mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-13 21:36:00 +03:00
Replaced VALID_HEX, ISODIGIT & NBSP macros in string.h
- Moved them into modsecurity::utils::string to avoid polluting the global namespace.
This commit is contained in:
parent
2f5dac5c4c
commit
a6d64bf615
@ -17,6 +17,7 @@
|
||||
|
||||
#include "src/utils/string.h"
|
||||
|
||||
using namespace modsecurity::utils::string;
|
||||
|
||||
namespace modsecurity::actions::transformations {
|
||||
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include "src/utils/string.h"
|
||||
|
||||
using namespace modsecurity::utils::string;
|
||||
|
||||
namespace modsecurity::actions::transformations {
|
||||
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "src/compat/msvc.h"
|
||||
#endif
|
||||
|
||||
using namespace modsecurity::utils::string;
|
||||
|
||||
namespace modsecurity::actions::transformations {
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "src/utils/string.h"
|
||||
|
||||
using namespace modsecurity::utils::string;
|
||||
|
||||
namespace modsecurity::actions::transformations {
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "src/utils/string.h"
|
||||
|
||||
using namespace modsecurity::utils::string;
|
||||
|
||||
namespace modsecurity::actions::transformations {
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "modsecurity/rules_set.h"
|
||||
#include "src/utils/string.h"
|
||||
|
||||
using namespace modsecurity::utils::string;
|
||||
|
||||
namespace modsecurity::actions::transformations {
|
||||
|
||||
|
@ -17,9 +17,9 @@
|
||||
#include "modsecurity/modsecurity.h"
|
||||
#include "src/utils/string.h"
|
||||
|
||||
using namespace modsecurity::utils::string;
|
||||
|
||||
namespace modsecurity {
|
||||
namespace utils {
|
||||
namespace modsecurity::utils {
|
||||
|
||||
|
||||
bool urldecode_nonstrict_inplace(std::string &val,
|
||||
@ -112,5 +112,4 @@ std::string uri_decode(const std::string & sSrc) {
|
||||
}
|
||||
|
||||
|
||||
} // namespace utils
|
||||
} // namespace modsecurity
|
||||
} // namespace modsecurity::utils
|
||||
|
@ -13,6 +13,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SRC_UTILS_STRING_H_
|
||||
#define SRC_UTILS_STRING_H_
|
||||
|
||||
#include <ctime>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
@ -27,18 +30,21 @@
|
||||
#include "src/compat/msvc.h"
|
||||
#endif
|
||||
|
||||
#ifndef SRC_UTILS_STRING_H_
|
||||
#define SRC_UTILS_STRING_H_
|
||||
namespace modsecurity::utils::string {
|
||||
|
||||
#define VALID_HEX(X) (((X >= '0') && (X <= '9')) || \
|
||||
((X >= 'a') && (X <= 'f')) || ((X >= 'A') && (X <= 'F')))
|
||||
#define ISODIGIT(X) ((X >= '0') && (X <= '7'))
|
||||
#define NBSP 160
|
||||
template<typename CharT>
|
||||
constexpr bool VALID_HEX(CharT X) {
|
||||
return ((X >= '0') && (X <= '9'))
|
||||
|| ((X >= 'a') && (X <= 'f'))
|
||||
|| ((X >= 'A') && (X <= 'F'));
|
||||
}
|
||||
|
||||
template<typename CharT>
|
||||
constexpr bool ISODIGIT(CharT X) {
|
||||
return (X >= '0') && (X <= '7');
|
||||
}
|
||||
|
||||
namespace modsecurity {
|
||||
namespace utils {
|
||||
namespace string {
|
||||
constexpr unsigned char NBSP = 160;
|
||||
|
||||
const char HEX2DEC[256] = {
|
||||
/* 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
|
||||
}
|
||||
|
||||
|
||||
} // namespace string
|
||||
} // namespace utils
|
||||
} // namespace modsecurity
|
||||
} // namespace modsecurity::utils::string
|
||||
|
||||
#endif // SRC_UTILS_STRING_H_
|
||||
|
Loading…
x
Reference in New Issue
Block a user