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

Unified Diff: core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp

Issue 1135893008: Re-land: Remove FX_Alloc() null checks now that it can't return NULL. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 952fe1d9a92760f6fbb0e1273957eb170f8c07eb..d8b24593ef624fcbc050a215d6229b980435cfdb 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -262,8 +262,8 @@ FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, FX_LPBYTE& dest_b
delete pDecoder;
return -1;
}
- dest_size = pitch * height;
- dest_buf = FX_Alloc( FX_BYTE, dest_size);
+ dest_buf = FX_Alloc2D(FX_BYTE, pitch, height);
+ dest_size = pitch * height; // Safe since checked alloc returned.
for (int row = 0; row < height; row ++) {
FX_LPBYTE pLine = pDecoder->GetScanline(row);
if (pLine == NULL) {
@@ -1050,10 +1050,6 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause)
m_Size += size + 1;
}
m_pData = FX_Alloc(FX_BYTE, m_Size);
- if (!m_pData) {
- m_Status = Done;
- return;
- }
FX_DWORD pos = 0;
for (i = 0; i < m_nStreams; i ++) {
FXSYS_memcpy32(m_pData + pos, m_pStreamArray[i]->GetData(), m_pStreamArray[i]->GetSize());
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698