Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/SoftEtherVPN/libhamcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavide Beatrici <git@davidebeatrici.dev>2021-03-10 00:06:53 +0300
committerDavide Beatrici <git@davidebeatrici.dev>2021-03-10 00:06:53 +0300
commitc798511e419ededd0cbe34a09f2aaca5111d9576 (patch)
tree040b3dde21f4e86509087330b8b40e7fe6d1ee82 /Memory.c
parentafe882a6739dcb0efba5cc9fabd7647b98a9fbba (diff)
Introduce HamcoreBuild(), for building archives
Diffstat (limited to 'Memory.c')
-rw-r--r--Memory.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Memory.c b/Memory.c
index b7ef7fc..661d729 100644
--- a/Memory.c
+++ b/Memory.c
@@ -1,5 +1,7 @@
#include "Memory.h"
+#include <string.h>
+
size_t CompressionBufferSize(const size_t original_size) { return original_size * 2 + 256; }
uint32_t Swap32(const uint32_t value)
@@ -11,3 +13,14 @@ uint32_t Swap32(const uint32_t value)
((uint8_t *)&swapped)[3] = ((uint8_t *)&value)[0];
return swapped;
}
+
+void WriteAndSeek(void **dst, const void *src, const size_t size)
+{
+ if (!dst || !*dst)
+ {
+ return;
+ }
+
+ memcpy(*dst, src, size);
+ *dst += size;
+}