summaryrefslogtreecommitdiff
path: root/core/src/fxge/win32
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-05-19 14:48:00 -0700
committerTom Sepez <tsepez@chromium.org>2015-05-19 14:48:00 -0700
commiteb6527763171cdb4b0fbfea5a20d691f4d67b660 (patch)
tree7781d0fb716b95696b9f411037508244f4cfc28a /core/src/fxge/win32
parent59f4b44d1fbb259967ea518e0bf5fa76b0cc9767 (diff)
downloadpdfium-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/fxge/win32')
-rw-r--r--core/src/fxge/win32/fx_win32_device.cpp3
-rw-r--r--core/src/fxge/win32/fx_win32_dib.cpp13
-rw-r--r--core/src/fxge/win32/fx_win32_gdipext.cpp28
-rw-r--r--core/src/fxge/win32/fx_win32_print.cpp3
4 files changed, 0 insertions, 47 deletions
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp
index 00baa2bee9..0717fb1528 100644
--- a/core/src/fxge/win32/fx_win32_device.cpp
+++ b/core/src/fxge/win32/fx_win32_device.cpp
@@ -655,9 +655,6 @@ static HPEN _CreatePen(const CFX_GraphStateData* pGraphState, const CFX_AffineMa
FX_DWORD* pDash = NULL;
if (pGraphState->m_DashCount) {
pDash = FX_Alloc(FX_DWORD, pGraphState->m_DashCount);
- if (!pDash) {
- return NULL;
- }
for (int i = 0; i < pGraphState->m_DashCount; i ++) {
pDash[i] = FXSYS_round(pMatrix ? pMatrix->TransformDistance(pGraphState->m_DashArray[i]) : pGraphState->m_DashArray[i]);
if (pDash[i] < 1) {
diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp
index ec523c39c1..46abdb366c 100644
--- a/core/src/fxge/win32/fx_win32_dib.cpp
+++ b/core/src/fxge/win32/fx_win32_dib.cpp
@@ -69,12 +69,6 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData, FX_BOOL
FXSYS_memcpy32(pBitmap->GetBuffer(), pData, pitch * height);
if (bBottomUp) {
FX_LPBYTE temp_buf = FX_Alloc(FX_BYTE, pitch);
- if (!temp_buf) {
- if (pBitmap) {
- delete pBitmap;
- }
- return NULL;
- }
int top = 0, bottom = height - 1;
while (top < bottom) {
FXSYS_memcpy32(temp_buf, pBitmap->GetBuffer() + top * pitch, pitch);
@@ -203,13 +197,6 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC, HBITMAP hBitmap, FX_DWORD* pP
size += sizeof (FX_DWORD) * 254;
}
BITMAPINFO* pbmih = (BITMAPINFO*)FX_Alloc(FX_BYTE, size);
- if (!pbmih) {
- delete pDIBitmap;
- if (bCreatedDC) {
- DeleteDC(hDC);
- }
- return NULL;
- }
pbmih->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
pbmih->bmiHeader.biBitCount = bmih.biBitCount;
pbmih->bmiHeader.biCompression = BI_RGB;
diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp
index 49c3f2b0cf..67aa16242b 100644
--- a/core/src/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/src/fxge/win32/fx_win32_gdipext.cpp
@@ -766,9 +766,6 @@ static GpPen* _GdipCreatePen(const CFX_GraphStateData* pGraphState, const CFX_Af
CallFunc(GdipSetPenLineJoin)(pPen, lineJoin);
if(pGraphState->m_DashCount) {
FX_FLOAT* pDashArray = FX_Alloc(FX_FLOAT, pGraphState->m_DashCount + pGraphState->m_DashCount % 2);
- if (!pDashArray) {
- return NULL;
- }
int nCount = 0;
FX_FLOAT on_leftover = 0, off_leftover = 0;
for (int i = 0; i < pGraphState->m_DashCount; i += 2) {
@@ -870,14 +867,7 @@ BOOL CGdiplusExt::DrawPath(HDC hDC, const CFX_PathData* pPathData,
CallFunc(GdipSetWorldTransform)(pGraphics, pMatrix);
}
PointF *points = FX_Alloc(PointF, nPoints);
- if (!points) {
- return FALSE;
- }
BYTE * types = FX_Alloc(BYTE, nPoints);
- if (!types) {
- FX_Free(points);
- return FALSE;
- }
int nSubPathes = 0;
FX_BOOL bSubClose = FALSE;
int pos_subclose = 0;
@@ -1192,12 +1182,6 @@ static PREVIEW3_DIBITMAP* LoadDIBitmap(WINDIB_Open_Args_ args)
dest_pixel_format = PixelFormat32bppARGB;
}
LPBYTE buf = FX_Alloc(BYTE, info_size);
- if (!buf) {
- if (pStream) {
- pStream->Release();
- }
- return NULL;
- }
BITMAPINFOHEADER* pbmih = (BITMAPINFOHEADER*)buf;
pbmih->biBitCount = bpp;
pbmih->biCompression = BI_RGB;
@@ -1206,12 +1190,6 @@ static PREVIEW3_DIBITMAP* LoadDIBitmap(WINDIB_Open_Args_ args)
pbmih->biWidth = width;
Rect rect(0, 0, width, height);
BitmapData* pBitmapData = FX_Alloc(BitmapData, 1);
- if (!pBitmapData) {
- if (pStream) {
- pStream->Release();
- }
- return NULL;
- }
CallFunc(GdipBitmapLockBits)(pBitmap, &rect, ImageLockModeRead,
dest_pixel_format, pBitmapData);
if (pixel_format == PixelFormat1bppIndexed || pixel_format == PixelFormat8bppIndexed) {
@@ -1230,12 +1208,6 @@ static PREVIEW3_DIBITMAP* LoadDIBitmap(WINDIB_Open_Args_ args)
}
}
PREVIEW3_DIBITMAP* pInfo = FX_Alloc(PREVIEW3_DIBITMAP, 1);
- if (!pInfo) {
- if (pStream) {
- pStream->Release();
- }
- return NULL;
- }
pInfo->pbmi = (BITMAPINFO*)buf;
pInfo->pScan0 = (LPBYTE)pBitmapData->Scan0;
pInfo->Stride = pBitmapData->Stride;
diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp
index 7dc48a1808..670622a5fb 100644
--- a/core/src/fxge/win32/fx_win32_print.cpp
+++ b/core/src/fxge/win32/fx_win32_print.cpp
@@ -295,9 +295,6 @@ FX_BOOL CPSPrinterDriver::Init(HDC hDC, int pslevel, FX_BOOL bCmykOutput)
ret = ::GetRegionData(hRgn, 0, NULL);
if (ret) {
RGNDATA* pData = (RGNDATA*)FX_Alloc(FX_BYTE, ret);
- if (!pData) {
- return FALSE;
- }
ret = ::GetRegionData(hRgn, ret, pData);
if (ret) {
CFX_PathData path;