فهرست منبع

* Add const to string args where possible. Fix issue #40050

Michaël Van Canneyt 2 سال پیش
والد
کامیت
310db2ce92

+ 2 - 2
packages/fcl-base/src/avl_tree.pp

@@ -1117,7 +1117,7 @@ end;
 
 procedure TAVLTree.ConsistencyCheck;
 
-  procedure E(Msg: string);
+  procedure E(const Msg: string);
   begin
     raise Exception.Create('TAVLTree.ConsistencyCheck: '+Msg);
   end;
@@ -1353,7 +1353,7 @@ end;
 
 procedure TAVLTreeNode.ConsistencyCheck(Tree: TAVLTree);
 
-  procedure E(Msg: string);
+  procedure E(const Msg: string);
   begin
     raise Exception.Create('TAVLTreeNode.ConsistencyCheck: '+Msg);
   end;

+ 2 - 2
packages/fcl-base/src/custapp.pp

@@ -41,7 +41,7 @@ Type
     FCaseSensitiveOptions : Boolean;
     FStopOnException : Boolean;
     FExceptionExitCode : Integer;
-    function GetEnvironmentVar(VarName : String): String;
+    function GetEnvironmentVar(const VarName : String): String;
     function GetExeName: string;
     Function GetLocation : String;
     function GetSingleInstance: TBaseSingleInstance;
@@ -195,7 +195,7 @@ begin
     end;
 end;
 
-function TCustomApplication.GetEnvironmentVar(VarName : String): String;
+function TCustomApplication.GetEnvironmentVar(const VarName : String): String;
 begin
   Result:=GetEnvironmentVariable(VarName);
 end;

+ 18 - 18
packages/fcl-base/src/fpexprpars.pp

@@ -60,7 +60,7 @@ Type
     FTokenType : TTokenType;
   private
     function GetCurrentChar: Char;
-    procedure ScanError(Msg: String);
+    procedure ScanError(const Msg: String);
   protected
     procedure SetSource(const AValue: String); virtual;
     function DoIdentifier: TTokenType;
@@ -466,7 +466,7 @@ Type
   private
     FValue : TFPExpressionResult;
   public
-    Constructor CreateString(AValue : String);
+    Constructor CreateString(const AValue : String);
     Constructor CreateInteger(AValue : Int64);
     Constructor CreateDateTime(AValue : TDateTime);
     Constructor CreateFloat(AValue : TExprFloat);
@@ -579,12 +579,12 @@ Type
     Function IdentifierByName(Const AName : ShortString) : TFPExprIdentifierDef;
     Function AddVariable(Const AName : ShortString; AResultType : TResultType; ACallback : TFPExprVariableCallBack) : TFPExprIdentifierDef;
     Function AddVariable(Const AName : ShortString; AResultType : TResultType; ACallback : TFPExprVariableEvent) : TFPExprIdentifierDef;
-    Function AddVariable(Const AName : ShortString; AResultType : TResultType; AValue : String) : TFPExprIdentifierDef;
+    Function AddVariable(Const AName : ShortString; AResultType : TResultType; const AValue : String) : TFPExprIdentifierDef;
     Function AddBooleanVariable(Const AName : ShortString; AValue : Boolean) : TFPExprIdentifierDef;
     Function AddIntegerVariable(Const AName : ShortString; AValue : Integer) : TFPExprIdentifierDef;
     Function AddFloatVariable(Const AName : ShortString; AValue : TExprFloat) : TFPExprIdentifierDef;
     Function AddCurrencyVariable(Const AName : ShortString; AValue : Currency) : TFPExprIdentifierDef;
-    Function AddStringVariable(Const AName : ShortString; AValue : String) : TFPExprIdentifierDef;
+    Function AddStringVariable(Const AName : ShortString; const AValue : String) : TFPExprIdentifierDef;
     Function AddDateTimeVariable(Const AName : ShortString; AValue : TDateTime) : TFPExprIdentifierDef;
     Function AddFunction(Const AName : ShortString; Const AResultType : Char; Const AParamTypes : String; ACallBack : TFPExprFunctionCallBack) : TFPExprIdentifierDef;
     Function AddFunction(Const AName : ShortString; Const AResultType : Char; Const AParamTypes : String; ACallBack : TFPExprFunctionEvent) : TFPExprIdentifierDef;
