aboutsummaryrefslogtreecommitdiff
path: root/sibs
diff options
context:
space:
mode:
Diffstat (limited to 'sibs')
-rw-r--r--sibs/SafeDeserializer.hpp7
-rw-r--r--sibs/SafeSerializer.hpp5
2 files changed, 12 insertions, 0 deletions
diff --git a/sibs/SafeDeserializer.hpp b/sibs/SafeDeserializer.hpp
index 0110920..763140a 100644
--- a/sibs/SafeDeserializer.hpp
+++ b/sibs/SafeDeserializer.hpp
@@ -97,6 +97,13 @@ namespace sibs
{
return size;
}
+
+ void skip(usize bytesToSkip)
+ {
+ bytesToSkip = bytesToSkip < size ? bytesToSkip : size;
+ size -= bytesToSkip;
+ data += bytesToSkip;
+ }
private:
void verifyExtractSize(usize typeSize) const
{
diff --git a/sibs/SafeSerializer.hpp b/sibs/SafeSerializer.hpp
index efc4ecd..fe8ee58 100644
--- a/sibs/SafeSerializer.hpp
+++ b/sibs/SafeSerializer.hpp
@@ -64,6 +64,11 @@ namespace sibs
memcpy(&buffer[offset], data, size);
}
}
+
+ void add(const char *data, usize size)
+ {
+ add((const u8*)data, size);
+ }
std::vector<u8>& getBuffer()
{