diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-12-19 07:26:29 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-12-19 07:26:29 +0000 |
commit | 915a6c51c5d8127e87ef797ee23e04e4f92b4c4f (patch) | |
tree | 4c7f9881c4b6b3ab049688dc22e969c44e8fbcf9 /wcsmbs | |
parent | 477aa8698f7963b0984c15016f62f99efe4bb0b5 (diff) | |
download | glibc-915a6c51c5d8127e87ef797ee23e04e4f92b4c4f.zip glibc-915a6c51c5d8127e87ef797ee23e04e4f92b4c4f.tar.gz glibc-915a6c51c5d8127e87ef797ee23e04e4f92b4c4f.tar.bz2 |
* iconv/gconv.c: Demangle pointers before use if necessary.cvs/fedora-glibc-20051219T1003
* iconv/gconv_cache.c: Likewise.
* iconv/skeleton.c: Likewise.
* libio/iofwide.c: Likewise.
* wcsmbs/btowc.c: Likewise.
* wcsmbs/mbrtowc.c: Likewise.
* wcsmbs/mbsnrtowcs.c: Likewise.
* wcsmbs/mbsrtowcs_l.c: Likewise.
* wcsmbs/wcrtomb.c: Likewise.
* wcsmbs/wcsnrtombs.c: Likewise.
* wcsmbs/wcsrtombs.c: Likewise.
* wcsmbs/wctob.c: Likewise.
* iconv_gconv_db.c: Likewise. After init functions returns mangle
btowc pointer if necessary.
* iconv/gconv_dl.c: Mangle function pointers retrieved from dlsym.
Diffstat (limited to 'wcsmbs')
-rw-r--r-- | wcsmbs/btowc.c | 22 | ||||
-rw-r--r-- | wcsmbs/mbrtowc.c | 13 | ||||
-rw-r--r-- | wcsmbs/mbsnrtowcs.c | 15 | ||||
-rw-r--r-- | wcsmbs/mbsrtowcs_l.c | 18 | ||||
-rw-r--r-- | wcsmbs/wcrtomb.c | 15 | ||||
-rw-r--r-- | wcsmbs/wcsnrtombs.c | 22 | ||||
-rw-r--r-- | wcsmbs/wcsrtombs.c | 22 | ||||
-rw-r--r-- | wcsmbs/wctob.c | 9 |
8 files changed, 90 insertions, 46 deletions
diff --git a/wcsmbs/btowc.c b/wcsmbs/btowc.c index 6add7ed..6517d4f 100644 --- a/wcsmbs/btowc.c +++ b/wcsmbs/btowc.c @@ -26,6 +26,8 @@ #include <wcsmbsload.h> #include <limits.h> +#include <sysdep.h> + wint_t __btowc (c) @@ -45,13 +47,17 @@ __btowc (c) /* Get the conversion functions. */ fcts = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE)); + __gconv_btowc_fct btowc_fct = fcts->towc->__btowc_fct; if (__builtin_expect (fcts->towc_nsteps == 1, 1) - && __builtin_expect (fcts->towc->__btowc_fct != NULL, 1)) + && __builtin_expect (btowc_fct != NULL, 1)) { /* Use the shortcut function. */ - return DL_CALL_FCT (fcts->towc->__btowc_fct, - (fcts->towc, (unsigned char) c)); +#ifdef PTR_DEMANGLE + if (fcts->towc->__shlib_handle != NULL) + PTR_DEMANGLE (btowc_fct); +#endif + return DL_CALL_FCT (btowc_fct, (fcts->towc, (unsigned char) c)); } else { @@ -78,9 +84,13 @@ __btowc (c) /* Create the input string. */ inbuf[0] = c; - status = DL_CALL_FCT (fcts->towc->__fct, - (fcts->towc, &data, &inptr, inptr + 1, - NULL, &dummy, 0, 1)); + __gconv_fct fct = fcts->towc->__fct; +#ifdef PTR_DEMANGLE + if (fcts->towc->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif + status = DL_CALL_FCT (fct, (fcts->towc, &data, &inptr, inptr + 1, + NULL, &dummy, 0, 1)); if (status != __GCONV_OK && status != __GCONV_FULL_OUTPUT && status != __GCONV_EMPTY_INPUT) diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c index eb2a312..b534571 100644 --- a/wcsmbs/mbrtowc.c +++ b/wcsmbs/mbrtowc.c @@ -18,13 +18,14 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <assert.h> #include <dlfcn.h> #include <errno.h> #include <gconv.h> #include <wchar.h> #include <wcsmbsload.h> -#include <assert.h> +#include <sysdep.h> #ifndef EILSEQ # define EILSEQ EINVAL @@ -73,9 +74,13 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) endbuf = inbuf + n; if (__builtin_expect (endbuf < inbuf, 0)) endbuf = (const unsigned char *) ~(uintptr_t) 0; - status = DL_CALL_FCT (fcts->towc->__fct, - (fcts->towc, &data, &inbuf, endbuf, - NULL, &dummy, 0, 1)); + __gconv_fct fct = fcts->towc->__fct; +#ifdef PTR_DEMANGLE + if (fcts->towc->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif + status = DL_CALL_FCT (fct, (fcts->towc, &data, &inbuf, endbuf, + NULL, &dummy, 0, 1)); /* There must not be any problems with the conversion but illegal input characters. The output buffer must be large enough, otherwise the diff --git a/wcsmbs/mbsnrtowcs.c b/wcsmbs/mbsnrtowcs.c index ef5ca06..8d0b9d3 100644 --- a/wcsmbs/mbsnrtowcs.c +++ b/wcsmbs/mbsnrtowcs.c @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <assert.h> #include <dlfcn.h> #include <errno.h> #include <gconv.h> @@ -24,7 +25,7 @@ #include <wchar.h> #include <wcsmbsload.h> -#include <assert.h> +#include <sysdep.h> #ifndef EILSEQ # define EILSEQ EINVAL @@ -69,6 +70,11 @@ __mbsnrtowcs (dst, src, nmc, len, ps) /* Get the structure with the function pointers. */ towc = fcts->towc; + __gconv_fct fct = towc->__fct; +#ifdef PTR_DEMANGLE + if (towc->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif /* We have to handle DST == NULL special. */ if (dst == NULL) @@ -82,9 +88,8 @@ __mbsnrtowcs (dst, src, nmc, len, ps) { data.__outbuf = (unsigned char *) buf; - status = DL_CALL_FCT (towc->__fct, - (towc, &data, &inbuf, srcend, NULL, - &dummy, 0, 1)); + status = DL_CALL_FCT (fct, (towc, &data, &inbuf, srcend, NULL, + &dummy, 0, 1)); result += (wchar_t *) data.__outbuf - buf; } @@ -103,7 +108,7 @@ __mbsnrtowcs (dst, src, nmc, len, ps) data.__outbuf = (unsigned char *) dst; data.__outbufend = data.__outbuf + len * sizeof (wchar_t); - status = DL_CALL_FCT (towc->__fct, + status = DL_CALL_FCT (fct, (towc, &data, (const unsigned char **) src, srcend, NULL, &dummy, 0, 1)); diff --git a/wcsmbs/mbsrtowcs_l.c b/wcsmbs/mbsrtowcs_l.c index c44c8e5..264c410 100644 --- a/wcsmbs/mbsrtowcs_l.c +++ b/wcsmbs/mbsrtowcs_l.c @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <assert.h> #include <ctype.h> #include <string.h> #include "wcsmbsload.h" @@ -28,7 +29,7 @@ #include <wchar.h> #include <wcsmbsload.h> -#include <assert.h> +#include <sysdep.h> #ifndef EILSEQ # define EILSEQ EINVAL @@ -63,6 +64,11 @@ __mbsrtowcs_l (dst, src, len, ps, l) /* Get the structure with the function pointers. */ towc = fcts->towc; + __gconv_fct fct = towc->__fct; +#ifdef PTR_DEMANGLE + if (towc->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif /* We have to handle DST == NULL special. */ if (dst == NULL) @@ -81,9 +87,8 @@ __mbsrtowcs_l (dst, src, len, ps, l) { data.__outbuf = (unsigned char *) buf; - status = DL_CALL_FCT (towc->__fct, - (towc, &data, &inbuf, srcend, NULL, - &non_reversible, 0, 1)); + status = DL_CALL_FCT (fct, (towc, &data, &inbuf, srcend, NULL, + &non_reversible, 0, 1)); result += (wchar_t *) data.__outbuf - buf; } @@ -116,9 +121,8 @@ __mbsrtowcs_l (dst, src, len, ps, l) worst case we need one input byte for one output wchar_t. */ srcend = srcp + __strnlen ((const char *) srcp, len) + 1; - status = DL_CALL_FCT (towc->__fct, - (towc, &data, &srcp, srcend, NULL, - &non_reversible, 0, 1)); + status = DL_CALL_FCT (fct, (towc, &data, &srcp, srcend, NULL, + &non_reversible, 0, 1)); if ((status != __GCONV_EMPTY_INPUT && status != __GCONV_INCOMPLETE_INPUT) /* Not all input read. */ diff --git a/wcsmbs/wcrtomb.c b/wcsmbs/wcrtomb.c index f7971e7..aa51b68 100644 --- a/wcsmbs/wcrtomb.c +++ b/wcsmbs/wcrtomb.c @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <assert.h> #include <dlfcn.h> #include <errno.h> #include <gconv.h> @@ -24,7 +25,7 @@ #include <wchar.h> #include <wcsmbsload.h> -#include <assert.h> +#include <sysdep.h> #ifndef EILSEQ # define EILSEQ EINVAL @@ -65,15 +66,19 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps) /* Get the conversion functions. */ fcts = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE)); + __gconv_fct fct = fcts->tomb->__fct; +#ifdef PTR_DEMANGLE + if (fcts->tomb->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif /* If WC is the NUL character we write into the output buffer the byte sequence necessary for PS to get into the initial state, followed by a NUL byte. */ if (wc == L'\0') { - status = DL_CALL_FCT (fcts->tomb->__fct, - (fcts->tomb, &data, NULL, NULL, - NULL, &dummy, 1, 1)); + status = DL_CALL_FCT (fct, (fcts->tomb, &data, NULL, NULL, + NULL, &dummy, 1, 1)); if (status == __GCONV_OK || status == __GCONV_EMPTY_INPUT) *data.__outbuf++ = '\0'; @@ -83,7 +88,7 @@ __wcrtomb (char *s, wchar_t wc, mbstate_t *ps) /* Do a normal conversion. */ const unsigned char *inbuf = (const unsigned char *) &wc; - status = DL_CALL_FCT (fcts->tomb->__fct, + status = DL_CALL_FCT (fct, (fcts->tomb, &data, &inbuf, inbuf + sizeof (wchar_t), NULL, &dummy, 0, 1)); } diff --git a/wcsmbs/wcsnrtombs.c b/wcsmbs/wcsnrtombs.c index 0252b7f..171fc3c 100644 --- a/wcsmbs/wcsnrtombs.c +++ b/wcsmbs/wcsnrtombs.c @@ -17,13 +17,14 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <assert.h> #include <dlfcn.h> #include <errno.h> #include <gconv.h> #include <wchar.h> #include <wcsmbsload.h> -#include <assert.h> +#include <sysdep.h> #ifndef EILSEQ # define EILSEQ EINVAL @@ -67,6 +68,11 @@ __wcsnrtombs (dst, src, nwc, len, ps) /* Get the structure with the function pointers. */ tomb = fcts->tomb; + __gconv_fct fct = tomb->__fct; +#ifdef PTR_DEMANGLE + if (tomb->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif /* We have to handle DST == NULL special. */ if (dst == NULL) @@ -82,10 +88,9 @@ __wcsnrtombs (dst, src, nwc, len, ps) { data.__outbuf = buf; - status = DL_CALL_FCT (tomb->__fct, - (tomb, &data, &inbuf, - (const unsigned char *) srcend, NULL, - &dummy, 0, 1)); + status = DL_CALL_FCT (fct, (tomb, &data, &inbuf, + (const unsigned char *) srcend, NULL, + &dummy, 0, 1)); /* Count the number of bytes. */ result += data.__outbuf - buf; @@ -107,10 +112,9 @@ __wcsnrtombs (dst, src, nwc, len, ps) data.__outbuf = (unsigned char *) dst; data.__outbufend = (unsigned char *) dst + len; - status = DL_CALL_FCT (tomb->__fct, - (tomb, &data, (const unsigned char **) src, - (const unsigned char *) srcend, NULL, - &dummy, 0, 1)); + status = DL_CALL_FCT (fct, (tomb, &data, (const unsigned char **) src, + (const unsigned char *) srcend, NULL, + &dummy, 0, 1)); /* Count the number of bytes. */ result = data.__outbuf - (unsigned char *) dst; diff --git a/wcsmbs/wcsrtombs.c b/wcsmbs/wcsrtombs.c index d41ca53..5973fd9 100644 --- a/wcsmbs/wcsrtombs.c +++ b/wcsmbs/wcsrtombs.c @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <assert.h> #include <dlfcn.h> #include <errno.h> #include <stdlib.h> @@ -24,7 +25,7 @@ #include <wchar.h> #include <wcsmbsload.h> -#include <assert.h> +#include <sysdep.h> #ifndef EILSEQ # define EILSEQ EINVAL @@ -59,6 +60,11 @@ __wcsrtombs (dst, src, len, ps) /* Get the structure with the function pointers. */ tomb = fcts->tomb; + __gconv_fct fct = tomb->__fct; +#ifdef PTR_DEMANGLE + if (tomb->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif /* We have to handle DST == NULL special. */ if (dst == NULL) @@ -79,10 +85,9 @@ __wcsrtombs (dst, src, len, ps) { data.__outbuf = buf; - status = DL_CALL_FCT (tomb->__fct, - (tomb, &data, &inbuf, - (const unsigned char *) srcend, NULL, - &dummy, 0, 1)); + status = DL_CALL_FCT (fct, (tomb, &data, &inbuf, + (const unsigned char *) srcend, NULL, + &dummy, 0, 1)); /* Count the number of bytes. */ result += data.__outbuf - buf; @@ -108,10 +113,9 @@ __wcsrtombs (dst, src, len, ps) data.__outbuf = (unsigned char *) dst; data.__outbufend = (unsigned char *) dst + len; - status = DL_CALL_FCT (tomb->__fct, - (tomb, &data, (const unsigned char **) src, - (const unsigned char *) srcend, NULL, - &dummy, 0, 1)); + status = DL_CALL_FCT (fct, (tomb, &data, (const unsigned char **) src, + (const unsigned char *) srcend, NULL, + &dummy, 0, 1)); /* Count the number of bytes. */ result = data.__outbuf - (unsigned char *) dst; diff --git a/wcsmbs/wctob.c b/wcsmbs/wctob.c index 0f24157..cbaac53 100644 --- a/wcsmbs/wctob.c +++ b/wcsmbs/wctob.c @@ -24,6 +24,8 @@ #include <wchar.h> #include <wcsmbsload.h> +#include <sysdep.h> + int wctob (c) @@ -64,7 +66,12 @@ wctob (c) inbuf[0] = c; const unsigned char *argptr = (const unsigned char *) inptr; - status = DL_CALL_FCT (fcts->tomb->__fct, + __gconv_fct fct = fcts->tomb->__fct; +#ifdef PTR_DEMANGLE + if (fcts->tomb->__shlib_handle != NULL) + PTR_DEMANGLE (fct); +#endif + status = DL_CALL_FCT (fct, (fcts->tomb, &data, &argptr, argptr + sizeof (inbuf[0]), NULL, &dummy, 0, 1)); |