summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Slice/CsUtil.cpp4
-rw-r--r--cpp/src/Slice/ObjCUtil.cpp21
-rw-r--r--cpp/src/slice2cs/Gen.cpp14
3 files changed, 29 insertions, 10 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp
index be424b7b67b..c72137ae53c 100644
--- a/cpp/src/Slice/CsUtil.cpp
+++ b/cpp/src/Slice/CsUtil.cpp
@@ -643,8 +643,8 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
{
if(!isValueType(st))
{
- const string read = streamingAPI ? "ice_readNew" : "readNew__";
- out << nl << param << " = " << typeToString(type) << "." << read << "(" << stream << ");";
+ const string r = streamingAPI ? "ice_read" : "read__";
+ out << nl << param << " = " << typeToString(type) << "." << r << "(" << stream << ", " << param << ");";
}
else
{
diff --git a/cpp/src/Slice/ObjCUtil.cpp b/cpp/src/Slice/ObjCUtil.cpp
index e449ea87539..77a2d627ece 100644
--- a/cpp/src/Slice/ObjCUtil.cpp
+++ b/cpp/src/Slice/ObjCUtil.cpp
@@ -848,13 +848,27 @@ Slice::ObjCGenerator::writeMarshalUnmarshalCode(Output &out, const TypePtr& type
}
else
{
- if(autoreleased)
+ if(StructPtr::dynamicCast(type))
{
- out << nl << param << " = [" << name << " read:" << stream << "];";
+ if(autoreleased)
+ {
+ out << nl << param << " = [" << name << " read:" << stream << " value:" << param << "];";
+ }
+ else
+ {
+ out << nl << param << " = [" << name << " readRetained:" << stream << " value:" << param << "];";
+ }
}
else
{
- out << nl << param << " = [" << name << " readRetained:" << stream << "];";
+ if(autoreleased)
+ {
+ out << nl << param << " = [" << name << " read:" << stream << "];";
+ }
+ else
+ {
+ out << nl << param << " = [" << name << " readRetained:" << stream << "];";
+ }
}
}
}
@@ -1294,4 +1308,3 @@ Slice::ObjCGenerator::MetaDataVisitor::modulePrefixError(const ModulePtr& m, con
os << " as `" << mp.name << "'" << endl;
emitWarning(file, line, os.str());
}
-
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;