@@ -742,7 +742,7 @@ Type
     procedure SetIdentifiers(const AValue: TFPExprIdentifierDefs);
     procedure AddIdentifierToStrings(Sender : TObject; Const aIdentifier : String; var ID : TFPExprIdentifierDef);
   Protected
-    procedure ParserError(Msg: String);
+    procedure ParserError(const Msg: String);
     procedure SetExpression(const AValue: String); virtual;
     Procedure CheckResultType(Const Res :TFPExpressionResult; AType : TResultType); inline;
     Procedure CheckResultTypes(Const Res :TFPExpressionResult; ATypes : TResultTypes); inline;
@@ -807,18 +807,18 @@ Type
     Function IndexOfIdentifier(Const AName : ShortString) : Integer;
     Function FindIdentifier(Const AName : ShortString) : TFPBuiltinExprIdentifierDef;
     Function IdentifierByName(Const AName : ShortString) : TFPBuiltinExprIdentifierDef;
-    Function AddVariable(Const ACategory : TBuiltInCategory; Const AName : ShortString; AResultType : TResultType; AValue : String) : TFPBuiltInExprIdentifierDef;
+    Function AddVariable(Const ACategory : TBuiltInCategory; Const AName : ShortString; AResultType : TResultType; const AValue : String) : TFPBuiltInExprIdentifierDef;
     Function AddBooleanVariable(Const ACategory : TBuiltInCategory; Const AName : ShortString; AValue : Boolean) : TFPBuiltInExprIdentifierDef;
     Function AddIntegerVariable(Const ACategory : TBuiltInCategory; Const AName : ShortString; AValue : Integer) : TFPBuiltInExprIdentifierDef;
     Function AddFloatVariable(Const ACategory : TBuiltInCategory; Const AName : ShortString; AValue : TExprFloat) : TFPBuiltInExprIdentifierDef;
     Function AddCurrencyVariable(Const ACategory : TBuiltInCategory; Const AName : ShortString; AValue : Currency) : TFPBuiltInExprIdentifierDef;
-    Function AddStringVariable(Const ACategory : TBuiltInCategory; Const AName : ShortString; AValue : String) : TFPBuiltInExprIdentifierDef;
+    Function AddStringVariable(Const ACategory : TBuiltInCategory; Const AName : ShortString; const AValue : String) : TFPBuiltInExprIdentifierDef;
     Function AddDateTimeVariable(Const ACategory : TBuiltInCategory; Const AName : ShortString; AValue : TDateTime) : TFPBuiltInExprIdentifierDef;
     Function AddFunction(Const ACategory : TBuiltInCategory; Const AName : ShortString; Const AResultType : Char; Const AParamTypes : String; ACallBack : TFPExprFunctionCallBack) : TFPBuiltInExprIdentifierDef;
     Function AddFunction(Const ACategory : TBuiltInCategory; Const AName : ShortString; Const AResultType : Char; Const AParamTypes : String; ACallBack : TFPExprFunctionEvent) : TFPBuiltInExprIdentifierDef;
     Function AddFunction(Const ACategory : TBuiltInCategory; Const AName : ShortString; Const AResultType : Char; Const AParamTypes : String; ANodeClass : TFPExprFunctionClass) : TFPBuiltInExprIdentifierDef;
     Procedure Delete(AIndex: Integer);
-    Function Remove(aIdentifier : String) : Integer;
+    Function Remove(const aIdentifier : String) : Integer;
     Property IdentifierCount : Integer Read GetCount;
     Property Identifiers[AIndex : Integer] :TFPBuiltInExprIdentifierDef Read GetI;
   end;
@@ -909,12 +909,12 @@ Resourcestring
   Auxiliary functions
   ---------------------------------------------------------------------}
 
-Procedure RaiseParserError(Msg : String);
+Procedure RaiseParserError(const Msg : String);
 begin
   Raise EExprParser.Create(Msg);
 end;
 
-Procedure RaiseParserError(Fmt : String; Args : Array of const);
+Procedure RaiseParserError(const Fmt : String; const Args : Array of const);
 begin
   Raise EExprParser.CreateFmt(Fmt,Args);
 end;
@@ -1318,7 +1318,7 @@ begin
 
 end;
 
-Procedure TFPExpressionScanner.ScanError(Msg : String);
+Procedure TFPExpressionScanner.ScanError(const Msg : String);
 
 begin
   Raise EExprScanner.Create(Msg)
