mirror of
https://github.com/curl/curl.git
synced 2026-08-24 14:03:35 +03:00
src: stop overriding system printf symbols
Also:
- tool_operate: use the socket printf mask, drop cast.
Follow-up to 4deea9396b #18814
Closes #18844
This commit is contained in:
parent
34ad78da89
commit
db98daab05
25 changed files with 203 additions and 207 deletions
|
|
@ -46,8 +46,8 @@ static const char *hms_for_sec(time_t tv_sec)
|
|||
if(tv_sec != cached_tv_sec) {
|
||||
/* !checksrc! disable BANNEDFUNC 1 */
|
||||
struct tm *now = localtime(&tv_sec); /* not thread safe either */
|
||||
msnprintf(hms_buf, sizeof(hms_buf), "%02d:%02d:%02d",
|
||||
now->tm_hour, now->tm_min, now->tm_sec);
|
||||
curl_msnprintf(hms_buf, sizeof(hms_buf), "%02d:%02d:%02d",
|
||||
now->tm_hour, now->tm_min, now->tm_sec);
|
||||
cached_tv_sec = tv_sec;
|
||||
}
|
||||
return hms_buf;
|
||||
|
|
@ -64,7 +64,7 @@ static void log_line_start(FILE *log, const char *timebuf,
|
|||
"* ", "< ", "> ", "{ ", "} ", "{ ", "} "
|
||||
};
|
||||
if((timebuf && *timebuf) || (idsbuf && *idsbuf))
|
||||
fprintf(log, "%s%s%s", timebuf, idsbuf, s_infotype[type]);
|
||||
curl_mfprintf(log, "%s%s%s", timebuf, idsbuf, s_infotype[type]);
|
||||
else
|
||||
fputs(s_infotype[type], log);
|
||||
}
|
||||
|
|
@ -96,8 +96,8 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
|
|||
|
||||
if(global->tracetime) {
|
||||
tv = tvrealnow();
|
||||
msnprintf(timebuf, sizeof(timebuf), "%s.%06ld ",
|
||||
hms_for_sec(tv.tv_sec), (long)tv.tv_usec);
|
||||
curl_msnprintf(timebuf, sizeof(timebuf), "%s.%06ld ",
|
||||
hms_for_sec(tv.tv_sec), (long)tv.tv_usec);
|
||||
}
|
||||
else
|
||||
timebuf[0] = 0;
|
||||
|
|
@ -106,11 +106,11 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
|
|||
!curl_easy_getinfo(handle, CURLINFO_XFER_ID, &xfer_id) && xfer_id >= 0) {
|
||||
if(!curl_easy_getinfo(handle, CURLINFO_CONN_ID, &conn_id) &&
|
||||
conn_id >= 0) {
|
||||
msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_2,
|
||||
xfer_id, conn_id);
|
||||
curl_msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_2,
|
||||
xfer_id, conn_id);
|
||||
}
|
||||
else {
|
||||
msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_1, xfer_id);
|
||||
curl_msnprintf(idsbuf, sizeof(idsbuf), TRC_IDS_FORMAT_IDS_1, xfer_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -184,7 +184,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
|
|||
((output != tool_stderr) && (output != stdout))) {
|
||||
if(!newl)
|
||||
log_line_start(output, timebuf, idsbuf, type);
|
||||
fprintf(output, "[%zu bytes data]\n", size);
|
||||
curl_mfprintf(output, "[%zu bytes data]\n", size);
|
||||
newl = FALSE;
|
||||
traced_data = TRUE;
|
||||
}
|
||||
|
|
@ -201,7 +201,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
|
|||
|
||||
switch(type) {
|
||||
case CURLINFO_TEXT:
|
||||
fprintf(output, "%s%s* %.*s", timebuf, idsbuf, (int)size, data);
|
||||
curl_mfprintf(output, "%s%s* %.*s", timebuf, idsbuf, (int)size, data);
|
||||
FALLTHROUGH();
|
||||
default: /* in case a new one is introduced to shock us */
|
||||
return 0;
|
||||
|
|
@ -244,18 +244,18 @@ static void dump(const char *timebuf, const char *idsbuf, const char *text,
|
|||
/* without the hex output, we can fit more on screen */
|
||||
width = 0x40;
|
||||
|
||||
fprintf(stream, "%s%s%s, %zu bytes (0x%zx)\n", timebuf, idsbuf,
|
||||
text, size, size);
|
||||
curl_mfprintf(stream, "%s%s%s, %zu bytes (0x%zx)\n", timebuf, idsbuf,
|
||||
text, size, size);
|
||||
|
||||
for(i = 0; i < size; i += width) {
|
||||
|
||||
fprintf(stream, "%04zx: ", i);
|
||||
curl_mfprintf(stream, "%04zx: ", i);
|
||||
|
||||
if(tracetype == TRACE_BIN) {
|
||||
/* hex not disabled, show it */
|
||||
for(c = 0; c < width; c++)
|
||||
if(i + c < size)
|
||||
fprintf(stream, "%02x ", ptr[i + c]);
|
||||
curl_mfprintf(stream, "%02x ", ptr[i + c]);
|
||||
else
|
||||
fputs(" ", stream);
|
||||
}
|
||||
|
|
@ -269,8 +269,9 @@ static void dump(const char *timebuf, const char *idsbuf, const char *text,
|
|||
break;
|
||||
}
|
||||
(void)infotype;
|
||||
fprintf(stream, "%c", ((ptr[i + c] >= 0x20) && (ptr[i + c] < 0x7F)) ?
|
||||
ptr[i + c] : UNPRINTABLE_CHAR);
|
||||
curl_mfprintf(stream, "%c",
|
||||
((ptr[i + c] >= 0x20) && (ptr[i + c] < 0x7F)) ?
|
||||
ptr[i + c] : UNPRINTABLE_CHAR);
|
||||
/* check again for 0D0A, to avoid an extra \n if it is at width */
|
||||
if((tracetype == TRACE_ASCII) &&
|
||||
(i + c + 2 < size) && (ptr[i + c + 1] == 0x0D) &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue