summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-09-01 15:59:40 -0400
committerNick Mathewson <nickm@torproject.org>2009-09-01 15:59:40 -0400
commit1cda6f3e756c2e76d50d398726c5b1851556756f (patch)
tree6532b12c8f7cc40b7daecb810e49596c6f509647 /src/common
parentd76fd59a7ee49b36591708070d1e50d8a50c67d0 (diff)
parentbddda9bbdb047e52652f7c6f9c2047df15a4e08e (diff)
downloadtor-1cda6f3e756c2e76d50d398726c5b1851556756f.tar.gz
tor-1cda6f3e756c2e76d50d398726c5b1851556756f.zip
Merge commit 'origin/maint-0.2.1'
Diffstat (limited to 'src/common')
-rw-r--r--src/common/address.c9
-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, 15 insertions, 13 deletions
diff --git a/src/common/address.c b/src/common/address.c
index fac9d50e15..2fe013a2cd 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -373,10 +373,11 @@ 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 = (uint32_t)
+ (((inaddr.s_addr & 0x000000ff) << 24)
+ |((inaddr.s_addr & 0x0000ff00) << 8)
+ |((inaddr.s_addr & 0x00ff0000) >> 8)
+ |((inaddr.s_addr & 0xff000000) >> 24));
if (result) {
tor_addr_from_in(result, &inaddr);
diff --git a/src/common/log.c b/src/common/log.c
index c25e98d5f8..09efa014c0 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -147,8 +147,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 a518e83d20..541cdb6403 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -1442,8 +1442,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 39e265404a..90f952f793 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1876,7 +1876,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;
@@ -1961,7 +1962,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);
@@ -2020,7 +2021,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;