Alexandre Julliard : ntdll: Fix RtlSizeHeap() error value for 64-bit.
Alexandre Julliard
julliard at winehq.org
Wed Jul 15 16:44:45 CDT 2020
Module: wine
Branch: master
Commit: 704d0662bef08a980c87c408fa33f50fc60b5cac
URL: https://source.winehq.org/git/wine.git/?a=commit;h=704d0662bef08a980c87c408fa33f50fc60b5cac
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Jul 15 12:06:32 2020 +0200
ntdll: Fix RtlSizeHeap() error value for 64-bit.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/heap.c | 8 ++++----
dlls/ntdll/heap.c | 6 +++---
dlls/ntdll/tests/env.c | 8 ++++----
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/dlls/kernel32/heap.c b/dlls/kernel32/heap.c
index 6c5219b624..dc1a3cd72c 100644
--- a/dlls/kernel32/heap.c
+++ b/dlls/kernel32/heap.c
@@ -333,10 +333,10 @@ SIZE_T WINAPI GlobalSize(HGLOBAL hmem)
{
retval=HeapSize(GetProcessHeap(), 0, hmem);
- if (retval == ~0ul) /* It might be a GMEM_MOVEABLE data pointer */
+ if (retval == ~(SIZE_T)0) /* It might be a GMEM_MOVEABLE data pointer */
{
retval = HeapSize(GetProcessHeap(), 0, (char*)hmem - HGLOBAL_STORAGE);
- if (retval != ~0ul) retval -= HGLOBAL_STORAGE;
+ if (retval != ~(SIZE_T)0) retval -= HGLOBAL_STORAGE;
}
}
else
@@ -351,7 +351,7 @@ SIZE_T WINAPI GlobalSize(HGLOBAL hmem)
else
{
retval = HeapSize(GetProcessHeap(), 0, (char *)pintern->Pointer - HGLOBAL_STORAGE );
- if (retval != ~0ul) retval -= HGLOBAL_STORAGE;
+ if (retval != ~(SIZE_T)0) retval -= HGLOBAL_STORAGE;
}
}
else
@@ -362,7 +362,7 @@ SIZE_T WINAPI GlobalSize(HGLOBAL hmem)
}
RtlUnlockHeap(GetProcessHeap());
}
- if (retval == ~0ul) retval = 0;
+ if (retval == ~(SIZE_T)0) retval = 0;
return retval;
}
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index cb66d1a258..f3c76cc82b 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -116,7 +116,7 @@ C_ASSERT( HEAP_MAX_SMALL_FREE_LIST % ALIGNMENT == 0 );
/* Max size of the blocks on the free lists above HEAP_MAX_SMALL_FREE_LIST */
static const SIZE_T HEAP_freeListSizes[] =
{
- 0x200, 0x400, 0x1000, ~0UL
+ 0x200, 0x400, 0x1000, ~(SIZE_T)0
};
#define HEAP_NB_FREE_LISTS (ARRAY_SIZE( HEAP_freeListSizes ) + HEAP_NB_SMALL_FREE_LISTS)
@@ -2007,7 +2007,7 @@ SIZE_T WINAPI RtlSizeHeap( HANDLE heap, ULONG flags, const void *ptr )
if (!heapPtr)
{
RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_HANDLE );
- return ~0UL;
+ return ~(SIZE_T)0;
}
flags &= HEAP_NO_SERIALIZE;
flags |= heapPtr->flags;
@@ -2017,7 +2017,7 @@ SIZE_T WINAPI RtlSizeHeap( HANDLE heap, ULONG flags, const void *ptr )
if (!validate_block_pointer( heapPtr, &subheap, pArena ))
{
RtlSetLastWin32ErrorAndNtStatusFromNtStatus( STATUS_INVALID_PARAMETER );
- ret = ~0UL;
+ ret = ~(SIZE_T)0;
}
else if (!subheap)
{
diff --git a/dlls/ntdll/tests/env.c b/dlls/ntdll/tests/env.c
index 9883739eba..4865a0a8e5 100644
--- a/dlls/ntdll/tests/env.c
+++ b/dlls/ntdll/tests/env.c
@@ -386,7 +386,7 @@ static void test_process_params(void)
else
{
size = HeapSize( GetProcessHeap(), 0, params );
- ok( size != ~0UL, "not a heap block %p\n", params );
+ ok( size != ~(SIZE_T)0, "not a heap block %p\n", params );
ok( params->AllocationSize == params->Size,
"wrong AllocationSize %x/%x\n", params->AllocationSize, params->Size );
}
@@ -456,7 +456,7 @@ static void test_process_params(void)
else
{
size = HeapSize( GetProcessHeap(), 0, params );
- ok( size != ~0UL, "not a heap block %p\n", params );
+ ok( size != ~(SIZE_T)0, "not a heap block %p\n", params );
ok( params->AllocationSize == params->Size,
"wrong AllocationSize %x/%x\n", params->AllocationSize, params->Size );
}
@@ -509,7 +509,7 @@ static void test_process_params(void)
else
{
size = HeapSize( GetProcessHeap(), 0, cur_params );
- ok( size != ~0UL, "not a heap block %p\n", cur_params );
+ ok( size != ~(SIZE_T)0, "not a heap block %p\n", cur_params );
ok( cur_params->AllocationSize == cur_params->Size,
"wrong AllocationSize %x/%x\n", cur_params->AllocationSize, cur_params->Size );
ok( cur_params->Size == size, "wrong Size %x/%lx\n", cur_params->Size, size );
@@ -548,7 +548,7 @@ static void test_process_params(void)
else
{
size = HeapSize( GetProcessHeap(), 0, initial_env );
- ok( size != ~0UL, "env is not a heap block %p / %p\n", cur_params, initial_env );
+ ok( size != ~(SIZE_T)0, "env is not a heap block %p / %p\n", cur_params, initial_env );
}
}
More information about the wine-cvs
mailing list