diff options
author | Michi Henning <michi@zeroc.com> | 2004-04-01 05:02:02 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2004-04-01 05:02:02 +0000 |
commit | 5953a354aed4513ae3aad4d4ec03ca8d750277fd (patch) | |
tree | 35ab559f7d33ce0c7e47871fd4907d709d8725c3 /cpp/src | |
parent | fix (diff) | |
download | ice-5953a354aed4513ae3aad4d4ec03ca8d750277fd.tar.bz2 ice-5953a354aed4513ae3aad4d4ec03ca8d750277fd.tar.xz ice-5953a354aed4513ae3aad4d4ec03ca8d750277fd.zip |
Fixed bug in code generator for sequences of structs.
Diffstat (limited to 'cpp/src')
-rwxr-xr-x | cpp/src/Slice/CsUtil.cpp | 24 | ||||
-rwxr-xr-x | cpp/src/slice2cs/Gen.cpp | 2 |
2 files changed, 25 insertions, 1 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp index 7a8713cc3e7..4a29dc6cb94 100755 --- a/cpp/src/Slice/CsUtil.cpp +++ b/cpp/src/Slice/CsUtil.cpp @@ -600,6 +600,30 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, return; } + StructPtr st = StructPtr::dynamicCast(type); + if(st) + { + if(marshal) + { + out << nl << stream << ".writeSize(" << param << ".Count);"; + out << nl << "for(int __i = 0; __i < " << param << ".Count; ++__i)"; + out << sb; + out << nl << param << "[__i].__write(" << stream << ");"; + out << eb; + } + else + { + out << nl << "int sz = " << stream << ".readSize();"; + out << nl << "for(int __i = 0; __i < " << param << ".Count; ++__i)"; + out << sb; + string typeS = typeToString(st); + out << nl << param << ".Add(new " << typeS << "());"; + out << nl << param << "[__i].__read(" << stream << ");"; + out << eb; + } + return; + } + EnumPtr en = EnumPtr::dynamicCast(type); if(en) diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 7fbf47261cb..269352b25dc 100755 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -2527,7 +2527,7 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p) _out << sp << nl << "public static " << typeS << " read(IceInternal.BasicStream __is)"; _out << sb; - _out << nl << typeS << " __v;"; + _out << nl << typeS << " __v = new " << typeS << "();"; writeSequenceMarshalUnmarshalCode(_out, p, "__v", false, false); _out << nl << "return __v;"; _out << eb; |