summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2006-02-10 13:15:28 +0000
committerDwayne Boone <dwayne@zeroc.com>2006-02-10 13:15:28 +0000
commit75b0b75699c3e46c27bafc0fe8c9c9419aec4f00 (patch)
tree4ab90f49cd0c4166137cbc891c9a0d1fbe64661f /cpp/src
parentFixed path for slice2cpp.exe (diff)
downloadice-75b0b75699c3e46c27bafc0fe8c9c9419aec4f00.tar.bz2
ice-75b0b75699c3e46c27bafc0fe8c9c9419aec4f00.tar.xz
ice-75b0b75699c3e46c27bafc0fe8c9c9419aec4f00.zip
Added zero copy readBlob
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/BasicStream.cpp19
-rw-r--r--cpp/src/Ice/ConnectionI.cpp12
-rw-r--r--cpp/src/Ice/ThreadPool.cpp6
3 files changed, 28 insertions, 9 deletions
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index fb764309bb0..c81d2aa552f 100644
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -705,6 +705,25 @@ IceInternal::BasicStream::readBlob(Ice::Byte* v, Container::size_type sz)
}
void
+IceInternal::BasicStream::readBlob(pair<const Byte*, const Byte*>& v, Int sz)
+{
+ if(sz > 0)
+ {
+ if(b.end() - i < sz)
+ {
+ throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ v.first = i;
+ v.second = i + sz;
+ i += sz;
+ }
+ else
+ {
+ v.first = v.second = 0;
+ }
+}
+
+void
IceInternal::BasicStream::write(const Byte* begin, const Byte* end)
{
Int sz = static_cast<Int>(end - begin);
diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp
index 7cd959f8500..9504acde619 100644
--- a/cpp/src/Ice/ConnectionI.cpp
+++ b/cpp/src/Ice/ConnectionI.cpp
@@ -148,12 +148,12 @@ Ice::ConnectionI::validate()
}
assert(is.i == is.b.end());
is.i = is.b.begin();
- ByteSeq m(sizeof(magic), 0);
+ pair<const Byte*, const Byte*> m;
is.readBlob(m, static_cast<Int>(sizeof(magic)));
- if(!equal(m.begin(), m.end(), magic))
+ if(!equal(m.first, m.second, magic))
{
BadMagicException ex(__FILE__, __LINE__);
- ex.badMagic = m;
+ ex.badMagic = vector<Byte>(m.first, m.second);
throw ex;
}
Byte pMajor;
@@ -2359,12 +2359,12 @@ Ice::ConnectionI::run()
ptrdiff_t pos = stream.i - stream.b.begin();
assert(pos >= headerSize);
stream.i = stream.b.begin();
- ByteSeq m(sizeof(magic), 0);
+ pair<const Byte*, const Byte*> m;
stream.readBlob(m, static_cast<Int>(sizeof(magic)));
- if(!equal(m.begin(), m.end(), magic))
+ if(!equal(m.first, m.second, magic))
{
BadMagicException ex(__FILE__, __LINE__);
- ex.badMagic = m;
+ ex.badMagic = vector<Byte>(m.first, m.second);
throw ex;
}
Byte pMajor;
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp
index 7b9f6fbbe8e..ec0e7e3b6b5 100644
--- a/cpp/src/Ice/ThreadPool.cpp
+++ b/cpp/src/Ice/ThreadPool.cpp
@@ -757,12 +757,12 @@ IceInternal::ThreadPool::read(const EventHandlerPtr& handler)
ptrdiff_t pos = stream.i - stream.b.begin();
assert(pos >= headerSize);
stream.i = stream.b.begin();
- ByteSeq m(sizeof(magic), 0);
+ pair<const Byte*, const Byte*> m;
stream.readBlob(m, static_cast<Int>(sizeof(magic)));
- if(!equal(m.begin(), m.end(), magic))
+ if(!equal(m.first, m.second, magic))
{
BadMagicException ex(__FILE__, __LINE__);
- ex.badMagic = m;
+ ex.badMagic = vector<Byte>(m.first, m.second);
throw ex;
}
Byte pMajor;