stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r579018 - in /incubator/stdcxx/trunk/util: charmap.cpp charmap.h
Date Mon, 24 Sep 2007 23:40:26 GMT
Author: sebor
Date: Mon Sep 24 16:40:24 2007
New Revision: 579018

URL: http://svn.apache.org/viewvc?rev=579018&view=rev
Log:
2007-09-24  Martin Sebor  <sebor@roguewave.com>

	STDCXX-404
	* charmap.h (<iconv.h>): Removed a redundant _MSC_VER guard.
	(open_iconv_to_utf8, open_iconv_to_ext, ic_to_utf8_, ic_to_ext_):
	Guarded declarations with _RWSTD_NO_ICONV instead of _MSC_VER.
	* charmap.cpp (my_iconv_open): Guarded function definition with
	_RWSTD_NO_ICONV instead of _MSC_VER.
	(convert_to_utf8): Defined function unconditionally and guarded
	implementation with _RWSTD_NO_ICONV (defaulting to returning 0
	when the macro is #defined).
	(ic_to_utf8_, ic_to_ext_): Guarded the assignment of variables
	with _RWSTD_NO_ICONV.
	Guarded MSVC-specific behavior with _MSC_VER.

Modified:
    incubator/stdcxx/trunk/util/charmap.cpp
    incubator/stdcxx/trunk/util/charmap.h

Modified: incubator/stdcxx/trunk/util/charmap.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/charmap.cpp?rev=579018&r1=579017&r2=579018&view=diff
==============================================================================
--- incubator/stdcxx/trunk/util/charmap.cpp (original)
+++ incubator/stdcxx/trunk/util/charmap.cpp Mon Sep 24 16:40:24 2007
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2006 Rogue Wave Software.
+ * Copyright 2001-2007 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -73,7 +73,7 @@
 // the numeric values cannot be greater then 3 digits long
 #define MAX_BYTE_LEN 5
 
-#ifndef _MSC_VER
+#ifndef _RWSTD_NO_ICONV
 
 static iconv_t
 my_iconv_open (const char *to_codeset, const char *from_codeset)
@@ -163,7 +163,7 @@
 }
 
 #  endif   // _RWSTD_NO_ISO_10646_WCHAR_T
-#endif  // _MSC_VER
+#endif   // _RWSTD_NO_ICONV
 
 
 // utf8_decode translates the UTF-8 encoded character (specified
@@ -433,20 +433,21 @@
 }
 
 
-#ifndef _MSC_VER
 char* Charmap::convert_to_utf8 (const char *inbuf, size_t inbuf_s, 
                                 char *outbuf, size_t outbuf_s) const
 {
+#ifndef _RWSTD_NO_ICONV
+
     if (ic_to_utf8_ == iconv_t (-1))
         return 0;
 
     char* outbufp = outbuf;
 
-#ifndef _RWSTD_NO_ICONV_CONST_CHAR
+#  ifndef _RWSTD_NO_ICONV_CONST_CHAR
     const char* inbufp = inbuf;
-#else
+#  else
     char* inbufp = _RWSTD_CONST_CAST(char*, inbuf);
-#endif   // _RWSTD_NO_ICONV_CONST_CHAR
+#  endif   // _RWSTD_NO_ICONV_CONST_CHAR
     
     if (std::size_t (-1) == 
         iconv (ic_to_utf8_, &inbufp, &inbuf_s, &outbufp, &outbuf_s)) {
@@ -460,8 +461,15 @@
     }
 
     return outbufp;
+
+#else   // if defined (_RWSTD_NO_ICONV)
+
+    return 0;
+
+#endif   // _RWSTD_NO_ICONV
+
 }
-#endif  // _MSC_VER
+
 
 
 std::string Charmap::get_charmap_name () const
