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

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

Issue 2430743003: in the attempt to fix 627393, changed IFX_FileRead's readBlock to return the length it reads
Patch Set: fix an undefined variable Created 4 years, 1 month 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_FXCRT_EXTENSION_H_ 7 #ifndef CORE_FXCRT_EXTENSION_H_
8 #define CORE_FXCRT_EXTENSION_H_ 8 #define CORE_FXCRT_EXTENSION_H_
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 public: 58 public:
59 explicit CFX_CRTFileStream(std::unique_ptr<IFXCRT_FileAccess> pFA); 59 explicit CFX_CRTFileStream(std::unique_ptr<IFXCRT_FileAccess> pFA);
60 ~CFX_CRTFileStream() override; 60 ~CFX_CRTFileStream() override;
61 61
62 // IFX_SeekableStream: 62 // IFX_SeekableStream:
63 IFX_SeekableStream* Retain() override; 63 IFX_SeekableStream* Retain() override;
64 void Release() override; 64 void Release() override;
65 FX_FILESIZE GetSize() override; 65 FX_FILESIZE GetSize() override;
66 bool IsEOF() override; 66 bool IsEOF() override;
67 FX_FILESIZE GetPosition() override; 67 FX_FILESIZE GetPosition() override;
68 bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; 68 size_t ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
69 size_t ReadBlock(void* buffer, size_t size) override; 69 size_t ReadBlock(void* buffer, size_t size) override;
70 bool WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override; 70 bool WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override;
71 bool Flush() override; 71 bool Flush() override;
72 72
73 protected: 73 protected:
74 std::unique_ptr<IFXCRT_FileAccess> m_pFile; 74 std::unique_ptr<IFXCRT_FileAccess> m_pFile;
75 uint32_t m_dwCount; 75 uint32_t m_dwCount;
76 }; 76 };
77 77
78 #define FX_MEMSTREAM_BlockSize (64 * 1024) 78 #define FX_MEMSTREAM_BlockSize (64 * 1024)
79 #define FX_MEMSTREAM_Consecutive 0x01 79 #define FX_MEMSTREAM_Consecutive 0x01
80 #define FX_MEMSTREAM_TakeOver 0x02 80 #define FX_MEMSTREAM_TakeOver 0x02
81 81
82 class CFX_MemoryStream final : public IFX_MemoryStream { 82 class CFX_MemoryStream final : public IFX_MemoryStream {
83 public: 83 public:
84 explicit CFX_MemoryStream(bool bConsecutive); 84 explicit CFX_MemoryStream(bool bConsecutive);
85 CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, bool bTakeOver); 85 CFX_MemoryStream(uint8_t* pBuffer, size_t nSize, bool bTakeOver);
86 ~CFX_MemoryStream() override; 86 ~CFX_MemoryStream() override;
87 87
88 // IFX_MemoryStream 88 // IFX_MemoryStream
89 IFX_SeekableStream* Retain() override; 89 IFX_SeekableStream* Retain() override;
90 void Release() override; 90 void Release() override;
91 FX_FILESIZE GetSize() override; 91 FX_FILESIZE GetSize() override;
92 bool IsEOF() override; 92 bool IsEOF() override;
93 FX_FILESIZE GetPosition() override; 93 FX_FILESIZE GetPosition() override;
94 bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; 94 size_t ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
95 size_t ReadBlock(void* buffer, size_t size) override; 95 size_t ReadBlock(void* buffer, size_t size) override;
96 bool WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override; 96 bool WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size) override;
97 bool Flush() override; 97 bool Flush() override;
98 bool IsConsecutive() const override; 98 bool IsConsecutive() const override;
99 void EstimateSize(size_t nInitSize, size_t nGrowSize) override; 99 void EstimateSize(size_t nInitSize, size_t nGrowSize) override;
100 uint8_t* GetBuffer() const override; 100 uint8_t* GetBuffer() const override;
101 void AttachBuffer(uint8_t* pBuffer, 101 void AttachBuffer(uint8_t* pBuffer,
102 size_t nSize, 102 size_t nSize,
103 bool bTakeOver = false) override; 103 bool bTakeOver = false) override;
104 void DetachBuffer() override; 104 void DetachBuffer() override;
(...skipping 27 matching lines...) Expand all
132 uint32_t mt[MT_N]; 132 uint32_t mt[MT_N];
133 }; 133 };
134 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 134 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
135 bool FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount); 135 bool FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount);
136 #endif 136 #endif
137 #ifdef __cplusplus 137 #ifdef __cplusplus
138 } 138 }
139 #endif 139 #endif
140 140
141 #endif // CORE_FXCRT_EXTENSION_H_ 141 #endif // CORE_FXCRT_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698