From: Francesco Chemolli Date: Mon, 23 Jul 2012 15:15:27 +0000 (+0200) Subject: Changed increment operators from postfix to prefix form. X-Git-Tag: sourceformat-review-1~164^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f207fe6477bb51aaf897e07d6ed0f8ac1c3d5ef6;p=thirdparty%2Fsquid.git Changed increment operators from postfix to prefix form. --- diff --git a/compat/xstring.cc b/compat/xstring.cc index ed31d92e73..3a288780c7 100644 --- a/compat/xstring.cc +++ b/compat/xstring.cc @@ -40,7 +40,8 @@ xstrncpy(char *dst, const char *src, size_t n) if (src) while (--n != 0 && *src != '\0') { - *dst++ = *src; + *dst = *src; + ++dst; ++src; } diff --git a/helpers/basic_auth/NCSA/crypt_md5.cc b/helpers/basic_auth/NCSA/crypt_md5.cc index 6b616d0b1b..1890d4eda5 100644 --- a/helpers/basic_auth/NCSA/crypt_md5.cc +++ b/helpers/basic_auth/NCSA/crypt_md5.cc @@ -32,7 +32,8 @@ static unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */ static void md5to64(char *s, unsigned long v, int n) { while (--n >= 0) { - *s++ = itoa64[v & 0x3f]; + *s = itoa64[v & 0x3f]; + ++s; v >>= 6; } } diff --git a/helpers/basic_auth/PAM/basic_pam_auth.cc b/helpers/basic_auth/PAM/basic_pam_auth.cc index 8be058e817..62d9a160cf 100644 --- a/helpers/basic_auth/PAM/basic_pam_auth.cc +++ b/helpers/basic_auth/PAM/basic_pam_auth.cc @@ -221,7 +221,8 @@ start: debug("ERROR: %s: Unexpected input '%s'\n", argv[0], buf); goto error; } - *password_buf++ = '\0'; + *password_buf = '\0'; + ++password_buf; rfc1738_unescape(user); rfc1738_unescape(password_buf); conv.appdata_ptr = (char *) password_buf; /* from buf above. not allocated */ diff --git a/helpers/basic_auth/RADIUS/basic_radius_auth.cc b/helpers/basic_auth/RADIUS/basic_radius_auth.cc index 21c0fec96e..a7cdde1adc 100644 --- a/helpers/basic_auth/RADIUS/basic_radius_auth.cc +++ b/helpers/basic_auth/RADIUS/basic_radius_auth.cc @@ -269,7 +269,8 @@ urldecode(char *dst, const char *src, int size) ++src; tmp[1] = *src; ++src; - *dst++ = strtol(tmp, NULL, 16); + *dst = strtol(tmp, NULL, 16); + ++dst; } else { *dst = *src; ++dst; @@ -312,12 +313,14 @@ authenticate(int socket_fd, const char *username, const char *passwd) /* * User Name */ - *ptr++ = PW_USER_NAME; + *ptr = PW_USER_NAME; + ++ptr; length = strlen(username); if (length > MAXPWNAM) { length = MAXPWNAM; } - *ptr++ = length + 2; + *ptr = length + 2; + ++ptr; memcpy(ptr, username, length); ptr += length; total_length += length + 2; @@ -339,8 +342,10 @@ authenticate(int socket_fd, const char *username, const char *passwd) */ length = ((length / AUTH_VECTOR_LEN) + 1) * AUTH_VECTOR_LEN; - *ptr++ = PW_PASSWORD; - *ptr++ = length + 2; + *ptr = PW_PASSWORD; + ++ptr; + *ptr = length + 2; + ++ptr; secretlen = strlen(secretkey); /* Set up the Cipher block chain */ @@ -353,21 +358,26 @@ authenticate(int socket_fd, const char *username, const char *passwd) /* Xor the password into the MD5 digest */ for (i = 0; i < AUTH_VECTOR_LEN; ++i) { - *ptr++ = (cbc[i] ^= passbuf[j + i]); + *ptr = (cbc[i] ^= passbuf[j + i]); + ++ptr; } } total_length += length + 2; - *ptr++ = PW_NAS_PORT_ID; - *ptr++ = 6; + *ptr = PW_NAS_PORT_ID; + ++ptr; + *ptr = 6; + ++ptr; ui = htonl(nasport); memcpy(ptr, &ui, 4); ptr += 4; total_length += 6; - *ptr++ = PW_NAS_PORT_TYPE; - *ptr++ = 6; + *ptr = PW_NAS_PORT_TYPE; + ++ptr; + *ptr = 6; + ++ptr; ui = htonl(nasporttype); memcpy(ptr, &ui, 4); @@ -376,14 +386,18 @@ authenticate(int socket_fd, const char *username, const char *passwd) if (*identifier) { int len = strlen(identifier); - *ptr++ = PW_NAS_ID; - *ptr++ = len + 2; + *ptr = PW_NAS_ID; + ++ptr; + *ptr = len + 2; + ++ptr; memcpy(ptr, identifier, len); ptr += len; total_length += len + 2; } else { - *ptr++ = PW_NAS_IP_ADDRESS; - *ptr++ = 6; + *ptr = PW_NAS_IP_ADDRESS; + ++ptr; + *ptr = 6; + ++ptr; ui = htonl(nas_ipaddr); memcpy(ptr, &ui, 4); diff --git a/helpers/basic_auth/SASL/basic_sasl_auth.cc b/helpers/basic_auth/SASL/basic_sasl_auth.cc index bdff532a2f..eb50fadd98 100644 --- a/helpers/basic_auth/SASL/basic_sasl_auth.cc +++ b/helpers/basic_auth/SASL/basic_sasl_auth.cc @@ -99,7 +99,8 @@ main(int argc, char *argv[]) SEND_ERR("No Password"); continue; } - *password++ = '\0'; + *password = '\0'; + ++password; rfc1738_unescape(username); rfc1738_unescape(password); diff --git a/helpers/basic_auth/SMB/basic_smb_auth.cc b/helpers/basic_auth/SMB/basic_smb_auth.cc index f33442b23a..9bea63a988 100644 --- a/helpers/basic_auth/SMB/basic_smb_auth.cc +++ b/helpers/basic_auth/SMB/basic_smb_auth.cc @@ -91,7 +91,8 @@ print_esc(FILE * p, char *s) if (*t == '\\') buf[i++] = '\\'; - buf[i++] = *t; + buf[i] = *t; + ++i; } if (i > 0) { diff --git a/helpers/digest_auth/LDAP/ldap_backend.cc b/helpers/digest_auth/LDAP/ldap_backend.cc index 3b9bf670e2..50e18f2931 100644 --- a/helpers/digest_auth/LDAP/ldap_backend.cc +++ b/helpers/digest_auth/LDAP/ldap_backend.cc @@ -170,7 +170,8 @@ ldap_escape_value(char *escaped, int size, const char *src) n += 3; size -= 3; if (size > 0) { - *escaped++ = '\\'; + *escaped = '\\'; + ++escaped; snprintf(escaped, 3, "%02x", (int) *src); ++src; escaped += 2; diff --git a/helpers/digest_auth/eDirectory/ldap_backend.cc b/helpers/digest_auth/eDirectory/ldap_backend.cc index 39dbe9eefa..8f676e0454 100644 --- a/helpers/digest_auth/eDirectory/ldap_backend.cc +++ b/helpers/digest_auth/eDirectory/ldap_backend.cc @@ -171,7 +171,8 @@ ldap_escape_value(char *escaped, int size, const char *src) n += 3; size -= 3; if (size > 0) { - *escaped++ = '\\'; + *escaped = '\\'; + ++escaped; snprintf(escaped, 3, "%02x", (int) *src); ++src; escaped += 2; diff --git a/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc b/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc index 0a9fd534a3..03a74466e2 100644 --- a/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc +++ b/helpers/external_acl/LDAP_group/ext_ldap_group_acl.cc @@ -631,7 +631,8 @@ ldap_escape_value(char *escaped, int size, const char *src) n += 3; size -= 3; if (size > 0) { - *escaped++ = '\\'; + *escaped = '\\'; + ++escaped; snprintf(escaped, 3, "%02x", (unsigned char) *src); ++src; escaped += 2; diff --git a/helpers/external_acl/kerberos_ldap_group/support_ldap.cc b/helpers/external_acl/kerberos_ldap_group/support_ldap.cc index 9c79276cec..070b0b9022 100644 --- a/helpers/external_acl/kerberos_ldap_group/support_ldap.cc +++ b/helpers/external_acl/kerberos_ldap_group/support_ldap.cc @@ -243,8 +243,10 @@ convert_domain_to_bind_path(char *domain) if (*dp == '.') { strcpy(bp, ",dc="); bp += 4; - } else - *bp++ = *dp; + } else { + *bp = *dp; + ++bp; + } } *bp = '\0'; return bindp; diff --git a/helpers/external_acl/unix_group/check_group.cc b/helpers/external_acl/unix_group/check_group.cc index 9cf0150013..0af0a0113c 100644 --- a/helpers/external_acl/unix_group/check_group.cc +++ b/helpers/external_acl/unix_group/check_group.cc @@ -169,7 +169,8 @@ main(int argc, char *argv[]) break; case 'g': grents = (char**)realloc(grents, sizeof(*grents) * (ngroups+1)); - grents[ngroups++] = optarg; + grents[ngroups] = optarg; + ++ngroups; break; case '?': if (xisprint(optopt)) { diff --git a/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc b/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc index 9e82f47f27..4594557598 100644 --- a/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc +++ b/helpers/ntlm_auth/smb_lm/ntlm_smb_lm_auth.cc @@ -243,7 +243,8 @@ ntlm_check_auth(ntlm_authenticate * auth, int auth_length) } memcpy(domain, tmp.str, tmp.l); user = domain + tmp.l; - *user++ = '\0'; + *user = '\0'; + ++user; /* debug("fetching user name\n"); */ tmp = ntlm_fetch_string(&(auth->hdr), auth_length, &auth->user, auth->flags); @@ -429,7 +430,8 @@ process_options(int argc, char *argv[]) free(d); continue; } - *c++ = '\0'; + *c= '\0'; + ++c; new_dc = (dc *) malloc(sizeof(dc)); if (!new_dc) { fprintf(stderr, "Malloc error while parsing DC options\n"); diff --git a/lib/ntlmauth/ntlmauth.cc b/lib/ntlmauth/ntlmauth.cc index def632c14a..5d991886c5 100644 --- a/lib/ntlmauth/ntlmauth.cc +++ b/lib/ntlmauth/ntlmauth.cc @@ -143,7 +143,8 @@ ntlm_fetch_string(const ntlmhdr *packet, const int32_t packet_size, const strhdr fprintf(stderr, "ntlmssp: bad unicode: %04x\n", c); return rv; } - *d++ = c; + *d = c; + ++d; ++rv.l; } } else { diff --git a/src/DiskIO/DiskDaemon/DiskdFile.cc b/src/DiskIO/DiskDaemon/DiskdFile.cc index 9c56f723ac..5946c8d0ab 100644 --- a/src/DiskIO/DiskDaemon/DiskdFile.cc +++ b/src/DiskIO/DiskDaemon/DiskdFile.cc @@ -75,7 +75,8 @@ DiskdFile::DiskdFile(char const *aPath, DiskdIOStrategy *anIO) : errorOccured (f assert (aPath); debugs(79, 3, "DiskdFile::DiskdFile: " << aPath); path_ = xstrdup (aPath); - id = diskd_stats.sio_id++; + id = diskd_stats.sio_id; + ++diskd_stats.sio_id; } DiskdFile::~DiskdFile() diff --git a/src/acl/IntRange.cc b/src/acl/IntRange.cc index a985fc70f0..186b1ce7a5 100644 --- a/src/acl/IntRange.cc +++ b/src/acl/IntRange.cc @@ -53,8 +53,10 @@ ACLIntRange::parse() char *b = strchr(a, '-'); unsigned short port1, port2; - if (b) - *b++ = '\0'; + if (b) { + *b = '\0'; + ++b; + } port1 = xatos(a); diff --git a/src/acl/RegexData.cc b/src/acl/RegexData.cc index 34b99fb14e..2a4a6d269e 100644 --- a/src/acl/RegexData.cc +++ b/src/acl/RegexData.cc @@ -235,12 +235,18 @@ compileOptimisedREs(relist **curlist, wordlist * wl) } } else if (RElen + largeREindex + 3 < BUFSIZ-1) { debugs(28, 2, "compileOptimisedREs: adding RE '" << wl->key << "'"); - if (largeREindex > 0) - largeRE[largeREindex++] = '|'; - largeRE[largeREindex++] = '('; - for (char * t = wl->key; *t != '\0'; ++t) - largeRE[largeREindex++] = *t; - largeRE[largeREindex++] = ')'; + if (largeREindex > 0) { + largeRE[largeREindex] = '|'; + ++largeREindex; + } + largeRE[largeREindex] = '('; + ++largeREindex; + for (char * t = wl->key; *t != '\0'; ++t) { + largeRE[largeREindex] = *t; + ++largeREindex; + } + largeRE[largeREindex] = ')'; + ++largeREindex; largeRE[largeREindex] = '\0'; ++numREs; } else { diff --git a/src/auth/basic/UserRequest.cc b/src/auth/basic/UserRequest.cc index fc07a5d6ac..490b2626bc 100644 --- a/src/auth/basic/UserRequest.cc +++ b/src/auth/basic/UserRequest.cc @@ -143,8 +143,10 @@ Auth::Basic::UserRequest::HandleReply(void *data, char *reply) debugs(29, 5, HERE << "{" << (reply ? reply : "") << "}"); if (reply) { - if ((t = strchr(reply, ' '))) - *t++ = '\0'; + if ((t = strchr(reply, ' '))) { + *t = '\0'; + ++t; + } if (*reply == '\0') reply = NULL; diff --git a/src/auth/digest/UserRequest.cc b/src/auth/digest/UserRequest.cc index 92972fdf0c..3305db575f 100644 --- a/src/auth/digest/UserRequest.cc +++ b/src/auth/digest/UserRequest.cc @@ -279,8 +279,10 @@ Auth::Digest::UserRequest::HandleReply(void *data, char *reply) debugs(29, 9, HERE << "{" << (reply ? reply : "") << "}"); if (reply) { - if ((t = strchr(reply, ' '))) - *t++ = '\0'; + if ((t = strchr(reply, ' '))) { + *t = '\0'; + ++t; + } if (*reply == '\0' || *reply == '\n') reply = NULL; diff --git a/src/auth/digest/auth_digest.cc b/src/auth/digest/auth_digest.cc index 58ad620ae0..4321778b64 100644 --- a/src/auth/digest/auth_digest.cc +++ b/src/auth/digest/auth_digest.cc @@ -809,7 +809,8 @@ Auth::Digest::Config::decode(char const *proxy_auth) size_t nlen; size_t vlen; if ((p = (const char *)memchr(item, '=', ilen)) && (p - item < ilen)) { - nlen = p++ - item; + nlen = p - item; + ++p; vlen = ilen - (p - item); } else { nlen = ilen; diff --git a/src/auth/negotiate/UserRequest.cc b/src/auth/negotiate/UserRequest.cc index 05489ba540..0722c705da 100644 --- a/src/auth/negotiate/UserRequest.cc +++ b/src/auth/negotiate/UserRequest.cc @@ -278,8 +278,10 @@ Auth::Negotiate::UserRequest::HandleReply(void *data, void *lastserver, char *re if (strncasecmp(reply, "TT ", 3) == 0) { /* we have been given a blob to send to the client */ - if (arg) - *arg++ = '\0'; + if (arg) { + *arg = '\0'; + ++arg; + } safe_free(lm_request->server_blob); lm_request->request->flags.must_keepalive = 1; if (lm_request->request->flags.proxy_keepalive) { @@ -294,8 +296,10 @@ Auth::Negotiate::UserRequest::HandleReply(void *data, void *lastserver, char *re } else if (strncasecmp(reply, "AF ", 3) == 0 && arg != NULL) { /* we're finished, release the helper */ - if (arg) - *arg++ = '\0'; + if (arg) { + *arg = '\0'; + ++arg; + } auth_user_request->user()->username(arg); auth_user_request->denyMessage("Login successful"); @@ -334,8 +338,10 @@ Auth::Negotiate::UserRequest::HandleReply(void *data, void *lastserver, char *re } else if (strncasecmp(reply, "NA ", 3) == 0 && arg != NULL) { /* authentication failure (wrong password, etc.) */ - if (arg) - *arg++ = '\0'; + if (arg) { + *arg = '\0'; + ++arg; + } auth_user_request->denyMessage(arg); auth_user_request->user()->credentials(Auth::Failed); diff --git a/src/base/TextException.cc b/src/base/TextException.cc index 60fd7304e8..ef66a37931 100644 --- a/src/base/TextException.cc +++ b/src/base/TextException.cc @@ -57,7 +57,8 @@ unsigned int TextException::FileNameHash(const char *fname) while (*s) { ++j; - n ^= 271 * (unsigned) *s++; + n ^= 271 * (unsigned) *s; + ++s; } i = n ^ (j * 271); /*18bits of a 32 bit integer used for filename hash (max hash=262143), diff --git a/src/comm/ModSelectWin32.cc b/src/comm/ModSelectWin32.cc index f350c2fe66..8d30690e88 100644 --- a/src/comm/ModSelectWin32.cc +++ b/src/comm/ModSelectWin32.cc @@ -281,11 +281,15 @@ comm_select_udp_incoming(void) int nevents; udp_io_events = 0; - if (Comm::IsConnOpen(icpIncomingConn)) - fds[nfds++] = icpIncomingConn->fd; + if (Comm::IsConnOpen(icpIncomingConn)) { + fds[nfds] = icpIncomingConn->fd; + ++nfds; + } - if (Comm::IsConnOpen(icpOutgoingConn) && icpIncomingConn != icpOutgoingConn) - fds[nfds++] = icpOutgoingConn->fd; + if (Comm::IsConnOpen(icpOutgoingConn) && icpIncomingConn != icpOutgoingConn) { + fds[nfds] = icpOutgoingConn->fd; + ++nfds; + } if (nfds == 0) return; @@ -317,8 +321,10 @@ comm_select_tcp_incoming(void) // XXX: only poll sockets that won't be deferred. But how do we identify them? for (const AnyP::PortCfg *s = Config.Sockaddr.http; s; s = s->next) { - if (Comm::IsConnOpen(s->listenConn)) - fds[nfds++] = s->listenConn->fd; + if (Comm::IsConnOpen(s->listenConn)) { + fds[nfds] = s->listenConn->fd; + ++nfds; + } } nevents = comm_check_incoming_select_handlers(nfds, fds); @@ -657,11 +663,15 @@ comm_select_dns_incoming(void) if (DnsSocketA < 0 && DnsSocketB < 0) return; - if (DnsSocketA >= 0) - fds[nfds++] = DnsSocketA; + if (DnsSocketA >= 0) { + fds[nfds] = DnsSocketA; + ++nfds; + } - if (DnsSocketB >= 0) - fds[nfds++] = DnsSocketB; + if (DnsSocketB >= 0) { + fds[nfds] = DnsSocketB; + ++nfds; + } nevents = comm_check_incoming_select_handlers(nfds, fds); diff --git a/src/esi/Esi.cc b/src/esi/Esi.cc index a52d1ea2ec..083e9a88ed 100644 --- a/src/esi/Esi.cc +++ b/src/esi/Esi.cc @@ -993,7 +993,8 @@ ESIContext::addStackElement (ESIElement::Pointer element) flags.error = 1; } else { /* added ok, push onto the stack */ - parserState.stack[parserState.stackdepth++] = element; + parserState.stack[parserState.stackdepth] = element; + ++parserState.stackdepth; } } @@ -1024,12 +1025,15 @@ ESIContext::start(const char *el, const char **attr, size_t attrCount) position = localbuf + strlen (localbuf); for (i = 0; i < specifiedattcount && attr[i]; i += 2) { - *position++ = ' '; + *position = ' '; + ++position; /* TODO: handle thisNode gracefully */ assert (xstrncpy (position, attr[i], sizeof(localbuf) + (position - localbuf))); position += strlen (position); - *position++ = '='; - *position++ = '\"'; + *position = '='; + ++position; + *position = '\"'; + ++position; const char *chPtr = attr[i + 1]; char ch; while ((ch = *chPtr++) != '\0') { @@ -1042,7 +1046,8 @@ ESIContext::start(const char *el, const char **attr, size_t attrCount) } } position += strlen (position); - *position++ = '\"'; + *position = '\"'; + ++position; } *position = '>'; @@ -1136,7 +1141,8 @@ ESIContext::end(const char *el) localbuf[1] = '/'; assert (xstrncpy (&localbuf[2], el, sizeof(localbuf) - 3)); position = localbuf + strlen (localbuf); - *position++ = '>'; + *position = '>'; + ++position; *position = '\0'; addLiteral (localbuf, position - localbuf); break; @@ -1285,7 +1291,8 @@ ESIContext::parse() if (!parserState.stackdepth) { debugs(86, 5, "empty parser stack, inserting the top level node"); assert (tree.getRaw()); - parserState.stack[parserState.stackdepth++] = tree; + parserState.stack[parserState.stackdepth] = tree; + ++parserState.stackdepth; } if (rep && !parserState.inited())