@@ -988,10 +996,10 @@
        reverse_maps (create_reverse_maps),
        UCS4_internal_ (use_UCS4)
 {
-#ifndef _MSC_VER
+#ifndef _RWSTD_NO_ICONV
     ic_to_utf8_ = 0;
     ic_to_ext_ = 0;
-#endif  // _MSC_VER
+#endif   // _RWSTD_NO_ICONV
 
     scanner_.open (fname, '#', '\\');
 
@@ -1020,21 +1028,26 @@
 
             // we always need a iconv to utf8 so that we can create
             // the utf8_charmap unless we are on windows
-#if !defined (_MSC_VER)
+#ifndef _RWSTD_NO_ICONV
             if (!in_utf8_) {
                 ic_to_utf8_ = open_iconv_to_utf8 ();
 #  if !defined (_RWSTD_NO_ISO_10646_WCHAR_T)
                 ic_to_ext_ = open_iconv_to_ext ();
 #  endif   // _RWSTD_NO_ISO_10646_WCHAR_T
             }
-#else
+
+#else   // if defined (_RWSTD_NO_ICONV)
+
+#  ifdef _MSC_VER
             codepage_ = get_codepage (code_set_name_);
             if (codepage_ == 0) {
                 issue_diag (W_ICONV, false, 0, 
                             "iconv_open (%s to UTF-8) failed\n",
                             code_set_name_.c_str());
             }
-#endif     // _MSC_VER
+
+#  endif   // _MSC_VER
+#endif   // _RWSTD_NO_ICONV
 
             scanner_.ignore_line ();
             break;

Modified: incubator/stdcxx/trunk/util/charmap.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/charmap.h?rev=579018&r1=579017&r2=579018&view=diff
==============================================================================
--- incubator/stdcxx/trunk/util/charmap.h (original)
+++ incubator/stdcxx/trunk/util/charmap.h Mon Sep 24 16:40:24 2007
@@ -22,24 +22,23 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2006 Rogue Wave Software.
+ * Copyright 2001-2007 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
 
-#ifndef _RWSTD_LOC_CHARMAP_H_INCLUDED
-#define _RWSTD_LOC_CHARMAP_H_INCLUDED
+#ifndef _RWSTD_CHARMAP_H_INCLUDED
+#define _RWSTD_CHARMAP_H_INCLUDED
 
 #include <string>
 #include <list>
 #include <map>
 #include <set>
 
-#ifndef _MSC_VER
-#  ifndef _RWSTD_NO_ICONV
-#    include <iconv.h>
-#  endif
-#endif  // _MSC_VER
+#ifndef _RWSTD_NO_ICONV
+#  include <iconv.h>
+#endif   // _RWSTD_NO_ICONV
+
 
 #include "scanner.h"
 
@@ -162,10 +161,10 @@
     // are defined in the character map
     void verify_portable_charset () const;
 
-#ifndef _MSC_VER
+#ifndef _RWSTD_NO_ICONV
     // open the iconv descriptor to convert to utf8
     iconv_t open_iconv_to_utf8 () const;
-#endif  // _MSC_VER
+#endif   // _RWSTD_NO_ICONV
 
     // convert a human-readable encoding of a character
     // to its raw multibyte character representation
@@ -175,13 +174,14 @@
     char* convert_to_utf8 (const char *inbuf, std::size_t inbuf_s, 
                            char *outbuf, std::size_t outbuf_s) const;
 
-#ifndef _MSC_VER
+#ifndef _RWSTD_NO_ICONV
 #  ifndef _RWSTD_NO_ISO_10646_WCHAR_T    
+
     // open the iconv descriptor to convert from utf8 to the external encoding
     iconv_t open_iconv_to_ext ();
 
 #  endif   // _RWSTD_NO_ISO_10646_WCHAR_T
-#endif  // _MSC_VER
+#endif   // _RWSTD_NO_ICONV
     
     // add the symbolic name of a character and the raw multibyte
     // character corresponding to it to the character maps
@@ -225,13 +225,13 @@
     // the number of bytes in the largest multi-byte value
     int mb_cur_max_;
 
-#ifndef _MSC_VER
+#ifndef _RWSTD_NO_ICONV
     // the iconv file descriptor that converts to utf8
     iconv_t ic_to_utf8_;
 
     // the iconv file descriptor that converts from utf8 to external
     iconv_t ic_to_ext_;
-#endif  // _MSC_VER
+#endif   // _RWSTD_NO_ICONV
 
     // the name of the character map file
     std::string charmap_name_;
@@ -260,5 +260,5 @@
 };
 
 
-#endif   // _RWSTD_LOC_CHARMAP_H_INCLUDED
+#endif   // _RWSTD_CHARMAP_H_INCLUDED
 



Mime
View raw message