From e34b0f2902588bbbfaf55829692e32c3c7134b74 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 24 Nov 1997 02:08:40 +0000 Subject: Update. 1997-11-24 03:01 Ulrich Drepper * elf/dl-support.c: Call __libc_init_secure to make sure __libc_enable_secure is defined early. * sysdeps/generic/enbl-secure.c: Change function name to __libc_init_secure and make it global instead of a constructor. * iconv/gconv.c: Fix lots of bugs. * iconv/gconv.h: Likewise. * iconv/gconv_builtin.h: Likewise. * iconv/gconv_close.c: Likewise. * iconv/gconv_conf.c: Likewise. * iconv/gconv_db.c: Likewise. * iconv/gconv_dl.c: Likewise. * iconv/gconv_open.c: Likewise. * iconv/gconv_simple.c: Likewise. * iconv/iconv.c: Likewise. * iconv/iconv_close.c: Likewise. * iconv/iconv_open.c: Likewise. * wcsmbs/Makefile (routines): Add wmemrtowcs and wmemrtombs. * wcsmbs/wchar.h: Add prototypes for wmemrtowcs and wmemrtombs. * wcsmbs/wmemrtombs.c: New file. * wcsmbs/wmemrtowcs.c: New file. --- iconv/iconv_open.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'iconv/iconv_open.c') diff --git a/iconv/iconv_open.c b/iconv/iconv_open.c index 82802b7451..bfff00d917 100644 --- a/iconv/iconv_open.c +++ b/iconv/iconv_open.c @@ -27,11 +27,9 @@ static inline void -strip (char *s) +strip (char *wp, const char *s) { int slash_count = 0; - char *wp; - wp = s; while (*s != '\0') { @@ -39,7 +37,7 @@ strip (char *s) *wp++ = *s; else if (*s == '/') { - if (++slash_count == 2) + if (++slash_count == 3) break; *wp++ = '/'; } @@ -67,14 +65,15 @@ iconv_open (const char *tocode, const char *fromcode) '_', '-', '/', and '.'. */ tocode_len = strlen (tocode); tocode_conv = alloca (tocode_len + 3); - strip (memcpy (tocode_conv, tocode, tocode_len + 1)); + strip (tocode_conv, tocode); fromcode_len = strlen (fromcode); fromcode_conv = alloca (fromcode_len + 3); - strip (memcpy (fromcode_conv, fromcode, fromcode_len + 1)); + strip (fromcode_conv, fromcode); res = __gconv_open (tocode_conv[2] == '\0' ? tocode : tocode_conv, - fromcode_conv[2] == '\0' ? fromcode, fromcode_conv, &cd); + fromcode_conv[2] == '\0' ? fromcode : fromcode_conv, + &cd); if (res != GCONV_OK) { -- cgit v1.2.3