diff options
Diffstat (limited to 'plugins/TipperYM/src/str_utils.cpp')
-rw-r--r-- | plugins/TipperYM/src/str_utils.cpp | 126 |
1 files changed, 2 insertions, 124 deletions
diff --git a/plugins/TipperYM/src/str_utils.cpp b/plugins/TipperYM/src/str_utils.cpp index b15abbf5fc..4c2f05ab54 100644 --- a/plugins/TipperYM/src/str_utils.cpp +++ b/plugins/TipperYM/src/str_utils.cpp @@ -50,7 +50,7 @@ bool a2utf(const char *as, char *buff, int bufflen) {
if (!as) return false;
- wchar_t *ws = a2w(as);
+ wchar_t *ws = mir_a2u(as);
if (ws) WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, bufflen, nullptr, nullptr);
mir_free(ws);
return true;
@@ -60,134 +60,12 @@ bool utf2a(const char *us, char *buff, int bufflen) {
if (!us) return false;
- wchar_t *ws = utf2w(us);
+ wchar_t *ws = mir_utf8decodeW(us);
if (ws) WideCharToMultiByte(iCodePage, 0, ws, -1, buff, bufflen, nullptr, nullptr);
mir_free(ws);
return true;
}
-
-bool t2w(const wchar_t *ts, wchar_t *buff, int bufflen)
-{
- wcsncpy(buff, ts, bufflen);
- return true;
-}
-
-bool w2t(const wchar_t *ws, wchar_t *buff, int bufflen)
-{
- wcsncpy(buff, ws, bufflen);
- return true;
-}
-
-bool t2a(const wchar_t *ts, char *buff, int bufflen)
-{
- return w2a(ts, buff, bufflen);
-}
-
-bool a2t(const char *as, wchar_t *buff, int bufflen)
-{
- return a2w(as, buff, bufflen);
-}
-
-bool t2utf(const wchar_t *ts, char *buff, int bufflen)
-{
- return w2utf(ts, buff, bufflen);
-}
-
-bool utf2t(const char *us, wchar_t *buff, int bufflen)
-{
- return utf2w(us, buff, bufflen);
-}
-
-wchar_t *utf2w(const char *us)
-{
- if (us) {
- int size = MultiByteToWideChar(CP_UTF8, 0, us, -1, nullptr, 0);
- wchar_t *buff = (wchar_t *)mir_alloc(size * sizeof(wchar_t));
- MultiByteToWideChar(CP_UTF8, 0, us, -1, buff, size);
- return buff;
- }
- else {
- return nullptr;
- }
-}
-
-char *w2utf(const wchar_t *ws)
-{
- if (ws) {
- int size = WideCharToMultiByte(CP_UTF8, 0, ws, -1, nullptr, 0, nullptr, nullptr);
- char *buff = (char *)mir_alloc(size);
- WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, size, nullptr, nullptr);
- return buff;
- }
- else {
- return nullptr;
- }
-}
-
-wchar_t *a2w(const char *as)
-{
- int size = MultiByteToWideChar(iCodePage, 0, as, -1, nullptr, 0);
- wchar_t *buff = (wchar_t *)mir_alloc(size * sizeof(wchar_t));
- MultiByteToWideChar(iCodePage, 0, as, -1, buff, size);
- return buff;
-}
-
-char *w2a(const wchar_t *ws)
-{
- int size = WideCharToMultiByte(iCodePage, 0, ws, -1, nullptr, 0, nullptr, nullptr);
- char *buff = (char *)mir_alloc(size);
- WideCharToMultiByte(iCodePage, 0, ws, -1, buff, size, nullptr, nullptr);
- return buff;
-}
-
-char *utf2a(const char *utfs)
-{
- wchar_t *ws = utf2w(utfs);
- char *ret = w2a(ws);
- mir_free(ws);
- return ret;
-}
-
-char *a2utf(const char *as)
-{
- wchar_t *ws = a2w(as);
- char *ret = w2utf(ws);
- mir_free(ws);
- return ret;
-}
-
-wchar_t *w2t(const wchar_t *ws)
-{
- return mir_wstrdup(ws);
-}
-
-wchar_t *t2w(const wchar_t *ts)
-{
- return mir_wstrdup(ts);
-}
-
-
-char *t2a(const wchar_t *ts)
-{
- return w2a(ts);
-}
-
-wchar_t *a2t(const char *as)
-{
- return a2w(as);
-}
-
-wchar_t *utf2t(const char *utfs)
-{
- return utf2w(utfs);
-}
-
-char *t2utf(const wchar_t *ts)
-{
- return w2utf(ts);
-}
-
wchar_t *myfgets(wchar_t *Buf, int MaxCount, FILE *File)
{
fgetws(Buf, MaxCount, File);
|