]> git.lyx.org Git - lyx.git/blobdiff - src/support/unicode.C
MacOSX compile fix.
[lyx.git] / src / support / unicode.C
index 4f4cf27980b8fb0a3f5f841bc7614b4df896f370..1545e2ddc01b19e0bf9609ec751c9d208e8b6b8c 100644 (file)
@@ -23,8 +23,6 @@
 
 using std::endl;
 
-namespace {
-
 #ifdef WORDS_BIGENDIAN
        char const * ucs4_codeset = "UCS-4BE";
        char const * ucs2_codeset = "UCS-2BE";
@@ -33,6 +31,8 @@ namespace {
        char const * ucs2_codeset = "UCS-2LE";
 #endif
 
+namespace {
+
 template<typename RetType, typename InType>
 std::vector<RetType>
 iconv_convert(iconv_t * cd,
@@ -64,9 +64,10 @@ iconv_convert(iconv_t * cd,
 
        char ICONV_CONST * inbuf = const_cast<char ICONV_CONST *>(reinterpret_cast<char const *>(buf));
        size_t inbytesleft = buflen * sizeof(InType);
-       static char out[1000];
+       size_t const outsize = 1000;
+       static char out[outsize];
        char * outbuf = out;
-       size_t outbytesleft = 1000;
+       size_t outbytesleft = outsize;
 
        size_t res = iconv(*cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
 
@@ -83,8 +84,8 @@ iconv_convert(iconv_t * cd,
                               << " to " << tocode << ".\n";
                        lyxerr << "Input: " << std::hex;
                        for (size_t i = 0; i < buflen; ++i) {
-                               unsigned char const b = buf[i];
-                               lyxerr << "0x" << int(b) << " ";
+                               boost::uint32_t const b = buf[i];
+                               lyxerr << "0x" << b << " ";
                        }
                        lyxerr << endl;
                        break;
@@ -95,8 +96,8 @@ iconv_convert(iconv_t * cd,
                               << " to " << tocode << ".\n";
                        lyxerr << "Input: " << std::hex;
                        for (size_t i = 0; i < buflen; ++i) {
-                               unsigned char const b = buf[i];
-                               lyxerr << "0x" << int(b) << " ";
+                               boost::uint32_t const b = buf[i];
+                               lyxerr << "0x" << b << " ";
                        }
                        lyxerr << endl;
                        break;
@@ -115,7 +116,7 @@ iconv_convert(iconv_t * cd,
        //lyxerr << std::dec;
        //lyxerr << "Inbytesleft: " << inbytesleft << endl;
        //lyxerr << "Outbytesleft: " << outbytesleft << endl;
-       int bytes = 1000 - outbytesleft;
+       int bytes = outsize - outbytesleft;
 
        RetType const * tmp = reinterpret_cast<RetType const *>(out);
        return std::vector<RetType>(tmp, tmp + bytes / sizeof(RetType));