Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Unified Diff: samples/pdfium_test.cc

Issue 1362143002: Flip conditionals to positive logic in pdfium_test. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/pdfium_test.cc
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index a4c4ec2b73b45251c7274175cc628ce39b5de6bc..1d8a77a3ad422fb617646e81dacd28d71598e1d9 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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698