diff options
author | Ed Tanous <edtanous@google.com> | 2023-02-10 22:04:36 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2023-02-10 22:36:42 +0300 |
commit | 7e0572f4c1bc5f13ee1a3bd40bb80bf6b9fbd751 (patch) | |
tree | 3670aa06382a7d401436c6bbda1c90663f0965fa /include | |
parent | d91415c4aad92f4ebda2ec0af4fd70af18d09234 (diff) | |
download | bmcweb-7e0572f4c1bc5f13ee1a3bd40bb80bf6b9fbd751.tar.xz |
Remove unused gzip helper
This was used way back in the day when bmcweb static files were
ungzipping their contents. Today we push that to the client.
Remove.
Tested: Code compiles. Unused file.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ie798b5eeb8854a677725d90adead8c1bf00bb5f4
Diffstat (limited to 'include')
-rw-r--r-- | include/gzip_helper.hpp | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/include/gzip_helper.hpp b/include/gzip_helper.hpp deleted file mode 100644 index be13809236..0000000000 --- a/include/gzip_helper.hpp +++ /dev/null @@ -1,65 +0,0 @@ -#pragma once - -#include <zlib.h> - -#include <cstring> -#include <string> - -inline bool gzipInflate(const std::string& compressedBytes, - std::string& uncompressedBytes) -{ - if (compressedBytes.empty()) - { - uncompressedBytes = compressedBytes; - return true; - } - - uncompressedBytes.clear(); - - unsigned half_length = compressedBytes.size() / 2; - - z_stream strm{}; - - // The following line is nolint because we're declaring away constness. - // It's not clear why the input buffers on zlib aren't const, so this is a - // bit of a cheat for the moment - strm.next_in = (Bytef*)compressedBytes.data(); // NOLINT - strm.avail_in = compressedBytes.size(); - strm.total_out = 0; - strm.zalloc = Z_NULL; - strm.zfree = Z_NULL; - - bool done = false; - - if (inflateInit2(&strm, (16 + MAX_WBITS)) != Z_OK) - { - return false; - } - - while (!done) - { - // If our output buffer is too small - if (strm.total_out >= uncompressedBytes.size()) - { - uncompressedBytes.resize(uncompressedBytes.size() + half_length); - } - - strm.next_out = - (Bytef*)(uncompressedBytes.data() + strm.total_out); // NOLINT - strm.avail_out = - ((uLong)uncompressedBytes.size() - strm.total_out); // NOLINT - - // Inflate another chunk. - int err = inflate(&strm, Z_SYNC_FLUSH); - if (err == Z_STREAM_END) - { - done = true; - } - else if (err != Z_OK) - { - break; - } - } - - return inflateEnd(&strm) == Z_OK; -}
\ No newline at end of file |