Skip to content

Commit

Permalink
correctly define {U,}INTPTR_T on 64bit Windows
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
milianw committed Jun 7, 2021
1 parent 38339ee commit 5878421
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions image/sys/ansi.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
//*@@@---@@@@******************************************************************
#pragma once

#include <stdint.h>

//================================
// bitio functions
//================================
Expand All @@ -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

0 comments on commit 5878421

Please sign in to comment.