Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9fea1ca

Browse files
committed
Change cast type (fix SonarCloud issues)
1 parent 47bc24a commit 9fea1ca

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

‎src/operators/rbl.cc‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,12 @@ bool Rbl::evaluate(Transaction *t, RuleWithActions *rule,
226226
return false;
227227
}
228228

229+
// NOSONAR
230+
// SonarCloud suggested to use the init-statement to declare "addr" inside the if statement.
231+
// I think that's not good here, because we need that in the else block
229232
struct sockaddr *addr = info->ai_addr;
230233
if (addr->sa_family == AF_INET) { // only IPv4 address is allowed
231-
struct sockaddr_in *sin = reinterpret_cast<struct sockaddr_in *>(addr);
234+
struct sockaddr_in *sin = (struct sockaddr_in *) addr; // cppcheck-suppress[dangerousTypeCast]
232235
furtherInfo(sin, ipStr, t, m_provider);
233236
}
234237
else {

‎src/variables/xml.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void XML::evaluate(Transaction *t,
9191
} else {
9292
std::vector<actions::Action *> acts = rule->getActionsByName("xmlns", t);
9393
for (auto &x : acts) {
94-
actions::XmlNS *z = reinterpret_cast<actions::XmlNS *>(x);
94+
actions::XmlNS *z = static_cast<actions::XmlNS *>(x);
9595
if (xmlXPathRegisterNs(xpathCtx, reinterpret_cast<const xmlChar*>(z->m_scope.c_str()),
9696
reinterpret_cast<const xmlChar*>(z->m_href.c_str())) != 0) {
9797
ms_dbg_a(t, 1, "Failed to register XML namespace href \"" + \

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /