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

Side by Side Diff: core/src/fxcrt/extension.h

Issue 1272653005: clang-format all pdfium code, again. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 4 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
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 #ifndef CORE_SRC_FXCRT_EXTENSION_H_ 7 #ifndef CORE_SRC_FXCRT_EXTENSION_H_
8 #define CORE_SRC_FXCRT_EXTENSION_H_ 8 #define CORE_SRC_FXCRT_EXTENSION_H_
9 9
10 #include "../../include/fxcrt/fx_basic.h" 10 #include "../../include/fxcrt/fx_basic.h"
(...skipping 14 matching lines...) Expand all
25 virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos) = 0; 25 virtual size_t ReadPos(void* pBuffer, size_t szBuffer, FX_FILESIZE pos) = 0;
26 virtual size_t WritePos(const void* pBuffer, 26 virtual size_t WritePos(const void* pBuffer,
27 size_t szBuffer, 27 size_t szBuffer,
28 FX_FILESIZE pos) = 0; 28 FX_FILESIZE pos) = 0;
29 virtual FX_BOOL Flush() = 0; 29 virtual FX_BOOL Flush() = 0;
30 virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0; 30 virtual FX_BOOL Truncate(FX_FILESIZE szFile) = 0;
31 }; 31 };
32 IFXCRT_FileAccess* FXCRT_FileAccess_Create(); 32 IFXCRT_FileAccess* FXCRT_FileAccess_Create();
33 class CFX_CRTFileStream final : public IFX_FileStream { 33 class CFX_CRTFileStream final : public IFX_FileStream {
34 public: 34 public:
35 CFX_CRTFileStream(IFXCRT_FileAccess* pFA) 35 CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1) {}
36 : m_pFile(pFA),
37 m_dwCount(1) {
38 }
39 ~CFX_CRTFileStream() { 36 ~CFX_CRTFileStream() {
40 if (m_pFile) { 37 if (m_pFile) {
41 m_pFile->Release(); 38 m_pFile->Release();
42 } 39 }
43 } 40 }
44 virtual IFX_FileStream* Retain() override { 41 virtual IFX_FileStream* Retain() override {
45 m_dwCount++; 42 m_dwCount++;
46 return this; 43 return this;
47 } 44 }
48 virtual void Release() override { 45 virtual void Release() override {
49 FX_DWORD nCount = --m_dwCount; 46 FX_DWORD nCount = --m_dwCount;
50 if (!nCount) { 47 if (!nCount) {
51 delete this; 48 delete this;
52 } 49 }
53 } 50 }
54 virtual FX_FILESIZE GetSize() override { 51 virtual FX_FILESIZE GetSize() override { return m_pFile->GetSize(); }
55 return m_pFile->GetSize();
56 }
57 virtual FX_BOOL IsEOF() override { return GetPosition() >= GetSize(); } 52 virtual FX_BOOL IsEOF() override { return GetPosition() >= GetSize(); }
58 virtual FX_FILESIZE GetPosition() override { 53 virtual FX_FILESIZE GetPosition() override { return m_pFile->GetPosition(); }
59 return m_pFile->GetPosition();
60 }
61 virtual FX_BOOL ReadBlock(void* buffer, 54 virtual FX_BOOL ReadBlock(void* buffer,
62 FX_FILESIZE offset, 55 FX_FILESIZE offset,
63 size_t size) override { 56 size_t size) override {
64 return (FX_BOOL)m_pFile->ReadPos(buffer, size, offset); 57 return (FX_BOOL)m_pFile->ReadPos(buffer, size, offset);
65 } 58 }
66 virtual size_t ReadBlock(void* buffer, size_t size) override { 59 virtual size_t ReadBlock(void* buffer, size_t size) override {
67 return m_pFile->Read(buffer, size); 60 return m_pFile->Read(buffer, size);
68 } 61 }
69 virtual FX_BOOL WriteBlock(const void* buffer, 62 virtual FX_BOOL WriteBlock(const void* buffer,
70 FX_FILESIZE offset, 63 FX_FILESIZE offset,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 m_dwCount++; 106 m_dwCount++;
114 return this; 107 return this;
115 } 108 }
116 virtual void Release() override { 109 virtual void Release() override {
117 FX_DWORD nCount = --m_dwCount; 110 FX_DWORD nCount = --m_dwCount;
118 if (nCount) { 111 if (nCount) {
119 return; 112 return;
120 } 113 }
121 delete this; 114 delete this;
122 } 115 }
123 virtual FX_FILESIZE GetSize() override { 116 virtual FX_FILESIZE GetSize() override { return (FX_FILESIZE)m_nCurSize; }
124 return (FX_FILESIZE)m_nCurSize;
125 }
126 virtual FX_BOOL IsEOF() override { return m_nCurPos >= (size_t)GetSize(); } 117 virtual FX_BOOL IsEOF() override { return m_nCurPos >= (size_t)GetSize(); }
127 virtual FX_FILESIZE GetPosition() override { 118 virtual FX_FILESIZE GetPosition() override { return (FX_FILESIZE)m_nCurPos; }
128 return (FX_FILESIZE)m_nCurPos;
129 }
130 virtual FX_BOOL ReadBlock(void* buffer, 119 virtual FX_BOOL ReadBlock(void* buffer,
131 FX_FILESIZE offset, 120 FX_FILESIZE offset,
132 size_t size) override { 121 size_t size) override {
133 if (!buffer || !size) { 122 if (!buffer || !size) {
134 return FALSE; 123 return FALSE;
135 } 124 }
136 125
137 FX_SAFE_SIZE_T newPos = size; 126 FX_SAFE_SIZE_T newPos = size;
138 newPos += offset; 127 newPos += offset;
139 if (!newPos.IsValid() || newPos.ValueOrDefault(0) == 0 || 128 if (!newPos.IsValid() || newPos.ValueOrDefault(0) == 0 ||
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } FX_MTRANDOMCONTEXT, *FX_LPMTRANDOMCONTEXT; 306 } FX_MTRANDOMCONTEXT, *FX_LPMTRANDOMCONTEXT;
318 typedef FX_MTRANDOMCONTEXT const* FX_LPCMTRANDOMCONTEXT; 307 typedef FX_MTRANDOMCONTEXT const* FX_LPCMTRANDOMCONTEXT;
319 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 308 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
320 FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount); 309 FX_BOOL FX_GenerateCryptoRandom(FX_DWORD* pBuffer, int32_t iCount);
321 #endif 310 #endif
322 #ifdef __cplusplus 311 #ifdef __cplusplus
323 } 312 }
324 #endif 313 #endif
325 314
326 #endif // CORE_SRC_FXCRT_EXTENSION_H_ 315 #endif // CORE_SRC_FXCRT_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698