summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2005-02-23 19:21:43 +0000
committerMarc Laukien <marc@zeroc.com>2005-02-23 19:21:43 +0000
commit98a6af97e16a364f1b493e472fa0a80bd812cb41 (patch)
tree2c951cf2087fef0d368114cb86ad1e8c8e05423d /cpp/src
parentreplaced some of the perl in place editing with some python code to get (diff)
downloadice-98a6af97e16a364f1b493e472fa0a80bd812cb41.tar.bz2
ice-98a6af97e16a364f1b493e472fa0a80bd812cb41.tar.xz
ice-98a6af97e16a364f1b493e472fa0a80bd812cb41.zip
Buffer::Container
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Freeze/ObjectStore.cpp9
-rw-r--r--cpp/src/Ice/BasicStream.cpp14
-rw-r--r--cpp/src/Ice/StreamI.cpp13
-rw-r--r--cpp/src/slice2freeze/Main.cpp8
4 files changed, 11 insertions, 33 deletions
diff --git a/cpp/src/Freeze/ObjectStore.cpp b/cpp/src/Freeze/ObjectStore.cpp
index 57a2a2d8df9..dfbe0de1651 100644
--- a/cpp/src/Freeze/ObjectStore.cpp
+++ b/cpp/src/Freeze/ObjectStore.cpp
@@ -251,14 +251,13 @@ Freeze::ObjectStore::save(Key& key, Value& value, Byte status, DbTxn* tx)
}
}
-
void
Freeze::ObjectStore::marshal(const Identity& ident, Key& bytes, const CommunicatorPtr& communicator)
{
IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);
IceInternal::BasicStream stream(instance.get());
ident.__write(&stream);
- bytes.swap(stream.b);
+ stream.b.copyToVector(bytes);
}
void
@@ -266,7 +265,7 @@ Freeze::ObjectStore::unmarshal(Identity& ident, const Key& bytes, const Communic
{
IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);
IceInternal::BasicStream stream(instance.get());
- stream.b = bytes;
+ stream.b.copyFromVector(bytes);
stream.i = stream.b.begin();
ident.__read(&stream);
}
@@ -280,7 +279,7 @@ Freeze::ObjectStore::marshal(const ObjectRecord& v, Value& bytes, const Communic
v.__write(&stream);
stream.writePendingObjects();
stream.endWriteEncaps();
- bytes.swap(stream.b);
+ stream.b.copyToVector(bytes);
}
void
@@ -289,7 +288,7 @@ Freeze::ObjectStore::unmarshal(ObjectRecord& v, const Value& bytes, const Commun
IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);
IceInternal::BasicStream stream(instance.get());
stream.sliceObjects(false);
- stream.b = bytes;
+ stream.b.copyFromVector(bytes);
stream.i = stream.b.begin();
stream.startReadEncaps();
v.__read(&stream);
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index 96a8812b402..41681accfbf 100644
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -93,8 +93,7 @@ IceInternal::BasicStream::swap(BasicStream& other)
{
assert(_instance == other._instance);
- b.swap(other.b);
- std::swap(i, other.i);
+ Buffer::swap(other);
//
// Swap is never called for BasicStreams that have more than one
@@ -141,17 +140,6 @@ IceInternal::BasicStream::swap(BasicStream& other)
std::swap(_objectList, other._objectList);
}
-void
-IceInternal::BasicStream::reserve(Container::size_type sz)
-{
- if(sz > _messageSizeMax)
- {
- throw MemoryLimitException(__FILE__, __LINE__);
- }
-
- b.reserve(sz);
-}
-
//
// startSeq() and endSeq() sanity-check sequence sizes during
// unmarshaling and prevent malicious messages with incorrect sequence
diff --git a/cpp/src/Ice/StreamI.cpp b/cpp/src/Ice/StreamI.cpp
index 951d8ac724c..5dda15a3b30 100644
--- a/cpp/src/Ice/StreamI.cpp
+++ b/cpp/src/Ice/StreamI.cpp
@@ -35,17 +35,8 @@ IceInternal::BasicOutputStream::BasicOutputStream(IceInternal::Instance* instanc
Ice::InputStreamI::InputStreamI(const Ice::CommunicatorPtr& communicator, const vector<Byte>& data) :
_communicator(communicator), _is(IceInternal::getInstance(communicator).get(), this)
{
-#if defined(__SUNPRO_CC)
- //
- // COMPILERFIX: No idea why Sun CC needs this.
- //
- vector<Byte> copy = data;
- _is.b.swap(copy);
+ _is.b.copyFromVector(data);
_is.i = _is.b.begin();
-#else
- _is.b = data;
- _is.i = _is.b.begin();
-#endif
}
Ice::InputStreamI::~InputStreamI()
@@ -450,7 +441,7 @@ Ice::OutputStreamI::writePendingObjects()
void
Ice::OutputStreamI::finished(vector<Byte>& bytes)
{
- bytes.swap(_os.b);
+ _os.b.copyToVector(bytes);
}
//
diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp
index 14947845fa7..46f94c52479 100644
--- a/cpp/src/slice2freeze/Main.cpp
+++ b/cpp/src/slice2freeze/Main.cpp
@@ -169,7 +169,7 @@ writeCodecC(const TypePtr& type, const string& name, const string& freezeType, b
{
C << nl << "stream.endWriteEncaps();";
}
- C << nl << "bytes.swap(stream.b);";
+ C << nl << "stream.b.copyToVector(bytes);";
C << eb;
C << sp << nl << "void" << nl << name << "::read(" << typeToString(type) << "& v, "
@@ -181,7 +181,7 @@ writeCodecC(const TypePtr& type, const string& name, const string& freezeType, b
{
C << nl << "stream.sliceObjects(false);";
}
- C << nl << "stream.b = bytes;";
+ C << nl << "stream.b.copyFromVector(bytes);";
C << nl << "stream.i = stream.b.begin();";
if(encaps)
{
@@ -468,7 +468,7 @@ writeDictWithIndicesC(const string& name, const string& absolute, const Dict& di
{
C << nl << "__stream.writePendingObjects();";
}
- C << nl << "__bytes.swap(__stream.b);";
+ C << nl << "__stream.b.copyToVector(__bytes);";
}
C << eb;
}
@@ -850,7 +850,7 @@ writeIndexC(const TypePtr& type, const TypePtr& memberType, const string& member
{
C << nl << "__stream.writePendingObjects();";
}
- C << nl << "__bytes.swap(__stream.b);";
+ C << nl << "__stream.b.copyToVector(__bytes);";
C << eb;
}