diff options
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 30 | ||||
-rw-r--r-- | cpp/src/slice2cppe/Gen.cpp | 22 | ||||
-rwxr-xr-x | cpp/src/slice2cs/Gen.cpp | 22 | ||||
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 12 | ||||
-rw-r--r-- | cpp/src/slice2javae/Gen.cpp | 12 | ||||
-rwxr-xr-x | cpp/src/slice2vb/Gen.cpp | 2 |
6 files changed, 43 insertions, 57 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; 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) diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 4d6ad7d09b2..89ec7724928 100755 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -2783,26 +2783,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()); _out << "\""; // Opening " - ios_base::fmtflags originalFlags = _out.flags(); // Save stream state - streamsize originalWidth = _out.width(); - ostream::char_type originalFill = _out.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 - _out << "\\u"; // Print as unicode if not in basic source character set - _out.flags(ios_base::hex); - _out.width(4); - _out.fill('0'); - _out << static_cast<unsigned>(uc); + ostringstream s; + s << "\\u"; // Print as unicode if not in basic source character set + s << hex; + s.width(4); + s.fill('0'); + s << static_cast<unsigned>(uc); + _out << s.str(); } else { @@ -2810,10 +2808,6 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p) } } - _out.fill(originalFill); // Restore stream state - _out.width(originalWidth); - _out.flags(originalFlags); - _out << "\""; // Closing " } else if(bp && bp->kind() == Builtin::KindLong) diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 004987f7310..90ee4cae3f6 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -2536,11 +2536,13 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p) default: { unsigned char uc = *c; - out << "\\u"; - out.flags(ios_base::hex); - out.width(4); - out.fill('0'); - out << static_cast<unsigned>(uc); + ostringstream s; + s << "\\u"; + s.flags(ios_base::hex); + s.width(4); + s.fill('0'); + s << static_cast<unsigned>(uc); + out << s.str(); break; } } diff --git a/cpp/src/slice2javae/Gen.cpp b/cpp/src/slice2javae/Gen.cpp index fd64ee4c003..194ef82bccd 100644 --- a/cpp/src/slice2javae/Gen.cpp +++ b/cpp/src/slice2javae/Gen.cpp @@ -1813,11 +1813,13 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p) default: { unsigned char uc = *c; - out << "\\u"; - out.flags(ios_base::hex); - out.width(4); - out.fill('0'); - out << static_cast<unsigned>(uc); + ostringstream s; + s << "\\u"; + s.flags(ios_base::hex); + s.width(4); + s.fill('0'); + s << static_cast<unsigned>(uc); + out << s.str(); break; } } diff --git a/cpp/src/slice2vb/Gen.cpp b/cpp/src/slice2vb/Gen.cpp index 83d3b867377..42c721aa69a 100755 --- a/cpp/src/slice2vb/Gen.cpp +++ b/cpp/src/slice2vb/Gen.cpp @@ -3084,7 +3084,7 @@ Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p) static const string basicStringChars = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789" - "_{}[]#()<>%:;,?*+=/^&|~!=,\\'\" \t"; + "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' "; static const set<char> charSet(basicStringChars.begin(), basicStringChars.end()); enum Position { Beginning, InString, NotInString }; |