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

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

Issue 1143663008: Merge to XFA: Remove FX_Alloc() null checks now that it can't return NULL. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Rebased. Created 5 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 "../../../include/fpdfapi/fpdf_parser.h" 7 #include "../../../include/fpdfapi/fpdf_parser.h"
8 #include "../../../include/fxcrt/fx_string.h" 8 #include "../../../include/fxcrt/fx_string.h"
9 9
10 //static 10 //static
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 m_pData = (FX_LPBYTE)pStream->m_pDataBuf; 1080 m_pData = (FX_LPBYTE)pStream->m_pDataBuf;
1081 return; 1081 return;
1082 } 1082 }
1083 FX_LPBYTE pSrcData; 1083 FX_LPBYTE pSrcData;
1084 FX_DWORD dwSrcSize = pStream->m_dwSize; 1084 FX_DWORD dwSrcSize = pStream->m_dwSize;
1085 if (dwSrcSize == 0) { 1085 if (dwSrcSize == 0) {
1086 return; 1086 return;
1087 } 1087 }
1088 if (!pStream->IsMemoryBased()) { 1088 if (!pStream->IsMemoryBased()) {
1089 pSrcData = m_pSrcData = FX_Alloc(FX_BYTE, dwSrcSize); 1089 pSrcData = m_pSrcData = FX_Alloc(FX_BYTE, dwSrcSize);
1090 if (!pSrcData || !pStream->ReadRawData(0, pSrcData, dwSrcSize)) { 1090 if (!pStream->ReadRawData(0, pSrcData, dwSrcSize)) {
1091 return; 1091 return;
1092 } 1092 }
1093 } else { 1093 } else {
1094 pSrcData = pStream->m_pDataBuf; 1094 pSrcData = pStream->m_pDataBuf;
1095 } 1095 }
1096 FX_LPBYTE pDecryptedData; 1096 FX_LPBYTE pDecryptedData;
1097 FX_DWORD dwDecryptedSize; 1097 FX_DWORD dwDecryptedSize;
1098 if (pStream->m_pCryptoHandler) { 1098 if (pStream->m_pCryptoHandler) {
1099 CFX_BinaryBuf dest_buf; 1099 CFX_BinaryBuf dest_buf;
1100 dest_buf.EstimateSize(pStream->m_pCryptoHandler->DecryptGetSize(dwSrcSiz e)); 1100 dest_buf.EstimateSize(pStream->m_pCryptoHandler->DecryptGetSize(dwSrcSiz e));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 } 1159 }
1160 FX_LPBYTE CPDF_StreamAcc::DetachData() 1160 FX_LPBYTE CPDF_StreamAcc::DetachData()
1161 { 1161 {
1162 if (m_bNewBuf) { 1162 if (m_bNewBuf) {
1163 FX_LPBYTE p = m_pData; 1163 FX_LPBYTE p = m_pData;
1164 m_pData = NULL; 1164 m_pData = NULL;
1165 m_dwSize = 0; 1165 m_dwSize = 0;
1166 return p; 1166 return p;
1167 } 1167 }
1168 FX_LPBYTE p = FX_Alloc(FX_BYTE, m_dwSize); 1168 FX_LPBYTE p = FX_Alloc(FX_BYTE, m_dwSize);
1169 if (p == NULL) {
1170 return NULL;
1171 }
1172 FXSYS_memcpy32(p, m_pData, m_dwSize); 1169 FXSYS_memcpy32(p, m_pData, m_dwSize);
1173 return p; 1170 return p;
1174 } 1171 }
1175 void CPDF_Reference::SetRef(CPDF_IndirectObjects* pDoc, FX_DWORD objnum) 1172 void CPDF_Reference::SetRef(CPDF_IndirectObjects* pDoc, FX_DWORD objnum)
1176 { 1173 {
1177 m_pObjList = pDoc; 1174 m_pObjList = pDoc;
1178 m_RefObjNum = objnum; 1175 m_RefObjNum = objnum;
1179 } 1176 }
1180 CPDF_IndirectObjects::CPDF_IndirectObjects(IPDF_DocParser* pParser) 1177 CPDF_IndirectObjects::CPDF_IndirectObjects(IPDF_DocParser* pParser)
1181 { 1178 {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 pObj->m_ObjNum = objnum; 1280 pObj->m_ObjNum = objnum;
1284 m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pObj); 1281 m_IndirectObjs.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pObj);
1285 if (m_LastObjNum < objnum) { 1282 if (m_LastObjNum < objnum) {
1286 m_LastObjNum = objnum; 1283 m_LastObjNum = objnum;
1287 } 1284 }
1288 } 1285 }
1289 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const 1286 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const
1290 { 1287 {
1291 return m_LastObjNum; 1288 return m_LastObjNum;
1292 } 1289 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698