mirror of
https://github.com/curl/curl.git
synced 2026-07-28 00:13:09 +03:00
tidy-up: replace (0 != expressions
This commit is contained in:
parent
b7393b9410
commit
8f18750bd2
13 changed files with 33 additions and 33 deletions
|
|
@ -80,7 +80,7 @@ int main(void)
|
|||
NULL, /* default attributes please */
|
||||
pull_one_url,
|
||||
(void *)urls[i]);
|
||||
if(0 != error)
|
||||
if(error)
|
||||
fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
|
||||
else
|
||||
fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]);
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ void *create_thread(void *progress_bar)
|
|||
NULL, /* default attributes please */
|
||||
pull_one_url,
|
||||
NULL);
|
||||
if(0 != error)
|
||||
if(error)
|
||||
fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
|
||||
else
|
||||
fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ int main(int argc, char **argv)
|
|||
NULL, /* default attributes please */
|
||||
pull_one_url,
|
||||
(void *)urls[i]);
|
||||
if(0 != error)
|
||||
if(error)
|
||||
fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
|
||||
else
|
||||
fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]);
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ If no parenthesis, use the default indent:
|
|||
|
||||
```c
|
||||
data->set.http_disable_hostname_check_before_authentication =
|
||||
(0 != va_arg(param, long)) ? TRUE : FALSE;
|
||||
va_arg(param, long) ? TRUE : FALSE;
|
||||
```
|
||||
|
||||
Function invoke with an open parenthesis:
|
||||
|
|
|
|||
|
|
@ -844,7 +844,7 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
|
|||
|
||||
#endif
|
||||
|
||||
if(0 != getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void *)&err, &errSize))
|
||||
if(getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void *)&err, &errSize))
|
||||
err = SOCKERRNO;
|
||||
#ifdef UNDER_CE
|
||||
/* Old Windows CE versions do not support SO_ERROR */
|
||||
|
|
|
|||
|
|
@ -633,7 +633,7 @@ static CURLcode Curl_sha512_256_update(void *context,
|
|||
ctx->count_bits_hi += ctx->count >> 61;
|
||||
ctx->count &= CURL_UINT64_C(0x1FFFFFFFFFFFFFFF);
|
||||
|
||||
if(0 != bytes_have) {
|
||||
if(bytes_have) {
|
||||
unsigned int bytes_left = CURL_SHA512_256_BLOCK_SIZE - bytes_have;
|
||||
if(length >= bytes_left) {
|
||||
/* Combine new data with data in the buffer and process the full
|
||||
|
|
@ -656,7 +656,7 @@ static CURLcode Curl_sha512_256_update(void *context,
|
|||
length -= CURL_SHA512_256_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
if(0 != length) {
|
||||
if(length) {
|
||||
/* Copy incomplete block of new data (if any)
|
||||
to the buffer. */
|
||||
memcpy(((unsigned char *) ctx_buf) + bytes_have, data, length);
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ static void set_ssl_options(struct ssl_config_data *ssl,
|
|||
static CURLcode setopt_long(struct Curl_easy *data, CURLoption option,
|
||||
long arg)
|
||||
{
|
||||
bool enabled = (0 != arg);
|
||||
bool enabled = !!arg;
|
||||
unsigned long uarg = (unsigned long)arg;
|
||||
switch(option) {
|
||||
case CURLOPT_DNS_CACHE_TIMEOUT:
|
||||
|
|
|
|||
|
|
@ -809,7 +809,7 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
|
|||
* storage is supplied via 'strerrbuf' and 'buflen' to hold the generated
|
||||
* message string, or EINVAL if 'errnum' is not a valid error number.
|
||||
*/
|
||||
if(0 != strerror_r(err, buf, buflen)) {
|
||||
if(strerror_r(err, buf, buflen)) {
|
||||
if('\0' == buf[0])
|
||||
curl_msnprintf(buf, buflen, "Unknown error %d", err);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers,
|
|||
{
|
||||
const char *startCur = ciphers;
|
||||
int algCount = 0;
|
||||
while(startCur && (0 != *startCur) && (algCount < NUM_CIPHERS)) {
|
||||
while(startCur && *startCur && (algCount < NUM_CIPHERS)) {
|
||||
curl_off_t alg;
|
||||
if(curlx_str_number(&startCur, &alg, INT_MAX) || !alg)
|
||||
alg = get_alg_id_by_name(startCur);
|
||||
|
|
|
|||
|
|
@ -670,7 +670,7 @@ static CURLcode pubkey_pem_to_der(const char *pem,
|
|||
|
||||
pem_count = begin_pos - pem;
|
||||
/* Invalid if not at beginning AND not directly following \n */
|
||||
if(0 != pem_count && '\n' != pem[pem_count - 1])
|
||||
if(pem_count && '\n' != pem[pem_count - 1])
|
||||
return CURLE_BAD_CONTENT_ENCODING;
|
||||
|
||||
/* 26 is length of "-----BEGIN PUBLIC KEY-----" */
|
||||
|
|
|
|||
|
|
@ -784,7 +784,7 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req)
|
|||
else {
|
||||
FILE *stream = test2fopen(req->testno, logdir);
|
||||
char partbuf[80]="data";
|
||||
if(0 != req->partno)
|
||||
if(req->partno)
|
||||
snprintf(partbuf, sizeof(partbuf), "data%ld", req->partno);
|
||||
if(!stream) {
|
||||
error = errno;
|
||||
|
|
@ -1099,8 +1099,8 @@ static int test_rtspd(int argc, char *argv[])
|
|||
}
|
||||
|
||||
flag = 1;
|
||||
if(0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("setsockopt(SO_REUSEADDR) failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
|
|||
|
|
@ -1243,8 +1243,8 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
|
|||
if(socket_domain_is_ip()) {
|
||||
/* Disable the Nagle algorithm */
|
||||
curl_socklen_t flag = 1;
|
||||
if(0 != setsockopt(serverfd, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void *)&flag, sizeof(flag)))
|
||||
if(setsockopt(serverfd, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void *)&flag, sizeof(flag)))
|
||||
logmsg("====> TCP_NODELAY for server connection failed");
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1252,7 +1252,7 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
|
|||
/* We want to do the connect() in a non-blocking mode, since
|
||||
* Windows has an internal retry logic that may lead to long
|
||||
* timeouts if the peer is not listening. */
|
||||
if(0 != curlx_nonblock(serverfd, TRUE)) {
|
||||
if(curlx_nonblock(serverfd, TRUE)) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("curlx_nonblock(TRUE) failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
@ -1321,8 +1321,8 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
|
|||
goto error;
|
||||
else if(rc > 0) {
|
||||
curl_socklen_t errSize = sizeof(error);
|
||||
if(0 != getsockopt(serverfd, SOL_SOCKET, SO_ERROR,
|
||||
(void *)&error, &errSize))
|
||||
if(getsockopt(serverfd, SOL_SOCKET, SO_ERROR,
|
||||
(void *)&error, &errSize))
|
||||
error = SOCKERRNO;
|
||||
if((0 == error) || (SOCKEISCONN == error))
|
||||
goto success;
|
||||
|
|
@ -1346,7 +1346,7 @@ success:
|
|||
logmsg("connected fine to %s%s%s:%hu, now tunnel",
|
||||
op_br, ipaddr, cl_br, port);
|
||||
|
||||
if(0 != curlx_nonblock(serverfd, FALSE)) {
|
||||
if(curlx_nonblock(serverfd, FALSE)) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("curlx_nonblock(FALSE) failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
@ -1549,8 +1549,8 @@ static void http_connect(curl_socket_t *infdp,
|
|||
if(socket_domain_is_ip()) {
|
||||
/* Disable the Nagle algorithm */
|
||||
curl_socklen_t flag = 1;
|
||||
if(0 != setsockopt(datafd, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void *)&flag, sizeof(flag)))
|
||||
if(setsockopt(datafd, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void *)&flag, sizeof(flag)))
|
||||
logmsg("====> TCP_NODELAY for client DATA connection failed");
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1839,7 +1839,7 @@ static curl_socket_t accept_connection(curl_socket_t sock)
|
|||
return CURL_SOCKET_BAD;
|
||||
}
|
||||
|
||||
if(0 != curlx_nonblock(msgsock, TRUE)) {
|
||||
if(curlx_nonblock(msgsock, TRUE)) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("curlx_nonblock failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
@ -1847,8 +1847,8 @@ static curl_socket_t accept_connection(curl_socket_t sock)
|
|||
return CURL_SOCKET_BAD;
|
||||
}
|
||||
|
||||
if(0 != setsockopt(msgsock, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
if(setsockopt(msgsock, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("setsockopt(SO_KEEPALIVE) failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
@ -1877,8 +1877,8 @@ static curl_socket_t accept_connection(curl_socket_t sock)
|
|||
* Disable the Nagle algorithm to make it easier to send out a large
|
||||
* response in many small segments to torture the clients more.
|
||||
*/
|
||||
if(0 != setsockopt(msgsock, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void *)&flag, sizeof(flag)))
|
||||
if(setsockopt(msgsock, IPPROTO_TCP, TCP_NODELAY,
|
||||
(void *)&flag, sizeof(flag)))
|
||||
logmsg("====> TCP_NODELAY failed");
|
||||
}
|
||||
#endif
|
||||
|
|
@ -2162,14 +2162,14 @@ static int test_sws(int argc, char *argv[])
|
|||
}
|
||||
|
||||
flag = 1;
|
||||
if(0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("setsockopt(SO_REUSEADDR) failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
goto sws_cleanup;
|
||||
}
|
||||
if(0 != curlx_nonblock(sock, TRUE)) {
|
||||
if(curlx_nonblock(sock, TRUE)) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("curlx_nonblock failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
|
|||
|
|
@ -662,8 +662,8 @@ static int test_tftpd(int argc, char **argv)
|
|||
}
|
||||
|
||||
flag = 1;
|
||||
if(0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(void *)&flag, sizeof(flag))) {
|
||||
error = SOCKERRNO;
|
||||
logmsg("setsockopt(SO_REUSEADDR) failed with error (%d) %s",
|
||||
error, sstrerror(error));
|
||||
|
|
@ -1118,7 +1118,7 @@ static int validate_access(struct testcase *test,
|
|||
|
||||
stream = test2fopen(testno, logdir);
|
||||
|
||||
if(0 != partno)
|
||||
if(partno)
|
||||
snprintf(partbuf, sizeof(partbuf), "data%ld", partno);
|
||||
|
||||
if(!stream) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue