From 46574e0f49560525442b9d46575aed58678b965a Mon Sep 17 00:00:00 2001 From: hyzboy Date: Sat, 8 Aug 2020 20:10:27 +0800 Subject: [PATCH] use int64 instead size_t in MemoryInputStream/MemoryOutputStream --- inc/hgl/io/MemoryInputStream.h | 8 ++++---- inc/hgl/io/MemoryOutputStream.h | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/inc/hgl/io/MemoryInputStream.h b/inc/hgl/io/MemoryInputStream.h index b7a7445..982bac9 100644 --- a/inc/hgl/io/MemoryInputStream.h +++ b/inc/hgl/io/MemoryInputStream.h @@ -14,8 +14,8 @@ namespace hgl protected: const uint8 *buf; - size_t buf_size; - size_t cur_pos; + int64 buf_size; + int64 cur_pos; public: @@ -37,7 +37,7 @@ namespace hgl * @param size 数据长度字节数 * @return 是否成功 */ - bool Link(const void *data,const size_t size) + bool Link(const void *data,const int64 size) { if(!data) return(false); @@ -55,7 +55,7 @@ namespace hgl * @param size 数据长度字节数 * @return 是否成功 */ - bool Update(void *data,size_t size) + bool Update(void *data,int64 size) { if(!data) return(false); diff --git a/inc/hgl/io/MemoryOutputStream.h b/inc/hgl/io/MemoryOutputStream.h index ea6ce88..9c48bdb 100644 --- a/inc/hgl/io/MemoryOutputStream.h +++ b/inc/hgl/io/MemoryOutputStream.h @@ -15,9 +15,9 @@ namespace hgl uint8 *buf; - size_t max_size; - size_t buf_size; - size_t cur_pos; + int64 max_size; + int64 buf_size; + int64 cur_pos; bool one; @@ -44,7 +44,7 @@ namespace hgl * @param len 存放数据长度的指针 * @return 创建好的内存拷贝 */ - void *CreateCopyData(int *len)const + void *CreateCopyData(int64 *len)const { if(buf_size<=0) return(nullptr); @@ -66,7 +66,7 @@ namespace hgl * @param one_instance 是否仅此一份实例(如果是,将由MemoryOutputStream类负责释放) * @return 是否成功 */ - bool Link(void *ptr,size_t size,bool one_instance=false) + bool Link(void *ptr,int64 size,bool one_instance=false) { if(!ptr||!size) return(false); @@ -87,7 +87,7 @@ namespace hgl * @param size 数据长度字节数 * @return 是否成功 */ - bool Update(void *ptr,size_t size) + bool Update(void *ptr,int64 size) { if(!ptr||!size) return(false);