summaryrefslogtreecommitdiff
path: root/core/src/fxcrt/fx_basic_buffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxcrt/fx_basic_buffer.cpp')
-rw-r--r--core/src/fxcrt/fx_basic_buffer.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp
index deb8133489..d993e5e567 100644
--- a/core/src/fxcrt/fx_basic_buffer.cpp
+++ b/core/src/fxcrt/fx_basic_buffer.cpp
@@ -13,9 +13,7 @@ CFX_BinaryBuf::CFX_BinaryBuf(FX_STRSIZE size)
m_pBuffer = FX_Alloc(uint8_t, size);
}
CFX_BinaryBuf::~CFX_BinaryBuf() {
- if (m_pBuffer) {
- FX_Free(m_pBuffer);
- }
+ FX_Free(m_pBuffer);
}
void CFX_BinaryBuf::Delete(int start_index, int count) {
if (!m_pBuffer || start_index < 0 || start_index + count > m_DataSize) {
@@ -34,9 +32,7 @@ void CFX_BinaryBuf::DetachBuffer() {
m_AllocSize = 0;
}
void CFX_BinaryBuf::AttachData(void* buffer, FX_STRSIZE size) {
- if (m_pBuffer) {
- FX_Free(m_pBuffer);
- }
+ FX_Free(m_pBuffer);
m_DataSize = size;
m_pBuffer = (uint8_t*)buffer;
m_AllocSize = size;
@@ -258,10 +254,8 @@ IFX_BufferArchive::IFX_BufferArchive(FX_STRSIZE size)
: m_BufSize(size), m_pBuffer(NULL), m_Length(0) {}
void IFX_BufferArchive::Clear() {
m_Length = 0;
- if (m_pBuffer) {
- FX_Free(m_pBuffer);
- m_pBuffer = NULL;
- }
+ FX_Free(m_pBuffer);
+ m_pBuffer = NULL;
}
FX_BOOL IFX_BufferArchive::Flush() {
FX_BOOL bRet = DoWork(m_pBuffer, m_Length);