summaryrefslogtreecommitdiff
path: root/samples/pdfium_test.cc
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-11-04 16:02:47 -0800
committerLei Zhang <thestig@chromium.org>2015-11-04 16:02:47 -0800
commit79e893a1d0f2083f17c40ccadf2cc1250aad5a14 (patch)
tree114028fbcc6ba016620cba2981a512bea83128d5 /samples/pdfium_test.cc
parent8fec3e42ed57a988ad5e7faae5e6a83847a3267e (diff)
downloadpdfium-79e893a1d0f2083f17c40ccadf2cc1250aad5a14.tar.xz
Merge to XFA: Make JS app.setTimeOut() work again.
This regressed in commit 794c9b6. BUG=551248 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1424743006 . (cherry picked from commit 8cadf995e9a0fec8da19f69edac9d10fccca7eed) (cherry picked from commit 955930dce7e4b5c764cdd34b134baea4207de523) Review URL: https://codereview.chromium.org/1416663008 .
Diffstat (limited to 'samples/pdfium_test.cc')
-rw-r--r--samples/pdfium_test.cc15
1 files changed, 2 insertions, 13 deletions
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 76de7ea7a5..4ccf1a7721 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -196,19 +196,8 @@ void WriteEmf(FPDF_PAGE page, const char* pdf_name, int num) {
int ExampleAppAlert(IPDF_JSPLATFORM*, FPDF_WIDESTRING msg, FPDF_WIDESTRING,
int, int) {
- // Deal with differences between UTF16LE and wchar_t on this platform.
- size_t characters = 0;
- while (msg[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*)&msg[i];
- platform_string[i] = ptr[0] + 256 * ptr[1];
- }
- printf("Alert: %ls\n", platform_string);
- free(platform_string);
+ std::wstring platform_string = GetWideString(msg);
+ printf("Alert: %ls\n", platform_string.c_str());
return 0;
}