diff options
| author | Mattias Andrée <m@maandree.se> | 2026-05-17 21:02:35 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-05-17 21:02:35 +0200 |
| commit | b5e063d63ecd3dbed1b68b1ea6961137d4f3f153 (patch) | |
| tree | fe2a848ab3208e9de8b362ba769535483472dbd6 /marshal.c | |
| parent | Update year (diff) | |
| download | libsha1-1.1.6.tar.gz libsha1-1.1.6.tar.bz2 libsha1-1.1.6.tar.xz | |
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
| -rw-r--r-- | marshal.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -5,17 +5,17 @@ size_t libsha1_marshal(const struct libsha1_state *restrict state, void *restrict buf_) { - char *restrict buf = buf_; + unsigned char *restrict buf = buf_; size_t off = 0; if (buf) - *(int *)buf = 1; /* version */ + memcpy(buf, &(int){1}, sizeof(int)); off += sizeof(int); if (buf) - *(enum libsha1_algorithm *)&buf[off] = state->algorithm; + memcpy(&buf[off], &state->algorithm, sizeof(enum libsha1_algorithm)); off += sizeof(enum libsha1_algorithm); if (buf) - *(size_t *)&buf[off] = state->message_size; + memcpy(&buf[off], &state->message_size, sizeof(size_t)); off += sizeof(size_t); if (buf) |
