diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-05-19 14:48:00 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-05-19 14:48:00 -0700 |
commit | eb6527763171cdb4b0fbfea5a20d691f4d67b660 (patch) | |
tree | 7781d0fb716b95696b9f411037508244f4cfc28a /core/src/fpdfapi/fpdf_page | |
parent | 59f4b44d1fbb259967ea518e0bf5fa76b0cc9767 (diff) | |
download | pdfium-eb6527763171cdb4b0fbfea5a20d691f4d67b660.tar.xz |
Remove FX_Alloc() null checks now that it can't return NULL.
This permits some functions to become void's since
they, in turn, can't fail.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1142713005
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page.cpp | 5 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 8 |
2 files changed, 4 insertions, 9 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp index 4ec753d751..5a9f1a8cb8 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp @@ -204,11 +204,10 @@ void CPDF_TextObject::CopyData(const CPDF_PageObject* pSrc) if (m_nChars > 1) { m_pCharCodes = FX_Alloc(FX_DWORD, m_nChars); m_pCharPos = FX_Alloc(FX_FLOAT, m_nChars - 1); - int i; - for (i = 0; i < m_nChars; i ++) { + for (int i = 0; i < m_nChars; i ++) { m_pCharCodes[i] = pSrcObj->m_pCharCodes[i]; } - for (i = 0; i < m_nChars - 1; i ++) { + for (int i = 0; i < m_nChars - 1; i ++) { m_pCharPos[i] = pSrcObj->m_pCharPos[i]; } } else { 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 952fe1d9a9..d8b24593ef 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()); |