mirror of
https://github.com/curl/curl.git
synced 2026-07-24 16:07:16 +03:00
checksrc: find bad indentation in conditions without open brace
If the previous line starts with if/while/for AND ends with a closed parenthesis and there's an equal number of open and closed parentheses on that line, verify that this line is indented $indent more steps, if not a cpp line. Also adjust the fall-out from this fix. Closes #11054
This commit is contained in:
parent
31303c34e9
commit
9ce7eee070
17 changed files with 49 additions and 23 deletions
|
|
@ -241,7 +241,7 @@ void Curl_sock_assign_addr(struct Curl_sockaddr_ex *dest,
|
|||
dest->addrlen = ai->ai_addrlen;
|
||||
|
||||
if(dest->addrlen > sizeof(struct Curl_sockaddr_storage))
|
||||
dest->addrlen = sizeof(struct Curl_sockaddr_storage);
|
||||
dest->addrlen = sizeof(struct Curl_sockaddr_storage);
|
||||
memcpy(&dest->sa_addr, ai->ai_addr, dest->addrlen);
|
||||
}
|
||||
|
||||
|
|
@ -1222,7 +1222,7 @@ static bool cf_socket_data_pending(struct Curl_cfilter *cf,
|
|||
|
||||
(void)data;
|
||||
if(!Curl_bufq_is_empty(&ctx->recvbuf))
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
|
||||
readable = SOCKET_READABLE(ctx->sock, 0);
|
||||
return (readable > 0 && (readable & CURL_CSELECT_IN));
|
||||
|
|
|
|||
|
|
@ -4134,7 +4134,7 @@ CURLcode ftp_parse_url_path(struct Curl_easy *data)
|
|||
case FTPFILE_NOCWD: /* fastest, but less standard-compliant */
|
||||
|
||||
if((pathLen > 0) && (rawPath[pathLen - 1] != '/'))
|
||||
fileName = rawPath; /* this is a full file path */
|
||||
fileName = rawPath; /* this is a full file path */
|
||||
/*
|
||||
else: ftpc->file is not used anywhere other than for operations on
|
||||
a file. In other words, never for directory operations.
|
||||
|
|
|
|||
|
|
@ -1931,7 +1931,7 @@ static CURLcode imap_parse_url_options(struct connectdata *conn)
|
|||
const char *value;
|
||||
|
||||
while(*ptr && *ptr != '=')
|
||||
ptr++;
|
||||
ptr++;
|
||||
|
||||
value = ptr + 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size)
|
|||
/* Was it a trailing run of 0x00's?
|
||||
*/
|
||||
if(best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ))
|
||||
*tp++ = ':';
|
||||
*tp++ = ':';
|
||||
*tp++ = '\0';
|
||||
|
||||
/* Check for overflow, copy, and we're done.
|
||||
|
|
|
|||
|
|
@ -731,7 +731,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
|
|||
}
|
||||
|
||||
if(ber)
|
||||
ber_free(ber, 0);
|
||||
ber_free(ber, 0);
|
||||
}
|
||||
|
||||
quit:
|
||||
|
|
@ -1069,7 +1069,7 @@ static int _ldap_url_parse(struct Curl_easy *data,
|
|||
|
||||
*ludpp = NULL;
|
||||
if(!ludp)
|
||||
return LDAP_NO_MEMORY;
|
||||
return LDAP_NO_MEMORY;
|
||||
|
||||
rc = _ldap_url_parse2(data, conn, ludp);
|
||||
if(rc != LDAP_SUCCESS) {
|
||||
|
|
|
|||
|
|
@ -1107,7 +1107,7 @@ static int mime_subparts_seek(void *instream, curl_off_t offset, int whence)
|
|||
return CURL_SEEKFUNC_CANTSEEK; /* Only support full rewind. */
|
||||
|
||||
if(mime->state.state == MIMESTATE_BEGIN)
|
||||
return CURL_SEEKFUNC_OK; /* Already rewound. */
|
||||
return CURL_SEEKFUNC_OK; /* Already rewound. */
|
||||
|
||||
for(part = mime->firstpart; part; part = part->nextpart) {
|
||||
int res = mime_part_rewind(part);
|
||||
|
|
@ -1734,7 +1734,7 @@ const char *Curl_mime_contenttype(const char *filename)
|
|||
size_t len2 = strlen(ctts[i].extension);
|
||||
|
||||
if(len1 >= len2 && strcasecompare(nameend - len2, ctts[i].extension))
|
||||
return ctts[i].type;
|
||||
return ctts[i].type;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -2021,7 +2021,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
|||
else
|
||||
#endif
|
||||
if(conn->bits.conn_to_host)
|
||||
hostname = conn->conn_to_host.name;
|
||||
hostname = conn->conn_to_host.name;
|
||||
else
|
||||
hostname = conn->host.name;
|
||||
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ static CURLcode oldap_parse_login_options(struct connectdata *conn)
|
|||
const char *value;
|
||||
|
||||
while(*ptr && *ptr != '=')
|
||||
ptr++;
|
||||
ptr++;
|
||||
|
||||
value = ptr + 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -1376,7 +1376,7 @@ static CURLcode pop3_parse_url_options(struct connectdata *conn)
|
|||
const char *value;
|
||||
|
||||
while(*ptr && *ptr != '=')
|
||||
ptr++;
|
||||
ptr++;
|
||||
|
||||
value = ptr + 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -542,7 +542,7 @@ static ssize_t cf_msh3_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
|
|||
if(nread < 0)
|
||||
goto out;
|
||||
if(stream->closed)
|
||||
drain_stream(cf, data);
|
||||
drain_stream(cf, data);
|
||||
}
|
||||
else if(stream->closed) {
|
||||
nread = recv_closed_stream(cf, data, err);
|
||||
|
|
|
|||
|
|
@ -1710,7 +1710,7 @@ static CURLcode qng_verify_peer(struct Curl_cfilter *cf,
|
|||
Curl_conn_get_host(data, cf->sockindex, &hostname, &disp_hostname, &port);
|
||||
snihost = Curl_ssl_snihost(data, hostname, NULL);
|
||||
if(!snihost)
|
||||
return CURLE_PEER_FAILED_VERIFICATION;
|
||||
return CURLE_PEER_FAILED_VERIFICATION;
|
||||
|
||||
cf->conn->bits.multiplex = TRUE; /* at least potentially multiplexed */
|
||||
cf->conn->httpversion = 30;
|
||||
|
|
|
|||
|
|
@ -1548,7 +1548,7 @@ static CURLcode sectransp_set_selected_ciphers(struct Curl_easy *data,
|
|||
|
||||
/* Skip separators */
|
||||
while(is_separator(*cipher_start))
|
||||
cipher_start++;
|
||||
cipher_start++;
|
||||
if(*cipher_start == '\0') {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue