summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp/Gen.cpp
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/slice2cpp/Gen.cpp
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/slice2cpp/Gen.cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index a3c5ba96964..0c6b3aa6c6d 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -1132,26 +1132,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.width(3);
+ s.fill('0');
+ s << oct;
+ s << static_cast<unsigned>(uc);
+ H << s.str();
}
else
{
@@ -1159,10 +1157,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)
@@ -3065,7 +3059,7 @@ Slice::Gen::ObjectVisitor::emitGCInsertCode(const TypePtr& p, const string& pref
else if(DictionaryPtr d = DictionaryPtr::dynamicCast(p))
{
string scoped = fixKwd(d->scoped());
- stringstream tmp;
+ ostringstream tmp;
tmp << "_i" << level;
string iterName = tmp.str();
C << sb;
@@ -3079,7 +3073,7 @@ Slice::Gen::ObjectVisitor::emitGCInsertCode(const TypePtr& p, const string& pref
else if(SequencePtr s = SequencePtr::dynamicCast(p))
{
string scoped = fixKwd(s->scoped());
- stringstream tmp;
+ ostringstream tmp;
tmp << "_i" << level;
string iterName = tmp.str();
C << sb;
@@ -3118,7 +3112,7 @@ Slice::Gen::ObjectVisitor::emitGCClearCode(const TypePtr& p, const string& prefi
else if(DictionaryPtr d = DictionaryPtr::dynamicCast(p))
{
string scoped = fixKwd(d->scoped());
- stringstream tmp;
+ ostringstream tmp;
tmp << "_i" << level;
string iterName = tmp.str();
C << sb;
@@ -3132,7 +3126,7 @@ Slice::Gen::ObjectVisitor::emitGCClearCode(const TypePtr& p, const string& prefi
else if(SequencePtr s = SequencePtr::dynamicCast(p))
{
string scoped = fixKwd(s->scoped());
- stringstream tmp;
+ ostringstream tmp;
tmp << "_i" << level;
string iterName = tmp.str();
C << sb;