using std::endl;
-namespace {
-
#ifdef WORDS_BIGENDIAN
char const * ucs4_codeset = "UCS-4BE";
char const * ucs2_codeset = "UCS-2BE";
char const * ucs2_codeset = "UCS-2LE";
#endif
+namespace {
+
template<typename RetType, typename InType>
std::vector<RetType>
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);
<< " 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;
<< " 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;
//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));