Nmap Development mailing list archives

[Patch] Eliminate compiler warnings


From: "Andrew J. Bennieston" <harriergr7 () gmail com>
Date: Wed, 09 Apr 2008 02:59:45 +0100

Good evening all!

As I mentioned in the patch I posted earlier (a malloc where a bigger buffer would do), I'm bored this evening. As a result, I set to eliminating all of the compiler warnings issued during the 'make' phase of
./configure && make && make install
on my machine. I've attached the patch of all the changes made, but a few detailed comments first:

1. These changes remove warnings from whatever gets compiled with standard configure options on a (Slackware) Linux system running a 2.6 kernel. Additional configure options may change various things, resulting in warnings slipping back in; I haven't explored this deep yet!

2. The majority of the changes are adding "const" to char * in function declarations (and of course, their corresponding definitions), either for arguments or return types. This prevents warnings about passing a string literal (which is of course, inherently const) to something expecting a char *. In every such case, string literals were passed, so code should not rely on the non-constness of the char * anyway, and I read through as much of the code of those functions and the ones that call it as possible, to ensure that there would be no adverse effects of adding const qualifiers.

3. A number of other small changes include changing types, e.g. from int to socklen_t, adding ( ) around a && b || c && d ==> (a && b) || (c && d) [Which is determined by the order of precedence for the && and || operators, but in such situations it never hurts to spell it out, and a few other minor changes.

4. I don't believe that any change I've made fundamentally affects anything within nmap's inner workings (or on the facade); indeed the program still compiles and executes, providing the expected scan results for the scans I've tried so far (-sT, -sS and -sI on hosts within my network).

5. The patch is rather large; there are a fair amount of changes here, because there were lots of warnings.

6. A lot of people don't care about compiler warnings. If nmap follows this tradition, feel free to ignore my patch; at the very least I've familiarised myself with a lot of nmap code in a very short length of time, and it staved off the boredom for a while. On the other hand, I happen to think that warnings are almost as bad as errors, and should be treated as such!

7. One final note is that, in one situation, rather than marking a struct member const char * in struct Aval, I added a whole host of casts to the string literals which were assigned to it. The reason for this is that, elsewhere in the codebase, something expects that member to be non-const, and I didn't want to break anything. If warnings are considered better than "silly" casts from string literals to non-const pointers, please feel free to ignore these parts of the patch!

Without further ado, here's the patch!
diff -u nmap-4.60/NmapOps.cc nmap-4.60-nowarnings/NmapOps.cc
--- nmap-4.60/NmapOps.cc        2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/NmapOps.cc     2008-04-09 00:04:33.653911588 +0100
@@ -550,7 +550,7 @@
      If this is never called, a default stylesheet distributed with
      Nmap is used.  If you call it with NULL as the xslname, no
      stylesheet line is printed. */
-void NmapOps::setXSLStyleSheet(char *xslname) {
+void NmapOps::setXSLStyleSheet(const char *xslname) {
   if (xsl_stylesheet) free(xsl_stylesheet);
   xsl_stylesheet = xslname? strdup(xslname) : NULL;
 }
diff -u nmap-4.60/NmapOps.h nmap-4.60-nowarnings/NmapOps.h
--- nmap-4.60/NmapOps.h 2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/NmapOps.h      2008-04-09 00:04:47.141965646 +0100
@@ -237,7 +237,7 @@
      If this is never called, a default stylesheet distributed with
      Nmap is used.  If you call it with NULL as the xslname, no
      stylesheet line is printed. */
-  void setXSLStyleSheet(char *xslname);
+  void setXSLStyleSheet(const char *xslname);
   /* Returns the full path or URL that should be printed in the XML
      output xml-stylesheet element.  Returns NULL if the whole element
      should be skipped */
diff -u nmap-4.60/nmap.cc nmap-4.60-nowarnings/nmap.cc
--- nmap-4.60/nmap.cc   2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/nmap.cc        2008-04-09 00:19:27.301908569 +0100
@@ -2046,10 +2046,10 @@
  * the outer part of the port expression. It's "closed".
  */
 
-static void getpts_aux(char *origexpr, int nested, u8 *porttbl, int range_type,
+static void getpts_aux(const char *origexpr, int nested, u8 *porttbl, int range_type,
                        int *portwarning, bool change_range_type = true);
 
-struct scan_lists *getpts(char *origexpr) {
+struct scan_lists *getpts(const char *origexpr) {
   u8 *porttbl;
   struct scan_lists *ports;
   int range_type = 0;
@@ -2116,7 +2116,7 @@
    of ports in a struct scan_lists, it allocates only one list and stores it in
    the list and count arguments. For that reason, T:, U:, and P: restrictions
    are not allowed and only one bit in range_type may be set. */
-void getpts_simple(char *origexpr, int range_type,
+void getpts_simple(const char *origexpr, int range_type,
                    unsigned short **list, int *count) {
   u8 *porttbl;
   int portwarning = 0;
@@ -2154,15 +2154,15 @@
 
 /* getpts() and getpts_simple() (see above) are wrappers for this function */
 
-static void getpts_aux(char *origexpr, int nested, u8 *porttbl, int range_type, int *portwarning, bool 
change_range_type) {
+static void getpts_aux(const char *origexpr, int nested, u8 *porttbl, int range_type, int *portwarning, bool 
change_range_type) {
   long rangestart = -2343242, rangeend = -9324423;
-  char *current_range;
+  const char *current_range;
   char *endptr;
   char servmask[128];  // A protocol name can be up to 127 chars + nul byte
   int i;
 
   /* An example of proper syntax to use in error messages. */
-  char *syntax_example;
+  const char *syntax_example;
   if (change_range_type)
     syntax_example = "-100,200-1024,T:3000-4000,U:60000-";
   else
@@ -2379,7 +2379,7 @@
 }
 
 
-char *seqclass2ascii(int seqclass) {
+const char *seqclass2ascii(int seqclass) {
   switch(seqclass) {
   case SEQ_CONSTANT:
     return "constant sequence number (!)";
@@ -2400,7 +2400,7 @@
   }
 }
 
-char *ipidclass2ascii(int seqclass) {
+const char *ipidclass2ascii(int seqclass) {
   switch(seqclass) {
   case IPID_SEQ_CONSTANT:
     return "Duplicated ipid (!)";
@@ -2421,7 +2421,7 @@
   }
 }
 
-char *tsseqclass2ascii(int seqclass) {
+const char *tsseqclass2ascii(int seqclass) {
   switch(seqclass) {
   case TS_SEQ_ZERO:
     return "zero timestamp";
@@ -2446,7 +2446,7 @@
 
 
 /* Just a routine for obtaining a string for printing based on the scantype */
-char *scantype2str(stype scantype) {
+const char *scantype2str(stype scantype) {
 
   switch(scantype) {
   case STYPE_UNKNOWN: return "Unknown Scan Type"; break;
@@ -2478,7 +2478,7 @@
 
 }
 
-char *statenum2str(int state) {
+const char *statenum2str(int state) {
   switch(state) {
   case PORT_OPEN: return "open"; break;
   case PORT_FILTERED: return "filtered"; break;
@@ -2664,7 +2664,7 @@
        return fileexistsandisreadable(pathname);
 }
 
-int nmap_fetchfile(char *filename_returned, int bufferlen, char *file) {
+int nmap_fetchfile(char *filename_returned, int bufferlen, const char *file) {
   char *dirptr;
   int res;
   int foundsomething = 0;
diff -u nmap-4.60/nmap.h nmap-4.60-nowarnings/nmap.h
--- nmap-4.60/nmap.h    2008-03-15 01:21:22.000000000 +0000
+++ nmap-4.60-nowarnings/nmap.h 2008-04-09 00:19:34.797907554 +0100
@@ -410,8 +410,8 @@
 int ftp_anon_connect(struct ftpinfo *ftp);
 
 /* port manipulators */
-struct scan_lists *getpts(char *expr); /* someone stole the name getports()! */
-void getpts_simple(char *origexpr, int range_type,
+struct scan_lists *getpts(const char *expr); /* someone stole the name getports()! */
+void getpts_simple(const char *origexpr, int range_type,
                    unsigned short **list, int *count);
 void free_scan_lists(struct scan_lists *ports);
 
@@ -425,21 +425,21 @@
 
 /* general helper functions */
 int parse_targets(struct targets *targets, char *h);
-char *statenum2str(int state);
-char *scantype2str(stype scantype);
+const char *statenum2str(int state);
+const char *scantype2str(stype scantype);
 void sigdie(int signo);
 void reaper(int signo);
 char *seqreport(struct seq_info *seq);
 char *seqreport1(struct seq_info *seq);
-char *seqclass2ascii(int clas);
-char *ipidclass2ascii(int seqclass);
-char *tsseqclass2ascii(int seqclass);
+const char *seqclass2ascii(int clas);
+const char *ipidclass2ascii(int seqclass);
+const char *tsseqclass2ascii(int seqclass);
 
 /* Convert a TCP sequence prediction difficulty index like 1264386
    into a difficulty string like "Worthy Challenge */
 const char *seqidx2difficultystr(unsigned long idx);
 const char *seqidx2difficultystr1(unsigned long idx);
-int nmap_fetchfile(char *filename_returned, int bufferlen, char *file);
+int nmap_fetchfile(char *filename_returned, int bufferlen, const char *file);
 int nmap_fileexistsandisreadable(char* pathname);
 int gather_logfile_resumption_state(char *fname, int *myargc, char ***myargv);
 
diff -u nmap-4.60/nmap_dns.cc nmap-4.60-nowarnings/nmap_dns.cc
--- nmap-4.60/nmap_dns.cc       2008-03-14 21:45:41.000000000 +0000
+++ nmap-4.60-nowarnings/nmap_dns.cc    2008-04-08 23:32:16.497909618 +0100
@@ -964,11 +964,10 @@
 }
 
 
-static void parse_etchosts(char *fname) {
+static void parse_etchosts(const char *fname) {
   FILE *fp;
   char buf[2048], hname[256], ipaddrstr[16], *tp;
   struct in_addr ia;
-  host_elem *he;
 
   fp = fopen(fname, "r");
   if (fp == NULL) return; // silently is OK
@@ -1069,7 +1068,7 @@
 /* External interface to dns cache */
 const char *lookup_cached_host(u32 ip) {
   const char *tmp = lookup_etchosts(ip);
-  return tmp==NULL?"":tmp;
+  return tmp;
 }
 
 static void etchosts_init(void) {
diff -u nmap-4.60/nse_nsock.cc nmap-4.60-nowarnings/nse_nsock.cc
--- nmap-4.60/nse_nsock.cc      2008-01-21 17:18:51.000000000 +0000
+++ nmap-4.60-nowarnings/nse_nsock.cc   2008-04-09 02:31:11.337907475 +0100
@@ -67,8 +67,8 @@
 
 int l_nsock_checkstatus(lua_State* l, nsock_event nse);
 
-void l_nsock_trace(nsock_iod nsiod, char* message, int direction);
-char* inet_ntop_both(int af, const void* v_addr, char* ipstring);
+void l_nsock_trace(nsock_iod nsiod, const char* message, int direction);
+const char* inet_ntop_both(int af, const void* v_addr, char* ipstring);
 unsigned short inet_port_both(int af, const void* v_addr);
 
 static luaL_reg l_nsock [] = {
@@ -246,7 +246,7 @@
                 * is there a better way? */
                int arguments = 3;
                const char *how = luaL_optstring(l, 4, "");
-               if(how != ""){
+               if(*how != '\0'){ 
                        arguments = 4;
                        int port = luaL_optinteger(l, 5, -1);
                        if(port!=-1)
@@ -454,7 +454,7 @@
        }
 }
 
-void l_nsock_trace(nsock_iod nsiod, char* message, int direction) { 
+void l_nsock_trace(nsock_iod nsiod, const char* message, int direction) { 
        int status; 
        int protocol; 
        int af; 
@@ -486,7 +486,7 @@
        }
 }
 
-char* inet_ntop_both(int af, const void* v_addr, char* ipstring) {
+const char* inet_ntop_both(int af, const void* v_addr, char* ipstring) {
 //     char* ipstring = (char*) safe_malloc(sizeof(char) * INET6_ADDRSTRLEN);
 
        if(af == AF_INET) {
@@ -965,7 +965,7 @@
 
 int ncap_restore_lua(ncap_request *nr);
 void ncap_request_set_result(nsock_event nse, struct ncap_request *nr);
-int ncap_request_set_results(nsock_event nse, char *key);
+int ncap_request_set_results(nsock_event nse, const char *key);
 void l_nsock_pcap_receive_handler(nsock_pool nsp, nsock_event nse, void *userdata);
 
 /* next map, this time it's multimap "key"(from callback)->suspended_lua_threads */
@@ -1143,7 +1143,7 @@
 
 
 /* get data from nsock_event, and set result on ncap_requests which mach key */
-int ncap_request_set_results(nsock_event nse, char *key) {
+int ncap_request_set_results(nsock_event nse, const char *key) {
        int this_event_restored = 0;
        
        std::string skey = key;
@@ -1286,7 +1286,7 @@
                lua_pushnil(l);
                return 1;
        }
-       char *s= NULL;
+       const char *s= NULL;
        switch(ii->device_type){
        case devt_ethernet:
                s = "ethernet";
diff -u nmap-4.60/osscan.cc nmap-4.60-nowarnings/osscan.cc
--- nmap-4.60/osscan.cc 2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/osscan.cc      2008-04-09 00:41:05.133906932 +0100
@@ -629,7 +629,7 @@
    representation. Tests that are identical between more than one fingerprint
    are included only once. If wrapit is true, the string is wrapped for
    submission. */
-char *mergeFPs(FingerPrint *FPs[], int numFPs, bool isGoodFP,
+const char *mergeFPs(FingerPrint *FPs[], int numFPs, bool isGoodFP,
                           const struct in_addr * const addr, int distance, const u8 *mac,
                           int openTcpPort, int closedTcpPort, int closedUdpPort, bool wrapit) {
   static char str[10240];
@@ -760,7 +760,7 @@
   }
 }
 
-char *fp2ascii(FingerPrint *FP) {
+const char *fp2ascii(FingerPrint *FP) {
 static char str[2048];
 FingerPrint *current;
 struct AVal *AV;
@@ -1139,7 +1139,7 @@
  return DB;
 }
 
-FingerPrintDB *parse_fingerprint_reference_file(char *dbname) {
+FingerPrintDB *parse_fingerprint_reference_file(const char *dbname) {
 char filename[256];
 
 if (nmap_fetchfile(filename, sizeof(filename), dbname) != 1){
diff -u nmap-4.60/osscan.h nmap-4.60-nowarnings/osscan.h
--- nmap-4.60/osscan.h  2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/osscan.h       2008-04-09 00:42:03.285909369 +0100
@@ -1,4 +1,3 @@
-
 /***************************************************************************
  * osscan.h -- Routines used for OS detection via TCP/IP fingerprinting.   *
  * For more information on how this works in Nmap, see my paper at         *
@@ -119,7 +118,7 @@
 /* moved to global_structures.h */
 
 /**********************  PROTOTYPES  ***********************************/
-char *fp2ascii(FingerPrint *FP);
+const char *fp2ascii(FingerPrint *FP);
 
 /* Parses a single fingerprint from the memory region given.  If a
  non-null fingerprint is returned, the user is in charge of freeing it
@@ -132,7 +131,7 @@
    (allocated) FingerPrintDB containing the results.  They exit with
    an error message in the case of error. */
 FingerPrintDB *parse_fingerprint_file(char *fname);
-FingerPrintDB *parse_fingerprint_reference_file(char *dbname);
+FingerPrintDB *parse_fingerprint_reference_file(const char *dbname);
 
 void free_fingerprint_file(FingerPrintDB *DB);
 
@@ -156,7 +155,7 @@
 /* Returns true if perfect match -- if num_subtests & num_subtests_succeeded are non_null it updates them.  if 
shortcircuit is zero, it does all the tests, otherwise it returns when the first one fails */
 
 void freeFingerPrint(FingerPrint *FP);
-char *mergeFPs(FingerPrint *FPs[], int numFPs, bool isGoodFP, const struct in_addr * const addr, int distance, const 
u8 *mac, int openTcpPort, int closedTcpPort, int closedUdpPort, bool wrapit);
+const char *mergeFPs(FingerPrint *FPs[], int numFPs, bool isGoodFP, const struct in_addr * const addr, int distance, 
const u8 *mac, int openTcpPort, int closedTcpPort, int closedUdpPort, bool wrapit);
 
 #endif /*OSSCAN_H*/
 
diff -u nmap-4.60/osscan2.cc nmap-4.60-nowarnings/osscan2.cc
--- nmap-4.60/osscan2.cc        2008-03-13 05:34:17.000000000 +0000
+++ nmap-4.60-nowarnings/osscan2.cc     2008-04-09 00:52:49.889912272 +0100
@@ -1563,7 +1563,7 @@
          received */
       hss->FPtests[i] = (FingerPrint *) safe_zalloc(sizeof(FingerPrint));
       pAV = (struct AVal *) safe_zalloc(sizeof(struct AVal));
-      pAV->attribute = "R";
+      pAV->attribute = (char*)"R";
       strcpy(pAV->value, "N");
       pAV->next = NULL;
       hss->FPtests[i]->results = pAV;
@@ -1572,7 +1572,7 @@
        else if(hss->FPtests[i]) {
          /* Replace TTL with initial TTL. */
          for(pAV = hss->FPtests[i]->results; pAV; pAV = pAV->next) {
-               if(pAV->attribute == "T") {
+               if(pAV->attribute == (char*)"T") {
                  /* Found TTL item. The value for this attribute is the
                     received TTL encoded in decimal. We replace it with the
                     initial TTL encoded in hex. */
@@ -1588,7 +1588,7 @@
                        sprintf(pAV->value, "%hX", ttl + hss->distance);
                  } else {
                        /* Guess the initial TTL value */
-                       pAV->attribute = "TG";
+                       pAV->attribute = (char*) "TG";
                        sprintf(pAV->value, "%hX", get_initial_ttl_guess(ttl));
                  }
                  break;
@@ -1769,13 +1769,13 @@
     hss->FP_TSeq->results = seq_AVs;
     avnum = 0;
 
-    seq_AVs[avnum].attribute = "SP";
+    seq_AVs[avnum].attribute = (char*)"SP";
     sprintf(seq_AVs[avnum].value, "%X", hss->si.index);
     seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-    seq_AVs[avnum].attribute= "GCD";
+    seq_AVs[avnum].attribute = (char*)"GCD";
     sprintf(seq_AVs[avnum].value, "%X", seq_gcd);
     seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-    seq_AVs[avnum].attribute= "ISR";     
+    seq_AVs[avnum].attribute = (char*)"ISR";     
     sprintf(seq_AVs[avnum].value, "%X", (unsigned int) seq_rate);
 
     /* Now it is time to deal with IPIDs */
@@ -1816,32 +1816,32 @@
     switch(tcp_ipid_seqclass) {
     case IPID_SEQ_CONSTANT:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "TI";
+      seq_AVs[avnum].attribute = (char*)"TI";
       sprintf(seq_AVs[avnum].value, "%X", hss->ipid.tcp_ipids[0]);
       break;
     case IPID_SEQ_INCR:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "TI";
+      seq_AVs[avnum].attribute = (char*)"TI";
       strcpy(seq_AVs[avnum].value, "I");
       break;
     case IPID_SEQ_BROKEN_INCR:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "TI";
+      seq_AVs[avnum].attribute = (char*)"TI";
       strcpy(seq_AVs[avnum].value, "BI");
       break;
     case IPID_SEQ_RPI:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "TI";
+      seq_AVs[avnum].attribute = (char*)"TI";
       strcpy(seq_AVs[avnum].value, "RI");
       break;
     case IPID_SEQ_RD:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "TI";
+      seq_AVs[avnum].attribute = (char*)"TI";
       strcpy(seq_AVs[avnum].value, "RD");
       break;
     case IPID_SEQ_ZERO:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "TI";
+      seq_AVs[avnum].attribute = (char*)"TI";
       strcpy(seq_AVs[avnum].value, "Z");
       break;
     }
@@ -1850,32 +1850,32 @@
     switch(icmp_ipid_seqclass) {
     case IPID_SEQ_CONSTANT:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "II";
+      seq_AVs[avnum].attribute = (char*)"II";
       sprintf(seq_AVs[avnum].value, "%X", hss->ipid.icmp_ipids[0]);
       break;
     case IPID_SEQ_INCR:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "II";
+      seq_AVs[avnum].attribute = (char*)"II";
       strcpy(seq_AVs[avnum].value, "I");
       break;
     case IPID_SEQ_BROKEN_INCR:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "II";
+      seq_AVs[avnum].attribute = (char*)"II";
       strcpy(seq_AVs[avnum].value, "BI");
       break;
     case IPID_SEQ_RPI:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "II";
+      seq_AVs[avnum].attribute = (char*)"II";
       strcpy(seq_AVs[avnum].value, "RI");
       break;
     case IPID_SEQ_RD:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "II";
+      seq_AVs[avnum].attribute = (char*)"II";
       strcpy(seq_AVs[avnum].value, "RD");
       break;
     case IPID_SEQ_ZERO:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "II";
+      seq_AVs[avnum].attribute = (char*)"II";
       strcpy(seq_AVs[avnum].value, "Z");
       break;     
     }
@@ -1890,7 +1890,7 @@
          /* Both are incremental. Thus we have "SS" test. Check if they
                 are in the same sequence. */
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "SS";
+      seq_AVs[avnum].attribute = (char*)"SS";
          int avg = (hss->ipid.tcp_ipids[good_tcp_ipid_num-1] - hss->ipid.tcp_ipids[0]) / (good_tcp_ipid_num - 1);
          if ( hss->ipid.icmp_ipids[0] < hss->ipid.tcp_ipids[good_tcp_ipid_num-1] + 3 * avg) {
                strcpy(seq_AVs[avnum].value, "S");
@@ -1904,7 +1904,7 @@
 
     case TS_SEQ_ZERO:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "TS";
+      seq_AVs[avnum].attribute = (char*)"TS";
       strcpy(seq_AVs[avnum].value, "0");
       break;
     case TS_SEQ_2HZ:
@@ -1912,7 +1912,7 @@
     case TS_SEQ_1000HZ:
     case TS_SEQ_OTHER_NUM:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "TS";
+      seq_AVs[avnum].attribute = (char*)"TS";
 
       /* Here we "cheat" a little to make the classes correspond more
         closely to common real-life frequencies (particularly 100)
@@ -1939,7 +1939,7 @@
       break;
     case TS_SEQ_UNSUPPORTED:
       seq_AVs[avnum].next = &seq_AVs[avnum+1]; avnum++;
-      seq_AVs[avnum].attribute = "TS";
+      seq_AVs[avnum].attribute = (char*)"TS";
       strcpy(seq_AVs[avnum].value, "U");
       break;
     }
@@ -2085,22 +2085,22 @@
   
   switch(replyNo) {
   case 0:
-    hss->TOps_AVs[replyNo]->attribute = "O1";
+    hss->TOps_AVs[replyNo]->attribute = (char*)"O1";
        break;
   case 1:
-    hss->TOps_AVs[replyNo]->attribute = "O2";
+    hss->TOps_AVs[replyNo]->attribute = (char*)"O2";
        break;
   case 2:
-    hss->TOps_AVs[replyNo]->attribute = "O3";
+    hss->TOps_AVs[replyNo]->attribute = (char*)"O3";
        break;
   case 3:
-    hss->TOps_AVs[replyNo]->attribute = "O4";
+    hss->TOps_AVs[replyNo]->attribute = (char*)"O4";
        break;
   case 4:
-    hss->TOps_AVs[replyNo]->attribute = "O5";
+    hss->TOps_AVs[replyNo]->attribute = (char*)"O5";
        break;
   case 5:
-    hss->TOps_AVs[replyNo]->attribute = "O6";
+    hss->TOps_AVs[replyNo]->attribute = (char*)"O6";
        break;
   }
   
@@ -2118,22 +2118,22 @@
 
   switch(replyNo) {
   case 0:
-       hss->TWin_AVs[replyNo]->attribute = "W1";
+       hss->TWin_AVs[replyNo]->attribute = (char*)"W1";
        break;
   case 1:
-       hss->TWin_AVs[replyNo]->attribute = "W2";
+       hss->TWin_AVs[replyNo]->attribute = (char*)"W2";
        break;
   case 2:
-       hss->TWin_AVs[replyNo]->attribute = "W3";
+       hss->TWin_AVs[replyNo]->attribute = (char*)"W3";
        break;
   case 3:
-       hss->TWin_AVs[replyNo]->attribute = "W4";
+       hss->TWin_AVs[replyNo]->attribute = (char*)"W4";
        break;
   case 4:
-       hss->TWin_AVs[replyNo]->attribute = "W5";
+       hss->TWin_AVs[replyNo]->attribute = (char*)"W5";
        break;
   case 5:
-       hss->TWin_AVs[replyNo]->attribute = "W6";
+       hss->TWin_AVs[replyNo]->attribute = (char*)"W6";
        break;
   }
   
@@ -2160,13 +2160,13 @@
     AVs[i].next = &AVs[i+1];
   AVs[numtests-1].next = NULL;
   
-  AVs[current_testno].attribute = "R";
+  AVs[current_testno].attribute = (char*)"R";
   strcpy(AVs[current_testno].value, "Y");
 
   current_testno++;
 
   /* don't frag flag */
-  AVs[current_testno].attribute = "DF";
+  AVs[current_testno].attribute = (char*)"DF";
   if(ntohs(ip->ip_off) & IP_DF) {
     strcpy(AVs[current_testno].value,"Y");
   } else strcpy(AVs[current_testno].value, "N");
@@ -2174,19 +2174,19 @@
   current_testno++;
 
   /* TTL */
-  AVs[current_testno].attribute = "T";
+  AVs[current_testno].attribute = (char*)"T";
   sprintf(AVs[current_testno].value, "%d", ip->ip_ttl);
 
   current_testno++;
 
   /* TCP Window size */
-  AVs[current_testno].attribute = "W";
+  AVs[current_testno].attribute = (char*)"W";
   sprintf(AVs[current_testno].value, "%hX", ntohs(tcp->th_win));
        
   current_testno++;
 
   /* Now for the TCP options ... */
-  AVs[current_testno].attribute = "O";
+  AVs[current_testno].attribute = (char*)"O";
   opsParseResult = get_tcpopt_string(tcp, this->tcpMss,
                                                                         AVs[current_testno].value,
                                                                         sizeof(AVs[current_testno].value));
@@ -2199,7 +2199,7 @@
   current_testno++;
         
   /* Explicit Congestion Notification support test */
-  AVs[current_testno].attribute = "CC";
+  AVs[current_testno].attribute = (char*)"CC";
   if ((tcp->th_flags & TH_ECE) && (tcp->th_flags & TH_CWR))
     /* echo back */
     strcpy(AVs[current_testno].value,"S");
@@ -2215,7 +2215,7 @@
   current_testno++;
 
   /* TCP miscellaneous quirks test */
-  AVs[current_testno].attribute = "Q";
+  AVs[current_testno].attribute = (char*)"Q";
   p = AVs[current_testno].value;
   if (tcp->th_x2) {
     /* Reserved field of TCP is not zero */
@@ -2263,13 +2263,13 @@
   
   /* First we give the "response" flag to say we did actually receive
      a packet -- this way we won't match a template with R=N */
-  AVs[current_testno].attribute = "R";
+  AVs[current_testno].attribute = (char*)"R";
   strcpy(AVs[current_testno].value, "Y");
 
   current_testno++;
 
   /* Next we check whether the Don't Fragment bit is set */
-  AVs[current_testno].attribute = "DF";
+  AVs[current_testno].attribute = (char*)"DF";
   if(ntohs(ip->ip_off) & 0x4000) {
     strcpy(AVs[current_testno].value,"Y");
   } else strcpy(AVs[current_testno].value, "N");
@@ -2277,14 +2277,14 @@
   current_testno++;
 
   /* TTL */
-  AVs[current_testno].attribute = "T";
+  AVs[current_testno].attribute = (char*)"T";
   sprintf(AVs[current_testno].value, "%d", ip->ip_ttl);
 
   current_testno++;
 
   if(replyNo!=0) {
        /* Now we do the TCP Window size */
-       AVs[current_testno].attribute = "W";
+       AVs[current_testno].attribute = (char*)"W";
        sprintf(AVs[current_testno].value, "%hX", ntohs(tcp->th_win));
        
        current_testno++;
@@ -2296,7 +2296,7 @@
      A+  = ack + 1
      O   = other
   */
-  AVs[current_testno].attribute = "S";
+  AVs[current_testno].attribute = (char*)"S";
   if (ntohl(tcp->th_seq) == 0)
     strcpy(AVs[current_testno].value, "Z");
   else if (ntohl(tcp->th_seq) == tcpAck)
@@ -2314,7 +2314,7 @@
      S+  = syn + 1
      O   = other
   */
-  AVs[current_testno].attribute = "A";
+  AVs[current_testno].attribute = (char*)"A";
   if (ntohl(tcp->th_ack) == 0)
     strcpy(AVs[current_testno].value, "Z");
   else if (ntohl(tcp->th_ack) == tcpSeqBase) 
@@ -2335,7 +2335,7 @@
      S = Synchronize
      F = Final
   */
-  AVs[current_testno].attribute = "F";
+  AVs[current_testno].attribute = (char*)"F";
   p = AVs[current_testno].value;
   if (tcp->th_flags & TH_ECE) *p++ = 'E';
   if (tcp->th_flags & TH_URG) *p++ = 'U';
@@ -2350,7 +2350,7 @@
 
   if(replyNo!=0) {
        /* Now for the TCP options ... */
-       AVs[current_testno].attribute = "O";
+       AVs[current_testno].attribute = (char*)"O";
        opsParseResult = get_tcpopt_string(tcp, this->tcpMss,
                                                                           AVs[current_testno].value,
                                                                           sizeof(AVs[current_testno].value));
@@ -2364,7 +2364,7 @@
   }
   
   /* Rst Data CRC16 */
-  AVs[current_testno].attribute = "RD";
+  AVs[current_testno].attribute = (char*)"RD";
   length = (int) ntohs(ip->ip_len) - 4 * ip->ip_hl -4 * tcp->th_off;
   if ((tcp->th_flags & TH_RST) && length>0) {
     sprintf(AVs[current_testno].value, "%08lX", crc16(((u8 *)tcp) + 4 * tcp->th_off, length));
@@ -2376,7 +2376,7 @@
   current_testno++;
 
   /* TCP miscellaneous quirks test */
-  AVs[current_testno].attribute = "Q";
+  AVs[current_testno].attribute = (char*)"Q";
   p = AVs[current_testno].value;
   if (tcp->th_x2) {
     /* Reserved field of TCP is not zero */
@@ -2442,7 +2442,7 @@
   AVs[numtests-1].next = NULL;
   
   /* First of all, if we got this far the response was yes */
-  AVs[current_testno].attribute = "R";
+  AVs[current_testno].attribute = (char*)"R";
   strcpy(AVs[current_testno].value, "Y");
 
   current_testno++;
@@ -2452,7 +2452,7 @@
     hss->target->FPR->osscan_closedudpport = hss->upi.dport;
 
   /* Now let us do an easy one, Don't fragment */
-  AVs[current_testno].attribute = "DF";
+  AVs[current_testno].attribute = (char*)"DF";
   if(ntohs(ip->ip_off) & 0x4000) {
     strcpy(AVs[current_testno].value,"Y");
   } else strcpy(AVs[current_testno].value, "N");
@@ -2460,33 +2460,33 @@
   current_testno++;
 
   /* TTL */
-  AVs[current_testno].attribute = "T";
+  AVs[current_testno].attribute = (char*)"T";
   sprintf(AVs[current_testno].value, "%d", ip->ip_ttl);
 
   current_testno++;
 
   /* TOS of the response */
-  AVs[current_testno].attribute = "TOS";
+  AVs[current_testno].attribute = (char*)"TOS";
   sprintf(AVs[current_testno].value, "%hX", ip->ip_tos);
 
   current_testno++;
 
   /* Now we look at the IP datagram length that was returned, some
      machines send more of the original packet back than others */
-  AVs[current_testno].attribute = "IPL";
+  AVs[current_testno].attribute = (char*)"IPL";
   sprintf(AVs[current_testno].value, "%hX", ntohs(ip->ip_len));
 
   current_testno++;
 
   /* unused filed not zero in Destination Unreachable Message */
-  AVs[current_testno].attribute = "UN";
+  AVs[current_testno].attribute = (char*)"UN";
   sprintf(AVs[current_testno].value, "%hX", ntohl(icmp->icmp_void));
 
   current_testno++;
 
   /* OK, lets check the returned IP length, some systems @$@ this
      up */
-  AVs[current_testno].attribute = "RIPL";
+  AVs[current_testno].attribute = (char*)"RIPL";
   if(ntohs(ip2->ip_len) == 328)
        strcpy(AVs[current_testno].value, "G");
   else
@@ -2499,7 +2499,7 @@
 #if !defined(SOLARIS) && !defined(SUNOS) && !defined(IRIX) && !defined(HPUX)
 
   /* Now lets see how they treated the ID we sent ... */
-  AVs[current_testno].attribute = "RID";
+  AVs[current_testno].attribute = (char*)"RID";
   if (ip2->ip_id == hss->upi.ipid)
     strcpy(AVs[current_testno].value, "G"); /* The good "expected" value */
   else
@@ -2511,7 +2511,7 @@
 
   /* Let us see if the IP checksum we got back computes */
 
-  AVs[current_testno].attribute = "RIPCK";
+  AVs[current_testno].attribute = (char*)"RIPCK";
   /* Thanks to some machines not having struct ip member ip_sum we
      have to go with this BS */
   checksumptr = (unsigned short *)   ((char *) ip2 + 10);
@@ -2532,7 +2532,7 @@
   current_testno++;
 
   /* UDP checksum */
-  AVs[current_testno].attribute = "RUCK";
+  AVs[current_testno].attribute = (char*)"RUCK";
   if (udp->uh_sum == hss->upi.udpck)
     strcpy(AVs[current_testno].value, "G"); /* The "expected" good value */
   else
@@ -2541,7 +2541,7 @@
   current_testno++;
 
   /* UDP length ... */
-  AVs[current_testno].attribute = "RUL";
+  AVs[current_testno].attribute = (char*)"RUL";
   if(ntohs(udp->uh_ulen) == 308)
        strcpy(AVs[current_testno].value, "G"); /* The "expected" good value */
   else
@@ -2557,7 +2557,7 @@
     if (*datastart != hss->upi.patternbyte) break;
     datastart++;
   }
-  AVs[current_testno].attribute = "RUD";
+  AVs[current_testno].attribute = (char*)"RUD";
   if (datastart < dataend)
     strcpy(AVs[current_testno].value, "I"); /* They fucked it up */
   else  
@@ -2622,7 +2622,7 @@
     AVs[i].next = &AVs[i+1];
   AVs[numtests-1].next = NULL;
 
-  AVs[current_testno].attribute = "R";
+  AVs[current_testno].attribute = (char*)"R";
   strcpy(AVs[current_testno].value, "Y");
 
   current_testno++;
@@ -2633,7 +2633,7 @@
    * N. Both not set;
    * O. Other(both different with the sender, -_-b).
    */
-  AVs[current_testno].attribute = "DFI";
+  AVs[current_testno].attribute = (char*)"DFI";
   value1 = (ntohs(ip1->ip_off) & IP_DF);
   value2 = (ntohs(ip2->ip_off) & IP_DF);
   if (value1 && value2)
@@ -2652,7 +2652,7 @@
 
   /* TTL */
     
-  AVs[current_testno].attribute = "T";
+  AVs[current_testno].attribute = (char*)"T";
   sprintf(AVs[current_testno].value, "%d", ip1->ip_ttl);
   
   current_testno++;
@@ -2663,7 +2663,7 @@
    * S. Both use the TOS that the sender uses;
    * O. Other.
    */
-  AVs[current_testno].attribute = "TOSI";
+  AVs[current_testno].attribute = (char*)"TOSI";
   value1 = ip1->ip_tos;
   value2 = ip2->ip_tos;
   if (value1 == value2){
@@ -2685,7 +2685,7 @@
    * S. Both use the Code that the sender uses;
    * O. Other.
    */
-  AVs[current_testno].attribute = "CD";
+  AVs[current_testno].attribute = (char*)"CD";
   value1 = icmp1->icmp_code;
   value2 = icmp2->icmp_code;
   if (value1 == value2){
@@ -2708,7 +2708,7 @@
    * S. Both use the Seq value that the sender uses;
    * O. Other.
    */
-  AVs[5].attribute = "SI";
+  AVs[5].attribute = (char*)"SI";
   value1 = ntohs(icmp1->icmp_seq);
   value2 = ntohs(icmp2->icmp_seq);
   if (value1 == value2) {
@@ -2736,7 +2736,7 @@
    * S. Both the same with the sender;
    * O. Other.
    */
-  AVs[current_testno].attribute = "DLI";
+  AVs[current_testno].attribute = (char*)"DLI";
   value1 = ntohs(ip1->ip_len) - 4 * ip1->ip_hl - 8;
   value2 = ntohs(ip2->ip_len) - 4 * ip2->ip_hl - 8;
   if (value1 == value2){
diff -u nmap-4.60/output.cc nmap-4.60-nowarnings/output.cc
--- nmap-4.60/output.cc 2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/output.cc      2008-04-09 00:55:50.165907538 +0100
@@ -123,7 +123,7 @@
 using namespace std;
 
 extern NmapOps o;
-static char *logtypes[LOG_NUM_FILES]=LOG_NAMES;
+static const char *logtypes[LOG_NUM_FILES]=LOG_NAMES;
 
 /* Used in creating skript kiddie style output.  |<-R4d! */
 static void skid_output(char *s)
@@ -430,7 +430,7 @@
   char grepvers[256];
   char grepown[64];
   char *p;
-  char *state;
+  const char *state;
   char serviceinfo[64];
   char *name=NULL;
   int i;
@@ -761,9 +761,9 @@
 
        int line = 0;
 #ifdef WIN32
-       char* sep = "\r\n";
+       const char* sep = "\r\n";
 #else
-       char* sep = "\n";
+       const char* sep = "\n";
 #endif
        std::string line_prfx = "|  ";
        
@@ -806,7 +806,7 @@
   temp = (char *) safe_malloc(strl*6+1);
   char *end = temp + strl * 6 + 1;
   for (p = temp;(prevch = ch, ch = *str);str++) {
-    char *a;
+    const char *a;
     switch (ch) {
     case '\t':
       a = "&#x9;";
@@ -1146,7 +1146,7 @@
 }
 
 /* Simple helper function for output_xml_scaninfo_records */
-static void doscaninfo(char *type, char *proto, unsigned short *ports, 
+static void doscaninfo(const char *type, const char *proto, unsigned short *ports, 
                  int numports) {
   log_write(LOG_XML, "<scaninfo type=\"%s\" protocol=\"%s\" numservices=\"%d\" services=\"", type, proto, numports);
   output_rangelist_given_ports(LOG_XML, ports, numports);
@@ -1359,9 +1359,9 @@
     // Now to create the fodder for normal output
     for (classno=0; classno < OSR->OSC_num_matches; classno++) {
       /* We have processed enough if any of the following are true */
-      if (!guess && OSR->OSC_Accuracy[classno] < 1.0 ||
+      if ((!guess && OSR->OSC_Accuracy[classno] < 1.0) ||
          OSR->OSC_Accuracy[classno] <= OSR->OSC_Accuracy[0] - 0.1 ||
-         OSR->OSC_Accuracy[classno] < 1.0 && classno > 9)
+         (OSR->OSC_Accuracy[classno] < 1.0 && classno > 9))
        break;
       if (addtochararrayifnew(types, &numtypes, MAX_OS_CLASSMEMBERS, OSR->OSC[classno]->Device_Type) == -1)
        overflow = 1;
@@ -1738,7 +1738,7 @@
   char hostname_tbl[MAX_SERVICE_INFO_FIELDS][MAXHOSTNAMELEN];
   char ostype_tbl[MAX_SERVICE_INFO_FIELDS][64];
   char devicetype_tbl[MAX_SERVICE_INFO_FIELDS][64];
-  char *delim;
+  const char *delim;
 
   for (i=0; i<MAX_SERVICE_INFO_FIELDS; i++)
     hostname_tbl[i][0] = ostype_tbl[i][0] = devicetype_tbl[i][0] = '\0';
@@ -1990,7 +1990,7 @@
     /* If all the files were from the same directory and we're in verbose mode,
        print a brief message unless we are also in debugging mode. */
     log_write(LOG_PLAIN, "Read data files from: %s\n", dir.c_str());
-  } else if (num_dirs == 1 && o.debugging || num_dirs > 1) {
+  } else if ( (num_dirs == 1 && o.debugging) || num_dirs > 1) {
     /* If files were read from more than one directory, or if they were read
        from one directory and we are in debugging mode, display all the files
        grouped by directory. */
diff -u nmap-4.60/portreasons.cc nmap-4.60-nowarnings/portreasons.cc
--- nmap-4.60/portreasons.cc    2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/portreasons.cc 2008-04-08 23:10:05.685911949 +0100
@@ -113,7 +113,7 @@
 class PortList;
 
 /* Possible plural and singular reasons */
-char *reason_text[ER_MAX+1]={ 
+const char *reason_text[ER_MAX+1]={ 
         "reset", "conn-refused", "syn-ack", "syn-ack",  "udp-response",
         "proto-response", "perm-denied",
         "net-unreach", "host-unreach", "proto-unreach",
@@ -125,7 +125,7 @@
         "no-response", "localhost-response", "script-set", "unknown-response"
 };
 
-char *reason_pl_text[ER_MAX+1]={ 
+const char *reason_pl_text[ER_MAX+1]={ 
         "resets", "conn-refused", "syn-acks", "syn-acks",  "udp-responses",
         "proto-responses", "perm-denieds",
         "net-unreaches", "host-unreaches", "proto-unreaches",
@@ -317,7 +317,7 @@
 void print_state_summary(PortList *Ports, unsigned short type) {
        state_reason_summary_t *reason_head, *currentr;
        bool first_time = true;
-       char *separator = ", ";
+       const char *separator = ", ";
        int states;
 
        if((reason_head = print_state_summary_internal(Ports, 0)) == NULL)
diff -u nmap-4.60/scan_engine.cc nmap-4.60-nowarnings/scan_engine.cc
--- nmap-4.60/scan_engine.cc    2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/scan_engine.cc 2008-04-09 02:27:33.233911424 +0100
@@ -286,7 +286,7 @@
   /* Returns true if the given tryno and pingseq match those within this
      probe. */
   bool check_tryno_pingseq(unsigned int tryno, unsigned int pingseq) {
-    return pingseq == 0 && tryno >= this->tryno || pingseq > 0 && pingseq == this->pingseq;
+    return (pingseq == 0 && tryno >= this->tryno) || (pingseq > 0 && pingseq == this->pingseq);
   }
 
   u8 tryno; /* Try (retransmission) number of this probe */
diff -u nmap-4.60/service_scan.cc nmap-4.60-nowarnings/service_scan.cc
--- nmap-4.60/service_scan.cc   2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/service_scan.cc        2008-04-08 23:56:19.137913321 +0100
@@ -216,7 +216,7 @@
   // written if there is enough space.  Otherwise it exits.
   void addServiceChar(char c, int wrapat);
   // Like addServiceChar, but for a whole zero-terminated string
-  void addServiceString(char *s, int wrapat);
+  void addServiceString(const char *s, int wrapat);
   vector<ServiceProbe *>::iterator current_probe;
   u8 *currentresp;
   int currentresplen;
@@ -1354,7 +1354,7 @@
   // Adds a character to servicefp.  Takes care of word wrapping if
   // necessary at the given (wrapat) column.  Chars will only be
   // written if there is enough space.  Otherwise it exits.
-void ServiceNFO::addServiceChar(char c, int wrapat) {
+void ServiceNFO::addServiceChar(const char c, int wrapat) {
 
   if (servicefpalloc - servicefplen < 6)
     fatal("%s - out of space for servicefp", __func__);
@@ -1369,7 +1369,7 @@
 }
 
 // Like addServiceChar, but for a whole zero-terminated string
-void ServiceNFO::addServiceString(char *s, int wrapat) {
+void ServiceNFO::addServiceString(const char *s, int wrapat) {
   while(*s) 
     addServiceChar(*s++, wrapat);
 }
@@ -2136,7 +2136,7 @@
        // example, if we read more data for the same probe response
        // it will probably still match.
       } else {
-       if (o.debugging > 1)
+       if (o.debugging > 1) {
          if (MD->product || MD->version || MD->info)
            log_write(LOG_PLAIN, "Service scan match (Probe %s matched with %s): %s:%hi is %s%s.  Version: 
|%s|%s|%s|\n",
                       probe->getName(), (*probe->fallbacks[fallbackDepth]).getName(),
@@ -2148,6 +2148,7 @@
                       (MD->isSoft)? "soft" : "hard",
                       probe->getName(), (*probe->fallbacks[fallbackDepth]).getName(),
                      svc->target->NameIP(), svc->portno, (svc->tunnel == SERVICE_TUNNEL_SSL)? "SSL/" : "", 
MD->serviceName);
+       }
        svc->probe_matched = MD->serviceName;
        if (MD->product)
          Strncpy(svc->product_matched, MD->product, sizeof(svc->product_matched));
diff -u nmap-4.60/targets.cc nmap-4.60-nowarnings/targets.cc
--- nmap-4.60/targets.cc        2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/targets.cc     2008-04-09 00:24:23.653903462 +0100
@@ -130,7 +130,7 @@
   return 0; // Unreached
 }
 
-char *readhoststate(int state) {
+const char *readhoststate(int state) {
   switch(state) {
   case HOST_UP:
     return "HOST_UP";
@@ -228,7 +228,7 @@
       /* For Netmasks simply compare the network bits and move to the next
        * group if it does not compare, we don't care about the individual addrs */
       if (targets_type == TargetGroup::IPV4_NETMASK) {
-        mask = htonl((unsigned long) (0-1) << 32-exclude_group[i].get_mask());
+        mask = htonl((unsigned long) (0-1) << (32-exclude_group[i].get_mask()));
         if ((tmpTarget & mask) == (checkhost->sin_addr.s_addr & mask)) {
          exclude_group[i].rewind();
          return 1;
@@ -610,11 +610,12 @@
           hs->hostbatch[i]->reason.reason_id = ER_LOCALHOST;
      }
    }
- } else if (!arpping_done)
+ } else if (!arpping_done) {
    if (pingtype & PINGTYPE_ARP) /* A host that we can't arp scan ... maybe localhost */
      massping(hs->hostbatch, hs->current_batch_sz, DEFAULT_PING_TYPES);
    else
      massping(hs->hostbatch, hs->current_batch_sz, pingtype);
+ }
  
  if (!o.noresolve) nmap_mass_rdns(hs->hostbatch, hs->current_batch_sz);
  
diff -u nmap-4.60/tcpip.cc nmap-4.60-nowarnings/tcpip.cc
--- nmap-4.60/tcpip.cc  2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/tcpip.cc       2008-04-09 00:34:30.629913362 +0100
@@ -450,7 +450,7 @@
   Snprintf(ipinfo, sizeof(ipinfo), "ttl=%d id=%d iplen=%d%s %s%s%s", 
          ip->ip_ttl, ntohs(ip->ip_id), ntohs(ip->ip_len), fragnfo,
          ip->ip_hl==5?"":"ipopts={",
-         ip->ip_hl==5?"":print_ip_options((u8*)ip + sizeof(struct ip), MIN((ip->ip_hl-5)*4,len-sizeof(struct ip))),
+         ip->ip_hl==5?"":print_ip_options((u8*)ip + sizeof(struct ip), MIN((unsigned)(ip->ip_hl-5)*4,len-sizeof(struct 
ip))),
          ip->ip_hl==5?"":"}");
 
   if (ip->ip_p == IPPROTO_TCP) {
@@ -1312,7 +1312,7 @@
   return res;
 }
 
-static int Sendto(char *functionname, int sd, const unsigned char *packet, 
+static int Sendto(const char *functionname, int sd, const unsigned char *packet, 
                  int len, unsigned int flags, struct sockaddr *to, int tolen) {
 
 struct sockaddr_in *sin = (struct sockaddr_in *) to;
@@ -2473,7 +2473,7 @@
 
 /* Set a pcap filter */
 void set_pcap_filter(const char *device,
-                    pcap_t *pd, char *bpf, ...)
+                    pcap_t *pd, const char *bpf, ...)
 {
   va_list ap;
   char buf[3072];
diff -u nmap-4.60/tcpip.h nmap-4.60-nowarnings/tcpip.h
--- nmap-4.60/tcpip.h   2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/tcpip.h        2008-04-09 00:35:09.537908459 +0100
@@ -760,7 +760,7 @@
 
 /* Sets a pcap filter function -- makes SOCK_RAW reads easier */
 #ifndef WINIP_H
-void set_pcap_filter(const char *device, pcap_t *pd, char *bpf, ...);
+void set_pcap_filter(const char *device, pcap_t *pd, const char *bpf, ...);
 #endif
 
 #endif /*TCPIP_H*/
diff -u nmap-4.60/timing.cc nmap-4.60-nowarnings/timing.cc
--- nmap-4.60/timing.cc 2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/timing.cc      2008-04-08 23:19:00.489906869 +0100
@@ -238,7 +238,7 @@
   return;    
 }
 
-ScanProgressMeter::ScanProgressMeter(char *stypestr) {
+ScanProgressMeter::ScanProgressMeter(const char *stypestr) {
   scantypestr = strdup(stypestr);
   gettimeofday(&begin, NULL);
   last_print_test = begin;
diff -u nmap-4.60/timing.h nmap-4.60-nowarnings/timing.h
--- nmap-4.60/timing.h  2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/timing.h       2008-04-08 23:18:21.449912228 +0100
@@ -132,7 +132,7 @@
 class ScanProgressMeter {
  public:
   /* A COPY of stypestr is made and saved for when stats are printed */
-  ScanProgressMeter(char *stypestr);
+  ScanProgressMeter(const char *stypestr);
   ~ScanProgressMeter();
 /* Decides whether a timing report is likely to even be
    printed.  There are stringent limitations on how often they are
diff -u nmap-4.60/traceroute.cc nmap-4.60-nowarnings/traceroute.cc
--- nmap-4.60/traceroute.cc     2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/traceroute.cc  2008-04-08 23:24:41.185910736 +0100
@@ -743,7 +743,7 @@
             tg->setState (G_ALIVE_TTL);
             return -1;
         }
-        if (!tg->ttl || tg->gotReply && tg->noDistProbe) {
+        if (!tg->ttl || (tg->gotReply && tg->noDistProbe) ) {
             tg->setState (G_FINISH);
             return 0;
         }
@@ -1135,7 +1135,7 @@
         addr.s_addr = commonPath[ttl_count];
         log_write(LOG_XML, "<hop ttl=\"%d\" rtt=\"--\" ", ttl_count);
         log_write(LOG_XML, "ipaddr=\"%s\"", inet_ntoa(addr));
-        if((hostname_tmp = lookup_cached_host(commonPath[ttl_count])) != "")
+        if((hostname_tmp = lookup_cached_host(commonPath[ttl_count])) != NULL)
             log_write(LOG_XML, " host=\"%s\"", hostname_tmp);
         log_write(LOG_XML, "/>\n");
     }
@@ -1502,7 +1502,7 @@
 
     memset (nameipbuf, '\0', MAXHOSTNAMELEN + INET6_ADDRSTRLEN);
     addr.s_addr = ip;
-    if((hname = lookup_cached_host(ip)) == "")
+    if((hname = lookup_cached_host(ip)) == NULL)
         Snprintf(nameipbuf, MAXHOSTNAMELEN+INET6_ADDRSTRLEN, "%s", inet_ntoa(addr));
     else
         Snprintf (nameipbuf, MAXHOSTNAMELEN + INET6_ADDRSTRLEN, "%s (%s)", hname, inet_ntoa (addr));
diff -u nmap-4.60/utils.cc nmap-4.60-nowarnings/utils.cc
--- nmap-4.60/utils.cc  2008-02-28 18:52:06.000000000 +0000
+++ nmap-4.60-nowarnings/utils.cc       2008-04-09 00:37:36.972537145 +0100
@@ -704,7 +704,7 @@
       bp += Snprintf(buf+bp, buflen-bp,"\n");
 }
 
-static inline char* STRAPP(char *fmt, ...) {
+static inline char* STRAPP(const char *fmt, ...) {
   static char buf[256];
   static int bp;
   int left = (int)sizeof(buf)-bp;

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Current thread: