0.00% Lines (0/36) 0.00% Functions (0/2)
TLA Baseline Branch
Line Hits Code Line Hits Code
1   // 1   //
2   // Copyright (c) 2024 Mohammad Nejati 2   // Copyright (c) 2024 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/brotli/error.hpp> 10   #include <boost/http/brotli/error.hpp>
11   11  
12   namespace boost { 12   namespace boost {
13   namespace http { 13   namespace http {
14   namespace brotli { 14   namespace brotli {
15   namespace detail { 15   namespace detail {
16   16  
17   const char* 17   const char*
MISUBC 18   error_cat_type:: 18   error_cat_type::
19   name() const noexcept 19   name() const noexcept
20   { 20   {
MISUBC 21   return "boost.http.brotli"; 21   return "boost.http.brotli";
22   } 22   }
23 - bool  
24 - error_cat_type::  
DCB 25 - 1 failed(int ev) const noexcept  
26 - {  
27 - return ev < 0;  
DCB 28 - 1 }  
29 -  
30   23  
31   std::string 24   std::string
MISUBC 32   error_cat_type:: 25   error_cat_type::
33 - {  
34 - return message(ev, nullptr, 0);  
DUB 35 - }  
36 -  
37 - char const*  
38 - error_cat_type::  
DUB 39 - message(  
40 - int ev,  
41 - char*,  
42 - std::size_t) const noexcept  
43   message(int ev) const 26   message(int ev) const
44   { 27   {
MISUBC 45   switch(static_cast<error>(ev)) 28   switch(static_cast<error>(ev))
46   { 29   {
47   30  
MISUBC 48   case error::no_error: return "no_error"; 31   case error::no_error: return "no_error";
MISUBC 49   case error::success: return "success"; 32   case error::success: return "success";
MISUBC 50   case error::needs_more_input: return "needs_more_input"; 33   case error::needs_more_input: return "needs_more_input";
MISUBC 51   case error::needs_more_output: return "needs_more_output"; 34   case error::needs_more_output: return "needs_more_output";
MISUBC 52   case error::format_exuberant_nibble: return "format_exuberant_nibble"; 35   case error::format_exuberant_nibble: return "format_exuberant_nibble";
MISUBC 53   case error::format_reserved: return "format_reserved"; 36   case error::format_reserved: return "format_reserved";
MISUBC 54   case error::format_exuberant_meta_nibbl: return "format_exuberant_meta_nibbl"; 37   case error::format_exuberant_meta_nibbl: return "format_exuberant_meta_nibbl";
MISUBC 55   case error::format_simple_huffman_alphabet: return "format_simple_huffman_alphabet"; 38   case error::format_simple_huffman_alphabet: return "format_simple_huffman_alphabet";
MISUBC 56   case error::format_simple_huffman_same: return "format_simple_huffman_same"; 39   case error::format_simple_huffman_same: return "format_simple_huffman_same";
MISUBC 57   case error::format_cl_space: return "format_cl_space"; 40   case error::format_cl_space: return "format_cl_space";
MISUBC 58   case error::format_huffman_space: return "format_huffman_space"; 41   case error::format_huffman_space: return "format_huffman_space";
MISUBC 59   case error::format_context_map_repea: return "format_context_map_repea"; 42   case error::format_context_map_repea: return "format_context_map_repea";
MISUBC 60   case error::format_block_length_1: return "format_block_length_1"; 43   case error::format_block_length_1: return "format_block_length_1";
MISUBC 61   case error::format_block_length_2: return "format_block_length_2"; 44   case error::format_block_length_2: return "format_block_length_2";
MISUBC 62   case error::format_transform: return "format_transform"; 45   case error::format_transform: return "format_transform";
MISUBC 63   case error::format_dictionary: return "format_dictionary"; 46   case error::format_dictionary: return "format_dictionary";
MISUBC 64   case error::format_window_bits: return "format_window_bits"; 47   case error::format_window_bits: return "format_window_bits";
MISUBC 65   case error::format_padding_1: return "format_padding_1"; 48   case error::format_padding_1: return "format_padding_1";
MISUBC 66   case error::format_padding_2: return "format_padding_2"; 49   case error::format_padding_2: return "format_padding_2";
MISUBC 67   case error::format_distance: return "format_distance"; 50   case error::format_distance: return "format_distance";
MISUBC 68   case error::compound_dictionary: return "compound_dictionary"; 51   case error::compound_dictionary: return "compound_dictionary";
MISUBC 69   case error::dictionary_not_set: return "dictionary_not_set"; 52   case error::dictionary_not_set: return "dictionary_not_set";
MISUBC 70   case error::invalid_arguments: return "invalid_arguments"; 53   case error::invalid_arguments: return "invalid_arguments";
MISUBC 71   case error::alloc_context_modes: return "alloc_context_modes"; 54   case error::alloc_context_modes: return "alloc_context_modes";
MISUBC 72   case error::alloc_tree_groups: return "alloc_tree_groups"; 55   case error::alloc_tree_groups: return "alloc_tree_groups";
MISUBC 73   case error::alloc_context_map: return "alloc_context_map"; 56   case error::alloc_context_map: return "alloc_context_map";
MISUBC 74   case error::alloc_ring_buffer_1: return "alloc_ring_buffer_1"; 57   case error::alloc_ring_buffer_1: return "alloc_ring_buffer_1";
MISUBC 75   case error::alloc_ring_buffer_2: return "alloc_ring_buffer_2"; 58   case error::alloc_ring_buffer_2: return "alloc_ring_buffer_2";
MISUBC 76   case error::alloc_block_type_trees: return "alloc_block_type_trees"; 59   case error::alloc_block_type_trees: return "alloc_block_type_trees";
MISUBC 77   case error::unreachable: return "unreachable"; 60   case error::unreachable: return "unreachable";
MISUBC 78   default: 61   default:
MISUBC 79   return "unknown"; 62   return "unknown";
80   } 63   }
81   } 64   }
82   65  
83   // msvc 14.0 has a bug that warns about inability 66   // msvc 14.0 has a bug that warns about inability
84   // to use constexpr construction here, even though 67   // to use constexpr construction here, even though
85   // there's no constexpr construction 68   // there's no constexpr construction
86   #if defined(_MSC_VER) && _MSC_VER <= 1900 69   #if defined(_MSC_VER) && _MSC_VER <= 1900
87   # pragma warning( push ) 70   # pragma warning( push )
88   # pragma warning( disable : 4592 ) 71   # pragma warning( disable : 4592 )
89   #endif 72   #endif
90   73  
91   #if defined(__cpp_constinit) && __cpp_constinit >= 201907L 74   #if defined(__cpp_constinit) && __cpp_constinit >= 201907L
92   constinit error_cat_type error_cat; 75   constinit error_cat_type error_cat;
93   #else 76   #else
94   error_cat_type error_cat; 77   error_cat_type error_cat;
95   #endif 78   #endif
96   79  
97   #if defined(_MSC_VER) && _MSC_VER <= 1900 80   #if defined(_MSC_VER) && _MSC_VER <= 1900
98   # pragma warning( pop ) 81   # pragma warning( pop )
99   #endif 82   #endif
100   83  
101   } // detail 84   } // detail
102   } // brotli 85   } // brotli
103   } // http 86   } // http
104   } // boost 87   } // boost