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

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.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/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../../../include/fpdfapi/fpdf_page.h" 9 #include "../../../include/fpdfapi/fpdf_page.h"
10 #include "../../../src/fxcrt/fx_safe_types.h" 10 #include "../../../src/fxcrt/fx_safe_types.h"
(...skipping 2463 matching lines...) Expand 10 before | Expand all | Expand 10 after
2474 m_Pos = StreamStartPos; 2474 m_Pos = StreamStartPos;
2475 if (FindTag(FX_BSTRC("endobj"), 0) < 0) { 2475 if (FindTag(FX_BSTRC("endobj"), 0) < 0) {
2476 return NULL; 2476 return NULL;
2477 } 2477 }
2478 } 2478 }
2479 } 2479 }
2480 m_Pos = StreamStartPos; 2480 m_Pos = StreamStartPos;
2481 } 2481 }
2482 CPDF_Stream* pStream; 2482 CPDF_Stream* pStream;
2483 FX_LPBYTE pData = FX_Alloc(FX_BYTE, len); 2483 FX_LPBYTE pData = FX_Alloc(FX_BYTE, len);
2484 if (!pData) {
2485 return NULL;
2486 }
2487 ReadBlock(pData, len); 2484 ReadBlock(pData, len);
2488 if (pCryptoHandler) { 2485 if (pCryptoHandler) {
2489 CFX_BinaryBuf dest_buf; 2486 CFX_BinaryBuf dest_buf;
2490 dest_buf.EstimateSize(pCryptoHandler->DecryptGetSize(len)); 2487 dest_buf.EstimateSize(pCryptoHandler->DecryptGetSize(len));
2491 FX_LPVOID context = pCryptoHandler->DecryptStart(objnum, gennum); 2488 FX_LPVOID context = pCryptoHandler->DecryptStart(objnum, gennum);
2492 pCryptoHandler->DecryptStream(context, pData, len, dest_buf); 2489 pCryptoHandler->DecryptStream(context, pData, len, dest_buf);
2493 pCryptoHandler->DecryptFinish(context, dest_buf); 2490 pCryptoHandler->DecryptFinish(context, dest_buf);
2494 FX_Free(pData); 2491 FX_Free(pData);
2495 pData = dest_buf.GetBuffer(); 2492 pData = dest_buf.GetBuffer();
2496 len = dest_buf.GetSize(); 2493 len = dest_buf.GetSize();
(...skipping 2149 matching lines...) Expand 10 before | Expand all | Expand 10 after
4646 { 4643 {
4647 FX_INT32 iSize = m_childNode.GetSize(); 4644 FX_INT32 iSize = m_childNode.GetSize();
4648 for (FX_INT32 i = 0; i < iSize; ++i) { 4645 for (FX_INT32 i = 0; i < iSize; ++i) {
4649 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; 4646 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i];
4650 if (pNode) { 4647 if (pNode) {
4651 delete pNode; 4648 delete pNode;
4652 } 4649 }
4653 } 4650 }
4654 m_childNode.RemoveAll(); 4651 m_childNode.RemoveAll();
4655 } 4652 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp ('k') | core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698