From 17c9af5fb6e009e7beb99f268778adeef30f2e4a Mon Sep 17 00:00:00 2001
From: Jon Griffiths <jon_p_griffiths@yahoo.com>
Date: Tue, 22 Jul 2003 00:56:31 +0000
Subject: [PATCH] Support float and function ptr args better, -W warning fixes.

---
 tools/winedump/msmangle.c | 11 ++++++++---
 tools/winedump/pe.c       |  4 ++--
 tools/winedump/symbol.c   |  3 +++
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/tools/winedump/msmangle.c b/tools/winedump/msmangle.c
index cbe89ac54a9..271d0d7ffa9 100644
--- a/tools/winedump/msmangle.c
+++ b/tools/winedump/msmangle.c
@@ -507,11 +507,12 @@ static char *demangle_datatype (char **str, compound_type *ct,
 	{
 	  if (*iter == '6')
 	  {
+	      int sub_expressions = 0;
 	      /* FIXME: there are a tons of memory leaks here */
 	      /* FIXME: this is still broken in some cases and it has to be
 	       * merged with the function prototype parsing above...
 	       */
-	      iter += 3; /* FIXME */
+	      iter += iter[1] == 'A' ? 2 : 3; /* FIXME */
 	      if (!demangle_datatype (&iter, &sub_ct, sym))
 		  return NULL;
 	      ct->expression = str_create(2, sub_ct.expression, " (*)(");
@@ -523,8 +524,12 @@ static char *demangle_datatype (char **str, compound_type *ct,
 		      INIT_CT (sub_ct);
 		      if (!demangle_datatype (&iter, &sub_ct, sym))
 			  return NULL;
-		      ct->expression = str_create(3, ct->expression, ", ", sub_ct.expression);
+		      if (sub_expressions)
+                              ct->expression = str_create(3, ct->expression, ", ", sub_ct.expression);
+		      else
+                              ct->expression = str_create(2, ct->expression, sub_ct.expression);
 		      while (*iter == '@') iter++;
+		      sub_expressions++;
 		  }
 	      } else while (*iter == '@') iter++;
 	      iter++;
@@ -739,7 +744,7 @@ static int get_type_constant (const char c, const int constraints)
   case 'J': case 'K':
     return ARG_LONG;
   case 'M':
-    return -1; /* FIXME */
+    return ARG_FLOAT;
   case 'N': case 'O':
     return ARG_DOUBLE;
   case 'P': case 'Q':
diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c
index 69062c0b625..913cae03204 100644
--- a/tools/winedump/pe.c
+++ b/tools/winedump/pe.c
@@ -673,7 +673,7 @@ static const char *get_resource_type( unsigned int id )
         "HTML"
     };
 
-    if (id < sizeof(types)/sizeof(types[0])) return types[id];
+    if ((size_t)id < sizeof(types)/sizeof(types[0])) return types[id];
     return NULL;
 }
 
@@ -948,7 +948,7 @@ int pe_analysis(const char* name, void (*fn)(enum FileSig), enum FileSig wanted_
 #endif
     {
         if (!(PE_base = malloc( PE_total_len ))) fatal( "Out of memory" );
-        if (read( fd, PE_base, PE_total_len ) != (int)PE_total_len) fatal( "Cannot read file" );
+        if ((unsigned long)read( fd, PE_base, PE_total_len ) != PE_total_len) fatal( "Cannot read file" );
     }
 
     effective_sig = check_headers();
diff --git a/tools/winedump/symbol.c b/tools/winedump/symbol.c
index 2a3280c2f18..ccc2bf5dada 100644
--- a/tools/winedump/symbol.c
+++ b/tools/winedump/symbol.c
@@ -259,6 +259,9 @@ int   symbol_get_type (const char *string)
   if (strstr (string, "double"))
     return ARG_DOUBLE;
 
+  if (strstr (string, "float"))
+    return ARG_FLOAT;
+
   if (strstr (string, "void") || strstr (string, "VOID"))
     return ARG_VOID;
 
-- 
GitLab