diff -r e1b950c65cb4 -r 837f303aceeb epoc32/include/stdapis/stlportv5/stl/_ios.c --- a/epoc32/include/stdapis/stlportv5/stl/_ios.c Wed Mar 31 12:27:01 2010 +0100 +++ b/epoc32/include/stdapis/stlportv5/stl/_ios.c Wed Mar 31 12:33:34 2010 +0100 @@ -1,21 +1,22 @@ /* - * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved. + * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + * * Copyright (c) 1999 * Silicon Graphics Computer Systems, Inc. * - * Copyright (c) 1999 + * Copyright (c) 1999 * Boris Fomitchev * * This material is provided "as is", with absolutely no warranty expressed * or implied. Any use is at your own risk. * - * Permission to use or copy this software for any purpose is hereby granted + * Permission to use or copy this software for any purpose is hereby granted * without fee, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * - */ + */ #ifndef _STLP_IOS_C #define _STLP_IOS_C @@ -23,8 +24,6 @@ # include #endif -#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) - #ifndef _STLP_INTERNAL_STREAMBUF # include #endif @@ -42,15 +41,13 @@ basic_ios<_CharT, _Traits> ::basic_ios(basic_streambuf<_CharT, _Traits>* __streambuf) : ios_base(), - _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0) -{ - init(__streambuf); + _M_fill(_STLP_NULL_CHAR_INIT(_CharT)), _M_streambuf(0), _M_tied_ostream(0) { + basic_ios<_CharT, _Traits>::init(__streambuf); } template basic_streambuf<_CharT, _Traits>* -basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __buf) -{ +basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __buf) { basic_streambuf<_CharT, _Traits>* __tmp = _M_streambuf; _M_streambuf = __buf; this->clear(); @@ -59,38 +56,42 @@ template basic_ios<_CharT, _Traits>& -basic_ios<_CharT, _Traits>::copyfmt(const basic_ios<_CharT, _Traits>& __x) -{ +basic_ios<_CharT, _Traits>::copyfmt(const basic_ios<_CharT, _Traits>& __x) { _M_invoke_callbacks(erase_event); _M_copy_state(__x); // Inherited from ios_base. _M_fill = __x._M_fill; _M_tied_ostream = __x._M_tied_ostream; _M_invoke_callbacks(copyfmt_event); - // this->_M_set_exception_mask(__x.exceptions()); //Exceptions should copy not simply set. should throw exception if mask&state ==1 ,while copying exception. - this->exceptions(__x.exceptions()); + this->_M_set_exception_mask(__x.exceptions()); return *this; } -//#ifndef __SYMBIAN32__ // Moved to src +#if defined(__SYMBIAN32__WSD__) || defined (__SYMBIAN32__NO_STATIC_IMPORTS__) +#define id GetFacetLocaleId() +#endif + template -locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) -{ +locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) { locale __tmp = ios_base::imbue(__loc); + _STLP_TRY { + if (_M_streambuf) + _M_streambuf->pubimbue(__loc); - if (_M_streambuf) - _M_streambuf->pubimbue(__loc); - - // no throwing here -#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_) - this->_M_cached_ctype = __loc._M_get_facet(ctype::GetFacetLocaleId()) ; - this->_M_cached_numpunct = __loc._M_get_facet(numpunct::GetFacetLocaleId()) ; -#else - this->_M_cached_ctype = __loc._M_get_facet(ctype::id) ; - this->_M_cached_numpunct = __loc._M_get_facet(numpunct::id) ; -#endif //__LIBSTD_CPP_SYMBIAN32_WSD__ - this->_M_cached_grouping = ((numpunct*)_M_cached_numpunct)->grouping() ; + // no throwing here + this->_M_cached_ctype = __loc._M_get_facet(ctype::id); + this->_M_cached_numpunct = __loc._M_get_facet(numpunct::id); + this->_M_cached_grouping = ((numpunct*)_M_cached_numpunct)->grouping(); + } + _STLP_CATCH_ALL { + __tmp = ios_base::imbue(__tmp); + _M_handle_exception(ios_base::failbit); + } return __tmp; } -//#endif // __SYMBIAN32__ +#if defined(__SYMBIAN32__WSD__) || defined (__SYMBIAN32__NO_STATIC_IMPORTS__) +#undef id +#endif + + // Protected constructor and initialization functions. The default // constructor creates an uninitialized basic_ios, and init() initializes // all of the members to the values in Table 89 of the C++ standard. @@ -109,7 +110,17 @@ this->imbue(locale()); this->tie(0); this->_M_set_exception_mask(ios_base::goodbit); - this->_M_clear_nothrow(__sb != 0 ? ios_base::goodbit : ios_base::badbit); + /* + this->_M_clear_nothrow(__sb != 0 ? ios_base::goodbit : ios_base::badbit); + + The ternary expression above, throws an undefined reference link error (for goodbit and badbit) + when compiled with GCCE 4.3.2. Replacing ternary statement with an if-else block fixes this. + */ + if(__sb != 0) { + this->_M_clear_nothrow(ios_base::goodbit); + } else { + this->_M_clear_nothrow(ios_base::badbit); + } ios_base::flags(ios_base::skipws | ios_base::dec); ios_base::width(0); ios_base::precision(6); @@ -129,6 +140,8 @@ _STLP_END_NAMESPACE -#endif /* defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) */ +#endif /* _STLP_IOS_C */ -#endif /* _STLP_IOS_C */ +// Local Variables: +// mode:C++ +// End: