lib: use FMT_ as prefix instead of CURL_FORMAT_

For printf format defines used internally. Makes the code slighly
easier to read.

Closes #14764
This commit is contained in:
Daniel Stenberg 2024-09-03 00:04:23 +02:00
parent a2bcec0ee0
commit 4ff04615a0
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
40 changed files with 357 additions and 395 deletions

View file

@ -462,16 +462,15 @@ static CURLcode http_perhapsrewind(struct Curl_easy *data,
if(abort_upload) {
if(upload_remain >= 0)
infof(data, "%s%sclose instead of sending %"
CURL_FORMAT_CURL_OFF_T " more bytes",
ongoing_auth? ongoing_auth : "",
ongoing_auth? " send, " : "",
upload_remain);
infof(data, "%s%sclose instead of sending %" FMT_OFF_T " more bytes",
ongoing_auth? ongoing_auth : "",
ongoing_auth? " send, " : "",
upload_remain);
else
infof(data, "%s%sclose instead of sending unknown amount "
"of more bytes",
ongoing_auth? ongoing_auth : "",
ongoing_auth? " send, " : "");
"of more bytes",
ongoing_auth? ongoing_auth : "",
ongoing_auth? " send, " : "");
/* We decided to abort the ongoing transfer */
streamclose(conn, "Mid-auth HTTP and much data left to send");
/* FIXME: questionable manipulation here, can we do this differently? */
@ -2049,7 +2048,7 @@ static CURLcode http_resume(struct Curl_easy *data, Curl_HttpReq httpreq)
CURLcode result;
result = Curl_creader_resume_from(data, data->state.resume_from);
if(result) {
failf(data, "Unable to resume from offset %" CURL_FORMAT_CURL_OFF_T,
failf(data, "Unable to resume from offset %" FMT_OFF_T,
data->state.resume_from);
return result;
}
@ -2186,9 +2185,8 @@ CURLcode Curl_http_req_complete(struct Curl_easy *data,
!Curl_checkheaders(data, STRCONST("Content-Length")))) {
/* we allow replacing this header if not during auth negotiation,
although it is not very wise to actually set your own */
result = Curl_dyn_addf(r,
"Content-Length: %" CURL_FORMAT_CURL_OFF_T
"\r\n", req_clen);
result = Curl_dyn_addf(r, "Content-Length: %" FMT_OFF_T "\r\n",
req_clen);
}
if(result)
goto out;
@ -2343,8 +2341,7 @@ CURLcode Curl_http_range(struct Curl_easy *data,
remote part so we tell the server (and act accordingly) that we
upload the whole file (again) */
data->state.aptr.rangeline =
aprintf("Content-Range: bytes 0-%" CURL_FORMAT_CURL_OFF_T
"/%" CURL_FORMAT_CURL_OFF_T "\r\n",
aprintf("Content-Range: bytes 0-%" FMT_OFF_T "/%" FMT_OFF_T "\r\n",
req_clen - 1, req_clen);
}
@ -2357,15 +2354,14 @@ CURLcode Curl_http_range(struct Curl_easy *data,
data->state.infilesize :
(data->state.resume_from + req_clen);
data->state.aptr.rangeline =
aprintf("Content-Range: bytes %s%" CURL_FORMAT_CURL_OFF_T
"/%" CURL_FORMAT_CURL_OFF_T "\r\n",
aprintf("Content-Range: bytes %s%" FMT_OFF_T "/%" FMT_OFF_T "\r\n",
data->state.range, total_len-1, total_len);
}
else {
/* Range was selected and then we just pass the incoming range and
append total size */
data->state.aptr.rangeline =
aprintf("Content-Range: bytes %s/%" CURL_FORMAT_CURL_OFF_T "\r\n",
aprintf("Content-Range: bytes %s/%" FMT_OFF_T "\r\n",
data->state.range, req_clen);
}
if(!data->state.aptr.rangeline)