Adds checks for the NO_LOGS definition and improved the vars resolution time

This commit is contained in:
Felipe Zimmerle
2015-09-17 17:41:38 -03:00
parent 3e067e7409
commit ed86c24df6
46 changed files with 294 additions and 62 deletions

View File

@@ -125,45 +125,55 @@ bool ValidateUtf8Encoding::evaluate(Assay *assay, const std::string &str) {
switch (rc) {
case UNICODE_ERROR_CHARACTERS_MISSING :
if (assay) {
#ifndef NO_LOGS
assay->debug(8, "Invalid UTF-8 encoding: "
"not enough bytes in character "
"at " + str + ". [offset \"" +
std::to_string(i) + "\"]");
#endif
}
return true;
break;
case UNICODE_ERROR_INVALID_ENCODING :
if (assay) {
#ifndef NO_LOGS
assay->debug(8, "Invalid UTF-8 encoding: "
"invalid byte value in character "
"at " + str + ". [offset \"" +
std::to_string(i) + "\"]");
#endif
}
return true;
break;
case UNICODE_ERROR_OVERLONG_CHARACTER :
if (assay) {
#ifndef NO_LOGS
assay->debug(8, "Invalid UTF-8 encoding: "
"overlong character detected "
"at " + str + ". [offset \"" +
std::to_string(i) + "\"]");
#endif
}
return true;
break;
case UNICODE_ERROR_RESTRICTED_CHARACTER :
if (assay) {
#ifndef NO_LOGS
assay->debug(8, "Invalid UTF-8 encoding: "
"use of restricted character "
"at " + str + ". [offset \"" +
std::to_string(i) + "\"]");
#endif
}
return true;
break;
case UNICODE_ERROR_DECODING_ERROR :
if (assay) {
#ifndef NO_LOGS
assay->debug(8, "Error validating UTF-8 decoding "
"at " + str + ". [offset \"" +
std::to_string(i) + "\"]");
#endif
}
return true;
break;
@@ -171,9 +181,11 @@ bool ValidateUtf8Encoding::evaluate(Assay *assay, const std::string &str) {
if (rc <= 0) {
if (assay) {
#ifndef NO_LOGS
assay->debug(8, "Internal error during UTF-8 validation "
"at " + str + ". [offset \"" +
std::to_string(i) + "\"]");
#endif
}
return true;
}