summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-05-19 15:19:32 -0700
committerTom Sepez <tsepez@chromium.org>2015-05-19 15:19:32 -0700
commit981a3468319eb24e696bb64ba84d9631fd26f1f7 (patch)
treec1136b807975ccc80199ff6593e69475261c1670 /fpdfsdk
parentbf4aa2cc93a67826247e887b2ba26a1b965eb616 (diff)
downloadpdfium-981a3468319eb24e696bb64ba84d9631fd26f1f7.tar.xz
Re-land: Remove FX_Alloc() null checks now that it can't return NULL.
Fixes the ordering of some assignments broken when converting to checked numerics in CFX_PathData::AddPointCount(). Original Review URL: https://codereview.chromium.org/1142713005 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1135893008
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/src/fsdk_baseform.cpp5
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Edit.cpp30
2 files changed, 14 insertions, 21 deletions
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index 9ab61843b8..0cbc4baa44 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -2352,13 +2352,10 @@ FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(FX_LPBYTE& pBuf, FX_STRSIZE& nBuf
if(i != pFields->GetCount()-1)
fdfEncodedData = fdfEncodedData<<"&";
}
-
+
nBufSize = fdfEncodedData.GetLength();
pBuf = FX_Alloc(FX_BYTE, nBufSize);
- if(!pBuf)
- return FALSE;
FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize);
-
}
return TRUE;
}
diff --git a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
index f704a67731..678da68b49 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
@@ -426,17 +426,15 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser
gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth();
CFX_PathData path;
- if (!path.SetPointCount(nCharArraySafe.ValueOrDie())) {
- return;
- }
-
+ path.SetPointCount(nCharArraySafe.ValueOrDie());
+
for (FX_INT32 i=0; i<nCharArray-1; i++)
- {
- path.SetPoint(i*2, rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*(i+1),
+ {
+ path.SetPoint(i*2, rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*(i+1),
rcClient.bottom, FXPT_MOVETO);
path.SetPoint(i*2+1, rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*(i+1),
- rcClient.top, FXPT_LINETO);
- }
+ rcClient.top, FXPT_LINETO);
+ }
if (path.GetPointCount() > 0)
pDevice->DrawPath(&path, pUser2Device, &gsd,0,
CPWL_Utils::PWLColorToFXColor(GetBorderColor(),255), FXFILL_ALTERNATE);
@@ -453,19 +451,17 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser
gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPhase;
CFX_PathData path;
- if (!path.SetPointCount(nCharArraySafe.ValueOrDie())) {
- return;
- }
-
+ path.SetPointCount(nCharArraySafe.ValueOrDie());
+
for (FX_INT32 i=0; i<nCharArray-1; i++)
- {
- path.SetPoint(i*2, rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*(i+1),
+ {
+ path.SetPoint(i*2, rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*(i+1),
rcClient.bottom, FXPT_MOVETO);
path.SetPoint(i*2+1, rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*(i+1),
- rcClient.top, FXPT_LINETO);
- }
+ rcClient.top, FXPT_LINETO);
+ }
if (path.GetPointCount() > 0)
- pDevice->DrawPath(&path, pUser2Device, &gsd,0,
+ pDevice->DrawPath(&path, pUser2Device, &gsd,0,
CPWL_Utils::PWLColorToFXColor(GetBorderColor(),255), FXFILL_ALTERNATE);
}
break;