diff options
author | Ryan Harrison <rharrison@chromium.org> | 2017-09-27 10:53:11 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-09-27 16:11:38 +0000 |
commit | 875e98c581952478f3a3ccef9b2f2e3ed06c5346 (patch) | |
tree | 8e0d7e032056bf4c73d6da43c0f3ce4eadb74dfd /core/fxcrt/cfx_binarybuf.cpp | |
parent | cc3a3ee3ebcc1baabdfa7ffca5876dbbfa3980c1 (diff) | |
download | pdfium-875e98c581952478f3a3ccef9b2f2e3ed06c5346.tar.xz |
Remove FX_STRSIZE and replace with size_t
BUG=pdfium:828
Change-Id: I5c40237433ebabaeabdb43aec9cdf783e41dfe16
Reviewed-on: https://pdfium-review.googlesource.com/13230
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcrt/cfx_binarybuf.cpp')
-rw-r--r-- | core/fxcrt/cfx_binarybuf.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/core/fxcrt/cfx_binarybuf.cpp b/core/fxcrt/cfx_binarybuf.cpp index b826fdd5b5..d1bd05385d 100644 --- a/core/fxcrt/cfx_binarybuf.cpp +++ b/core/fxcrt/cfx_binarybuf.cpp @@ -12,14 +12,14 @@ CFX_BinaryBuf::CFX_BinaryBuf() : m_AllocStep(0), m_AllocSize(0), m_DataSize(0) {} -CFX_BinaryBuf::CFX_BinaryBuf(FX_STRSIZE size) +CFX_BinaryBuf::CFX_BinaryBuf(size_t size) : m_AllocStep(0), m_AllocSize(size), m_DataSize(size) { m_pBuffer.reset(FX_Alloc(uint8_t, size)); } CFX_BinaryBuf::~CFX_BinaryBuf() {} -void CFX_BinaryBuf::Delete(FX_STRSIZE start_index, FX_STRSIZE count) { +void CFX_BinaryBuf::Delete(size_t start_index, size_t count) { if (!m_pBuffer || count > m_DataSize || start_index > m_DataSize - count) return; @@ -28,7 +28,7 @@ void CFX_BinaryBuf::Delete(FX_STRSIZE start_index, FX_STRSIZE count) { m_DataSize -= count; } -FX_STRSIZE CFX_BinaryBuf::GetLength() const { +size_t CFX_BinaryBuf::GetLength() const { return m_DataSize; } @@ -42,20 +42,20 @@ std::unique_ptr<uint8_t, FxFreeDeleter> CFX_BinaryBuf::DetachBuffer() { return std::move(m_pBuffer); } -void CFX_BinaryBuf::EstimateSize(FX_STRSIZE size, FX_STRSIZE step) { +void CFX_BinaryBuf::EstimateSize(size_t size, size_t step) { m_AllocStep = step; if (m_AllocSize < size) ExpandBuf(size - m_DataSize); } -void CFX_BinaryBuf::ExpandBuf(FX_STRSIZE add_size) { +void CFX_BinaryBuf::ExpandBuf(size_t add_size) { FX_SAFE_STRSIZE new_size = m_DataSize; new_size += add_size; if (m_AllocSize >= new_size.ValueOrDie()) return; - FX_STRSIZE alloc_step = std::max(static_cast<FX_STRSIZE>(128), - m_AllocStep ? m_AllocStep : m_AllocSize / 4); + size_t alloc_step = std::max(static_cast<size_t>(128), + m_AllocStep ? m_AllocStep : m_AllocSize / 4); new_size += alloc_step - 1; // Quantize, don't combine these lines. new_size /= alloc_step; new_size *= alloc_step; @@ -65,8 +65,8 @@ void CFX_BinaryBuf::ExpandBuf(FX_STRSIZE add_size) { : FX_Alloc(uint8_t, m_AllocSize)); } -void CFX_BinaryBuf::AppendBlock(const void* pBuf, FX_STRSIZE size) { - if (size <= 0) +void CFX_BinaryBuf::AppendBlock(const void* pBuf, size_t size) { + if (size == 0) return; ExpandBuf(size); @@ -78,9 +78,7 @@ void CFX_BinaryBuf::AppendBlock(const void* pBuf, FX_STRSIZE size) { m_DataSize += size; } -void CFX_BinaryBuf::InsertBlock(FX_STRSIZE pos, - const void* pBuf, - FX_STRSIZE size) { +void CFX_BinaryBuf::InsertBlock(size_t pos, const void* pBuf, size_t size) { if (size <= 0) return; |