From: Guillaume Munch Date: Thu, 23 Jun 2016 21:07:13 +0000 (+0100) Subject: Use move when passed by value X-Git-Tag: 2.3.0alpha1~1392 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=7d456a93e411ad5b6185d7342e213bfe442c0252;p=lyx.git Use move when passed by value Also unduplicate code. --- diff --git a/src/support/unicode.cpp b/src/support/unicode.cpp index adec55299c..2620ddb5e4 100644 --- a/src/support/unicode.cpp +++ b/src/support/unicode.cpp @@ -62,7 +62,7 @@ struct IconvProcessor::Handler { IconvProcessor::IconvProcessor(string tocode, string fromcode) - : tocode_(tocode), fromcode_(fromcode) + : tocode_(move(tocode)), fromcode_(move(fromcode)) {} @@ -132,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(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;