summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rwxr-xr-xcpp/src/Slice/CsUtil.cpp9
-rwxr-xr-xcpp/src/slice2cs/Gen.cpp2
2 files changed, 9 insertions, 2 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp
index 063f91883d2..ae4575cfe7a 100755
--- a/cpp/src/Slice/CsUtil.cpp
+++ b/cpp/src/Slice/CsUtil.cpp
@@ -597,12 +597,12 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else
{
+ out << sb;
out << nl << "int sz = " << stream << ".readSize();";
out << nl << stream << ".startSeq(sz, " << static_cast<unsigned>(type->minWireSize()) << ");";
- out << nl << param << " = new ";
if(isArray)
{
- out << nl << param << " = new " << typeS << "[sz];";
+ out << nl << param << " = new " << typeS << "[sz]";
}
else
{
@@ -617,6 +617,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << stream << ".checkSeq();";
out << nl << stream << ".endElement();";
out << eb;
+ out << eb;
}
return;
}
@@ -634,6 +635,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else
{
+ out << sb;
out << nl << "int sz = " << stream << ".readSize();";
out << nl << stream << ".startSeq(sz, " << static_cast<unsigned>(type->minWireSize()) << ");";
out << nl << param << " = new ";
@@ -655,6 +657,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << stream << ".endElement();";
}
out << eb;
+ out << eb;
}
return;
}
@@ -673,6 +676,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else
{
+ out << sb;
out << nl << "int sz = " << stream << ".readSize();";
out << nl << stream << ".startSeq(sz, " << static_cast<unsigned>(type->minWireSize()) << ");";
out << nl << param << " = new ";
@@ -696,6 +700,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << param << ".Add((" << typeS << ')' << stream << ".readByte());";
}
out << eb;
+ out << eb;
}
return;
}
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index abfe1de6d59..4640b491018 100755
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -1211,7 +1211,9 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p)
patchParams << ", " << classMemberCount++;
}
}
+ _out << sb;
writeMarshalUnmarshalCode(_out, (*d)->type(), fixId((*d)->name()), false, false, patchParams.str());
+ _out << eb;
}
_out << nl << "__is.endReadSlice();";
_out << nl << "base.__read(__is, true);";