diff options
author | Michi Henning <michi@zeroc.com> | 2005-06-08 06:05:46 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2005-06-08 06:05:46 +0000 |
commit | 393ef0827d68a6f0d425116adcd1f91b1dbe34f4 (patch) | |
tree | 40b716e18776d23c88dac542073c23b7ea4b2101 /cpp/src/Slice/PythonUtil.cpp | |
parent | Fixed bug reported in (diff) | |
download | ice-393ef0827d68a6f0d425116adcd1f91b1dbe34f4.tar.bz2 ice-393ef0827d68a6f0d425116adcd1f91b1dbe34f4.tar.xz ice-393ef0827d68a6f0d425116adcd1f91b1dbe34f4.zip |
Fixed but reported in http://www.zeroc.com/vbulletin/showthread.php?t=1480
Diffstat (limited to 'cpp/src/Slice/PythonUtil.cpp')
-rw-r--r-- | cpp/src/Slice/PythonUtil.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 6f4beebf727..46aa7ceebc5 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -1260,15 +1260,11 @@ Slice::Python::CodeVisitor::visitConst(const ConstPtr& p) static const string basicSourceChars = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789" - "_{}[]#()<>%:;,?*+=/^&|~!=, '"; + "_{}[]#()<>%:;.?*+-/^&|~!=, '"; static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end()); _out << "\""; // Opening " - ios_base::fmtflags originalFlags = _out.flags(); // Save stream state - streamsize originalWidth = _out.width(); - ostream::char_type originalFill = _out.fill(); - for(string::const_iterator c = value.begin(); c != value.end(); ++c) { switch(*c) @@ -1313,11 +1309,13 @@ Slice::Python::CodeVisitor::visitConst(const ConstPtr& p) if(charSet.find(*c) == charSet.end()) { unsigned char uc = *c; // Char may be signed, so make it positive. - _out << "\\"; // Print as octal if not in basic source character set. - _out.flags(ios_base::oct); - _out.width(3); - _out.fill('0'); - _out << static_cast<unsigned>(uc); + stringstream s; + s << "\\"; // Print as octal if not in basic source character set. + s.flags(ios_base::oct); + s.width(3); + s.fill('0'); + s << static_cast<unsigned>(uc); + _out << s.str(); } else { @@ -1328,10 +1326,6 @@ Slice::Python::CodeVisitor::visitConst(const ConstPtr& p) } } - _out.fill(originalFill); // Restore stream state - _out.width(originalWidth); - _out.flags(originalFlags); - _out << "\""; // Closing " break; } |