aboutsummaryrefslogtreecommitdiff
path: root/src/tool_setopt.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-11-22 09:01:24 +0100
committerDaniel Stenberg <daniel@haxx.se>2018-11-23 08:26:51 +0100
commitdcd6f810255785d52b89150e18460fb0899d4f7e (patch)
treec3cb7cdcb79dbf752edcd997934e44a2e9998397 /src/tool_setopt.c
parent9944d6ba334f07b0b6199bdb5bb82091c88c16ed (diff)
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
Diffstat (limited to 'src/tool_setopt.c')
-rw-r--r--src/tool_setopt.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/tool_setopt.c b/src/tool_setopt.c
index fb2cb66d3..cd28ad829 100644
--- a/src/tool_setopt.c
+++ b/src/tool_setopt.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -251,7 +251,7 @@ static char *c_escape(const char *str, size_t len)
e += 2;
}
else if(! isprint(c)) {
- snprintf(e, 5, "\\%03o", (unsigned)c);
+ msnprintf(e, 5, "\\%03o", (unsigned)c);
e += 4;
}
else
@@ -311,8 +311,8 @@ CURLcode tool_setopt_flags(CURL *curl, struct GlobalConfig *config,
char preamble[80]; /* should accommodate any symbol name */
long rest = lval; /* bits not handled yet */
const NameValue *nv = NULL;
- snprintf(preamble, sizeof(preamble),
- "curl_easy_setopt(hnd, %s, ", name);
+ msnprintf(preamble, sizeof(preamble),
+ "curl_easy_setopt(hnd, %s, ", name);
for(nv = nvlist; nv->name; nv++) {
if((nv->value & ~ rest) == 0) {
/* all value flags contained in rest */
@@ -322,7 +322,7 @@ CURLcode tool_setopt_flags(CURL *curl, struct GlobalConfig *config,
if(!rest)
break; /* handled them all */
/* replace with all spaces for continuation line */
- snprintf(preamble, sizeof(preamble), "%*s", strlen(preamble), "");
+ msnprintf(preamble, sizeof(preamble), "%*s", strlen(preamble), "");
}
}
/* If any bits have no definition, output an explicit value.
@@ -354,8 +354,8 @@ CURLcode tool_setopt_bitmask(CURL *curl, struct GlobalConfig *config,
char preamble[80];
unsigned long rest = (unsigned long)lval;
const NameValueUnsigned *nv = NULL;
- snprintf(preamble, sizeof(preamble),
- "curl_easy_setopt(hnd, %s, ", name);
+ msnprintf(preamble, sizeof(preamble),
+ "curl_easy_setopt(hnd, %s, ", name);
for(nv = nvlist; nv->name; nv++) {
if((nv->value & ~ rest) == 0) {
/* all value flags contained in rest */
@@ -365,7 +365,7 @@ CURLcode tool_setopt_bitmask(CURL *curl, struct GlobalConfig *config,
if(!rest)
break; /* handled them all */
/* replace with all spaces for continuation line */
- snprintf(preamble, sizeof(preamble), "%*s", strlen(preamble), "");
+ msnprintf(preamble, sizeof(preamble), "%*s", strlen(preamble), "");
}
}
/* If any bits have no definition, output an explicit value.
@@ -629,7 +629,7 @@ CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *config,
}
}
- snprintf(buf, sizeof(buf), "%ldL", lval);
+ msnprintf(buf, sizeof(buf), "%ldL", lval);
value = buf;
ret = curl_easy_setopt(curl, tag, lval);
if(lval == defval)
@@ -666,8 +666,8 @@ CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *config,
else {
/* Value is expected to be curl_off_t */
curl_off_t oval = va_arg(arg, curl_off_t);
- snprintf(buf, sizeof(buf),
- "(curl_off_t)%" CURL_FORMAT_CURL_OFF_T, oval);
+ msnprintf(buf, sizeof(buf),
+ "(curl_off_t)%" CURL_FORMAT_CURL_OFF_T, oval);
value = buf;
ret = curl_easy_setopt(curl, tag, oval);