summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/OutputStream.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2016-02-05 16:25:26 +0100
committerBenoit Foucher <benoit@zeroc.com>2016-02-05 16:25:26 +0100
commit3cfb37df79a86ff279bee8e57bbe8105ec7edd5e (patch)
treede6e4384041940a162d2bf6711359186bc4240dd /cpp/src/Ice/OutputStream.cpp
parentFix for java8 compilation failure (diff)
downloadice-3cfb37df79a86ff279bee8e57bbe8105ec7edd5e.tar.bz2
ice-3cfb37df79a86ff279bee8e57bbe8105ec7edd5e.tar.xz
ice-3cfb37df79a86ff279bee8e57bbe8105ec7edd5e.zip
Updated Objective-C mapping to use new stream classes
Diffstat (limited to 'cpp/src/Ice/OutputStream.cpp')
-rw-r--r--cpp/src/Ice/OutputStream.cpp24
1 files changed, 7 insertions, 17 deletions
diff --git a/cpp/src/Ice/OutputStream.cpp b/cpp/src/Ice/OutputStream.cpp
index 1f784ad3675..318f411cc4a 100644
--- a/cpp/src/Ice/OutputStream.cpp
+++ b/cpp/src/Ice/OutputStream.cpp
@@ -79,11 +79,6 @@ Ice::OutputStream::OutputStream() :
_format(CompactFormat),
_currentEncaps(0)
{
- //
- // Initialize the encoding member of our pre-allocated encapsulation, in case
- // this stream is used without an explicit encapsulation.
- //
- _preAllocatedEncaps.encoding = _encoding;
}
Ice::OutputStream::OutputStream(const CommunicatorPtr& communicator) :
@@ -111,16 +106,15 @@ void
Ice::OutputStream::initialize(const CommunicatorPtr& communicator)
{
assert(communicator);
- InstancePtr instance = getInstance(communicator);
- initialize(instance.get(), instance->defaultsAndOverrides()->defaultEncoding);
+ Instance* instance = getInstance(communicator).get();
+ initialize(instance, instance->defaultsAndOverrides()->defaultEncoding);
}
void
Ice::OutputStream::initialize(const CommunicatorPtr& communicator, const EncodingVersion& encoding)
{
assert(communicator);
- InstancePtr instance = getInstance(communicator);
- initialize(instance.get(), encoding);
+ initialize(getInstance(communicator).get(), encoding);
}
void
@@ -135,12 +129,6 @@ Ice::OutputStream::initialize(Instance* instance, const EncodingVersion& encodin
_wstringConverter = _instance->getWstringConverter();
_format = _instance->defaultsAndOverrides()->defaultFormat;
-
- //
- // Initialize the encoding member of our pre-allocated encapsulation, in case
- // this stream is used without an explicit encapsulation.
- //
- _preAllocatedEncaps.encoding = encoding;
}
void
@@ -184,11 +172,12 @@ Ice::OutputStream::setClosure(void* p)
void
Ice::OutputStream::swap(OutputStream& other)
{
- assert(_instance == other._instance);
-
swapBuffer(other);
+ std::swap(_instance, other._instance);
std::swap(_closure, other._closure);
+ std::swap(_encoding, other._encoding);
+ std::swap(_format, other._format);
//
// Swap is never called for streams that have encapsulations being written. However,
@@ -877,6 +866,7 @@ Ice::OutputStream::initEncaps()
{
_currentEncaps = &_preAllocatedEncaps;
_currentEncaps->start = b.size();
+ _currentEncaps->encoding = _encoding;
}
if(_currentEncaps->format == Ice::DefaultFormat)