From 66bf1a7f2d0d46281ebf3d62caab6b9158eaa8a0 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Wed, 23 Jan 2013 14:36:10 +0100 Subject: Fix for ICE-4841 - added no copy option when creating input stream --- cpp/src/slice2freeze/Main.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'cpp/src/slice2freeze/Main.cpp') diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp index a42d692297c..d16c8213653 100644 --- a/cpp/src/slice2freeze/Main.cpp +++ b/cpp/src/slice2freeze/Main.cpp @@ -360,14 +360,11 @@ writeCodecC(const TypePtr& type, const StringList& metaData, const string& name, << "const Ice::EncodingVersion& encoding)"; C << sb; C << nl << "IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);"; - C << nl << "IceInternal::BasicStream stream(instance.get(), encoding, true);"; + C << nl << "IceInternal::BasicStream stream(instance.get(), encoding, &bytes[0], &bytes[0] + bytes.size());"; if(type->usesClasses()) { C << nl << "stream.sliceObjects(false);"; } - C << nl << "stream.b.resize(bytes.size());"; - C << nl << "::memcpy(&stream.b[0], &bytes[0], bytes.size());"; - C << nl << "stream.i = stream.b.begin();"; if(encaps) { C << nl << "stream.startReadEncaps();"; @@ -754,11 +751,9 @@ writeDictWithIndicesC(const string& name, const string& absolute, const Dict& di else { C << nl << "IceInternal::InstancePtr __instance = IceInternal::getInstance(__communicator);"; - C << nl << "IceInternal::BasicStream __stream(__instance.get(), __encoding, true);"; + C << nl << "IceInternal::BasicStream __stream(__instance.get(), __encoding, "; + C << "&__bytes[0], &__bytes[0] + __bytes.size());"; - C << nl << "__stream.b.resize(__bytes.size());"; - C << nl << "::memcpy(&__stream.b[0], &__bytes[0], __bytes.size());"; - C << nl << "__stream.i = __stream.b.begin();"; writeMarshalUnmarshalCode(C, indexTypes[i].type, false, 0, "__index", false, indexTypes[i].metaData, 0, "__stream", false); } -- cgit v1.2.3