summaryrefslogtreecommitdiff
path: root/queue.cpp
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2003-06-06 02:34:03 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2003-06-06 02:34:03 +0000
commitaec493328f4cd1a6d717743c984a153dc120013a (patch)
tree22ac172cd2a9920b7d33711a25947c5c98e8cef2 /queue.cpp
parente3e0c6c7d2d37b902060ffefc27270675fbf246b (diff)
downloadcryptopp-aec493328f4cd1a6d717743c984a153dc120013a.tar.gz
sync with private branch
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@76 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'queue.cpp')
-rw-r--r--queue.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/queue.cpp b/queue.cpp
index b5ac16d..976bb0c 100644
--- a/queue.cpp
+++ b/queue.cpp
@@ -234,8 +234,18 @@ void ByteQueue::LazyPut(const byte *inString, unsigned int size)
{
if (m_lazyLength > 0)
FinalizeLazyPut();
+ m_lazyString = const_cast<byte *>(inString);
+ m_lazyLength = size;
+ m_lazyStringModifiable = false;
+}
+
+void ByteQueue::LazyPutModifiable(byte *inString, unsigned int size)
+{
+ if (m_lazyLength > 0)
+ FinalizeLazyPut();
m_lazyString = inString;
m_lazyLength = size;
+ m_lazyStringModifiable = true;
}
void ByteQueue::UndoLazyPut(unsigned int size)
@@ -309,7 +319,10 @@ unsigned int ByteQueue::TransferTo2(BufferedTransformation &target, unsigned lon
unsigned int len = (unsigned int)STDMIN(bytesLeft, (unsigned long)m_lazyLength);
if (len)
{
- target.ChannelPut(channel, m_lazyString, len);
+ if (m_lazyStringModifiable)
+ target.ChannelPutModifiable(channel, m_lazyString, len);
+ else
+ target.ChannelPut(channel, m_lazyString, len);
m_lazyString += len;
m_lazyLength -= len;
bytesLeft -= len;