mirror of
https://github.com/curl/curl.git
synced 2026-08-25 22:13:33 +03:00
snprintf: renamed and we now only use msnprintf()
The function does not return the same value as snprintf() normally does, so readers may be mislead into thinking the code works differently than it actually does. A different function name makes this easier to detect. Reported-by: Tomas Hoger Assisted-by: Daniel Gustafsson Fixes #3296 Closes #3297
This commit is contained in:
parent
9944d6ba33
commit
dcd6f81025
92 changed files with 632 additions and 631 deletions
30
lib/ftp.c
30
lib/ftp.c
|
|
@ -1272,7 +1272,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
|
|||
source++;
|
||||
}
|
||||
*dest = 0;
|
||||
snprintf(dest, 20, ",%d,%d", (int)(port>>8), (int)(port&0xff));
|
||||
msnprintf(dest, 20, ",%d,%d", (int)(port>>8), (int)(port&0xff));
|
||||
|
||||
result = Curl_pp_sendf(&ftpc->pp, "%s %s", mode[fcmd], tmp);
|
||||
if(result) {
|
||||
|
|
@ -2061,9 +2061,9 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn,
|
|||
char timebuf[24];
|
||||
time_t secs = time(NULL);
|
||||
|
||||
snprintf(timebuf, sizeof(timebuf),
|
||||
"%04d%02d%02d %02d:%02d:%02d GMT",
|
||||
year, month, day, hour, minute, second);
|
||||
msnprintf(timebuf, sizeof(timebuf),
|
||||
"%04d%02d%02d %02d:%02d:%02d GMT",
|
||||
year, month, day, hour, minute, second);
|
||||
/* now, convert this into a time() value: */
|
||||
data->info.filetime = curl_getdate(timebuf, &secs);
|
||||
}
|
||||
|
|
@ -2086,15 +2086,15 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn,
|
|||
return result;
|
||||
|
||||
/* format: "Tue, 15 Nov 1994 12:45:26" */
|
||||
snprintf(headerbuf, sizeof(headerbuf),
|
||||
"Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
|
||||
Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
|
||||
tm->tm_mday,
|
||||
Curl_month[tm->tm_mon],
|
||||
tm->tm_year + 1900,
|
||||
tm->tm_hour,
|
||||
tm->tm_min,
|
||||
tm->tm_sec);
|
||||
msnprintf(headerbuf, sizeof(headerbuf),
|
||||
"Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
|
||||
Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
|
||||
tm->tm_mday,
|
||||
Curl_month[tm->tm_mon],
|
||||
tm->tm_year + 1900,
|
||||
tm->tm_hour,
|
||||
tm->tm_min,
|
||||
tm->tm_sec);
|
||||
result = Curl_client_write(conn, CLIENTWRITE_BOTH, headerbuf, 0);
|
||||
if(result)
|
||||
return result;
|
||||
|
|
@ -2276,8 +2276,8 @@ static CURLcode ftp_state_size_resp(struct connectdata *conn,
|
|||
#ifdef CURL_FTP_HTTPSTYLE_HEAD
|
||||
if(-1 != filesize) {
|
||||
char clbuf[128];
|
||||
snprintf(clbuf, sizeof(clbuf),
|
||||
"Content-Length: %" CURL_FORMAT_CURL_OFF_T "\r\n", filesize);
|
||||
msnprintf(clbuf, sizeof(clbuf),
|
||||
"Content-Length: %" CURL_FORMAT_CURL_OFF_T "\r\n", filesize);
|
||||
result = Curl_client_write(conn, CLIENTWRITE_BOTH, clbuf, 0);
|
||||
if(result)
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue