[or-cvs] Tricksy compiler warnings! We hates them, hates them foreve...

Nick Mathewson nickm at seul.org
Wed Oct 27 21:14:13 UTC 2004


Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv16330/src/common

Modified Files:
	crypto.c log.c tortls.c 
Log Message:
Tricksy compiler warnings! We hates them, hates them forever, my precious!

Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/src/common/crypto.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- crypto.c	27 Oct 2004 18:16:36 -0000	1.115
+++ crypto.c	27 Oct 2004 21:14:10 -0000	1.116
@@ -127,7 +127,7 @@
 static void
 crypto_log_errors(int severity, const char *doing)
 {
-  int err;
+  unsigned int err;
   const char *msg, *lib, *func;
   while ((err = ERR_get_error()) != 0) {
     msg = (const char*)ERR_reason_error_string(err);
@@ -1398,7 +1398,7 @@
   RAND_screen();
   return 0;
 #else
-  static char *filenames[] = {
+  static const char *filenames[] = {
     "/dev/srandom", "/dev/urandom", "/dev/random", NULL
   };
   int fd;

Index: log.c
===================================================================
RCS file: /home/or/cvsroot/src/common/log.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- log.c	27 Oct 2004 06:37:34 -0000	1.57
+++ log.c	27 Oct 2004 21:14:10 -0000	1.58
@@ -124,11 +124,13 @@
       n += r;
   }
   
-  n += tor_vsnprintf(buf+n,buf_len-n,format,ap);
-  if(n < 0) {
+  r = tor_vsnprintf(buf+n,buf_len-n,format,ap);
+  if(r < 0) {
     n = buf_len-2;
     strlcpy(buf+buf_len-TRUNCATED_STR_LEN-1, TRUNCATED_STR,
             buf_len-(buf_len-TRUNCATED_STR_LEN-1));
+  } else {
+    n += r;
   }
   buf[n]='\n';
   buf[n+1]='\0';

Index: tortls.c
===================================================================
RCS file: /home/or/cvsroot/src/common/tortls.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- tortls.c	27 Oct 2004 18:16:37 -0000	1.72
+++ tortls.c	27 Oct 2004 21:14:10 -0000	1.73
@@ -210,7 +210,7 @@
     goto error;
   if ((nid = OBJ_txt2nid("organizationName")) == NID_undef) goto error;
   if (!(X509_NAME_add_entry_by_NID(name, nid, MBSTRING_ASC,
-                                   "TOR", -1, -1, 0))) goto error;
+                                   (char*)"TOR", -1, -1, 0))) goto error;
   if ((nid = OBJ_txt2nid("commonName")) == NID_undef) goto error;
   if (!(X509_NAME_add_entry_by_NID(name, nid, MBSTRING_ASC,
                                    (char*)cname, -1, -1, 0))) goto error;
@@ -221,7 +221,7 @@
     goto error;
   if ((nid = OBJ_txt2nid("organizationName")) == NID_undef) goto error;
   if (!(X509_NAME_add_entry_by_NID(name_issuer, nid, MBSTRING_ASC,
-                                   "TOR", -1, -1, 0))) goto error;
+                                   (char*)"TOR", -1, -1, 0))) goto error;
   if ((nid = OBJ_txt2nid("commonName")) == NID_undef) goto error;
   if (!(X509_NAME_add_entry_by_NID(name_issuer, nid, MBSTRING_ASC,
                                 (char*)cname_sign, -1, -1, 0))) goto error;



More information about the tor-commits mailing list