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

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp

Issue 1832173003: Remove FX_DWORD from core/ and delete definition (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_stream.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" 9 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h"
10 10
11 CPDF_StreamAcc::CPDF_StreamAcc() 11 CPDF_StreamAcc::CPDF_StreamAcc()
12 : m_pData(nullptr), 12 : m_pData(nullptr),
13 m_dwSize(0), 13 m_dwSize(0),
14 m_bNewBuf(FALSE), 14 m_bNewBuf(FALSE),
15 m_pImageParam(nullptr), 15 m_pImageParam(nullptr),
16 m_pStream(nullptr), 16 m_pStream(nullptr),
17 m_pSrcData(nullptr) {} 17 m_pSrcData(nullptr) {}
18 18
19 void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream, 19 void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
20 FX_BOOL bRawAccess, 20 FX_BOOL bRawAccess,
21 FX_DWORD estimated_size, 21 uint32_t estimated_size,
22 FX_BOOL bImageAcc) { 22 FX_BOOL bImageAcc) {
23 if (!pStream) 23 if (!pStream)
24 return; 24 return;
25 25
26 m_pStream = pStream; 26 m_pStream = pStream;
27 if (pStream->IsMemoryBased() && 27 if (pStream->IsMemoryBased() &&
28 (!pStream->GetDict()->KeyExist("Filter") || bRawAccess)) { 28 (!pStream->GetDict()->KeyExist("Filter") || bRawAccess)) {
29 m_dwSize = pStream->GetRawSize(); 29 m_dwSize = pStream->GetRawSize();
30 m_pData = pStream->GetRawData(); 30 m_pData = pStream->GetRawData();
31 return; 31 return;
32 } 32 }
33 uint8_t* pSrcData; 33 uint8_t* pSrcData;
34 FX_DWORD dwSrcSize = pStream->GetRawSize(); 34 uint32_t dwSrcSize = pStream->GetRawSize();
35 if (dwSrcSize == 0) 35 if (dwSrcSize == 0)
36 return; 36 return;
37 37
38 if (!pStream->IsMemoryBased()) { 38 if (!pStream->IsMemoryBased()) {
39 pSrcData = m_pSrcData = FX_Alloc(uint8_t, dwSrcSize); 39 pSrcData = m_pSrcData = FX_Alloc(uint8_t, dwSrcSize);
40 if (!pStream->ReadRawData(0, pSrcData, dwSrcSize)) 40 if (!pStream->ReadRawData(0, pSrcData, dwSrcSize))
41 return; 41 return;
42 } else { 42 } else {
43 pSrcData = pStream->GetRawData(); 43 pSrcData = pStream->GetRawData();
44 } 44 }
45 uint8_t* pDecryptedData = pSrcData; 45 uint8_t* pDecryptedData = pSrcData;
46 FX_DWORD dwDecryptedSize = dwSrcSize; 46 uint32_t dwDecryptedSize = dwSrcSize;
47 if (!pStream->GetDict()->KeyExist("Filter") || bRawAccess) { 47 if (!pStream->GetDict()->KeyExist("Filter") || bRawAccess) {
48 m_pData = pDecryptedData; 48 m_pData = pDecryptedData;
49 m_dwSize = dwDecryptedSize; 49 m_dwSize = dwDecryptedSize;
50 } else { 50 } else {
51 FX_BOOL bRet = PDF_DataDecode( 51 FX_BOOL bRet = PDF_DataDecode(
52 pDecryptedData, dwDecryptedSize, m_pStream->GetDict(), m_pData, 52 pDecryptedData, dwDecryptedSize, m_pStream->GetDict(), m_pData,
53 m_dwSize, m_ImageDecoder, m_pImageParam, estimated_size, bImageAcc); 53 m_dwSize, m_ImageDecoder, m_pImageParam, estimated_size, bImageAcc);
54 if (!bRet) { 54 if (!bRet) {
55 m_pData = pDecryptedData; 55 m_pData = pDecryptedData;
56 m_dwSize = dwDecryptedSize; 56 m_dwSize = dwDecryptedSize;
(...skipping 19 matching lines...) Expand all
76 const uint8_t* CPDF_StreamAcc::GetData() const { 76 const uint8_t* CPDF_StreamAcc::GetData() const {
77 if (m_bNewBuf) { 77 if (m_bNewBuf) {
78 return m_pData; 78 return m_pData;
79 } 79 }
80 if (!m_pStream) { 80 if (!m_pStream) {
81 return nullptr; 81 return nullptr;
82 } 82 }
83 return m_pStream->GetRawData(); 83 return m_pStream->GetRawData();
84 } 84 }
85 85
86 FX_DWORD CPDF_StreamAcc::GetSize() const { 86 uint32_t CPDF_StreamAcc::GetSize() const {
87 if (m_bNewBuf) { 87 if (m_bNewBuf) {
88 return m_dwSize; 88 return m_dwSize;
89 } 89 }
90 if (!m_pStream) { 90 if (!m_pStream) {
91 return 0; 91 return 0;
92 } 92 }
93 return m_pStream->GetRawSize(); 93 return m_pStream->GetRawSize();
94 } 94 }
95 95
96 uint8_t* CPDF_StreamAcc::DetachData() { 96 uint8_t* CPDF_StreamAcc::DetachData() {
97 if (m_bNewBuf) { 97 if (m_bNewBuf) {
98 uint8_t* p = m_pData; 98 uint8_t* p = m_pData;
99 m_pData = nullptr; 99 m_pData = nullptr;
100 m_dwSize = 0; 100 m_dwSize = 0;
101 return p; 101 return p;
102 } 102 }
103 uint8_t* p = FX_Alloc(uint8_t, m_dwSize); 103 uint8_t* p = FX_Alloc(uint8_t, m_dwSize);
104 FXSYS_memcpy(p, m_pData, m_dwSize); 104 FXSYS_memcpy(p, m_pData, m_dwSize);
105 return p; 105 return p;
106 } 106 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_stream.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698