From 5f4ccc016f6cca6f2357daa955aa70e59406e108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delanoy?= Date: Thu, 2 Jan 2014 02:16:51 +0100 Subject: [PATCH] winedump: Use BOOL type where appropriate. --- tools/winedump/lnk.c | 40 +++++++++++++-------------------------- tools/winedump/main.c | 2 +- tools/winedump/pe.c | 6 +++--- tools/winedump/search.c | 24 +++++++++++------------ tools/winedump/symbol.c | 3 +-- tools/winedump/winedump.h | 4 ++-- 6 files changed, 32 insertions(+), 47 deletions(-) diff --git a/tools/winedump/lnk.c b/tools/winedump/lnk.c index 5f496bc1208..b0f6580cb3d 100644 --- a/tools/winedump/lnk.c +++ b/tools/winedump/lnk.c @@ -188,14 +188,14 @@ static const lnk_string* fetch_string(int unicode) } -static int dump_pidl(void) +static void dump_pidl(void) { const lnk_string *pidl; int i, n = 0, sz = 0; pidl = fetch_string(FALSE); if (!pidl) - return -1; + return; printf("PIDL\n"); printf("----\n\n"); @@ -219,18 +219,16 @@ static int dump_pidl(void) printf("\n"); } printf("\n"); - - return 0; } -static int dump_string(const char *what, int unicode) +static void dump_string(const char *what, int unicode) { const lnk_string *data; unsigned sz; data = fetch_string(unicode); if (!data) - return -1; + return; printf("%s : ", what); sz = data->size; if (unicode) @@ -238,18 +236,16 @@ static int dump_string(const char *what, int unicode) else while (sz) printf("%c", data->str.a[data->size - sz--]); printf("\n"); - - return 0; } -static int dump_location(void) +static void dump_location(void) { const LOCATION_INFO *loc; const char *p; loc = fetch_block(); if (!loc) - return -1; + return; p = (const char*)loc; printf("Location\n"); @@ -297,8 +293,6 @@ static int dump_location(void) printf("(\"%s\")", &p[loc->dwFinalPathOfs]); printf("\n"); printf("\n"); - - return 0; } static const unsigned char table_dec85[0x80] = { @@ -338,7 +332,7 @@ static BOOL base85_to_guid( const char *str, LPGUID guid ) return TRUE; } -static int dump_special_folder_block(const DATABLOCK_HEADER* bhdr) +static void dump_special_folder_block(const DATABLOCK_HEADER* bhdr) { const EXP_SPECIAL_FOLDER *sfb = (const EXP_SPECIAL_FOLDER*)bhdr; printf("Special folder block\n"); @@ -346,10 +340,9 @@ static int dump_special_folder_block(const DATABLOCK_HEADER* bhdr) printf("folder = 0x%04x\n", sfb->idSpecialFolder); printf("offset = %d\n", sfb->cbOffset); printf("\n"); - return 0; } -static int dump_sz_block(const DATABLOCK_HEADER* bhdr, const char* label) +static void dump_sz_block(const DATABLOCK_HEADER* bhdr, const char* label) { const LINK_SZ_BLOCK *szp = (const LINK_SZ_BLOCK*)bhdr; printf("String block\n"); @@ -357,10 +350,9 @@ static int dump_sz_block(const DATABLOCK_HEADER* bhdr, const char* label) printf("magic = %x\n", szp->magic); printf("%s = %s\n", label, szp->bufA); printf("\n"); - return 0; } -static int dump_darwin_id(const DATABLOCK_HEADER* bhdr) +static void dump_darwin_id(const DATABLOCK_HEADER* bhdr) { const LINK_SZ_BLOCK *szp = (const LINK_SZ_BLOCK*)bhdr; char comp_str[40]; @@ -399,8 +391,6 @@ static int dump_darwin_id(const DATABLOCK_HEADER* bhdr) printf(" component: %s\n", comp_str ); printf(" feature: %s\n", feat_str); printf("\n"); - - return 0; } static void dump_property_storage_value(const LINK_PROPERTYSTORAGE_VALUE *lnk_value_hdr, @@ -445,7 +435,7 @@ static void dump_property_storage_value(const LINK_PROPERTYSTORAGE_VALUE *lnk_va printf(" missing terminator!\n"); } -static int dump_property_storage(const DATABLOCK_HEADER* bhdr) +static void dump_property_storage(const DATABLOCK_HEADER* bhdr) { int data_size; const LINK_PROPERTYSTORAGE_GUID *lnk_guid_hdr; @@ -468,8 +458,8 @@ static int dump_property_storage(const DATABLOCK_HEADER* bhdr) if (lnk_guid_hdr->size > data_size || lnk_guid_hdr->size < sizeof(*lnk_guid_hdr)) { - printf("size: %d (invald)\n", lnk_guid_hdr->size); - return 1; + printf("size: %d (invalid)\n", lnk_guid_hdr->size); + return; } if (lnk_guid_hdr->magic != 0x53505331) @@ -488,11 +478,9 @@ static int dump_property_storage(const DATABLOCK_HEADER* bhdr) printf("missing terminator!\n"); printf("\n"); - - return 0; } -static BOOL dump_raw_block(const DATABLOCK_HEADER* bhdr) +static void dump_raw_block(const DATABLOCK_HEADER* bhdr) { int data_size; @@ -529,8 +517,6 @@ static BOOL dump_raw_block(const DATABLOCK_HEADER* bhdr) } } printf("\n"); - - return TRUE; } static const GUID CLSID_ShellLink = {0x00021401L, 0, 0, {0xC0,0,0,0,0,0,0,0x46}}; diff --git a/tools/winedump/main.c b/tools/winedump/main.c index 018f94bdca5..9b076e149dd 100644 --- a/tools/winedump/main.c +++ b/tools/winedump/main.c @@ -433,7 +433,7 @@ int main (int argc, char *argv[]) output_header_preamble (); output_c_preamble (); - while (!dll_next_symbol (&symbol)) + while (dll_next_symbol (&symbol)) { count++; diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c index 0ca82f59a3d..607f56f08f7 100644 --- a/tools/winedump/pe.c +++ b/tools/winedump/pe.c @@ -1665,13 +1665,13 @@ BOOL dll_open (const char *dll_name) * * Get next exported symbol from dll */ -int dll_next_symbol (parsed_symbol * sym) +BOOL dll_next_symbol (parsed_symbol * sym) { if (!dll_current_symbol || !dll_current_symbol->symbol) - return 1; + return FALSE; assert (dll_symbols); sym->symbol = strdup (dll_current_symbol->symbol); sym->ordinal = dll_current_symbol->ordinal; dll_current_symbol++; - return 0; + return TRUE; } diff --git a/tools/winedump/search.c b/tools/winedump/search.c index 8d18131f97e..7b3a98f2d21 100644 --- a/tools/winedump/search.c +++ b/tools/winedump/search.c @@ -26,7 +26,7 @@ static char *grep_buff = NULL; static char *fgrep_buff = NULL; -static int symbol_from_prototype (parsed_symbol *sym, const char *prototype); +static BOOL symbol_from_prototype (parsed_symbol *sym, const char *prototype); static const char *get_type (parsed_symbol *sym, const char *proto, int arg); @@ -133,7 +133,7 @@ int symbol_search (parsed_symbol *sym) if (VERBOSE) printf ("Prototype '%s' looks OK, processing\n", grep_buff); - if (!symbol_from_prototype (sym, grep_buff)) + if (symbol_from_prototype (sym, grep_buff)) { pclose (f_grep); pclose (grep); @@ -161,14 +161,14 @@ int symbol_search (parsed_symbol *sym) * * Convert a C prototype into a symbol */ -static int symbol_from_prototype (parsed_symbol *sym, const char *proto) +static BOOL symbol_from_prototype (parsed_symbol *sym, const char *proto) { const char *iter; BOOL found; proto = get_type (sym, proto, -1); /* Get return type */ if (!proto) - return -1; + return FALSE; iter = str_match (proto, sym->symbol, &found); @@ -178,7 +178,7 @@ static int symbol_from_prototype (parsed_symbol *sym, const char *proto) /* Calling Convention */ iter = strchr (iter, ' '); if (!iter) - return -1; + return FALSE; call = str_substring (proto, iter); @@ -190,7 +190,7 @@ static int symbol_from_prototype (parsed_symbol *sym, const char *proto) iter = str_match (iter, sym->symbol, &found); if (!found) - return -1; + return FALSE; if (VERBOSE) printf ("Using %s calling convention\n", @@ -204,33 +204,33 @@ static int symbol_from_prototype (parsed_symbol *sym, const char *proto) /* Now should be the arguments */ if (*proto++ != '(') - return -1; + return FALSE; for (; *proto == ' '; proto++); if (!strncmp (proto, "void", 4)) - return 0; + return TRUE; do { /* Process next argument */ str_match (proto, "...", &sym->varargs); if (sym->varargs) - return 0; + return TRUE; if (!(proto = get_type (sym, proto, sym->argc))) - return -1; + return FALSE; sym->argc++; if (*proto == ',') proto++; else if (*proto != ')') - return -1; + return FALSE; } while (*proto != ')'); - return 0; + return TRUE; } diff --git a/tools/winedump/symbol.c b/tools/winedump/symbol.c index 4dccb451f30..8511654438f 100644 --- a/tools/winedump/symbol.c +++ b/tools/winedump/symbol.c @@ -89,11 +89,10 @@ static const char * const known_longs[] = "WCHAR", "BOOL", "bool", "INT16", "WORD", "DWORD", NULL }; -int symbol_init(parsed_symbol* sym, const char* name) +void symbol_init(parsed_symbol* sym, const char* name) { memset(sym, 0, sizeof(parsed_symbol)); sym->symbol = strdup(name); - return 0; } /******************************************************************* diff --git a/tools/winedump/winedump.h b/tools/winedump/winedump.h index 45243cfbe6c..ea7fc87a27e 100644 --- a/tools/winedump/winedump.h +++ b/tools/winedump/winedump.h @@ -159,10 +159,10 @@ void dump_file(const char* name); /* DLL functions */ BOOL dll_open (const char *dll_name); -int dll_next_symbol (parsed_symbol * sym); +BOOL dll_next_symbol (parsed_symbol * sym); /* Symbol functions */ -int symbol_init(parsed_symbol* symbol, const char* name); +void symbol_init(parsed_symbol* symbol, const char* name); int symbol_demangle (parsed_symbol *symbol);