ntdll: Fix compiler warnings with flag -Wcast-qual.

This commit is contained in:
Mikhail Maroukhine 2010-03-27 21:41:14 +06:00 committed by Alexandre Julliard
parent 88cca2cf76
commit 2b8f11b8c0
3 changed files with 7 additions and 7 deletions

View File

@ -1261,15 +1261,15 @@ static BOOL HEAP_ValidateInUseArena( const SUBHEAP *subheap, const ARENA_INUSE *
/* Check unused bytes */ /* Check unused bytes */
if (pArena->magic == ARENA_PENDING_MAGIC) if (pArena->magic == ARENA_PENDING_MAGIC)
{ {
DWORD *ptr = (DWORD *)(pArena + 1); const DWORD *ptr = (const DWORD *)(pArena + 1);
DWORD *end = (DWORD *)((char *)ptr + size); const DWORD *end = (const DWORD *)((const char *)ptr + size);
while (ptr < end) while (ptr < end)
{ {
if (*ptr != ARENA_FREE_FILLER) if (*ptr != ARENA_FREE_FILLER)
{ {
ERR("Heap %p: free block %p overwritten at %p by %08x\n", ERR("Heap %p: free block %p overwritten at %p by %08x\n",
subheap->heap, (ARENA_INUSE *)pArena + 1, ptr, *ptr ); subheap->heap, (const ARENA_INUSE *)pArena + 1, ptr, *ptr );
if (!*ptr) { HEAP_Dump( subheap->heap ); DbgBreakPoint(); } if (!*ptr) { HEAP_Dump( subheap->heap ); DbgBreakPoint(); }
return FALSE; return FALSE;
} }
@ -1398,7 +1398,7 @@ static BOOL validate_block_pointer( HEAP *heap, SUBHEAP **ret_subheap, const ARE
return TRUE; return TRUE;
} }
if ((char *)arena < (char *)subheap->base + subheap->headerSize) if ((const char *)arena < (char *)subheap->base + subheap->headerSize)
WARN( "Heap %p: pointer %p is inside subheap %p header\n", subheap->heap, arena + 1, subheap ); WARN( "Heap %p: pointer %p is inside subheap %p header\n", subheap->heap, arena + 1, subheap );
else if (subheap->heap->flags & HEAP_VALIDATE) /* do the full validation */ else if (subheap->heap->flags & HEAP_VALIDATE) /* do the full validation */
ret = HEAP_ValidateInUseArena( subheap, arena, QUIET ); ret = HEAP_ValidateInUseArena( subheap, arena, QUIET );

View File

@ -2688,7 +2688,7 @@ PVOID WINAPI RtlImageDirectoryEntryToData( HMODULE module, BOOL image, WORD dir,
if (!(nt = RtlImageNtHeader( module ))) return NULL; if (!(nt = RtlImageNtHeader( module ))) return NULL;
if (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC) if (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC)
{ {
const IMAGE_NT_HEADERS64 *nt64 = (IMAGE_NT_HEADERS64 *)nt; const IMAGE_NT_HEADERS64 *nt64 = (const IMAGE_NT_HEADERS64 *)nt;
if (dir >= nt64->OptionalHeader.NumberOfRvaAndSizes) return NULL; if (dir >= nt64->OptionalHeader.NumberOfRvaAndSizes) return NULL;
if (!(addr = nt64->OptionalHeader.DataDirectory[dir].VirtualAddress)) return NULL; if (!(addr = nt64->OptionalHeader.DataDirectory[dir].VirtualAddress)) return NULL;
@ -2697,7 +2697,7 @@ PVOID WINAPI RtlImageDirectoryEntryToData( HMODULE module, BOOL image, WORD dir,
} }
else if (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC) else if (nt->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC)
{ {
const IMAGE_NT_HEADERS32 *nt32 = (IMAGE_NT_HEADERS32 *)nt; const IMAGE_NT_HEADERS32 *nt32 = (const IMAGE_NT_HEADERS32 *)nt;
if (dir >= nt32->OptionalHeader.NumberOfRvaAndSizes) return NULL; if (dir >= nt32->OptionalHeader.NumberOfRvaAndSizes) return NULL;
if (!(addr = nt32->OptionalHeader.DataDirectory[dir].VirtualAddress)) return NULL; if (!(addr = nt32->OptionalHeader.DataDirectory[dir].VirtualAddress)) return NULL;

View File

@ -1617,7 +1617,7 @@ BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf )
/* Check for an odd length ... pass if even. */ /* Check for an odd length ... pass if even. */
if (len & 1) out_flags |= IS_TEXT_UNICODE_ODD_LENGTH; if (len & 1) out_flags |= IS_TEXT_UNICODE_ODD_LENGTH;
if (((char *)buf)[len - 1] == 0) if (((const char *)buf)[len - 1] == 0)
len--; /* Windows seems to do something like that to avoid e.g. false IS_TEXT_UNICODE_NULL_BYTES */ len--; /* Windows seems to do something like that to avoid e.g. false IS_TEXT_UNICODE_NULL_BYTES */
len /= sizeof(WCHAR); len /= sizeof(WCHAR);