Mikhail Maroukhine : ntdll: Fix compiler warnings with flag -Wcast-qual.
Alexandre Julliard
julliard at winehq.org
Mon Mar 29 09:57:56 CDT 2010
Module: wine
Branch: master
Commit: 2b8f11b8c0a1f00b9087d0c52212792d65258e9d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2b8f11b8c0a1f00b9087d0c52212792d65258e9d
Author: Mikhail Maroukhine <mikolg at yandex.ru>
Date: Sat Mar 27 21:41:14 2010 +0600
ntdll: Fix compiler warnings with flag -Wcast-qual.
---
dlls/ntdll/heap.c | 8 ++++----
dlls/ntdll/loader.c | 4 ++--
dlls/ntdll/rtlstr.c | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index e49e77a..15dd85c 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -1261,15 +1261,15 @@ static BOOL HEAP_ValidateInUseArena( const SUBHEAP *subheap, const ARENA_INUSE *
/* Check unused bytes */
if (pArena->magic == ARENA_PENDING_MAGIC)
{
- DWORD *ptr = (DWORD *)(pArena + 1);
- DWORD *end = (DWORD *)((char *)ptr + size);
+ const DWORD *ptr = (const DWORD *)(pArena + 1);
+ const DWORD *end = (const DWORD *)((const char *)ptr + size);
while (ptr < end)
{
if (*ptr != ARENA_FREE_FILLER)
{
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(); }
return FALSE;
}
@@ -1398,7 +1398,7 @@ static BOOL validate_block_pointer( HEAP *heap, SUBHEAP **ret_subheap, const ARE
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 );
else if (subheap->heap->flags & HEAP_VALIDATE) /* do the full validation */
ret = HEAP_ValidateInUseArena( subheap, arena, QUIET );
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 1723f18..74e873b 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2688,7 +2688,7 @@ PVOID WINAPI RtlImageDirectoryEntryToData( HMODULE module, BOOL image, WORD dir,
if (!(nt = RtlImageNtHeader( module ))) return NULL;
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 (!(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)
{
- 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 (!(addr = nt32->OptionalHeader.DataDirectory[dir].VirtualAddress)) return NULL;
diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c
index 14993f2..4e9614c 100644
--- a/dlls/ntdll/rtlstr.c
+++ b/dlls/ntdll/rtlstr.c
@@ -1617,7 +1617,7 @@ BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf )
/* Check for an odd length ... pass if even. */
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 /= sizeof(WCHAR);
More information about the wine-cvs
mailing list