diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-11-25 15:06:56 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-11-26 08:13:51 +0100 |
commit | fc813f80e1bcacdb8f6e86d3f0d4263f2e5ad856 (patch) | |
tree | dff4d80015c0280b4350d8133b4a32f2d885a5f8 /src | |
parent | 12cb7a1fe0282cc0b1ef4faa6013a2de03028aac (diff) | |
download | curl-fc813f80e1bcacdb8f6e86d3f0d4263f2e5ad856.tar.gz |
tool_writeout: use off_t getinfo-types instead of doubles
Commit 3b80d3ca46b12e52342 (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
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_writeout.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/src/tool_writeout.c b/src/tool_writeout.c index 0642b6f78..c12738c43 100644 --- a/src/tool_writeout.c +++ b/src/tool_writeout.c @@ -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]) { @@ -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 == |