* Use const string arguments where possible. Fixes issue #40441

This commit is contained in:
Michaël Van Canneyt 2023-10-12 08:49:07 +02:00
parent ac5b96a0c9
commit 38776ca494
3 changed files with 9 additions and 9 deletions

View File

@ -654,9 +654,9 @@ Type
{$IFNDEF PAS2JS}
function GetInt64s(const AName : String): Int64;
function GetUnicodeStrings(const AName : String): TJSONUnicodeStringType;
function GetQWords(AName : String): QWord;
function GetQWords(const AName : String): QWord;
procedure SetInt64s(const AName : String; const AValue: Int64);
procedure SetQWords(AName : String; AValue: QWord);
procedure SetQWords(const AName : String; AValue: QWord);
procedure SetUnicodeStrings(const AName : String; const AValue: TJSONUnicodeStringType);
{$ELSE}
function GetNativeInts(const AName : String): NativeInt;
@ -1507,7 +1507,7 @@ end;
procedure TJSONData.DumpJSON(S: TFPJSStream);
Procedure W(T : String);
Procedure W(const T : String);
begin
if T='' then exit;
{$IFDEF PAS2JS}
@ -3219,7 +3219,7 @@ begin
Result:=GetElements(AName).AsInt64;
end;
function TJSONObject.GetQWords(AName : String): QWord;
function TJSONObject.GetQWords(const AName : String): QWord;
begin
Result:=GetElements(AName).AsQWord;
end;
@ -3235,7 +3235,7 @@ begin
SetElements(AName,CreateJSON(AVAlue));
end;
procedure TJSONObject.SetQWords(AName : String; AValue: QWord);
procedure TJSONObject.SetQWords(const AName : String; AValue: QWord);
begin
SetElements(AName,CreateJSON(AVAlue));
end;

View File

@ -56,7 +56,7 @@ Type
procedure SetSourceJSON(AValue: TJSONObject);
Protected
procedure Apply(aSrc, aApply: TJSONObject); virtual;
procedure SaveDestJSON(aFileName : string);
procedure SaveDestJSON(const aFileName : string);
procedure SaveDestJSON(aStream : TStream);
Public
destructor destroy; override;
@ -201,7 +201,7 @@ begin
end;
end;
procedure TJSONApplier.SaveDestJSON(aFileName: string);
procedure TJSONApplier.SaveDestJSON(const aFileName: string);
Var
F : TFileStream;

View File

@ -152,7 +152,7 @@ Type
procedure SetCaseInsensitive(AValue: Boolean);
protected
// Try to parse a date.
Function ExtractDateTime(S : String): TDateTime;
Function ExtractDateTime(const S : String): TDateTime;
function GetObject(AInstance : TObject; const APropName: TJSONStringType; D: TJSONObject; PropInfo: PPropInfo): TObject;
procedure DoClearProperty(AObject: TObject; PropInfo: PPropInfo); virtual;
procedure DoRestoreProperty(AObject: TObject; PropInfo: PPropInfo; PropData: TJSONData); virtual;
@ -380,7 +380,7 @@ begin
Exclude(Foptions,jdoCaseInsensitive);
end;
function TJSONDeStreamer.ExtractDateTime(S: String): TDateTime;
function TJSONDeStreamer.ExtractDateTime(const S: String): TDateTime;
Var
Fmt : String;