@@ -1668,7 +1668,7 @@ begin
     end;
 end;
 
-procedure TFPExpressionParser.ParserError(Msg: String);
+procedure TFPExpressionParser.ParserError(const Msg: String);
 begin
   Raise EExprParser.Create(Msg);
 end;
@@ -2279,7 +2279,7 @@ begin
 end;
 
 function TFPExprIdentifierDefs.AddVariable(const AName: ShortString;
-  AResultType: TResultType; AValue: String): TFPExprIdentifierDef;
+  AResultType: TResultType; const AValue: String): TFPExprIdentifierDef;
 begin
   Result:=Add as TFPExprIdentifierDef;
   Result.IdentifierType:=itVariable;
@@ -2328,7 +2328,7 @@ begin
 end;
 
 function TFPExprIdentifierDefs.AddStringVariable(const AName: ShortString;
-  AValue: String): TFPExprIdentifierDef;
+  const AValue: String): TFPExprIdentifierDef;
 begin
   Result:=Add as TFPExprIdentifierDef;
   Result.IdentifierType:=itVariable;
@@ -2690,7 +2690,7 @@ begin
 end;
 
 function TExprBuiltInManager.AddVariable(const ACategory: TBuiltInCategory;
-  const AName: ShortString; AResultType: TResultType; AValue: String
+  const AName: ShortString; AResultType: TResultType; const AValue: String
   ): TFPBuiltInExprIdentifierDef;
 begin
   Result:=TFPBuiltInExprIdentifierDef(FDefs.Addvariable(AName,AResultType,AValue));
@@ -2729,7 +2729,7 @@ begin
 end;
 
 function TExprBuiltInManager.AddStringVariable(
-  const ACategory: TBuiltInCategory; const AName: ShortString; AValue: String
+  const ACategory: TBuiltInCategory; const AName: ShortString; const AValue: String
   ): TFPBuiltInExprIdentifierDef;
 begin
   Result:=TFPBuiltInExprIdentifierDef(FDefs.AddStringVariable(AName,AValue));
@@ -2773,7 +2773,7 @@ begin
   FDefs.Delete(AIndex);
 end;
 
-function TExprBuiltInManager.Remove(aIdentifier: String): Integer;
+function TExprBuiltInManager.Remove(const aIdentifier: String): Integer;
 begin
   Result:=IndexOfIdentifier(aIdentifier);
   if Result<>-1 then
@@ -2891,7 +2891,7 @@ end;
 
 { TFPConstExpression }
 
-constructor TFPConstExpression.CreateString(AValue: String);
+constructor TFPConstExpression.CreateString(const AValue: String);
 begin
   FValue.ResultType:=rtString;
   FValue.ResString:=AValue;

+ 2 - 2
packages/fcl-base/src/fpobserver.pp

@@ -368,7 +368,7 @@ Type
     function FindDefFor(ASubject: TObject; AGui: TComponent; const APropName: string): TMediatorDef; overload;
     function FindDefFor(ASubject: TObject; AGui: TComponent; APropInfo: PPropInfo): TMediatorDef; overload;
     function RegisterMediator(MediatorClass: TMediatorClass; MinSubjectClass: TClass): TMediatorDef; overload;
-    function RegisterMediator(MediatorClass: TMediatorClass; MinSubjectClass: TClass; PropertyName: string): TMediatorDef; overload;
+    function RegisterMediator(MediatorClass: TMediatorClass; MinSubjectClass: TClass; const PropertyName: string): TMediatorDef; overload;
     function RegisterMediator(MediatorClass: TMediatorClass; MinSubjectClass: TClass; PropertyTypes: TTypeKinds): TMediatorDef; overload;
     property Defs: TMediatorDefs read FDefs;
   end;
@@ -949,7 +949,7 @@ begin
   Result.FPT  := tkProperties - [tkClass, tkInterface, tkDynArray, tkObject, tkInterfaceRaw];
 end;
 
-function TMediatorManager.RegisterMediator(MediatorClass: TMediatorClass; MinSubjectClass: TClass; PropertyName: string): TMediatorDef;
+function TMediatorManager.RegisterMediator(MediatorClass: TMediatorClass; MinSubjectClass: TClass; const PropertyName: string): TMediatorDef;
 
 begin
   Result      := FDefs.AddDef;

