Merge pull request #3098 from devzero2000/ep/scoped-for

Ep/scoped for: second pr
This commit is contained in:
Ervin Hegedus 2024-03-01 21:43:00 +01:00 committed by GitHub
commit 97687496e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 8 deletions

View File

@ -58,13 +58,13 @@ std::string HexDecode::evaluate(const std::string &value,
int HexDecode::inplace(unsigned char *data, int len) { int HexDecode::inplace(unsigned char *data, int len) {
unsigned char *d = data; unsigned char *d = data;
int i, count = 0; int count = 0;
if ((data == NULL) || (len == 0)) { if ((data == NULL) || (len == 0)) {
return 0; return 0;
} }
for (i = 0; i <= len - 2; i += 2) { for (int i = 0;i <= len - 2;i += 2) {
*d++ = utils::string::x2c(&data[i]); *d++ = utils::string::x2c(&data[i]);
count++; count++;
} }

View File

@ -59,7 +59,6 @@ int VerifyCC::luhnVerify(const char *ccnumber, int len) {
int sum[2] = { 0, 0 }; int sum[2] = { 0, 0 };
int odd = 0; int odd = 0;
int digits = 0; int digits = 0;
int i;
/* Weighted lookup table which is just a precalculated (i = index): /* Weighted lookup table which is just a precalculated (i = index):
* i*2 + (( (i*2) > 9 ) ? -9 : 0) * i*2 + (( (i*2) > 9 ) ? -9 : 0)
@ -71,7 +70,7 @@ int VerifyCC::luhnVerify(const char *ccnumber, int len) {
/* Add up only digits (weighted digits via lookup table) /* Add up only digits (weighted digits via lookup table)
* for both odd and even CC numbers to avoid 2 passes. * for both odd and even CC numbers to avoid 2 passes.
*/ */
for (i = 0; i < len; i++) { for (int i = 0;i < len;i++) {
if (ccnumber[i] >= (0 + 48) && ccnumber[i] <= (9 + 48)) { if (ccnumber[i] >= (0 + 48) && ccnumber[i] <= (9 + 48)) {
sum[0] += (!odd ? wtable[ccnumber[i] - '0'] : (ccnumber[i] - '0')); sum[0] += (!odd ? wtable[ccnumber[i] - '0'] : (ccnumber[i] - '0'));
sum[1] += (odd ? wtable[ccnumber[i] - '0'] : (ccnumber[i] - '0')); sum[1] += (odd ? wtable[ccnumber[i] - '0'] : (ccnumber[i] - '0'));

View File

@ -231,7 +231,7 @@ int Multipart::boundary_characters_valid(const char *boundary) {
void Multipart::validate_quotes(const char *data, char quote) { void Multipart::validate_quotes(const char *data, char quote) {
int i, len; int len;
if (data == NULL) if (data == NULL)
return; return;
@ -244,7 +244,7 @@ void Multipart::validate_quotes(const char *data, char quote) {
len = strlen(data); len = strlen(data);
for (i = 0; i < len; i++) { for (int i = 0;i < len;i++) {
if (data[i] == '\'') { if (data[i] == '\'') {
ms_dbg_a(m_transaction, 9, ms_dbg_a(m_transaction, 9,
"Multipart: Invalid quoting detected: " \ "Multipart: Invalid quoting detected: " \

View File

@ -190,10 +190,9 @@ static size_t acmp_strlen(ACMP *parser, const char *str) {
* len - length of input string * len - length of input string
*/ */
static void acmp_strtoucs(ACMP *parser, const char *str, long *ucs_chars, int len) { static void acmp_strtoucs(ACMP *parser, const char *str, long *ucs_chars, int len) {
int i;
const char *c = str; const char *c = str;
for (i = 0; i < len; i++) { for (int i = 0;i < len;i++) {
*(ucs_chars++) = *(c++); *(ucs_chars++) = *(c++);
} }
} }