stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r370553 - /incubator/stdcxx/trunk/src/wcodecvt.cpp
Date Thu, 19 Jan 2006 17:48:09 GMT
Author: sebor
Date: Thu Jan 19 09:48:03 2006
New Revision: 370553

URL: http://svn.apache.org/viewcvs?rev=370553&view=rev
Log:
2006-01-19  Martin Sebor  <sebor@roguewave.com>

	* wcodecvt.cpp [_RWSTD_NO_MBTOWC] (mbtowc): Declared when not
	declared in <stdlib.h> but known to be defined in the libc binary.
	(do_in, do_out, do_length): Guarded references to mbtowc() with
	_RWSTD_NO_MBTOWC.
	[_RWSTD_NO_MBRLEN && _RWSTD_NO_MBLEN] (__rw_libc_mbrlen): Silenced
	an unused variable warning.
	(do_unshift): Removed an unnecessary scope resolution operator
	from a call to mbtowc().

Modified:
    incubator/stdcxx/trunk/src/wcodecvt.cpp

Modified: incubator/stdcxx/trunk/src/wcodecvt.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/src/wcodecvt.cpp?rev=370553&r1=370552&r2=370553&view=diff
==============================================================================
--- incubator/stdcxx/trunk/src/wcodecvt.cpp (original)
+++ incubator/stdcxx/trunk/src/wcodecvt.cpp Thu Jan 19 09:48:03 2006
@@ -40,7 +40,7 @@
 #include <wchar.h>
 #include <limits.h>
 #include <locale.h>
-#include <stdlib.h>   // for MB_CUR_MAX, mblen()
+#include <stdlib.h>   // for MB_CUR_MAX, mblen(), mbtowc()
 #include <string.h>   // for memcmp()
 #include <errno.h>
 
@@ -85,6 +85,18 @@
 #endif   // _RWSTD_NO_MBLEN && !_RWSTD_NO_MBLEN_IN_LIBC
 
 
+// declare mbtowc() if it's not declared in the system headers
+// but is known to be defined in the libc binary
+#if defined (_RWSTD_NO_MBTOWC) && !defined (_RWSTD_NO_MBTOWC_IN_LIBC)
+
+#  undef _RWSTD_NO_MBTOWC
+
+extern "C" int
+mbtowc (wchar_t*, const char*, _RWSTD_SIZE_T) _LIBC_THROWS();
+
+#endif   // _RWSTD_NO_MBTOWC && !_RWSTD_NO_MBTOWC_IN_LIBC
+
+
 // declare wcsrtombs() if it's not declared in the system headers
 // but is known to be defined in the libc binary
 #if defined (_RWSTD_NO_WCSRTOMBS) && !defined (_RWSTD_NO_WCSRTOMBS_IN_LIBC)
@@ -248,6 +260,8 @@
 
 #else   // if defined (_RWSTD_NO_MBLEN)
 
+    _RWSTD_UNUSED (state);
+
     // this is bogus but it's the best we can do given the absence
     // of libc support for this functionality (more likely than not,
     // this code will never end up getting executed because we'll
@@ -1269,7 +1283,7 @@
     if (_RW::stateless == (_C_flags & 0xf)) {
         const _RW::__rw_setlocale clocale (_C_name, LC_CTYPE);
 
-        _C_flags =mbtowc (0, 0, 0) ? _RW::stateful : _RW::stateless;
+        _C_flags = mbtowc (0, 0, 0) ? _RW::stateful : _RW::stateless;
     }
 
 #endif   // 0/1
@@ -1423,14 +1437,18 @@
             // use libc locale
             const _RW::__rw_setlocale clocale (_C_name, LC_CTYPE);
 
+#ifndef _RWSTD_NO_MBTOWC
+
             // verify that either the encoding is stateful
             // or the state is in its initial shift state
             const bool mbstate_valid =
                mbtowc (0, 0, 0) || _RW::__rw_mbsinit (&state);
-            _RWSTD_ASSERT (mbstate_valid);
 
+            _RWSTD_ASSERT (mbstate_valid);
             _RWSTD_UNUSED (mbstate_valid);
 
+#endif   // _RWSTD_NO_MBTOWC
+
             res = _RW::__rw_libc_do_in (state, 
                                         from, from_end, from_next,
                                         to, to_limit, to_next);
@@ -1508,14 +1526,17 @@
             // use libc locale
             const _RW::__rw_setlocale clocale (_C_name, LC_CTYPE);
 
+#ifndef _RWSTD_NO_MBTOWC
+
             // verify that either the encoding is stateful
             // or the state is in its initial shift state
             const bool mbstate_valid =
                mbtowc (0, 0, 0) || _RW::__rw_mbsinit (&state);
-            _RWSTD_ASSERT (mbstate_valid);
 
+            _RWSTD_ASSERT (mbstate_valid);
             _RWSTD_UNUSED (mbstate_valid);
 
+#endif   // _RWSTD_NO_MBTOWC
             
             res = _RW::__rw_libc_do_out (state, from, from_end, from_next,
                                          to, to_limit, to_next);
@@ -1579,7 +1600,7 @@
 
             const _RW::__rw_setlocale clocale (_C_name, LC_CTYPE);
             
-            if (::mbtowc (0, 0, 0) == 0) {
+            if (mbtowc (0, 0, 0) == 0) {
                 // verify that the state is in its initial shift state
                 const int mbstate_valid = _RW::__rw_mbsinit (&state);
                 _RWSTD_ASSERT (mbstate_valid);
@@ -1644,13 +1665,17 @@
             // use libc locale
             const _RW::__rw_setlocale clocale (this->_C_name, LC_CTYPE);
 
+#ifndef _RWSTD_NO_MBTOWC
+
             // verify that either the encoding is stateful
             // or the state is in its initial shift state
             const bool mbstate_valid =
                 mbtowc (0, 0, 0) || _RW::__rw_mbsinit (&state);
-            _RWSTD_ASSERT (mbstate_valid);
 
+            _RWSTD_ASSERT (mbstate_valid);
             _RWSTD_UNUSED (mbstate_valid);
+
+#endif   // _RWSTD_NO_MBTOWC
 
             len = _RW::__rw_libc_do_length (state, from, from_end, cmax);
         }



Mime
View raw message