From 177f4410d8b5133d2d34e481df30cb2ccdb2c519 Mon Sep 17 00:00:00 2001 From: Marc Laukien Date: Mon, 10 Jun 2002 23:15:34 +0000 Subject: more fixes --- cpp/src/slice2cpp/Gen.cpp | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'cpp/src/slice2cpp/Gen.cpp') 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();"; -- cgit v1.2.3