Skip to content

Commit

Permalink
'size' remains unused if none of ZLIB, LZO and LZ4 are available.
Browse files Browse the repository at this point in the history
While we're here, take care of a couple of lint warnings by converting CHECK(a != b) to CHECK_NE(a, b).

PiperOrigin-RevId: 369132446
  • Loading branch information
atdt authored and pwnall committed Apr 22, 2021
1 parent 78650d1 commit 9c1be17
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions snappy_test_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ bool Compress(const char* input, size_t input_size, CompressorType comp,
int destlen = compressed->size();
destlen = LZ4_compress_default(input, string_as_array(compressed),
input_size, destlen);
CHECK(destlen != 0);
CHECK_NE(destlen, 0);
if (!compressed_is_preallocated) {
compressed->resize(destlen);
}
Expand Down Expand Up @@ -233,6 +233,8 @@ bool Compress(const char* input, size_t input_size, CompressorType comp,

bool Uncompress(const std::string& compressed, CompressorType comp, int size,
std::string* output) {
// TODO: Switch to [[maybe_unused]] when we can assume C++17.
(void)size;
switch (comp) {
#ifdef ZLIB_VERSION
case ZLIB: {
Expand Down Expand Up @@ -272,7 +274,7 @@ bool Uncompress(const std::string& compressed, CompressorType comp, int size,
int destlen = output->size();
destlen = LZ4_decompress_safe(compressed.data(), string_as_array(output),
compressed.size(), destlen);
CHECK(destlen != 0);
CHECK_NE(destlen, 0);
CHECK_EQ(size, destlen);
break;
}
Expand Down

0 comments on commit 9c1be17

Please sign in to comment.