1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 16:18:48 -05:00

example: fix code to build warning-free

This commit is contained in:
Daniel Stenberg 2010-08-02 23:46:24 +02:00
parent a1a5ba3d0a
commit e9f3513264

View File

@ -40,6 +40,8 @@ static size_t WriteCallback(void *ptr, size_t size, size_t nmemb, void *data)
{
/* we are not interested in the downloaded bytes itself,
so we only return the size we would have saved ... */
(void)ptr; /* unused */
(void)data; /* unused */
return (size_t)(size * nmemb);
}
@ -48,7 +50,7 @@ int main(int argc, char *argv[])
CURL *curl_handle;
CURLcode res;
int prtsep = 0, prttime = 0;
char *url = URL_1M;
const char *url = URL_1M;
char *appname = argv[0];
if (argc > 1) {
@ -135,17 +137,17 @@ int main(int argc, char *argv[])
/* check for bytes downloaded */
res = curl_easy_getinfo(curl_handle, CURLINFO_SIZE_DOWNLOAD, &val);
if((CURLE_OK == res) && val)
if((CURLE_OK == res) && (val>0))
printf("Data downloaded: %0.0f bytes.\n", val);
/* check for total download time */
res = curl_easy_getinfo(curl_handle, CURLINFO_TOTAL_TIME, &val);
if((CURLE_OK == res) && val)
if((CURLE_OK == res) && (val>0))
printf("Total download time: %0.3f sec.\n", val);
/* check for average download speed */
res = curl_easy_getinfo(curl_handle, CURLINFO_SPEED_DOWNLOAD, &val);
if((CURLE_OK == res) && val)
if((CURLE_OK == res) && (val>0))
printf("Average download speed: %0.3f kbyte/sec.\n", val / 1024);
} else {