summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2009-09-01 05:23:47 +0200
committerSebastian Hahn <sebastian@torproject.org>2009-09-01 18:36:27 +0200
commitaea9cf1011cf3c7badfd1bc49f0a27f96f234cf9 (patch)
treec66af3fe76725d159afe4f32e421c3c6a8db349c /src/common
parent075c004095e25940707aa496b49e29caefdd73e8 (diff)
downloadtor-aea9cf1011cf3c7badfd1bc49f0a27f96f234cf9.tar.gz
tor-aea9cf1011cf3c7badfd1bc49f0a27f96f234cf9.zip
Fix compile warnings on Snow Leopard
Big thanks to nickm and arma for helping me with this!
Diffstat (limited to 'src/common')
-rw-r--r--src/common/address.c8
-rw-r--r--src/common/log.c4
-rw-r--r--src/common/tortls.c4
-rw-r--r--src/common/tortls.h4
-rw-r--r--src/common/util.c7
5 files changed, 14 insertions, 13 deletions
diff --git a/src/common/address.c b/src/common/address.c
index fac9d50e15..88cbbb7470 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -373,10 +373,10 @@ tor_addr_parse_reverse_lookup_name(tor_addr_t *result, const char *address,
return -1; /* malformed. */
/* reverse the bytes */
- inaddr.s_addr = (((inaddr.s_addr & 0x000000fful) << 24)
- |((inaddr.s_addr & 0x0000ff00ul) << 8)
- |((inaddr.s_addr & 0x00ff0000ul) >> 8)
- |((inaddr.s_addr & 0xff000000ul) >> 24));
+ inaddr.s_addr = (((inaddr.s_addr & (uint32_t)0x000000fful) << 24)
+ |((inaddr.s_addr & (uint32_t)0x0000ff00ul) << 8)
+ |((inaddr.s_addr & (uint32_t)0x00ff0000ul) >> 8)
+ |((inaddr.s_addr & (uint32_t)0xff000000ul) >> 24));
if (result) {
tor_addr_from_in(result, &inaddr);
diff --git a/src/common/log.c b/src/common/log.c
index ea09fca167..423a687a51 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -149,8 +149,8 @@ _log_prefix(char *buf, size_t buf_len, int severity)
t = (time_t)now.tv_sec;
n = strftime(buf, buf_len, "%b %d %H:%M:%S", tor_localtime_r(&t, &tm));
- r = tor_snprintf(buf+n, buf_len-n, ".%.3ld [%s] ",
- (long)now.tv_usec / 1000, sev_to_string(severity));
+ r = tor_snprintf(buf+n, buf_len-n, ".%.3i [%s] ",
+ (int)now.tv_usec / 1000, sev_to_string(severity));
if (r<0)
return buf_len-1;
else
diff --git a/src/common/tortls.c b/src/common/tortls.c
index f14eab18a5..aeb0ca0800 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -1443,8 +1443,8 @@ tor_tls_used_v1_handshake(tor_tls_t *tls)
* buffer and *<b>wbuf_bytes</b> to the amount actually used. */
void
tor_tls_get_buffer_sizes(tor_tls_t *tls,
- int *rbuf_capacity, int *rbuf_bytes,
- int *wbuf_capacity, int *wbuf_bytes)
+ size_t *rbuf_capacity, size_t *rbuf_bytes,
+ size_t *wbuf_capacity, size_t *wbuf_bytes)
{
if (tls->ssl->s3->rbuf.buf)
*rbuf_capacity = tls->ssl->s3->rbuf.len;
diff --git a/src/common/tortls.h b/src/common/tortls.h
index 44e3b499ef..d00690911c 100644
--- a/src/common/tortls.h
+++ b/src/common/tortls.h
@@ -73,8 +73,8 @@ void tor_tls_get_n_raw_bytes(tor_tls_t *tls,
size_t *n_read, size_t *n_written);
void tor_tls_get_buffer_sizes(tor_tls_t *tls,
- int *rbuf_capacity, int *rbuf_bytes,
- int *wbuf_capacity, int *wbuf_bytes);
+ size_t *rbuf_capacity, size_t *rbuf_bytes,
+ size_t *wbuf_capacity, size_t *wbuf_bytes);
int tor_tls_used_v1_handshake(tor_tls_t *tls);
diff --git a/src/common/util.c b/src/common/util.c
index 7b9e5eb562..9dcf9fba64 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1816,7 +1816,8 @@ write_chunks_to_file_impl(const char *fname, const smartlist_t *chunks,
int open_flags)
{
open_file_t *file = NULL;
- int fd, result;
+ int fd;
+ ssize_t result;
fd = start_writing_to_file(fname, open_flags, 0600, &file);
if (fd<0)
return -1;
@@ -1901,7 +1902,7 @@ read_file_to_str(const char *filename, int flags, struct stat *stat_out)
int fd; /* router file */
struct stat statbuf;
char *string;
- int r;
+ ssize_t r;
int bin = flags & RFTS_BIN;
tor_assert(filename);
@@ -1960,7 +1961,7 @@ read_file_to_str(const char *filename, int flags, struct stat *stat_out)
* match for size. */
int save_errno = errno;
log_warn(LD_FS,"Could read only %d of %ld bytes of file \"%s\".",
- r, (long)statbuf.st_size,filename);
+ (int)r, (long)statbuf.st_size,filename);
tor_free(string);
close(fd);
errno = save_errno;