]> git.lyx.org Git - lyx.git/blobdiff - src/support/unicode.cpp
Fix bug 9798.
[lyx.git] / src / support / unicode.cpp
index 187d018f2bc03da066e011483d6c3b0e21cff8cf..b5839827403ba688987636a2ebc523d5932a7902 100644 (file)
@@ -62,7 +62,14 @@ struct IconvProcessor::Handler {
 
 
 IconvProcessor::IconvProcessor(string tocode, string fromcode)
-       : tocode_(tocode), fromcode_(fromcode)
+       : tocode_(move(tocode)), fromcode_(move(fromcode))
+{}
+
+
+// for gcc 4.6
+IconvProcessor::IconvProcessor(IconvProcessor && other)
+       : tocode_(move(other.tocode_)), fromcode_(move(other.fromcode_)),
+         h_(move(other.h_))
 {}
 
 
@@ -125,23 +132,11 @@ int IconvProcessor::convert(char const * buf, size_t buflen,
                        lyxerr << "E2BIG  There is not sufficient room at *outbuf." << endl;
                        break;
                case EILSEQ:
-                       lyxerr << "EILSEQ An invalid multibyte sequence"
-                               << " has been encountered in the input.\n"
-                               << "When converting from " << fromcode_
-                               << " to " << tocode_ << ".\n";
-                       lyxerr << "Input:" << hex;
-                       for (size_t i = 0; i < buflen; ++i) {
-                               // char may be signed, avoid output of
-                               // something like 0xffffffc2
-                               boost::uint32_t const b =
-                                       *reinterpret_cast<unsigned char const *>(buf + i);
-                               lyxerr << " 0x" << (unsigned int)b;
-                       }
-                       lyxerr << dec << endl;
-                       break;
                case EINVAL:
-                       lyxerr << "EINVAL An incomplete multibyte sequence"
-                               << " has been encountered in the input.\n"
+                       lyxerr << (errno == EINVAL
+                                  ? "EINVAL An incomplete "
+                                  : "EILSEQ An invalid ")
+                               << "multibyte sequence has been encountered in the input.\n"
                                << "When converting from " << fromcode_
                                << " to " << tocode_ << ".\n";
                        lyxerr << "Input:" << hex;
@@ -198,7 +193,7 @@ iconv_convert(IconvProcessor & processor, InType const * buf, size_t buflen)
        return vector<RetType>(tmp, tmp + bytes / sizeof(RetType));
 }
 
-} // anon namespace
+} // namespace
 
 
 IconvProcessor & utf8ToUcs4()
@@ -269,7 +264,7 @@ IconvProcessor & getProc(map<string, IconvProcessor> & processors,
                return it->second;
 }
 
-} //anon namespace
+} // namespace
 
 
 vector<char>
@@ -318,7 +313,7 @@ map<string, IconvProcessor> & ucs4To8bitProcessors()
        return *processors.localData();
 }
 
-}
+} // namespace
 
 vector<char>
 ucs4_to_eightbit(char_type const * ucs4str, size_t ls, string const & encoding)