Skip to content

Commit af37add

Browse files
author
Sascha Ochsenknecht
committed
fix in winmain, Fixes #3879
[SVN r59437]
1 parent 85b2b1c commit af37add

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/winmain.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ namespace boost { namespace program_options {
3030

3131
std::string current;
3232
bool inside_quoted = false;
33+
bool empty_quote = false;
3334
int backslash_count = 0;
3435

3536
for(; i != e; ++i) {
@@ -38,6 +39,7 @@ namespace boost { namespace program_options {
3839
// n/2 backslashes and is a quoted block delimiter
3940
if (backslash_count % 2 == 0) {
4041
current.append(backslash_count / 2, '\\');
42+
empty_quote = inside_quoted && current.empty();
4143
inside_quoted = !inside_quoted;
4244
// '"' preceded by odd number (n) of backslashes generates
4345
// (n-1)/2 backslashes and is literal quote.
@@ -59,6 +61,7 @@ namespace boost { namespace program_options {
5961
// Space outside quoted section terminate the current argument
6062
result.push_back(current);
6163
current.resize(0);
64+
empty_quote = false;
6265
for(;i != e && isspace((unsigned char)*i); ++i)
6366
;
6467
--i;
@@ -74,7 +77,7 @@ namespace boost { namespace program_options {
7477

7578
// If we have non-empty 'current' or we're still in quoted
7679
// section (even if 'current' is empty), add the last token.
77-
if (!current.empty() || inside_quoted)
80+
if (!current.empty() || inside_quoted || empty_quote)
7881
result.push_back(current);
7982
}
8083
return result;
@@ -94,3 +97,4 @@ namespace boost { namespace program_options {
9497

9598
}}
9699
#endif
100+

0 commit comments

Comments
 (0)