Eliminate pointless UTF-8 -> utf-8 conversion

This commit is contained in:
Thomas Goyne 2013-06-09 07:37:05 -07:00
parent 51d083fe70
commit ef2a39fc7b
1 changed files with 3 additions and 2 deletions

View File

@ -23,6 +23,7 @@
#include <sstream> #include <sstream>
#include <cstdint> #include <cstdint>
#include <boost/algorithm/string/case_conv.hpp>
#include <libaegisub/charset_conv.h> #include <libaegisub/charset_conv.h>
@ -70,14 +71,14 @@ public:
, lf(0) , lf(0)
, width(0) , width(0)
{ {
boost::to_lower(encoding);
agi::charset::IconvWrapper c("utf-8", encoding.c_str()); agi::charset::IconvWrapper c("utf-8", encoding.c_str());
c.Convert("\r", 1, reinterpret_cast<char *>(&cr), sizeof(int)); c.Convert("\r", 1, reinterpret_cast<char *>(&cr), sizeof(int));
c.Convert("\n", 1, reinterpret_cast<char *>(&lf), sizeof(int)); c.Convert("\n", 1, reinterpret_cast<char *>(&lf), sizeof(int));
width = c.RequiredBufferSize("\n"); width = c.RequiredBufferSize("\n");
if (encoding != "utf-8") { if (encoding != "utf-8")
conv.reset(new agi::charset::IconvWrapper(encoding.c_str(), "utf-8")); conv.reset(new agi::charset::IconvWrapper(encoding.c_str(), "utf-8"));
}
init(); init();
++(*this); ++(*this);
} }