summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-09-23 15:10:05 -0700
committerLei Zhang <thestig@chromium.org>2015-09-23 15:10:05 -0700
commitc4e940d803113552a146cd059b1ca793a1f72a22 (patch)
tree26aaf78d85dc802a0638271b3965d7a00b43f934
parent155345e2c47188fa65da1603b7f06c986707bb69 (diff)
downloadpdfium-c4e940d803113552a146cd059b1ca793a1f72a22.tar.xz
Flip conditionals to positive logic in pdfium_test.
Also merge a check for failed document loads from XFA. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1362143002 .
-rw-r--r--samples/pdfium_test.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index a4c4ec2b73..1d8a77a3ad 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -469,12 +469,17 @@ void RenderPdf(const std::string& name, const char* pBuf, size_t len,
(void)FPDFAvail_IsDocAvail(pdf_avail, &hints);
- if (!FPDFAvail_IsLinearized(pdf_avail)) {
- fprintf(stderr, "Non-linearized path...\n");
- doc = FPDF_LoadCustomDocument(&file_access, nullptr);
- } else {
+ if (FPDFAvail_IsLinearized(pdf_avail)) {
fprintf(stderr, "Linearized path...\n");
doc = FPDFAvail_GetDocument(pdf_avail, nullptr);
+ } else {
+ fprintf(stderr, "Non-linearized path...\n");
+ doc = FPDF_LoadCustomDocument(&file_access, nullptr);
+ }
+
+ if (!doc) {
+ fprintf(stderr, "Load pdf docs unsuccessful.\n");
+ return;
}
(void)FPDF_GetDocPermissions(doc);
@@ -611,7 +616,9 @@ int main(int argc, const char* argv[]) {
v8::V8::SetSnapshotDataBlob(&snapshot);
#endif // V8_USE_EXTERNAL_STARTUP_DATA
- if (!options.font_directory.empty()) {
+ if (options.font_directory.empty()) {
+ FPDF_InitLibrary();
+ } else {
const char* path_array[2];
path_array[0] = options.font_directory.c_str();
path_array[1] = nullptr;
@@ -619,8 +626,6 @@ int main(int argc, const char* argv[]) {
config.version = 1;
config.m_pUserFontPaths = path_array;
FPDF_InitLibraryWithConfig(&config);
- } else {
- FPDF_InitLibrary();
}
UNSUPPORT_INFO unsuppored_info;