+ 10 - 10
packages/fcl-base/src/fptemplate.pp

@@ -62,12 +62,12 @@ Type
     FOnReplaceTag: TReplaceTagEvent;                       //Event handler to use for templates containing tags with parameters (ex: <#TagName paramname1="paramvalue1" paramname2="paramvalue2">)
     function GetDelimiter(Index: integer): TParseDelimiter;
     function GetNameByIndex(index : Integer): String;
-    function GetValue(Key : String): String;
+    function GetValue(const Key : String): String;
     function GetValueByIndex(index : Integer): String;
     function GetValueCount: Integer;
     procedure SetDelimiter(Index: integer; const AValue: TParseDelimiter);
-    procedure SetValue(Key : String; const AValue: String);
-    Function IntParseString(Src : String) : String;
+    procedure SetValue(const Key : String; const AValue: String);
+    Function IntParseString(const Src : String) : String;
   Public
     Constructor Create;
     Destructor Destroy; override;
@@ -75,7 +75,7 @@ Type
     Function ReplaceTag(const Key: String; TagParams:TStringList; out ReplaceWith: String): Boolean;//used only when AllowTagParams = true
     Function GetParam(Const Key : String; Out AValue : String) : Boolean;                           //used only when AllowTagParams = false
     Procedure GetTagParams(var TagName:String; var TagParams : TStringList) ;
-    Function ParseString(Src : String) : String;
+    Function ParseString(const Src : String) : String;
     Function ParseStream(Src : TStream; Dest : TStream) : Integer; // Wrapper, Returns number of bytes written.
     Procedure ParseStrings(Src : TStrings; Dest : TStrings) ;      // Wrapper
     Procedure ParseFiles(Const Src,Dest : String);
@@ -163,20 +163,20 @@ Type
   Private
     FValue : String;
   Public
-    Constructor Create(AValue : String);
+    Constructor Create(const AValue : String);
     Property Value : String Read FValue Write FValue;
   end;
 
 { TStringItem }
 
-constructor TStringItem.Create(AValue: String);
+constructor TStringItem.Create(const AValue: String);
 begin
   FValue:=AValue;
 end;
 
 { TTemplateParser }
 
-function TTemplateParser.GetValue(Key : String): String;
+function TTemplateParser.GetValue(const Key : String): String;
 
 Var
   I : Integer;
@@ -241,7 +241,7 @@ begin
 
 end;
 
-procedure TTemplateParser.SetValue(Key : String; const AValue: String);
+procedure TTemplateParser.SetValue(const Key : String; const AValue: String);
 
 Var
   I : Integer;
@@ -446,13 +446,13 @@ begin
   TagName := Trim(TP);
 end;
 
-function TTemplateParser.ParseString(Src: String): String;
+function TTemplateParser.ParseString(const Src: String): String;
 begin
   FParseLevel:=0;
   Result:=IntParseString(Src);
 end;
 
-function TTemplateParser.IntParseString(Src: String): String;
+function TTemplateParser.IntParseString(const Src: String): String;
 
 Var
   PN,PV,ReplaceWith : String;

+ 4 - 4
packages/fcl-base/src/gettext.pp

@@ -62,8 +62,8 @@ type
     constructor Create(AStream: TStream);
     destructor Destroy; override;
     function Translate(AOrig: PChar; ALen: Integer; AHash: LongWord): String;
-    function Translate(AOrig: String; AHash: LongWord): String;
-    function Translate(AOrig: String): String;
+    function Translate(const AOrig: String; AHash: LongWord): String;
+    function Translate(const AOrig: String): String;
   end;
 
   EMOFileError = class(Exception);
@@ -244,12 +244,12 @@ begin
   end;
 end;
 
-function TMOFile.Translate(AOrig: String; AHash: LongWord): String;
+function TMOFile.Translate(const AOrig: String; AHash: LongWord): String;
 begin
   Result := Translate(PChar(AOrig), Length(AOrig), AHash);
 end;
 
-function TMOFile.Translate(AOrig: String): String;
+function TMOFile.Translate(Const AOrig: String): String;
 begin
   Result := Translate(AOrig, Hash(AOrig));
 end;

+ 8 - 8
packages/fcl-base/src/inicol.pp

