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

Side by Side Diff: core/include/fxcrt/fx_basic.h

Issue 1712353002: Remove IFX_BufferArchive. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: pFile never null. 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 | « no previous file | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.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 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_ 7 #ifndef CORE_INCLUDE_FXCRT_FX_BASIC_H_
8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_ 8 #define CORE_INCLUDE_FXCRT_FX_BASIC_H_
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 protected: 173 protected:
174 FX_DWORD m_LoadingPos; 174 FX_DWORD m_LoadingPos;
175 175
176 const uint8_t* m_pLoadingBuf; 176 const uint8_t* m_pLoadingBuf;
177 177
178 FX_DWORD m_LoadingSize; 178 FX_DWORD m_LoadingSize;
179 }; 179 };
180 #endif // PDF_ENABLE_XFA 180 #endif // PDF_ENABLE_XFA
181 181
182 class IFX_BufferArchive { 182 class CFX_FileBufferArchive {
183 public: 183 public:
184 IFX_BufferArchive(FX_STRSIZE size); 184 CFX_FileBufferArchive();
185 virtual ~IFX_BufferArchive() {}
186 185
187 virtual void Clear(); 186 void Clear();
188 187 bool Flush();
189 FX_BOOL Flush();
190
191 int32_t AppendBlock(const void* pBuf, size_t size); 188 int32_t AppendBlock(const void* pBuf, size_t size);
192
193 int32_t AppendByte(uint8_t byte); 189 int32_t AppendByte(uint8_t byte);
194
195 int32_t AppendDWord(FX_DWORD i); 190 int32_t AppendDWord(FX_DWORD i);
196
197 int32_t AppendString(const CFX_ByteStringC& lpsz); 191 int32_t AppendString(const CFX_ByteStringC& lpsz);
198 192
199 protected: 193 // |pFile| must outlive the CFX_FileBufferArchive.
200 virtual FX_BOOL DoWork(const void* pBuf, size_t size) = 0; 194 void AttachFile(IFX_StreamWrite* pFile);
201
202 FX_STRSIZE m_BufSize;
203
204 uint8_t* m_pBuffer;
205
206 FX_STRSIZE m_Length;
207 };
208
209 class CFX_FileBufferArchive : public IFX_BufferArchive {
210 public:
211 CFX_FileBufferArchive(FX_STRSIZE size = 32768);
212 ~CFX_FileBufferArchive() override;
213
214 void Clear() override;
215 FX_BOOL AttachFile(IFX_StreamWrite* pFile, FX_BOOL bTakeover = FALSE);
216 195
217 private: 196 private:
218 FX_BOOL DoWork(const void* pBuf, size_t size) override; 197 static const size_t kBufSize = 32768;
219 198
199 size_t m_Length;
200 std::unique_ptr<uint8_t, FxFreeDeleter> m_pBuffer;
220 IFX_StreamWrite* m_pFile; 201 IFX_StreamWrite* m_pFile;
221 FX_BOOL m_bTakeover;
222 }; 202 };
223 203
224 class CFX_CharMap { 204 class CFX_CharMap {
225 public: 205 public:
226 static CFX_ByteString GetByteString(FX_WORD codepage, 206 static CFX_ByteString GetByteString(FX_WORD codepage,
227 const CFX_WideString& wstr); 207 const CFX_WideString& wstr);
228 208
229 static CFX_WideString GetWideString(FX_WORD codepage, 209 static CFX_WideString GetWideString(FX_WORD codepage,
230 const CFX_ByteString& bstr); 210 const CFX_ByteString& bstr);
231 211
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 FX_FLOAT c; 1171 FX_FLOAT c;
1192 FX_FLOAT d; 1172 FX_FLOAT d;
1193 FX_FLOAT e; 1173 FX_FLOAT e;
1194 FX_FLOAT f; 1174 FX_FLOAT f;
1195 FX_FLOAT g; 1175 FX_FLOAT g;
1196 FX_FLOAT h; 1176 FX_FLOAT h;
1197 FX_FLOAT i; 1177 FX_FLOAT i;
1198 }; 1178 };
1199 1179
1200 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_ 1180 #endif // CORE_INCLUDE_FXCRT_FX_BASIC_H_
OLDNEW
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698