From aec493328f4cd1a6d717743c984a153dc120013a Mon Sep 17 00:00:00 2001 From: weidai Date: Fri, 6 Jun 2003 02:34:03 +0000 Subject: sync with private branch git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@76 57ff6487-cd31-0410-9ec3-f628ee90f5f0 --- queue.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'queue.cpp') diff --git a/queue.cpp b/queue.cpp index b5ac16d..976bb0c 100644 --- a/queue.cpp +++ b/queue.cpp @@ -231,11 +231,21 @@ void ByteQueue::CleanupUsedNodes() } void ByteQueue::LazyPut(const byte *inString, unsigned int size) +{ + if (m_lazyLength > 0) + FinalizeLazyPut(); + m_lazyString = const_cast(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; -- cgit v1.2.1