1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-16 22:45:03 -05:00

unittests: Fixed compilation warnings

warning: implicit declaration of function 'sprintf_was_used'
         [-Wimplicit-function-declaration]

Follow up to the modications made to tests/libtest in commit 55452ebdff
as we prefer not to use sprintf() now.
This commit is contained in:
Steve Holme 2016-04-03 00:02:19 +01:00
parent e238253d06
commit 0326b06770

View File

@ -45,7 +45,7 @@ static void unit_stop(void)
static char *getflagstr(int flags) { static char *getflagstr(int flags) {
char *buf = malloc(256); char *buf = malloc(256);
fail_unless(buf, "out of memory"); fail_unless(buf, "out of memory");
sprintf(buf, "%s,%s,%s,%s", snprintf(buf, sizeof(buf), "%s,%s,%s,%s",
((flags & SANITIZE_ALLOW_COLONS) ? "SANITIZE_ALLOW_COLONS" : ""), ((flags & SANITIZE_ALLOW_COLONS) ? "SANITIZE_ALLOW_COLONS" : ""),
((flags & SANITIZE_ALLOW_PATH) ? "SANITIZE_ALLOW_PATH" : ""), ((flags & SANITIZE_ALLOW_PATH) ? "SANITIZE_ALLOW_PATH" : ""),
((flags & SANITIZE_ALLOW_RESERVED) ? "SANITIZE_ALLOW_RESERVED" : ""), ((flags & SANITIZE_ALLOW_RESERVED) ? "SANITIZE_ALLOW_RESERVED" : ""),
@ -56,7 +56,7 @@ static char *getflagstr(int flags) {
static char *getcurlcodestr(int cc) { static char *getcurlcodestr(int cc) {
char *buf = malloc(256); char *buf = malloc(256);
fail_unless(buf, "out of memory"); fail_unless(buf, "out of memory");
sprintf(buf, "%s (%d)", snprintf(buf, sizeof(buf), "%s (%d)",
(cc == SANITIZE_ERR_OK ? "SANITIZE_ERR_OK" : (cc == SANITIZE_ERR_OK ? "SANITIZE_ERR_OK" :
cc == SANITIZE_ERR_BAD_ARGUMENT ? "SANITIZE_ERR_BAD_ARGUMENT" : cc == SANITIZE_ERR_BAD_ARGUMENT ? "SANITIZE_ERR_BAD_ARGUMENT" :
cc == SANITIZE_ERR_INVALID_PATH ? "SANITIZE_ERR_INVALID_PATH" : cc == SANITIZE_ERR_INVALID_PATH ? "SANITIZE_ERR_INVALID_PATH" :