Index: testing/test_support.cpp |
diff --git a/testing/test_support.cpp b/testing/test_support.cpp |
index 611ba5d580641df8c5a64c31c273ab83e630a0a9..12933e62633a76fa8d89c8e15548bdf506560b3d 100644 |
--- a/testing/test_support.cpp |
+++ b/testing/test_support.cpp |
@@ -98,6 +98,23 @@ char* GetFileContents(const char* filename, size_t* retlen) { |
return buffer; |
} |
+wchar_t* GetWideString(FPDF_WIDESTRING wstr) { |
+ if (!wstr) |
Tom Sepez
2015/11/04 18:02:33
nit: move the comment about utf16le from the other
Lei Zhang
2015/11/04 22:11:29
I put it in the header.
|
+ return nullptr; |
+ |
+ 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) { |
+ const unsigned char* ptr = reinterpret_cast<const 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, |