Browse Source

* check zero length instead of comparing to empty string

Michael VAN CANNEYT 2 years ago
parent
commit
f04577d292
1 changed files with 4 additions and 4 deletions
  1. 4 4
      rtl/inc/ustrings.inc

+ 4 - 4
rtl/inc/ustrings.inc

@@ -458,12 +458,12 @@ Var
   same : boolean;
 begin
   { only assign if s1 or s2 is empty }
-  if (S1='') then
+  if Length(S1)=0 then
     begin
       DestS:=s2;
       exit;
     end;
-  if (S2='') then
+  if Length(S2)=0 then
     begin
       DestS:=s1;
       exit;
@@ -2064,7 +2064,7 @@ function UTF8Encode(const s : UnicodeString) : RawByteString;
     hs : UTF8String;
   begin
     result:='';
-    if s='' then
+    if Length(s)=0 then
       exit;
     SetLength(hs,length(s)*3);
     i:=UnicodeToUtf8(pansichar(hs),length(hs)+1,PUnicodeChar(s),length(s));
@@ -2085,7 +2085,7 @@ function UTF8Decode(const s : RawByteString): UnicodeString;
     hs : UnicodeString;
   begin
     result:='';
-    if s='' then
+    if Length(s)=0 then
       exit;
     SetLength(hs,length(s));
     i:=Utf8ToUnicode(PUnicodeChar(hs),length(hs)+1,pansichar(s),length(s));