From d18140cef47e39aa6625dba6c74efdaa56671ba3 Mon Sep 17 00:00:00 2001
From: Joerg Mayer <jmayer@loplof.de>
Date: Tue, 26 Dec 2000 01:28:51 +0000
Subject: [PATCH] Fix the trivial compiler warnings in debugger/ when compiling
 with -W - moved inline statements to front - fixed the trivial cases of
 signed/unsigned comparisons

---
 debugger/expr.c   |  2 +-
 debugger/module.c |  6 +++---
 debugger/msc.c    | 32 +++++++++++++++++---------------
 debugger/stabs.c  | 12 ++++++------
 4 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/debugger/expr.c b/debugger/expr.c
index 3352c335365..1051efa7228 100644
--- a/debugger/expr.c
+++ b/debugger/expr.c
@@ -106,7 +106,7 @@ struct expr
 #define EXPR_TYPE_CAST		11
 
 static char expr_list[4096];
-static int next_expr_free = 0;
+static unsigned int next_expr_free = 0;
 
 /*
  * This is how we turn an expression address into the actual value.
diff --git a/debugger/module.c b/debugger/module.c
index ee7c2d13120..20176dceb91 100644
--- a/debugger/module.c
+++ b/debugger/module.c
@@ -304,7 +304,7 @@ enum DbgInfoLoad	DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
     DBG_VALUE			value;
     char			buffer[512];
     char			bufstr[256];
-    int 			i;
+    unsigned int 		i;
     IMAGE_SECTION_HEADER 	pe_seg;
     DWORD			pe_seg_ofs;
     IMAGE_DATA_DIRECTORY 	dir;
@@ -351,7 +351,7 @@ enum DbgInfoLoad	DEBUG_RegisterPEDebugInfo(DBG_MODULE* wmod, HANDLE hFile,
 	WORD*			ordinals = NULL;
 	void**			functions = NULL;
 	DWORD*			names = NULL;
-	int			j;
+	unsigned int		j;
 	
 	if (DEBUG_READ_MEM_VERBOSE((void*)(base + dir.VirtualAddress), 
 				   &exports, sizeof(exports)) &&
@@ -512,7 +512,7 @@ static int	DEBUG_ModuleCompare(const void* p1, const void* p2)
  *
  * returns TRUE is wmod_child is contained (inside bounds) of wmod_cntnr
  */
-static BOOL inline DEBUG_IsContainer(const DBG_MODULE* wmod_cntnr, 
+static inline BOOL DEBUG_IsContainer(const DBG_MODULE* wmod_cntnr, 
 				     const DBG_MODULE* wmod_child)
 {
     return wmod_cntnr->load_addr < wmod_child->load_addr &&
diff --git a/debugger/msc.c b/debugger/msc.c
index 97719a6591a..41cb1d04239 100644
--- a/debugger/msc.c
+++ b/debugger/msc.c
@@ -214,9 +214,10 @@ static enum DbgInfoLoad DEBUG_ProcessCoff( DBG_MODULE *module, LPBYTE root )
   PIMAGE_SYMBOL			coff_symbols;
   struct CoffFileSet	        coff_files;
   int				curr_file_idx = -1;
-  int		       		i;
-  int		       		j;
-  int		       		k;
+  unsigned int		       	i;
+  int			       	j;
+  int			       	k;
+  int			       	l;
   int		       		linetab_indx;
   const char	     	      * nampnt;
   int		       		naux;
@@ -476,7 +477,7 @@ static enum DbgInfoLoad DEBUG_ProcessCoff( DBG_MODULE *module, LPBYTE root )
        */
       for(j=0; j < coff_files.nfiles; j++)
 	{
-	  i = 0;
+	  l = 0;
 	  if( coff_files.files[j].neps != 0 )
 	    for(k=0; k < coff_files.files[j].linecnt; k++)
 	    {
@@ -487,12 +488,12 @@ static enum DbgInfoLoad DEBUG_ProcessCoff( DBG_MODULE *module, LPBYTE root )
 	       */
 	      while(TRUE)
 		{
-		  if (i+1 >= coff_files.files[j].neps) break;
-		  DEBUG_GetSymbolAddr(coff_files.files[j].entries[i+1], &new_value.addr);
+		  if (l+1 >= coff_files.files[j].neps) break;
+		  DEBUG_GetSymbolAddr(coff_files.files[j].entries[l+1], &new_value.addr);
 		  if( (((unsigned int)module->load_addr +
 		        linepnt->Type.VirtualAddress) >= new_value.addr.off) )
 		  {
-		      i++;
+		      l++;
 		  } else break;
 		}
 
@@ -501,8 +502,8 @@ static enum DbgInfoLoad DEBUG_ProcessCoff( DBG_MODULE *module, LPBYTE root )
 	       * start of the function, so we need to subtract that offset
 	       * first.
 	       */
-	      DEBUG_GetSymbolAddr(coff_files.files[j].entries[i], &new_value.addr);
-	      DEBUG_AddLineNumber(coff_files.files[j].entries[i], 
+	      DEBUG_GetSymbolAddr(coff_files.files[j].entries[l], &new_value.addr);
+	      DEBUG_AddLineNumber(coff_files.files[j].entries[l], 
 				  linepnt->Linenumber,
 				  (unsigned int) module->load_addr 
 				  + linepnt->Type.VirtualAddress 
@@ -1092,7 +1093,7 @@ union codeview_fieldtype
 
 #define MAX_BUILTIN_TYPES	0x480
 static struct datatype * cv_basic_types[MAX_BUILTIN_TYPES];
-static int num_cv_defined_types = 0;
+static unsigned int num_cv_defined_types = 0;
 static struct datatype **cv_defined_types = NULL;
 
 void
@@ -2041,7 +2042,8 @@ DEBUG_MapCVOffset( DBG_MODULE *module, unsigned int offset )
 
 static struct name_hash *
 DEBUG_AddCVSymbol( DBG_MODULE *module, char *name, int namelen,
-                   int type, int seg, int offset, int size, int cookie, int flags, 
+                   int type, unsigned int seg, unsigned int offset,
+                   int size, int cookie, int flags, 
                    struct codeview_linetab_hdr *linetab )
 {
     int			  nsect = module->msc_info->nsect;
@@ -2106,7 +2108,7 @@ DEBUG_AddCVSymbol( DBG_MODULE *module, char *name, int namelen,
      */
     if ( linetab )
     {
-        int i;
+        unsigned int i;
         for ( i = 0; i < linetab->nline; i++ )
             if (    linetab->offtab[i] >= offset
                  && linetab->offtab[i] <  offset + size )
@@ -2448,11 +2450,11 @@ static void *pdb_read( LPBYTE image, WORD *block_list, int size )
     return buffer;
 }
 
-static void *pdb_read_file( LPBYTE image, PPDB_TOC toc, int fileNr )
+static void *pdb_read_file( LPBYTE image, PPDB_TOC toc, DWORD fileNr )
 {
     PPDB_HEADER pdb = (PPDB_HEADER)image;
     WORD *block_list;
-    int i;
+    DWORD i;
 
     if ( !toc || fileNr >= toc->nFiles )
         return NULL;
@@ -2768,7 +2770,7 @@ static enum DbgInfoLoad DEBUG_ProcessCodeView( DBG_MODULE *module, LPBYTE root )
     {
         PCV_DIRECTORY_HEADER hdr = (PCV_DIRECTORY_HEADER)(root + cv->lfoDirectory);
         PCV_DIRECTORY_ENTRY ent, prev, next;
-        int i;
+        unsigned int i;
 
         ent = (PCV_DIRECTORY_ENTRY)((LPBYTE)hdr + hdr->cbDirHeader);
         for ( i = 0; i < hdr->cDir; i++, ent = next )
diff --git a/debugger/stabs.c b/debugger/stabs.c
index 90aebf2b4b9..c6b5e52ed91 100644
--- a/debugger/stabs.c
+++ b/debugger/stabs.c
@@ -264,7 +264,7 @@ static int DEBUG_PTS_ReadTypedef(struct ParseTypedefData* ptd, const char* typen
 static int DEBUG_PTS_ReadID(struct ParseTypedefData* ptd)
 {
     char*	first = ptd->ptr;
-    int		len;
+    unsigned int	len;
 
     if ((ptd->ptr = strchr(ptd->ptr, ':')) == NULL) return -1;
     len = ptd->ptr - first;
@@ -316,7 +316,7 @@ static int DEBUG_PTS_ReadRange(struct ParseTypedefData* ptd, struct datatype** d
     return 0;
 }
 
-static int inline DEBUG_PTS_ReadAggregate(struct ParseTypedefData* ptd, struct datatype* sdt)
+static inline int DEBUG_PTS_ReadAggregate(struct ParseTypedefData* ptd, struct datatype* sdt)
 {
     int			sz, ofs;
     char*		last;
@@ -356,7 +356,7 @@ static int inline DEBUG_PTS_ReadAggregate(struct ParseTypedefData* ptd, struct d
     return 0;
 }
 
-static int inline DEBUG_PTS_ReadEnum(struct ParseTypedefData* ptd, struct datatype* edt)
+static inline int DEBUG_PTS_ReadEnum(struct ParseTypedefData* ptd, struct datatype* edt)
 {
     int			ofs;
     int			idx;
@@ -373,7 +373,7 @@ static int inline DEBUG_PTS_ReadEnum(struct ParseTypedefData* ptd, struct dataty
     return 0;
 }
 
-static int inline DEBUG_PTS_ReadArray(struct ParseTypedefData* ptd, struct datatype* adt)
+static inline int DEBUG_PTS_ReadArray(struct ParseTypedefData* ptd, struct datatype* adt)
 {
     int			lo, hi;
     struct datatype*	rdt;
@@ -612,12 +612,12 @@ enum DbgInfoLoad DEBUG_ParseStabs(char * addr, unsigned int load_offset,
   int                   i;
   int                   in_external_file = FALSE;
   int                   last_nso = -1;
-  int                   len;
+  unsigned int          len;
   DBG_VALUE	        new_value;
   int                   nstab;
   char                * ptr;
   char                * stabbuff;
-  int                   stabbufflen;
+  unsigned int          stabbufflen;
   struct stab_nlist   * stab_ptr;
   char                * strs;
   int                   strtabinc;
-- 
GitLab