mirror of
https://github.com/curl/curl.git
synced 2026-08-25 10:53:37 +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
|
|
@ -95,7 +95,7 @@ static size_t brotli_version(char *buf, size_t bufsz)
|
|||
unsigned int minor = (brotli_version & 0x00FFFFFF) >> 12;
|
||||
unsigned int patch = brotli_version & 0x00000FFF;
|
||||
|
||||
return snprintf(buf, bufsz, "%u.%u.%u", major, minor, patch);
|
||||
return msnprintf(buf, bufsz, "%u.%u.%u", major, minor, patch);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -126,12 +126,12 @@ char *curl_version(void)
|
|||
}
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
len = snprintf(ptr, left, " zlib/%s", zlibVersion());
|
||||
len = msnprintf(ptr, left, " zlib/%s", zlibVersion());
|
||||
left -= len;
|
||||
ptr += len;
|
||||
#endif
|
||||
#ifdef HAVE_BROTLI
|
||||
len = snprintf(ptr, left, "%s", " brotli/");
|
||||
len = msnprintf(ptr, left, "%s", " brotli/");
|
||||
left -= len;
|
||||
ptr += len;
|
||||
len = brotli_version(ptr, left);
|
||||
|
|
@ -140,45 +140,45 @@ char *curl_version(void)
|
|||
#endif
|
||||
#ifdef USE_ARES
|
||||
/* this function is only present in c-ares, not in the original ares */
|
||||
len = snprintf(ptr, left, " c-ares/%s", ares_version(NULL));
|
||||
len = msnprintf(ptr, left, " c-ares/%s", ares_version(NULL));
|
||||
left -= len;
|
||||
ptr += len;
|
||||
#endif
|
||||
#ifdef USE_LIBIDN2
|
||||
if(idn2_check_version(IDN2_VERSION)) {
|
||||
len = snprintf(ptr, left, " libidn2/%s", idn2_check_version(NULL));
|
||||
len = msnprintf(ptr, left, " libidn2/%s", idn2_check_version(NULL));
|
||||
left -= len;
|
||||
ptr += len;
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_LIBPSL
|
||||
len = snprintf(ptr, left, " libpsl/%s", psl_get_version());
|
||||
len = msnprintf(ptr, left, " libpsl/%s", psl_get_version());
|
||||
left -= len;
|
||||
ptr += len;
|
||||
#endif
|
||||
#ifdef USE_WIN32_IDN
|
||||
len = snprintf(ptr, left, " WinIDN");
|
||||
len = msnprintf(ptr, left, " WinIDN");
|
||||
left -= len;
|
||||
ptr += len;
|
||||
#endif
|
||||
#if defined(HAVE_ICONV) && defined(CURL_DOES_CONVERSIONS)
|
||||
#ifdef _LIBICONV_VERSION
|
||||
len = snprintf(ptr, left, " iconv/%d.%d",
|
||||
_LIBICONV_VERSION >> 8, _LIBICONV_VERSION & 255);
|
||||
len = msnprintf(ptr, left, " iconv/%d.%d",
|
||||
_LIBICONV_VERSION >> 8, _LIBICONV_VERSION & 255);
|
||||
#else
|
||||
/* version unknown */
|
||||
len = snprintf(ptr, left, " iconv");
|
||||
len = msnprintf(ptr, left, " iconv");
|
||||
#endif /* _LIBICONV_VERSION */
|
||||
left -= len;
|
||||
ptr += len;
|
||||
#endif
|
||||
#ifdef USE_LIBSSH2
|
||||
len = snprintf(ptr, left, " libssh2/%s", CURL_LIBSSH2_VERSION);
|
||||
len = msnprintf(ptr, left, " libssh2/%s", CURL_LIBSSH2_VERSION);
|
||||
left -= len;
|
||||
ptr += len;
|
||||
#endif
|
||||
#ifdef USE_LIBSSH
|
||||
len = snprintf(ptr, left, " libssh/%s", CURL_LIBSSH_VERSION);
|
||||
len = msnprintf(ptr, left, " libssh/%s", CURL_LIBSSH_VERSION);
|
||||
left -= len;
|
||||
ptr += len;
|
||||
#endif
|
||||
|
|
@ -197,14 +197,14 @@ char *curl_version(void)
|
|||
else
|
||||
suff[0] = '\0';
|
||||
|
||||
snprintf(ptr, left, " librtmp/%d.%d%s",
|
||||
RTMP_LIB_VERSION >> 16, (RTMP_LIB_VERSION >> 8) & 0xff,
|
||||
suff);
|
||||
msnprintf(ptr, left, " librtmp/%d.%d%s",
|
||||
RTMP_LIB_VERSION >> 16, (RTMP_LIB_VERSION >> 8) & 0xff,
|
||||
suff);
|
||||
/*
|
||||
If another lib version is added below this one, this code would
|
||||
also have to do:
|
||||
|
||||
len = what snprintf() returned
|
||||
len = what msnprintf() returned
|
||||
|
||||
left -= len;
|
||||
ptr += len;
|
||||
|
|
@ -436,10 +436,10 @@ curl_version_info_data *curl_version_info(CURLversion stamp)
|
|||
#endif
|
||||
|
||||
#if defined(USE_LIBSSH2)
|
||||
snprintf(ssh_buffer, sizeof(ssh_buffer), "libssh2/%s", LIBSSH2_VERSION);
|
||||
msnprintf(ssh_buffer, sizeof(ssh_buffer), "libssh2/%s", LIBSSH2_VERSION);
|
||||
version_info.libssh_version = ssh_buffer;
|
||||
#elif defined(USE_LIBSSH)
|
||||
snprintf(ssh_buffer, sizeof(ssh_buffer), "libssh/%s", CURL_LIBSSH_VERSION);
|
||||
msnprintf(ssh_buffer, sizeof(ssh_buffer), "libssh/%s", CURL_LIBSSH_VERSION);
|
||||
version_info.libssh_version = ssh_buffer;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue