From 5878421894910417c66b56d5ce7665cb2aa4f048 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Mon, 7 Jun 2021 09:55:00 +0200 Subject: [PATCH] correctly define {U,}INTPTR_T on 64bit Windows Fixes crashes on Windows when loading jxr compressed czi files. This library, despite being originally a Windows product, didn't support 64bit Windows at all. There's a special code path for 32bit Windows with handwritten assembler code, which may have worked back then. But the 64bit code path in the generic "ANSI" platform only checked `__LP64__`, which isn't defined by MSVC. Fix this by using `stdint.h`'s `{u},intptr_t` here to get portable code. --- image/sys/ansi.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/image/sys/ansi.h b/image/sys/ansi.h index 07b9566..26a4e7d 100644 --- a/image/sys/ansi.h +++ b/image/sys/ansi.h @@ -27,6 +27,8 @@ //*@@@---@@@@****************************************************************** #pragma once +#include + //================================ // bitio functions //================================ @@ -42,11 +44,5 @@ //================================ // common defines //================================ -#if __LP64__ -#define UINTPTR_T unsigned long long -#define INTPTR_T long long -#else -#define UINTPTR_T unsigned int -#define INTPTR_T int -#endif - +#define UINTPTR_T uintptr_t +#define INTPTR_T intptr_t