From: Francesco Chemolli Date: Mon, 2 Jul 2012 15:31:03 +0000 (+0200) Subject: Prefix-to-postfix increment operator change in some helpers. X-Git-Tag: sourceformat-review-1~164^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb62585f9d0b0e74752bae8b0923a43044b3f8fd;p=thirdparty%2Fsquid.git Prefix-to-postfix increment operator change in some helpers. --- diff --git a/helpers/basic_auth/RADIUS/basic_radius_auth.cc b/helpers/basic_auth/RADIUS/basic_radius_auth.cc index 0cf9b78876..fe7432b29f 100644 --- a/helpers/basic_auth/RADIUS/basic_radius_auth.cc +++ b/helpers/basic_auth/RADIUS/basic_radius_auth.cc @@ -264,16 +264,16 @@ urldecode(char *dst, const char *src, int size) tmp[2] = '\0'; while (*src && size > 1) { if (*src == '%' && src[1] != '\0' && src[2] != '\0') { - src++; + ++src; tmp[0] = *src++; tmp[1] = *src++; *dst++ = strtol(tmp, NULL, 16); } else { *dst++ = *src++; } - size--; + --size; } - *dst++ = '\0'; + *dst = '\0'; } static int @@ -348,7 +348,7 @@ authenticate(int socket_fd, const char *username, const char *passwd) md5_calc(cbc, md5buf, secretlen + AUTH_VECTOR_LEN); /* Xor the password into the MD5 digest */ - for (i = 0; i < AUTH_VECTOR_LEN; i++) { + for (i = 0; i < AUTH_VECTOR_LEN; ++i) { *ptr++ = (cbc[i] ^= passbuf[j + i]); } } @@ -397,7 +397,8 @@ authenticate(int socket_fd, const char *username, const char *passwd) */ auth->length = htons(total_length); - while (retry--) { + while (retry) { + --retry; int time_spent; struct timeval sent; /* @@ -566,7 +567,7 @@ main(int argc, char **argv) /* Parse out the username and password */ ptr = buf; while (isspace(*ptr)) - ptr++; + ++ptr; if ((end = strchr(ptr, ' ')) == NULL) { SEND_ERR("No password"); continue; @@ -575,7 +576,7 @@ main(int argc, char **argv) urldecode(username, ptr, MAXPWNAM); ptr = end + 1; while (isspace(*ptr)) - ptr++; + ++ptr; urldecode(passwd, ptr, MAXPASS); if (authenticate(sockfd, username, passwd)) diff --git a/helpers/basic_auth/RADIUS/radius-util.cc b/helpers/basic_auth/RADIUS/radius-util.cc index 96692e525a..dd0ae70f44 100644 --- a/helpers/basic_auth/RADIUS/radius-util.cc +++ b/helpers/basic_auth/RADIUS/radius-util.cc @@ -79,17 +79,17 @@ static int good_ipaddr(char *addr) digit_count = 0; while (*addr != '\0' && *addr != ' ') { if (*addr == '.') { - dot_count++; + ++dot_count; digit_count = 0; } else if (!isdigit(*addr)) { dot_count = 5; } else { - digit_count++; + ++digit_count; if (digit_count > 3) { dot_count = 5; } } - addr++; + ++addr; } if (dot_count != 3) { return(-1); @@ -112,7 +112,7 @@ static uint32_t ipstr2long(char *ip_str) int cur_byte; ipaddr = (uint32_t)0; - for (i = 0; i < 4; i++) { + for (i = 0; i < 4; ++i) { ptr = buf; count = 0; *ptr = '\0'; @@ -121,7 +121,7 @@ static uint32_t ipstr2long(char *ip_str) return((uint32_t)0); } *ptr++ = *ip_str++; - count++; + ++count; } if (count >= 4 || count == 0) { return((uint32_t)0); @@ -131,7 +131,7 @@ static uint32_t ipstr2long(char *ip_str) if (cur_byte < 0 || cur_byte > 255) { return((uint32_t)0); } - ip_str++; + ++ip_str; ipaddr = ipaddr << 8 | (uint32_t)cur_byte; } return(ipaddr); diff --git a/helpers/external_acl/AD_group/ext_ad_group_acl.cc b/helpers/external_acl/AD_group/ext_ad_group_acl.cc index 2c84bd771e..32d580a609 100644 --- a/helpers/external_acl/AD_group/ext_ad_group_acl.cc +++ b/helpers/external_acl/AD_group/ext_ad_group_acl.cc @@ -583,7 +583,7 @@ Valid_Local_Groups(char *UserName, const char **Groups) */ if (nStatus == NERR_Success) { if ((pTmpBuf = pBuf) != NULL) { - for (i = 0; i < dwEntriesRead; i++) { + for (i = 0; i < dwEntriesRead; ++i) { assert(pTmpBuf != NULL); if (pTmpBuf == NULL) { result = 0; @@ -629,7 +629,7 @@ Valid_Global_Groups(char *UserName, const char **Groups) strncpy(NTDomain, UserName, sizeof(NTDomain)); - for (j = 0; j < strlen(NTV_VALID_DOMAIN_SEPARATOR); j++) { + for (j = 0; j < strlen(NTV_VALID_DOMAIN_SEPARATOR); ++j) { if ((domain_qualify = strchr(NTDomain, NTV_VALID_DOMAIN_SEPARATOR[j])) != NULL) break; } @@ -850,7 +850,7 @@ main(int argc, char *argv[]) continue; } username = strtok(buf, " "); - for (n = 0; (group = strtok(NULL, " ")) != NULL; n++) { + for (n = 0; (group = strtok(NULL, " ")) != NULL; ++n) { rfc1738_unescape(group); groups[n] = group; } diff --git a/helpers/external_acl/eDirectory_userip/ext_edirectory_userip_acl.cc b/helpers/external_acl/eDirectory_userip/ext_edirectory_userip_acl.cc index 7a6781c589..db774ef9e9 100644 --- a/helpers/external_acl/eDirectory_userip/ext_edirectory_userip_acl.cc +++ b/helpers/external_acl/eDirectory_userip/ext_edirectory_userip_acl.cc @@ -1092,7 +1092,7 @@ SearchFilterLDAP(edui_ldap_t *l, char *group) bufc[0] = '\134'; swi = 0; j = 1; - for (i = 0; i < s; i++) { + for (i = 0; i < s; ++i) { if (swi == 2) { bufc[j] = '\134'; ++j; @@ -1256,20 +1256,20 @@ SearchIPLDAP(edui_ldap_t *l) l->num_val = x; if (x > 0) { /* Display all values */ - for (i = 0; i < x; i++) { + for (i = 0; i < x; ++i) { j = l->val[i]->bv_len; memcpy(bufa, l->val[i]->bv_val, j); z = BinarySplit(bufa, j, '#', bufb, sizeof(bufb)); /* BINARY DEBUGGING * local_printfx("value[%" PRIuSIZE "]: BinarySplit(", (size_t) i); - for (k = 0; k < z; k++) { + for (k = 0; k < z; ++k) { c = (int) bufb[k]; if (c < 0) c = c + 256; local_printfx("%02X", c); } local_printfx(", "); - for (k = 0; k < (j - z - 1); k++) { + for (k = 0; k < (j - z - 1); ++k) { c = (int) bufa[k]; if (c < 0) c = c + 256; @@ -1284,7 +1284,7 @@ SearchIPLDAP(edui_ldap_t *l) /* bufa is the address, just compare it */ if (!(l->status & LDAP_IPV4_S) || (l->status & LDAP_IPV6_S)) break; /* Not looking for IPv4 */ - for (k = 0; k < z; k++) { + for (k = 0; k < z; ++k) { c = (int) bufa[k]; if (c < 0) c = c + 256; @@ -1299,7 +1299,7 @@ SearchIPLDAP(edui_ldap_t *l) if (memcmp(l->search_ip, bufb, y) == 0) { /* We got a match! - Scan 'ber' for 'cn' values */ z = ldap_count_values_len(ber); - for (j = 0; j < z; j++) { + for (j = 0; j < z; ++j) { // broken? xstrncpy(l->userid, ber[j]->bv_val, min(sizeof(l->userid),static_cast(ber[j]->bv_len))); xstrncpy(l->userid, ber[j]->bv_val, sizeof(l->userid)); /* Using bv_len of min() breaks the result by 2 chars */ @@ -1319,7 +1319,7 @@ SearchIPLDAP(edui_ldap_t *l) /* bufa + 2 is the address (skip 2 digit port) */ if (!(l->status & LDAP_IPV4_S) || (l->status & LDAP_IPV6_S)) break; /* Not looking for IPv4 */ - for (k = 2; k < z; k++) { + for (k = 2; k < z; ++k) { c = (int) bufa[k]; if (c < 0) c = c + 256; @@ -1334,7 +1334,7 @@ SearchIPLDAP(edui_ldap_t *l) if (memcmp(l->search_ip, bufb, y) == 0) { /* We got a match! - Scan 'ber' for 'cn' values */ z = ldap_count_values_len(ber); - for (j = 0; j < z; j++) { + for (j = 0; j < z; ++j) { // broken? xstrncpy(l->userid, ber[j]->bv_val, min(sizeof(l->userid),static_cast(ber[j]->bv_len))); xstrncpy(l->userid, ber[j]->bv_val, sizeof(l->userid)); /* Using bv_len of min() breaks the result by 2 chars */ @@ -1354,7 +1354,7 @@ SearchIPLDAP(edui_ldap_t *l) /* bufa + 2 is the address (skip 2 digit port) */ if (!(l->status & LDAP_IPV6_S)) break; /* Not looking for IPv6 */ - for (k = 2; k < z; k++) { + for (k = 2; k < z; ++k) { c = (int) bufa[k]; if (c < 0) c = c + 256; @@ -1369,7 +1369,7 @@ SearchIPLDAP(edui_ldap_t *l) if (memcmp(l->search_ip, bufb, y) == 0) { /* We got a match! - Scan 'ber' for 'cn' values */ z = ldap_count_values_len(ber); - for (j = 0; j < z; j++) { + for (j = 0; j < z; ++j) { // broken? xstrncpy(l->userid, ber[j]->bv_val, min(sizeof(l->userid),static_cast(ber[j]->bv_len))); xstrncpy(l->userid, ber[j]->bv_val, sizeof(l->userid)); /* Using bv_len of min() breaks the result by 2 chars */ @@ -1527,7 +1527,7 @@ MainSafe(int argc, char **argv) /* Scan args */ if (k > 1) { - for (i = 1; i < k; i++) { + for (i = 1; i < k; ++i) { /* Classic / novelty usage schemes */ if (!strcmp(argv[i], "--help")) { DisplayUsage(); @@ -1540,7 +1540,7 @@ MainSafe(int argc, char **argv) return 1; } else if (argv[i][0] == '-') { s = strlen(argv[i]); - for (j = 1; j < s; j++) { + for (j = 1; j < s; ++j) { switch (argv[i][j]) { case 'h': DisplayUsage(); @@ -1760,7 +1760,7 @@ MainSafe(int argc, char **argv) k = strlen(bufa); /* BINARY DEBUGGING * local_printfx("while() -> bufa[%" PRIuSIZE "]: %s", k, bufa); - for (i = 0; i < k; i++) + for (i = 0; i < k; ++i) local_printfx("%02X", bufa[i]); local_printfx("\n"); * BINARY DEBUGGING */