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

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

Issue 1693913003: Remove the FX_MIN macro. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 10 months 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/fxcodec/codec/fx_codec_flate.cpp ('k') | no next file » | 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 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 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 = std::min(pdfium::base::checked_cast<size_t>(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) { 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) {
(...skipping 191 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/fxcodec/codec/fx_codec_flate.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698