aboutsummaryrefslogtreecommitdiff
path: root/iconv
diff options
context:
space:
mode:
Diffstat (limited to 'iconv')
-rw-r--r--iconv/gconv_conf.c6
-rw-r--r--iconv/iconv_open.c15
2 files changed, 11 insertions, 10 deletions
diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
index 307bf8a274..ece63354da 100644
--- a/iconv/gconv_conf.c
+++ b/iconv/gconv_conf.c
@@ -177,12 +177,12 @@ add_alias (char *rp, void *modules)
++rp;
from = wp = rp;
while (*rp != '\0' && !isspace (*rp))
- *wp = toupper (*rp++);
+ *wp++ = toupper (*rp++);
if (*rp == '\0')
/* There is no `to' string on the line. Ignore it. */
return;
- *rp++ = '\0';
- to = wp = rp;
+ *wp++ = '\0';
+ to = ++rp;
while (isspace (*rp))
++rp;
while (*rp != '\0' && !isspace (*rp))
diff --git a/iconv/iconv_open.c b/iconv/iconv_open.c
index 49576fd508..51dcf0baaa 100644
--- a/iconv/iconv_open.c
+++ b/iconv/iconv_open.c
@@ -53,12 +53,12 @@ strip (char *wp, const char *s)
static char *
-upstr (char *str)
+upstr (char *dst, const char *str)
{
- char *cp = str;
- while ((*cp = toupper (*cp)) != '\0')
- ++cp;
- return str;
+ char *cp = dst;
+ while ((*cp++ = toupper (*str++)) != '\0')
+ /* nothing */;
+ return dst;
}
@@ -77,12 +77,13 @@ iconv_open (const char *tocode, const char *fromcode)
tocode_len = strlen (tocode);
tocode_conv = alloca (tocode_len + 3);
strip (tocode_conv, tocode);
- tocode = tocode_conv[2] == '\0' ? upstr (tocode) : tocode_conv;
+ tocode = tocode_conv[2] == '\0' ? upstr (tocode_conv, tocode) : tocode_conv;
fromcode_len = strlen (fromcode);
fromcode_conv = alloca (fromcode_len + 3);
strip (fromcode_conv, fromcode);
- fromcode = romcode_conv[2] == '\0' ? upstr (fromcode) : fromcode_conv;
+ fromcode = (fromcode_conv[2] == '\0'
+ ? upstr (fromcode_conv, fromcode) : fromcode_conv);
res = __gconv_open (tocode, fromcode, &cd);