summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cppe
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2005-06-08 05:45:24 +0000
committerMichi Henning <michi@zeroc.com>2005-06-08 05:45:24 +0000
commitfb8f3ba00fce45f779698266b750687db6756380 (patch)
treefb75f956d6b617e1e06a04a150ca6e7de1822c0f /cpp/src/slice2cppe
parentChanged optimization from -O2 to -O3 for FreeBSD. (diff)
downloadice-fb8f3ba00fce45f779698266b750687db6756380.tar.bz2
ice-fb8f3ba00fce45f779698266b750687db6756380.tar.xz
ice-fb8f3ba00fce45f779698266b750687db6756380.zip
Fixed bug reported in
http://www.zeroc.com/vbulletin/showthread.php?p=6308#post6308
Diffstat (limited to 'cpp/src/slice2cppe')
-rw-r--r--cpp/src/slice2cppe/Gen.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp
index 18dc268c802..6640e90eccb 100644
--- a/cpp/src/slice2cppe/Gen.cpp
+++ b/cpp/src/slice2cppe/Gen.cpp
@@ -827,26 +827,24 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
static const string basicSourceChars = "abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789"
- "_{}[]#()<>%:;,?*+=/^&|~!=,\\\"' \t";
+ "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' ";
static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end());
H << "\""; // Opening "
- ios_base::fmtflags originalFlags = H.flags(); // Save stream state
- streamsize originalWidth = H.width();
- ostream::char_type originalFill = H.fill();
-
const string val = p->value();
for(string::const_iterator c = val.begin(); c != val.end(); ++c)
{
if(charSet.find(*c) == charSet.end())
{
unsigned char uc = *c; // char may be signed, so make it positive
- H << "\\"; // Print as octal if not in basic source character set
- H.flags(ios_base::oct);
- H.width(3);
- H.fill('0');
- H << static_cast<unsigned>(uc);
+ ostringstream 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);
+ H << s.str();
}
else
{
@@ -854,10 +852,6 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p)
}
}
- H.fill(originalFill); // Restore stream state
- H.width(originalWidth);
- H.flags(originalFlags);
-
H << "\""; // Closing "
}
else if(bp && bp->kind() == Builtin::KindLong)