mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 17:49:13 +02:00
* array[cardinal] is buggy, use array[word]
* small fix in getresourcestring
This commit is contained in:
parent
6dac94ac96
commit
ea34cb18fa
@ -170,25 +170,25 @@ Type
|
||||
DefaultValue,
|
||||
CurrentValue : AnsiString;
|
||||
HashValue : longint;
|
||||
end;
|
||||
end;
|
||||
|
||||
TResourceStringTable = Packed Record
|
||||
Count : longint;
|
||||
Resrec : Array[Cardinal] of TResourceStringRecord;
|
||||
end;
|
||||
Resrec : Array[Word] of TResourceStringRecord;
|
||||
end;
|
||||
|
||||
Var
|
||||
ResourceStringTable : TResourceStringTable; External Name 'RESOURCESTRINGLIST';
|
||||
|
||||
Function FindHashIndex (Value : Longint) : Longint;
|
||||
|
||||
VAr I : longint;
|
||||
|
||||
Var
|
||||
I : longint;
|
||||
begin
|
||||
// Linear search, later we can implement binary search.
|
||||
With ResourceStringTable do
|
||||
For I:=0 to Count-1 do
|
||||
If Value=Resrec[result].HashValue then
|
||||
If Value=Resrec[I].HashValue then
|
||||
begin
|
||||
Result:=I;
|
||||
exit;
|
||||
@ -196,6 +196,7 @@ begin
|
||||
Result:=-1;
|
||||
end;
|
||||
|
||||
|
||||
Function GetResourceString(Hash : Longint) : AnsiString;[Public,Alias : 'FPC_GETRESOURCESTRING'];
|
||||
|
||||
begin
|
||||
@ -206,6 +207,7 @@ begin
|
||||
Result:='';
|
||||
end;
|
||||
|
||||
|
||||
Function SetResourceString(Hash : longint; Const Value : AnsiString) : Boolean;
|
||||
|
||||
begin
|
||||
@ -215,14 +217,16 @@ begin
|
||||
ResourceStringTable.ResRec[Hash].CurrentValue:=Value;
|
||||
end;
|
||||
|
||||
|
||||
Procedure ResetResourceTables;
|
||||
|
||||
Var I : longint;
|
||||
|
||||
begin
|
||||
For I:=0 to ResourceStringTable.Count-1 do
|
||||
ResourceStringTable.ResRec[i].CurrentValue:=
|
||||
ResourceStringTable.ResRec[i].DefaultValue;
|
||||
With ResourceStringTable do
|
||||
For I:=0 to Count-1 do
|
||||
With ResRec[i] do
|
||||
CurrentValue:=DefaultValue;
|
||||
end;
|
||||
|
||||
Initialization
|
||||
@ -233,7 +237,11 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.28 1999-07-23 22:51:11 michael
|
||||
Revision 1.29 1999-07-23 23:13:54 peter
|
||||
* array[cardinal] is buggy, use array[word]
|
||||
* small fix in getresourcestring
|
||||
|
||||
Revision 1.28 1999/07/23 22:51:11 michael
|
||||
* Added HasResourceStrings check
|
||||
|
||||
Revision 1.27 1999/07/22 20:30:13 michael
|
||||
|
Loading…
Reference in New Issue
Block a user