Browse Source

* fix SysUtils.HashName as proposed by Awkward in #39827, resolves #39827
* adapted to syscodepages.inc for the fixed HashName

florian 3 years ago
parent
commit
4fecfe3df3
1 changed files with 3 additions and 2 deletions
  1. 3 2
      rtl/objpas/sysutils/sysansi.inc

+ 3 - 2
rtl/objpas/sysutils/sysansi.inc

@@ -64,10 +64,11 @@ end;
 
 
 Function HashName(Name: PAnsiChar): LongWord;
 Function HashName(Name: PAnsiChar): LongWord;
 Var
 Var
-  thehash,g,I : LongWord;
+  thehash,g : LongWord;
+  I : SizeInt;
 begin
 begin
   thehash:=0;
   thehash:=0;
-  For I:=1 to Length(Name) do { 0 terminated }
+  For I:=0 to StrLen(Name)-1 do { 0 terminated }
     begin
     begin
       thehash:=thehash shl 4;
       thehash:=thehash shl 4;
       inc(theHash,Ord(UpCase(Name[i])));
       inc(theHash,Ord(UpCase(Name[i])));