Lots of progress on indefinite lengths; refactor decoder to get of weird semi-recursion
diff --git a/src/UsefulBuf.c b/src/UsefulBuf.c
index 323e173..3aa6406 100644
--- a/src/UsefulBuf.c
+++ b/src/UsefulBuf.c
@@ -93,6 +93,18 @@
return((UsefulBufC){Dest.ptr, Src.len});
}
+
+UsefulBufC UsefulBuf_CopyOffset(UsefulBuf Dest, size_t uOffset, const UsefulBufC Src)
+{
+ if(Src.len > Dest.len - uOffset) {
+ return NULLUsefulBufC;
+ }
+
+ memcpy(Dest.ptr + uOffset, Src.ptr, Src.len);
+
+ return((UsefulBufC){Dest.ptr, Src.len});
+}
+
/*
Public function -- see UsefulBuf.h
*/
@@ -170,6 +182,7 @@
// The following check fails on ThreadX
#if 0
+ // TODO: fix this for new way of doing storage
// Sanity check on the pointer and size to be sure we are not
// passed a buffer that goes off the end of the address space.
// Given this test, we know that all unsigned lengths less than