Skip to content

Commit

Permalink
Merge pull request #5103 from FernetMenta/wasapi
Browse files Browse the repository at this point in the history
WASAPI: fix empty audio device in settings dialog after c401513...
  • Loading branch information
FernetMenta committed Jul 27, 2014
2 parents fd3f618 + ec8d306 commit 8975e83
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,14 @@ std::string localWideToUtf(LPCWSTR wstr)
if (wstr == NULL)
return "";
int bufSize = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
std::string strA ("", bufSize);
strA.resize(bufSize);
if ( bufSize == 0 || WideCharToMultiByte(CP_UTF8, 0, wstr, -1, &strA[0], bufSize, NULL, NULL) != bufSize )
strA.clear();
return strA;
char *multiStr = new char[bufSize + 1];
if (bufSize == 0 || WideCharToMultiByte(CP_UTF8, 0, wstr, -1, multiStr, bufSize, NULL, NULL) != bufSize)
multiStr[0] = 0;
else
multiStr[bufSize] = 0;
std::string ret(multiStr);
delete[] multiStr;
return ret;
}

CAESinkWASAPI::CAESinkWASAPI() :
Expand Down

0 comments on commit 8975e83

Please sign in to comment.