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

Side by Side Diff: core/src/fxcrt/fx_basic_buffer.cpp

Issue 1567343002: Switch most min/max macros to std::min/max. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: actually compile Created 4 years, 11 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/fxcrt/extension.h ('k') | core/src/fxcrt/fx_basic_wstring.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 <algorithm>
8
7 #include "core/include/fxcrt/fx_basic.h" 9 #include "core/include/fxcrt/fx_basic.h"
8 10
9 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf); 11 FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf);
10 CFX_BinaryBuf::CFX_BinaryBuf() 12 CFX_BinaryBuf::CFX_BinaryBuf()
11 : m_AllocStep(0), m_pBuffer(NULL), m_DataSize(0), m_AllocSize(0) {} 13 : m_AllocStep(0), m_pBuffer(NULL), m_DataSize(0), m_AllocSize(0) {}
12 CFX_BinaryBuf::CFX_BinaryBuf(FX_STRSIZE size) 14 CFX_BinaryBuf::CFX_BinaryBuf(FX_STRSIZE size)
13 : m_AllocStep(0), m_DataSize(size), m_AllocSize(size) { 15 : m_AllocStep(0), m_DataSize(size), m_AllocSize(size) {
14 m_pBuffer = FX_Alloc(uint8_t, size); 16 m_pBuffer = FX_Alloc(uint8_t, size);
15 } 17 }
16 CFX_BinaryBuf::~CFX_BinaryBuf() { 18 CFX_BinaryBuf::~CFX_BinaryBuf() {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 int32_t IFX_BufferArchive::AppendBlock(const void* pBuf, size_t size) { 268 int32_t IFX_BufferArchive::AppendBlock(const void* pBuf, size_t size) {
267 if (!pBuf || size < 1) { 269 if (!pBuf || size < 1) {
268 return 0; 270 return 0;
269 } 271 }
270 if (!m_pBuffer) { 272 if (!m_pBuffer) {
271 m_pBuffer = FX_Alloc(uint8_t, m_BufSize); 273 m_pBuffer = FX_Alloc(uint8_t, m_BufSize);
272 } 274 }
273 uint8_t* buffer = (uint8_t*)pBuf; 275 uint8_t* buffer = (uint8_t*)pBuf;
274 FX_STRSIZE temp_size = (FX_STRSIZE)size; 276 FX_STRSIZE temp_size = (FX_STRSIZE)size;
275 while (temp_size > 0) { 277 while (temp_size > 0) {
276 FX_STRSIZE buf_size = FX_MIN(m_BufSize - m_Length, (FX_STRSIZE)temp_size); 278 FX_STRSIZE buf_size = std::min(m_BufSize - m_Length, (FX_STRSIZE)temp_size);
277 FXSYS_memcpy(m_pBuffer + m_Length, buffer, buf_size); 279 FXSYS_memcpy(m_pBuffer + m_Length, buffer, buf_size);
278 m_Length += buf_size; 280 m_Length += buf_size;
279 if (m_Length == m_BufSize) { 281 if (m_Length == m_BufSize) {
280 if (!Flush()) { 282 if (!Flush()) {
281 return -1; 283 return -1;
282 } 284 }
283 } 285 }
284 temp_size -= buf_size; 286 temp_size -= buf_size;
285 buffer += buf_size; 287 buffer += buf_size;
286 } 288 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 } 326 }
325 FX_BOOL CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) { 327 FX_BOOL CFX_FileBufferArchive::DoWork(const void* pBuf, size_t size) {
326 if (!m_pFile) { 328 if (!m_pFile) {
327 return FALSE; 329 return FALSE;
328 } 330 }
329 if (!pBuf || size < 1) { 331 if (!pBuf || size < 1) {
330 return TRUE; 332 return TRUE;
331 } 333 }
332 return m_pFile->WriteBlock(pBuf, size); 334 return m_pFile->WriteBlock(pBuf, size);
333 } 335 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/extension.h ('k') | core/src/fxcrt/fx_basic_wstring.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698