summaryrefslogtreecommitdiff
path: root/core/fxcrt/cfx_binarybuf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt/cfx_binarybuf.cpp')
-rw-r--r--core/fxcrt/cfx_binarybuf.cpp22
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;