From 51be93f2d7fe2ad0a48257c27dce03313e3e1831 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Mon, 16 Dec 2019 20:34:53 +0800 Subject: [PATCH] 1.fix List::GetBegin/GetEnd bug. 2.fix TextOutputStream bug --- inc/hgl/io/TextOutputStream.h | 2 +- inc/hgl/type/List.cpp | 4 ++-- inc/hgl/type/StringList.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/hgl/io/TextOutputStream.h b/inc/hgl/io/TextOutputStream.h index 20f838b..68e0522 100644 --- a/inc/hgl/io/TextOutputStream.h +++ b/inc/hgl/io/TextOutputStream.h @@ -123,7 +123,7 @@ namespace hgl for(int i=0;i &str=sl[i]; + const T &str=sl.GetString(i); const int len=str.Length(); diff --git a/inc/hgl/type/List.cpp b/inc/hgl/type/List.cpp index 72c9ae2..ed39490 100644 --- a/inc/hgl/type/List.cpp +++ b/inc/hgl/type/List.cpp @@ -19,7 +19,7 @@ namespace hgl template bool List::Begin(T &ti)const { - if(!items) + if(!items||count<=0) return(false); memcpy(&ti,items,sizeof(T)); @@ -29,7 +29,7 @@ namespace hgl template bool List::End(T &ti)const { - if(!items) + if(!items||count<=0) return(false); memcpy(&ti,items+count-1,sizeof(T)); diff --git a/inc/hgl/type/StringList.h b/inc/hgl/type/StringList.h index 70cffa0..1e94875 100644 --- a/inc/hgl/type/StringList.h +++ b/inc/hgl/type/StringList.h @@ -205,7 +205,7 @@ namespace hgl Items.Exchange(index1,index2); } - T &GetString(int n)const{return *(Items[n]);} ///<取得指定行字符串 + const T &GetString(int n)const{return *(Items[n]);} ///<取得指定行字符串 };//template class StringList template T StringList::NullString; ///<空字符串实例