types: Add a simple testcase for basic types and fix the LLC code
* Make append_data, remaining_space and fits_in_current.. work
on m_length and not the index. This ways things can't overflow.
* The current API consumer was moving the m_index so it should have
worked okay.
diff --git a/src/llc.cpp b/src/llc.cpp
index c0c517f..ae190b7 100644
--- a/src/llc.cpp
+++ b/src/llc.cpp
@@ -55,7 +55,7 @@
void gprs_llc::append_frame(const uint8_t *data, size_t len)
{
/* TODO: bounds check */
- memcpy(frame + m_index, data, len);
+ memcpy(frame + m_length, data, len);
m_length += len;
}
@@ -72,6 +72,7 @@
void gprs_llc::init()
{
INIT_LLIST_HEAD(&queue);
+ reset();
}
struct msgb *gprs_llc::dequeue()