Index: testing/test_support.cpp |
diff --git a/testing/test_support.cpp b/testing/test_support.cpp |
index 611ba5d580641df8c5a64c31c273ab83e630a0a9..1bbfed7fb4cd79bddd3358e2f91bf4e210706f36 100644 |
--- a/testing/test_support.cpp |
+++ b/testing/test_support.cpp |
@@ -98,6 +98,20 @@ char* GetFileContents(const char* filename, size_t* retlen) { |
return buffer; |
} |
+wchar_t* GetWideString(FPDF_WIDESTRING wstr) { |
+ size_t characters = 0; |
+ while (wstr[characters]) |
+ ++characters; |
+ |
+ wchar_t* platform_string = |
+ static_cast<wchar_t*>(malloc((characters + 1) * sizeof(wchar_t))); |
+ for (size_t i = 0; i < characters + 1; ++i) { |
+ unsigned char* ptr = (unsigned char*)&wstr[i]; |
+ platform_string[i] = ptr[0] + 256 * ptr[1]; |
+ } |
+ return platform_string; |
+} |
+ |
#ifdef PDF_ENABLE_V8 |
#ifdef V8_USE_EXTERNAL_STARTUP_DATA |
bool InitializeV8ForPDFium(const std::string& exe_path, |