[or-cvs] Make GCC v4 happy with heavy warnings enabled.

Nick Mathewson nickm at seul.org
Thu Sep 8 06:37:52 UTC 2005


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv7516

Modified Files:
	config.c control.c dirserv.c rendservice.c 
Log Message:
Make GCC v4 happy with heavy warnings enabled.

Index: config.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.405
retrieving revision 1.406
diff -u -d -r1.405 -r1.406
--- config.c	8 Sep 2005 05:38:47 -0000	1.405
+++ config.c	8 Sep 2005 06:37:50 -0000	1.406
@@ -86,16 +86,16 @@
  * or_options_t.<b>member</b>"
  */
 #define VAR(name,conftype,member,initvalue)                            \
-  { name, CONFIG_TYPE_ ## conftype, STRUCT_OFFSET(or_options_t, member), initvalue }
+  { name, CONFIG_TYPE_ ## conftype, STRUCT_OFFSET(or_options_t, member), initvalue, NULL }
 /** An entry for config_vars: "The option <b>name</b> is obsolete." */
-#define OBSOLETE(name) { name, CONFIG_TYPE_OBSOLETE, 0, NULL }
+#define OBSOLETE(name) { name, CONFIG_TYPE_OBSOLETE, 0, NULL, NULL }
 
 /** Array of configuration options.  Until we disallow nonstandard
  * abbreviations, order is significant, since the first matching option will
  * be chosen first.
  */
 static config_var_t _option_vars[] = {
-  VAR("AccountingMax",       MEMUNIT,   AccountingMax,        "0 bytes"),
+  VAR("AccountingMax",       MEMUNIT,   AccountingMax,       "0 bytes"),
   VAR("AccountingMaxKB",     UINT,     _AccountingMaxKB,     "0"),
   VAR("AccountingStart",     STRING,   AccountingStart,      NULL),
   VAR("Address",             STRING,   Address,              NULL),
@@ -189,12 +189,12 @@
   VAR("UseHelperNodes",      BOOL,     UseHelperNodes,       "0"),
   VAR("User",                STRING,   User,                 NULL),
   VAR("__LeaveStreamsUnattached", BOOL,LeaveStreamsUnattached, "0"),
-  { NULL, CONFIG_TYPE_OBSOLETE, 0, NULL }
+  { NULL, CONFIG_TYPE_OBSOLETE, 0, NULL, NULL }
 };
 #undef VAR
 
 #define VAR(name,conftype,member,initvalue) \
-  { name, CONFIG_TYPE_ ## conftype, STRUCT_OFFSET(or_state_t, member), initvalue }
+  { name, CONFIG_TYPE_ ## conftype, STRUCT_OFFSET(or_state_t, member), initvalue, NULL }
 static config_var_t _state_vars[] = {
   VAR("AccountingBytesReadInterval", MEMUNIT, AccountingBytesReadInInterval,NULL),
   VAR("AccountingBytesWrittenInInterval", MEMUNIT,
@@ -208,7 +208,7 @@
   VAR("HelperNodes",             LINELIST_V,  HelperNodes,          NULL),
   VAR("LastWritten",             ISOTIME,     LastWritten,          NULL),
 
-  { NULL, CONFIG_TYPE_OBSOLETE, 0, NULL }
+  { NULL, CONFIG_TYPE_OBSOLETE, 0, NULL, NULL }
 };
 
 #undef VAR

Index: control.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/control.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- control.c	8 Sep 2005 03:18:51 -0000	1.126
+++ control.c	8 Sep 2005 06:37:50 -0000	1.127
@@ -409,7 +409,7 @@
     *outp++ = *cp++;
   }
   *outp = '\0';
-  tor_assert((outp - *out) == *out_len);
+  tor_assert((outp - *out) == (int)*out_len);
 
   return end+1;
 }
@@ -1965,7 +1965,8 @@
    * recognize it.
    */
   cmd_len = 0;
-  while (cmd_len < data_len && !TOR_ISSPACE(conn->incoming_cmd[cmd_len]))
+  while ((size_t)cmd_len < data_len
+         && !TOR_ISSPACE(conn->incoming_cmd[cmd_len]))
     ++cmd_len;
 
   /*

Index: dirserv.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -d -r1.208 -r1.209
--- dirserv.c	8 Sep 2005 05:23:55 -0000	1.208
+++ dirserv.c	8 Sep 2005 06:37:50 -0000	1.209
@@ -422,8 +422,8 @@
   for (i = 0; i < smartlist_len(descriptor_list); ++i) {
     ent = smartlist_get(descriptor_list, i);
     r = dirserv_router_fingerprint_is_known(ent);
-    if (ent->bandwidthcapacity >= min_bw &&
-        ent->bandwidthrate >= min_bw &&
+    if (ent->bandwidthcapacity >= (size_t)min_bw &&
+        ent->bandwidthrate >= (size_t)min_bw &&
         r == 0) {
       /* then log this one */
       tor_snprintf(buf, sizeof(buf),

Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/rendservice.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- rendservice.c	6 Sep 2005 06:14:38 -0000	1.136
+++ rendservice.c	8 Sep 2005 06:37:50 -0000	1.137
@@ -469,7 +469,7 @@
                   extend_info->identity_digest, DIGEST_LEN);
 
     klen = ntohs(get_uint16(buf+7+DIGEST_LEN));
-    if (len != 7+DIGEST_LEN+2+klen+20+128) {
+    if ((int)len != 7+DIGEST_LEN+2+klen+20+128) {
       log_fn(LOG_WARN, "Bad length %u for version 2 INTRODUCE2 cell.", (int)len);
       goto err;
     }



More information about the tor-commits mailing list