Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59437 - trunk/libs/program_options/src
From: s.ochsenknecht_at_[hidden]
Date: 2010-02-03 03:26:36


Author: s_ochsenknecht
Date: 2010-02-03 03:26:35 EST (Wed, 03 Feb 2010)
New Revision: 59437
URL: http://svn.boost.org/trac/boost/changeset/59437

Log:
fix in winmain, Fixes #3879
Text files modified:
   trunk/libs/program_options/src/winmain.cpp | 6 +++++-
   1 files changed, 5 insertions(+), 1 deletions(-)

Modified: trunk/libs/program_options/src/winmain.cpp
==============================================================================
--- trunk/libs/program_options/src/winmain.cpp (original)
+++ trunk/libs/program_options/src/winmain.cpp 2010-02-03 03:26:35 EST (Wed, 03 Feb 2010)
@@ -30,6 +30,7 @@
    
             std::string current;
             bool inside_quoted = false;
+ bool empty_quote = false;
             int backslash_count = 0;
             
             for(; i != e; ++i) {
@@ -38,6 +39,7 @@
                     // n/2 backslashes and is a quoted block delimiter
                     if (backslash_count % 2 == 0) {
                         current.append(backslash_count / 2, '\\');
+ empty_quote = inside_quoted && current.empty();
                         inside_quoted = !inside_quoted;
                         // '"' preceded by odd number (n) of backslashes generates
                         // (n-1)/2 backslashes and is literal quote.
@@ -59,6 +61,7 @@
                         // Space outside quoted section terminate the current argument
                         result.push_back(current);
                         current.resize(0);
+ empty_quote = false;
                         for(;i != e && isspace((unsigned char)*i); ++i)
                             ;
                         --i;
@@ -74,7 +77,7 @@
         
             // If we have non-empty 'current' or we're still in quoted
             // section (even if 'current' is empty), add the last token.
- if (!current.empty() || inside_quoted)
+ if (!current.empty() || inside_quoted || empty_quote)
                 result.push_back(current);
         }
         return result;
@@ -94,3 +97,4 @@
 
 }}
 #endif
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk