src/actions/transformations/hex_decode.cc: reduce the scope of variable in a for () loop

In general, it is always preferable to reduce
the scope of a variable in a for loop
This commit is contained in:
Elia Pinto 2024-02-21 13:50:51 +01:00
parent 734646dbf1
commit 9842b92bd1

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++;
} }