Skip to content

Commit 7fccb0d

Browse files
committed
Cosmetic: pleasing cppcheck
1 parent 6fdba42 commit 7fccb0d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/actions/transformations/remove_whitespace.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "modsecurity/transaction.h"
2626
#include "src/actions/transformations/transformation.h"
2727

28-
#define NBSP 160 // non breaking space char
2928

3029
namespace modsecurity {
3130
namespace actions {
@@ -41,12 +40,15 @@ std::string RemoveWhitespace::evaluate(const std::string &val,
4140
std::string value(val);
4241

4342
int64_t i = 0;
44-
char nonBreakingSpaces = 0xa0;
43+
const char nonBreakingSpaces = 0xa0;
44+
const char nonBreakingSpaces2 = 0xc2;
4545

4646
// loop through all the chars
4747
while (i < value.size()) {
4848
// remove whitespaces and non breaking spaces (NBSP)
49-
if (isspace(value[i]) || (value[i] == nonBreakingSpaces)) {
49+
if (std::isspace(static_cast<unsigned char>(value[i]))
50+
|| (value[i] == nonBreakingSpaces)
51+
|| value[i] == nonBreakingSpaces2) {
5052
value.erase(i, 1);
5153
} else {
5254
/* if the space is not a whitespace char, increment counter

src/audit_log/writer/https.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ bool Https::write(Transaction *transaction, int parts, std::string *error) {
5353

5454
std::string log = transaction->toJSON(parts);
5555
m_http_client.setRequestType("application/json");
56-
m_http_client.setRequestBody(log.c_str());
56+
m_http_client.setRequestBody(log);
5757
m_http_client.download(m_audit->m_path1);
5858
return true;
5959
}

0 commit comments

Comments
 (0)