From 1fb297775c0987f2ed32bb062c56d42d95158e2a Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Thu, 7 Aug 2014 14:21:46 -0600 Subject: [PATCH] fix clang "always true" warning in lzma/main.cpp --- src/lzma/main.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/lzma/main.cpp b/src/lzma/main.cpp index 91d828df01..5820e235cf 100644 --- a/src/lzma/main.cpp +++ b/src/lzma/main.cpp @@ -90,20 +90,21 @@ int main(int argc, const char** argv) const unsigned HeaderSize = 13; SizeT outSize; + bool outSizeIsValid; if (encode) { outSize = size * 2; + outSizeIsValid = true; } else { int32_t outSize32 = read4(data + PropHeaderSize); - if (outSize32 >= 0) { - outSize = outSize32; - } else if (argc == 5) { - outSize = atoi(argv[4]); - } else { - outSize = -1; + if (outSize32 < 0 and argc == 5) { + outSize32 = atoi(argv[4]); } + + outSize = outSize32; + outSizeIsValid = outSize32 >= 0; } - if (outSize >= 0) { + if (outSizeIsValid) { uint8_t* out = static_cast(malloc(outSize)); if (out) { SizeT inSize = size;