mirror of
https://github.com/curl/curl.git
synced 2026-08-02 02:10:29 +03:00
tidy-up: move literals to right-side of if expressions (where missing)
Closes #20535
This commit is contained in:
parent
c6ac2de5b3
commit
85de995208
57 changed files with 115 additions and 115 deletions
|
|
@ -183,17 +183,17 @@ int main(int argc, const char *argv[])
|
|||
/* get it! */
|
||||
result = curl_easy_perform(curl);
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
curl_off_t val;
|
||||
|
||||
/* check for bytes downloaded */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
if((result == CURLE_OK) && (val > 0))
|
||||
printf("Data downloaded: %" CURL_FORMAT_CURL_OFF_T " bytes.\n", val);
|
||||
|
||||
/* check for total download time */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
if((result == CURLE_OK) && (val > 0))
|
||||
printf("Total download time: %" CURL_FORMAT_CURL_OFF_T
|
||||
".%06" CURL_FORMAT_CURL_OFF_T " sec.\n",
|
||||
val / 1000000,
|
||||
|
|
@ -201,7 +201,7 @@ int main(int argc, const char *argv[])
|
|||
|
||||
/* check for average download speed */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
if((result == CURLE_OK) && (val > 0))
|
||||
printf("Average download speed: "
|
||||
"%" CURL_FORMAT_CURL_OFF_T " kbyte/sec.\n",
|
||||
val / 1024);
|
||||
|
|
@ -209,7 +209,7 @@ int main(int argc, const char *argv[])
|
|||
if(prtall) {
|
||||
/* check for name resolution time */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
if((result == CURLE_OK) && (val > 0))
|
||||
printf("Name lookup time: %" CURL_FORMAT_CURL_OFF_T
|
||||
".%06" CURL_FORMAT_CURL_OFF_T " sec.\n",
|
||||
val / 1000000,
|
||||
|
|
@ -217,7 +217,7 @@ int main(int argc, const char *argv[])
|
|||
|
||||
/* check for connect time */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &val);
|
||||
if((CURLE_OK == result) && (val > 0))
|
||||
if((result == CURLE_OK) && (val > 0))
|
||||
printf("Connect time: %" CURL_FORMAT_CURL_OFF_T
|
||||
".%06" CURL_FORMAT_CURL_OFF_T " sec.\n",
|
||||
val / 1000000,
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ int main(void)
|
|||
/* clean up the FTP commands list */
|
||||
curl_slist_free_all(headerlist);
|
||||
|
||||
if(CURLE_OK != result) {
|
||||
if(result != CURLE_OK) {
|
||||
/* we failed */
|
||||
fprintf(stderr, "curl told us %d\n", result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ int main(void)
|
|||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
if(CURLE_OK != result) {
|
||||
if(result != CURLE_OK) {
|
||||
/* we failed */
|
||||
fprintf(stderr, "curl told us %d\n", result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,16 +75,16 @@ int main(void)
|
|||
|
||||
result = curl_easy_perform(curl);
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
/* https://curl.se/libcurl/c/curl_easy_getinfo.html */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
|
||||
if((CURLE_OK == result) && (filetime >= 0)) {
|
||||
if((result == CURLE_OK) && (filetime >= 0)) {
|
||||
time_t file_time = (time_t)filetime;
|
||||
printf("filetime %s: %s", filename, ctime(&file_time));
|
||||
}
|
||||
result = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
|
||||
&filesize);
|
||||
if((CURLE_OK == result) && (filesize > 0))
|
||||
if((result == CURLE_OK) && (filesize > 0))
|
||||
printf("filesize %s: %" CURL_FORMAT_CURL_OFF_T " bytes\n",
|
||||
filename, filesize);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ int main(void)
|
|||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
if(CURLE_OK != result) {
|
||||
if(result != CURLE_OK) {
|
||||
/* we failed */
|
||||
fprintf(stderr, "curl told us %d\n", result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ int main(void)
|
|||
curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
|
||||
result = curl_easy_perform(curl);
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
const char *ct;
|
||||
/* ask for the content-type */
|
||||
result = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);
|
||||
|
||||
if((CURLE_OK == result) && ct)
|
||||
if((result == CURLE_OK) && ct)
|
||||
printf("We received Content-Type: %s\n", ct);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ int main(void)
|
|||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
if(CURLE_OK != result) {
|
||||
if(result != CURLE_OK) {
|
||||
/* we failed */
|
||||
fprintf(stderr, "curl told us %d\n", result);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ static curl_off_t sftpGetRemoteFileSize(const char *i_remoteFile)
|
|||
curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
|
||||
|
||||
result = curl_easy_perform(curl);
|
||||
if(CURLE_OK == result) {
|
||||
if(result == CURLE_OK) {
|
||||
result = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
|
||||
&remoteFileSizeByte);
|
||||
if(result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue