From 6efa8e270c59e044194c9772a6cac2d5483b66b8 Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Wed, 31 Jan 2018 12:04:52 -0800 Subject: [PATCH] Update endif/else behavior for unreachable code error on Windows. Summary: Per #3367 Closes https://github.com/facebook/rocksdb/pull/3389 Differential Revision: D6766126 Pulled By: gfosco fbshipit-source-id: e441a15e8aec6747c613d68f4f0621b605eb48a0 --- util/compression.h | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/util/compression.h b/util/compression.h index 6dd942435..f12036d21 100644 --- a/util/compression.h +++ b/util/compression.h @@ -57,8 +57,9 @@ inline bool Snappy_Supported() { inline bool Zlib_Supported() { #ifdef ZLIB return true; -#endif +#else return false; +#endif } inline bool BZip2_Supported() { @@ -283,8 +284,9 @@ inline bool Zlib_Compress(const CompressionOptions& opts, deflateEnd(&_stream); return compressed; -#endif +#else return false; +#endif } // compress_format_version == 1 -- decompressed size is not included in the @@ -382,9 +384,9 @@ inline char* Zlib_Uncompress(const char* input_data, size_t input_length, *decompress_size = static_cast(output_len - _stream.avail_out); inflateEnd(&_stream); return output; -#endif - +#else return nullptr; +#endif } // compress_format_version == 1 -- decompressed size is not included in the @@ -441,8 +443,9 @@ inline bool BZip2_Compress(const CompressionOptions& opts, BZ2_bzCompressEnd(&_stream); return compressed; -#endif +#else return false; +#endif } // compress_format_version == 1 -- decompressed size is not included in the @@ -520,8 +523,9 @@ inline char* BZip2_Uncompress(const char* input_data, size_t input_length, *decompress_size = static_cast(output_len - _stream.avail_out); BZ2_bzDecompressEnd(&_stream); return output; -#endif +#else return nullptr; +#endif } // compress_format_version == 1 -- decompressed size is included in the @@ -583,8 +587,9 @@ inline bool LZ4_Compress(const CompressionOptions& opts, } output->resize(static_cast(output_header_len + outlen)); return true; -#endif // LZ4 +#else // LZ4 return false; +#endif } // compress_format_version == 1 -- decompressed size is included in the @@ -639,8 +644,9 @@ inline char* LZ4_Uncompress(const char* input_data, size_t input_length, } assert(*decompress_size == static_cast(output_len)); return output; -#endif // LZ4 +#else // LZ4 return nullptr; +#endif } // compress_format_version == 1 -- decompressed size is included in the @@ -711,8 +717,9 @@ inline bool LZ4HC_Compress(const CompressionOptions& opts, } output->resize(static_cast(output_header_len + outlen)); return true; -#endif // LZ4 +#else // LZ4 return false; +#endif } inline bool XPRESS_Compress(const char* input, size_t length, std::string* output) { @@ -765,8 +772,9 @@ inline bool ZSTD_Compress(const CompressionOptions& opts, const char* input, } output->resize(output_header_len + outlen); return true; -#endif +#else // ZSTD return false; +#endif } // @param compression_dict Data for presetting the compression library's @@ -796,8 +804,9 @@ inline char* ZSTD_Uncompress(const char* input_data, size_t input_length, assert(actual_output_length == output_len); *decompress_size = static_cast(actual_output_length); return output; -#endif +#else // ZSTD return nullptr; +#endif } inline std::string ZSTD_TrainDictionary(const std::string& samples,