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

Side by Side Diff: core/src/fxge/win32/fx_win32_gdipext.cpp

Issue 1512763013: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits Created 5 years 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 unified diff | Download patch
« no previous file with comments | « core/src/fxge/win32/fx_win32_dwrite.cpp ('k') | core/src/fxge/win32/fx_win32_print.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/include/fxge/fx_ge.h" 7 #include "core/include/fxge/fx_ge.h"
8 8
9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ 9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
10 #include <windows.h> 10 #include <windows.h>
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 } 1288 }
1289 return res; 1289 return res;
1290 } 1290 }
1291 1291
1292 public: 1292 public:
1293 virtual HRESULT STDMETHODCALLTYPE Read(void* Output, 1293 virtual HRESULT STDMETHODCALLTYPE Read(void* Output,
1294 ULONG cb, 1294 ULONG cb,
1295 ULONG* pcbRead) { 1295 ULONG* pcbRead) {
1296 size_t bytes_left; 1296 size_t bytes_left;
1297 size_t bytes_out; 1297 size_t bytes_out;
1298 if (pcbRead != NULL) { 1298 if (pcbRead) {
1299 *pcbRead = 0; 1299 *pcbRead = 0;
1300 } 1300 }
1301 if (m_ReadPos == m_InterStream.GetLength()) { 1301 if (m_ReadPos == m_InterStream.GetLength()) {
1302 return HRESULT_FROM_WIN32(ERROR_END_OF_MEDIA); 1302 return HRESULT_FROM_WIN32(ERROR_END_OF_MEDIA);
1303 } 1303 }
1304 bytes_left = m_InterStream.GetLength() - m_ReadPos; 1304 bytes_left = m_InterStream.GetLength() - m_ReadPos;
1305 bytes_out = FX_MIN(cb, bytes_left); 1305 bytes_out = FX_MIN(cb, bytes_left);
1306 FXSYS_memcpy(Output, m_InterStream.GetBuffer() + m_ReadPos, bytes_out); 1306 FXSYS_memcpy(Output, m_InterStream.GetBuffer() + m_ReadPos, bytes_out);
1307 m_ReadPos += (int32_t)bytes_out; 1307 m_ReadPos += (int32_t)bytes_out;
1308 if (pcbRead != NULL) { 1308 if (pcbRead) {
1309 *pcbRead = (ULONG)bytes_out; 1309 *pcbRead = (ULONG)bytes_out;
1310 } 1310 }
1311 return S_OK; 1311 return S_OK;
1312 } 1312 }
1313 virtual HRESULT STDMETHODCALLTYPE Write(void const* Input, 1313 virtual HRESULT STDMETHODCALLTYPE Write(void const* Input,
1314 ULONG cb, 1314 ULONG cb,
1315 ULONG* pcbWritten) { 1315 ULONG* pcbWritten) {
1316 if (cb <= 0) { 1316 if (cb <= 0) {
1317 if (pcbWritten != NULL) { 1317 if (pcbWritten) {
1318 *pcbWritten = 0; 1318 *pcbWritten = 0;
1319 } 1319 }
1320 return S_OK; 1320 return S_OK;
1321 } 1321 }
1322 m_InterStream.InsertBlock(m_InterStream.GetLength(), Input, cb); 1322 m_InterStream.InsertBlock(m_InterStream.GetLength(), Input, cb);
1323 if (pcbWritten != NULL) { 1323 if (pcbWritten) {
1324 *pcbWritten = cb; 1324 *pcbWritten = cb;
1325 } 1325 }
1326 return S_OK; 1326 return S_OK;
1327 } 1327 }
1328 1328
1329 public: 1329 public:
1330 virtual HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER) { 1330 virtual HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER) {
1331 return E_NOTIMPL; 1331 return E_NOTIMPL;
1332 } 1332 }
1333 virtual HRESULT STDMETHODCALLTYPE CopyTo(IStream*, 1333 virtual HRESULT STDMETHODCALLTYPE CopyTo(IStream*,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 default: 1367 default:
1368 return STG_E_INVALIDFUNCTION; 1368 return STG_E_INVALIDFUNCTION;
1369 break; 1369 break;
1370 } 1370 }
1371 new_read_position = start + (long)liDistanceToMove.QuadPart; 1371 new_read_position = start + (long)liDistanceToMove.QuadPart;
1372 if (new_read_position < 0 || 1372 if (new_read_position < 0 ||
1373 new_read_position > m_InterStream.GetLength()) { 1373 new_read_position > m_InterStream.GetLength()) {
1374 return STG_E_SEEKERROR; 1374 return STG_E_SEEKERROR;
1375 } 1375 }
1376 m_ReadPos = new_read_position; 1376 m_ReadPos = new_read_position;
1377 if (lpNewFilePointer != NULL) { 1377 if (lpNewFilePointer) {
1378 lpNewFilePointer->QuadPart = m_ReadPos; 1378 lpNewFilePointer->QuadPart = m_ReadPos;
1379 } 1379 }
1380 return S_OK; 1380 return S_OK;
1381 } 1381 }
1382 virtual HRESULT STDMETHODCALLTYPE Stat(STATSTG* pStatstg, DWORD grfStatFlag) { 1382 virtual HRESULT STDMETHODCALLTYPE Stat(STATSTG* pStatstg, DWORD grfStatFlag) {
1383 if (pStatstg == NULL) { 1383 if (pStatstg == NULL) {
1384 return STG_E_INVALIDFUNCTION; 1384 return STG_E_INVALIDFUNCTION;
1385 } 1385 }
1386 ZeroMemory(pStatstg, sizeof(STATSTG)); 1386 ZeroMemory(pStatstg, sizeof(STATSTG));
1387 pStatstg->cbSize.QuadPart = m_InterStream.GetLength(); 1387 pStatstg->cbSize.QuadPart = m_InterStream.GetLength();
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 dest_pitch); 1507 dest_pitch);
1508 } 1508 }
1509 } 1509 }
1510 CFX_DIBitmap* pDIBitmap = _FX_WindowsDIB_LoadFromBuf( 1510 CFX_DIBitmap* pDIBitmap = _FX_WindowsDIB_LoadFromBuf(
1511 pInfo->pbmi, pData, pInfo->pbmi->bmiHeader.biBitCount == 32); 1511 pInfo->pbmi, pData, pInfo->pbmi->bmiHeader.biBitCount == 32);
1512 FX_Free(pData); 1512 FX_Free(pData);
1513 FreeDIBitmap(pInfo); 1513 FreeDIBitmap(pInfo);
1514 return pDIBitmap; 1514 return pDIBitmap;
1515 } 1515 }
1516 #endif 1516 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/win32/fx_win32_dwrite.cpp ('k') | core/src/fxge/win32/fx_win32_print.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698