@@ -30,8 +30,8 @@ Type
   Public
     Procedure SaveToIni(Ini: TCustomInifile; Section : String); Virtual; Abstract;
     Procedure LoadFromIni(Ini: TCustomInifile; Section : String); Virtual; Abstract;
-    Procedure SaveToFile(FileName : String; Section : String);
-    Procedure LoadFromFile(FileName : String; Section : String);
+    Procedure SaveToFile(const FileName : String; const Section : String);
+    Procedure LoadFromFile(const FileName : String; const Section : String);
     Property SectionName : String Read GetSectionName Write SetSectionName;
   end;
 
@@ -46,9 +46,9 @@ Type
     Procedure Load;
     Procedure Save;
     Procedure SaveToIni(Ini: TCustomInifile; Section : String); virtual;
-    Procedure SaveToFile(AFileName : String; Section : String);
+    Procedure SaveToFile(const AFileName : String; const Section : String);
     Procedure LoadFromIni(Ini: TCustomInifile; Section : String); virtual;
-    Procedure LoadFromFile(AFileName : String; Section : String);
+    Procedure LoadFromFile(const AFileName : String; const Section : String);
     Property Prefix : String Read FPrefix;
     Property SectionPrefix : String Read FSectionPrefix;
     Property FileName : String Read FFileName Write FFileName;
@@ -101,7 +101,7 @@ resourcestring
   SErrNoSection = '%s: No [global] section specified.';
   SErrDuplicateName = 'Duplicate names "%s" not allowed in collection';
   
-procedure TIniCollectionItem.LoadFromFile(FileName, Section: String);
+procedure TIniCollectionItem.LoadFromFile(const FileName, Section: String);
 
 Var
   Ini : TMemInifile;
@@ -115,7 +115,7 @@ begin
   end;
 end;
 
-procedure TIniCollectionItem.SaveToFile(FileName, Section: String);
+procedure TIniCollectionItem.SaveToFile(const FileName, Section: String);
 
 Var
   Ini : TMemInifile;
@@ -142,7 +142,7 @@ begin
   LoadFromFile(FFileName,GlobalSection)
 end;
 
-procedure TIniCollection.LoadFromFile(AFileName, Section: String);
+procedure TIniCollection.LoadFromFile(const AFileName, Section: String);
 
 Var
   Ini  : TMemIniFile;
@@ -191,7 +191,7 @@ begin
   SaveToFile(FFileName,GlobalSection)
 end;
 
-procedure TIniCollection.SaveToFile(AFileName, Section: String);
+procedure TIniCollection.SaveToFile(const AFileName, Section: String);
 
 Var
   Ini : TMemIniFile;

+ 1 - 1
packages/fcl-base/src/inifiles.pp

@@ -703,7 +703,7 @@ begin
   WriteString(Section, Ident, IntToStr(Value));
 end;
 
-function IndexOfString(A : TStringArray; S : String) : integer;
+function IndexOfString(A : TStringArray; const S : String) : integer;
 
 begin
   Result:=Length(A)-1;

+ 2 - 2
packages/fcl-base/src/pascodegen.pp

@@ -67,7 +67,7 @@ Type
     Procedure Undent;
     Function IsKeyWord (Const S : String) : Boolean; virtual;
     Function EscapeKeyWord(Const S : String; ForceAmpersand : Boolean = false) : String; virtual;
-    Function MakePascalString(S: String; AddQuotes: Boolean=False): String;
+    Function MakePascalString(const S: String; AddQuotes: Boolean=False): String;
     Function PrettyPrint(Const S: string): String;
     Procedure AddLn(Const aLine: string);
     Procedure AddLn(Const TheLines : array of string);
@@ -373,7 +373,7 @@ begin
   Result:='';
 end;
 
-function TPascalCodeGenerator.MakePascalString(S: String; AddQuotes: Boolean
+function TPascalCodeGenerator.MakePascalString(const S: String; AddQuotes: Boolean
   ): String;
 
 begin

+ 6 - 6
packages/fcl-base/src/rtfpars.pp

@@ -50,7 +50,7 @@ TRTFParser = class(TObject)
     dcb : array [0..rtfMaxDestination] of TRTFFuncPtr;  { destination callbacks }
     readHook : TRTFFUNCPTR;
     FTokenClass: Integer;
-    Procedure Error (msg : String);
+    Procedure Error (const msg : String);
     Procedure LookupInit ;
     Procedure ReadFontTbl ;
     Procedure ReadColorTbl;
@@ -83,7 +83,7 @@ TRTFParser = class(TObject)
     Procedure StartReading;
     Procedure SetReadHook (Hook : TRTFFuncPtr);
     Procedure UngetToken;
-    Procedure SetToken (Aclass, major, minor, param : Integer; text : string);
+    Procedure SetToken (Aclass, major, minor, param : Integer; const text : string);
     Procedure ExpandStyle (n : Integer);
     Function GetRtfBuf : String;
     { Properties }
@@ -112,7 +112,7 @@ Const EOF = -255;
          Utility functions
   ---------------------------------------------------------------------}
 
