Navigation Menu

Skip to content

Commit

Permalink
tool_writeout: use off_t getinfo-types instead of doubles
Browse files Browse the repository at this point in the history
Commit 3b80d3c (June 2017) introduced getinfo replacement
variables that use curl_off_t instead of doubles. Switch the --write-out
function over to use them.

Closes #6248
  • Loading branch information
bagder committed Nov 26, 2020
1 parent 12cb7a1 commit fc813f8
Showing 1 changed file with 29 additions and 30 deletions.
59 changes: 29 additions & 30 deletions src/tool_writeout.c
Expand Up @@ -112,7 +112,7 @@ void ourWriteOut(CURL *curl, struct per_transfer *per, const char *writeinfo)
const char *ptr = writeinfo;
char *stringp = NULL;
long longinfo;
double doubleinfo;
curl_off_t offinfo;

while(ptr && *ptr) {
if('%' == *ptr && ptr[1]) {
Expand Down Expand Up @@ -189,65 +189,64 @@ void ourWriteOut(CURL *curl, struct per_transfer *per, const char *writeinfo)
break;
case VAR_REDIRECT_TIME:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME,
&doubleinfo))
fprintf(stream, "%.6f", doubleinfo);
curl_easy_getinfo(curl, CURLINFO_REDIRECT_TIME_T, &offinfo))
fprintf(stream, "%" CURL_FORMAT_CURL_OFF_TU, offinfo);
break;
case VAR_TOTAL_TIME:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &doubleinfo))
fprintf(stream, "%.6f", doubleinfo);
curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &offinfo))
fprintf(stream, "%" CURL_FORMAT_CURL_OFF_TU, offinfo);
break;
case VAR_NAMELOOKUP_TIME:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME,
&doubleinfo))
fprintf(stream, "%.6f", doubleinfo);
curl_easy_getinfo(curl, CURLINFO_NAMELOOKUP_TIME_T,
&offinfo))
fprintf(stream, "%" CURL_FORMAT_CURL_OFF_TU, offinfo);
break;
case VAR_CONNECT_TIME:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME, &doubleinfo))
fprintf(stream, "%.6f", doubleinfo);
curl_easy_getinfo(curl, CURLINFO_CONNECT_TIME_T, &offinfo))
fprintf(stream, "%" CURL_FORMAT_CURL_OFF_TU, offinfo);
break;
case VAR_APPCONNECT_TIME:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME,
&doubleinfo))
fprintf(stream, "%.6f", doubleinfo);
curl_easy_getinfo(curl, CURLINFO_APPCONNECT_TIME_T,
&offinfo))
fprintf(stream, "%" CURL_FORMAT_CURL_OFF_TU, offinfo);
break;
case VAR_PRETRANSFER_TIME:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME,
&doubleinfo))
fprintf(stream, "%.6f", doubleinfo);
curl_easy_getinfo(curl, CURLINFO_PRETRANSFER_TIME_T,
&offinfo))
fprintf(stream, "%" CURL_FORMAT_CURL_OFF_TU, offinfo);
break;
case VAR_STARTTRANSFER_TIME:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME,
&doubleinfo))
fprintf(stream, "%.6f", doubleinfo);
curl_easy_getinfo(curl, CURLINFO_STARTTRANSFER_TIME_T,
&offinfo))
fprintf(stream, "%" CURL_FORMAT_CURL_OFF_TU, offinfo);
break;
case VAR_SIZE_UPLOAD:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD, &doubleinfo))
fprintf(stream, "%.0f", doubleinfo);
curl_easy_getinfo(curl, CURLINFO_SIZE_UPLOAD_T, &offinfo))
fprintf(stream, "%" CURL_FORMAT_CURL_OFF_TU, offinfo);
break;
case VAR_SIZE_DOWNLOAD:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD,
&doubleinfo))
fprintf(stream, "%.0f", doubleinfo);
curl_easy_getinfo(curl, CURLINFO_SIZE_DOWNLOAD_T,
&offinfo))
fprintf(stream, "%" CURL_FORMAT_CURL_OFF_TU, offinfo);
break;
case VAR_SPEED_DOWNLOAD:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD,
&doubleinfo))
fprintf(stream, "%.3f", doubleinfo);
curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD_T,
&offinfo))
fprintf(stream, "%" CURL_FORMAT_CURL_OFF_TU, offinfo);
break;
case VAR_SPEED_UPLOAD:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &doubleinfo))
fprintf(stream, "%.3f", doubleinfo);
curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD_T, &offinfo))
fprintf(stream, "%" CURL_FORMAT_CURL_OFF_TU, offinfo);
break;
case VAR_CONTENT_TYPE:
if((CURLE_OK ==
Expand Down

0 comments on commit fc813f8

Please sign in to comment.