From afec9aa66facbfac3812a5dcc3f43bf308beb274 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Wed, 12 Dec 2012 14:47:15 +0100 Subject: [PATCH] Ignore empty modifiers (thanks to Mehmet Bozkurt). --- src/disposition.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/disposition.cpp b/src/disposition.cpp index 24a45798..4edc61ce 100644 --- a/src/disposition.cpp +++ b/src/disposition.cpp @@ -300,13 +300,22 @@ void disposition::generateImpl(utility::outputStream& os, const string::size_typ if (m_modifiers.size() >= 1) { - os << "/" << m_modifiers[0]; - pos += 1 + m_modifiers[0].length(); - - for (std::vector ::size_type i = 1 ; i < m_modifiers.size() ; ++i) + for (std::vector ::size_type i = 1, n = 0 ; i < m_modifiers.size() ; ++i) { - os << "," << m_modifiers[i]; - pos += 1 + m_modifiers[i].length(); + const string mod = utility::stringUtils::trim(m_modifiers[i]); + + if (!mod.empty()) + { + if (n == 0) + os << "/"; + else + os << ","; + + os << mod; + pos += 1 + mod.length(); + + ++n; + } } }