diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-02-21 21:57:42 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-02-21 21:57:42 +0000 |
commit | b375472d14cb9165e3acab899e4388a36c03bf25 (patch) | |
tree | ae14920d819371d594d45a7020ea44a593bd44d6 /src/common/util.c | |
parent | 1cd90948ab6b82f65600ed9bae45a201dfae4a3d (diff) | |
download | tor-b375472d14cb9165e3acab899e4388a36c03bf25.tar.gz tor-b375472d14cb9165e3acab899e4388a36c03bf25.zip |
r14373@tombo: nickm | 2008-02-21 16:29:18 -0500
Apply warnings about implicit 64-to-32 conversions; some from Sebastian Hahn; some not.
svn:r13664
Diffstat (limited to 'src/common/util.c')
-rw-r--r-- | src/common/util.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/common/util.c b/src/common/util.c index 4cb6f1d6d2..3578dd666a 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -331,8 +331,8 @@ round_to_power_of_2(uint64_t u64) * ===== */ /** Remove from the string <b>s</b> every character which appears in - * <b>strip</b>. Return the number of characters removed. */ -int + * <b>strip</b>. */ +void tor_strstrip(char *s, const char *strip) { char *read = s; @@ -344,7 +344,6 @@ tor_strstrip(char *s, const char *strip) } } *s = '\0'; - return read-s; } /** Return a pointer to a NUL-terminated hexadecimal string encoding @@ -1000,7 +999,8 @@ tor_timegm(struct tm *tm) log_warn(LD_BUG, "Out-of-range argument to tor_timegm"); return -1; } - days = 365 * (year-1970) + n_leapdays(1970,year); + tor_assert(year < INT_MAX); + days = 365 * (year-1970) + n_leapdays(1970,(int)year); for (i = 0; i < tm->tm_mon; ++i) days += days_per_month[i]; if (tm->tm_mon > 1 && IS_LEAPYEAR(year)) @@ -1328,6 +1328,7 @@ write_all(int fd, const char *buf, size_t count, int isSocket) { size_t written = 0; int result; + tor_assert(count < INT_MAX); /*XXXX021 make returnval an ssize_t */ while (written != count) { if (isSocket) @@ -1338,7 +1339,7 @@ write_all(int fd, const char *buf, size_t count, int isSocket) return -1; written += result; } - return count; + return (int)count; } /** Read from <b>fd</b> to <b>buf</b>, until we get <b>count</b> bytes |