summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2002-06-10 23:15:34 +0000
committerMarc Laukien <marc@zeroc.com>2002-06-10 23:15:34 +0000
commit177f4410d8b5133d2d34e481df30cb2ccdb2c519 (patch)
treeb091f645cb8b3661186831954d6154cc319cf1ea /cpp/src/slice2cpp
parentfix (diff)
downloadice-177f4410d8b5133d2d34e481df30cb2ccdb2c519.tar.bz2
ice-177f4410d8b5133d2d34e481df30cb2ccdb2c519.tar.xz
ice-177f4410d8b5133d2d34e481df30cb2ccdb2c519.zip
more fixes
Diffstat (limited to 'cpp/src/slice2cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp28
1 files changed, 6 insertions, 22 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 6c246d63d50..860e69ff20c 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -651,17 +651,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
//
C << nl << "while (sz--)";
C << sb;
- C.zeroIndent();
- C << nl << "#ifdef _WIN32"; // STLBUG
- C.restoreIndent();
- C << nl << "v.push_back(" << typeToString(type) << "());";
- C.zeroIndent();
- C << nl << "#else";
- C.restoreIndent();
- C << nl << "v.push_back();";
- C.zeroIndent();
- C << nl << "#endif";
- C.restoreIndent();
+ C << nl << "v.resize(v.size() + 1);";
writeMarshalUnmarshalCode(C, type, "v.back()", false);
C << eb;
C << eb;
@@ -683,19 +673,13 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
<< "const ::Ice::StreamPtr& __is, " << scoped << "& v, " << scope << "__U__" << name << ')';
C << sb;
C << nl << "::Ice::Int sz = __is->startReadSequence(__name);";
+ //
+ // Don't use v.resize(sz) or v.reserve(sz) here, as it cannot
+ // be checked whether sz is a reasonable value.
+ //
C << nl << "while (sz--)";
C << sb;
- C.zeroIndent();
- C << nl << "#ifdef _WIN32"; // STLBUG
- C.restoreIndent();
- C << nl << "v.push_back(" << typeToString(type) << "());";
- C.zeroIndent();
- C << nl << "#else";
- C.restoreIndent();
- C << nl << "v.push_back();";
- C.zeroIndent();
- C << nl << "#endif";
- C.restoreIndent();
+ C << nl << "v.resize(v.size() + 1);";
writeGenericMarshalUnmarshalCode(C, type, "v.back()", false, "\"e\"");
C << eb;
C << nl << "__is->endReadSequence();";