From 49e1347e14c2ea6ee69d7f879d2d05448da50403 Mon Sep 17 00:00:00 2001 From: jhurst Date: Sat, 3 Mar 2007 20:29:25 +0000 Subject: added new methods --- src/KM_util.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/KM_util.cpp') diff --git a/src/KM_util.cpp b/src/KM_util.cpp index 1d2cc11..8228739 100755 --- a/src/KM_util.cpp +++ b/src/KM_util.cpp @@ -1026,6 +1026,20 @@ Kumu::ByteString::Set(const byte_t* buf, ui32_t buf_len) } +// copy the given data into the ByteString, set Length value. +// Returns error if the ByteString is too small. +Kumu::Result_t +Kumu::ByteString::Set(const ByteString& Buf) +{ + if ( m_Capacity < Buf.m_Capacity ) + return RESULT_ALLOC; + + memcpy(m_Data, Buf.m_Data, Buf.m_Length); + m_Length = Buf.m_Length; + return RESULT_OK; +} + + // Sets the size of the internally allocate buffer. // Resets content length to zero. Kumu::Result_t -- cgit v1.2.3