-Function Hash (s : String) : Integer;
+Function Hash (const s : String) : Integer;
 
 var
   val,i : integer;
@@ -630,7 +630,7 @@ End;
   values supplied.  Typically this is followed with a call
   to RTFRouteToken().
   If param is non-negative, it becomes part of the token text. }
-Procedure TRTFParser.SetToken (Aclass, major, minor, param : Integer; text : string);
+Procedure TRTFParser.SetToken (Aclass, major, minor, param : Integer; const text : string);
 
 Begin
   FrtfClass := Aclass;
@@ -1032,7 +1032,7 @@ End;
        not found, the class turns into rtfUnknown.
   ---------------------------------------------------------------------}
 
-Procedure TRTFParser.Lookup (S : String);
+Procedure TRTFParser.Lookup(S : String);
 
 var
  thehash,rp : Integer;
@@ -1056,7 +1056,7 @@ FrtfClass:=rtfUnknown;
 End;
 
 
-Procedure TRTFParser.Error (msg : String);
+Procedure TRTFParser.Error (const msg : String);
 
 { Call errorhandler }
 

+ 6 - 6
packages/fcl-base/src/streamcoll.pp

@@ -24,7 +24,7 @@ type
   Protected
     Procedure WriteInteger(S : TStream; AValue : Integer);
     Procedure WriteBoolean(S : TStream; AValue : Boolean);
-    Procedure WriteString(S : TStream; AValue : String);
+    Procedure WriteString(S : TStream; const AValue : String);
     Procedure WriteCurrency(S : TStream; AValue : Currency);
     Procedure WriteDateTime(S : TStream; AValue : TDateTime);
     Procedure WriteFloat(S : TStream; AValue : Double);
@@ -44,7 +44,7 @@ type
   Protected
     Procedure WriteInteger(S : TStream; AValue : Integer);
     Procedure WriteBoolean(S : TStream; AValue : Boolean);
-    Procedure WriteString(S : TStream; AValue : String);
+    Procedure WriteString(S : TStream; const AValue : String);
     Procedure WriteCurrency(S : TStream; AValue : Currency);
     Procedure WriteDateTime(S : TStream; AValue : TDateTime);
     Procedure WriteFloat(S : TStream; AValue : Double);
@@ -68,7 +68,7 @@ type
 
 Procedure ColWriteInteger(S : TStream; AValue : Integer);
 Procedure ColWriteBoolean(S : TStream; AValue : Boolean);
-Procedure ColWriteString(S : TStream; AValue : String);
+Procedure ColWriteString(S : TStream; const AValue : String);
 Procedure ColWriteCurrency(S : TStream; AValue : Currency);
 Procedure ColWriteDateTime(S : TStream; AValue : TDateTime);
 Procedure ColWriteFloat(S : TStream; AValue : Double);
@@ -96,7 +96,7 @@ begin
   ColWriteInteger(S,Ord(AValue));
 end;
 
-Procedure ColWriteString(S : TStream; AValue : String);
+Procedure ColWriteString(S : TStream; const AValue : String);
 
 Var
   L : Integer;
@@ -231,7 +231,7 @@ begin
   ColWriteInteger(S,AValue);
 end;
 
-procedure TStreamCollectionItem.WriteString(S: TStream; AValue: String);
+procedure TStreamCollectionItem.WriteString(S: TStream; const AValue: String);
 begin
   ColWriteString(S,AValue);
 end;
@@ -349,7 +349,7 @@ begin
   ColWriteInteger(S,AValue);
 end;
 
-procedure TStreamCollection.WriteString(S: TStream; AValue: String);
+procedure TStreamCollection.WriteString(S: TStream; const AValue: String);
 begin
   ColWriteString(S,AValue);
 end;