summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rwxr-xr-xcpp/src/slice2cs/Gen.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index 205332e6e87..24df02af591 100755
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -326,9 +326,17 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream)
if(!isClass)
{
_out << nl << typeS << ' ' << param << ';';
- if(StructPtr::dynamicCast(q->first) && !isValueType(q->first))
+ StructPtr st = StructPtr::dynamicCast(q->first);
+ if(st)
{
- _out << nl << param << " = null;";
+ if(isValueType(q->first))
+ {
+ _out << nl << param << " = new " << typeS << "();";
+ }
+ else
+ {
+ _out << nl << param << " = null;";
+ }
}
}
writeMarshalUnmarshalCode(_out, q->first, param, false, false, true);
@@ -453,9 +461,17 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream)
if(!isClass)
{
_out << nl << typeS << ' ' << param << ';';
- if(StructPtr::dynamicCast(q->first) && !isValueType(q->first))
+ StructPtr st = StructPtr::dynamicCast(q->first);
+ if(st)
{
- _out << nl << param << " = null;";
+ if(isValueType(q->first))
+ {
+ _out << nl << param << " = new " << typeS << "();";
+ }
+ else
+ {
+ _out << nl << param << " = null;";
+ }
}
}
writeMarshalUnmarshalCode(_out, q->first, fixId(q->second), false, false, true);