zlib.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2017 The Crashpad Authors. All rights reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef CRASHPAD_UTIL_MISC_ZLIB_H_
  15. #define CRASHPAD_UTIL_MISC_ZLIB_H_
  16. #include <string>
  17. namespace crashpad {
  18. //! \brief Obtain a \a window_bits parameter to pass to `deflateInit2()` or
  19. //! `inflateInit2()` that specifies a `gzip` wrapper instead of the default
  20. //! zlib wrapper.
  21. //!
  22. //! \param[in] window_bits A \a window_bits value that only specifies the base-2
  23. //! logarithm of the deflate sliding window size.
  24. //!
  25. //! \return \a window_bits adjusted to specify a `gzip` wrapper, to be passed to
  26. //! `deflateInit2()` or `inflateInit2()`.
  27. int ZlibWindowBitsWithGzipWrapper(int window_bits);
  28. //! \brief Formats a string for an error received from the zlib library.
  29. //!
  30. //! \param[in] zr A zlib result code, such as `Z_STREAM_ERROR`.
  31. //!
  32. //! \return A formatted string.
  33. std::string ZlibErrorString(int zr);
  34. } // namespace crashpad
  35. #endif // CRASHPAD_UTIL_MISC_ZLIB_H_