ntdll: Fix compiler warnings with flag -Wcast-qual.
authorMikhail Maroukhine <mikolg@yandex.ru>
Sat, 27 Mar 2010 15:41:14 +0000 (21:41 +0600)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 29 Mar 2010 10:15:28 +0000 (12:15 +0200)
dlls/ntdll/heap.c
dlls/ntdll/loader.c
dlls/ntdll/rtlstr.c

index e49e77aae088c41e0721e4bf976cc340e92a5683..15dd85ccd4dc1389c46f95d78d0805318d1bccc0 100644 (file)
@@ -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 );
index 1723f183c4e0a3c0e41a604ccb3f08b609afb72c..74e873b7de1e028ee21f010942de19c2c20cd5f6 100644 (file)
@@ -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;
index 14993f2687933aeedc4298b7a42261e0ab2bbffd..4e9614c2f72500c538bd9ff29abe93c1abbed947 100644 (file)
@@ -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);