From 0f19a20c8c8c6104b44ea39316d736337422e26c Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 31 Jan 2025 16:06:36 +0000 Subject: [PATCH] tiles: pointer arithmetic with 'unsigned long' is too narrow for _WIN64 is mmap() is available the type 'size_t' is better suited --- tiles/tile.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tiles/tile.c b/tiles/tile.c index 698a29b2..dd779e44 100644 --- a/tiles/tile.c +++ b/tiles/tile.c @@ -669,7 +669,7 @@ mmapTileStore() { int prot = PROT_READ | PROT_WRITE; int flags = MAP_ANON | MAP_PRIVATE; - unsigned long map_len = TILE_STORE_BLOCK_SIZE; + size_t map_len = TILE_STORE_BLOCK_SIZE; _block_begin = mmap(NULL, map_len, prot, flags, -1, 0); if (_block_begin == MAP_FAILED) @@ -677,7 +677,7 @@ mmapTileStore() TxError("TileStore: Unable to mmap ANON SEGMENT\n"); _exit(1); } - _block_end = (void *) ((unsigned long) _block_begin + map_len); + _block_end = (void *) ((pointertype) _block_begin + map_len); _current_ptr = _block_begin; return 0; } @@ -705,19 +705,19 @@ getTileFromTileStore() /* Get it from the mmap */ - if (((unsigned long)_current_ptr + sizeof(Tile)) - > (unsigned long)_block_end) + if (((pointertype)_current_ptr + sizeof(Tile)) + > (pointertype)_block_end) { mmapTileStore(); } - _current_ptr = (void *)((unsigned long)_current_ptr + sizeof(Tile)); + _current_ptr = (void *)((pointertype)_current_ptr + sizeof(Tile)); - if ((unsigned long)_current_ptr > (unsigned long) _block_end) + if ((pointertype)_current_ptr > (pointertype) _block_end) { fprintf(stderr,"TileStore: internal assertion failure..."); _exit(1); } - return (Tile *)((unsigned long)_current_ptr - sizeof(Tile)); + return (Tile *)((pointertype)_current_ptr - sizeof(Tile)); } static void