diff options
author | Benoit Foucher <benoit@zeroc.com> | 2015-02-20 15:48:50 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2015-02-20 15:48:50 +0100 |
commit | 6912a3e2c742e0243130d989f558131f0c73b54e (patch) | |
tree | 708610eaf0d52e0d35fde0661a4ded595efe424a /cpp/src/slice2cs | |
parent | build fix (diff) | |
download | ice-6912a3e2c742e0243130d989f558131f0c73b54e.tar.bz2 ice-6912a3e2c742e0243130d989f558131f0c73b54e.tar.xz ice-6912a3e2c742e0243130d989f558131f0c73b54e.zip |
Additional fix for ICE-6268, fixed struct un-marshalling to not re-create the struct
Diffstat (limited to 'cpp/src/slice2cs')
-rw-r--r-- | cpp/src/slice2cs/Gen.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 6693a6fdc9f..e4d6460a81d 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -4374,9 +4374,12 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "public static " << name << " readNew__(IceInternal.BasicStream is__)"; + _out << nl << "public static " << name << " read__(IceInternal.BasicStream is__, " << name << " v__)"; _out << sb; - _out << nl << name << " v__ = new " << name << "();"; + _out << nl << "if(v__ == null)"; + _out << sb; + _out << nl << "v__ = new " << name << "();"; + _out << eb; _out << nl << "v__.read__(is__);"; _out << nl << "return v__;"; _out << eb; @@ -4423,9 +4426,12 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "public static " << name << " ice_readNew(Ice.InputStream inS__)"; + _out << nl << "public static " << name << " ice_read(Ice.InputStream inS__, " << name << " v__)"; _out << sb; - _out << nl << name << " v__ = new " << name << "();"; + _out << nl << "if(v__ == null)"; + _out << sb; + _out << nl << "v__ = new " << name << "();"; + _out << eb; _out << nl << "v__.ice_read(inS__);"; _out << nl << "return v__;"; _out << eb; |