Skip to content

Commit

Permalink
Replace all occurrences of 'intptr' by 'intnat'
Browse files Browse the repository at this point in the history
Except the one in 'fail.h' because it is clear from the context
that 'intptr_t' exists.
  • Loading branch information
mlasson committed Apr 11, 2018
1 parent e538716 commit cebd202
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
20 changes: 4 additions & 16 deletions byterun/win32.c
Expand Up @@ -56,18 +56,6 @@
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
#endif

/* Very old Microsoft headers don't include intptr_t */
#ifdef _MSC_VER
#ifndef _UINTPTR_T_DEFINED
typedef uintnat uintptr_t;
#define _UINTPTR_T_DEFINED
#endif
#ifndef _INTPTR_T_DEFINED
typedef intnat intptr_t;
#define _INTPTR_T_DEFINED
#endif
#endif

unsigned short caml_win32_major = 0;
unsigned short caml_win32_minor = 0;
unsigned short caml_win32_build = 0;
Expand Down Expand Up @@ -376,7 +364,7 @@ static void expand_argument(wchar_t * arg)
static void expand_pattern(wchar_t * pat)
{
wchar_t * prefix, * p, * name;
intptr_t handle;
intnat handle;
struct _wfinddata_t ffblk;
size_t i;

Expand Down Expand Up @@ -425,7 +413,7 @@ int caml_read_directory(wchar_t * dirname, struct ext_table * contents)
{
size_t dirnamelen;
wchar_t * template;
intptr_t h;
intnat h;
struct _wfinddata_t fileinfo;

dirnamelen = wcslen(dirname);
Expand Down Expand Up @@ -460,7 +448,7 @@ void caml_signal_thread(void * lpParam)
wchar_t *endptr;
HANDLE h;
/* Get an hexa-code raw handle through the environment */
h = (HANDLE) (uintptr_t)
h = (HANDLE) (uintnat)
wcstol(caml_secure_getenv(_T("CAMLSIGPIPE")), &endptr, 16);
while (1) {
DWORD numread;
Expand Down Expand Up @@ -650,7 +638,7 @@ static void invalid_parameter_handler(const wchar_t* expression,
const wchar_t* function,
const wchar_t* file,
unsigned int line,
uintptr_t pReserved)
uintnat pReserved)
{
/* no crash box */
}
Expand Down
7 changes: 1 addition & 6 deletions otherlibs/win32unix/channels.c
Expand Up @@ -23,17 +23,12 @@
#include <fcntl.h>
#include <io.h>

#if defined(_MSC_VER) && !defined(_INTPTR_T_DEFINED)
typedef int intptr_t;
#define _INTPTR_T_DEFINED
#endif

int win_CRT_fd_of_filedescr(value handle)
{
if (CRT_fd_val(handle) != NO_CRT_FD) {
return CRT_fd_val(handle);
} else {
int fd = _open_osfhandle((intptr_t) Handle_val(handle), O_BINARY);
int fd = _open_osfhandle((intnat) Handle_val(handle), O_BINARY);
if (fd == -1) uerror("channel_of_descr", Nothing);
CRT_fd_val(handle) = fd;
return fd;
Expand Down

0 comments on commit cebd202

Please sign in to comment.