diff options
author | Chris Robinson <[email protected]> | 2019-08-11 18:50:07 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-08-11 18:50:07 -0700 |
commit | e200569cd319448d12099f27a2713c69da382d26 (patch) | |
tree | 5475e5aa20505bd403b46053321dd2d6a019ac5d /common/dynload.cpp | |
parent | 7118733458bc388a900677da6e0d4e4244d0f536 (diff) |
Move the wstr converters to a separate header
Diffstat (limited to 'common/dynload.cpp')
-rw-r--r-- | common/dynload.cpp | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/common/dynload.cpp b/common/dynload.cpp index 89824f78..98d2c521 100644 --- a/common/dynload.cpp +++ b/common/dynload.cpp @@ -3,29 +3,10 @@ #include "dynload.h" +#include "strutils.h" #ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include <windows.h> - -#include <string> - -inline std::wstring utf8_to_wstr(const char *str) -{ - std::wstring ret; - - int len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0); - if(len > 0) - { - ret.resize(len); - MultiByteToWideChar(CP_UTF8, 0, str, -1, &ret[0], len); - ret.pop_back(); - } - - return ret; -} - void *LoadLib(const char *name) { std::wstring wname{utf8_to_wstr(name)}; |