aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_token_bucket.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-08-06 11:42:04 -0400
committerNick Mathewson <nickm@torproject.org>2019-08-06 11:42:04 -0400
commit484b6540480ee4fdbc7a105242c897cca6d9d8eb (patch)
tree548f6cf83e5fb3fa8f67ccca4c5c3132f0e51217 /src/test/test_token_bucket.c
parent88f9b123d6d929d2f783ba7823b7c289c09d83e0 (diff)
downloadtor-484b6540480ee4fdbc7a105242c897cca6d9d8eb.tar.gz
tor-484b6540480ee4fdbc7a105242c897cca6d9d8eb.zip
test_token_bucket: negate after casting to signed type.
Previously we tried multiplying by -1 before casting to int32_t, which would cause us to cast the -1 to an unsigned before we multiplied. This gave us compiler warnings on windows. Fixes bug 31353; bug not in any released Tor.
Diffstat (limited to 'src/test/test_token_bucket.c')
-rw-r--r--src/test/test_token_bucket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/test_token_bucket.c b/src/test/test_token_bucket.c
index d3ce591388..31670718d9 100644
--- a/src/test/test_token_bucket.c
+++ b/src/test/test_token_bucket.c
@@ -93,7 +93,7 @@ test_token_bucket_ctr_dec(void *arg)
/* Keep underflowing shouldn't flag the bucket as empty. */
tt_uint_op(false, OP_EQ, token_bucket_ctr_dec(&tb, BURST));
- tt_int_op(tb.counter.bucket, OP_EQ, (int32_t) ((BURST + 1) * -1));
+ tt_int_op(tb.counter.bucket, OP_EQ, - (int32_t) (BURST + 1));
done:
;