diff --git a/core/deps/chdr/chd.c b/core/deps/chdr/chd.c index ef7999d75..3c047375a 100644 --- a/core/deps/chdr/chd.c +++ b/core/deps/chdr/chd.c @@ -448,7 +448,7 @@ void *lzma_fast_alloc(void *p, size_t size) } /* alloc a new one and put it into the list */ - uint32_t *addr = (uint32_t *)malloc(sizeof(uint8_t) * (size + sizeof(uint32_t))); + uint32_t *addr = (uint32_t *)malloc(sizeof(uint8_t) * size + sizeof(uintptr_t)); if (addr==NULL) return NULL; for (int scan = 0; scan < MAX_LZMA_ALLOCS; scan++) @@ -462,7 +462,7 @@ void *lzma_fast_alloc(void *p, size_t size) /* set the low bit of the size so we don't match next time */ *addr = size | 1; - return addr + 1; + return addr + (sizeof(uint32_t) == sizeof(uintptr_t) ? 1 : 2); } /*------------------------------------------------- @@ -479,7 +479,7 @@ void lzma_fast_free(void *p, void *address) lzma_allocator *codec = (lzma_allocator *)(p); /* find the hunk */ - uint32_t *ptr = (uint32_t *)(address) - 1; + uint32_t *ptr = (uint32_t *)(address) - (sizeof(uint32_t) == sizeof(uintptr_t) ? 1 : 2); for (int scan = 0; scan < MAX_LZMA_ALLOCS; scan++) { if (ptr == codec->allocptr[scan]) @@ -2466,7 +2466,7 @@ static voidpf zlib_fast_alloc(voidpf opaque, uInt items, uInt size) } /* alloc a new one */ - ptr = (UINT32 *)malloc(size + sizeof(UINT32)); + ptr = (UINT32 *)malloc(size + sizeof(uintptr_t)); if (!ptr) return NULL; @@ -2480,7 +2480,7 @@ static voidpf zlib_fast_alloc(voidpf opaque, uInt items, uInt size) /* set the low bit of the size so we don't match next time */ *ptr = size | 1; - return ptr + 1; + return ptr + (sizeof(uint32_t) == sizeof(uintptr_t) ? 1 : 2); } /*------------------------------------------------- @@ -2491,7 +2491,7 @@ static voidpf zlib_fast_alloc(voidpf opaque, uInt items, uInt size) static void zlib_fast_free(voidpf opaque, voidpf address) { zlib_allocator *alloc = (zlib_allocator *)opaque; - UINT32 *ptr = (UINT32 *)address - 1; + UINT32 *ptr = (UINT32 *)address - (sizeof(uint32_t) == sizeof(uintptr_t) ? 1 : 2); int i; /* find the hunk */ diff --git a/core/hw/aica/sgc_if.cpp b/core/hw/aica/sgc_if.cpp index ab648aef0..c4be2c1d2 100755 --- a/core/hw/aica/sgc_if.cpp +++ b/core/hw/aica/sgc_if.cpp @@ -152,7 +152,7 @@ s16 pl=0,pr=0; DSP_OUT_VOL_REG* dsp_out_vol; -#pragma pack (1) +#pragma pack(push, 1) //All regs are 16b , aligned to 32b (upper bits 0?) struct ChannelCommonData { @@ -294,7 +294,7 @@ struct ChannelCommonData u32 pad_20:16; }; - +#pragma pack(pop) enum _EG_state