From 3f44011ea2894e618c8fdd361e3b7f7260bf7a04 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Mon, 5 May 2025 03:24:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Macro.h=E5=A2=9E=E5=8A=A0SAFE=5FCLEAR=5FSTD?= =?UTF-8?q?=5FMAP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/hgl/Macro.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inc/hgl/Macro.h b/inc/hgl/Macro.h index 4fd5fa2..03cbf7b 100644 --- a/inc/hgl/Macro.h +++ b/inc/hgl/Macro.h @@ -77,4 +77,6 @@ namespace hgl name=nullptr; \ } \ } -}//namespace hgl \ No newline at end of file + + #define SAFE_CLEAR_STD_MAP(name) {for(auto &it:name)delete it.second;} +}//namespace hgl From b4d1bd17a9a85feb5f13cc6fac201f4f75942f70 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Tue, 6 May 2025 00:39:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8DStringInstance=E6=9C=AB?= =?UTF-8?q?=E4=BD=8D=E6=B7=BB0=E6=97=B6=E5=8F=AF=E8=83=BD=E5=86=85?= =?UTF-8?q?=E5=AD=98=E4=B8=8D=E5=A4=9F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/hgl/type/StringInstance.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/hgl/type/StringInstance.h b/inc/hgl/type/StringInstance.h index 4db7d29..d1db086 100644 --- a/inc/hgl/type/StringInstance.h +++ b/inc/hgl/type/StringInstance.h @@ -400,7 +400,7 @@ namespace hgl if(need_length>malloc_length) { - malloc_length=power_to_2(need_length); + malloc_length=power_to_2(need_length+1); T *new_str=new T[malloc_length];