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