summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rwxr-xr-xcpp/src/Slice/CsUtil.cpp24
-rwxr-xr-xcpp/src/slice2cs/Gen.cpp2
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;