[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Make GCC very happy, even with lots of warnings set. Also, ...



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

Modified Files:
	circuitbuild.c config.c control.c test.c 
Log Message:
Make GCC very happy, even with lots of warnings set. Also, try to fix some reported Solaris x86 warnings.

Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- circuitbuild.c	8 Aug 2005 21:58:48 -0000	1.133
+++ circuitbuild.c	12 Aug 2005 17:24:53 -0000	1.134
@@ -1672,7 +1672,7 @@
 
   for (i = 0; i < smartlist_len(helper_nodes); ) {
     helper_node_t *helper = smartlist_get(helper_nodes, i);
-    char *why = NULL;
+    const char *why = NULL;
     time_t since = 0;
     if (helper->unlisted_since + HELPER_ALLOW_UNLISTED > now) {
       why = "unlisted";

Index: config.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.385
retrieving revision 1.386
diff -u -d -r1.385 -r1.386
--- config.c	10 Aug 2005 18:05:20 -0000	1.385
+++ config.c	12 Aug 2005 17:24:53 -0000	1.386
@@ -291,6 +291,8 @@
 static void check_libevent_version(const char *m, const char *v, int server);
 #endif
 
+/*static*/ or_options_t *options_new(void);
+
 #define OR_OPTIONS_MAGIC 9090909
 
 static config_format_t options_format = {
@@ -2213,7 +2215,6 @@
     return get_default_conf_file();
 }
 
-
 /** Adjust the address map mased on the MapAddress elements in the
  * configuration <b>options</b>
  */

Index: control.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/control.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- control.c	10 Aug 2005 18:05:20 -0000	1.117
+++ control.c	12 Aug 2005 17:24:53 -0000	1.118
@@ -127,6 +127,10 @@
 
 static void connection_printf_to_buf(connection_t *conn, const char *format, ...)
   CHECK_PRINTF(2,3);
+/*static*/ size_t write_escaped_data(const char *data, size_t len,
+                                     int translate_newlines, char **out);
+/*static*/ size_t read_escaped_data(const char *data, size_t len,
+                                    int translate_newlines,  char **out);
 static void send_control0_message(connection_t *conn, uint16_t type,
                                  uint32_t len, const char *body);
 static void send_control_done(connection_t *conn);
@@ -1883,7 +1887,8 @@
 static int
 connection_control_process_inbuf_v1(connection_t *conn)
 {
-  size_t data_len, cmd_len;
+  size_t data_len;
+  int cmd_len;
   char *args;
 
   tor_assert(conn);

Index: test.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/test.c,v
retrieving revision 1.190
retrieving revision 1.191
diff -u -d -r1.190 -r1.191
--- test.c	9 Aug 2005 18:49:43 -0000	1.190
+++ test.c	12 Aug 2005 17:24:53 -0000	1.191
@@ -676,12 +676,12 @@
   smartlist_insert(sl, 1, (void*)22);
   smartlist_insert(sl, 0, (void*)0);
   smartlist_insert(sl, 5, (void*)555);
-  test_eq((void*)0,   smartlist_get(sl,0));
-  test_eq((void*)1,   smartlist_get(sl,1));
-  test_eq((void*)22,  smartlist_get(sl,2));
-  test_eq((void*)3,   smartlist_get(sl,3));
-  test_eq((void*)4,   smartlist_get(sl,4));
-  test_eq((void*)555, smartlist_get(sl,5));
+  test_eq_ptr((void*)0,   smartlist_get(sl,0));
+  test_eq_ptr((void*)1,   smartlist_get(sl,1));
+  test_eq_ptr((void*)22,  smartlist_get(sl,2));
+  test_eq_ptr((void*)3,   smartlist_get(sl,3));
+  test_eq_ptr((void*)4,   smartlist_get(sl,4));
+  test_eq_ptr((void*)555, smartlist_get(sl,5));
 
   smartlist_clear(sl);
   smartlist_split_string(sl, "abc", ":", 0, 0);
@@ -968,14 +968,14 @@
   test_eq(v, NULL);
   v = strmap_set(map, "K1", (void*)100);
   test_eq(v, (void*)99);
-  test_eq(strmap_get(map,"K1"), (void*)100);
-  test_eq(strmap_get(map,"K2"), (void*)101);
-  test_eq(strmap_get(map,"K-not-there"), NULL);
+  test_eq_ptr(strmap_get(map,"K1"), (void*)100);
+  test_eq_ptr(strmap_get(map,"K2"), (void*)101);
+  test_eq_ptr(strmap_get(map,"K-not-there"), NULL);
 
   v = strmap_remove(map,"K2");
-  test_eq(v, (void*)101);
-  test_eq(strmap_get(map,"K2"), NULL);
-  test_eq(strmap_remove(map,"K2"), NULL);
+  test_eq_ptr(v, (void*)101);
+  test_eq_ptr(strmap_get(map,"K2"), NULL);
+  test_eq_ptr(strmap_remove(map,"K2"), NULL);
 
   strmap_set(map, "K2", (void*)101);
   strmap_set(map, "K3", (void*)102);
@@ -986,9 +986,9 @@
   count = 0;
   strmap_foreach(map, _squareAndRemoveK4, &count);
   test_eq(count, 1);
-  test_eq(strmap_get(map, "K4"), NULL);
-  test_eq(strmap_get(map, "K1"), (void*)10000);
-  test_eq(strmap_get(map, "K6"), (void*)11025);
+  test_eq_ptr(strmap_get(map, "K4"), NULL);
+  test_eq_ptr(strmap_get(map, "K1"), (void*)10000);
+  test_eq_ptr(strmap_get(map, "K6"), (void*)11025);
 
   iter = strmap_iter_init(map);
   strmap_iter_get(iter,&k,&v);
@@ -1010,8 +1010,8 @@
   test_assert(strmap_iter_done(iter));
 
   /* Make sure we removed K2, but not the others. */
-  test_eq(strmap_get(map, "K2"), NULL);
-  test_eq(strmap_get(map, "K5"), (void*)10816);
+  test_eq_ptr(strmap_get(map, "K2"), NULL);
+  test_eq_ptr(strmap_get(map, "K5"), (void*)10816);
 
   /* Clean up after ourselves. */
   strmap_free(map, NULL);
@@ -1019,11 +1019,11 @@
   /* Now try some lc functions. */
   map = strmap_new();
   strmap_set_lc(map,"Ab.C", (void*)1);
-  test_eq(strmap_get(map,"ab.c"), (void*)1);
-  test_eq(strmap_get_lc(map,"AB.C"), (void*)1);
-  test_eq(strmap_get(map,"AB.C"), NULL);
-  test_eq(strmap_remove_lc(map,"aB.C"), (void*)1);
-  test_eq(strmap_get_lc(map,"AB.C"), NULL);
+  test_eq_ptr(strmap_get(map,"ab.c"), (void*)1);
+  test_eq_ptr(strmap_get_lc(map,"AB.C"), (void*)1);
+  test_eq_ptr(strmap_get(map,"AB.C"), NULL);
+  test_eq_ptr(strmap_remove_lc(map,"aB.C"), (void*)1);
+  test_eq_ptr(strmap_get_lc(map,"AB.C"), NULL);
   strmap_free(map,NULL);
 }
 
@@ -1396,11 +1396,11 @@
   test_streq("reject 192.168.0.0/16:*", policy->string);
 
   test_assert(exit_policy_implicitly_allows_local_networks(policy, 0));
-  test_eq(ADDR_POLICY_ACCEPTED,
+  test_assert(ADDR_POLICY_ACCEPTED ==
           router_compare_addr_to_addr_policy(0x01020304u, 2, policy));
-  test_eq(ADDR_POLICY_PROBABLY_ACCEPTED,
+  test_assert(ADDR_POLICY_PROBABLY_ACCEPTED ==
           router_compare_addr_to_addr_policy(0, 2, policy));
-  test_eq(ADDR_POLICY_REJECTED,
+  test_assert(ADDR_POLICY_REJECTED ==
           router_compare_addr_to_addr_policy(0xc0a80102, 2, policy));
 
   addr_policy_free(policy);
@@ -1509,10 +1509,10 @@
   test_memeq(d2->intro_point_extend_info[1]->identity_digest,
              d1->intro_point_extend_info[1]->identity_digest, DIGEST_LEN);
 
-  test_eq(BAD_HOSTNAME, parse_extended_hostname(address1));
-  test_eq(ONION_HOSTNAME, parse_extended_hostname(address2));
-  test_eq(EXIT_HOSTNAME, parse_extended_hostname(address3));
-  test_eq(NORMAL_HOSTNAME, parse_extended_hostname(address4));
+  test_assert(BAD_HOSTNAME == parse_extended_hostname(address1));
+  test_assert(ONION_HOSTNAME == parse_extended_hostname(address2));
+  test_assert(EXIT_HOSTNAME == parse_extended_hostname(address3));
+  test_assert(NORMAL_HOSTNAME == parse_extended_hostname(address4));
 
   rend_service_descriptor_free(d1);
   rend_service_descriptor_free(d2);