Fix mingw build with --enable-gcc-warnings set.

svn:r16759
This commit is contained in:
Nick Mathewson 2008-09-04 21:58:09 +00:00
parent fa2f72ded7
commit c33dde4ac1
5 changed files with 11 additions and 7 deletions

View File

@ -64,7 +64,7 @@ tor_addr_to_sockaddr(const tor_addr_t *a,
{ {
if (a->family == AF_INET) { if (a->family == AF_INET) {
struct sockaddr_in *sin; struct sockaddr_in *sin;
if (len < sizeof(struct sockaddr_in)) if (len < (int)sizeof(struct sockaddr_in))
return -1; return -1;
sin = (struct sockaddr_in *)sa_out; sin = (struct sockaddr_in *)sa_out;
sin->sin_family = AF_INET; sin->sin_family = AF_INET;
@ -73,7 +73,7 @@ tor_addr_to_sockaddr(const tor_addr_t *a,
return sizeof(struct sockaddr_in); return sizeof(struct sockaddr_in);
} else if (a->family == AF_INET6) { } else if (a->family == AF_INET6) {
struct sockaddr_in6 *sin6; struct sockaddr_in6 *sin6;
if (len < sizeof(struct sockaddr_in6)) if (len < (int)sizeof(struct sockaddr_in6))
return -1; return -1;
sin6 = (struct sockaddr_in6 *)sa_out; sin6 = (struct sockaddr_in6 *)sa_out;
memset(sin6, 0, sizeof(struct sockaddr_in6)); memset(sin6, 0, sizeof(struct sockaddr_in6));

View File

@ -497,7 +497,7 @@ tor_lockfile_lock(const char *filename, int blocking, int *locked_out)
} }
#ifdef WIN32 #ifdef WIN32
_lseek(fd, 0, SEEK_SET); _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) if (errno != EDEADLOCK)
log_warn(LD_FS,"Couldn't lock \"%s\": %s", filename, strerror(errno)); log_warn(LD_FS,"Couldn't lock \"%s\": %s", filename, strerror(errno));
else else
@ -529,8 +529,8 @@ tor_lockfile_unlock(tor_lockfile_t *lockfile)
log_info(LD_FS, "Unlocking \"%s\"", lockfile->filename); log_info(LD_FS, "Unlocking \"%s\"", lockfile->filename);
#ifdef WIN32 #ifdef WIN32
_lseek(fd, 0, SEEK_SET); _lseek(lockfile->fd, 0, SEEK_SET);
if (_locking(fd, _LK_UNLCK, 0) < 0) { if (_locking(lockfile->fd, _LK_UNLCK, 0) < 0) {
log_warn(LD_FS,"Error unlocking \"%s\": %s", lockfile->filename, log_warn(LD_FS,"Error unlocking \"%s\": %s", lockfile->filename,
strerror(errno)); strerror(errno));
} }

View File

@ -2178,7 +2178,7 @@ _evdns_nameserver_add_impl(const struct sockaddr *address,
server = server->next; server = server->next;
} while (server != started_at); } while (server != started_at);
} }
if (addrlen > sizeof(ns->address)) { if (addrlen > (int)sizeof(ns->address)) {
return 2; return 2;
} }

View File

@ -443,7 +443,7 @@ geoip_get_client_history(time_t now, geoip_client_action_t action)
#endif #endif
HT_FOREACH(ent, clientmap, &client_history) { HT_FOREACH(ent, clientmap, &client_history) {
int country; int country;
if (((*ent)->last_seen & ACTION_MASK) != action) if (((*ent)->last_seen & ACTION_MASK) != (int)action)
continue; continue;
country = geoip_get_country_by_ip((*ent)->ipaddr); country = geoip_get_country_by_ip((*ent)->ipaddr);
if (country < 0) if (country < 0)

View File

@ -1868,7 +1868,11 @@ try_locking(or_options_t *options, int err_if_locked)
log_warn(LD_GENERAL, "It looks like another Tor process is running " log_warn(LD_GENERAL, "It looks like another Tor process is running "
"with the same data directory. Waiting 5 seconds to see " "with the same data directory. Waiting 5 seconds to see "
"if it goes away."); "if it goes away.");
#ifndef WIN32
sleep(5); sleep(5);
#else
Sleep(5000);
#endif
r = try_locking(options, 0); r = try_locking(options, 0);
if (r<0) { if (r<0) {
log_err(LD_GENERAL, "No, it's still there. Exiting."); log_err(LD_GENERAL, "No, it's still there. Exiting.");