summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-04-26 14:21:45 -0400
committerNick Mathewson <nickm@torproject.org>2017-04-26 14:21:45 -0400
commit4038202f89d97caf4d0a0b2d44d4111c4c4b2422 (patch)
tree28c59c596b91f0aa3f920faa5ed1015353b4bb55 /src
parentbe0557f759a804b5d50cdc775af67aeb1873b719 (diff)
downloadtor-4038202f89d97caf4d0a0b2d44d4111c4c4b2422.tar.gz
tor-4038202f89d97caf4d0a0b2d44d4111c4c4b2422.zip
Avoid a warning from the use of floating-point in zstd
Replace "(preset - 0.5) * 1mb" with "preset * 1mb - 0.5 mb", to avoid warning about converting double to size_t.
Diffstat (limited to 'src')
-rw-r--r--src/common/compress_zstd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/compress_zstd.c b/src/common/compress_zstd.c
index 4a8f03e30a..40b541247b 100644
--- a/src/common/compress_zstd.c
+++ b/src/common/compress_zstd.c
@@ -145,7 +145,8 @@ tor_zstd_state_size_precalc(int compress, int preset)
// variables that are not exposed via the public API. We use a _very_
// simplified function to calculate the estimated amount of bytes used in
// this struct.
- memory_usage += (preset - 0.5) * 1024 * 1024;
+ // memory_usage += (preset - 0.5) * 1024 * 1024;
+ memory_usage += (preset * 1024 * 1024) - (512 * 1024);
// - ZSTD_sizeof_CDict(stream->cdictLocal): Unused in Tor: 0 bytes.
// - stream->outBuffSize: 128 KB:
memory_usage += 128 * 1024;