diff options
Diffstat (limited to 'WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp')
-rw-r--r-- | WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp index e96adae..dfa4de0 100644 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp @@ -140,6 +140,17 @@ wstring urlSuitableForTestResult(const wstring& url) return PathFindFileNameW(url.c_str()); } +string toUTF8(BSTR bstr) +{ + int result = WideCharToMultiByte(CP_UTF8, 0, bstr, SysStringLen(bstr) + 1, 0, 0, 0, 0); + Vector<char> utf8Vector(result); + result = WideCharToMultiByte(CP_UTF8, 0, bstr, SysStringLen(bstr) + 1, utf8Vector.data(), result, 0, 0); + if (!result) + return string(); + + return string(utf8Vector.data(), utf8Vector.size() - 1); +} + static LRESULT CALLBACK DumpRenderTreeWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { |