temp sync broken

This commit is contained in:
2025-12-30 08:04:26 +01:00
parent 31dda62474
commit 3b2ec32532
27 changed files with 1339 additions and 589 deletions

View File

@@ -21,4 +21,19 @@ void hexdump (const char *label, const uint8_t *data, size_t len) {
}
printf ("\n");
}
}
void hexdump_compact(const uint8_t* data, size_t len, char* out, size_t out_size) {
size_t pos = 0;
for (size_t i = 0; i < len; i++) {
if (pos + 2 >= out_size) break; // make sure we don¡¯t overflow
snprintf(out + pos, 3, "%02x", data[i]); // 2 chars + null terminator
pos += 2;
}
if (pos < out_size)
out[pos] = '\0';
else
out[out_size - 1] = '\0'; // ensure null termination
}

View File

@@ -6,4 +6,6 @@
#include "stdint.h"
void hexdump (const char *label, const uint8_t *data, size_t len);
void hexdump_compact(const uint8_t* data, size_t len, char* out, size_t out_size);
#endif