Coding style fixes

This commit is contained in:
Felipe Zimmerle
2017-11-13 14:22:17 -03:00
parent 023e7acbad
commit 3fb71f32d8
40 changed files with 591 additions and 662 deletions

View File

@@ -56,7 +56,8 @@ bool FuzzyHash::init(const std::string &param2, std::string *error) {
}
for (std::string line; std::getline(*iss, line); ) {
chunk = (struct fuzzy_hash_chunk *)calloc(1, sizeof(struct fuzzy_hash_chunk));
chunk = (struct fuzzy_hash_chunk *)calloc(1,
sizeof(struct fuzzy_hash_chunk));
chunk->data = strdup(line.c_str());
chunk->next = NULL;
@@ -77,7 +78,8 @@ bool FuzzyHash::init(const std::string &param2, std::string *error) {
delete iss;
return true;
#else
error->assign("@fuzzyHash: SSDEEP support was not enabled during the compilation.");
error->assign("@fuzzyHash: SSDEEP support was not enabled " \
"during the compilation.");
return false;
#endif
}
@@ -89,17 +91,15 @@ bool FuzzyHash::evaluate(Transaction *t, const std::string &str) {
char result[FUZZY_MAX_RESULT];
struct fuzzy_hash_chunk *chunk = m_head;
if (fuzzy_hash_buf((const unsigned char*)str.c_str(), str.size(), result))
{
if (fuzzy_hash_buf((const unsigned char*)str.c_str(),
str.size(), result)) {
t->debug(4, "Problems generating fuzzy hash");
return false;
}
while (chunk != NULL)
{
while (chunk != NULL) {
int i = fuzzy_compare(chunk->data, result);
if (i >= m_threshold)
{
if (i >= m_threshold) {
t->debug(4, "Fuzzy hash: matched " \
"with score: " + std::to_string(i) + ".");
return true;