summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2007-03-03 20:29:25 +0000
committerjhurst <>2007-03-03 20:29:25 +0000
commit49e1347e14c2ea6ee69d7f879d2d05448da50403 (patch)
tree29fe28eb1a9353f4c6a394bf656a9178963db922 /src
parentd3fc58a004ab9ae9bbbb1ac7174fa00465563a90 (diff)
added new methods
Diffstat (limited to 'src')
-rwxr-xr-xsrc/KM_util.cpp14
-rwxr-xr-xsrc/KM_util.h2
2 files changed, 16 insertions, 0 deletions
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
diff --git a/src/KM_util.h b/src/KM_util.h
index 6b2e78e..dbbdedf 100755
--- a/src/KM_util.h
+++ b/src/KM_util.h
@@ -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; }