winedump: Use BOOL type where appropriate

Frédéric Delanoy frederic.delanoy at gmail.com
Thu Dec 26 15:54:19 CST 2013


Note: symbol_init and dump_* functions are made to return TRUE/FALSE on success/failure respectively, for
consistency with the rest of the codebase
---
 tools/winedump/lnk.c      | 38 +++++++++++++++++++-------------------
 tools/winedump/symbol.c   |  4 ++--
 tools/winedump/winedump.h |  2 +-
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/tools/winedump/lnk.c b/tools/winedump/lnk.c
index 5f496bc..9db18c0 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 BOOL dump_pidl(void)
 {
     const lnk_string *pidl;
     int i, n = 0, sz = 0;
 
     pidl = fetch_string(FALSE);
     if (!pidl)
-        return -1;
+        return FALSE;
 
     printf("PIDL\n");
     printf("----\n\n");
@@ -220,17 +220,17 @@ static int dump_pidl(void)
     }
     printf("\n");
 
-    return 0;
+    return TRUE;
 }
 
-static int dump_string(const char *what, int unicode)
+static BOOL dump_string(const char *what, int unicode)
 {
     const lnk_string *data;
     unsigned sz;
 
     data = fetch_string(unicode);
     if (!data)
-        return -1;
+        return FALSE;
     printf("%s : ", what);
     sz = data->size;
     if (unicode)
@@ -239,17 +239,17 @@ static int dump_string(const char *what, int unicode)
         while (sz) printf("%c", data->str.a[data->size - sz--]);
     printf("\n");
 
-    return 0;
+    return TRUE;
 }
 
-static int dump_location(void)
+static BOOL dump_location(void)
 {
     const LOCATION_INFO *loc;
     const char *p;
 
     loc = fetch_block();
     if (!loc)
-        return -1;
+        return FALSE;
     p = (const char*)loc;
 
     printf("Location\n");
@@ -298,7 +298,7 @@ static int dump_location(void)
     printf("\n");
     printf("\n");
 
-    return 0;
+    return TRUE;
 }
 
 static const unsigned char table_dec85[0x80] = {
@@ -338,7 +338,7 @@ static BOOL base85_to_guid( const char *str, LPGUID guid )
     return TRUE;
 }
 
-static int dump_special_folder_block(const DATABLOCK_HEADER* bhdr)
+static BOOL 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 +346,10 @@ 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;
+    return TRUE;
 }
 
-static int dump_sz_block(const DATABLOCK_HEADER* bhdr, const char* label)
+static BOOL 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 +357,10 @@ 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;
+    return TRUE;
 }
 
-static int dump_darwin_id(const DATABLOCK_HEADER* bhdr)
+static BOOL dump_darwin_id(const DATABLOCK_HEADER* bhdr)
 {
     const LINK_SZ_BLOCK *szp = (const LINK_SZ_BLOCK*)bhdr;
     char comp_str[40];
@@ -400,7 +400,7 @@ static int dump_darwin_id(const DATABLOCK_HEADER* bhdr)
     printf("  feature:   %s\n", feat_str);
     printf("\n");
 
-    return 0;
+    return TRUE;
 }
 
 static void dump_property_storage_value(const LINK_PROPERTYSTORAGE_VALUE *lnk_value_hdr,
@@ -445,7 +445,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 BOOL dump_property_storage(const DATABLOCK_HEADER* bhdr)
 {
     int data_size;
     const LINK_PROPERTYSTORAGE_GUID *lnk_guid_hdr;
@@ -468,8 +468,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 FALSE;
         }
 
         if (lnk_guid_hdr->magic != 0x53505331)
@@ -489,7 +489,7 @@ static int dump_property_storage(const DATABLOCK_HEADER* bhdr)
 
     printf("\n");
 
-    return 0;
+    return TRUE;
 }
 
 static BOOL dump_raw_block(const DATABLOCK_HEADER* bhdr)
diff --git a/tools/winedump/symbol.c b/tools/winedump/symbol.c
index 4dccb45..fc40aa5 100644
--- a/tools/winedump/symbol.c
+++ b/tools/winedump/symbol.c
@@ -89,11 +89,11 @@ static const char * const known_longs[] =
   "WCHAR", "BOOL", "bool", "INT16", "WORD", "DWORD", NULL
 };
 
-int symbol_init(parsed_symbol* sym, const char* name)
+BOOL symbol_init(parsed_symbol* sym, const char* name)
 {
     memset(sym, 0, sizeof(parsed_symbol));
     sym->symbol = strdup(name);
-    return 0;
+    return TRUE;
 }
 
 /*******************************************************************
diff --git a/tools/winedump/winedump.h b/tools/winedump/winedump.h
index 45243cf..285a9f0 100644
--- a/tools/winedump/winedump.h
+++ b/tools/winedump/winedump.h
@@ -162,7 +162,7 @@ BOOL  dll_open (const char *dll_name);
 int   dll_next_symbol (parsed_symbol * sym);
 
 /* Symbol functions */
-int   symbol_init(parsed_symbol* symbol, const char* name);
+BOOL  symbol_init(parsed_symbol* symbol, const char* name);
 
 int   symbol_demangle (parsed_symbol *symbol);
 
-- 
1.8.5.2




More information about the wine-patches mailing list