added new methods
authorjhurst <jhurst@cinecert.com>
Sat, 3 Mar 2007 20:29:25 +0000 (20:29 +0000)
committerjhurst <>
Sat, 3 Mar 2007 20:29:25 +0000 (20:29 +0000)
src/KM_util.cpp
src/KM_util.h

index 1d2cc114031db0969ae264bb133b4bf2bff748f7..82287390f609f3e0db40d6900928a3690ce087fb 100755 (executable)
@@ -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
index 6b2e78e9ec5b71a0ec3248cf34bdab28130939da..dbbdedf40a70f46e83f8de877f9fa80c0b989dce 100755 (executable)
@@ -203,6 +203,7 @@ namespace Kumu
       }
 
       inline void Set(const byte_t* value) { m_HasValue = true; memcpy(m_Value, value, SIZE); }
+      inline void Reset() { m_HasValue = false; memset(m_Value, 0, SIZE); }
       inline const byte_t* Value() const { return m_Value; }
       inline ui32_t Size() const { return SIZE; }
 
@@ -395,6 +396,7 @@ namespace Kumu
       // copy the given data into the ByteString, set Length value.
       // Returns error if the ByteString is too small.
       Result_t Set(const byte_t* buf, ui32_t buf_len);
+      Result_t Set(const ByteString& Buf);
 
       inline virtual bool HasValue() const { return m_Length > 0; }