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

Side by Side Diff: core/src/fpdfapi/fpdf_parser/cpdf_parser.cpp

Issue 1783023002: Re-enable MSVC warning 4800 for compiling with chromium_code (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: remove cast change on security_handler file Created 4 years, 9 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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "core/include/fpdfapi/cpdf_parser.h" 7 #include "core/include/fpdfapi/cpdf_parser.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 } // namespace 50 } // namespace
51 51
52 CPDF_Parser::CPDF_Parser() 52 CPDF_Parser::CPDF_Parser()
53 : m_pDocument(nullptr), 53 : m_pDocument(nullptr),
54 m_bOwnFileRead(true), 54 m_bOwnFileRead(true),
55 m_FileVersion(0), 55 m_FileVersion(0),
56 m_pTrailer(nullptr), 56 m_pTrailer(nullptr),
57 m_pEncryptDict(nullptr), 57 m_pEncryptDict(nullptr),
58 m_bVersionUpdated(false),
58 m_pLinearized(nullptr), 59 m_pLinearized(nullptr),
59 m_dwFirstPageNo(0), 60 m_dwFirstPageNo(0),
60 m_dwXrefStartObjNum(0) { 61 m_dwXrefStartObjNum(0) {
61 m_pSyntax.reset(new CPDF_SyntaxParser); 62 m_pSyntax.reset(new CPDF_SyntaxParser);
62 } 63 }
63 64
64 CPDF_Parser::~CPDF_Parser() { 65 CPDF_Parser::~CPDF_Parser() {
65 CloseParser(); 66 CloseParser();
66 } 67 }
67 68
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 while (it != m_ObjectInfo.end()) { 118 while (it != m_ObjectInfo.end()) {
118 auto saved_it = it++; 119 auto saved_it = it++;
119 m_ObjectInfo.erase(saved_it); 120 m_ObjectInfo.erase(saved_it);
120 } 121 }
121 122
122 if (!pdfium::ContainsKey(m_ObjectInfo, objnum - 1)) 123 if (!pdfium::ContainsKey(m_ObjectInfo, objnum - 1))
123 m_ObjectInfo[objnum - 1].pos = 0; 124 m_ObjectInfo[objnum - 1].pos = 0;
124 } 125 }
125 126
126 void CPDF_Parser::CloseParser() { 127 void CPDF_Parser::CloseParser() {
127 m_bVersionUpdated = FALSE; 128 m_bVersionUpdated = false;
128 delete m_pDocument; 129 delete m_pDocument;
129 m_pDocument = nullptr; 130 m_pDocument = nullptr;
130 131
131 if (m_pTrailer) { 132 if (m_pTrailer) {
132 m_pTrailer->Release(); 133 m_pTrailer->Release();
133 m_pTrailer = nullptr; 134 m_pTrailer = nullptr;
134 } 135 }
135 ReleaseEncryptHandler(); 136 ReleaseEncryptHandler();
136 SetEncryptDictionary(nullptr); 137 SetEncryptDictionary(nullptr);
137 138
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 if (offset == 0) { 460 if (offset == 0) {
460 for (int32_t c = 0; c < 10; c++) { 461 for (int32_t c = 0; c < 10; c++) {
461 if (!std::isdigit(pEntry[c])) 462 if (!std::isdigit(pEntry[c]))
462 return FALSE; 463 return FALSE;
463 } 464 }
464 } 465 }
465 466
466 m_ObjectInfo[objnum].pos = offset; 467 m_ObjectInfo[objnum].pos = offset;
467 int32_t version = FXSYS_atoi(pEntry + 11); 468 int32_t version = FXSYS_atoi(pEntry + 11);
468 if (version >= 1) 469 if (version >= 1)
469 m_bVersionUpdated = TRUE; 470 m_bVersionUpdated = true;
470 471
471 m_ObjectInfo[objnum].gennum = version; 472 m_ObjectInfo[objnum].gennum = version;
472 if (m_ObjectInfo[objnum].pos < m_pSyntax->m_FileLen) 473 if (m_ObjectInfo[objnum].pos < m_pSyntax->m_FileLen)
473 m_SortedOffset.insert(m_ObjectInfo[objnum].pos); 474 m_SortedOffset.insert(m_ObjectInfo[objnum].pos);
474 475
475 m_ObjectInfo[objnum].type = 1; 476 m_ObjectInfo[objnum].type = 1;
476 } 477 }
477 } 478 }
478 } 479 }
479 m_pSyntax->RestorePos(SavedPos + count * recordsize); 480 m_pSyntax->RestorePos(SavedPos + count * recordsize);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 if (offset == 0) { 535 if (offset == 0) {
535 for (int32_t c = 0; c < 10; c++) { 536 for (int32_t c = 0; c < 10; c++) {
536 if (!std::isdigit(pEntry[c])) 537 if (!std::isdigit(pEntry[c]))
537 return false; 538 return false;
538 } 539 }
539 } 540 }
540 541
541 m_ObjectInfo[objnum].pos = offset; 542 m_ObjectInfo[objnum].pos = offset;
542 int32_t version = FXSYS_atoi(pEntry + 11); 543 int32_t version = FXSYS_atoi(pEntry + 11);
543 if (version >= 1) 544 if (version >= 1)
544 m_bVersionUpdated = TRUE; 545 m_bVersionUpdated = true;
545 546
546 m_ObjectInfo[objnum].gennum = version; 547 m_ObjectInfo[objnum].gennum = version;
547 if (m_ObjectInfo[objnum].pos < m_pSyntax->m_FileLen) 548 if (m_ObjectInfo[objnum].pos < m_pSyntax->m_FileLen)
548 m_SortedOffset.insert(m_ObjectInfo[objnum].pos); 549 m_SortedOffset.insert(m_ObjectInfo[objnum].pos);
549 550
550 m_ObjectInfo[objnum].type = 1; 551 m_ObjectInfo[objnum].type = 1;
551 } 552 }
552 } 553 }
553 } 554 }
554 } 555 }
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 i += (FX_DWORD)nLen; 769 i += (FX_DWORD)nLen;
769 } 770 }
770 771
771 if (!m_ObjectInfo.empty() && IsValidObjectNumber(objnum) && 772 if (!m_ObjectInfo.empty() && IsValidObjectNumber(objnum) &&
772 m_ObjectInfo[objnum].pos) { 773 m_ObjectInfo[objnum].pos) {
773 if (pObject) { 774 if (pObject) {
774 FX_DWORD oldgen = GetObjectGenNum(objnum); 775 FX_DWORD oldgen = GetObjectGenNum(objnum);
775 m_ObjectInfo[objnum].pos = obj_pos; 776 m_ObjectInfo[objnum].pos = obj_pos;
776 m_ObjectInfo[objnum].gennum = gennum; 777 m_ObjectInfo[objnum].gennum = gennum;
777 if (oldgen != gennum) 778 if (oldgen != gennum)
778 m_bVersionUpdated = TRUE; 779 m_bVersionUpdated = true;
779 } 780 }
780 } else { 781 } else {
781 m_ObjectInfo[objnum].pos = obj_pos; 782 m_ObjectInfo[objnum].pos = obj_pos;
782 m_ObjectInfo[objnum].type = 1; 783 m_ObjectInfo[objnum].type = 1;
783 m_ObjectInfo[objnum].gennum = gennum; 784 m_ObjectInfo[objnum].gennum = gennum;
784 } 785 }
785 786
786 if (pObject) 787 if (pObject)
787 pObject->Release(); 788 pObject->Release();
788 } 789 }
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && 1643 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) &&
1643 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { 1644 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) {
1644 m_LastXRefOffset = 0; 1645 m_LastXRefOffset = 0;
1645 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; 1646 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum;
1646 return FORMAT_ERROR; 1647 return FORMAT_ERROR;
1647 } 1648 }
1648 1649
1649 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; 1650 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum;
1650 return SUCCESS; 1651 return SUCCESS;
1651 } 1652 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp ('k') | core/src/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698