修正初始容量为0时,扩容会永远失败的BUG
This commit is contained in:
parent
7a7986c4e4
commit
c3cad1019e
|
@ -355,8 +355,9 @@ bool MemoryStream::CheckRemain(uint count)
|
||||||
if(!CanResize) return Stream::CheckRemain(count);
|
if(!CanResize) return Stream::CheckRemain(count);
|
||||||
|
|
||||||
// 原始容量成倍扩容
|
// 原始容量成倍扩容
|
||||||
uint total = _Position + count;
|
uint total = _Position + count;
|
||||||
uint size = _Capacity;
|
uint size = _Capacity;
|
||||||
|
if(size < 0x10) size = 0x10;
|
||||||
while(size < total) size <<= 1;
|
while(size < total) size <<= 1;
|
||||||
|
|
||||||
// 申请新的空间,并复制数据
|
// 申请新的空间,并复制数据
|
||||||
|
|
Loading…
Reference in New Issue