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

[or-cvs] r16759: {tor} Fix mingw build with --enable-gcc-warnings set. (in tor/trunk/src: common or)



Author: nickm
Date: 2008-09-04 17:58:09 -0400 (Thu, 04 Sep 2008)
New Revision: 16759

Modified:
   tor/trunk/src/common/address.c
   tor/trunk/src/common/compat.c
   tor/trunk/src/or/eventdns.c
   tor/trunk/src/or/geoip.c
   tor/trunk/src/or/main.c
Log:
Fix mingw build with --enable-gcc-warnings set.

Modified: tor/trunk/src/common/address.c
===================================================================
--- tor/trunk/src/common/address.c	2008-09-04 20:42:02 UTC (rev 16758)
+++ tor/trunk/src/common/address.c	2008-09-04 21:58:09 UTC (rev 16759)
@@ -64,7 +64,7 @@
 {
   if (a->family == AF_INET) {
     struct sockaddr_in *sin;
-    if (len < sizeof(struct sockaddr_in))
+    if (len < (int)sizeof(struct sockaddr_in))
       return -1;
     sin = (struct sockaddr_in *)sa_out;
     sin->sin_family = AF_INET;
@@ -73,7 +73,7 @@
     return sizeof(struct sockaddr_in);
   } else if (a->family == AF_INET6) {
     struct sockaddr_in6 *sin6;
-    if (len < sizeof(struct sockaddr_in6))
+    if (len < (int)sizeof(struct sockaddr_in6))
       return -1;
     sin6 = (struct sockaddr_in6 *)sa_out;
     memset(sin6, 0, sizeof(struct sockaddr_in6));

Modified: tor/trunk/src/common/compat.c
===================================================================
--- tor/trunk/src/common/compat.c	2008-09-04 20:42:02 UTC (rev 16758)
+++ tor/trunk/src/common/compat.c	2008-09-04 21:58:09 UTC (rev 16759)
@@ -497,7 +497,7 @@
   }
 #ifdef WIN32
   _lseek(fd, 0, SEEK_SET);
-  if (_locking(fd, blocking ? _LK_LOCK : _LK_NBLOCK, 0) < 0) {
+  if (_locking(fd, blocking ? _LK_LOCK : _LK_NBLCK, 0) < 0) {
     if (errno != EDEADLOCK)
       log_warn(LD_FS,"Couldn't lock \"%s\": %s", filename, strerror(errno));
     else
@@ -529,8 +529,8 @@
 
   log_info(LD_FS, "Unlocking \"%s\"", lockfile->filename);
 #ifdef WIN32
-  _lseek(fd, 0, SEEK_SET);
-  if (_locking(fd, _LK_UNLCK, 0) < 0) {
+  _lseek(lockfile->fd, 0, SEEK_SET);
+  if (_locking(lockfile->fd, _LK_UNLCK, 0) < 0) {
     log_warn(LD_FS,"Error unlocking \"%s\": %s", lockfile->filename,
              strerror(errno));
   }

Modified: tor/trunk/src/or/eventdns.c
===================================================================
--- tor/trunk/src/or/eventdns.c	2008-09-04 20:42:02 UTC (rev 16758)
+++ tor/trunk/src/or/eventdns.c	2008-09-04 21:58:09 UTC (rev 16759)
@@ -2178,7 +2178,7 @@
 			server = server->next;
 		} while (server != started_at);
 	}
-	if (addrlen > sizeof(ns->address)) {
+	if (addrlen > (int)sizeof(ns->address)) {
 		return 2;
 	}
 

Modified: tor/trunk/src/or/geoip.c
===================================================================
--- tor/trunk/src/or/geoip.c	2008-09-04 20:42:02 UTC (rev 16758)
+++ tor/trunk/src/or/geoip.c	2008-09-04 21:58:09 UTC (rev 16759)
@@ -443,7 +443,7 @@
 #endif
     HT_FOREACH(ent, clientmap, &client_history) {
       int country;
-      if (((*ent)->last_seen & ACTION_MASK) != action)
+      if (((*ent)->last_seen & ACTION_MASK) != (int)action)
         continue;
       country = geoip_get_country_by_ip((*ent)->ipaddr);
       if (country < 0)

Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c	2008-09-04 20:42:02 UTC (rev 16758)
+++ tor/trunk/src/or/main.c	2008-09-04 21:58:09 UTC (rev 16759)
@@ -1868,7 +1868,11 @@
         log_warn(LD_GENERAL, "It looks like another Tor process is running "
                  "with the same data directory.  Waiting 5 seconds to see "
                  "if it goes away.");
+#ifndef WIN32
         sleep(5);
+#else
+        Sleep(5000);
+#endif
         r = try_locking(options, 0);
         if (r<0) {
           log_err(LD_GENERAL, "No, it's still there.  Exiting.");