lib: fix some format specifiers

- Use CURL_FORMAT_CURL_OFF_T where %zd was erroneously used for some
  curl_off_t variables.

- Use %zu where %zd was erroneously used for some size_t variables.

Prior to this change some of the Windows CI tests were failing because
in Windows 32-bit targets have a 32-bit size_t and a 64-bit curl_off_t.
When %zd was used for some curl_off_t variables then only the lower
32-bits was read and the upper 32-bits would be read for part or all of
the next specifier.

Fixes https://github.com/curl/curl/issues/11327
Closes https://github.com/curl/curl/pull/11321
This commit is contained in:
Jay Satiro 2023-06-15 23:02:48 -04:00
parent 1eca27f100
commit fd306e55a0
11 changed files with 38 additions and 29 deletions

View file

@ -769,8 +769,9 @@ static CURLcode multi_done(struct Curl_easy *data,
#endif
) || conn->bits.close
|| (premature && !Curl_conn_is_multiplex(conn, FIRSTSOCKET))) {
DEBUGF(infof(data, "multi_done, not re-using connection=%zd, forbid=%d"
", close=%d, premature=%d, conn_multiplex=%d",
DEBUGF(infof(data, "multi_done, not re-using connection=%"
CURL_FORMAT_CURL_OFF_T ", forbid=%d"
", close=%d, premature=%d, conn_multiplex=%d",
conn->connection_id,
data->set.reuse_forbid, conn->bits.close, premature,
Curl_conn_is_multiplex(conn, FIRSTSOCKET)));
@ -792,7 +793,7 @@ static CURLcode multi_done(struct Curl_easy *data,
/* create string before returning the connection */
curl_off_t connection_id = conn->connection_id;
msnprintf(buffer, sizeof(buffer),
"Connection #%zd to host %s left intact",
"Connection #%" CURL_FORMAT_CURL_OFF_T " to host %s left intact",
connection_id, host);
/* the connection is no longer in use by this transfer */
CONNCACHE_UNLOCK(data);