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

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

Issue 1577503002: Merge to XFA: Switch most min/max macros to std::min/max. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: rebase 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/fx_basic_wstring.cpp ('k') | core/src/fxcrt/xml_int.h » ('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/fxcrt/fx_basic.h" 7 #include "core/include/fxcrt/fx_basic.h"
8 #include "core/include/fxcrt/fx_ext.h" 8 #include "core/include/fxcrt/fx_ext.h"
9 #include "extension.h" 9 #include "extension.h"
10 10
11 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 11 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
12 #include <wincrypt.h> 12 #include <wincrypt.h>
13 #else 13 #else
14 #include <ctime> 14 #include <ctime>
15 #endif 15 #endif
16 16
17 CFX_CRTFileStream::CFX_CRTFileStream(IFXCRT_FileAccess* pFA)
18 : m_pFile(pFA), m_dwCount(1) {}
19
20 CFX_CRTFileStream::~CFX_CRTFileStream() {
21 if (m_pFile) {
22 m_pFile->Release();
23 }
24 }
25
26 IFX_FileStream* CFX_CRTFileStream::Retain() {
27 m_dwCount++;
28 return this;
29 }
30
31 void CFX_CRTFileStream::Release() {
32 FX_DWORD nCount = --m_dwCount;
33 if (!nCount) {
34 delete this;
35 }
36 }
37
38 FX_FILESIZE CFX_CRTFileStream::GetSize() {
39 return m_pFile->GetSize();
40 }
41
42 FX_BOOL CFX_CRTFileStream::IsEOF() {
43 return GetPosition() >= GetSize();
44 }
45
46 FX_FILESIZE CFX_CRTFileStream::GetPosition() {
47 return m_pFile->GetPosition();
48 }
49
50 FX_BOOL CFX_CRTFileStream::ReadBlock(void* buffer,
51 FX_FILESIZE offset,
52 size_t size) {
53 return (FX_BOOL)m_pFile->ReadPos(buffer, size, offset);
54 }
55
56 size_t CFX_CRTFileStream::ReadBlock(void* buffer, size_t size) {
57 return m_pFile->Read(buffer, size);
58 }
59
60 FX_BOOL CFX_CRTFileStream::WriteBlock(const void* buffer,
61 FX_FILESIZE offset,
62 size_t size) {
63 return (FX_BOOL)m_pFile->WritePos(buffer, size, offset);
64 }
65
66 FX_BOOL CFX_CRTFileStream::Flush() {
67 return m_pFile->Flush();
68 }
69
17 #ifdef PDF_ENABLE_XFA 70 #ifdef PDF_ENABLE_XFA
18 IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) { 71 IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) {
19 if (wsPath.GetLength() == 0) 72 if (wsPath.GetLength() == 0)
20 return NULL; 73 return NULL;
21 74
22 CFX_CRTFileAccess* pFA = NULL; 75 CFX_CRTFileAccess* pFA = NULL;
23 pFA = new CFX_CRTFileAccess; 76 pFA = new CFX_CRTFileAccess;
24 if (NULL == pFA) 77 if (NULL == pFA)
25 return NULL; 78 return NULL;
26 79
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 b = ((const uint8_t*)pGUID)[i]; 386 b = ((const uint8_t*)pGUID)[i];
334 *pBuf++ = gs_FX_pHexChars[b >> 4]; 387 *pBuf++ = gs_FX_pHexChars[b >> 4];
335 *pBuf++ = gs_FX_pHexChars[b & 0x0F]; 388 *pBuf++ = gs_FX_pHexChars[b & 0x0F];
336 if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) { 389 if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) {
337 *pBuf++ = L'-'; 390 *pBuf++ = L'-';
338 } 391 }
339 } 392 }
340 bsStr.ReleaseBuffer(bSeparator ? 36 : 32); 393 bsStr.ReleaseBuffer(bSeparator ? 36 : 32);
341 } 394 }
342 #endif // PDF_ENABLE_XFA 395 #endif // PDF_ENABLE_XFA
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_wstring.cpp ('k') | core/src/fxcrt/xml_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698