diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-02-22 19:09:45 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-02-22 19:09:45 +0000 |
commit | e7db789e82a7a2edc5c7e8230265f8ec83021f69 (patch) | |
tree | c8af0a1fe11383d565d916634a7c0d4c963ce4ec /src/or/dns.c | |
parent | a20eda5669cc5ce8b8c02d16ea80f642b7de64f9 (diff) | |
download | tor-e7db789e82a7a2edc5c7e8230265f8ec83021f69.tar.gz tor-e7db789e82a7a2edc5c7e8230265f8ec83021f69.zip |
r14399@tombo: nickm | 2008-02-22 14:09:38 -0500
More 64-to-32 fixes. Partial backport candidate. still not done.
svn:r13680
Diffstat (limited to 'src/or/dns.c')
-rw-r--r-- | src/or/dns.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/or/dns.c b/src/or/dns.c index ac21fc5f33..a617130bdf 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -268,7 +268,12 @@ static int _compare_cached_resolves_by_expiry(const void *_a, const void *_b) { const cached_resolve_t *a = _a, *b = _b; - return a->expire - b->expire; + if (a->expire < b->expire) + return -1; + else if (a->expire == b->expire) + return 0; + else + return 1; } /** Priority queue of cached_resolve_t objects to let us know when they @@ -423,7 +428,7 @@ send_resolved_cell(edge_connection_t *conn, uint8_t answer_type) case RESOLVED_TYPE_ERROR: { const char *errmsg = "Error resolving hostname"; - int msglen = strlen(errmsg); + size_t msglen = strlen(errmsg); buf[1] = msglen; strlcpy(buf+2, errmsg, sizeof(buf)-2); @@ -501,10 +506,10 @@ parse_inaddr_arpa_address(const char *address, struct in_addr *in) if (in) { uint32_t a; /* reverse the bytes */ - a = ( ((inaddr.s_addr & 0x000000fful) << 24) - |((inaddr.s_addr & 0x0000ff00ul) << 8) - |((inaddr.s_addr & 0x00ff0000ul) >> 8) - |((inaddr.s_addr & 0xff000000ul) >> 24)); + a = (uint32_t) ( ((inaddr.s_addr & 0x000000fful) << 24) + |((inaddr.s_addr & 0x0000ff00ul) << 8) + |((inaddr.s_addr & 0x00ff0000ul) >> 8) + |((inaddr.s_addr & 0xff000000ul) >> 24)); inaddr.s_addr = a; memcpy(in, &inaddr, sizeof(inaddr)); |