summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-05-20 09:50:37 -0700
committerTom Sepez <tsepez@chromium.org>2015-05-20 09:50:37 -0700
commitd50b172a9d3a05704748f0798b5aaa422485abbd (patch)
tree0289d99b370b8526c539fc676004bf622f5228a3 /core/src/fpdfapi/fpdf_page
parent90a4181194dd8eca153cf2a101ec27e382b27a58 (diff)
downloadpdfium-d50b172a9d3a05704748f0798b5aaa422485abbd.tar.xz
Merge to XFA: Remove FX_Alloc() null checks now that it can't return NULL.
Original Review URL: https://codereview.chromium.org/1142713005 R=thestig@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1143663008
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page.cpp5
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp8
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());