From 393ef0827d68a6f0d425116adcd1f91b1dbe34f4 Mon Sep 17 00:00:00 2001 From: Michi Henning Date: Wed, 8 Jun 2005 06:05:46 +0000 Subject: Fixed but reported in http://www.zeroc.com/vbulletin/showthread.php?t=1480 --- cpp/src/Slice/PythonUtil.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'cpp/src/Slice/PythonUtil.cpp') 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 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(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(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; } -- cgit v1.2.3