File tree Expand file tree Collapse file tree 8 files changed +26
-16
lines changed Expand file tree Collapse file tree 8 files changed +26
-16
lines changed Original file line number Diff line number Diff line change 1717
1818#include " src/utils/string.h"
1919
20+ using namespace modsecurity ::utils::string;
2021
2122namespace modsecurity ::actions::transformations {
2223
Original file line number Diff line number Diff line change 1717
1818#include " src/utils/string.h"
1919
20+ using namespace modsecurity ::utils::string;
21+
2022namespace modsecurity ::actions::transformations {
2123
2224
Original file line number Diff line number Diff line change 2323#include " src/compat/msvc.h"
2424#endif
2525
26+ using namespace modsecurity ::utils::string;
2627
2728namespace modsecurity ::actions::transformations {
2829
Original file line number Diff line number Diff line change 1717
1818#include " src/utils/string.h"
1919
20+ using namespace modsecurity ::utils::string;
2021
2122namespace modsecurity ::actions::transformations {
2223
Original file line number Diff line number Diff line change 1919
2020#include " src/utils/string.h"
2121
22+ using namespace modsecurity ::utils::string;
2223
2324namespace modsecurity ::actions::transformations {
2425
Original file line number Diff line number Diff line change 1818#include " modsecurity/rules_set.h"
1919#include " src/utils/string.h"
2020
21+ using namespace modsecurity ::utils::string;
2122
2223namespace modsecurity ::actions::transformations {
2324
Original file line number Diff line number Diff line change 1717#include " modsecurity/modsecurity.h"
1818#include " src/utils/string.h"
1919
20+ using namespace modsecurity ::utils::string;
2021
21- namespace modsecurity {
22- namespace utils {
22+ namespace modsecurity ::utils {
2323
2424
2525bool urldecode_nonstrict_inplace (std::string &val,
@@ -112,5 +112,4 @@ std::string uri_decode(const std::string & sSrc) {
112112}
113113
114114
115- } // namespace utils
116- } // namespace modsecurity
115+ } // namespace modsecurity::utils
Original file line number Diff line number Diff line change 1313 *
1414 */
1515
16+ #ifndef SRC_UTILS_STRING_H_
17+ #define SRC_UTILS_STRING_H_
18+
1619#include < ctime>
1720#include < string>
1821#include < cstring>
2730#include " src/compat/msvc.h"
2831#endif
2932
30- #ifndef SRC_UTILS_STRING_H_
31- #define SRC_UTILS_STRING_H_
33+ namespace modsecurity ::utils::string {
3234
33- #define VALID_HEX (X ) (((X >= ' 0' ) && (X <= ' 9' )) || \
34- ((X >= ' a' ) && (X <= ' f' )) || ((X >= ' A' ) && (X <= ' F' )))
35- #define ISODIGIT (X ) ((X >= ' 0' ) && (X <= ' 7' ))
36- #define NBSP 160
35+ template <typename CharT>
36+ constexpr bool VALID_HEX (CharT X) {
37+ return ((X >= ' 0' ) && (X <= ' 9' ))
38+ || ((X >= ' a' ) && (X <= ' f' ))
39+ || ((X >= ' A' ) && (X <= ' F' ));
40+ }
3741
42+ template <typename CharT>
43+ constexpr bool ISODIGIT (CharT X) {
44+ return (X >= ' 0' ) && (X <= ' 7' );
45+ }
3846
39- namespace modsecurity {
40- namespace utils {
41- namespace string {
47+ constexpr char NBSP = 160 ;
4248
4349const char HEX2DEC[256 ] = {
4450 /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
@@ -271,8 +277,6 @@ inline std::string toupper(std::string str) { // cppcheck-suppress passedByValue
271277}
272278
273279
274- } // namespace string
275- } // namespace utils
276- } // namespace modsecurity
280+ } // namespace modsecurity::utils::string
277281
278282#endif // SRC_UTILS_STRING_H_
You can’t perform that action at this time.
0 commit comments