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

Side by Side Diff: fpdfsdk/fpdfview.cpp

Issue 2005653002: Distinguish between user and owner passwords. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: fix bug Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "public/fpdfview.h" 7 #include "public/fpdfview.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 return FALSE; 457 return FALSE;
458 458
459 *fileVersion = pParser->GetFileVersion(); 459 *fileVersion = pParser->GetFileVersion();
460 return TRUE; 460 return TRUE;
461 } 461 }
462 462
463 // jabdelmalek: changed return type from uint32_t to build on Linux (and match 463 // jabdelmalek: changed return type from uint32_t to build on Linux (and match
464 // header). 464 // header).
465 DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document) { 465 DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document) {
466 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); 466 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
467 if (!pDoc || !pDoc->GetParser()) 467 if (!pDoc) {
468 #ifndef PDF_ENABLE_XFA 468 #ifndef PDF_ENABLE_XFA
469 return 0; 469 return 0;
470 #else // PDF_ENABLE_XFA 470 #else // PDF_ENABLE_XFA
471 return (uint32_t)-1; 471 return 0xFFFFFFFF;
472 #endif // PDF_ENABLE_XFA 472 #endif // PDF_ENABLE_XFA
473 }
473 474
474 CPDF_Dictionary* pDict = pDoc->GetParser()->GetEncryptDict(); 475 return pDoc->GetUserPermissions();
475 return pDict ? pDict->GetIntegerBy("P") : (uint32_t)-1;
476 } 476 }
477 477
478 DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document) { 478 DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document) {
479 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); 479 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
480 if (!pDoc || !pDoc->GetParser()) 480 if (!pDoc || !pDoc->GetParser())
481 return -1; 481 return -1;
482 482
483 CPDF_Dictionary* pDict = pDoc->GetParser()->GetEncryptDict(); 483 CPDF_Dictionary* pDict = pDoc->GetParser()->GetEncryptDict();
484 return pDict ? pDict->GetIntegerBy("R") : -1; 484 return pDict ? pDict->GetIntegerBy("R") : -1;
485 } 485 }
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 if (!buffer) { 1143 if (!buffer) {
1144 *buflen = len; 1144 *buflen = len;
1145 } else if (*buflen >= len) { 1145 } else if (*buflen >= len) {
1146 memcpy(buffer, utf16Name.c_str(), len); 1146 memcpy(buffer, utf16Name.c_str(), len);
1147 *buflen = len; 1147 *buflen = len;
1148 } else { 1148 } else {
1149 *buflen = -1; 1149 *buflen = -1;
1150 } 1150 }
1151 return (FPDF_DEST)pDestObj; 1151 return (FPDF_DEST)pDestObj;
1152 } 1152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698