diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-07-27 08:29:06 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-07-27 08:29:06 +0000 |
commit | 129d706d77587e4d6627cc1ebef9be0f7cbc65f0 (patch) | |
tree | 219bd622277bf2262d16cd4fd0400bd1ef7aea7e /libio/iofwide.c | |
parent | 6a904bbfc610f98ee2f467844434117a7bca5982 (diff) | |
download | glibc-129d706d77587e4d6627cc1ebef9be0f7cbc65f0.tar.gz glibc-129d706d77587e4d6627cc1ebef9be0f7cbc65f0.tar.xz glibc-129d706d77587e4d6627cc1ebef9be0f7cbc65f0.zip |
Update.
* libio/fileops.c (_IO_new_file_fopen): Correctly locate ccs= substring. Don't handle ccs= if no descriptor was allocated. Normalize codeset name before calling __wcsmbs_named_conv. Initialize transliteration elements. Free step data structure. * libio/iofclose.c (_IO_new_fclose): Correct freeing of the step data. * libio/iofwide.c (__libio_translit): Renamed from libio_translit and made public. Various little cleanup changes. * wcsmbs/wcsmbsload.h (struct gconv_fcts): Add towc_nsteps and tomb_nsteps member. * wcsmbs/wcsmbsload.c: Add some casts to avoid warnings. (__wcsmbs_gconv_fcts): Initialize towc_nsteps and tomb_nsteps member. (getfct): Take additional parameter with pointer to variable where the number of steps is stored in. Disable code which allows to use more than one step for now. Adjust all callers. (free_mem): New function. Frees data associated with currently selected converters.
Diffstat (limited to 'libio/iofwide.c')
-rw-r--r-- | libio/iofwide.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/libio/iofwide.c b/libio/iofwide.c index d191baaf99..aa314fe671 100644 --- a/libio/iofwide.c +++ b/libio/iofwide.c @@ -30,6 +30,7 @@ # include <dlfcn.h> # include <wchar.h> #endif +#include <assert.h> #include <stdlib.h> #include <string.h> @@ -81,7 +82,7 @@ struct _IO_codecvt __libio_codecvt = #ifdef _LIBC -static struct __gconv_trans_data libio_translit = +struct __gconv_trans_data __libio_translit = { .__trans_fct = __gconv_transliterate }; @@ -134,11 +135,13 @@ _IO_fwide (fp, mode) memset (&fp->_wide_data->_IO_last_state, '\0', sizeof (__mbstate_t)); __wcsmbs_clone_conv (&fcts); + assert (fcts.towc_nsteps == 1); + assert (fcts.tomb_nsteps == 1); /* The functions are always the same. */ *cc = __libio_codecvt; - cc->__cd_in.__cd.__nsteps = 1; /* Only one step allowed. */ + cc->__cd_in.__cd.__nsteps = fcts.towc_nsteps; cc->__cd_in.__cd.__steps = fcts.towc; cc->__cd_in.__cd.__data[0].__invocation_counter = 0; @@ -149,7 +152,7 @@ _IO_fwide (fp, mode) /* XXX For now no transliteration. */ cc->__cd_in.__cd.__data[0].__trans = NULL; - cc->__cd_out.__cd.__nsteps = 1; /* Only one step allowed. */ + cc->__cd_out.__cd.__nsteps = fcts.tomb_nsteps; cc->__cd_out.__cd.__steps = fcts.tomb; cc->__cd_out.__cd.__data[0].__invocation_counter = 0; @@ -158,11 +161,7 @@ _IO_fwide (fp, mode) cc->__cd_out.__cd.__data[0].__statep = &fp->_wide_data->_IO_state; /* And now the transliteration. */ -#ifdef _LIBC - cc->__cd_out.__cd.__data[0].__trans = &libio_translit; -#else - cc->__cd_out.__cd.__data[0].__trans = NULL; -#endif + cc->__cd_out.__cd.__data[0].__trans = &__libio_translit; } #else # ifdef _GLIBCPP_USE_WCHAR_T @@ -188,8 +187,12 @@ _IO_fwide (fp, mode) cc->__cd_out = iconv_open (external_ccs, internal_ccs); if (cc->__cd_in == (iconv_t) -1 || cc->__cd_out == (iconv_t) -1) - /* XXX */ - abort (); + { + if (cc->__cd_in != (iconv_t) -1) + iconv_close (cc->__cd_in); + /* XXX */ + abort (); + } } # else # error "somehow determine this from LC_CTYPE" |