From 43e3e4fe8504b65a7c11f75bf488d1094313bb06 Mon Sep 17 00:00:00 2001 From: Quinn Date: Wed, 27 Aug 2025 11:53:53 +0200 Subject: [PATCH] fix: not converting big-endian numbers to host. I swear I did have this here at some point... I've got no idea when I removed it, or even why. --- src/dat/mcx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dat/mcx.c b/src/dat/mcx.c index 5b7c062..0d75172 100644 --- a/src/dat/mcx.c +++ b/src/dat/mcx.c @@ -12,9 +12,9 @@ void mcx_delchunk(u8 *restrict buf, int chunk) { // load the table data, and clear it u32 *table = (u32 *)buf; - size_t bidx = (table[chunk] >> 8) * 0x1000; // compute the byte offset the chunk starts at - size_t blen = (table[chunk] & 0xFF) * 0x1000; // compute the byte length of the chunk - size_t slen = (table[chunk] & 0xFF); // acquire the sector length of the chunk + size_t bidx = be32toh(table[chunk] >> 8) * 0x1000; // compute the byte offset the chunk starts at + size_t blen = be32toh(table[chunk] & 0xFF) * 0x1000; // compute the byte length of the chunk + size_t slen = be32toh(table[chunk] & 0xFF); // acquire the sector length of the chunk table[chunk] = 0; table[chunk + 0x400] = time(NULL); // assign the current time to the timestamp, for correctness NOTE: might need to zero-out instead