瀏覽代碼

* Optimization by Bart. Fixes issue #40150

Michaël Van Canneyt 1 月之前
父節點
當前提交
3c7d0cbe27
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      rtl/objpas/sysutils/sysstr.inc

+ 2 - 2
rtl/objpas/sysutils/sysstr.inc

@@ -292,7 +292,7 @@ end;
 function SameText(const s1,s2:String):Boolean; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
 
 begin
- Result:=CompareText(S1,S2)=0;
+ Result:=(Length(s1)=Length(s2)) and (CompareText(S1,S2)=0);
 end;
 
 function SameText(const s1,s2:String; LocaleOptions: TLocaleOptions):Boolean; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
@@ -307,7 +307,7 @@ end;
 function SameStr(const s1,s2:String):Boolean; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
 
 begin
- Result:=CompareStr(S1,S2)=0;
+ Result:=(Length(s1)=Length(s2)) and (CompareStr(S1,S2)=0);
 end;
 
 function SameStr(const s1,s2:String; LocaleOptions: TLocaleOptions):Boolean; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}