diff options
author | Benjamin Kosnik <bkoz@redhat.com> | 2001-10-26 07:21:56 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2001-10-26 07:21:56 +0000 |
commit | 1a808622b6f1e5a0a3fc871d030e98b2bbfc2928 (patch) | |
tree | 2b93a1cf78aeb7ca12e959d919d1e05844e4518e | |
parent | f8c8c2ff39d06198f6f98bd2c436abe44f1bebcc (diff) | |
download | gcc-1a808622b6f1e5a0a3fc871d030e98b2bbfc2928.zip gcc-1a808622b6f1e5a0a3fc871d030e98b2bbfc2928.tar.gz gcc-1a808622b6f1e5a0a3fc871d030e98b2bbfc2928.tar.bz2 |
2001-10-26 Benjamin Kosnik <bkoz@redhat.com>
libstdc++/4503
* config/locale/codecvt_specializations_ieee_1003.1-200x.h
(__enc_traits::~__enc_traits): Fix.
(__enc_traits::_M_init): Add error checking.
From-SVN: r46532
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/config/locale/codecvt_specializations_ieee_1003.1-200x.h | 25 |
2 files changed, 22 insertions, 10 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 51dccc9..80c5c9d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2001-10-26 Benjamin Kosnik <bkoz@redhat.com> + + libstdc++/4503 + * config/locale/codecvt_specializations_ieee_1003.1-200x.h + (__enc_traits::~__enc_traits): Fix. + (__enc_traits::_M_init): Add error checking. + 2001-10-25 Benjamin Kosnik <bkoz@redhat.com> libstdc++/4542 diff --git a/libstdc++-v3/config/locale/codecvt_specializations_ieee_1003.1-200x.h b/libstdc++-v3/config/locale/codecvt_specializations_ieee_1003.1-200x.h index 3fe261c..3cf9fef 100644 --- a/libstdc++-v3/config/locale/codecvt_specializations_ieee_1003.1-200x.h +++ b/libstdc++-v3/config/locale/codecvt_specializations_ieee_1003.1-200x.h @@ -85,7 +85,7 @@ : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(0), _M_int_bom(0) { // __intc_end = whatever we are using internally, which is - // UCS4 (linux) + // UCS4 (linux, solaris) // UCS2 == UNICODE (microsoft, java, aix, whatever...) // XXX Currently don't know how to get this data from target system... strcpy(_M_int_enc, "UCS4"); @@ -121,27 +121,32 @@ ~__enc_traits() { - iconv_close(_M_in_desc); - iconv_close(_M_out_desc); + __desc_type __err = reinterpret_cast<iconv_t>(-1); + if (_M_in_desc && _M_in_desc != __err) + iconv_close(_M_in_desc); + if (_M_out_desc && _M_out_desc != __err) + iconv_close(_M_out_desc); } - // Initializes void _M_init() { + __desc_type __err = reinterpret_cast<iconv_t>(-1); _M_in_desc = iconv_open(_M_int_enc, _M_ext_enc); + if (_M_in_desc == __err) + __throw_runtime_error("creating iconv input descriptor failed."); _M_out_desc = iconv_open(_M_ext_enc, _M_int_enc); - if (_M_out_desc == iconv_t(-1) || _M_in_desc == iconv_t(-1)) - { - // XXX Extended error checking. - } + if (_M_out_desc == __err) + __throw_runtime_error("creating iconv output descriptor failed."); } bool _M_good() { - return _M_out_desc && _M_in_desc - && _M_out_desc != iconv_t(-1) && _M_in_desc != iconv_t(-1); + __desc_type __err = reinterpret_cast<iconv_t>(-1); + bool __test = _M_in_desc && _M_in_desc != __err; + __test &= _M_out_desc && _M_out_desc != __err; + return __test; } const __desc_type* |