From 072153aa9135d7de413cc9d63e3019e9853d7045 Mon Sep 17 00:00:00 2001 From: "HuYingzhuo(hugo/hyzboy)" Date: Wed, 20 Sep 2023 21:52:58 +0800 Subject: [PATCH] fixed 3 bugs in ActiveMemoryBlockManager --- src/Type/ActiveMemoryBlockManager.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Type/ActiveMemoryBlockManager.cpp b/src/Type/ActiveMemoryBlockManager.cpp index 179d696..d8ea378 100644 --- a/src/Type/ActiveMemoryBlockManager.cpp +++ b/src/Type/ActiveMemoryBlockManager.cpp @@ -89,7 +89,7 @@ namespace hgl void *ActiveMemoryBlockManager::GetData(const int id)const { - if(!id||id<0||id>=aim.GetHistoryMaxId()) + if(id<0||id>=aim.GetHistoryMaxId()) return(nullptr); return (uint8 *)(data_mb->Get())+id*unit_size; @@ -97,7 +97,7 @@ namespace hgl bool ActiveMemoryBlockManager::GetData(void *da,const int id)const { - if(!id||id<0||id>=aim.GetHistoryMaxId()) + if(id<0||id>=aim.GetHistoryMaxId()) return(false); memcpy(da,(uint8 *)(data_mb->Get())+id*unit_size,unit_size); @@ -199,7 +199,6 @@ namespace hgl if(!Get(da,count)) return(false); - ReallocDataBlock(); return(true); }