28.21% Lines (11/39) 100.00% Functions (4/4)
TLA Baseline Branch
Line Hits Code Line Hits Code
  1 + //
  2 + // Copyright (c) 2026 Mohammad Nejati
  3 + //
  4 + // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5 + // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6 + //
  7 + // Official repository: https://github.com/cppalliance/http
  8 + //
  9 +
  10 + #include <boost/http/zstd/error.hpp>
  11 +
  12 + namespace boost {
  13 + namespace http {
  14 + namespace zstd {
  15 + namespace detail {
  16 +
  17 + const char*
HITGNC   18 + 1 error_cat_type::
  19 + name() const noexcept
  20 + {
HITGNC   21 + 1 return "boost.http.zstd";
  22 + }
  23 +
  24 + bool
HITGNC   25 + 5 error_cat_type::
  26 + failed(int ev) const noexcept
  27 + {
HITGNC   28 + 5 return ev != 0;
  29 + }
  30 +
  31 + std::string
HITGNC   32 + 2 error_cat_type::
  33 + message(int ev) const
  34 + {
HITGNC   35 + 4 return message(ev, nullptr, 0);
  36 + }
  37 +
  38 + char const*
HITGNC   39 + 2 error_cat_type::
  40 + message(
  41 + int ev,
  42 + char*,
  43 + std::size_t) const noexcept
  44 + {
HITGNC   45 + 2 switch(static_cast<error>(ev))
  46 + {
MISUNC   47 + case error::no_error: return "no_error";
MISUNC   48 + case error::generic: return "generic";
MISUNC   49 + case error::prefix_unknown: return "prefix_unknown";
MISUNC   50 + case error::version_unsupported: return "version_unsupported";
MISUNC   51 + case error::frame_parameter_unsupported: return "frame_parameter_unsupported";
MISUNC   52 + case error::frame_parameter_window_too_large: return "frame_parameter_window_too_large";
HITGNC   53 + 1 case error::corruption_detected: return "corruption_detected";
MISUNC   54 + case error::checksum_wrong: return "checksum_wrong";
MISUNC   55 + case error::literals_header_wrong: return "literals_header_wrong";
MISUNC   56 + case error::dictionary_corrupted: return "dictionary_corrupted";
MISUNC   57 + case error::dictionary_wrong: return "dictionary_wrong";
MISUNC   58 + case error::dictionary_creation_failed: return "dictionary_creation_failed";
MISUNC   59 + case error::parameter_unsupported: return "parameter_unsupported";
MISUNC   60 + case error::parameter_combination_unsupported: return "parameter_combination_unsupported";
MISUNC   61 + case error::parameter_out_of_bound: return "parameter_out_of_bound";
MISUNC   62 + case error::table_log_too_large: return "table_log_too_large";
MISUNC   63 + case error::max_symbol_value_too_large: return "max_symbol_value_too_large";
MISUNC   64 + case error::max_symbol_value_too_small: return "max_symbol_value_too_small";
MISUNC   65 + case error::cannot_produce_uncompressed_block: return "cannot_produce_uncompressed_block";
MISUNC   66 + case error::stability_condition_not_respected: return "stability_condition_not_respected";
MISUNC   67 + case error::stage_wrong: return "stage_wrong";
MISUNC   68 + case error::init_missing: return "init_missing";
MISUNC   69 + case error::memory_allocation: return "memory_allocation";
MISUNC   70 + case error::work_space_too_small: return "work_space_too_small";
MISUNC   71 + case error::dst_size_too_small: return "dst_size_too_small";
MISUNC   72 + case error::src_size_wrong: return "src_size_wrong";
MISUNC   73 + case error::dst_buffer_null: return "dst_buffer_null";
MISUNC   74 + case error::no_forward_progress_dest_full: return "no_forward_progress_dest_full";
MISUNC   75 + case error::no_forward_progress_input_empty: return "no_forward_progress_input_empty";
HITGNC   76 + 1 default:
HITGNC   77 + 1 return "unknown";
  78 + }
  79 + }
  80 +
  81 + // msvc 14.0 has a bug that warns about inability
  82 + // to use constexpr construction here, even though
  83 + // there's no constexpr construction
  84 + #if defined(_MSC_VER) && _MSC_VER <= 1900
  85 + # pragma warning( push )
  86 + # pragma warning( disable : 4592 )
  87 + #endif
  88 +
  89 + #if defined(__cpp_constinit) && __cpp_constinit >= 201907L
  90 + constinit error_cat_type error_cat;
  91 + #else
  92 + error_cat_type error_cat;
  93 + #endif
  94 +
  95 + #if defined(_MSC_VER) && _MSC_VER <= 1900
  96 + # pragma warning( pop )
  97 + #endif
  98 +
  99 + } // detail
  100 + } // zstd
  101 + } // http
  102 + } // boost