Removes some warnings by adding missing returns

This commit is contained in:
Felipe Zimmerle 2015-08-11 10:22:46 -03:00
parent c5a4355348
commit fb161a69a9
8 changed files with 20 additions and 19 deletions

View File

@ -104,6 +104,7 @@ class ModSecurityStringVariables :
if (updateFirstVariable(key, value) == false) { if (updateFirstVariable(key, value) == false) {
storeVariable(key, value); storeVariable(key, value);
} }
return true;
} }

View File

@ -28,11 +28,6 @@
#ifndef HEADERS_MODSECURITY_RULES_H_ #ifndef HEADERS_MODSECURITY_RULES_H_
#define HEADERS_MODSECURITY_RULES_H_ #define HEADERS_MODSECURITY_RULES_H_
#ifndef __cplusplus
typedef struct Rules_t Rules;
typedef struct Assay_t Assay;
#endif
#include "modsecurity/modsecurity.h" #include "modsecurity/modsecurity.h"
#include "modsecurity/assay.h" #include "modsecurity/assay.h"
#include "modsecurity/rules_properties.h" #include "modsecurity/rules_properties.h"

View File

@ -93,8 +93,9 @@ bool Pm::init(const char **error) {
acmp_add_pattern(m_p, a.c_str(), NULL, NULL, a.length()); acmp_add_pattern(m_p, a.c_str(), NULL, NULL, a.length());
} }
acmp_prepare(m_p); acmp_prepare(m_p);
return true;
} }

View File

@ -44,12 +44,11 @@ bool Multipart::init() {
} }
std::size_t boundary_pos = m_header.find("boundary"); std::size_t boundary_pos = m_header.find("boundary");
if (boundary_pos < 0) { if (boundary_pos != std::string::npos &&
if (boundary_pos > 0 && m_header.find("boundary", boundary_pos) > 0) { m_header.find("boundary", boundary_pos + 1) != std::string::npos) {
debug(4, "Multipart: Multiple boundary parameters in " \ debug(4, "Multipart: Multiple boundary parameters in " \
"Content-Type."); "Content-Type.");
return false; return false;
}
} }
std::string boundary = m_header.c_str() + boundary_pos; std::string boundary = m_header.c_str() + boundary_pos;

View File

@ -70,6 +70,8 @@ bool MultipartBlob::processContent() {
offset = end + 1; offset = end + 1;
} }
content = std::string(m_blob, offset, m_blob.length() - offset + 1); content = std::string(m_blob, offset, m_blob.length() - offset + 1);
return true;
} }
@ -123,6 +125,8 @@ bool MultipartBlob::processContentDispositionLine(
filename = std::string(dispositionLine, offset, end - offset); filename = std::string(dispositionLine, offset, end - offset);
} }
} }
return true;
} }

View File

@ -52,7 +52,7 @@ char *parse_pm_content(const char *op_parm, unsigned short int op_len, const cha
return NULL; return NULL;
} }
while (offset < op_len && content[offset] == ' ' || content[offset] == '\t') { while (offset < op_len && (content[offset] == ' ' || content[offset] == '\t')) {
offset++; offset++;
}; };
@ -380,7 +380,7 @@ static int acmp_connect_fail_branches(ACMP *parser) {
std::vector<acmp_node_t *> arr2; std::vector<acmp_node_t *> arr2;
std::vector<acmp_node_t *> tmp; std::vector<acmp_node_t *> tmp;
parser->root_node->text = ""; parser->root_node->text = (char *)"";
parser->root_node->fail = parser->root_node; parser->root_node->fail = parser->root_node;
@ -496,7 +496,7 @@ if (parser->is_active != 0) return -1;
if (child == NULL) { if (child == NULL) {
child = (acmp_node_t *) calloc(1, sizeof(acmp_node_t)); child = (acmp_node_t *) calloc(1, sizeof(acmp_node_t));
/* ENH: Check alloc succeded */ /* ENH: Check alloc succeded */
child->pattern = ""; child->pattern = (char *)"";
child->letter = letter; child->letter = letter;
child->depth = i; child->depth = i;
child->text = (char *)calloc(1, strlen(pattern) + 2); child->text = (char *)calloc(1, strlen(pattern) + 2);

View File

@ -59,19 +59,19 @@ documentation and/or software.
// F, G, H and I are basic MD5 functions. // F, G, H and I are basic MD5 functions.
inline MD5::uint4 MD5::F(uint4 x, uint4 y, uint4 z) { inline MD5::uint4 MD5::F(uint4 x, uint4 y, uint4 z) {
return x&y | ~x&z; return (x & y) | (~x & z);
} }
inline MD5::uint4 MD5::G(uint4 x, uint4 y, uint4 z) { inline MD5::uint4 MD5::G(uint4 x, uint4 y, uint4 z) {
return x&z | y&~z; return (x & z) | (y & ~z);
} }
inline MD5::uint4 MD5::H(uint4 x, uint4 y, uint4 z) { inline MD5::uint4 MD5::H(uint4 x, uint4 y, uint4 z) {
return x^y^z; return (x ^ y ^ z);
} }
inline MD5::uint4 MD5::I(uint4 x, uint4 y, uint4 z) { inline MD5::uint4 MD5::I(uint4 x, uint4 y, uint4 z) {
return y ^ (x | ~z); return (y ^ (x | ~z));
} }
// rotate_left rotates x left n bits. // rotate_left rotates x left n bits.

View File

@ -30,6 +30,7 @@ CustomDebugLog *CustomDebugLog::new_instance() {
bool CustomDebugLog::write_log(int level, const std::string& message) { bool CustomDebugLog::write_log(int level, const std::string& message) {
m_log << "[" << level << "] " << message << std::endl; m_log << "[" << level << "] " << message << std::endl;
return true;
} }