winedump: Use BOOL type where appropriate.

This commit is contained in:
Frédéric Delanoy 2013-12-05 00:58:10 +01:00 committed by Alexandre Julliard
parent 67545ed54c
commit 35f82370ab
9 changed files with 40 additions and 37 deletions

View File

@ -247,10 +247,10 @@ dumpers[] =
{SIG_UNKNOWN, NULL, NULL} /* sentinel */ {SIG_UNKNOWN, NULL, NULL} /* sentinel */
}; };
int dump_analysis(const char *name, file_dumper fn, enum FileSig wanted_sig) BOOL dump_analysis(const char *name, file_dumper fn, enum FileSig wanted_sig)
{ {
int fd; int fd;
int ret = 1; BOOL ret = TRUE;
struct stat s; struct stat s;
const struct dumper *dpr; const struct dumper *dpr;
@ -284,7 +284,7 @@ int dump_analysis(const char *name, file_dumper fn, enum FileSig wanted_sig)
if (dpr->kind == SIG_UNKNOWN) if (dpr->kind == SIG_UNKNOWN)
{ {
printf("Can't get a suitable file signature, aborting\n"); printf("Can't get a suitable file signature, aborting\n");
ret = 0; ret = FALSE;
} }
if (ret) printf("Done dumping %s\n", name); if (ret) printf("Done dumping %s\n", name);

View File

@ -149,7 +149,7 @@ enum FileSig get_kind_lib(void)
void lib_dump(void) void lib_dump(void)
{ {
int first_linker_member = 1; BOOL first_linker_member = TRUE;
unsigned long cur_file_pos, long_names_size = 0; unsigned long cur_file_pos, long_names_size = 0;
const IMAGE_ARCHIVE_MEMBER_HEADER *iamh; const IMAGE_ARCHIVE_MEMBER_HEADER *iamh;
const char *long_names = NULL; const char *long_names = NULL;
@ -268,7 +268,7 @@ void lib_dump(void)
dump_long_import(fh, (const IMAGE_SECTION_HEADER *)((const char *)fh + sizeof(*fh) + fh->SizeOfOptionalHeader), fh->NumberOfSections); dump_long_import(fh, (const IMAGE_SECTION_HEADER *)((const char *)fh + sizeof(*fh) + fh->SizeOfOptionalHeader), fh->NumberOfSections);
} }
first_linker_member = 0; first_linker_member = FALSE;
cur_file_pos += size; cur_file_pos += size;
} }
} }

View File

