tidy-up: replace (-1 != expressions

This commit is contained in:
Viktor Szakats 2025-07-09 19:05:57 +02:00
parent 8f18750bd2
commit 656c1cae6a
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
4 changed files with 7 additions and 7 deletions

View file

@ -358,7 +358,7 @@ static CURLcode file_upload(struct Curl_easy *data,
return CURLE_WRITE_ERROR;
}
if(-1 != data->state.infilesize)
if(data->state.infilesize != -1)
/* known size of data to "upload" */
Curl_pgrsSetUploadSize(data, data->state.infilesize);
@ -470,7 +470,7 @@ static CURLcode file_do(struct Curl_easy *data, bool *done)
fd = file->fd;
/* VMS: This only works reliable for STREAMLF files */
if(-1 != fstat(fd, &statbuf)) {
if(fstat(fd, &statbuf) != -1) {
if(!S_ISDIR(statbuf.st_mode))
expected_size = statbuf.st_size;
/* and store the modification time */

View file

@ -2356,7 +2356,7 @@ static CURLcode ftp_state_size_resp(struct Curl_easy *data,
if(instate == FTP_SIZE) {
#ifdef CURL_FTP_HTTPSTYLE_HEAD
if(-1 != filesize) {
if(filesize != -1) {
char clbuf[128];
int clbuflen = msnprintf(clbuf, sizeof(clbuf),
"Content-Length: %" FMT_OFF_T "\r\n", filesize);
@ -3439,7 +3439,7 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
}
}
else {
if((-1 != data->req.size) &&
if((data->req.size != -1) &&
(data->req.size != data->req.bytecount) &&
(data->req.maxdownload != data->req.bytecount)) {
failf(data, "Received only partial file: %" FMT_OFF_T " bytes",

View file

@ -281,7 +281,7 @@ static CURLcode cw_download_write(struct Curl_easy *data,
* This gives deterministic BODY writes on varying buffer receive
* lengths. */
nwrite = nbytes;
if(-1 != data->req.maxdownload) {
if(data->req.maxdownload != -1) {
size_t wmax = get_max_body_write_len(data, data->req.maxdownload);
if(nwrite > wmax) {
excess_len = nbytes - wmax;
@ -879,7 +879,7 @@ static CURLcode cr_in_rewind(struct Curl_easy *data,
int err = fseek(data->state.in, 0, SEEK_SET);
CURL_TRC_READ(data, "cr_in, rewind via fseek -> %d(%d)",
(int)err, (int)errno);
if(-1 != err)
if(err != -1)
/* successful rewind */
return CURLE_OK;
}

View file

@ -76,7 +76,7 @@ int getfiletime(const char *filename, struct GlobalConfig *global,
}
#else
struct_stat statbuf;
if(-1 != stat(filename, &statbuf)) {
if(stat(filename, &statbuf) != -1) {
*stamp = (curl_off_t)statbuf.st_mtime;
rc = 0;
}