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

This commit is contained in:
Mikhail Maroukhine 2010-03-28 23:19:18 +07:00 committed by Alexandre Julliard
parent 93d9d8a3af
commit 3f1c2d5e35
3 changed files with 24 additions and 24 deletions

View File

@ -171,16 +171,16 @@ static int dump_emfrecord(void)
case EMR_EXTSELECTCLIPRGN: case EMR_EXTSELECTCLIPRGN:
{ {
const EMREXTSELECTCLIPRGN *clip = PRD(offset, sizeof(*clip)); const EMREXTSELECTCLIPRGN *clip = PRD(offset, sizeof(*clip));
const RGNDATA *data = (RGNDATA *)clip->RgnData; const RGNDATA *data = (const RGNDATA *)clip->RgnData;
DWORD i, rc_count = 0; DWORD i, rc_count = 0;
RECT *rc; const RECT *rc;
if (length >= sizeof(*clip) + sizeof(*data)) if (length >= sizeof(*clip) + sizeof(*data))
rc_count = data->rdh.nCount; rc_count = data->rdh.nCount;
printf("%-20s %08x\n", "EMREXTSELECTCLIPRGN", length); printf("%-20s %08x\n", "EMREXTSELECTCLIPRGN", length);
printf("mode %d, rects %d\n", clip->iMode, rc_count); printf("mode %d, rects %d\n", clip->iMode, rc_count);
for (i = 0, rc = (RECT *)data->Buffer; i < rc_count; i++, rc++) for (i = 0, rc = (const RECT *)data->Buffer; i < rc_count; i++, rc++)
printf(" (%d,%d)-(%d,%d)", rc->left, rc->top, rc->right, rc->bottom); printf(" (%d,%d)-(%d,%d)", rc->left, rc->top, rc->right, rc->bottom);
if (rc_count != 0) printf("\n"); if (rc_count != 0) printf("\n");
break; break;

View File

@ -1331,26 +1331,26 @@ int codeview_dump_symbols(const void* root, unsigned long size)
case S_SECTINFO_V3: case S_SECTINFO_V3:
printf("\tSSection Info: seg=%04x ?=%04x rva=%08x size=%08x attr=%08x %s\n", printf("\tSSection Info: seg=%04x ?=%04x rva=%08x size=%08x attr=%08x %s\n",
*(unsigned short*)((const char*)sym + 4), *(const unsigned short*)((const char*)sym + 4),
*(unsigned short*)((const char*)sym + 6), *(const unsigned short*)((const char*)sym + 6),
*(unsigned*)((const char*)sym + 8), *(const unsigned*)((const char*)sym + 8),
*(unsigned*)((const char*)sym + 12), *(const unsigned*)((const char*)sym + 12),
*(unsigned*)((const char*)sym + 16), *(const unsigned*)((const char*)sym + 16),
(const char*)sym + 20); (const char*)sym + 20);
break; break;
case S_SUBSECTINFO_V3: case S_SUBSECTINFO_V3:
printf("\tSSubSection Info: addr=%04x:%08x size=%08x attr=%08x %s\n", printf("\tSSubSection Info: addr=%04x:%08x size=%08x attr=%08x %s\n",
*(unsigned short*)((const char*)sym + 16), *(const unsigned short*)((const char*)sym + 16),
*(unsigned*)((const char*)sym + 12), *(const unsigned*)((const char*)sym + 12),
*(unsigned*)((const char*)sym + 4), *(const unsigned*)((const char*)sym + 4),
*(unsigned*)((const char*)sym + 8), *(const unsigned*)((const char*)sym + 8),
(const char*)sym + 18); (const char*)sym + 18);
break; break;
case S_ENTRYPOINT_V3: case S_ENTRYPOINT_V3:
printf("\tSEntryPoint: id=%x '%s'\n", printf("\tSEntryPoint: id=%x '%s'\n",
*(unsigned*)((const char*)sym + 4), (const char*)sym + 8); *(const unsigned*)((const char*)sym + 4), (const char*)sym + 8);
break; break;
default: default:

View File

@ -377,7 +377,7 @@ void dump_section(const IMAGE_SECTION_HEADER *sectHead, const char* strtable)
/* long section name ? */ /* long section name ? */
if (strtable && sectHead->Name[0] == '/' && if (strtable && sectHead->Name[0] == '/' &&
((offset = atoi((const char*)sectHead->Name + 1)) < *(DWORD*)strtable)) ((offset = atoi((const char*)sectHead->Name + 1)) < *(const DWORD*)strtable))
printf(" %.8s (%s)", sectHead->Name, strtable + offset); printf(" %.8s (%s)", sectHead->Name, strtable + offset);
else else
printf(" %-8.8s", sectHead->Name); printf(" %-8.8s", sectHead->Name);
@ -589,7 +589,7 @@ static void dump_x86_64_unwind_info( const struct runtime_function *function )
{ "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi", { "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" }; "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15" };
union handler_data *handler_data; const union handler_data *handler_data;
const struct unwind_info *info; const struct unwind_info *info;
unsigned int i, count; unsigned int i, count;
@ -629,12 +629,12 @@ static void dump_x86_64_unwind_info( const struct runtime_function *function )
case UWOP_ALLOC_LARGE: case UWOP_ALLOC_LARGE:
if (info->opcodes[i].info) if (info->opcodes[i].info)
{ {
count = *(DWORD *)&info->opcodes[i+1]; count = *(const DWORD *)&info->opcodes[i+1];
i += 2; i += 2;
} }
else else
{ {
count = *(USHORT *)&info->opcodes[i+1] * 8; count = *(const USHORT *)&info->opcodes[i+1] * 8;
i++; i++;
} }
printf( "sub $0x%x,%%rsp\n", count ); printf( "sub $0x%x,%%rsp\n", count );
@ -648,22 +648,22 @@ static void dump_x86_64_unwind_info( const struct runtime_function *function )
info->frame_offset * 16, reg_names[info->frame_reg] ); info->frame_offset * 16, reg_names[info->frame_reg] );
break; break;
case UWOP_SAVE_NONVOL: case UWOP_SAVE_NONVOL:
count = *(USHORT *)&info->opcodes[i+1] * 8; count = *(const USHORT *)&info->opcodes[i+1] * 8;
printf( "mov %%%s,0x%x(%%rsp)\n", reg_names[info->opcodes[i].info], count ); printf( "mov %%%s,0x%x(%%rsp)\n", reg_names[info->opcodes[i].info], count );
i++; i++;
break; break;
case UWOP_SAVE_NONVOL_FAR: case UWOP_SAVE_NONVOL_FAR:
count = *(DWORD *)&info->opcodes[i+1]; count = *(const DWORD *)&info->opcodes[i+1];
printf( "mov %%%s,0x%x(%%rsp)\n", reg_names[info->opcodes[i].info], count ); printf( "mov %%%s,0x%x(%%rsp)\n", reg_names[info->opcodes[i].info], count );
i += 2; i += 2;
break; break;
case UWOP_SAVE_XMM128: case UWOP_SAVE_XMM128:
count = *(USHORT *)&info->opcodes[i+1] * 16; count = *(const USHORT *)&info->opcodes[i+1] * 16;
printf( "movaps %%xmm%u,0x%x(%%rsp)\n", info->opcodes[i].info, count ); printf( "movaps %%xmm%u,0x%x(%%rsp)\n", info->opcodes[i].info, count );
i++; i++;
break; break;
case UWOP_SAVE_XMM128_FAR: case UWOP_SAVE_XMM128_FAR:
count = *(DWORD *)&info->opcodes[i+1]; count = *(const DWORD *)&info->opcodes[i+1];
printf( "movaps %%xmm%u,0x%x(%%rsp)\n", info->opcodes[i].info, count ); printf( "movaps %%xmm%u,0x%x(%%rsp)\n", info->opcodes[i].info, count );
i += 2; i += 2;
break; break;
@ -676,7 +676,7 @@ static void dump_x86_64_unwind_info( const struct runtime_function *function )
} }
} }
handler_data = (union handler_data *)&info->opcodes[(info->count + 1) & ~1]; handler_data = (const union handler_data *)&info->opcodes[(info->count + 1) & ~1];
if (info->flags & UNW_FLAG_CHAININFO) if (info->flags & UNW_FLAG_CHAININFO)
{ {
printf( " -> function %08x-%08x\n", printf( " -> function %08x-%08x\n",
@ -685,7 +685,7 @@ static void dump_x86_64_unwind_info( const struct runtime_function *function )
} }
if (info->flags & (UNW_FLAG_EHANDLER | UNW_FLAG_UHANDLER)) if (info->flags & (UNW_FLAG_EHANDLER | UNW_FLAG_UHANDLER))
printf( " handler %08x data at %08x\n", handler_data->handler, printf( " handler %08x data at %08x\n", handler_data->handler,
(ULONG)(function->UnwindData + (char *)(&handler_data->handler + 1) - (char *)info )); (ULONG)(function->UnwindData + (const char *)(&handler_data->handler + 1) - (const char *)info ));
} }
static void dump_dir_exceptions(void) static void dump_dir_exceptions(void)
@ -995,7 +995,7 @@ static void dump_dir_reloc(void)
unsigned int i, size = 0; unsigned int i, size = 0;
const USHORT *relocs; const USHORT *relocs;
const IMAGE_BASE_RELOCATION *rel = get_dir_and_size(IMAGE_DIRECTORY_ENTRY_BASERELOC, &size); const IMAGE_BASE_RELOCATION *rel = get_dir_and_size(IMAGE_DIRECTORY_ENTRY_BASERELOC, &size);
const IMAGE_BASE_RELOCATION *end = (IMAGE_BASE_RELOCATION *)((char *)rel + size); const IMAGE_BASE_RELOCATION *end = (const IMAGE_BASE_RELOCATION *)((const char *)rel + size);
static const char * const names[] = static const char * const names[] =
{ {
"BASED_ABSOLUTE", "BASED_ABSOLUTE",