Win-specific: Update OpenCC library

This commit is contained in:
Abs62 2016-10-27 17:52:55 +03:00
parent 249db51e86
commit c689487614
5 changed files with 10 additions and 8 deletions

View file

@ -140,11 +140,11 @@ public:
size_t NumValues() const { return values.size(); }
vector<const char*> Values() const {
vector<const char*> values;
vector<const char*> retsult;
for (const string& value : this->values) {
values.push_back(value.c_str());
retsult.push_back(value.c_str());
}
return values;
return retsult;
}
private:

View file

@ -32,7 +32,7 @@
namespace opencc {
class OPENCC_EXPORT Exception : public std::exception {
class OPENCC_EXPORT Exception {
public:
Exception() {}

View file

@ -262,20 +262,22 @@ public:
#ifdef _MSC_VER
static std::string U16ToU8(const std::wstring& wstr) {
std::string ret;
int convcnt = WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), wstr.length(), NULL, 0, NULL, NULL);
int length = static_cast<int>(wstr.length());
int convcnt = WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), length, NULL, 0, NULL, NULL);
if (convcnt > 0) {
ret.resize(convcnt);
WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), wstr.length(), &ret[0], convcnt, NULL, NULL);
WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), length, &ret[0], convcnt, NULL, NULL);
}
return ret;
}
static std::wstring U8ToU16(const std::string& str) {
std::wstring ret;
int convcnt = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), NULL, 0);
int length = static_cast<int>(str.length());
int convcnt = MultiByteToWideChar(CP_UTF8, 0, str.c_str(), length, NULL, 0);
if (convcnt > 0) {
ret.resize(convcnt);
MultiByteToWideChar(CP_UTF8, 0, str.c_str(), str.length(), &ret[0], convcnt);
MultiByteToWideChar(CP_UTF8, 0, str.c_str(), length, &ret[0], convcnt);
}
return ret;
}

Binary file not shown.

Binary file not shown.