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

Side by Side Diff: samples/pdfium_test.cc

Issue 1423123002: Merge to XFA: Add context to file load failures in pdfium_test. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <limits.h> 5 #include <limits.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 #include <wchar.h> 9 #include <wchar.h>
10 10
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 382
383 if (FPDFAvail_IsLinearized(pdf_avail)) { 383 if (FPDFAvail_IsLinearized(pdf_avail)) {
384 fprintf(stderr, "Linearized path...\n"); 384 fprintf(stderr, "Linearized path...\n");
385 doc = FPDFAvail_GetDocument(pdf_avail, nullptr); 385 doc = FPDFAvail_GetDocument(pdf_avail, nullptr);
386 } else { 386 } else {
387 fprintf(stderr, "Non-linearized path...\n"); 387 fprintf(stderr, "Non-linearized path...\n");
388 doc = FPDF_LoadCustomDocument(&file_access, nullptr); 388 doc = FPDF_LoadCustomDocument(&file_access, nullptr);
389 } 389 }
390 390
391 if (!doc) { 391 if (!doc) {
392 fprintf(stderr, "Load pdf docs unsuccessful.\n"); 392 unsigned long err = FPDF_GetLastError();
393 fprintf(stderr, "Load pdf docs unsuccessful: ");
394 switch (err) {
395 case FPDF_ERR_SUCCESS:
396 fprintf(stderr, "Success");
397 break;
398 case FPDF_ERR_UNKNOWN:
399 fprintf(stderr, "Unknown error");
400 break;
401 case FPDF_ERR_FILE:
402 fprintf(stderr, "File not found or could not be opened");
403 break;
404 case FPDF_ERR_FORMAT:
405 fprintf(stderr, "File not in PDF format or corrupted");
406 break;
407 case FPDF_ERR_PASSWORD:
408 fprintf(stderr, "Password required or incorrect password");
409 break;
410 case FPDF_ERR_SECURITY:
411 fprintf(stderr, "Unsupported security scheme");
412 break;
413 case FPDF_ERR_PAGE:
414 fprintf(stderr, "Page not found or content error");
415 break;
416 default:
417 fprintf(stderr, "Unknown error %ld", err);
418 }
419 fprintf(stderr, ".\n");
420
393 FPDFAvail_Destroy(pdf_avail); 421 FPDFAvail_Destroy(pdf_avail);
394 return; 422 return;
395 } 423 }
396 424
397 (void)FPDF_GetDocPermissions(doc); 425 (void)FPDF_GetDocPermissions(doc);
398 (void)FPDFAvail_IsFormAvail(pdf_avail, &hints); 426 (void)FPDFAvail_IsFormAvail(pdf_avail, &hints);
399 427
400 FPDF_FORMHANDLE form = FPDFDOC_InitFormFillEnvironment(doc, &form_callbacks); 428 FPDF_FORMHANDLE form = FPDFDOC_InitFormFillEnvironment(doc, &form_callbacks);
401 int docType = DOCTYPE_PDF; 429 int docType = DOCTYPE_PDF;
402 if (FPDF_HasXFAField(doc, &docType) && docType != DOCTYPE_PDF && 430 if (FPDF_HasXFAField(doc, &docType) && docType != DOCTYPE_PDF &&
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 } 590 }
563 591
564 FPDF_DestroyLibrary(); 592 FPDF_DestroyLibrary();
565 #ifdef PDF_ENABLE_V8 593 #ifdef PDF_ENABLE_V8
566 v8::V8::ShutdownPlatform(); 594 v8::V8::ShutdownPlatform();
567 delete platform; 595 delete platform;
568 #endif // PDF_ENABLE_V8 596 #endif // PDF_ENABLE_V8
569 597
570 return 0; 598 return 0;
571 } 599 }
OLDNEW
« 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