OLD | NEW |
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 FXSYS_memcpy(m_Blocks[(int)nStartBlock] + (size_t)offset, buffer, nWrite); | 234 FXSYS_memcpy(m_Blocks[(int)nStartBlock] + (size_t)offset, buffer, nWrite); |
235 buffer = ((uint8_t*)buffer) + nWrite; | 235 buffer = ((uint8_t*)buffer) + nWrite; |
236 size -= nWrite; | 236 size -= nWrite; |
237 nStartBlock++; | 237 nStartBlock++; |
238 offset = 0; | 238 offset = 0; |
239 } | 239 } |
240 return TRUE; | 240 return TRUE; |
241 } | 241 } |
242 FX_BOOL Flush() override { return TRUE; } | 242 FX_BOOL Flush() override { return TRUE; } |
243 FX_BOOL IsConsecutive() const override { | 243 FX_BOOL IsConsecutive() const override { |
244 return m_dwFlags & FX_MEMSTREAM_Consecutive; | 244 return !!(m_dwFlags & FX_MEMSTREAM_Consecutive); |
245 } | 245 } |
246 void EstimateSize(size_t nInitSize, size_t nGrowSize) override { | 246 void EstimateSize(size_t nInitSize, size_t nGrowSize) override { |
247 if (m_dwFlags & FX_MEMSTREAM_Consecutive) { | 247 if (m_dwFlags & FX_MEMSTREAM_Consecutive) { |
248 if (m_Blocks.GetSize() < 1) { | 248 if (m_Blocks.GetSize() < 1) { |
249 uint8_t* pBlock = | 249 uint8_t* pBlock = |
250 FX_Alloc(uint8_t, std::max(nInitSize, static_cast<size_t>(4096))); | 250 FX_Alloc(uint8_t, std::max(nInitSize, static_cast<size_t>(4096))); |
251 m_Blocks.Add(pBlock); | 251 m_Blocks.Add(pBlock); |
252 } | 252 } |
253 m_nGrowSize = std::max(nGrowSize, static_cast<size_t>(4096)); | 253 m_nGrowSize = std::max(nGrowSize, static_cast<size_t>(4096)); |
254 } else if (m_Blocks.GetSize() < 1) { | 254 } else if (m_Blocks.GetSize() < 1) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 uint32_t mt[MT_N]; | 325 uint32_t mt[MT_N]; |
326 }; | 326 }; |
327 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 327 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
328 FX_BOOL FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount); | 328 FX_BOOL FX_GenerateCryptoRandom(uint32_t* pBuffer, int32_t iCount); |
329 #endif | 329 #endif |
330 #ifdef __cplusplus | 330 #ifdef __cplusplus |
331 } | 331 } |
332 #endif | 332 #endif |
333 | 333 |
334 #endif // CORE_FXCRT_EXTENSION_H_ | 334 #endif // CORE_FXCRT_EXTENSION_H_ |
OLD | NEW |