@ -312,7 +312,7 @@ static const unsigned char table_dec85[0x80] = {
0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0xff,0x53,0x54,0xff, 0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0xff,0x53,0x54,0xff,
}; };
static int base85_to_guid( const char *str, LPGUID guid ) static BOOL base85_to_guid( const char *str, LPGUID guid )
{ {
DWORD i, val = 0, base = 1, *p; DWORD i, val = 0, base = 1, *p;
unsigned char ch; unsigned char ch;
@ -327,15 +327,15 @@ static int base85_to_guid( const char *str, LPGUID guid )
} }
ch = str[i]; ch = str[i];
if( ch >= 0x80 ) if( ch >= 0x80 )
return 0; return FALSE;
val += table_dec85[ch] * base; val += table_dec85[ch] * base;
if( table_dec85[ch] == 0xff ) if( table_dec85[ch] == 0xff )
return 0; return FALSE;
if( (i%5) == 4 ) if( (i%5) == 4 )
p[i/5] = val; p[i/5] = val;
base *= 85; base *= 85;
} }
return 1; return TRUE;
} }
static int dump_special_folder_block(const DATABLOCK_HEADER* bhdr) static int dump_special_folder_block(const DATABLOCK_HEADER* bhdr)
@ -406,14 +406,15 @@ static int dump_darwin_id(const DATABLOCK_HEADER* bhdr)
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,
DWORD data_size) DWORD data_size)
{ {
int got_terminator = 0, i, value_size; BOOL got_terminator = FALSE;
int i, value_size;
const unsigned char *value; const unsigned char *value;
while (data_size >= sizeof(DWORD)) while (data_size >= sizeof(DWORD))
{ {
if (!lnk_value_hdr->size) if (!lnk_value_hdr->size)
{ {
got_terminator = 1; got_terminator = TRUE;
break; break;
} }
@ -448,7 +449,7 @@ static int 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;
int got_terminator = 0; BOOL got_terminator = FALSE;
printf("Property Storage\n"); printf("Property Storage\n");
printf("--------------\n\n"); printf("--------------\n\n");
@ -461,7 +462,7 @@ static int dump_property_storage(const DATABLOCK_HEADER* bhdr)
{ {
if (!lnk_guid_hdr->size) if (!lnk_guid_hdr->size)
{ {
got_terminator = 1; got_terminator = TRUE;
break; break;
} }
@ -491,7 +492,7 @@ static int dump_property_storage(const DATABLOCK_HEADER* bhdr)
return 0; return 0;
} }
static int dump_raw_block(const DATABLOCK_HEADER* bhdr) static BOOL dump_raw_block(const DATABLOCK_HEADER* bhdr)
{ {
int data_size; int data_size;
@ -529,7 +530,7 @@ static int dump_raw_block(const DATABLOCK_HEADER* bhdr)
} }
printf("\n"); printf("\n");
return 1; 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}};

View File

@ -148,7 +148,7 @@ static void do_symfile (const char *arg)
if (!(symbolp = malloc(sizeof(*symbolp) + strlen(symstring)))) if (!(symbolp = malloc(sizeof(*symbolp) + strlen(symstring))))
fatal ("Out of memory"); fatal ("Out of memory");
strcpy(symbolp->symbolname, symstring); strcpy(symbolp->symbolname, symstring);
symbolp->found = 0; symbolp->found = FALSE;
symbolp->next = NULL; symbolp->next = NULL;
*symbolptail = symbolp; *symbolptail = symbolp;
symbolptail = &symbolp->next; symbolptail = &symbolp->next;
@ -320,7 +320,7 @@ static void parse_options (char *argv[])
do_dump(""); do_dump("");
} }
static void set_module_name(unsigned setUC) static void set_module_name(BOOL setUC)
{ {
const char* ptr; const char* ptr;
char* buf; char* buf;
@ -361,7 +361,7 @@ static BOOL symbol_searched(int count, const char *symbolname)
{ {
if (!strcmp(symbolname, search_symbol->symbolname)) if (!strcmp(symbolname, search_symbol->symbolname))
{ {
search_symbol->found = 1; search_symbol->found = TRUE;
return TRUE; return TRUE;
} }
} }
@ -425,7 +425,7 @@ int main (int argc, char *argv[])
case SPEC: case SPEC:
if (globals.input_name == NULL) if (globals.input_name == NULL)
fatal("No file name has been given\n"); fatal("No file name has been given\n");
set_module_name(1); set_module_name(TRUE);
if (!dll_open (globals.input_name)) if (!dll_open (globals.input_name))
break; break;
@ -479,7 +479,7 @@ int main (int argc, char *argv[])
case DUMP: case DUMP:
if (globals.input_name == NULL) if (globals.input_name == NULL)
fatal("No file name has been given\n"); fatal("No file name has been given\n");
set_module_name(0); set_module_name(FALSE);
dump_file(globals.input_name); dump_file(globals.input_name);
break; break;
} }

View File

@ -134,19 +134,19 @@ char *str_replace (char *str, const char *oldstr, const char *newstr)
* *
* Locate one string in another, ignoring spaces * Locate one string in another, ignoring spaces
*/ */
const char *str_match (const char *str, const char *match, int *found) const char *str_match (const char *str, const char *match, BOOL *found)
{ {
assert(str && match && found); assert(str && match && found);
while (*str == ' ') str++; while (*str == ' ') str++;
if (!strncmp (str, match, strlen (match))) if (!strncmp (str, match, strlen (match)))
{ {
*found = 1; *found = TRUE;
str += strlen (match); str += strlen (match);
while (*str == ' ') str++; while (*str == ' ') str++;
} }
else else
*found = 0; *found = FALSE;
return str; return str;
} }

View File

@ -28,7 +28,7 @@ typedef struct _compound_type
{ {
char dest_type; char dest_type;
int flags; int flags;
int have_qualifiers; BOOL have_qualifiers;
char *expression; char *expression;
} compound_type; } compound_type;
@ -66,7 +66,8 @@ static char *get_pointer_type_string (compound_type *ct,
int symbol_demangle (parsed_symbol *sym) int symbol_demangle (parsed_symbol *sym)
{ {
compound_type ct; compound_type ct;
int is_static = 0, is_const = 0; BOOL is_static = FALSE;
int is_const = 0;
char *function_name = NULL; char *function_name = NULL;
char *class_name = NULL; char *class_name = NULL;
char *name; char *name;
@ -207,7 +208,7 @@ int symbol_demangle (parsed_symbol *sym)
case '0' : /* private static */ case '0' : /* private static */
case '1' : /* protected static */ case '1' : /* protected static */
case '2' : /* public static */ case '2' : /* public static */
is_static = 1; is_static = TRUE;
/* Fall through */ /* Fall through */
case '3' : /* non static */ case '3' : /* non static */
case '4' : /* non static */ case '4' : /* non static */
@ -285,7 +286,7 @@ int symbol_demangle (parsed_symbol *sym)
case 'L' : /* protected: static */ case 'L' : /* protected: static */
case 'S' : /* public: static */ case 'S' : /* public: static */
case 'T' : /* public: static */ case 'T' : /* public: static */
is_static = 1; /* No implicit this pointer */ is_static = TRUE; /* No implicit this pointer */
break; break;
case 'Y' : case 'Y' :
case 'Z' : case 'Z' :
@ -632,7 +633,7 @@ static char *get_constraints_convention_1 (char **str, compound_type *ct)
if (*iter == '?' || *iter == 'A') if (*iter == '?' || *iter == 'A')
{ {
ct->have_qualifiers = 1; ct->have_qualifiers = TRUE;
ct->flags |= (*iter++ == '?' ? 0 : CT_BY_REFERENCE); ct->flags |= (*iter++ == '?' ? 0 : CT_BY_REFERENCE);
switch (*iter++) switch (*iter++)
@ -667,7 +668,7 @@ static char *get_constraints_convention_2 (char **str, compound_type *ct)
if (ct->have_qualifiers && ct->dest_type != 'Q') if (ct->have_qualifiers && ct->dest_type != 'Q')
return (char *)*str; /* Previously got constraints for this type */ return (char *)*str; /* Previously got constraints for this type */
ct->have_qualifiers = 1; /* Even if none, we've got all we're getting */ ct->have_qualifiers = TRUE; /* Even if none, we've got all we're getting */
switch (*iter) switch (*iter)
{ {

View File

@ -97,7 +97,7 @@ static const IMAGE_NT_HEADERS32 *get_nt_header( void )
return PRD(dos->e_lfanew, sizeof(DWORD) + sizeof(IMAGE_FILE_HEADER)); return PRD(dos->e_lfanew, sizeof(DWORD) + sizeof(IMAGE_FILE_HEADER));
} }
static int is_fake_dll( void ) static BOOL is_fake_dll( void )
{ {
static const char fakedll_signature[] = "Wine placeholder DLL"; static const char fakedll_signature[] = "Wine placeholder DLL";
const IMAGE_DOS_HEADER *dos; const IMAGE_DOS_HEADER *dos;
@ -1655,7 +1655,7 @@ static void do_grab_sym( void )
* *
* Open a DLL and read in exported symbols * Open a DLL and read in exported symbols
*/ */
int dll_open (const char *dll_name) BOOL dll_open (const char *dll_name)
{ {
return dump_analysis(dll_name, do_grab_sym, SIG_PE); return dump_analysis(dll_name, do_grab_sym, SIG_PE);
} }

View File

@ -164,7 +164,7 @@ int symbol_search (parsed_symbol *sym)
static int symbol_from_prototype (parsed_symbol *sym, const char *proto) static int symbol_from_prototype (parsed_symbol *sym, const char *proto)
{ {
const char *iter; const char *iter;
int 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)
@ -241,7 +241,8 @@ static int symbol_from_prototype (parsed_symbol *sym, const char *proto)
*/ */
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)
{ {
int is_const, is_volatile, is_struct, is_signed, is_unsigned, ptrs = 0; BOOL is_const, is_volatile, is_struct, is_signed, is_unsigned;
int ptrs = 0;
const char *iter, *base_type, *catch_unsigned, *proto_str; const char *iter, *base_type, *catch_unsigned, *proto_str;
char dest_type, *type_str; char dest_type, *type_str;

View File

@ -95,7 +95,7 @@ typedef struct __parsed_symbol
typedef struct __search_symbol typedef struct __search_symbol
{ {
struct __search_symbol *next; struct __search_symbol *next;
int found; BOOL found;
char symbolname[1]; /* static string, be ANSI C compliant by [1] */ char symbolname[1]; /* static string, be ANSI C compliant by [1] */
} search_symbol; } search_symbol;
@ -157,7 +157,7 @@ extern _globals globals;
void dump_file(const char* name); void dump_file(const char* name);
/* DLL functions */ /* DLL functions */
int dll_open (const char *dll_name); BOOL dll_open (const char *dll_name);
int dll_next_symbol (parsed_symbol * sym); int dll_next_symbol (parsed_symbol * sym);
@ -206,7 +206,7 @@ char *str_substring(const char *start, const char *end);
char *str_replace (char *str, const char *oldstr, const char *newstr); char *str_replace (char *str, const char *oldstr, const char *newstr);
const char *str_match (const char *str, const char *match, int *found); const char *str_match (const char *str, const char *match, BOOL *found);
const char *str_find_set (const char *str, const char *findset); const char *str_find_set (const char *str, const char *findset);
@ -222,7 +222,7 @@ const void* PRD(unsigned long prd, unsigned long len);
unsigned long Offset(const void* ptr); unsigned long Offset(const void* ptr);
typedef void (*file_dumper)(void); typedef void (*file_dumper)(void);
int dump_analysis(const char*, file_dumper, enum FileSig); BOOL dump_analysis(const char*, file_dumper, enum FileSig);
void dump_data( const unsigned char *ptr, unsigned int size, const char *prefix ); void dump_data( const unsigned char *ptr, unsigned int size, const char *prefix );
const char* get_time_str( unsigned long ); const char* get_time_str( unsigned long );