AmendHub

Download:

jcs

/

subtext

/

amendments

/

366

zip: Add PUT_U{16,32}


jcs made amendment 366 about 1 year ago
--- zip.h Thu Mar 2 21:46:43 2023 +++ zip.h Mon Mar 6 15:42:42 2023 @@ -23,11 +23,19 @@ #define GET_U16(buf) (u_int16_t)(\ ((u_int16_t)((unsigned char *)buf)[1] << 8) | \ ((u_int16_t)((unsigned char *)buf)[0])) +#define PUT_U16(buf, i) \ + ((unsigned char *)buf)[0] = (i) & 0xff; \ + ((unsigned char *)buf)[1] = ((i) >> 8) & 0xff; #define GET_U32(buf) (u_int32_t)(\ ((u_int32_t)((unsigned char *)buf)[3] << 24) | \ ((u_int32_t)((unsigned char *)buf)[2] << 16) | \ ((u_int32_t)((unsigned char *)buf)[1] << 8) | \ ((u_int32_t)((unsigned char *)buf)[0])) +#define PUT_U32(buf, i) \ + ((unsigned char *)buf)[0] = (i) & 0xff; \ + ((unsigned char *)buf)[1] = ((i) >> 8) & 0xff; \ + ((unsigned char *)buf)[2] = ((i) >> 16) & 0xff; \ + ((unsigned char *)buf)[3] = ((i) >> 24) & 0xff; typedef bool zip_extract_decider(char *filename, size_t extracted_size); typedef void zip_extract_processor(char *filename,