Commit 5f4ccc01 authored by Frédéric Delanoy's avatar Frédéric Delanoy Committed by Alexandre Julliard

winedump: Use BOOL type where appropriate.

parent 393135c3
...@@ -188,14 +188,14 @@ static const lnk_string* fetch_string(int unicode) ...@@ -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; const lnk_string *pidl;
int i, n = 0, sz = 0; int i, n = 0, sz = 0;
pidl = fetch_string(FALSE); pidl = fetch_string(FALSE);
if (!pidl) if (!pidl)
return -1; return;
printf("PIDL\n"); printf("PIDL\n");
printf("----\n\n"); printf("----\n\n");
...@@ -219,18 +219,16 @@ static int dump_pidl(void) ...@@ -219,18 +219,16 @@ static int dump_pidl(void)
printf("\n"); printf("\n");
} }
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; const lnk_string *data;
unsigned sz; unsigned sz;
data = fetch_string(unicode); data = fetch_string(unicode);
if (!data) if (!data)
return -1; return;
printf("%s : ", what); printf("%s : ", what);
sz = data->size; sz = data->size;
if (unicode) if (unicode)
...@@ -238,18 +236,16 @@ static int dump_string(const char *what, int unicode) ...@@ -238,18 +236,16 @@ static int dump_string(const char *what, int unicode)
else else
while (sz) printf("%c", data->str.a[data->size - sz--]); while (sz) printf("%c", data->str.a[data->size - sz--]);
printf("\n"); printf("\n");
return 0;
} }
static int dump_location(void) static void dump_location(void)
{ {
const LOCATION_INFO *loc; const LOCATION_INFO *loc;
const char *p; const char *p;
loc = fetch_block(); loc = fetch_block();
if (!loc) if (!loc)
return -1; return;
p = (const char*)loc; p = (const char*)loc;
printf("Location\n"); printf("Location\n");
...@@ -297,8 +293,6 @@ static int dump_location(void) ...@@ -297,8 +293,6 @@ static int dump_location(void)
printf("(\"%s\")", &p[loc->dwFinalPathOfs]); printf("(\"%s\")", &p[loc->dwFinalPathOfs]);
printf("\n"); printf("\n");
printf("\n"); printf("\n");
return 0;
} }
static const unsigned char table_dec85[0x80] = { static const unsigned char table_dec85[0x80] = {
...@@ -338,7 +332,7 @@ static BOOL base85_to_guid( const char *str, LPGUID guid ) ...@@ -338,7 +332,7 @@ static BOOL base85_to_guid( const char *str, LPGUID guid )
return TRUE; 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; const EXP_SPECIAL_FOLDER *sfb = (const EXP_SPECIAL_FOLDER*)bhdr;
printf("Special folder block\n"); printf("Special folder block\n");
...@@ -346,10 +340,9 @@ static int dump_special_folder_block(const DATABLOCK_HEADER* bhdr) ...@@ -346,10 +340,9 @@ static int dump_special_folder_block(const DATABLOCK_HEADER* bhdr)
printf("folder = 0x%04x\n", sfb->idSpecialFolder); printf("folder = 0x%04x\n", sfb->idSpecialFolder);
printf("offset = %d\n", sfb->cbOffset); printf("offset = %d\n", sfb->cbOffset);
printf("\n"); 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; const LINK_SZ_BLOCK *szp = (const LINK_SZ_BLOCK*)bhdr;
printf("String block\n"); printf("String block\n");
...@@ -357,10 +350,9 @@ static int dump_sz_block(const DATABLOCK_HEADER* bhdr, const char* label) ...@@ -357,10 +350,9 @@ static int dump_sz_block(const DATABLOCK_HEADER* bhdr, const char* label)
printf("magic = %x\n", szp->magic); printf("magic = %x\n", szp->magic);
printf("%s = %s\n", label, szp->bufA); printf("%s = %s\n", label, szp->bufA);
printf("\n"); 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; const LINK_SZ_BLOCK *szp = (const LINK_SZ_BLOCK*)bhdr;
char comp_str[40]; char comp_str[40];
...@@ -399,8 +391,6 @@ static int dump_darwin_id(const DATABLOCK_HEADER* bhdr) ...@@ -399,8 +391,6 @@ static int dump_darwin_id(const DATABLOCK_HEADER* bhdr)
printf(" component: %s\n", comp_str ); printf(" component: %s\n", comp_str );
printf(" feature: %s\n", feat_str); printf(" feature: %s\n", feat_str);
printf("\n"); printf("\n");
return 0;
} }
static void dump_property_storage_value(const LINK_PROPERTYSTORAGE_VALUE *lnk_value_hdr, 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 ...@@ -445,7 +435,7 @@ static void dump_property_storage_value(const LINK_PROPERTYSTORAGE_VALUE *lnk_va
printf(" missing terminator!\n"); 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; int data_size;
const LINK_PROPERTYSTORAGE_GUID *lnk_guid_hdr; const LINK_PROPERTYSTORAGE_GUID *lnk_guid_hdr;
...@@ -468,8 +458,8 @@ static int dump_property_storage(const DATABLOCK_HEADER* bhdr) ...@@ -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)) if (lnk_guid_hdr->size > data_size || lnk_guid_hdr->size < sizeof(*lnk_guid_hdr))
{ {
printf("size: %d (invald)\n", lnk_guid_hdr->size); printf("size: %d (invalid)\n", lnk_guid_hdr->size);
return 1; return;
} }
if (lnk_guid_hdr->magic != 0x53505331) if (lnk_guid_hdr->magic != 0x53505331)
...@@ -488,11 +478,9 @@ static int dump_property_storage(const DATABLOCK_HEADER* bhdr) ...@@ -488,11 +478,9 @@ static int dump_property_storage(const DATABLOCK_HEADER* bhdr)
printf("missing terminator!\n"); printf("missing terminator!\n");
printf("\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; int data_size;
...@@ -529,8 +517,6 @@ static BOOL dump_raw_block(const DATABLOCK_HEADER* bhdr) ...@@ -529,8 +517,6 @@ static BOOL dump_raw_block(const DATABLOCK_HEADER* bhdr)
} }
} }
printf("\n"); printf("\n");
return TRUE;
} }
static const GUID CLSID_ShellLink = {0x00021401L, 0, 0, {0xC0,0,0,0,0,0,0,0x46}}; static const GUID CLSID_ShellLink = {0x00021401L, 0, 0, {0xC0,0,0,0,0,0,0,0x46}};
......
...@@ -433,7 +433,7 @@ int main (int argc, char *argv[]) ...@@ -433,7 +433,7 @@ int main (int argc, char *argv[])
output_header_preamble (); output_header_preamble ();
output_c_preamble (); output_c_preamble ();
while (!dll_next_symbol (&symbol)) while (dll_next_symbol (&symbol))
{ {
count++; count++;
......
...@@ -1665,13 +1665,13 @@ BOOL dll_open (const char *dll_name) ...@@ -1665,13 +1665,13 @@ BOOL dll_open (const char *dll_name)
* *
* Get next exported symbol from dll * 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) if (!dll_current_symbol || !dll_current_symbol->symbol)
return 1; return FALSE;
assert (dll_symbols); assert (dll_symbols);
sym->symbol = strdup (dll_current_symbol->symbol); sym->symbol = strdup (dll_current_symbol->symbol);
sym->ordinal = dll_current_symbol->ordinal; sym->ordinal = dll_current_symbol->ordinal;
dll_current_symbol++; dll_current_symbol++;
return 0; return TRUE;
} }
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
static char *grep_buff = NULL; static char *grep_buff = NULL;
static char *fgrep_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); static const char *get_type (parsed_symbol *sym, const char *proto, int arg);
...@@ -133,7 +133,7 @@ int symbol_search (parsed_symbol *sym) ...@@ -133,7 +133,7 @@ int symbol_search (parsed_symbol *sym)
if (VERBOSE) if (VERBOSE)
printf ("Prototype '%s' looks OK, processing\n", grep_buff); 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 (f_grep);
pclose (grep); pclose (grep);
...@@ -161,14 +161,14 @@ int symbol_search (parsed_symbol *sym) ...@@ -161,14 +161,14 @@ int symbol_search (parsed_symbol *sym)
* *
* Convert a C prototype into a symbol * 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; const char *iter;
BOOL found; BOOL found;
proto = get_type (sym, proto, -1); /* Get return type */ proto = get_type (sym, proto, -1); /* Get return type */
if (!proto) if (!proto)
return -1; return FALSE;
iter = str_match (proto, sym->symbol, &found); iter = str_match (proto, sym->symbol, &found);
...@@ -178,7 +178,7 @@ static int symbol_from_prototype (parsed_symbol *sym, const char *proto) ...@@ -178,7 +178,7 @@ static int symbol_from_prototype (parsed_symbol *sym, const char *proto)
/* Calling Convention */ /* Calling Convention */
iter = strchr (iter, ' '); iter = strchr (iter, ' ');
if (!iter) if (!iter)
return -1; return FALSE;
call = str_substring (proto, iter); call = str_substring (proto, iter);
...@@ -190,7 +190,7 @@ static int symbol_from_prototype (parsed_symbol *sym, const char *proto) ...@@ -190,7 +190,7 @@ static int symbol_from_prototype (parsed_symbol *sym, const char *proto)
iter = str_match (iter, sym->symbol, &found); iter = str_match (iter, sym->symbol, &found);
if (!found) if (!found)
return -1; return FALSE;
if (VERBOSE) if (VERBOSE)
printf ("Using %s calling convention\n", printf ("Using %s calling convention\n",
...@@ -204,33 +204,33 @@ static int symbol_from_prototype (parsed_symbol *sym, const char *proto) ...@@ -204,33 +204,33 @@ static int symbol_from_prototype (parsed_symbol *sym, const char *proto)
/* Now should be the arguments */ /* Now should be the arguments */
if (*proto++ != '(') if (*proto++ != '(')
return -1; return FALSE;
for (; *proto == ' '; proto++); for (; *proto == ' '; proto++);
if (!strncmp (proto, "void", 4)) if (!strncmp (proto, "void", 4))
return 0; return TRUE;
do do
{ {
/* Process next argument */ /* Process next argument */
str_match (proto, "...", &sym->varargs); str_match (proto, "...", &sym->varargs);
if (sym->varargs) if (sym->varargs)
return 0; return TRUE;
if (!(proto = get_type (sym, proto, sym->argc))) if (!(proto = get_type (sym, proto, sym->argc)))
return -1; return FALSE;
sym->argc++; sym->argc++;
if (*proto == ',') if (*proto == ',')
proto++; proto++;
else if (*proto != ')') else if (*proto != ')')
return -1; return FALSE;
} while (*proto != ')'); } while (*proto != ')');
return 0; return TRUE;
} }
......
...@@ -89,11 +89,10 @@ static const char * const known_longs[] = ...@@ -89,11 +89,10 @@ static const char * const known_longs[] =
"WCHAR", "BOOL", "bool", "INT16", "WORD", "DWORD", NULL "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)); memset(sym, 0, sizeof(parsed_symbol));
sym->symbol = strdup(name); sym->symbol = strdup(name);
return 0;
} }
/******************************************************************* /*******************************************************************
......
...@@ -159,10 +159,10 @@ void dump_file(const char* name); ...@@ -159,10 +159,10 @@ void dump_file(const char* name);
/* DLL functions */ /* DLL functions */
BOOL dll_open (const char *dll_name); BOOL dll_open (const char *dll_name);
int dll_next_symbol (parsed_symbol * sym); BOOL dll_next_symbol (parsed_symbol * sym);
/* Symbol functions */ /* 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); int symbol_demangle (parsed_symbol *symbol);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment