winedump: Use BOOL type where appropriate
Frédéric Delanoy
frederic.delanoy at gmail.com
Wed Dec 4 17:58:10 CST 2013
---
tools/winedump/dump.c | 6 +++---
tools/winedump/lib.c | 4 ++--
tools/winedump/lnk.c | 21 +++++++++++----------
tools/winedump/main.c | 10 +++++-----
tools/winedump/misc.c | 6 +++---
tools/winedump/msmangle.c | 13 +++++++------
tools/winedump/pe.c | 4 ++--
tools/winedump/search.c | 5 +++--
tools/winedump/winedump.h | 8 ++++----
9 files changed, 40 insertions(+), 37 deletions(-)
diff --git a/tools/winedump/dump.c b/tools/winedump/dump.c
index 5da8a10..f263390 100644
--- a/tools/winedump/dump.c
+++ b/tools/winedump/dump.c
@@ -247,10 +247,10 @@ dumpers[] =
{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 ret = 1;
+ BOOL ret = TRUE;
struct stat s;
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)
{
printf("Can't get a suitable file signature, aborting\n");
- ret = 0;
+ ret = FALSE;
}
if (ret) printf("Done dumping %s\n", name);
diff --git a/tools/winedump/lib.c b/tools/winedump/lib.c
index 6afef25..6c926d4 100644
--- a/tools/winedump/lib.c
+++ b/tools/winedump/lib.c
@@ -149,7 +149,7 @@ enum FileSig get_kind_lib(void)
void lib_dump(void)
{
- int first_linker_member = 1;
+ BOOL first_linker_member = TRUE;
unsigned long cur_file_pos, long_names_size = 0;
const IMAGE_ARCHIVE_MEMBER_HEADER *iamh;
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);
}
- first_linker_member = 0;
+ first_linker_member = FALSE;
cur_file_pos += size;
}
}
diff --git a/tools/winedump/lnk.c b/tools/winedump/lnk.c
index 1a89173..5f496bc 100644
--- a/tools/winedump/lnk.c
+++ b/tools/winedump/lnk.c
@@ -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,
};
-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;
unsigned char ch;
@@ -327,15 +327,15 @@ static int base85_to_guid( const char *str, LPGUID guid )
}
ch = str[i];
if( ch >= 0x80 )
- return 0;
+ return FALSE;
val += table_dec85[ch] * base;
if( table_dec85[ch] == 0xff )
- return 0;
+ return FALSE;
if( (i%5) == 4 )
p[i/5] = val;
base *= 85;
}
- return 1;
+ return TRUE;
}
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,
DWORD data_size)
{
- int got_terminator = 0, i, value_size;
+ BOOL got_terminator = FALSE;
+ int i, value_size;
const unsigned char *value;
while (data_size >= sizeof(DWORD))
{
if (!lnk_value_hdr->size)
{
- got_terminator = 1;
+ got_terminator = TRUE;
break;
}
@@ -448,7 +449,7 @@ static int dump_property_storage(const DATABLOCK_HEADER* bhdr)
{
int data_size;
const LINK_PROPERTYSTORAGE_GUID *lnk_guid_hdr;
- int got_terminator = 0;
+ BOOL got_terminator = FALSE;
printf("Property Storage\n");
printf("--------------\n\n");
@@ -461,7 +462,7 @@ static int dump_property_storage(const DATABLOCK_HEADER* bhdr)
{
if (!lnk_guid_hdr->size)
{
- got_terminator = 1;
+ got_terminator = TRUE;
break;
}
@@ -491,7 +492,7 @@ static int dump_property_storage(const DATABLOCK_HEADER* bhdr)
return 0;
}
-static int dump_raw_block(const DATABLOCK_HEADER* bhdr)
+static BOOL dump_raw_block(const DATABLOCK_HEADER* bhdr)
{
int data_size;
@@ -529,7 +530,7 @@ static int dump_raw_block(const DATABLOCK_HEADER* bhdr)
}
printf("\n");
- return 1;
+ 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 cafe1ef..018f94b 100644
--- a/tools/winedump/main.c
+++ b/tools/winedump/main.c
@@ -148,7 +148,7 @@ static void do_symfile (const char *arg)
if (!(symbolp = malloc(sizeof(*symbolp) + strlen(symstring))))
fatal ("Out of memory");
strcpy(symbolp->symbolname, symstring);
- symbolp->found = 0;
+ symbolp->found = FALSE;
symbolp->next = NULL;
*symbolptail = symbolp;
symbolptail = &symbolp->next;
@@ -320,7 +320,7 @@ static void parse_options (char *argv[])
do_dump("");
}
-static void set_module_name(unsigned setUC)
+static void set_module_name(BOOL setUC)
{
const char* ptr;
char* buf;
@@ -361,7 +361,7 @@ static BOOL symbol_searched(int count, const char *symbolname)
{
if (!strcmp(symbolname, search_symbol->symbolname))
{
- search_symbol->found = 1;
+ search_symbol->found = TRUE;
return TRUE;
}
}
@@ -425,7 +425,7 @@ int main (int argc, char *argv[])
case SPEC:
if (globals.input_name == NULL)
fatal("No file name has been given\n");
- set_module_name(1);
+ set_module_name(TRUE);
if (!dll_open (globals.input_name))
break;
@@ -479,7 +479,7 @@ int main (int argc, char *argv[])
case DUMP:
if (globals.input_name == NULL)
fatal("No file name has been given\n");
- set_module_name(0);
+ set_module_name(FALSE);
dump_file(globals.input_name);
break;
}
diff --git a/tools/winedump/misc.c b/tools/winedump/misc.c
index 17c35cc..98cd309 100644
--- a/tools/winedump/misc.c
+++ b/tools/winedump/misc.c
@@ -134,19 +134,19 @@ char *str_replace (char *str, const char *oldstr, const char *newstr)
*
* 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);
while (*str == ' ') str++;
if (!strncmp (str, match, strlen (match)))
{
- *found = 1;
+ *found = TRUE;
str += strlen (match);
while (*str == ' ') str++;
}
else
- *found = 0;
+ *found = FALSE;
return str;
}
diff --git a/tools/winedump/msmangle.c b/tools/winedump/msmangle.c
index 1493484..a0d9f92 100644
--- a/tools/winedump/msmangle.c
+++ b/tools/winedump/msmangle.c
@@ -28,7 +28,7 @@ typedef struct _compound_type
{
char dest_type;
int flags;
- int have_qualifiers;
+ BOOL have_qualifiers;
char *expression;
} compound_type;
@@ -66,7 +66,8 @@ static char *get_pointer_type_string (compound_type *ct,
int symbol_demangle (parsed_symbol *sym)
{
compound_type ct;
- int is_static = 0, is_const = 0;
+ BOOL is_static = FALSE;
+ int is_const = 0;
char *function_name = NULL;
char *class_name = NULL;
char *name;
@@ -207,7 +208,7 @@ int symbol_demangle (parsed_symbol *sym)
case '0' : /* private static */
case '1' : /* protected static */
case '2' : /* public static */
- is_static = 1;
+ is_static = TRUE;
/* Fall through */
case '3' : /* non static */
case '4' : /* non static */
@@ -285,7 +286,7 @@ int symbol_demangle (parsed_symbol *sym)
case 'L' : /* protected: static */
case 'S' : /* public: static */
case 'T' : /* public: static */
- is_static = 1; /* No implicit this pointer */
+ is_static = TRUE; /* No implicit this pointer */
break;
case 'Y' :
case 'Z' :
@@ -632,7 +633,7 @@ static char *get_constraints_convention_1 (char **str, compound_type *ct)
if (*iter == '?' || *iter == 'A')
{
- ct->have_qualifiers = 1;
+ ct->have_qualifiers = TRUE;
ct->flags |= (*iter++ == '?' ? 0 : CT_BY_REFERENCE);
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')
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)
{
diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c
index 6721898..0ca82f5 100644
--- a/tools/winedump/pe.c
+++ b/tools/winedump/pe.c
@@ -97,7 +97,7 @@ static const IMAGE_NT_HEADERS32 *get_nt_header( void )
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";
const IMAGE_DOS_HEADER *dos;
@@ -1655,7 +1655,7 @@ static void do_grab_sym( void )
*
* 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);
}
diff --git a/tools/winedump/search.c b/tools/winedump/search.c
index 2538caf..8d18131 100644
--- a/tools/winedump/search.c
+++ b/tools/winedump/search.c
@@ -164,7 +164,7 @@ int symbol_search (parsed_symbol *sym)
static int symbol_from_prototype (parsed_symbol *sym, const char *proto)
{
const char *iter;
- int found;
+ BOOL found;
proto = get_type (sym, proto, -1); /* Get return type */
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)
{
- 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;
char dest_type, *type_str;
diff --git a/tools/winedump/winedump.h b/tools/winedump/winedump.h
index 7195b65..5cd74b3 100644
--- a/tools/winedump/winedump.h
+++ b/tools/winedump/winedump.h
@@ -95,7 +95,7 @@ typedef struct __parsed_symbol
typedef struct __search_symbol
{
struct __search_symbol *next;
- int found;
+ BOOL found;
char symbolname[1]; /* static string, be ANSI C compliant by [1] */
} search_symbol;
@@ -157,7 +157,7 @@ extern _globals globals;
void dump_file(const char* name);
/* DLL functions */
-int dll_open (const char *dll_name);
+BOOL dll_open (const char *dll_name);
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);
-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);
@@ -222,7 +222,7 @@ const void* PRD(unsigned long prd, unsigned long len);
unsigned long Offset(const void* ptr);
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 );
const char* get_time_str( unsigned long );
--
1.8.5
More information about the wine-patches
mailing list