Fix unused variable warnings in fuzzers.

PiperOrigin-RevId: 264377331
This commit is contained in:
Victor Costan 2019-08-20 07:14:07 -07:00 committed by Victor Costan
parent 5a57d32566
commit 6219c7787b

View file

@ -43,6 +43,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
size_t compressed_size = size_t compressed_size =
snappy::Compress(input.data(), input.size(), &compressed); snappy::Compress(input.data(), input.size(), &compressed);
(void)compressed_size; // Variable only used in debug builds.
assert(compressed_size == compressed.size()); assert(compressed_size == compressed.size());
assert(compressed.size() <= snappy::MaxCompressedLength(input.size())); assert(compressed.size() <= snappy::MaxCompressedLength(input.size()));
assert(snappy::IsValidCompressedBuffer(compressed.data(), compressed.size())); assert(snappy::IsValidCompressedBuffer(compressed.data(), compressed.size()));
@ -51,6 +52,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
bool uncompress_succeeded = snappy::Uncompress( bool uncompress_succeeded = snappy::Uncompress(
compressed.data(), compressed.size(), &uncompressed_after_compress); compressed.data(), compressed.size(), &uncompressed_after_compress);
(void)uncompress_succeeded; // Variable only used in debug builds.
assert(uncompress_succeeded); assert(uncompress_succeeded);
assert(input == uncompressed_after_compress); assert(input == uncompressed_after_compress);
return 0; return 0;