From b5bd4a101a6f6adcab25570302fe57364487ea47 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Fri, 2 Sep 2005 14:47:36 +0000 Subject: [PATCH] Fix gcc 4.0 warnings. --- dlls/dbghelp/elf_module.c | 12 ++++++------ dlls/dbghelp/msc.c | 30 +++++++++++++++--------------- dlls/dbghelp/mscvpdb.h | 1 + dlls/dbghelp/pe_module.c | 6 +++--- dlls/ntdll/cdrom.c | 4 ++-- dlls/ntdll/loader.c | 12 ++++++------ dlls/ntdll/nt.c | 2 +- dlls/ntdll/tests/rtl.c | 2 +- dlls/ntdll/time.c | 2 +- programs/progman/grpfile.c | 2 +- 10 files changed, 37 insertions(+), 36 deletions(-) diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c index fd5ad194a22..749f81ff490 100644 --- a/dlls/dbghelp/elf_module.c +++ b/dlls/dbghelp/elf_module.c @@ -882,15 +882,15 @@ static BOOL elf_load_debug_info_from_map(struct module* module, else if (debug_sect != -1) { /* Dwarf 2 debug information */ - const char* dw2_debug; - const char* dw2_debug_abbrev; - const char* dw2_debug_str; + const BYTE* dw2_debug; + const BYTE* dw2_debug_abbrev; + const BYTE* dw2_debug_str; FIXME("Alpha-support for Dwarf2 information for %s\n", module->module.ModuleName); - dw2_debug = elf_map_section(fmap, debug_sect); - dw2_debug_abbrev = elf_map_section(fmap, debug_abbrev_sect); - dw2_debug_str = elf_map_section(fmap, debug_str_sect); + dw2_debug = (const BYTE*) elf_map_section(fmap, debug_sect); + dw2_debug_abbrev = (const BYTE*) elf_map_section(fmap, debug_abbrev_sect); + dw2_debug_str = (const BYTE*) elf_map_section(fmap, debug_str_sect); if (dw2_debug != NO_MAP && NO_MAP != dw2_debug_abbrev && dw2_debug_str != NO_MAP) { /* OK, now just parse dwarf2 debug infos. */ diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 78f87ae8d8b..5ec5731c6a4 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -76,7 +76,7 @@ static WINE_EXCEPTION_FILTER(page_fault) static void dump(const void* ptr, unsigned len) { int i, j; - BYTE msg[128]; + char msg[128]; const char* hexof = "0123456789abcdef"; const BYTE* x = (const BYTE*)ptr; @@ -741,11 +741,11 @@ static int codeview_new_func_signature(struct module* module, unsigned typeno, return codeview_add_type(typeno, symt); } -static int codeview_parse_type_table(struct module* module, const char* table, +static int codeview_parse_type_table(struct module* module, const BYTE* table, int len) { unsigned int curr_type = 0x1000; - const char* ptr = table; + const BYTE* ptr = table; int retv; const union codeview_type* type; int value, leaf_len; @@ -846,7 +846,7 @@ static int codeview_parse_type_table(struct module* module, const char* table, * type of the corresponding sort. Later on, the definition of * the 'real' type will copy the member / enumeration data. */ - const char* list = type->fieldlist.list; + const unsigned char* list = type->fieldlist.list; int len = (ptr + type->generic.len + 2) - list; if (((const union codeview_fieldtype*)list)->generic.id == LF_ENUMERATE_V1 || @@ -970,7 +970,7 @@ static int codeview_parse_type_table(struct module* module, const char* table, */ static struct codeview_linetab* codeview_snarf_linetab(struct module* module, - const char* linetab, int size, + const BYTE* linetab, int size, BOOL pascal_str) { int file_segcount; @@ -992,7 +992,7 @@ static struct codeview_linetab* codeview_snarf_linetab(struct module* module, /* * Now get the important bits. */ - pnt.c = linetab; + pnt.uc = linetab; nfile = *pnt.s++; nseg = *pnt.s++; @@ -1004,7 +1004,7 @@ static struct codeview_linetab* codeview_snarf_linetab(struct module* module, nseg = 0; for (i = 0; i < nfile; i++) { - pnt2.c = linetab + filetab[i]; + pnt2.uc = linetab + filetab[i]; nseg += *pnt2.s; } @@ -1033,7 +1033,7 @@ static struct codeview_linetab* codeview_snarf_linetab(struct module* module, /* * Get the pointer into the segment information. */ - pnt2.c = linetab + filetab[i]; + pnt2.uc = linetab + filetab[i]; file_segcount = *pnt2.s; pnt2.ui++; @@ -1055,7 +1055,7 @@ static struct codeview_linetab* codeview_snarf_linetab(struct module* module, for (k = 0; k < file_segcount; k++, this_seg++) { - pnt2.c = linetab + lt_ptr[k]; + pnt2.uc = linetab + lt_ptr[k]; lt_hdr[this_seg].start = start[k].start; lt_hdr[this_seg].end = start[k].end; lt_hdr[this_seg].compiland = compiland; @@ -1643,7 +1643,7 @@ static void* pdb_read_ds_file(const struct PDB_DS_HEADER* pdb, return pdb_ds_read(pdb, block_list, toc->file_size[file_nr]); } -static void* pdb_read_file(const BYTE* image, const struct pdb_lookup* pdb_lookup, +static void* pdb_read_file(const char* image, const struct pdb_lookup* pdb_lookup, DWORD file_nr) { switch (pdb_lookup->kind) @@ -1795,7 +1795,7 @@ static HANDLE open_pdb_file(const struct process* pcs, const char* filename) static void pdb_process_types(const struct msc_debug_info* msc_dbg, const char* image, struct pdb_lookup* pdb_lookup) { - char* types_image = NULL; + BYTE* types_image = NULL; types_image = pdb_read_file(image, pdb_lookup, 2); if (types_image) @@ -1995,7 +1995,7 @@ static BOOL pdb_process_internal(const struct process* pcs, BOOL ret = FALSE; HANDLE hFile, hMap = NULL; char* image = NULL; - char* symbols_image = NULL; + BYTE* symbols_image = NULL; TRACE("Processing PDB file %s\n", pdb_lookup->filename); @@ -2013,8 +2013,8 @@ static BOOL pdb_process_internal(const struct process* pcs, if (symbols_image) { PDB_SYMBOLS symbols; - char* modimage; - char* file; + BYTE* modimage; + BYTE* file; int header_size = 0; pdb_convert_symbols_header(&symbols, &header_size, symbols_image); @@ -2072,7 +2072,7 @@ static BOOL pdb_process_internal(const struct process* pcs, } file_name = (const char*)file + size; file_name += strlen(file_name) + 1; - file = (char*)((DWORD)(file_name + strlen(file_name) + 1 + 3) & ~3); + file = (BYTE*)((DWORD)(file_name + strlen(file_name) + 1 + 3) & ~3); } } else diff --git a/dlls/dbghelp/mscvpdb.h b/dlls/dbghelp/mscvpdb.h index 1ae3e9ff74a..828f31128a7 100644 --- a/dlls/dbghelp/mscvpdb.h +++ b/dlls/dbghelp/mscvpdb.h @@ -1185,6 +1185,7 @@ union codeview_symbol union any_size { const char* c; + const unsigned char* uc; const short* s; const int* i; const unsigned int* ui; diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c index 7ec5bf23417..7e217ff47ec 100644 --- a/dlls/dbghelp/pe_module.c +++ b/dlls/dbghelp/pe_module.c @@ -52,12 +52,12 @@ static BOOL pe_load_stabs(const struct process* pcs, struct module* module, ((char*)&nth->OptionalHeader + nth->FileHeader.SizeOfOptionalHeader); for (i = 0; i < nth->FileHeader.NumberOfSections; i++, section++) { - if (!strcasecmp(section->Name, ".stab")) + if (!strcasecmp((const char*)section->Name, ".stab")) { stabs = section->VirtualAddress; stabsize = section->SizeOfRawData; } - else if (!strncasecmp(section->Name, ".stabstr", 8)) + else if (!strncasecmp((const char*)section->Name, ".stabstr", 8)) { stabstr = section->VirtualAddress; stabstrsize = section->SizeOfRawData; @@ -183,7 +183,7 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs, } else { - ret = pe_load_dbg_file(pcs, module, misc->Data, nth->FileHeader.TimeDateStamp); + ret = pe_load_dbg_file(pcs, module, (const char*)misc->Data, nth->FileHeader.TimeDateStamp); } } else diff --git a/dlls/ntdll/cdrom.c b/dlls/ntdll/cdrom.c index cdba93d469e..8da62680c37 100644 --- a/dlls/ntdll/cdrom.c +++ b/dlls/ntdll/cdrom.c @@ -1467,7 +1467,7 @@ static NTSTATUS CDROM_ScsiPassThroughDirect(int fd, PSCSI_PASS_THROUGH_DIRECT pP cmd.dxfer_len = pPacket->DataTransferLength; cmd.dxferp = pPacket->DataBuffer; cmd.cmdp = pPacket->Cdb; - cmd.sbp = (char*)pPacket + pPacket->SenseInfoOffset; + cmd.sbp = (unsigned char*)pPacket + pPacket->SenseInfoOffset; cmd.timeout = pPacket->TimeOutValue*1000; switch (pPacket->DataIn) @@ -1591,7 +1591,7 @@ static NTSTATUS CDROM_ScsiPassThrough(int fd, PSCSI_PASS_THROUGH pPacket) cmd.timeout = pPacket->TimeOutValue*1000; if(cmd.mx_sb_len > 0) - cmd.sbp = (char*)pPacket + pPacket->SenseInfoOffset; + cmd.sbp = (unsigned char*)pPacket + pPacket->SenseInfoOffset; switch (pPacket->DataIn) { diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index eccb190e8fd..fa04f82132e 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -515,7 +515,7 @@ static WINE_MODREF *import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *d { IMAGE_IMPORT_BY_NAME *pe_name = get_rva( module, (DWORD)import_list->u1.AddressOfData ); WARN("No implementation for %s.%s", name, pe_name->Name ); - thunk_list->u1.Function = allocate_stub( name, pe_name->Name ); + thunk_list->u1.Function = allocate_stub( name, (const char*)pe_name->Name ); } WARN(" imported from %s, allocating stub %p\n", debugstr_w(current_modref->ldr.FullDllName.Buffer), @@ -548,10 +548,10 @@ static WINE_MODREF *import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *d IMAGE_IMPORT_BY_NAME *pe_name; pe_name = get_rva( module, (DWORD)import_list->u1.AddressOfData ); thunk_list->u1.Function = (ULONG_PTR)find_named_export( imp_mod, exports, exp_size, - pe_name->Name, pe_name->Hint ); + (const char*)pe_name->Name, pe_name->Hint ); if (!thunk_list->u1.Function) { - thunk_list->u1.Function = allocate_stub( name, pe_name->Name ); + thunk_list->u1.Function = allocate_stub( name, (const char*)pe_name->Name ); WARN("No implementation for %s.%s imported from %s, setting to %p\n", name, pe_name->Name, debugstr_w(current_modref->ldr.FullDllName.Buffer), (void *)thunk_list->u1.Function ); @@ -1707,10 +1707,10 @@ NTSTATUS WINAPI LdrQueryProcessModuleInformation(PSYSTEM_MODULE_INFORMATION smi, sm->Unknown = 0; /* FIXME */ str.Length = 0; str.MaximumLength = MAXIMUM_FILENAME_LENGTH; - str.Buffer = sm->Name; + str.Buffer = (char*)sm->Name; RtlUnicodeStringToAnsiString(&str, &mod->FullDllName, FALSE); - ptr = strrchr(sm->Name, '\\'); - sm->NameOffset = (ptr != NULL) ? (ptr - (char*)sm->Name + 1) : 0; + ptr = strrchr(str.Buffer, '\\'); + sm->NameOffset = (ptr != NULL) ? (ptr - str.Buffer + 1) : 0; smi->ModulesCount++; sm++; diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c index ce94a2dfc0b..798e4815550 100644 --- a/dlls/ntdll/nt.c +++ b/dlls/ntdll/nt.c @@ -497,7 +497,7 @@ NTSTATUS WINAPI NtRequestWaitReplyPort( TRACE("\tMessageId = %lu\n",pLpcMessageIn->MessageId); TRACE("\tSectionSize = %lu\n",pLpcMessageIn->SectionSize); TRACE("\tData = %s\n", - debugstr_an(pLpcMessageIn->Data,pLpcMessageIn->DataSize)); + debugstr_an((const char*)pLpcMessageIn->Data,pLpcMessageIn->DataSize)); } return 0; } diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index 438910d1864..89f64838b99 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -840,7 +840,7 @@ static void test_RtlComputeCrc32(void) if (!pRtlComputeCrc32) return; - crc = pRtlComputeCrc32(crc, src, LEN); + crc = pRtlComputeCrc32(crc, (LPBYTE)src, LEN); ok(crc == 0x40861dc2,"Expected 0x40861dc2, got %8lx\n", crc); } diff --git a/dlls/ntdll/time.c b/dlls/ntdll/time.c index 2b754d1eb92..1906bca2c63 100644 --- a/dlls/ntdll/time.c +++ b/dlls/ntdll/time.c @@ -757,7 +757,7 @@ void WINAPI RtlSecondsSince1980ToTime( DWORD Seconds, LARGE_INTEGER *Time ) void WINAPI RtlTimeToElapsedTimeFields( const LARGE_INTEGER *Time, PTIME_FIELDS TimeFields ) { LONGLONG time; - UINT rem; + INT rem; time = RtlExtendedLargeIntegerDivide( Time->QuadPart, TICKSPERSEC, &rem ); TimeFields->Milliseconds = rem / TICKSPERMSEC; diff --git a/programs/progman/grpfile.c b/programs/progman/grpfile.c index d4c5b8843df..024d40289f6 100644 --- a/programs/progman/grpfile.c +++ b/programs/progman/grpfile.c @@ -515,7 +515,7 @@ static UINT GRPFILE_WriteWithChecksum(HFILE file, LPCSTR str, UINT size) static BOOL GRPFILE_DoWriteGroupFile(HFILE file, PROGGROUP *group) { - BYTE buffer[34]; + CHAR buffer[34]; HLOCAL hProgram; INT NumProg, Title, Progs, Icons, Extension; INT CurrProg, CurrIcon, nCmdShow, ptr, seqnum;