From: <man...@us...> - 2015-04-24 17:31:49
|
Revision: 4984 http://sourceforge.net/p/modplug/code/4984 Author: manxorist Date: 2015-04-24 17:31:36 +0000 (Fri, 24 Apr 2015) Log Message: ----------- [Ref] UNICODE build support in soundlib/plugins/PluginManager.cpp. Modified Paths: -------------- trunk/OpenMPT/mptrack/MPTrackUtil.cpp trunk/OpenMPT/mptrack/MPTrackUtil.h trunk/OpenMPT/soundlib/plugins/PluginManager.cpp Modified: trunk/OpenMPT/mptrack/MPTrackUtil.cpp =================================================================== --- trunk/OpenMPT/mptrack/MPTrackUtil.cpp 2015-04-24 16:44:05 UTC (rev 4983) +++ trunk/OpenMPT/mptrack/MPTrackUtil.cpp 2015-04-24 17:31:36 UTC (rev 4984) @@ -49,10 +49,10 @@ // Returns WinAPI error message corresponding to error code returned by GetLastError(). -std::string GetErrorMessage(DWORD nErrorCode) -//------------------------------------------- +CString GetErrorMessage(DWORD nErrorCode) +//--------------------------------------- { - LPVOID lpMsgBuf; + LPTSTR lpMsgBuf = NULL; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, @@ -62,7 +62,7 @@ 0, NULL ); - std::string msg = (LPTSTR)lpMsgBuf; + CString msg = lpMsgBuf; LocalFree(lpMsgBuf); return msg; Modified: trunk/OpenMPT/mptrack/MPTrackUtil.h =================================================================== --- trunk/OpenMPT/mptrack/MPTrackUtil.h 2015-04-24 16:44:05 UTC (rev 4983) +++ trunk/OpenMPT/mptrack/MPTrackUtil.h 2015-04-24 17:31:36 UTC (rev 4984) @@ -19,7 +19,7 @@ LPCCH LoadResource(LPCTSTR lpName, LPCTSTR lpType, LPCCH& pData, size_t& nSize, HGLOBAL& hglob); -std::string GetErrorMessage(DWORD nErrorCode); +CString GetErrorMessage(DWORD nErrorCode); namespace Util { Modified: trunk/OpenMPT/soundlib/plugins/PluginManager.cpp =================================================================== --- trunk/OpenMPT/soundlib/plugins/PluginManager.cpp 2015-04-24 16:44:05 UTC (rev 4983) +++ trunk/OpenMPT/soundlib/plugins/PluginManager.cpp 2015-04-24 17:31:36 UTC (rev 4984) @@ -247,9 +247,11 @@ #ifdef _DEBUG if(error != ERROR_MOD_NOT_FOUND) // "File not found errors" are annoying. { - TCHAR szBuf[256]; - wsprintf(szBuf, "Warning: encountered problem when loading plugin dll. Error %x: %s", error, GetErrorMessage(error).c_str()); - Reporting::Error(szBuf, "DEBUG: Error when loading plugin dll"); + mpt::ustring buf = mpt::String::Print(MPT_USTRING("Warning: encountered problem when loading plugin dll. Error %1: %2") + , mpt::ufmt::hex(error) + , mpt::ToUnicode(GetErrorMessage(error)) + ); + Reporting::Error(buf, "DEBUG: Error when loading plugin dll"); } #endif //_DEBUG This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |