winedump: Use BOOL type where appropriate.

This commit is contained in:
Frédéric Delanoy 2014-01-02 02:16:51 +01:00 committed by Alexandre Julliard
parent 393135c3c7
commit 5f4ccc016f
6 changed files with 32 additions and 47 deletions

View File

@ -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}};

View File

@ -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++;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
/*******************************************************************

View File

@ -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);