Browse Source

* Use const string where possible. Fix issue #40047

Michaël Van Canneyt 2 years ago
parent
commit
ce44efdae3
40 changed files with 314 additions and 312 deletions
  1. 5 5
      packages/fcl-web/src/base/cgiapp.pp
  2. 2 2
      packages/fcl-web/src/base/cgiprotocol.pp
  3. 2 2
      packages/fcl-web/src/base/custapache.pp
  4. 2 2
      packages/fcl-web/src/base/custapache24.pp
  5. 4 4
      packages/fcl-web/src/base/custcgi.pp
  6. 2 2
      packages/fcl-web/src/base/custfcgi.pp
  7. 4 4
      packages/fcl-web/src/base/custhttpapp.pp
  8. 4 4
      packages/fcl-web/src/base/custmicrohttpapp.pp
  9. 9 9
      packages/fcl-web/src/base/custweb.pp
  10. 13 13
      packages/fcl-web/src/base/ezcgi.pp
  11. 1 1
      packages/fcl-web/src/base/fcgigate.pp
  12. 6 6
      packages/fcl-web/src/base/fpdatasetform.pp
  13. 25 25
      packages/fcl-web/src/base/fphtml.pp
  14. 6 6
      packages/fcl-web/src/base/fphttpclient.pp
  15. 2 2
      packages/fcl-web/src/base/fphttpserver.pp
  16. 2 2
      packages/fcl-web/src/base/fpmimetypes.pp
  17. 6 6
      packages/fcl-web/src/base/fpweb.pp
  18. 10 6
      packages/fcl-web/src/base/fpwebclient.pp
  19. 45 41
      packages/fcl-web/src/base/httpdefs.pp
  20. 2 2
      packages/fcl-web/src/base/httpjson.pp
  21. 9 9
      packages/fcl-web/src/base/httproute.pp
  22. 8 9
      packages/fcl-web/src/base/iniwebsession.pp
  23. 6 6
      packages/fcl-web/src/base/restbase.pp
  24. 6 6
      packages/fcl-web/src/base/tcwebmodule.pp
  25. 12 12
      packages/fcl-web/src/base/webpage.pp
  26. 8 8
      packages/fcl-web/src/jsonrpc/fprpcclient.pp
  27. 7 4
      packages/fcl-web/src/jsonrpc/fprpccodegen.pp
  28. 18 18
      packages/fcl-web/src/jwt/fpjwt.pp
  29. 2 2
      packages/fcl-web/src/jwt/fpoauth2.pp
  30. 2 1
      packages/fcl-web/src/jwt/fpoauth2ini.pp
  31. 6 6
      packages/fcl-web/src/restbridge/sqldbrestauthini.pp
  32. 6 6
      packages/fcl-web/src/restbridge/sqldbrestbridge.pp
  33. 3 3
      packages/fcl-web/src/restbridge/sqldbrestdata.pp
  34. 27 28
      packages/fcl-web/src/restbridge/sqldbrestini.pp
  35. 17 15
      packages/fcl-web/src/restbridge/sqldbrestio.pp
  36. 9 9
      packages/fcl-web/src/restbridge/sqldbrestschema.pp
  37. 2 12
      packages/fcl-web/src/webdata/extjsjson.pp
  38. 2 2
      packages/fcl-web/src/webdata/sqldbwebdata.pp
  39. 8 8
      packages/fcl-web/src/websocket/fpcustwsserver.pp
  40. 4 4
      packages/fcl-web/src/websocket/wsupgrader.pp

+ 5 - 5
packages/fcl-web/src/base/cgiapp.pp

@@ -71,7 +71,7 @@ Type
     Procedure InitPostVars;
     Procedure InitPostVars;
     Procedure InitGetVars;
     Procedure InitGetVars;
     Procedure SetContentLength (Value : Integer);
     Procedure SetContentLength (Value : Integer);
-    Procedure SetCGIVar(Index : Integer; Value : String);
+    Procedure SetCGIVar(Index : Integer; const Value : String);
     Function GetContentLength : Integer;
     Function GetContentLength : Integer;
     Function GetServerPort : Word;
     Function GetServerPort : Word;
     Function GetEmail : String;
     Function GetEmail : String;
@@ -165,13 +165,13 @@ end;
 Var
 Var
   flog : Text;
   flog : Text;
 
 
-Procedure Log(Msg : String);
+Procedure Log(const Msg : String);
 
 
 begin
 begin
   Writeln(flog,Msg);
   Writeln(flog,Msg);
 end;
 end;
 
 
-Procedure Log(Msg : String;Args : Array of const);
+Procedure Log(Const Msg : String;Args : Array of const);
 
 
 begin
 begin
   Writeln(flog,Format(Msg,Args));
   Writeln(flog,Format(Msg,Args));
@@ -328,7 +328,7 @@ begin
   SetCGIVar(2,IntToStr(Value));
   SetCGIVar(2,IntToStr(Value));
 end;
 end;
 
 
-Procedure TCgiApplication.SetCGIVar(Index : Integer; Value : String);
+Procedure TCgiApplication.SetCGIVar(Index : Integer; const Value : String);
 
 
 begin
 begin
   If Index in [1..cgiVarCount] then
   If Index in [1..cgiVarCount] then
@@ -553,7 +553,7 @@ begin
     Move(PStart^,Result[1],Length(Result));
     Move(PStart^,Result[1],Length(Result));
 end;
 end;
 
 
-procedure FormSplit(var Cnt : String; boundary: String; List : TList);
+procedure FormSplit(var Cnt : String; const boundary: String; List : TList);
 
 
 // Splits the form into items
 // Splits the form into items
 var
 var

+ 2 - 2
packages/fcl-web/src/base/cgiprotocol.pp

@@ -75,13 +75,13 @@ Const
     { 45 } 'REQUEST_SCHEME'
     { 45 } 'REQUEST_SCHEME'
     );
     );
 
 
-Function IndexOfCGIVar(AVarName: String): Integer;
+Function IndexOfCGIVar(const AVarName: String): Integer;
 
 
 implementation
 implementation
 
 
 uses sysutils;
 uses sysutils;
 
 
-Function IndexOfCGIVar(AVarName: String): Integer;
+Function IndexOfCGIVar(const AVarName: String): Integer;
 
 
 begin
 begin
   Result:=CGIVarCount;
   Result:=CGIVarCount;

+ 2 - 2
packages/fcl-web/src/base/custapache.pp

@@ -90,7 +90,7 @@ Type
     Procedure Run; override;
     Procedure Run; override;
     Procedure SetModuleRecord(Var ModuleRecord : Module);
     Procedure SetModuleRecord(Var ModuleRecord : Module);
     Procedure Initialize;
     Procedure Initialize;
-    Procedure LogErrorMessage(Msg : String; LogLevel : integer = APLOG_INFO); virtual;
+    Procedure LogErrorMessage(const Msg : String; LogLevel : integer = APLOG_INFO); virtual;
     Procedure handleRequest(ARequest : TRequest; AResponse : TResponse); override;
     Procedure handleRequest(ARequest : TRequest; AResponse : TResponse); override;
     Property HandlerPriority : THandlerPriority Read FPriority Write FPriority default hpMiddle;
     Property HandlerPriority : THandlerPriority Read FPriority Write FPriority default hpMiddle;
     Property BeforeModules : TStrings Index 0 Read GetModules Write SetModules;
     Property BeforeModules : TStrings Index 0 Read GetModules Write SetModules;
@@ -317,7 +317,7 @@ begin
   FModuleRecord^.register_hooks:=@RegisterApacheHooks;
   FModuleRecord^.register_hooks:=@RegisterApacheHooks;
 end;
 end;
 
 
-procedure TApacheHandler.LogErrorMessage(Msg: String; LogLevel: integer);
+procedure TApacheHandler.LogErrorMessage(const Msg: String; LogLevel: integer);
 begin
 begin
   ap_log_error(pchar(FModuleName),0,LogLevel,0,Nil,'module: %s',[pchar(Msg)]);
   ap_log_error(pchar(FModuleName),0,LogLevel,0,Nil,'module: %s',[pchar(Msg)]);
 end;
 end;

+ 2 - 2
packages/fcl-web/src/base/custapache24.pp

@@ -91,7 +91,7 @@ Type
     Procedure Run; override;
     Procedure Run; override;
     Procedure SetModuleRecord(Var ModuleRecord : Module);
     Procedure SetModuleRecord(Var ModuleRecord : Module);
     Procedure Initialize;
     Procedure Initialize;
-    Procedure LogErrorMessage(Msg : String; LogLevel : integer = APLOG_INFO); virtual;
+    Procedure LogErrorMessage(const Msg : String; LogLevel : integer = APLOG_INFO); virtual;
     Procedure handleRequest(ARequest : TRequest; AResponse : TResponse); override;
     Procedure handleRequest(ARequest : TRequest; AResponse : TResponse); override;
     Property HandlerPriority : THandlerPriority Read FPriority Write FPriority default hpMiddle;
     Property HandlerPriority : THandlerPriority Read FPriority Write FPriority default hpMiddle;
     Property BeforeModules : TStrings Index 0 Read GetModules Write SetModules;
     Property BeforeModules : TStrings Index 0 Read GetModules Write SetModules;
@@ -313,7 +313,7 @@ begin
   FModuleRecord^.register_hooks:=@RegisterApacheHooks;
   FModuleRecord^.register_hooks:=@RegisterApacheHooks;
 end;
 end;
 
 
-procedure TApacheHandler.LogErrorMessage(Msg: String; LogLevel: integer);
+procedure TApacheHandler.LogErrorMessage(const Msg: String; LogLevel: integer);
 var a: ap_version_t;
 var a: ap_version_t;
 begin
 begin
   ap_log_error(pchar(FModuleName),  //The file in which this function is called
   ap_log_error(pchar(FModuleName),  //The file in which this function is called

+ 4 - 4
packages/fcl-web/src/base/custcgi.pp

@@ -37,7 +37,7 @@ Type
     function GetCGIVar(Index: integer): String;
     function GetCGIVar(Index: integer): String;
   Protected
   Protected
     Function DoMapCgiToHTTP(Const AVariableName : String; Out AHeaderType : THeader; Out AVariableType : THTTPVariableType) : Boolean;
     Function DoMapCgiToHTTP(Const AVariableName : String; Out AHeaderType : THeader; Out AVariableType : THTTPVariableType) : Boolean;
-    function DoGetCGIVar(AVarName: String): String; virtual;
+    function DoGetCGIVar(const AVarName: String): String; virtual;
     Procedure InitFromEnvironment; virtual;
     Procedure InitFromEnvironment; virtual;
     // Read content from stdin. Calls DoContentRead to see if reading must be aborted.
     // Read content from stdin. Calls DoContentRead to see if reading must be aborted.
     procedure ReadContent; override;
     procedure ReadContent; override;
@@ -113,7 +113,7 @@ Type
   TCustomCGIApplication = Class(TCustomWebApplication)
   TCustomCGIApplication = Class(TCustomWebApplication)
   private
   private
     function GetRequest: TCGIRequest;
     function GetRequest: TCGIRequest;
-    function GetRequestVariable(VarName : String): String;
+    function GetRequestVariable(const VarName : String): String;
     function GetRequestVariableCount: Integer;
     function GetRequestVariableCount: Integer;
     function GetResponse: TCGIResponse;
     function GetResponse: TCGIResponse;
   protected
   protected
@@ -315,7 +315,7 @@ begin
 end;
 end;
 
 
 { TCGIHTTPRequest }
 { TCGIHTTPRequest }
-function TCGIRequest.DoGetCGIVar(AVarName : String) : String;
+function TCGIRequest.DoGetCGIVar(const AVarName : String) : String;
 
 
 begin
 begin
   Result := GetEnvironmentVariable(AVarName);
   Result := GetEnvironmentVariable(AVarName);
@@ -487,7 +487,7 @@ begin
   result := TCgiHandler(WebHandler).Request;
   result := TCgiHandler(WebHandler).Request;
 end;
 end;
 
 
-function TCustomCGIApplication.GetRequestVariable(VarName : String): String;
+function TCustomCGIApplication.GetRequestVariable(const VarName : String): String;
 begin
 begin
   If Assigned(Request) then
   If Assigned(Request) then
     Result:=Request.QueryFields.Values[VarName]
     Result:=Request.QueryFields.Values[VarName]

+ 2 - 2
packages/fcl-web/src/base/custfcgi.pp

@@ -67,7 +67,7 @@ Type
     FRequestHeadersInitialized: Boolean;
     FRequestHeadersInitialized: Boolean;
     FStreamingContentReceived: Boolean;
     FStreamingContentReceived: Boolean;
   Protected
   Protected
-    function DoGetCGIVar(AVarName: String): String; override;
+    function DoGetCGIVar(const AVarName: String): String; override;
     procedure GetNameValuePairsFromContentRecord(const ARecord : PFCGI_ContentRecord; NameValueList : TStrings); virtual;
     procedure GetNameValuePairsFromContentRecord(const ARecord : PFCGI_ContentRecord; NameValueList : TStrings); virtual;
     Procedure Log(EventType : TEventType; Const Msg : String);
     Procedure Log(EventType : TEventType; Const Msg : String);
   Public
   Public
@@ -312,7 +312,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-function TFCGIRequest.DoGetCGIVar(AVarName: String): String;
+function TFCGIRequest.DoGetCGIVar(const AVarName: String): String;
 begin
 begin
   Result:=FCGIParams.Values[AVarName];
   Result:=FCGIParams.Values[AVarName];
 end;
 end;

+ 4 - 4
packages/fcl-web/src/base/custhttpapp.pp

@@ -67,7 +67,7 @@ Type
     function GetQueueSize: Word;
     function GetQueueSize: Word;
     function GetThreaded: Boolean;
     function GetThreaded: Boolean;
     function GetUseSSL: Boolean;
     function GetUseSSL: Boolean;
-    procedure SetHostName(AValue: String);
+    procedure SetHostName(const AValue: String);
     procedure SetIdle(AValue: TNotifyEvent);
     procedure SetIdle(AValue: TNotifyEvent);
     procedure SetIDleTimeOut(AValue: Cardinal);
     procedure SetIDleTimeOut(AValue: Cardinal);
     procedure SetOnAllowConnect(const AValue: TConnectQuery);
     procedure SetOnAllowConnect(const AValue: TConnectQuery);
@@ -127,7 +127,7 @@ Type
     function GetIDleTimeOut: Cardinal;
     function GetIDleTimeOut: Cardinal;
     function GetLookupHostNames : Boolean;
     function GetLookupHostNames : Boolean;
     function GetUseSSL: Boolean;
     function GetUseSSL: Boolean;
-    procedure SetHostName(AValue: String);
+    procedure SetHostName(const AValue: String);
     procedure SetIdle(AValue: TNotifyEvent);
     procedure SetIdle(AValue: TNotifyEvent);
     procedure SetIDleTimeOut(AValue: Cardinal);
     procedure SetIDleTimeOut(AValue: Cardinal);
     Procedure SetLookupHostnames(Avalue : Boolean);
     Procedure SetLookupHostnames(Avalue : Boolean);
@@ -214,7 +214,7 @@ begin
   Result:=HTTPHandler.UseSSL;
   Result:=HTTPHandler.UseSSL;
 end;
 end;
 
 
-procedure TCustomHTTPApplication.SetHostName(AValue: String);
+procedure TCustomHTTPApplication.SetHostName(const AValue: String);
 begin
 begin
   HTTPHandler.HostName:=aValue;
   HTTPHandler.HostName:=aValue;
 end;
 end;
@@ -421,7 +421,7 @@ begin
   Result:=FServer.UseSSL;
   Result:=FServer.UseSSL;
 end;
 end;
 
 
-procedure TFPHTTPServerHandler.SetHostName(AValue: String);
+procedure TFPHTTPServerHandler.SetHostName(const AValue: String);
 begin
 begin
   FServer.CertificateData.HostName:=aValue;
   FServer.CertificateData.HostName:=aValue;
 end;
 end;

+ 4 - 4
packages/fcl-web/src/base/custmicrohttpapp.pp

@@ -115,7 +115,7 @@ Type
     procedure RequestCompleted(aRequest: TRequestHandler);
     procedure RequestCompleted(aRequest: TRequestHandler);
     function DoRequest(connection: PMHD_Connection; const aUrl, aMethod, aVersion: String; Data: PAnsiChar; var DataSize: Size_t): TRequestHandler;
     function DoRequest(connection: PMHD_Connection; const aUrl, aMethod, aVersion: String; Data: PAnsiChar; var DataSize: Size_t): TRequestHandler;
     procedure SetExtraHeaders(AValue: TStrings);
     procedure SetExtraHeaders(AValue: TStrings);
-    procedure SetHostName(AValue: String);
+    procedure SetHostName(const AValue: String);
     procedure SetOptions(AValue: TMicroServerOptions);
     procedure SetOptions(AValue: TMicroServerOptions);
     procedure SetPort(const AValue: Word);
     procedure SetPort(const AValue: Word);
   protected
   protected
@@ -156,7 +156,7 @@ Type
     function GetPort: Word;
     function GetPort: Word;
     function GetUseSSL: Boolean;
     function GetUseSSL: Boolean;
     procedure SetExtraHeaders(AValue: TStrings);
     procedure SetExtraHeaders(AValue: TStrings);
-    procedure SetHostName(AValue: String);
+    procedure SetHostName(const AValue: String);
     procedure SetOptions(AValue: TMicroServerOptions);
     procedure SetOptions(AValue: TMicroServerOptions);
     procedure SetPort(AValue: Word);
     procedure SetPort(AValue: Word);
     procedure SetUseSSL(AValue: Boolean);
     procedure SetUseSSL(AValue: Boolean);
@@ -571,7 +571,7 @@ begin
     Raise EHTTP.Create(SErrServerActive);
     Raise EHTTP.Create(SErrServerActive);
 end;
 end;
 
 
-procedure TMicroHTTPHandler.SetHostName(AValue: String);
+procedure TMicroHTTPHandler.SetHostName(const AValue: String);
 begin
 begin
   CheckInactive;
   CheckInactive;
   FHostName:=aValue;
   FHostName:=aValue;
@@ -687,7 +687,7 @@ end;
   ---------------------------------------------------------------------}
   ---------------------------------------------------------------------}
 
 
 
 
-procedure TCustomMicroHTTPApplication.SetHostName(AValue: String);
+procedure TCustomMicroHTTPApplication.SetHostName(const AValue: String);
 begin
 begin
   HTTPHandler.HostName:=aValue;
   HTTPHandler.HostName:=aValue;
 end;
 end;

+ 9 - 9
packages/fcl-web/src/base/custweb.pp

@@ -56,12 +56,12 @@ Type
     FOnTerminate : TNotifyEvent;
     FOnTerminate : TNotifyEvent;
     FOnLog : TLogEvent;
     FOnLog : TLogEvent;
     FPreferModuleName : Boolean;
     FPreferModuleName : Boolean;
-    procedure DoCallModule(AModule: TCustomHTTPModule; AModuleName: String; ARequest: TRequest; AResponse: TResponse);
+    procedure DoCallModule(AModule: TCustomHTTPModule; const AModuleName: String; ARequest: TRequest; AResponse: TResponse);
     procedure HandleModuleRequest(Sender: TModuleItem; ARequest: TRequest; AResponse: TResponse);
     procedure HandleModuleRequest(Sender: TModuleItem; ARequest: TRequest; AResponse: TResponse);
     procedure OldHandleRequest(ARequest: TRequest; AResponse: TResponse);
     procedure OldHandleRequest(ARequest: TRequest; AResponse: TResponse);
   protected
   protected
-    Class Procedure DoError(Msg : String; AStatusCode : Integer = 0; AStatusText : String = '');
-    Class Procedure DoError(Fmt : String; Const Args : Array of const;AStatusCode : Integer = 0; AStatusText : String = '');
+    Class Procedure DoError(const Msg : String; AStatusCode : Integer = 0; const AStatusText : String = '');
+    Class Procedure DoError(const Fmt : String; Const Args : Array of const; AStatusCode : Integer = 0; Const AStatusText : String = '');
     procedure Terminate; virtual;
     procedure Terminate; virtual;
     Function GetModuleName(Arequest : TRequest) : string;
     Function GetModuleName(Arequest : TRequest) : string;
     function WaitForRequest(out ARequest : TRequest; out AResponse : TResponse) : boolean; virtual; abstract;
     function WaitForRequest(out ARequest : TRequest; out AResponse : TResponse) : boolean; virtual; abstract;
@@ -124,7 +124,7 @@ Type
     procedure SetAdministrator(const AValue: String);
     procedure SetAdministrator(const AValue: String);
     procedure SetAllowDefaultModule(const AValue: Boolean);
     procedure SetAllowDefaultModule(const AValue: Boolean);
     procedure SetApplicationURL(const AValue: String);
     procedure SetApplicationURL(const AValue: String);
-    procedure SetDefaultModuleName(AValue: String);
+    procedure SetDefaultModuleName(const AValue: String);
     procedure SetEmail(const AValue: String);
     procedure SetEmail(const AValue: String);
     procedure SetHandleGetOnPost(const AValue: Boolean);
     procedure SetHandleGetOnPost(const AValue: Boolean);
     procedure SetLegacyRouting(AValue: Boolean);
     procedure SetLegacyRouting(AValue: Boolean);
@@ -314,7 +314,7 @@ begin
   Result := FAdministrator;
   Result := FAdministrator;
 end;
 end;
 
 
-Procedure TWebHandler.DoCallModule(AModule : TCustomHTTPModule; AModuleName : String ; ARequest: TRequest; AResponse: TResponse);
+Procedure TWebHandler.DoCallModule(AModule : TCustomHTTPModule; const AModuleName : String ; ARequest: TRequest; AResponse: TResponse);
 
 
 begin
 begin
   SetBaseURL(AModule,AModuleName,ARequest);
   SetBaseURL(AModule,AModuleName,ARequest);
@@ -406,7 +406,7 @@ begin
     Result:=ARequest.ScriptName;
     Result:=ARequest.ScriptName;
 end;
 end;
 
 
-Class Procedure TWebHandler.DoError(Msg : String;AStatusCode : Integer = 0; AStatusText : String = '');
+Class Procedure TWebHandler.DoError(Const Msg : String;AStatusCode : Integer = 0; const AStatusText : String = '');
 
 
 Var
 Var
   E : EFPWebError;
   E : EFPWebError;
@@ -418,8 +418,8 @@ begin
   Raise E;
   Raise E;
 end;
 end;
 
 
-Class Procedure TWebHandler.DoError(Fmt: String; Const Args: Array of const;
-  AStatusCode: Integer = 0; AStatusText: String = '');
+Class Procedure TWebHandler.DoError(Const Fmt: String; Const Args: Array of const;
+  AStatusCode: Integer = 0; Const AStatusText: String = '');
 begin
 begin
   DoError(Format(Fmt,Args),AStatusCode,AStatusText);
   DoError(Format(Fmt,Args),AStatusCode,AStatusText);
 end;
 end;
@@ -653,7 +653,7 @@ begin
   FWebHandler.ApplicationURL := AValue;
   FWebHandler.ApplicationURL := AValue;
 end;
 end;
 
 
-procedure TCustomWebApplication.SetDefaultModuleName(AValue: String);
+procedure TCustomWebApplication.SetDefaultModuleName(const AValue: String);
 begin
 begin
   FWebHandler.DefaultModuleName:=AValue;
   FWebHandler.DefaultModuleName:=AValue;
 end;
 end;

+ 13 - 13
packages/fcl-web/src/base/ezcgi.pp

@@ -40,13 +40,13 @@ type
       aLenStr : Integer;
       aLenStr : Integer;
       aLenSep : Integer;
       aLenSep : Integer;
 
 
-      procedure InitToken(aStr, aSep : String);
+      procedure InitToken(const aStr, aSep : String);
       function NextToken(var aToken : String; out aSepChar : Char) : Boolean;
       function NextToken(var aToken : String; out aSepChar : Char) : Boolean;
 
 
       procedure GetQueryItems;
       procedure GetQueryItems;
       procedure ProcessRequest;
       procedure ProcessRequest;
       procedure LoadEnvVariables;
       procedure LoadEnvVariables;
-      function GetVal(Index : String) : String;
+      function GetVal(const Index : String) : String;
       function GetName(Index : Integer) : String;
       function GetName(Index : Integer) : String;
       function GetVariable(Index : Integer) : String;
       function GetVariable(Index : Integer) : String;
       function GetVarCount : Integer;
       function GetVarCount : Integer;
@@ -55,15 +55,15 @@ type
    protected
    protected
       { Protected declarations }
       { Protected declarations }
 
 
-      procedure OutputError(errorMessage : String);
+      procedure OutputError(const errorMessage : String);
    public
    public
       { Public declarations }
       { Public declarations }
       constructor Create;
       constructor Create;
       destructor Destroy; override;
       destructor Destroy; override;
       procedure Run;
       procedure Run;
-      procedure WriteContent(ctype : String);
-      procedure PutLine(sOut : String);
-      function GetValue(Index : String; defaultValue : String) : String;
+      procedure WriteContent(const ctype : String);
+      procedure PutLine(const sOut : String);
+      function GetValue(const Index : String; const defaultValue : String) : String;
 
 
       procedure DoPost; virtual;
       procedure DoPost; virtual;
       procedure DoGet; virtual;
       procedure DoGet; virtual;
@@ -112,18 +112,18 @@ begin
   // Must be overridden by child class
   // Must be overridden by child class
 end;
 end;
 
 
-procedure TEZcgi.WriteContent(ctype : String);
+procedure TEZcgi.WriteContent(const ctype : String);
 begin
 begin
    writeln('Content-Type: ',ctype);
    writeln('Content-Type: ',ctype);
    writeln;
    writeln;
 end;
 end;
 
 
-procedure TEZcgi.PutLine(sOut : String);
+procedure TEZcgi.PutLine(const sOut : String);
 begin
 begin
    writeln(sOut);
    writeln(sOut);
 end;
 end;
 
 
-function TEZcgi.GetValue(Index, defaultValue : String) : String;
+function TEZcgi.GetValue(Const Index, defaultValue : String) : String;
 begin
 begin
    result := GetVal(Index);
    result := GetVal(Index);
    if result = '' then
    if result = '' then
@@ -135,7 +135,7 @@ end;
 
 
 procedure TEZcgi.LoadEnvVariables;
 procedure TEZcgi.LoadEnvVariables;
 
 
-   procedure GetEData(variable : String);
+   procedure GetEData(const variable : String);
    var
    var
       tempStr : String;
       tempStr : String;
    begin
    begin
@@ -199,7 +199,7 @@ begin
       OutputError('Invalid REQUEST_METHOD passed from server!');
       OutputError('Invalid REQUEST_METHOD passed from server!');
 end;
 end;
 
 
-function TEZcgi.GetVal(Index : String) : String;
+function TEZcgi.GetVal(const Index : String) : String;
 begin
 begin
    result := FVariables.Values[Index];
    result := FVariables.Values[Index];
 end;
 end;
@@ -314,7 +314,7 @@ begin
    end;
    end;
 end;
 end;
 
 
-procedure TEZcgi.OutputError(errorMessage : String);
+procedure TEZcgi.OutputError(const errorMessage : String);
 begin
 begin
    WriteContent('text/html');
    WriteContent('text/html');
    writeln('<html><head><title>CGI ERROR</title></head>');
    writeln('<html><head><title>CGI ERROR</title></head>');
@@ -329,7 +329,7 @@ begin
    Raise ECGIException.Create(errorMessage);
    Raise ECGIException.Create(errorMessage);
 end;
 end;
 
 
-procedure TEZcgi.InitToken(aStr, aSep : String);
+procedure TEZcgi.InitToken(const aStr, aSep : String);
 begin
 begin
      aString := aStr;
      aString := aStr;
      aSepStr := aSep;
      aSepStr := aSep;

+ 1 - 1
packages/fcl-web/src/base/fcgigate.pp

@@ -397,7 +397,7 @@ end;
 
 
 Procedure TFastCGIGatewayHandler.SendRequestData(Const ARequest : Trequest);
 Procedure TFastCGIGatewayHandler.SendRequestData(Const ARequest : Trequest);
 
 
-  Procedure SendString(S : String; RecType : Byte);
+  Procedure SendString(const S : String; RecType : Byte);
 
 
   Var
   Var
     L : Integer;
     L : Integer;

+ 6 - 6
packages/fcl-web/src/base/fpdatasetform.pp

@@ -128,9 +128,9 @@ type
     procedure SetItem(index : integer; const AValue: TFormFieldItem);
     procedure SetItem(index : integer; const AValue: TFormFieldItem);
   public
   public
     constructor create;
     constructor create;
-    function AddField (afieldname, acaption : string) : TFormFieldItem;
-    Function FindItem(AName : String): TFormFieldItem;
-    Function IndexofItem(AName : String) : Integer;
+    function AddField (const afieldname, acaption : string) : TFormFieldItem;
+    Function FindItem(const AName : String): TFormFieldItem;
+    Function IndexofItem(const AName : String) : Integer;
     property Items [index : integer] : TFormFieldItem read GetItem write SetItem;
     property Items [index : integer] : TFormFieldItem read GetItem write SetItem;
   end;
   end;
 
 
@@ -549,14 +549,14 @@ begin
   inherited create (TFormFieldItem);
   inherited create (TFormFieldItem);
 end;
 end;
 
 
-function TFormFieldCollection.AddField(afieldname, acaption: string): TFormFieldItem;
+function TFormFieldCollection.AddField(const afieldname, acaption: string): TFormFieldItem;
 begin
 begin
   result := TFormFieldItem (Add);
   result := TFormFieldItem (Add);
   result.fieldname := afieldname;
   result.fieldname := afieldname;
   result.labelcaption := acaption;
   result.labelcaption := acaption;
 end;
 end;
 
 
-function TFormFieldCollection.FindItem(AName: String): TFormFieldItem;
+function TFormFieldCollection.FindItem(const AName: String): TFormFieldItem;
 Var
 Var
   I : Integer;
   I : Integer;
 
 
@@ -568,7 +568,7 @@ begin
     Result:=Items[I];
     Result:=Items[I];
 end;
 end;
 
 
-function TFormFieldCollection.IndexofItem(AName: String): Integer;
+function TFormFieldCollection.IndexofItem(const AName: String): Integer;
 
 
 begin
 begin
   Result:=Count-1;
   Result:=Count-1;

+ 25 - 25
packages/fcl-web/src/base/fphtml.pp

@@ -56,12 +56,12 @@ type
   public
   public
     constructor Create(const AWebController: TWebController; const AJavaType: TJavaType); virtual;
     constructor Create(const AWebController: TWebController; const AJavaType: TJavaType); virtual;
     destructor Destroy; override;
     destructor Destroy; override;
-    procedure AddScriptLine(ALine: String); virtual;
-    procedure MessageBox(AText: String; Buttons: TWebButtons; Loaded: string = ''); virtual;
+    procedure AddScriptLine(const ALine: String); virtual;
+    procedure MessageBox(const AText: String; Buttons: TWebButtons; const Loaded: string = ''); virtual;
     procedure RedrawContentProducer(AContentProducer: THTMLContentProducer); virtual;
     procedure RedrawContentProducer(AContentProducer: THTMLContentProducer); virtual;
-    procedure CallServerEvent(AHTMLContentProducer: THTMLContentProducer; AEvent: Integer; APostVariable: string = ''); virtual;
+    procedure CallServerEvent(AHTMLContentProducer: THTMLContentProducer; AEvent: Integer; const APostVariable: string = ''); virtual;
     procedure Clear; virtual;
     procedure Clear; virtual;
-    procedure Redirect(AUrl: string); virtual;
+    procedure Redirect(const AUrl: string); virtual;
     function ScriptIsEmpty: Boolean; virtual;
     function ScriptIsEmpty: Boolean; virtual;
     function GetScript: String; virtual;
     function GetScript: String; virtual;
     property WebController: TWebController read GetWebController;
     property WebController: TWebController read GetWebController;
@@ -145,30 +145,30 @@ type
   public
   public
     constructor Create(AOwner: TComponent); override;
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
     destructor Destroy; override;
-    procedure AddScriptFileReference(AScriptFile: String); virtual; abstract;
-    procedure AddStylesheetReference(Ahref, Amedia: String); virtual; abstract;
+    procedure AddScriptFileReference(const AScriptFile: String); virtual; abstract;
+    procedure AddStylesheetReference(const Ahref, Amedia: String); virtual; abstract;
     function CreateNewJavascriptStack(AJavaType: TJavaType): TJavaScriptStack; virtual; abstract;
     function CreateNewJavascriptStack(AJavaType: TJavaType): TJavaScriptStack; virtual; abstract;
     function InitializeJavaScriptStack(AJavaType: TJavaType): TJavaScriptStack;
     function InitializeJavaScriptStack(AJavaType: TJavaType): TJavaScriptStack;
     procedure FreeJavascriptStack; virtual;
     procedure FreeJavascriptStack; virtual;
     function HasJavascriptStack: boolean; virtual; abstract;
     function HasJavascriptStack: boolean; virtual; abstract;
-    function GetUrl(ParamNames, ParamValues, KeepParams: array of string; Action: string = ''): string; virtual; abstract;
+    function GetUrl(ParamNames, ParamValues, KeepParams: array of string; const Action: string = ''): string; virtual; abstract;
     procedure InitializeAjaxRequest; virtual;
     procedure InitializeAjaxRequest; virtual;
     procedure InitializeShowRequest; virtual;
     procedure InitializeShowRequest; virtual;
     procedure CleanupShowRequest; virtual;
     procedure CleanupShowRequest; virtual;
     procedure CleanupAfterRequest; virtual;
     procedure CleanupAfterRequest; virtual;
     procedure BeforeGenerateHead; virtual;
     procedure BeforeGenerateHead; virtual;
-    function AddJavaVariable(AName, ABelongsTo, AGetValueFunc, AID, AIDSuffix: string): TJavaVariable;
-    procedure BindJavascriptCallstackToElement(AComponent: TComponent; AnElement: THtmlCustomElement; AnEvent: string); virtual; abstract;
-    function MessageBox(AText: String; Buttons: TWebButtons; ALoaded: string = ''): string; virtual;
-    function DefaultMessageBoxHandler(Sender: TObject; AText: String; Buttons: TWebButtons;  ALoaded: string = ''): string; virtual; abstract;
+    function AddJavaVariable(const AName, ABelongsTo, AGetValueFunc, AID, AIDSuffix: string): TJavaVariable;
+    procedure BindJavascriptCallstackToElement(AComponent: TComponent; AnElement: THtmlCustomElement; const AnEvent: string); virtual; abstract;
+    function MessageBox(Const AText: String; Buttons: TWebButtons; const ALoaded: string = ''): string; virtual;
+    function DefaultMessageBoxHandler(Sender: TObject; const AText: String; Buttons: TWebButtons;  const ALoaded: string = ''): string; virtual; abstract;
     function CreateNewScript: TStringList; virtual; abstract;
     function CreateNewScript: TStringList; virtual; abstract;
-    function AddrelativeLinkPrefix(AnURL: string): string;
+    function AddrelativeLinkPrefix(const AnURL: string): string;
     procedure FreeScript(var AScript: TStringList); virtual; abstract;
     procedure FreeScript(var AScript: TStringList); virtual; abstract;
     procedure ShowRegisteredScript(ScriptID: integer); virtual; abstract;
     procedure ShowRegisteredScript(ScriptID: integer); virtual; abstract;
 
 
     function IncrementIterationLevel: integer; virtual;
     function IncrementIterationLevel: integer; virtual;
     function ResetIterationLevel: integer; virtual;
     function ResetIterationLevel: integer; virtual;
-    procedure SetIterationIDSuffix(AIterationLevel: integer; IDSuffix: string); virtual;
+    procedure SetIterationIDSuffix(AIterationLevel: integer; const IDSuffix: string); virtual;
     function GetIterationIDSuffix: string; virtual;
     function GetIterationIDSuffix: string; virtual;
     procedure DecrementIterationLevel; virtual;
     procedure DecrementIterationLevel; virtual;
 
 
@@ -198,7 +198,7 @@ type
     constructor Create(AWebController: TWebController; AResponse: TResponse); virtual;
     constructor Create(AWebController: TWebController; AResponse: TResponse); virtual;
     destructor Destroy; override;
     destructor Destroy; override;
     procedure BindToResponse; virtual;
     procedure BindToResponse; virtual;
-    procedure SetError(HelpContext: longint; ErrorMessage: string);
+    procedure SetError(HelpContext: longint; const ErrorMessage: string);
     procedure CancelXMLAnswer;
     procedure CancelXMLAnswer;
     property Response: TResponse read FResponse;
     property Response: TResponse read FResponse;
     property XMLAnswer: TXMLDocument read GetXMLAnswer;
     property XMLAnswer: TXMLDocument read GetXMLAnswer;
@@ -261,7 +261,7 @@ type
     procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
     procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
     procedure DoBeforeGenerateContent(const AContentProducer: THTMLContentProducer);
     procedure DoBeforeGenerateContent(const AContentProducer: THTMLContentProducer);
     function GetEvents: TEventRecords; virtual;
     function GetEvents: TEventRecords; virtual;
-    procedure AddEvent(var Events: TEventRecords; AServerEventID: integer; AServerEvent: THandleAjaxEvent; AJavaEventName: string; AcsCallBack: TCSAjaxEvent); virtual;
+    procedure AddEvent(var Events: TEventRecords; AServerEventID: integer; AServerEvent: THandleAjaxEvent; const AJavaEventName: string; AcsCallBack: TCSAjaxEvent); virtual;
     procedure DoOnEventCS(AnEvent: TEventRecord; AJavascriptStack: TJavaScriptStack; var Handled: boolean); virtual;
     procedure DoOnEventCS(AnEvent: TEventRecord; AJavascriptStack: TJavaScriptStack; var Handled: boolean); virtual;
     procedure SetupEvents(AHtmlElement: THtmlCustomElement); virtual;
     procedure SetupEvents(AHtmlElement: THtmlCustomElement); virtual;
     function GetWebPage: TDataModule;
     function GetWebPage: TDataModule;
@@ -599,12 +599,12 @@ begin
   inherited Destroy;
   inherited Destroy;
 end;
 end;
 
 
-procedure TJavaScriptStack.AddScriptLine(ALine: String);
+procedure TJavaScriptStack.AddScriptLine(const ALine: String);
 begin
 begin
   FScript.Add(ALine);
   FScript.Add(ALine);
 end;
 end;
 
 
-procedure TJavaScriptStack.MessageBox(AText: String; Buttons: TWebButtons; Loaded: string = '');
+procedure TJavaScriptStack.MessageBox(const AText: String; Buttons: TWebButtons; const Loaded: string = '');
 begin
 begin
   AddScriptLine(WebController.MessageBox(AText,Buttons,Loaded));
   AddScriptLine(WebController.MessageBox(AText,Buttons,Loaded));
 end;
 end;
@@ -614,7 +614,7 @@ begin
   raise EHTMLError.Create('RedrawContentProducer not supported by current WebController');
   raise EHTMLError.Create('RedrawContentProducer not supported by current WebController');
 end;
 end;
 
 
-procedure TJavaScriptStack.CallServerEvent(AHTMLContentProducer: THTMLContentProducer; AEvent: Integer; APostVariable: string = '');
+procedure TJavaScriptStack.CallServerEvent(AHTMLContentProducer: THTMLContentProducer; AEvent: Integer; const APostVariable: string = '');
 begin
 begin
   raise EHTMLError.Create('SendServerEvent not supported by current WebController');
   raise EHTMLError.Create('SendServerEvent not supported by current WebController');
 end;
 end;
@@ -624,7 +624,7 @@ begin
   FScript.Clear;
   FScript.Clear;
 end;
 end;
 
 
-procedure TJavaScriptStack.Redirect(AUrl: string);
+procedure TJavaScriptStack.Redirect(const AUrl: string);
 begin
 begin
   AddScriptLine('window.location = "'+AUrl+'";');
   AddScriptLine('window.location = "'+AUrl+'";');
 end;
 end;
@@ -744,7 +744,7 @@ begin
 end;
 end;
 
 
 procedure THTMLContentProducer.AddEvent(var Events: TEventRecords;
 procedure THTMLContentProducer.AddEvent(var Events: TEventRecords;
-  AServerEventID: integer; AServerEvent: THandleAjaxEvent; AJavaEventName: string;
+  AServerEventID: integer; AServerEvent: THandleAjaxEvent; const AJavaEventName: string;
   AcsCallBack: TCSAjaxEvent);
   AcsCallBack: TCSAjaxEvent);
 begin
 begin
   SetLength(Events,length(Events)+1);
   SetLength(Events,length(Events)+1);
@@ -1359,7 +1359,7 @@ begin
     end
     end
 end;
 end;
 
 
-procedure TAjaxResponse.SetError(HelpContext: longint; ErrorMessage: string);
+procedure TAjaxResponse.SetError(HelpContext: longint; const ErrorMessage: string);
 var SubNode: TDOMNode;
 var SubNode: TDOMNode;
     ErrNode: TDOMNode;
     ErrNode: TDOMNode;
 begin
 begin
@@ -1440,7 +1440,7 @@ begin
   // do nothing
   // do nothing
 end;
 end;
 
 
-function TWebController.AddJavaVariable(AName, ABelongsTo, AGetValueFunc, AID, AIDSuffix: string): TJavaVariable;
+function TWebController.AddJavaVariable(const AName, ABelongsTo, AGetValueFunc, AID, AIDSuffix: string): TJavaVariable;
 begin
 begin
   result := GetJavaVariables.Add;
   result := GetJavaVariables.Add;
   result.BelongsTo := ABelongsTo;
   result.BelongsTo := ABelongsTo;
@@ -1450,7 +1450,7 @@ begin
   result.ID := AID;
   result.ID := AID;
 end;
 end;
 
 
-function TWebController.MessageBox(AText: String; Buttons: TWebButtons; ALoaded: string = ''): string;
+function TWebController.MessageBox(const AText: String; Buttons: TWebButtons; const ALoaded: string = ''): string;
 begin
 begin
   if assigned(MessageBoxHandler) then
   if assigned(MessageBoxHandler) then
     result := MessageBoxHandler(self,AText,Buttons,ALoaded)
     result := MessageBoxHandler(self,AText,Buttons,ALoaded)
@@ -1458,7 +1458,7 @@ begin
     result := DefaultMessageBoxHandler(self,AText,Buttons,ALoaded);
     result := DefaultMessageBoxHandler(self,AText,Buttons,ALoaded);
 end;
 end;
 
 
-function TWebController.AddrelativeLinkPrefix(AnURL: string): string;
+function TWebController.AddrelativeLinkPrefix(const AnURL: string): string;
 var
 var
   i: Integer;
   i: Integer;
 begin
 begin
@@ -1479,7 +1479,7 @@ begin
   SetLength(FIterationIDs,0);
   SetLength(FIterationIDs,0);
 end;
 end;
 
 
-procedure TWebController.SetIterationIDSuffix(AIterationLevel: integer; IDSuffix: string);
+procedure TWebController.SetIterationIDSuffix(AIterationLevel: integer; const IDSuffix: string);
 begin
 begin
   FIterationIDs[AIterationLevel-1]:=IDSuffix;
   FIterationIDs[AIterationLevel-1]:=IDSuffix;
 end;
 end;

+ 6 - 6
packages/fcl-web/src/base/fphttpclient.pp

@@ -150,7 +150,7 @@ Type
     // Read 1 line of response. Fills FBuffer
     // Read 1 line of response. Fills FBuffer
     function ReadString(out S: String): Boolean;
     function ReadString(out S: String): Boolean;
     // Write string
     // Write string
-    function WriteString(S: String): Boolean;
+    function WriteString(const S: String): Boolean;
     // Write the request body
     // Write the request body
     function WriteRequestBody: Boolean;
     function WriteRequestBody: Boolean;
     // Check if response code is in AllowedResponseCodes. if not, an exception is raised.
     // Check if response code is in AllowedResponseCodes. if not, an exception is raised.
@@ -273,7 +273,7 @@ Type
     Class Procedure SimpleOptions(const URL: string; const LocalFileName: String);
     Class Procedure SimpleOptions(const URL: string; const LocalFileName: String);
     Class function SimpleOptions(const URL: string) : RawByteString;
     Class function SimpleOptions(const URL: string) : RawByteString;
     // Get HEAD
     // Get HEAD
-    Class Procedure Head(AURL : String; Headers: TStrings);
+    Class Procedure Head(const AURL : String; Headers: TStrings);
     // Post Form data (www-urlencoded).
     // Post Form data (www-urlencoded).
     // Formdata in string (urlencoded) or TStrings (plain text) format.
     // Formdata in string (urlencoded) or TStrings (plain text) format.
     // Form data will be inserted in the requestbody.
     // Form data will be inserted in the requestbody.
@@ -411,7 +411,7 @@ Type
   // writing to socket
   // writing to socket
   EHTTPClientSocketWrite = Class(EHTTPClientSocket);
   EHTTPClientSocketWrite = Class(EHTTPClientSocket);
 
 
-Function EncodeURLElement(S : String) : String;
+Function EncodeURLElement(const S : String) : String;
 Function DecodeURLElement(Const S : String) : String;
 Function DecodeURLElement(Const S : String) : String;
 
 
 implementation
 implementation
@@ -431,7 +431,7 @@ resourcestring
 Const
 Const
   CRLF = #13#10;
   CRLF = #13#10;
 
 
-function EncodeURLElement(S: String): String;
+function EncodeURLElement(const S: String): String;
 
 
 Const
 Const
   NotAllowed = [ ';', '/', '?', ':', '@', '=', '&', '#', '+', '_', '<', '>',
   NotAllowed = [ ';', '/', '?', ':', '@', '=', '&', '#', '+', '_', '<', '>',
@@ -889,7 +889,7 @@ begin
   until Result or Terminated;
   until Result or Terminated;
 end;
 end;
 
 
-function TFPCustomHTTPClient.WriteString(S: String): Boolean;
+function TFPCustomHTTPClient.WriteString(const S: String): Boolean;
 var
 var
   r,t : Longint;
   r,t : Longint;
 
 
@@ -2204,7 +2204,7 @@ begin
     end;
     end;
 end;
 end;
 
 
-class procedure TFPCustomHTTPClient.Head(AURL: String; Headers: TStrings);
+class procedure TFPCustomHTTPClient.Head(const AURL: String; Headers: TStrings);
 begin
 begin
   With Self.Create(nil) do
   With Self.Create(nil) do
     try
     try

+ 2 - 2
packages/fcl-web/src/base/fphttpserver.pp

@@ -346,7 +346,7 @@ Type
     procedure SetAcceptIdleTimeout(AValue: Cardinal);
     procedure SetAcceptIdleTimeout(AValue: Cardinal);
     procedure SetActive(const AValue: Boolean);
     procedure SetActive(const AValue: Boolean);
     procedure SetCertificateData(AValue: TCertificateData);
     procedure SetCertificateData(AValue: TCertificateData);
-    procedure SetHostName(AValue: string);
+    procedure SetHostName(const AValue: string);
     procedure SetIdle(AValue: TNotifyEvent);
     procedure SetIdle(AValue: TNotifyEvent);
     procedure SetOnAllowConnect(const AValue: TConnectQuery);
     procedure SetOnAllowConnect(const AValue: TConnectQuery);
     procedure SetAddress(const AValue: string);
     procedure SetAddress(const AValue: string);
@@ -1477,7 +1477,7 @@ begin
   FCertificateData:=AValue;
   FCertificateData:=AValue;
 end;
 end;
 
 
-procedure TFPCustomHttpServer.SetHostName(AValue: string);
+procedure TFPCustomHttpServer.SetHostName(const AValue: string);
 begin
 begin
   FCertificateData.HostName:=aValue;
   FCertificateData.HostName:=aValue;
 end;
 end;

+ 2 - 2
packages/fcl-web/src/base/fpmimetypes.pp

@@ -42,7 +42,7 @@ Type
   Private
   Private
     FTypes : TFPHashList;
     FTypes : TFPHashList;
     FExtensions : TFPHashList;
     FExtensions : TFPHashList;
-    procedure ParseLine(ALine: String; out Mime, Extensions: String);
+    procedure ParseLine(const ALine: String; out Mime, Extensions: String);
   Protected
   Protected
     Function FindMimeByType(Const AMime : String) : TMimeType;
     Function FindMimeByType(Const AMime : String) : TMimeType;
     Function FindMimeByExt(Const AExt : String) : TMimeType;
     Function FindMimeByExt(Const AExt : String) : TMimeType;
@@ -108,7 +108,7 @@ begin
   Result:=FTypes;
   Result:=FTypes;
 end;
 end;
 
 
-Procedure TFPMimeTypes.ParseLine(ALine : String; Out Mime,Extensions : String);
+Procedure TFPMimeTypes.ParseLine(const ALine : String; Out Mime,Extensions : String);
 
 
 COnst
 COnst
   WhiteSpace = [' ',#9];
   WhiteSpace = [' ',#9];

+ 6 - 6
packages/fcl-web/src/base/fpweb.pp

@@ -88,9 +88,9 @@ Type
     function GetVar(I : Integer): TTemplateVar;
     function GetVar(I : Integer): TTemplateVar;
     procedure Setvar(I : Integer; const AValue: TTemplateVar);
     procedure Setvar(I : Integer; const AValue: TTemplateVar);
   Public
   Public
-    Function IndexOfVar(AName : String) : Integer;
-    Function VarByName(AName : String) : TTemplateVar;
-    Function FindVar(AName : String) : TTemplateVar;
+    Function IndexOfVar(const AName : String) : Integer;
+    Function VarByName(const AName : String) : TTemplateVar;
+    Function FindVar(const AName : String) : TTemplateVar;
     Property Variables[I : Integer] : TTemplateVar Read GetVar Write Setvar; default;
     Property Variables[I : Integer] : TTemplateVar Read GetVar Write Setvar; default;
   end;
   end;
 
 
@@ -558,7 +558,7 @@ begin
   Items[i]:=AValue;
   Items[i]:=AValue;
 end;
 end;
 
 
-function TTemplateVars.IndexOfVar(AName: String): Integer;
+function TTemplateVars.IndexOfVar(const AName: String): Integer;
 
 
 begin
 begin
   Result:=Count-1;
   Result:=Count-1;
@@ -566,14 +566,14 @@ begin
     Dec(Result);
     Dec(Result);
 end;
 end;
 
 
-function TTemplateVars.VarByName(AName: String): TTemplateVar;
+function TTemplateVars.VarByName(Const AName: String): TTemplateVar;
 begin
 begin
   Result:=FindVar(AName);
   Result:=FindVar(AName);
   If (Result=Nil) then
   If (Result=Nil) then
     Raise EFPWebError.CreateFmt(SErrInvalidVar,[AName]);
     Raise EFPWebError.CreateFmt(SErrInvalidVar,[AName]);
 end;
 end;
 
 
-function TTemplateVars.FindVar(AName: String): TTemplateVar;
+function TTemplateVars.FindVar(Const AName: String): TTemplateVar;
 
 
 Var
 Var
   I : Integer;
   I : Integer;

+ 10 - 6
packages/fcl-web/src/base/fpwebclient.pp

@@ -116,14 +116,14 @@ Type
     FMaxSSLVersion: TSSLVersion;
     FMaxSSLVersion: TSSLVersion;
     Procedure LogRequest(AMethod, AURL: String; ARequest: TWebClientRequest);
     Procedure LogRequest(AMethod, AURL: String; ARequest: TWebClientRequest);
     Procedure LogResponse(AResponse: TWebClientResponse);
     Procedure LogResponse(AResponse: TWebClientResponse);
-    procedure SetLogFile(AValue: String);
+    procedure SetLogFile(const AValue: String);
     procedure SetSSLVersion(AValue : TSSLVersion);
     procedure SetSSLVersion(AValue : TSSLVersion);
     Function GetSSLVersion : TSSLVersion;
     Function GetSSLVersion : TSSLVersion;
   protected
   protected
     // Determine min/max version to try
     // Determine min/max version to try
     procedure GetVersionLimits(out PMin, PMax: TSSLVersion);
     procedure GetVersionLimits(out PMin, PMax: TSSLVersion);
     // Write a string to the log file
     // Write a string to the log file
-    procedure StringToStream(str: string);
+    procedure StringToStream(const str: string);
     // Must execute the requested method using request/response. Must take ResponseContent stream into account
     // Must execute the requested method using request/response. Must take ResponseContent stream into account
     Function DoHTTPMethod(Const AMethod,AURL : String; ARequest : TWebClientRequest) : TWebClientResponse; virtual; abstract;
     Function DoHTTPMethod(Const AMethod,AURL : String; ARequest : TWebClientRequest) : TWebClientResponse; virtual; abstract;
     // Must create a request.
     // Must create a request.
@@ -241,7 +241,7 @@ begin
   Result:=MinSSLVersion;
   Result:=MinSSLVersion;
 end;
 end;
 
 
-procedure TAbstractWebClient.SetLogFile(AValue: String);
+procedure TAbstractWebClient.SetLogFile(const AValue: String);
 begin
 begin
   if FLogFile=AValue then Exit;
   if FLogFile=AValue then Exit;
   if Assigned(FlogStream) then
   if Assigned(FlogStream) then
@@ -258,12 +258,16 @@ begin
 end;
 end;
 
 
 
 
-procedure TAbstractWebClient.StringToStream(str: string);
+procedure TAbstractWebClient.StringToStream(const str: string);
+
+var
+  S : String;
+
 begin
 begin
   if Assigned(FLogStream) then
   if Assigned(FLogStream) then
     begin
     begin
-    Str:=Str+sLineBreak;
-    FlogStream.Write(str[1],length(str));
+    S:=Str+sLineBreak;
+    FlogStream.Write(S[1],length(str));
     end;
     end;
 end;
 end;
 
 

+ 45 - 41
packages/fcl-web/src/base/httpdefs.pp

@@ -189,9 +189,9 @@ type
     procedure SetCookie(Index: Integer; Value: TCookie);
     procedure SetCookie(Index: Integer; Value: TCookie);
   public
   public
     function  Add: TCookie;
     function  Add: TCookie;
-    Function CookieByName(AName : String) : TCookie;
-    Function FindCookie(AName : String): TCookie;
-    Function IndexOfCookie(AName : String) : Integer;
+    Function CookieByName(const AName : String) : TCookie;
+    Function FindCookie(const AName : String): TCookie;
+    Function IndexOfCookie(const AName : String) : Integer;
     property Items[Index: Integer]: TCookie read GetCookie write SetCookie; default;
     property Items[Index: Integer]: TCookie read GetCookie write SetCookie; default;
   end;
   end;
 
 
@@ -238,9 +238,9 @@ type
   public
   public
     Function First : TUploadedFile;
     Function First : TUploadedFile;
     Function Last : TUploadedFile;
     Function Last : TUploadedFile;
-    Function IndexOfFile(AName : String) : Integer;
-    Function FileByName(AName : String) : TUploadedFile;
-    Function FindFile(AName : String) : TUploadedFile;
+    Function IndexOfFile(const AName : String) : Integer;
+    Function FileByName(const AName : String) : TUploadedFile;
+    Function FindFile(const AName : String) : TUploadedFile;
     Property Files[Index : Integer] : TUploadedFile read GetFile Write SetFile; default;
     Property Files[Index : Integer] : TUploadedFile read GetFile Write SetFile; default;
   end;
   end;
   TUploadedFilesClass = Class of TUploadedFiles;
   TUploadedFilesClass = Class of TUploadedFiles;
@@ -286,13 +286,13 @@ type
     function GetP(AIndex : Integer): TMimeItem;
     function GetP(AIndex : Integer): TMimeItem;
   Protected
   Protected
     Procedure CreateUploadFiles(Files : TUploadedFiles; Vars : TStrings); virtual;
     Procedure CreateUploadFiles(Files : TUploadedFiles; Vars : TStrings); virtual;
-    procedure FormSplit(var Cnt: String; boundary: String); virtual;
+    procedure FormSplit(var Cnt: String; const boundary: String); virtual;
     procedure ProcessStreamingMultiPart(const State: TContentStreamingState; const Buf; const Size: Integer); virtual;
     procedure ProcessStreamingMultiPart(const State: TContentStreamingState; const Buf; const Size: Integer); virtual;
     // With streaming is meant that the incoming data is processed in smaller
     // With streaming is meant that the incoming data is processed in smaller
     // chunks. To support streaming descendents have to implement
     // chunks. To support streaming descendents have to implement
     // ProcessStreamingMultiPart
     // ProcessStreamingMultiPart
     class function SupportsStreamingProcessing: Boolean; virtual;
     class function SupportsStreamingProcessing: Boolean; virtual;
-    procedure SetBoundary(AValue: string); virtual;
+    procedure SetBoundary(const AValue: string); virtual;
   Public
   Public
     Function First : TMimeItem;
     Function First : TMimeItem;
     Function Last : TMimeItem;
     Function Last : TMimeItem;
@@ -313,7 +313,7 @@ type
     FMimeEndFound: Boolean;
     FMimeEndFound: Boolean;
     FAtStart: Boolean;
     FAtStart: Boolean;
   protected
   protected
-    procedure SetBoundary(AValue: string); override;
+    procedure SetBoundary(const AValue: string); override;
     procedure ProcessStreamingMultiPart(const State: TContentStreamingState; const Buf; const Size: Integer); override;
     procedure ProcessStreamingMultiPart(const State: TContentStreamingState; const Buf; const Size: Integer); override;
     class function SupportsStreamingProcessing: Boolean; override;
     class function SupportsStreamingProcessing: Boolean; override;
   end;
   end;
@@ -342,16 +342,16 @@ type
     Function GetSetFieldValue(Index : Integer) : String; virtual;
     Function GetSetFieldValue(Index : Integer) : String; virtual;
     // These are private, because we need to know for sure the index is in the correct enumerated.
     // These are private, because we need to know for sure the index is in the correct enumerated.
     Function GetHeaderValue(AIndex : Integer) : String;
     Function GetHeaderValue(AIndex : Integer) : String;
-    Procedure SetHeaderValue(AIndex : Integer; AValue : String);
-    procedure SetHTTPVariable(AIndex: Integer; AValue: String);
+    Procedure SetHeaderValue(AIndex : Integer; const AValue : String);
+    procedure SetHTTPVariable(AIndex: Integer; const AValue : String);
     Function  GetHTTPVariable(AIndex : Integer) : String;
     Function  GetHTTPVariable(AIndex : Integer) : String;
   Protected
   Protected
     // Kept for backwards compatibility
     // Kept for backwards compatibility
     Class Function IndexToHTTPHeader (AIndex : Integer) : THeader;
     Class Function IndexToHTTPHeader (AIndex : Integer) : THeader;
     Class Function IndexToHTTPVariable (AIndex : Integer) : THTTPVariableType;
     Class Function IndexToHTTPVariable (AIndex : Integer) : THTTPVariableType;
-    procedure SetHTTPVariable(AVariable : THTTPVariableType; AValue: String);
+    procedure SetHTTPVariable(AVariable : THTTPVariableType; const AValue: String);
     Function  GetFieldValue(Index : Integer) : String; virtual; deprecated;
     Function  GetFieldValue(Index : Integer) : String; virtual; deprecated;
-    Procedure SetFieldValue(Index : Integer; Value : String); virtual; deprecated;
+    Procedure SetFieldValue(Index : Integer; const Value : String); virtual; deprecated;
     procedure ParseFirstHeaderLine(const line: String);virtual;
     procedure ParseFirstHeaderLine(const line: String);virtual;
     Procedure ParseCookies; virtual;
     Procedure ParseCookies; virtual;
   public
   public
@@ -466,8 +466,8 @@ type
     FOnStreamEncodingEvent: TOnStreamEncodingEvent;
     FOnStreamEncodingEvent: TOnStreamEncodingEvent;
     function GetLocalPathPrefix: string;
     function GetLocalPathPrefix: string;
     function GetFirstHeaderLine: String;
     function GetFirstHeaderLine: String;
-    function GetRP(AParam : String): String;
-    procedure SetRP(AParam : String; AValue: String);
+    function GetRP(const AParam : String): String;
+    procedure SetRP(const AParam : String; const AValue: String);
   Protected
   Protected
     procedure AllocateRequestID; virtual;
     procedure AllocateRequestID; virtual;
     Function AllowReadContent : Boolean; virtual;
     Function AllowReadContent : Boolean; virtual;
@@ -615,8 +615,8 @@ type
     // When called, generates a new GUID. Override to retrieve GUID from cookie/URL/...
     // When called, generates a new GUID. Override to retrieve GUID from cookie/URL/...
     Function GetSessionID : String; virtual;
     Function GetSessionID : String; virtual;
     // These must be overridden to actually store/retrieve variables.
     // These must be overridden to actually store/retrieve variables.
-    Function GetSessionVariable(VarName : String) : String; Virtual; abstract;
-    procedure SetSessionVariable(VarName : String; const AValue: String);Virtual;abstract;
+    Function GetSessionVariable(const VarName : String) : String; Virtual; abstract;
+    procedure SetSessionVariable(const VarName : String; const AValue: String);Virtual;abstract;
   Public
   Public
     Constructor Create(AOwner : TComponent); override;
     Constructor Create(AOwner : TComponent); override;
     // Init session from request.
     // Init session from request.
@@ -626,11 +626,11 @@ type
     // Update response from session (typically, change cookie to response and write session data).
     // Update response from session (typically, change cookie to response and write session data).
     Procedure UpdateResponse(AResponse : TResponse); virtual; Abstract;
     Procedure UpdateResponse(AResponse : TResponse); virtual; Abstract;
     // Remove variable from list of variables.
     // Remove variable from list of variables.
-    Procedure RemoveVariable(VariableName : String); virtual; abstract;
+    Procedure RemoveVariable(const VariableName : String); virtual; abstract;
     // Terminate session
     // Terminate session
     Procedure Terminate; virtual; abstract;
     Procedure Terminate; virtual; abstract;
     // checks if session variable exists
     // checks if session variable exists
-    Function SessionVariableExists(VarName : String) : Boolean; Virtual; abstract;
+    Function SessionVariableExists(const VarName : String) : Boolean; Virtual; abstract;
     // Session timeout in minutes
     // Session timeout in minutes
     Property TimeOutMinutes : Integer Read FTimeOut Write FTimeOut default 15;
     Property TimeOutMinutes : Integer Read FTimeOut Write FTimeOut default 15;
     // ID of this session.
     // ID of this session.
@@ -688,7 +688,7 @@ type
     FMaxAge: Integer;
     FMaxAge: Integer;
     FEnabled: Boolean;
     FEnabled: Boolean;
     FOptions: TCORSOptions;
     FOptions: TCORSOptions;
-    procedure SetAllowedMethods(AValue: String);
+    procedure SetAllowedMethods(const AValue: String);
   Public
   Public
     Constructor Create; virtual;
     Constructor Create; virtual;
     function ResolvedCORSAllowedOrigins(aRequest: TRequest): String; virtual;
     function ResolvedCORSAllowedOrigins(aRequest: TRequest): String; virtual;
@@ -757,7 +757,7 @@ begin
 //  FileClose(FileCreate('/tmp/touch-'+StringReplace(AName,'/','_',[rfReplaceAll])));
 //  FileClose(FileCreate('/tmp/touch-'+StringReplace(AName,'/','_',[rfReplaceAll])));
 end;
 end;
 
 
-Function GetFieldNameIndex(AName : String) : Integer;
+Function GetFieldNameIndex(const AName : String) : Integer;
 
 
 var
 var
   Name: String;
   Name: String;
@@ -926,7 +926,7 @@ begin
   Result := True;
   Result := True;
 end;
 end;
 
 
-procedure TStreamingMimeItems.SetBoundary(AValue: string);
+procedure TStreamingMimeItems.SetBoundary(const AValue: string);
 begin
 begin
   if Length(FBuffer) > 0 then
   if Length(FBuffer) > 0 then
     Raise Exception.Create('It is not possible to adapt the binary when the evaluation of streaming data has already been started.');
     Raise Exception.Create('It is not possible to adapt the binary when the evaluation of streaming data has already been started.');
@@ -935,11 +935,15 @@ end;
 
 
 { TCORSSupport }
 { TCORSSupport }
 
 
-procedure TCORSSupport.SetAllowedMethods(AValue: String);
+procedure TCORSSupport.SetAllowedMethods(const AValue: String);
+
+var
+  V : String;
+
 begin
 begin
-  aValue:=UpperCase(aValue);
-  if FAllowedMethods=AValue then Exit;
-  FAllowedMethods:=AValue;
+  V:=UpperCase(aValue);
+  if FAllowedMethods=V then Exit;
+  FAllowedMethods:=V;
 end;
 end;
 
 
 constructor TCORSSupport.Create;
 constructor TCORSSupport.Create;
@@ -1356,13 +1360,13 @@ begin
   Result:=StrToIntDef(GetHTTPVariable(hvServerPort),0);
   Result:=StrToIntDef(GetHTTPVariable(hvServerPort),0);
 end;
 end;
 
 
-procedure THTTPHeader.SetHTTPVariable(AIndex: Integer; AValue: String);
+procedure THTTPHeader.SetHTTPVariable(AIndex: Integer; const AValue: String);
 begin
 begin
   if (AIndex>=0) and (Aindex<=Ord(High(THTTPVariableType))) then
   if (AIndex>=0) and (Aindex<=Ord(High(THTTPVariableType))) then
     SetHTTPVariable(THTTPVariableType(AIndex),AValue);
     SetHTTPVariable(THTTPVariableType(AIndex),AValue);
 end;
 end;
 
 
-procedure THTTPHeader.SetHTTPVariable(AVariable: THTTPVariableType; AValue: String);
+procedure THTTPHeader.SetHTTPVariable(AVariable: THTTPVariableType; const AValue: String);
 begin
 begin
 //  Touch(GetEnumName(TypeInfo(THTTPVariableType),Ord(AVariable))+'='+AValue);
 //  Touch(GetEnumName(TypeInfo(THTTPVariableType),Ord(AVariable))+'='+AValue);
   if FVariables[AVariable]=AValue then
   if FVariables[AVariable]=AValue then
@@ -1402,7 +1406,7 @@ begin
     Result:='';
     Result:='';
 end;
 end;
 
 
-procedure THTTPHeader.SetHeaderValue(AIndex: Integer; AValue: String);
+procedure THTTPHeader.SetHeaderValue(AIndex: Integer; const AValue: String);
 begin
 begin
   if (AIndex>=0) and (AIndex<=Ord(High(THeader))) then
   if (AIndex>=0) and (AIndex<=Ord(High(THeader))) then
     SetHeader(THeader(AIndex),AValue);
     SetHeader(THeader(AIndex),AValue);
@@ -1641,7 +1645,7 @@ begin
 end;
 end;
 
 
 
 
-procedure THTTPHeader.SetFieldValue(Index: Integer; Value: String);
+procedure THTTPHeader.SetFieldValue(Index: Integer; const Value: String);
 
 
 
 
 Var
 Var
@@ -2010,7 +2014,7 @@ end;
   certain size is reached.)
   certain size is reached.)
 }
 }
 
 
-procedure TMimeItems.FormSplit(var Cnt : String; boundary: String);
+procedure TMimeItems.FormSplit(var Cnt : String; const boundary: String);
 
 
 // Splits the form into items
 // Splits the form into items
 var
 var
@@ -2070,7 +2074,7 @@ begin
   Result := False;
   Result := False;
 end;
 end;
 
 
-procedure TMimeItems.SetBoundary(AValue: string);
+procedure TMimeItems.SetBoundary(const AValue: string);
 begin
 begin
   FBoundary := AValue;
   FBoundary := AValue;
 end;
 end;
@@ -2218,7 +2222,7 @@ begin
     Result := Result + ' HTTP/' + HttpVersion;
     Result := Result + ' HTTP/' + HttpVersion;
 end;
 end;
 
 
-function TRequest.GetRP(AParam : String): String;
+function TRequest.GetRP(const AParam : String): String;
 begin
 begin
   if Assigned(FRouteParams) then
   if Assigned(FRouteParams) then
     Result:=FRouteParams.Values[AParam]
     Result:=FRouteParams.Values[AParam]
@@ -2226,7 +2230,7 @@ begin
     Result:='';
     Result:='';
 end;
 end;
 
 
-procedure TRequest.SetRP(AParam : String; AValue: String);
+procedure TRequest.SetRP(const AParam : String; const AValue: String);
 begin
 begin
   if (AValue<>GetRP(AParam)) And ((AValue<>'')<>Assigned(FRouteParams)) then
   if (AValue<>GetRP(AParam)) And ((AValue<>'')<>Assigned(FRouteParams)) then
     FRouteParams:=TStringList.Create;
     FRouteParams:=TStringList.Create;
@@ -2708,7 +2712,7 @@ begin
     Result:=GetTempFileName;
     Result:=GetTempFileName;
 end;
 end;
 
 
-function TUploadedFiles.IndexOfFile(AName: String): Integer;
+function TUploadedFiles.IndexOfFile(const AName: String): Integer;
 
 
 begin
 begin
   Result:=Count-1;
   Result:=Count-1;
@@ -2716,7 +2720,7 @@ begin
     Dec(Result);
     Dec(Result);
 end;
 end;
 
 
-function TUploadedFiles.FileByName(AName: String): TUploadedFile;
+function TUploadedFiles.FileByName(const AName: String): TUploadedFile;
 
 
 
 
 begin
 begin
@@ -2725,7 +2729,7 @@ begin
     Raise HTTPError.CreateFmt(SErrNoSuchUploadedFile,[AName]);
     Raise HTTPError.CreateFmt(SErrNoSuchUploadedFile,[AName]);
 end;
 end;
 
 
-Function TUploadedFiles.FindFile(AName: String): TUploadedFile;
+Function TUploadedFiles.FindFile(const AName: String): TUploadedFile;
 
 
 Var
 Var
   I : Integer;
   I : Integer;
@@ -3009,7 +3013,7 @@ end;
 
 
 function TCookie.GetAsString: string;
 function TCookie.GetAsString: string;
 
 
-  Procedure AddToResult(S : String);
+  Procedure AddToResult(const S : String);
   
   
   begin
   begin
     Result:=Result+';'+S;
     Result:=Result+';'+S;
@@ -3100,14 +3104,14 @@ begin
   Result:=TCookie(Inherited Add);
   Result:=TCookie(Inherited Add);
 end;
 end;
 
 
-function TCookies.CookieByName(AName: String): TCookie;
+function TCookies.CookieByName(const AName: String): TCookie;
 begin
 begin
   Result:=FindCookie(AName);
   Result:=FindCookie(AName);
   If (Result=Nil) then
   If (Result=Nil) then
     Raise HTTPError.CreateFmt(SErrUnknownCookie,[AName]);
     Raise HTTPError.CreateFmt(SErrUnknownCookie,[AName]);
 end;
 end;
 
 
-function TCookies.FindCookie(AName: String): TCookie;
+function TCookies.FindCookie(const AName: String): TCookie;
 Var
 Var
   I : Integer;
   I : Integer;
 
 
@@ -3119,7 +3123,7 @@ begin
     Result:=GetCookie(I);
     Result:=GetCookie(I);
 end;
 end;
 
 
-function TCookies.IndexOfCookie(AName: String): Integer;
+function TCookies.IndexOfCookie(const AName: String): Integer;
 
 
 begin
 begin
   Result:=Count-1;
   Result:=Count-1;

+ 2 - 2
packages/fcl-web/src/base/httpjson.pp

@@ -22,7 +22,7 @@ Type
   Protected
   Protected
     Procedure ExceptionToJSON(aException: Exception; aJSON : TJSONObject);
     Procedure ExceptionToJSON(aException: Exception; aJSON : TJSONObject);
   Public
   Public
-    procedure SendExceptionJSON(aException: Exception; aElement: String='');
+    procedure SendExceptionJSON(aException: Exception; const aElement: String='');
     procedure SetContentFromJSON(const AValue: TJSONData; Formatted : Boolean = True);
     procedure SetContentFromJSON(const AValue: TJSONData; Formatted : Boolean = True);
     // These set without formatting
     // These set without formatting
     Property ContentAsJSON : TJSONData Read GetJSONContent Write SetJSONContent;
     Property ContentAsJSON : TJSONData Read GetJSONContent Write SetJSONContent;
@@ -78,7 +78,7 @@ begin
     end;
     end;
 end;
 end;
 
 
-procedure THTTPJSONResponseHelper.SendExceptionJSON(aException: Exception; aElement : String = '');
+procedure THTTPJSONResponseHelper.SendExceptionJSON(aException: Exception; const aElement : String = '');
 
 
 Var
 Var
   EH : EHTTP absolute aException;
   EH : EHTTP absolute aException;

+ 9 - 9
packages/fcl-web/src/base/httproute.pp

@@ -47,12 +47,12 @@ Type
     FDefault: Boolean;
     FDefault: Boolean;
     FMethod: TRouteMethod;
     FMethod: TRouteMethod;
     FURLPattern: String;
     FURLPattern: String;
-    procedure SetURLPattern(AValue: String);
+    procedure SetURLPattern(const AValue: String);
   Protected
   Protected
     Procedure DoHandleRequest(ARequest : TRequest; AResponse : TResponse); virtual;
     Procedure DoHandleRequest(ARequest : TRequest; AResponse : TResponse); virtual;
   Public
   Public
     Destructor Destroy; override;
     Destructor Destroy; override;
-    class function NormalizeRoute(AValue: String): String;
+    class function NormalizeRoute(const AValue: String): String;
     Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse);
     Procedure HandleRequest(ARequest : TRequest; AResponse : TResponse);
     Function Matches(Const APattern : String; AMethod : TRouteMethod; Options : TRouteOptions) : Boolean;
     Function Matches(Const APattern : String; AMethod : TRouteMethod; Options : TRouteOptions) : Boolean;
     Function MatchPattern(Const Path : String; L : TStrings; Options : TRouteOptions) : Boolean;
     Function MatchPattern(Const Path : String; L : TStrings; Options : TRouteOptions) : Boolean;
@@ -214,7 +214,7 @@ Type
     // Override this if you want to use another collection class.
     // Override this if you want to use another collection class.
     Function CreateRouteList : THTTPRouteList; virtual;
     Function CreateRouteList : THTTPRouteList; virtual;
     Function CreateInterceptorList : TRequestInterceptorList; virtual;
     Function CreateInterceptorList : TRequestInterceptorList; virtual;
-    Procedure CheckDuplicate(APattern : String; AMethod : TRouteMethod; isDefault : Boolean);
+    Procedure CheckDuplicate(const APattern : String; AMethod : TRouteMethod; isDefault : Boolean);
     // Actually route request. Override this for customized behaviour.
     // Actually route request. Override this for customized behaviour.
     Procedure DoRouteRequest(ARequest : TRequest; AResponse : TResponse); virtual;
     Procedure DoRouteRequest(ARequest : TRequest; AResponse : TResponse); virtual;
     // Extract route from request. This is PathInfo by default (sanitized);
     // Extract route from request. This is PathInfo by default (sanitized);
@@ -453,7 +453,7 @@ begin
   Result:=TRequestInterceptorList.Create(TRequestInterceptorItem);
   Result:=TRequestInterceptorList.Create(TRequestInterceptorItem);
 end;
 end;
 
 
-procedure THTTPRouter.CheckDuplicate(APattern: String; AMethod: TRouteMethod;
+procedure THTTPRouter.CheckDuplicate(const APattern: String; AMethod: TRouteMethod;
   isDefault: Boolean);
   isDefault: Boolean);
 Var
 Var
   I,DI : Integer;
   I,DI : Integer;
@@ -869,7 +869,7 @@ end;
 
 
 { THTTPRoute }
 { THTTPRoute }
 
 
-Class Function THTTPRoute.NormalizeRoute(AValue: String) : String;
+Class Function THTTPRoute.NormalizeRoute(const AValue: String) : String;
 
 
 begin
 begin
   Result:=IncludeHTTPPathDelimiter(AValue);
   Result:=IncludeHTTPPathDelimiter(AValue);
@@ -877,7 +877,7 @@ begin
     Delete(Result,1,1);
     Delete(Result,1,1);
 end;
 end;
 
 
-procedure THTTPRoute.SetURLPattern(AValue: String);
+procedure THTTPRoute.SetURLPattern(const AValue: String);
 
 
 Var
 Var
   V : String;
   V : String;
@@ -914,14 +914,14 @@ end;
 Function THTTPRoute.MatchPattern(Const Path : String; L : TStrings; Options: TRouteOptions) : Boolean;
 Function THTTPRoute.MatchPattern(Const Path : String; L : TStrings; Options: TRouteOptions) : Boolean;
 
 
   // This is used only with special chars, so we do not check case sensitivity
   // This is used only with special chars, so we do not check case sensitivity
-  Function StartsWith(C : Char; S : String): Boolean; 
+  Function StartsWith(C : Char; const S : String): Boolean; 
   
   
   begin
   begin
     Result:=(Length(S)>0) and (S[1]=C);
     Result:=(Length(S)>0) and (S[1]=C);
   end;
   end;
   
   
   // This is used only with special chars, so we do not check case sensitivity
   // This is used only with special chars, so we do not check case sensitivity
-  Function EndsWith(C : Char; S : String): Boolean;
+  Function EndsWith(C : Char; const S : String): Boolean;
   
   
   Var
   Var
   L : Integer;
   L : Integer;
@@ -931,7 +931,7 @@ Function THTTPRoute.MatchPattern(Const Path : String; L : TStrings; Options: TRo
     Result:=(L>0) and (S[L]=C);
     Result:=(L>0) and (S[L]=C);
   end;
   end;
 
 
-  Function SameString(A,B : String) : Boolean;
+  Function SameString(const A,B : String) : Boolean;
 
 
   begin
   begin
     if roCaseSensitive in Options then
     if roCaseSensitive in Options then

+ 8 - 9
packages/fcl-web/src/base/iniwebsession.pp

@@ -38,19 +38,19 @@ Type
     Procedure FreeIniFile;
     Procedure FreeIniFile;
     Procedure CheckSession;
     Procedure CheckSession;
     Function GetSessionID : String; override;
     Function GetSessionID : String; override;
-    Function GetSessionVariable(VarName : String) : String; override;
-    procedure SetSessionVariable(VarName : String; const AValue: String); override;
+    Function GetSessionVariable(const VarName : String) : String; override;
+    procedure SetSessionVariable(const VarName : String; const AValue: String); override;
     Property Cached : Boolean Read FCached Write FCached;
     Property Cached : Boolean Read FCached Write FCached;
     Property SessionDir : String Read FSessionDir Write FSessionDir;
     Property SessionDir : String Read FSessionDir Write FSessionDir;
     Property IniFile : TMemIniFile Read FIniFile Write FIniFile;
     Property IniFile : TMemIniFile Read FIniFile Write FIniFile;
   Public
   Public
     Destructor Destroy; override;
     Destructor Destroy; override;
     Procedure Terminate; override;
     Procedure Terminate; override;
-    function SessionVariableExists(VarName: String): Boolean; override;
+    function SessionVariableExists(const VarName: String): Boolean; override;
     Procedure UpdateResponse(AResponse : TResponse); override;
     Procedure UpdateResponse(AResponse : TResponse); override;
     Procedure InitSession(ARequest : TRequest; OnNewSession, OnExpired: TNotifyEvent); override;
     Procedure InitSession(ARequest : TRequest; OnNewSession, OnExpired: TNotifyEvent); override;
     Procedure InitResponse(AResponse : TResponse); override;
     Procedure InitResponse(AResponse : TResponse); override;
-    Procedure RemoveVariable(VariableName : String); override;
+    Procedure RemoveVariable(const VariableName : String); override;
     Function GetSessionDir : String;
     Function GetSessionDir : String;
   end;
   end;
   TIniWebSessionClass = Class of TIniWebSession;
   TIniWebSessionClass = Class of TIniWebSession;
@@ -324,14 +324,13 @@ begin
       Raise EWebSessionError.Create(SErrNoSession)
       Raise EWebSessionError.Create(SErrNoSession)
 end;
 end;
 
 
-function TIniWebSession.GetSessionVariable(VarName: String): String;
+function TIniWebSession.GetSessionVariable(const VarName: String): String;
 begin
 begin
   CheckSession;
   CheckSession;
   Result:=FIniFile.ReadString(SData,VarName,'');
   Result:=FIniFile.ReadString(SData,VarName,'');
 end;
 end;
 
 
-procedure TIniWebSession.SetSessionVariable(VarName: String;
-  const AValue: String);
+procedure TIniWebSession.SetSessionVariable(const VarName: String; const AValue: String);
 begin
 begin
   CheckSession;
   CheckSession;
   FIniFile.WriteString(SData,VarName,AValue);
   FIniFile.WriteString(SData,VarName,AValue);
@@ -360,7 +359,7 @@ begin
   RemoveFromSessionState(ssExpired);
   RemoveFromSessionState(ssExpired);
 end;
 end;
 
 
-function TIniWebSession.SessionVariableExists(VarName: String): Boolean;
+function TIniWebSession.SessionVariableExists(const VarName: String): Boolean;
 begin
 begin
   CheckSession;
   CheckSession;
   Result:=FIniFile.ValueExists(SData,VarName);
   Result:=FIniFile.ValueExists(SData,VarName);
@@ -458,7 +457,7 @@ begin
   AddToSessionState(ssResponseInitialized);
   AddToSessionState(ssResponseInitialized);
 end;
 end;
 
 
-procedure TIniWebSession.RemoveVariable(VariableName: String);
+procedure TIniWebSession.RemoveVariable(const VariableName: String);
 begin
 begin
 {$ifdef cgidebug}SendMethodEnter('TIniWebSession.RemoveVariable');{$endif}
 {$ifdef cgidebug}SendMethodEnter('TIniWebSession.RemoveVariable');{$endif}
   CheckSession;
   CheckSession;

+ 6 - 6
packages/fcl-web/src/base/restbase.pp

@@ -153,10 +153,10 @@ Type
     FList : TStringList;
     FList : TStringList;
     function GetN(Aindex : Integer): String;
     function GetN(Aindex : Integer): String;
     function GetO(Aindex : Integer): TBaseObject;
     function GetO(Aindex : Integer): TBaseObject;
-    function GetON(AName : String): TBaseObject;
-    procedure SetN(Aindex : Integer; AValue: String);
+    function GetON(const AName : String): TBaseObject;
+    procedure SetN(Aindex : Integer; const AValue: String);
     procedure SetO(Aindex : Integer; AValue: TBaseObject);
     procedure SetO(Aindex : Integer; AValue: TBaseObject);
-    procedure SetON(AName : String; AValue: TBaseObject);
+    procedure SetON(const AName : String; AValue: TBaseObject);
   Protected
   Protected
     Class Function ObjectClass : TBaseObjectClass; virtual;
     Class Function ObjectClass : TBaseObjectClass; virtual;
   Public
   Public
@@ -371,7 +371,7 @@ begin
   Result:=TBaseObject(Flist.Objects[AIndex]);
   Result:=TBaseObject(Flist.Objects[AIndex]);
 end;
 end;
 
 
-function TBaseNamedObjectList.GetON(AName : String): TBaseObject;
+function TBaseNamedObjectList.GetON(const AName : String): TBaseObject;
 
 
 Var
 Var
   I : Integer;
   I : Integer;
@@ -384,7 +384,7 @@ begin
     Result:=Nil;
     Result:=Nil;
 end;
 end;
 
 
-procedure TBaseNamedObjectList.SetN(Aindex : Integer; AValue: String);
+procedure TBaseNamedObjectList.SetN(Aindex : Integer; const AValue: String);
 begin
 begin
   Flist[AIndex]:=Avalue
   Flist[AIndex]:=Avalue
 end;
 end;
@@ -394,7 +394,7 @@ begin
   Flist.Objects[AIndex]:=Avalue
   Flist.Objects[AIndex]:=Avalue
 end;
 end;
 
 
-procedure TBaseNamedObjectList.SetON(AName : String; AValue: TBaseObject);
+procedure TBaseNamedObjectList.SetON(const AName : String; AValue: TBaseObject);
 Var
 Var
   I : Integer;
   I : Integer;
 
 

+ 6 - 6
packages/fcl-web/src/base/tcwebmodule.pp

@@ -43,7 +43,7 @@ Type
     function GetSCS: Ansistring;
     function GetSCS: Ansistring;
   protected
   protected
     Function GetFieldValue(Index : Integer) : String; override;
     Function GetFieldValue(Index : Integer) : String; override;
-    Procedure SetFieldValue(Index : Integer; Value : String); override;
+    Procedure SetFieldValue(Index : Integer; const Value : String); override;
     Procedure DoSendHeaders(Headers : TStrings); override;
     Procedure DoSendHeaders(Headers : TStrings); override;
     Procedure DoSendContent; override;
     Procedure DoSendContent; override;
   Public
   Public
@@ -64,8 +64,8 @@ Type
     function GetValues: TStrings;
     function GetValues: TStrings;
   Protected
   Protected
     Destructor Destroy; override;
     Destructor Destroy; override;
-    Function GetSessionVariable(VarName : String) : String; override;
-    procedure SetSessionVariable(VarName : String; const AValue: String);override;
+    Function GetSessionVariable(const VarName : String) : String; override;
+    procedure SetSessionVariable(const VarName : String; const AValue: String);override;
     Property Values : TStrings Read GetValues;
     Property Values : TStrings Read GetValues;
   end;
   end;
 
 
@@ -198,7 +198,7 @@ begin
   inherited Destroy;
   inherited Destroy;
 end;
 end;
 
 
-function TFakeSession.GetSessionVariable(VarName: String): String;
+function TFakeSession.GetSessionVariable(const VarName: String): String;
 begin
 begin
   If Assigned(FValues) then
   If Assigned(FValues) then
     Result:=FValues.Values[VarName]
     Result:=FValues.Values[VarName]
@@ -206,7 +206,7 @@ begin
     Result:='';
     Result:='';
 end;
 end;
 
 
-procedure TFakeSession.SetSessionVariable(VarName: String; const AValue: String);
+procedure TFakeSession.SetSessionVariable(const VarName: String; const AValue: String);
 begin
 begin
   CheckValues;
   CheckValues;
   FValues.Values[VarName]:=AValue;
   FValues.Values[VarName]:=AValue;
@@ -302,7 +302,7 @@ begin
     Result:=FFields.Values[IntToStr(Index)];
     Result:=FFields.Values[IntToStr(Index)];
 end;
 end;
 
 
-procedure TFakeResponse.SetFieldValue(Index: Integer; Value: String);
+procedure TFakeResponse.SetFieldValue(Index: Integer; const Value: String);
 begin
 begin
   inherited SetFieldValue(Index, Value);
   inherited SetFieldValue(Index, Value);
   If (Value<>'') and (GetFieldValue(Index)='') then
   If (Value<>'') and (GetFieldValue(Index)='') then

+ 12 - 12
packages/fcl-web/src/base/webpage.pp

@@ -67,11 +67,11 @@ type
     constructor Create(AOwner: TComponent); override;
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
     destructor Destroy; override;
     function CreateNewJavascriptStack(AJavaType: TJavaType): TJavaScriptStack; override;
     function CreateNewJavascriptStack(AJavaType: TJavaType): TJavaScriptStack; override;
-    function GetUrl(ParamNames, ParamValues, KeepParams: array of string; Action: string = ''): string; override;
-    procedure BindJavascriptCallstackToElement(AComponent: TComponent; AnElement: THtmlCustomElement; AnEvent: string); override;
-    procedure AddScriptFileReference(AScriptFile: String); override;
-    procedure AddStylesheetReference(Ahref, Amedia: String); override;
-    function DefaultMessageBoxHandler(Sender: TObject; AText: String; Buttons: TWebButtons; ALoaded: string = ''): string; override;
+    function GetUrl(ParamNames, ParamValues, KeepParams: array of string; const Action: string = ''): string; override;
+    procedure BindJavascriptCallstackToElement(AComponent: TComponent; AnElement: THtmlCustomElement; const AnEvent: string); override;
+    procedure AddScriptFileReference(const AScriptFile: String); override;
+    procedure AddStylesheetReference(const Ahref, Amedia: String); override;
+    function DefaultMessageBoxHandler(Sender: TObject; const AText: String; Buttons: TWebButtons; const ALoaded: string = ''): string; override;
     function CreateNewScript: TStringList; override;
     function CreateNewScript: TStringList; override;
     procedure ShowRegisteredScript(ScriptID: integer); override;
     procedure ShowRegisteredScript(ScriptID: integer); override;
     procedure FreeScript(var AScript: TStringList); override;
     procedure FreeScript(var AScript: TStringList); override;
@@ -138,7 +138,7 @@ type
     property BaseURL: string read FBaseURL write FBaseURL;
     property BaseURL: string read FBaseURL write FBaseURL;
   end;
   end;
 
 
-  function RegisterScript(AScript: string) : integer;
+  function RegisterScript(const AScript: string) : integer;
 
 
 implementation
 implementation
 
 
@@ -146,7 +146,7 @@ uses typinfo, strutils;
 
 
 var RegisteredScriptList : TStrings;
 var RegisteredScriptList : TStrings;
 
 
-function RegisterScript(AScript: string) : integer;
+function RegisterScript(const AScript: string) : integer;
 begin
 begin
   if not Assigned(RegisteredScriptList) then
   if not Assigned(RegisteredScriptList) then
     begin
     begin
@@ -498,7 +498,7 @@ begin
 end;
 end;
 
 
 function TStandardWebController.DefaultMessageBoxHandler(Sender: TObject;
 function TStandardWebController.DefaultMessageBoxHandler(Sender: TObject;
-  AText: String; Buttons: TWebButtons; ALoaded: string = ''): string;
+  const AText: String; Buttons: TWebButtons; const ALoaded: string = ''): string;
 var i : integer;
 var i : integer;
     HasCancel: boolean;
     HasCancel: boolean;
     OnOk: string;
     OnOk: string;
@@ -549,7 +549,7 @@ begin
 end;
 end;
 
 
 function TStandardWebController.GetUrl(ParamNames, ParamValues,
 function TStandardWebController.GetUrl(ParamNames, ParamValues,
-  KeepParams: array of string; Action: string): string;
+  KeepParams: array of string; const Action: string): string;
 
 
 var qs,p : String;
 var qs,p : String;
     i,j  : integer;
     i,j  : integer;
@@ -633,7 +633,7 @@ begin
     OnGetURL(ParamNames, ParamValues, KeepParams, Action, Result);
     OnGetURL(ParamNames, ParamValues, KeepParams, Action, Result);
 end;
 end;
 
 
-procedure TStandardWebController.BindJavascriptCallstackToElement(AComponent: TComponent; AnElement: THtmlCustomElement; AnEvent: string);
+procedure TStandardWebController.BindJavascriptCallstackToElement(AComponent: TComponent; AnElement: THtmlCustomElement; const AnEvent: string);
 begin
 begin
   if AnEvent='onclick' then
   if AnEvent='onclick' then
     (AnElement as THTMLAttrsElement).onclick:=CurrentJavaScriptStack.GetScript
     (AnElement as THTMLAttrsElement).onclick:=CurrentJavaScriptStack.GetScript
@@ -641,13 +641,13 @@ begin
     if AnElement is THTML_input then (AnElement as THTML_input).onchange:=CurrentJavaScriptStack.GetScript;
     if AnElement is THTML_input then (AnElement as THTML_input).onchange:=CurrentJavaScriptStack.GetScript;
 end;
 end;
 
 
-procedure TStandardWebController.AddScriptFileReference(AScriptFile: String);
+procedure TStandardWebController.AddScriptFileReference(const AScriptFile: String);
 begin
 begin
   if FScriptFileReferences.IndexOf(AScriptFile)=-1 then
   if FScriptFileReferences.IndexOf(AScriptFile)=-1 then
     FScriptFileReferences.Add(AScriptFile);
     FScriptFileReferences.Add(AScriptFile);
 end;
 end;
 
 
-procedure TStandardWebController.AddStylesheetReference(Ahref, Amedia: String);
+procedure TStandardWebController.AddStylesheetReference(Const Ahref, Amedia: String);
 begin
 begin
   with FStyleSheetReferences.Add do
   with FStyleSheetReferences.Add do
     begin
     begin

+ 8 - 8
packages/fcl-web/src/jsonrpc/fprpcclient.pp

@@ -57,7 +57,7 @@ Type
     // Override so we can query for all registered types
     // Override so we can query for all registered types
     function QueryInterface(constref aIID: TGuid; out aObj): LongInt;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; override;
     function QueryInterface(constref aIID: TGuid; out aObj): LongInt;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; override;
     // Create virtual interface. Override this if you want to return something other than TFPRPCVirtualInterface
     // Create virtual interface. Override this if you want to return something other than TFPRPCVirtualInterface
-    function CreateVirtualInterface(IntfType: TRttiInterfaceType; aName: string): IInterface; virtual;
+    function CreateVirtualInterface(IntfType: TRttiInterfaceType; const aName: string): IInterface; virtual;
     // Encode parameters to method call.
     // Encode parameters to method call.
     function EncodeParams(aMethod: TRttiMethod; const aArgs: TValueArray; out VarParamCount: Integer): TJSONData;
     function EncodeParams(aMethod: TRttiMethod; const aArgs: TValueArray; out VarParamCount: Integer): TJSONData;
     // Decode JSON-RPC result to method call result and var/out params.
     // Decode JSON-RPC result to method call result and var/out params.
@@ -66,7 +66,7 @@ Type
     function DoCreateProxy(constref aIID: TGuid; out aObj): Boolean;
     function DoCreateProxy(constref aIID: TGuid; out aObj): Boolean;
     function DoCreateProxy(const aName: String; out aObj): Boolean;
     function DoCreateProxy(const aName: String; out aObj): Boolean;
     // Called from TFPRPCVirtualInterface to actuall handle call.
     // Called from TFPRPCVirtualInterface to actuall handle call.
-    procedure HandleInvoke(aClassName : String; aMethod: TRttiMethod; const aArgs: TValueArray; out aResult: TValue); virtual;
+    procedure HandleInvoke(const aClassName : String; aMethod: TRttiMethod; const aArgs: TValueArray; out aResult: TValue); virtual;
     // Do actual HTTP request.
     // Do actual HTTP request.
     function DoRequest(aRequest : TJSONObject) : TJSONObject; virtual;
     function DoRequest(aRequest : TJSONObject) : TJSONObject; virtual;
     // Create JSON-RPC request object.
     // Create JSON-RPC request object.
@@ -75,9 +75,9 @@ Type
     property Client : TAbstractWebClient Read GetClient;
     property Client : TAbstractWebClient Read GetClient;
   Public
   Public
     // Create a service by name. Use QueryInterface on the result to get your actual interface
     // Create a service by name. Use QueryInterface on the result to get your actual interface
-    Function CreateService(aName : string) : IInterface;
+    Function CreateService(const aName : string) : IInterface;
     // Create a service by name, directly return the interface.
     // Create a service by name, directly return the interface.
-    generic Function CreateService<T : IInterface>(aName : string) : T;
+    generic Function CreateService<T : IInterface>(const aName : string) : T;
     // Set this to use another webclient other than the default one.
     // Set this to use another webclient other than the default one.
     Property WebClient : TAbstractWebClient Read FClient Write FClient;
     Property WebClient : TAbstractWebClient Read FClient Write FClient;
     // base URL for JSON-RPC requests
     // base URL for JSON-RPC requests
@@ -256,7 +256,7 @@ end;
 
 
 { TFPRPCClient }
 { TFPRPCClient }
 
 
-function TFPRPCClient.CreateVirtualInterface(IntfType : TRttiInterfaceType; aName: string) : IInterface;
+function TFPRPCClient.CreateVirtualInterface(IntfType : TRttiInterfaceType; const aName: string) : IInterface;
 
 
 begin
 begin
   Result:=TFPRPCVirtualInterface.Create(IntfType.Handle,aName,Self) as IInterface
   Result:=TFPRPCVirtualInterface.Create(IntfType.Handle,aName,Self) as IInterface
@@ -336,13 +336,13 @@ begin
   end;
   end;
 end;
 end;
 
 
-function TFPRPCClient.CreateService(aName: string): IInterface;
+function TFPRPCClient.CreateService(const aName: string): IInterface;
 begin
 begin
   if not DoCreateProxy(aName,Result) then
   if not DoCreateProxy(aName,Result) then
     Raise ERPCClient.CreateFmt(SErrUnknownServiceName,[aName]);
     Raise ERPCClient.CreateFmt(SErrUnknownServiceName,[aName]);
 end;
 end;
 
 
-generic function TFPRPCClient.CreateService<T>(aName: string): T;
+generic function TFPRPCClient.CreateService<T>(const aName: string): T;
 
 
 Var
 Var
   II : IInterface;
   II : IInterface;
@@ -437,7 +437,7 @@ begin
     end;
     end;
 end;
 end;
 
 
-procedure TFPRPCClient.HandleInvoke(aClassName : String; aMethod: TRttiMethod; const aArgs: TValueArray; out aResult: TValue);
+procedure TFPRPCClient.HandleInvoke(const aClassName : String; aMethod: TRttiMethod; const aArgs: TValueArray; out aResult: TValue);
 
 
 var
 var
   request, response: TJSONObject;
   request, response: TJSONObject;

+ 7 - 4
packages/fcl-web/src/jsonrpc/fprpccodegen.pp

@@ -113,7 +113,7 @@ type
   protected
   protected
     // Overrides
     // Overrides
     Function BaseUnits : String; override;
     Function BaseUnits : String; override;
-    function StringToJSType(S: String): TJSONtype;
+    function StringToJSType(const S: String): TJSONtype;
     // High-level decl
     // High-level decl
     procedure GenerateServiceClassDeclarations(aServices: TAPIServices); virtual;
     procedure GenerateServiceClassDeclarations(aServices: TAPIServices); virtual;
     procedure GenerateServiceDeclaration(aService: TAPIService); virtual;
     procedure GenerateServiceDeclaration(aService: TAPIService); virtual;
@@ -465,11 +465,14 @@ begin
     end;
     end;
 end;
 end;
 
 
-function TAPIClientCodeGen.StringToJSType(S : String) : TJSONtype;
+function TAPIClientCodeGen.StringToJSType(const S : String) : TJSONtype;
+
+var
+  LS : String;
 
 
 begin
 begin
-  S:=LowerCase(S);
-  Case S of
+  LS:=LowerCase(S);
+  Case LS of
     'jtunknown' : Result:=jtUnknown;
     'jtunknown' : Result:=jtUnknown;
     'jtnumber'  : Result:=jtNumber;
     'jtnumber'  : Result:=jtNumber;
     'jtstring'  : Result:=jtString;
     'jtstring'  : Result:=jtString;

+ 18 - 18
packages/fcl-web/src/jwt/fpjwt.pp

@@ -53,9 +53,9 @@ Type
     // Override this to disable writing a property to the JSON.
     // Override this to disable writing a property to the JSON.
     function WriteProp(P: PPropInfo; All: Boolean): Boolean; virtual;
     function WriteProp(P: PPropInfo; All: Boolean): Boolean; virtual;
     function GetAsEncodedString: String; virtual;
     function GetAsEncodedString: String; virtual;
-    procedure SetAsEncodedString(AValue: String); virtual;
+    procedure SetAsEncodedString(const AValue: String); virtual;
     function GetAsString: TJSONStringType; virtual;
     function GetAsString: TJSONStringType; virtual;
-    procedure SetAsString(AValue: TJSONStringType);virtual;
+    procedure SetAsString(const AValue: TJSONStringType);virtual;
     Procedure DoLoadFromJSON(JSON : TJSONObject);virtual;
     Procedure DoLoadFromJSON(JSON : TJSONObject);virtual;
     Procedure DoSaveToJSON(JSON : TJSONObject; All : Boolean);virtual;
     Procedure DoSaveToJSON(JSON : TJSONObject; All : Boolean);virtual;
   Public
   Public
@@ -63,12 +63,12 @@ Type
     Procedure LoadFromJSON(JSON : TJSONObject);
     Procedure LoadFromJSON(JSON : TJSONObject);
     Procedure SaveToJSON(JSON : TJSONObject; All : Boolean);
     Procedure SaveToJSON(JSON : TJSONObject; All : Boolean);
     // Base64url conversion functions (RFC7515)
     // Base64url conversion functions (RFC7515)
-    class function Base64ToBase64URL(AValue: string): string; deprecated 'Use basenenc functions instead';
-    class function Base64URLToBase64(AValue: string): string; deprecated 'Use basenenc functions instead';
+    class function Base64ToBase64URL(Const AValue: string): string; deprecated 'Use basenenc functions instead';
+    class function Base64URLToBase64(Const AValue: string): string; deprecated 'Use basenenc functions instead';
     // Decode Base64url string.
     // Decode Base64url string.
-    Class Function DecodeString(S : String) : String;
+    Class Function DecodeString(const S : String) : String;
     // Decode Base64url string and return a JSON Object.
     // Decode Base64url string and return a JSON Object.
-    Class Function DecodeStringToJSON(S : String) : TJSONObject;
+    Class Function DecodeStringToJSON(const S : String) : TJSONObject;
     // Get/Set as string. This is normally the JSON form.
     // Get/Set as string. This is normally the JSON form.
     Property AsString : TJSONStringType Read GetAsString Write SetAsString;
     Property AsString : TJSONStringType Read GetAsString Write SetAsString;
     // Set as string. This is normally the JSON form, encoded as Base64.
     // Set as string. This is normally the JSON form, encoded as Base64.
@@ -147,9 +147,9 @@ Type
     Function CreateClaims : TClaims; Virtual;
     Function CreateClaims : TClaims; Virtual;
     // AsString and AsEncodedString are the same in this case.
     // AsString and AsEncodedString are the same in this case.
     function GetAsString: TJSONStringType; override;
     function GetAsString: TJSONStringType; override;
-    procedure SetAsString(AValue: TJSONStringType);override;
+    procedure SetAsString(const AValue: TJSONStringType);override;
     function GetAsEncodedString: String;override;
     function GetAsEncodedString: String;override;
-    Procedure SetAsEncodedString (AValue : String);override;
+    Procedure SetAsEncodedString (const AValue : String);override;
   Public
   Public
     Constructor Create; override;
     Constructor Create; override;
     Destructor Destroy; override;
     Destructor Destroy; override;
@@ -176,7 +176,7 @@ Type
     class Destructor done;
     class Destructor done;
     Class function AlgorithmName : String; virtual; abstract;
     Class function AlgorithmName : String; virtual; abstract;
     Class Function GetParts(const aJWT : String; out aJOSE,aClaims,aSign : String) : Boolean;
     Class Function GetParts(const aJWT : String; out aJOSE,aClaims,aSign : String) : Boolean;
-    Class Function CreateSigner(aAlgorithm : String): TJWTSigner;
+    Class Function CreateSigner(const aAlgorithm : String): TJWTSigner;
     Constructor Create; virtual;
     Constructor Create; virtual;
     Function CreateSignature(aJWT : TJWT; aKey : TJWTKey) : String; virtual; abstract;
     Function CreateSignature(aJWT : TJWT; aKey : TJWTKey) : String; virtual; abstract;
     Function Verify(const aJWT : String; aKey : TJWTKey) : Boolean; virtual; abstract;
     Function Verify(const aJWT : String; aKey : TJWTKey) : Boolean; virtual; abstract;
@@ -351,7 +351,7 @@ begin
   Result:=(aJOSE<>'') and (aClaims<>'');
   Result:=(aJOSE<>'') and (aClaims<>'');
 end;
 end;
 
 
-class function TJWTSigner.CreateSigner(aAlgorithm: String): TJWTSigner;
+class function TJWTSigner.CreateSigner(const aAlgorithm: String): TJWTSigner;
 
 
 Var
 Var
   Idx : Integer;
   Idx : Integer;
@@ -462,7 +462,7 @@ begin
   Result:=GetAsString;
   Result:=GetAsString;
 end;
 end;
 
 
-procedure TJWT.SetAsEncodedString(AValue: String);
+procedure TJWT.SetAsEncodedString(const AValue: String);
 begin
 begin
   SetAsString(AValue);
   SetAsString(AValue);
 end;
 end;
@@ -504,7 +504,7 @@ begin
   Result:=TJWTSigner.ParseAndVerify(aJWT,aKey,aClass);
   Result:=TJWTSigner.ParseAndVerify(aJWT,aKey,aClass);
 end;
 end;
 
 
-procedure TJWT.SetAsString(AValue: TJSONStringType);
+procedure TJWT.SetAsString(const AValue: TJSONStringType);
 
 
 Var
 Var
   J,C,S : String;
   J,C,S : String;
@@ -525,7 +525,7 @@ begin
   Result:=Base64URL.Encode(AsString,False);
   Result:=Base64URL.Encode(AsString,False);
 end;
 end;
 
 
-procedure TBaseJWT.SetAsEncodedString(AValue: String);
+procedure TBaseJWT.SetAsEncodedString(const AValue: String);
 begin
 begin
   AsString:=DecodeString(AValue);
   AsString:=DecodeString(AValue);
 end;
 end;
@@ -545,7 +545,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-procedure TBaseJWT.SetAsString(AValue: TJSONStringType);
+procedure TBaseJWT.SetAsString(const AValue: TJSONStringType);
 Var
 Var
   D : TJSONData;
   D : TJSONData;
   O : TJSONObject absolute D;
   O : TJSONObject absolute D;
@@ -700,13 +700,13 @@ begin
   DoSaveToJSon(JSON,All);
   DoSaveToJSon(JSON,All);
 end;
 end;
 
 
-class function TBaseJWT.Base64ToBase64URL(AValue: string): string;
+class function TBaseJWT.Base64ToBase64URL(const AValue: string): string;
 begin
 begin
   Result := StringsReplace(AValue, ['+', '/'], ['-', '_'], [rfReplaceAll]);
   Result := StringsReplace(AValue, ['+', '/'], ['-', '_'], [rfReplaceAll]);
   Result := TrimRightSet(Result, ['=']);
   Result := TrimRightSet(Result, ['=']);
 end;
 end;
 
 
-class function TBaseJWT.Base64URLToBase64(AValue: string): string;
+class function TBaseJWT.Base64URLToBase64(const AValue: string): string;
 var
 var
   l: integer;
   l: integer;
 begin
 begin
@@ -716,12 +716,12 @@ begin
     Result:=Result+StringOfChar('=',4-l);
     Result:=Result+StringOfChar('=',4-l);
 end;
 end;
 
 
-class function TBaseJWT.DecodeString(S: String): String;
+class function TBaseJWT.DecodeString(const S: String): String;
 begin
 begin
   Result:=TEncoding.UTF8.GetAnsiString(Base64URL.Decode(S));
   Result:=TEncoding.UTF8.GetAnsiString(Base64URL.Decode(S));
 end;
 end;
 
 
-class function TBaseJWT.DecodeStringToJSON(S: String): TJSONObject;
+class function TBaseJWT.DecodeStringToJSON(const S: String): TJSONObject;
 
 
 Var
 Var
   D : TJSONData;
   D : TJSONData;

+ 2 - 2
packages/fcl-web/src/jwt/fpoauth2.pp

@@ -183,7 +183,7 @@ Type
     procedure SetSession(AValue: TOAuth2Session);
     procedure SetSession(AValue: TOAuth2Session);
     procedure SetStore(AValue: TAbstracTOAuth2ConfigStore);
     procedure SetStore(AValue: TAbstracTOAuth2ConfigStore);
   Protected
   Protected
-    function CheckHostedDomain(URL: String): String; virtual;
+    function CheckHostedDomain(const URL: String): String; virtual;
     Function RefreshToken: Boolean; virtual;
     Function RefreshToken: Boolean; virtual;
     Function CreateOauth2Config : TOAuth2Config; virtual;
     Function CreateOauth2Config : TOAuth2Config; virtual;
     Function CreateOauth2Session : TOAuth2Session; virtual;
     Function CreateOauth2Session : TOAuth2Session; virtual;
@@ -357,7 +357,7 @@ begin
     end;
     end;
 end;
 end;
 
 
-function TOAuth2Handler.CheckHostedDomain(URL : String): String;
+function TOAuth2Handler.CheckHostedDomain(const URL : String): String;
 
 
 Var
 Var
   HD : String;
   HD : String;

+ 2 - 1
packages/fcl-web/src/jwt/fpoauth2ini.pp

@@ -93,7 +93,7 @@ Const
 
 
 { TFPOAuth2IniStore }
 { TFPOAuth2IniStore }
 
 
-Procedure Touch(FN : String);
+Procedure Touch(const FN : String);
 
 
 begin
 begin
 //  FileClose(FileCreate('/tmp/logs/'+fn));
 //  FileClose(FileCreate('/tmp/logs/'+fn));
@@ -261,6 +261,7 @@ procedure TFPOAuth2IniStore.SetSessionSectionUser(AUser : String);
 begin
 begin
   If (UserSessionSection='') then
   If (UserSessionSection='') then
     begin
     begin
+    
     if (AUser='') then
     if (AUser='') then
        AUser:='anonymous';
        AUser:='anonymous';
     UserSessionSection:='session_'+AUser;
     UserSessionSection:='session_'+AUser;

+ 6 - 6
packages/fcl-web/src/restbridge/sqldbrestauthini.pp

@@ -34,13 +34,13 @@ Type
     Procedure ClearValues;
     Procedure ClearValues;
   Public
   Public
     Procedure LoadFromIni(Const aIni: TCustomIniFile; aOptions : TBasicAuthIniOptions = []); overload;
     Procedure LoadFromIni(Const aIni: TCustomIniFile; aOptions : TBasicAuthIniOptions = []); overload;
-    Procedure LoadFromIni(Const aIni: TCustomIniFile; ASection : String; aOptions : TBasicAuthIniOptions); overload;
+    Procedure LoadFromIni(Const aIni: TCustomIniFile; const ASection : String; aOptions : TBasicAuthIniOptions); overload;
     Procedure LoadFromFile(Const aFileName : String; aOptions : TBasicAuthIniOptions = []); overload;
     Procedure LoadFromFile(Const aFileName : String; aOptions : TBasicAuthIniOptions = []); overload;
     Procedure LoadFromFile(Const aFileName : String; Const ASection : String; aOptions : TBasicAuthIniOptions); overload;
     Procedure LoadFromFile(Const aFileName : String; Const ASection : String; aOptions : TBasicAuthIniOptions); overload;
     Procedure SaveToFile(Const aFileName : String; aOptions : TBasicAuthIniOptions = []);overload;
     Procedure SaveToFile(Const aFileName : String; aOptions : TBasicAuthIniOptions = []);overload;
     Procedure SaveToFile(Const aFileName : String; Const ASection : String; aOptions : TBasicAuthIniOptions = []);overload;
     Procedure SaveToFile(Const aFileName : String; Const ASection : String; aOptions : TBasicAuthIniOptions = []);overload;
     Procedure SaveToIni(Const aIni: TCustomIniFile; aOptions : TBasicAuthIniOptions = []); overload;
     Procedure SaveToIni(Const aIni: TCustomIniFile; aOptions : TBasicAuthIniOptions = []); overload;
-    Procedure SaveToIni(Const aIni: TCustomIniFile; ASection : String; aOptions : TBasicAuthIniOptions); overload;
+    Procedure SaveToIni(Const aIni: TCustomIniFile; const ASection : String; aOptions : TBasicAuthIniOptions); overload;
   end;
   end;
 
 
 Var
 Var
@@ -48,7 +48,7 @@ Var
   TrivialEncryptKey : String = 'SQLDBAuth';
   TrivialEncryptKey : String = 'SQLDBAuth';
 
 
 Function BasicAuthIniOptionsToStr(Options: TBasicAuthIniOptions): String;
 Function BasicAuthIniOptionsToStr(Options: TBasicAuthIniOptions): String;
-Function StrToBasicAuthIniOptions(S : String) : TBasicAuthIniOptions;
+Function StrToBasicAuthIniOptions(const S : String) : TBasicAuthIniOptions;
 
 
 implementation
 implementation
 
 
@@ -60,7 +60,7 @@ begin
   Result:=SetToString(PTypeInfo(TypeInfo(TBasicAuthIniOptions)),Integer(Options),false);
   Result:=SetToString(PTypeInfo(TypeInfo(TBasicAuthIniOptions)),Integer(Options),false);
 end;
 end;
 
 
-Function StrToBasicAuthIniOptions(S : String) : TBasicAuthIniOptions;
+Function StrToBasicAuthIniOptions(const S : String) : TBasicAuthIniOptions;
 
 
 var
 var
   i : integer;
   i : integer;
@@ -90,7 +90,7 @@ begin
   AuthenticationRealm:='';
   AuthenticationRealm:='';
 end;
 end;
 
 
-procedure TSQLDBRestBasicAuthHelper.LoadFromIni(const aIni: TCustomIniFile; ASection: String; aOptions: TBasicAuthIniOptions);
+procedure TSQLDBRestBasicAuthHelper.LoadFromIni(const aIni: TCustomIniFile; const ASection: String; aOptions: TBasicAuthIniOptions);
 
 
 Var
 Var
   M,P : String;
   M,P : String;
@@ -177,7 +177,7 @@ begin
   SaveToIni(aIni,DefaultBasicAuthSection,aOptions);
   SaveToIni(aIni,DefaultBasicAuthSection,aOptions);
 end;
 end;
 
 
-procedure TSQLDBRestBasicAuthHelper.SaveToIni(const aIni: TCustomIniFile; ASection: String; aOptions: TBasicAuthIniOptions);
+procedure TSQLDBRestBasicAuthHelper.SaveToIni(const aIni: TCustomIniFile; const ASection: String; aOptions: TBasicAuthIniOptions);
 
 
 Var
 Var
   M,P : String;
   M,P : String;

+ 6 - 6
packages/fcl-web/src/restbridge/sqldbrestbridge.pp

@@ -135,9 +135,9 @@ Type
     procedure SetSchema(aIndex : Integer; AValue: TSQLDBRestSchemaRef);
     procedure SetSchema(aIndex : Integer; AValue: TSQLDBRestSchemaRef);
   Public
   Public
     Function AddSchema (aSchema : TSQLDBRestSchema) : TSQLDBRestSchemaRef;
     Function AddSchema (aSchema : TSQLDBRestSchema) : TSQLDBRestSchemaRef;
-    Function IndexOfSchema(aSchemaName : String) : Integer;
-    Function FindSchemaRef(aSchemaName : String) : TSQLDBRestSchemaRef;
-    Function FindSchema(aSchemaName : String) : TSQLDBRestSchema;
+    Function IndexOfSchema(const aSchemaName : String) : Integer;
+    Function FindSchemaRef(const aSchemaName : String) : TSQLDBRestSchemaRef;
+    Function FindSchema(const aSchemaName : String) : TSQLDBRestSchema;
     Property Schemas[aIndex :Integer] : TSQLDBRestSchemaRef Read GetSchema Write SetSchema;default;
     Property Schemas[aIndex :Integer] : TSQLDBRestSchemaRef Read GetSchema Write SetSchema;default;
   end;
   end;
 
 
@@ -460,14 +460,14 @@ begin
   Result.Enabled:=True;
   Result.Enabled:=True;
 end;
 end;
 
 
-function TSQLDBRestSchemaList.IndexOfSchema(aSchemaName: String): Integer;
+function TSQLDBRestSchemaList.IndexOfSchema(const aSchemaName: String): Integer;
 begin
 begin
   Result:=Count-1;
   Result:=Count-1;
   While (Result>=0) and Not (Assigned(GetSchema(Result).Schema) and SameText(GetSchema(Result).Schema.Name,aSchemaName)) do
   While (Result>=0) and Not (Assigned(GetSchema(Result).Schema) and SameText(GetSchema(Result).Schema.Name,aSchemaName)) do
     Dec(Result);
     Dec(Result);
 end;
 end;
 
 
-function TSQLDBRestSchemaList.FindSchemaRef(aSchemaName: String): TSQLDBRestSchemaRef;
+function TSQLDBRestSchemaList.FindSchemaRef(const aSchemaName: String): TSQLDBRestSchemaRef;
 
 
 Var
 Var
   Idx : integer;
   Idx : integer;
@@ -480,7 +480,7 @@ begin
     Result:=Schemas[Idx];
     Result:=Schemas[Idx];
 end;
 end;
 
 
-function TSQLDBRestSchemaList.FindSchema(aSchemaName: String): TSQLDBRestSchema;
+function TSQLDBRestSchemaList.FindSchema(Const aSchemaName: String): TSQLDBRestSchema;
 
 
 Var
 Var
   Ref : TSQLDBRestSchemaRef;
   Ref : TSQLDBRestSchemaRef;

+ 3 - 3
packages/fcl-web/src/restbridge/sqldbrestdata.pp

@@ -76,7 +76,7 @@ Type
     function GetSpecialDatasetForResource(aFieldList: TRestFieldPairArray): TDataset; virtual;
     function GetSpecialDatasetForResource(aFieldList: TRestFieldPairArray): TDataset; virtual;
     function FindFieldForParam(aOperation: TRestOperation; P: TParam): TSQLDBRestField; virtual;
     function FindFieldForParam(aOperation: TRestOperation; P: TParam): TSQLDBRestField; virtual;
     function BuildFieldList(ForceAll : Boolean): TRestFieldPairArray; virtual;
     function BuildFieldList(ForceAll : Boolean): TRestFieldPairArray; virtual;
-    function CreateQuery(aSQL: String): TSQLQuery; virtual;
+    function CreateQuery(const aSQL: String): TSQLQuery; virtual;
     function GetDatasetForResource(aFieldList: TRestFieldPairArray; Singleton : Boolean): TDataset; virtual;
     function GetDatasetForResource(aFieldList: TRestFieldPairArray; Singleton : Boolean): TDataset; virtual;
     function GetOrderByFieldArray: TRestFieldOrderPairArray;
     function GetOrderByFieldArray: TRestFieldOrderPairArray;
     function GetOrderBy: UTF8String;virtual;
     function GetOrderBy: UTF8String;virtual;
@@ -308,7 +308,7 @@ begin
     end;
     end;
 end;
 end;
 
 
-function TSQLDBRestDBHandler.CreateQuery(aSQL: String): TSQLQuery;
+function TSQLDBRestDBHandler.CreateQuery(const aSQL: String): TSQLQuery;
 
 
 begin
 begin
   Result:=FQueryClass.Create(Self);
   Result:=FQueryClass.Create(Self);
@@ -325,7 +325,7 @@ Var
   aCount : Integer;
   aCount : Integer;
   Fi,Fe : TStrings;
   Fi,Fe : TStrings;
 
 
-  Function ML(N : String) : TStrings;
+  Function ML(const N : String) : TStrings;
   Var
   Var
     V : UTF8String;
     V : UTF8String;
   begin
   begin

+ 27 - 28
packages/fcl-web/src/restbridge/sqldbrestini.pp

@@ -35,15 +35,14 @@ Type
     Procedure ClearValues;
     Procedure ClearValues;
   Public
   Public
     Procedure LoadFromIni(Const aIni: TCustomIniFile; aOptions : TConnectionIniOptions = []); overload;
     Procedure LoadFromIni(Const aIni: TCustomIniFile; aOptions : TConnectionIniOptions = []); overload;
-    Procedure LoadFromIni(Const aIni: TCustomIniFile; ASection : String; aOptions : TConnectionIniOptions); overload;
+    Procedure LoadFromIni(Const aIni: TCustomIniFile; const ASection : String; aOptions : TConnectionIniOptions); overload;
     Procedure LoadFromIniFile(Const aFileName : String; aOptions : TConnectionIniOptions = []); overload;
     Procedure LoadFromIniFile(Const aFileName : String; aOptions : TConnectionIniOptions = []); overload;
     Procedure LoadFromIniFile(Const aFileName : String; Const ASection : String; aOptions : TConnectionIniOptions); overload;
     Procedure LoadFromIniFile(Const aFileName : String; Const ASection : String; aOptions : TConnectionIniOptions); overload;
     Procedure SaveToIniFile(Const aFileName : String; aOptions : TConnectionIniOptions = []);overload;
     Procedure SaveToIniFile(Const aFileName : String; aOptions : TConnectionIniOptions = []);overload;
     Procedure SaveToIniFile(Const aFileName : String; Const ASection : String; aOptions : TConnectionIniOptions = []);overload;
     Procedure SaveToIniFile(Const aFileName : String; Const ASection : String; aOptions : TConnectionIniOptions = []);overload;
     Procedure SaveToIni(Const aIni: TCustomIniFile; aOptions : TConnectionIniOptions = []); overload;
     Procedure SaveToIni(Const aIni: TCustomIniFile; aOptions : TConnectionIniOptions = []); overload;
-    Procedure SaveToIni(Const aIni: TCustomIniFile; ASection : String; aOptions : TConnectionIniOptions); overload;
+    Procedure SaveToIni(Const aIni: TCustomIniFile; const ASection : String; aOptions : TConnectionIniOptions); overload;
   end;
   end;
-
   TDispatcherIniOption = (dioSkipReadConnections,   // Do not Read connection definitions
   TDispatcherIniOption = (dioSkipReadConnections,   // Do not Read connection definitions
                           dioSkipExposeConnections, // Do not Expose connections defined in .ini file
                           dioSkipExposeConnections, // Do not Expose connections defined in .ini file
                           dioSkipReadSchemas,       // Do not Read schema definitions
                           dioSkipReadSchemas,       // Do not Read schema definitions
@@ -60,18 +59,18 @@ Type
   TSQLDBRestDispatcherHelper = class helper for TSQLDBRestDispatcher
   TSQLDBRestDispatcherHelper = class helper for TSQLDBRestDispatcher
   private
   private
   Public
   Public
-    procedure ReadSchemas(const aIni: TCustomIniFile; ASection: String; aOptions: TDispatcherIniOptions);
-    procedure ReadConnections(const aIni: TCustomIniFile; ASection: String);
-    procedure WriteConnections(const aIni: TCustomIniFile; ASection: String; aOptions : TConnectionIniOptions);
-    procedure WriteSchemas(const aIni: TCustomIniFile; ASection: String; SchemaFileDir : String);
+    procedure ReadSchemas(const aIni: TCustomIniFile; const ASection: String; aOptions: TDispatcherIniOptions);
+    procedure ReadConnections(const aIni: TCustomIniFile; const ASection: String);
+    procedure WriteConnections(const aIni: TCustomIniFile; const ASection: String; aOptions : TConnectionIniOptions);
+    procedure WriteSchemas(const aIni: TCustomIniFile; const ASection: String; const SchemaFileDir : String);
     Procedure LoadFromIni(Const aIni: TCustomIniFile; aOptions : TDispatcherIniOptions = []); overload;
     Procedure LoadFromIni(Const aIni: TCustomIniFile; aOptions : TDispatcherIniOptions = []); overload;
-    Procedure LoadFromIni(Const aIni: TCustomIniFile; ASection : String; aOptions : TDispatcherIniOptions); overload;
+    Procedure LoadFromIni(Const aIni: TCustomIniFile; const ASection : String; aOptions : TDispatcherIniOptions); overload;
     Procedure LoadFromFile(Const aFileName : String; aOptions : TDispatcherIniOptions = []); overload;
     Procedure LoadFromFile(Const aFileName : String; aOptions : TDispatcherIniOptions = []); overload;
     Procedure LoadFromFile(Const aFileName : String; Const ASection : String; aOptions : TDispatcherIniOptions); overload;
     Procedure LoadFromFile(Const aFileName : String; Const ASection : String; aOptions : TDispatcherIniOptions); overload;
     Procedure SaveToFile(Const aFileName : String; aOptions : TDispatcherIniOptions = []);overload;
     Procedure SaveToFile(Const aFileName : String; aOptions : TDispatcherIniOptions = []);overload;
     Procedure SaveToFile(Const aFileName : String; Const ASection : String; aOptions : TDispatcherIniOptions = []);overload;
     Procedure SaveToFile(Const aFileName : String; Const ASection : String; aOptions : TDispatcherIniOptions = []);overload;
     Procedure SaveToIni(Const aIni: TCustomIniFile; aOptions : TDispatcherIniOptions = []); overload;
     Procedure SaveToIni(Const aIni: TCustomIniFile; aOptions : TDispatcherIniOptions = []); overload;
-    Procedure SaveToIni(Const aIni: TCustomIniFile; ASection : String; aOptions : TDispatcherIniOptions); overload;
+    Procedure SaveToIni(Const aIni: TCustomIniFile; const ASection : String; aOptions : TDispatcherIniOptions); overload;
   end;
   end;
 
 
   { TRestStringsConfigHelper }
   { TRestStringsConfigHelper }
@@ -79,19 +78,19 @@ Type
   TRestStringsConfigHelper = class helper for TRestStringsConfig
   TRestStringsConfigHelper = class helper for TRestStringsConfig
   Public
   Public
     Procedure LoadFromIni(Const aIni: TCustomIniFile); overload;
     Procedure LoadFromIni(Const aIni: TCustomIniFile); overload;
-    Procedure LoadFromIni(Const aIni: TCustomIniFile; ASection : String); overload;
+    Procedure LoadFromIni(Const aIni: TCustomIniFile; const ASection : String); overload;
     Procedure LoadFromFile(Const aFileName : String); overload;
     Procedure LoadFromFile(Const aFileName : String); overload;
     Procedure LoadFromFile(Const aFileName : String; Const ASection : String); overload;
     Procedure LoadFromFile(Const aFileName : String; Const ASection : String); overload;
     Procedure SaveToFile(Const aFileName : String);overload;
     Procedure SaveToFile(Const aFileName : String);overload;
     Procedure SaveToFile(Const aFileName : String; Const ASection : String);overload;
     Procedure SaveToFile(Const aFileName : String; Const ASection : String);overload;
     Procedure SaveToIni(Const aIni: TCustomIniFile); overload;
     Procedure SaveToIni(Const aIni: TCustomIniFile); overload;
-    Procedure SaveToIni(Const aIni: TCustomIniFile; ASection : String); overload;
+    Procedure SaveToIni(Const aIni: TCustomIniFile; const ASection : String); overload;
   end;
   end;
 
 
 
 
-Function StrToOutputOptions(S : String) : TRestOutputOptions;
-Function StrToDispatcherOptions(S : String) : TRestDispatcherOptions;
-Function StrToConnectionIniOptions(S : String) : TConnectionIniOptions;
+Function StrToOutputOptions(const S : String) : TRestOutputOptions;
+Function StrToDispatcherOptions(const S : String) : TRestDispatcherOptions;
+Function StrToConnectionIniOptions(const S : String) : TConnectionIniOptions;
 Function OutputOptionsToStr(Options : TRestOutputOptions): String;
 Function OutputOptionsToStr(Options : TRestOutputOptions): String;
 Function DispatcherOptionsToStr(Options: TRestDispatcherOptions) : String;
 Function DispatcherOptionsToStr(Options: TRestDispatcherOptions) : String;
 Function ConnectionIniOptionsToStr(Options: TConnectionIniOptions): String;
 Function ConnectionIniOptionsToStr(Options: TConnectionIniOptions): String;
@@ -130,7 +129,7 @@ Const
   KeyEnabled = 'Enabled';
   KeyEnabled = 'Enabled';
   KeyBasicAuth = 'BasicAuth';
   KeyBasicAuth = 'BasicAuth';
 
 
-Function StrToOutputOptions(S : String) : TRestOutputOptions;
+Function StrToOutputOptions(const S : String) : TRestOutputOptions;
 
 
 var
 var
   i : integer;
   i : integer;
@@ -140,7 +139,7 @@ begin
   Result:=TRestOutputOptions(I);
   Result:=TRestOutputOptions(I);
 end;
 end;
 
 
-Function StrToDispatcherOptions(S : String) : TRestDispatcherOptions;
+Function StrToDispatcherOptions(Const S : String) : TRestDispatcherOptions;
 
 
 var
 var
   i : integer;
   i : integer;
@@ -150,7 +149,7 @@ begin
   Result:=TRestDispatcherOptions(I);
   Result:=TRestDispatcherOptions(I);
 end;
 end;
 
 
-Function StrToConnectionIniOptions(S : String) : TConnectionIniOptions;
+Function StrToConnectionIniOptions(const S : String) : TConnectionIniOptions;
 
 
 var
 var
   i : integer;
   i : integer;
@@ -160,7 +159,7 @@ begin
   Result:=TConnectionIniOptions(I);
   Result:=TConnectionIniOptions(I);
 end;
 end;
 
 
-Function StrToRestFieldOptions(S : String) : TRestFieldOptions;
+Function StrToRestFieldOptions(const S : String) : TRestFieldOptions;
 
 
 var
 var
   i : integer;
   i : integer;
@@ -195,7 +194,7 @@ begin
   LoadFromIni(aIni,DefaultStringsConfigSection);
   LoadFromIni(aIni,DefaultStringsConfigSection);
 end;
 end;
 
 
-procedure TRestStringsConfigHelper.LoadFromIni(const aIni: TCustomIniFile; ASection: String);
+procedure TRestStringsConfigHelper.LoadFromIni(const aIni: TCustomIniFile; const ASection: String);
 
 
 Var
 Var
   T : TRestStringProperty;
   T : TRestStringProperty;
@@ -254,7 +253,7 @@ begin
   SaveToini(aIni,DefaultStringsConfigSection);
   SaveToini(aIni,DefaultStringsConfigSection);
 end;
 end;
 
 
-procedure TRestStringsConfigHelper.SaveToIni(const aIni: TCustomIniFile; ASection: String);
+procedure TRestStringsConfigHelper.SaveToIni(const aIni: TCustomIniFile; const ASection: String);
 Var
 Var
   T : TRestStringProperty;
   T : TRestStringProperty;
   N : String;
   N : String;
@@ -277,7 +276,7 @@ begin
   LoadFromIni(aIni,DefaultDispatcherSection,aOptions);
   LoadFromIni(aIni,DefaultDispatcherSection,aOptions);
 end;
 end;
 
 
-procedure TSQLDBRestDispatcherHelper.ReadConnections(const aIni: TCustomIniFile; ASection: String);
+procedure TSQLDBRestDispatcherHelper.ReadConnections(const aIni: TCustomIniFile; const ASection: String);
 
 
 Var
 Var
   S,L : String;
   S,L : String;
@@ -297,7 +296,7 @@ begin
     end;
     end;
 end;
 end;
 
 
-procedure TSQLDBRestDispatcherHelper.WriteConnections(const aIni: TCustomIniFile; ASection: String; aOptions: TConnectionIniOptions);
+procedure TSQLDBRestDispatcherHelper.WriteConnections(const aIni: TCustomIniFile; const ASection: String; aOptions: TConnectionIniOptions);
 
 
 Var
 Var
   S,L : String;
   S,L : String;
@@ -321,7 +320,7 @@ begin
     end;
     end;
 end;
 end;
 
 
-procedure TSQLDBRestDispatcherHelper.WriteSchemas(const aIni: TCustomIniFile; ASection: String; SchemaFileDir : String);
+procedure TSQLDBRestDispatcherHelper.WriteSchemas(const aIni: TCustomIniFile; Const ASection: String; Const SchemaFileDir : String);
 
 
 Var
 Var
   S,L,FN : String;
   S,L,FN : String;
@@ -356,7 +355,7 @@ begin
     end;
     end;
 end;
 end;
 
 
-procedure TSQLDBRestDispatcherHelper.ReadSchemas(const aIni: TCustomIniFile; ASection: String; aOptions: TDispatcherIniOptions);
+procedure TSQLDBRestDispatcherHelper.ReadSchemas(const aIni: TCustomIniFile; const ASection: String; aOptions: TDispatcherIniOptions);
 
 
 Var
 Var
   S,L,FN : String;
   S,L,FN : String;
@@ -383,7 +382,7 @@ begin
     end;
     end;
 end;
 end;
 
 
-procedure TSQLDBRestDispatcherHelper.LoadFromIni(const aIni: TCustomIniFile; ASection: String; aOptions: TDispatcherIniOptions);
+procedure TSQLDBRestDispatcherHelper.LoadFromIni(const aIni: TCustomIniFile; const ASection: String; aOptions: TDispatcherIniOptions);
 
 
 Var
 Var
   I : Integer;
   I : Integer;
@@ -470,7 +469,7 @@ begin
   SaveToIni(aIni,DefaultDispatcherSection,aOptions);
   SaveToIni(aIni,DefaultDispatcherSection,aOptions);
 end;
 end;
 
 
-procedure TSQLDBRestDispatcherHelper.SaveToIni(const aIni: TCustomIniFile; ASection: String; aOptions: TDispatcherIniOptions);
+procedure TSQLDBRestDispatcherHelper.SaveToIni(const aIni: TCustomIniFile; const ASection: String; aOptions: TDispatcherIniOptions);
 
 
 Var
 Var
   BAN : String;
   BAN : String;
@@ -519,7 +518,7 @@ Const
                      = (keyHost,KeyDatabaseName,KeyUserName,KeyPassword,KeyPort,keyParams,keyCharSet,keyRole);
                      = (keyHost,KeyDatabaseName,KeyUserName,KeyPassword,KeyPort,keyParams,keyCharSet,keyRole);
   ParamSeps = [',',';',' '];
   ParamSeps = [',',';',' '];
 
 
-procedure TSQLDBRestConnectionHelper.LoadFromIni(const aIni: TCustomIniFile; ASection: String; aOptions: TConnectionIniOptions);
+procedure TSQLDBRestConnectionHelper.LoadFromIni(const aIni: TCustomIniFile; const ASection: String; aOptions: TConnectionIniOptions);
 
 
 Var
 Var
   M,N,P : String;
   M,N,P : String;
@@ -623,7 +622,7 @@ begin
   SaveToIni(aIni,DefaultConnectionSection,aOptions);
   SaveToIni(aIni,DefaultConnectionSection,aOptions);
 end;
 end;
 
 
-procedure TSQLDBRestConnectionHelper.SaveToIni(const aIni: TCustomIniFile; ASection: String; aOptions: TConnectionIniOptions);
+procedure TSQLDBRestConnectionHelper.SaveToIni(const aIni: TCustomIniFile; const ASection: String; aOptions: TConnectionIniOptions);
 Var
 Var
   M,N,P : String;
   M,N,P : String;
   I : integer;
   I : integer;

+ 17 - 15
packages/fcl-web/src/restbridge/sqldbrestio.pp

@@ -282,7 +282,7 @@ Type
   Protected
   Protected
     function GetConnection: TSQLConnection; override;
     function GetConnection: TSQLConnection; override;
     function GetTransaction: TSQLTransaction; override;
     function GetTransaction: TSQLTransaction; override;
-    Function DoGetInputData(aName : UTF8string) : TJSONData; override;
+    Function DoGetInputData(const aName : UTF8string) : TJSONData; override;
     Function GetUpdateData : TDataset; override;
     Function GetUpdateData : TDataset; override;
     property IO : TRestIO Read FIO;
     property IO : TRestIO Read FIO;
   Public
   Public
@@ -312,7 +312,7 @@ Type
     FUpdatedData: TBufDataset;
     FUpdatedData: TBufDataset;
     function GetResourceName: UTF8String;
     function GetResourceName: UTF8String;
     function GetUserID: String;
     function GetUserID: String;
-    procedure SetUserID(AValue: String);
+    procedure SetUserID(const AValue: String);
   Protected
   Protected
   Public
   Public
     Constructor Create(aRequest : TRequest; aResponse : TResponse); virtual;
     Constructor Create(aRequest : TRequest; aResponse : TResponse); virtual;
@@ -327,7 +327,7 @@ Type
     Procedure SetRestStrings(aValue : TRestStringsConfig);
     Procedure SetRestStrings(aValue : TRestStringsConfig);
     Procedure SetRestStatuses(aValue : TRestStatusConfig);
     Procedure SetRestStatuses(aValue : TRestStatusConfig);
     // Get things
     // Get things
-    class function StrToNullBoolean(S: String; Strict: Boolean): TNullBoolean;
+    class function StrToNullBoolean(const S: String; Strict: Boolean): TNullBoolean;
     Procedure DoGetVariable(Sender : TObject; Const aName : UTF8String; Out aVal : UTF8String);
     Procedure DoGetVariable(Sender : TObject; Const aName : UTF8String; Out aVal : UTF8String);
     Function GetVariable (Const aName : UTF8String; Out aVal : UTF8String; AllowedSources : TVAriableSources = AllVariableSources) : TVariableSource; virtual;
     Function GetVariable (Const aName : UTF8String; Out aVal : UTF8String; AllowedSources : TVAriableSources = AllVariableSources) : TVariableSource; virtual;
     function GetFilterVariable(const aName: UTF8String; AFilter: TRestFieldFilter; out aValue: UTF8String): TVariableSource;
     function GetFilterVariable(const aName: UTF8String; AFilter: TRestFieldFilter; out aValue: UTF8String): TVariableSource;
@@ -395,8 +395,8 @@ Type
   Private
   Private
     FDefs : Array[TRestStreamerType] of TStreamerDefList;
     FDefs : Array[TRestStreamerType] of TStreamerDefList;
   Protected
   Protected
-    Function FindDefByName(aType : TRestStreamerType; aName : String) : TStreamerDef;
-    Function FindDefByContentType(aType : TRestStreamerType; aContentType : String) : TStreamerDef;
+    Function FindDefByName(aType : TRestStreamerType; const aName : String) : TStreamerDef;
+    Function FindDefByContentType(aType : TRestStreamerType; const aContentType : String) : TStreamerDef;
     Function IndexOfStreamer(aType : TRestStreamerType; const aName : string) : Integer;
     Function IndexOfStreamer(aType : TRestStreamerType; const aName : string) : Integer;
     Function IndexOfStreamerContentType(aType : TRestStreamerType; const aContentType : string) : Integer;
     Function IndexOfStreamerContentType(aType : TRestStreamerType; const aContentType : string) : Integer;
     Procedure RegisterStreamer(aType : TRestStreamerType; Const aName : String; aClass : TRestStreamerClass);
     Procedure RegisterStreamer(aType : TRestStreamerType; Const aName : String; aClass : TRestStreamerClass);
@@ -576,7 +576,7 @@ begin
   Result:=IO.Transaction;
   Result:=IO.Transaction;
 end;
 end;
 
 
-function TRestContext.DoGetInputData(aName: UTF8string): TJSONData;
+function TRestContext.DoGetInputData(const aName: UTF8string): TJSONData;
 begin
 begin
   Result:=IO.RESTInput.GetContentField(aName);
   Result:=IO.RESTInput.GetContentField(aName);
 end;
 end;
@@ -610,7 +610,7 @@ end;
 
 
 { TStreamerFactory }
 { TStreamerFactory }
 
 
-function TStreamerFactory.FindDefByName(aType : TRestStreamerType; aName: String): TStreamerDef;
+function TStreamerFactory.FindDefByName(aType : TRestStreamerType; const aName: String): TStreamerDef;
 
 
 Var
 Var
   Idx : integer;
   Idx : integer;
@@ -623,7 +623,7 @@ begin
     Result:=FDefs[aType][Idx];
     Result:=FDefs[aType][Idx];
 end;
 end;
 
 
-function TStreamerFactory.FindDefByContentType(aType : TRestStreamerType;  aContentType: String): TStreamerDef;
+function TStreamerFactory.FindDefByContentType(aType : TRestStreamerType; Const aContentType: String): TStreamerDef;
 Var
 Var
   Idx : integer;
   Idx : integer;
 
 
@@ -977,7 +977,7 @@ begin
   GetVariable(aName,aVal);
   GetVariable(aName,aVal);
 end;
 end;
 
 
-procedure TRestIO.SetUserID(AValue: String);
+procedure TRestIO.SetUserID(const AValue: String);
 begin
 begin
   if (UserID=AValue) then Exit;
   if (UserID=AValue) then Exit;
   FRestContext.UserID:=AValue;
   FRestContext.UserID:=AValue;
@@ -1081,17 +1081,19 @@ begin
   Result:=GetVariable(aName+FRestStrings.GetRestString(FilterStrings[aFilter]),aValue,[vsQuery]);
   Result:=GetVariable(aName+FRestStrings.GetRestString(FilterStrings[aFilter]),aValue,[vsQuery]);
 end;
 end;
 
 
-class function TRestIO.StrToNullBoolean(S: String; Strict: Boolean
-  ): TNullBoolean;
+class function TRestIO.StrToNullBoolean(const S: String; Strict: Boolean): TNullBoolean;
+
+var
+  ls : string;
 
 
 begin
 begin
   result:=nbNone;
   result:=nbNone;
-  s:=lowercase(s);
-  if (s<>'') then
-    if (s='1') or (s='t') or (s='true') or (s='y') then
+  ls:=lowercase(s);
+  if (ls<>'') then
+    if (ls='1') or (ls='t') or (ls='true') or (ls='y') then
       Result:=nbTrue
       Result:=nbTrue
     else
     else
-      if (s='0') or (s='f') or (s='false') or (s='n') then
+      if (ls='0') or (ls='f') or (ls='false') or (ls='n') then
         Result:=nbFalse
         Result:=nbFalse
       else if not Strict then
       else if not Strict then
         Result:=nbNone
         Result:=nbNone

+ 9 - 9
packages/fcl-web/src/restbridge/sqldbrestschema.pp

@@ -66,7 +66,7 @@ Type
   Protected
   Protected
     Procedure AddToFreeList(aData : TJSONData);
     Procedure AddToFreeList(aData : TJSONData);
     // The result of this function will be freed.
     // The result of this function will be freed.
-    function DoGetInputData(aName: UTF8string): TJSONData; virtual; abstract;
+    function DoGetInputData(const aName: UTF8string): TJSONData; virtual; abstract;
     Function GetConnection : TSQLConnection; virtual; abstract;
     Function GetConnection : TSQLConnection; virtual; abstract;
     Function GetTransaction : TSQLTransaction; virtual; abstract;
     Function GetTransaction : TSQLTransaction; virtual; abstract;
     Function GetUpdateData : TDataset; virtual; abstract;
     Function GetUpdateData : TDataset; virtual; abstract;
@@ -288,10 +288,10 @@ Type
     Function AllowResource(aContext : TBaseRestContext) : Boolean;
     Function AllowResource(aContext : TBaseRestContext) : Boolean;
     Function GetAllowedOperations(aContext : TBaseRestContext) : TRestOperations;
     Function GetAllowedOperations(aContext : TBaseRestContext) : TRestOperations;
     Function GetHTTPAllow : String; virtual;
     Function GetHTTPAllow : String; virtual;
-    function GetFieldList(aListKind: TFieldListKind; ASep : String = ''; OnlyFields : TSQLDBRestFieldArray = Nil): UTF8String;
+    function GetFieldList(aListKind: TFieldListKind; const ASep : String = ''; OnlyFields : TSQLDBRestFieldArray = Nil): UTF8String;
     function GetFieldArray(aListKind: TFieldListKind): TSQLDBRestFieldArray;
     function GetFieldArray(aListKind: TFieldListKind): TSQLDBRestFieldArray;
-    Function GetResolvedSQl(aKind : TSQLKind; Const AWhere : UTF8String; Const aOrderBy : UTF8String = ''; aLimit : UTF8String = ''; OnlyFields : TSQLDBRestFieldArray = nil) : UTF8String;
-    Function ProcessSQl(aSQL : String; Const AWhere : UTF8String; Const aOrderBy : UTF8String = ''; aLimit : UTF8String = '') : UTF8String;
+    Function GetResolvedSQl(aKind : TSQLKind; Const AWhere : UTF8String; Const aOrderBy : UTF8String = ''; const aLimit : UTF8String = ''; OnlyFields : TSQLDBRestFieldArray = nil) : UTF8String;
+    Function ProcessSQl(const aSQL : String; Const AWhere : UTF8String; Const aOrderBy : UTF8String = ''; const aLimit : UTF8String = '') : UTF8String;
     Procedure PopulateFieldsFromFieldDefs(Defs : TFieldDefs; aIndexFields : TStringArray; aProcessIdentifier : TProcessIdentifier; aMinFieldOpts : TRestFieldOptions);
     Procedure PopulateFieldsFromFieldDefs(Defs : TFieldDefs; aIndexFields : TStringArray; aProcessIdentifier : TProcessIdentifier; aMinFieldOpts : TRestFieldOptions);
     Procedure PopulateParametersFromSQL(const SQL : String; DoClear : Boolean = True);
     Procedure PopulateParametersFromSQL(const SQL : String; DoClear : Boolean = True);
     Property SQL [aKind : TSQLKind] : TStrings Read GetSQLTyped;
     Property SQL [aKind : TSQLKind] : TStrings Read GetSQLTyped;
@@ -1299,7 +1299,7 @@ end;
 
 
 function TSQLDBRestResource.GetHTTPAllow: String;
 function TSQLDBRestResource.GetHTTPAllow: String;
 
 
-  Procedure AddR(s : String);
+  Procedure AddR(const s : String);
 
 
   begin
   begin
     if (Result<>'') then
     if (Result<>'') then
@@ -1319,7 +1319,7 @@ begin
 end;
 end;
 
 
 function TSQLDBRestResource.GetFieldList(aListKind: TFieldListKind;
 function TSQLDBRestResource.GetFieldList(aListKind: TFieldListKind;
-  ASep: String; OnlyFields: TSQLDBRestFieldArray): UTF8String;
+  const ASep: String; OnlyFields: TSQLDBRestFieldArray): UTF8String;
 
 
 Const
 Const
   SepComma = ', ';
   SepComma = ', ';
@@ -1421,7 +1421,7 @@ begin
 end;
 end;
 
 
 function TSQLDBRestResource.GetResolvedSQl(aKind: TSQLKind;
 function TSQLDBRestResource.GetResolvedSQl(aKind: TSQLKind;
-  const AWhere: UTF8String; const aOrderBy: UTF8String; aLimit: UTF8String;
+  const AWhere: UTF8String; const aOrderBy: UTF8String; const aLimit: UTF8String;
   OnlyFields: TSQLDBRestFieldArray): UTF8String;
   OnlyFields: TSQLDBRestFieldArray): UTF8String;
 
 
 begin
 begin
@@ -1431,8 +1431,8 @@ begin
   Result:=ProcessSQL(Result,aWhere,aOrderBy,aLimit);
   Result:=ProcessSQL(Result,aWhere,aOrderBy,aLimit);
 end;
 end;
 
 
-function TSQLDBRestResource.ProcessSQl(aSQL: String; const AWhere: UTF8String;
-  const aOrderBy: UTF8String; aLimit: UTF8String): UTF8String;
+function TSQLDBRestResource.ProcessSQl(const aSQL: String; const AWhere: UTF8String;
+  const aOrderBy: UTF8String; const aLimit: UTF8String): UTF8String;
 
 
 Var
 Var
   S : UTF8String;
   S : UTF8String;

+ 2 - 12
packages/fcl-web/src/webdata/extjsjson.pp

@@ -68,7 +68,7 @@ type
     Procedure NextBatchItem(ResponseContent : TStream); override;
     Procedure NextBatchItem(ResponseContent : TStream); override;
     Procedure EndBatch(ResponseContent : TStream); override;
     Procedure EndBatch(ResponseContent : TStream); override;
     Function CreateAdaptor(ARequest : TRequest) : TCustomWebdataInputAdaptor; override;
     Function CreateAdaptor(ARequest : TRequest) : TCustomWebdataInputAdaptor; override;
-    Function AddFieldToJSON(O: TJSONObject; AFieldName: String; F: TField): TJSONData;
+    Function AddFieldToJSON(O: TJSONObject; const AFieldName: String; F: TField): TJSONData;
     function GetDataContentType: String; override;
     function GetDataContentType: String; override;
     Function GetJSONMetaData: TJSONObject;
     Function GetJSONMetaData: TJSONObject;
     function RowToJSON: TJSONObject;
     function RowToJSON: TJSONObject;
@@ -147,7 +147,7 @@ begin
   Result.Request:=ARequest;
   Result.Request:=ARequest;
 end;
 end;
 
 
-function TExtJSJSONDataFormatter.AddFieldToJSON(O : TJSONObject; AFieldName : String; F : TField): TJSONData;
+function TExtJSJSONDataFormatter.AddFieldToJSON(O : TJSONObject; const AFieldName : String; F : TField): TJSONData;
 
 
 Var
 Var
   S : String;
   S : String;
@@ -246,16 +246,6 @@ end;
 
 
 Function TExtJSJSONDataFormatter.GetJSONMetaData: TJSONObject;
 Function TExtJSJSONDataFormatter.GetJSONMetaData: TJSONObject;
 
 
-  Function DefReplace(S : String) : String;
-
-  begin
-    Result:=StringReplace(Result,'/',DateSeparator,[rfReplaceAll]);
-    Result:=StringReplace(Result,':',TimeSeparator,[rfReplaceAll]);
-    Result:=StringReplace(Result,'hh','H',[rfReplaceAll]);
-    Result:=StringReplace(Result,'nn','i',[rfReplaceAll]);
-    Result:=StringReplace(S,'n','i',[rfReplaceAll]);
-  end;
-
 Var
 Var
   F : TJSONArray;
   F : TJSONArray;
   Fi : TField;
   Fi : TField;

+ 2 - 2
packages/fcl-web/src/webdata/sqldbwebdata.pp

@@ -50,7 +50,7 @@ Type
     function CreateQuery(AOwner: TComponent; ATransaction: TSQLTransaction; ASQL: Tstrings): TSQLQuery;
     function CreateQuery(AOwner: TComponent; ATransaction: TSQLTransaction; ASQL: Tstrings): TSQLQuery;
     function GetParamType(P: TParam; const AValue: String): TFieldType; virtual;
     function GetParamType(P: TParam; const AValue: String): TFieldType; virtual;
     procedure SetTypedParam(P: TParam; Const AValue: String); virtual;
     procedure SetTypedParam(P: TParam; Const AValue: String); virtual;
-    procedure ExecuteSQL(ASQL: TStrings; Msg: String=''; DoNewID : Boolean = False); virtual;
+    procedure ExecuteSQL(ASQL: TStrings; const Msg: String=''; DoNewID : Boolean = False); virtual;
     procedure ApplySQLParams(AQuery: TSQLQuery; DoNewID : Boolean = False); virtual;
     procedure ApplySQLParams(AQuery: TSQLQuery; DoNewID : Boolean = False); virtual;
     Procedure SQLChanged(Sender : TObject); virtual;
     Procedure SQLChanged(Sender : TObject); virtual;
     Procedure DoUpdate; override;
     Procedure DoUpdate; override;
@@ -167,7 +167,7 @@ begin
   Params.ParseSQL(S,True);
   Params.ParseSQL(S,True);
 end;
 end;
 
 
-procedure TCustomSQLDBWebDataProvider.ExecuteSQL(ASQL : TStrings; Msg : String = ''; DoNewID : Boolean = False);
+procedure TCustomSQLDBWebDataProvider.ExecuteSQL(ASQL : TStrings; const Msg : String = ''; DoNewID : Boolean = False);
 
 
 Var
 Var
   Q : TSQLQuery;
   Q : TSQLQuery;

+ 8 - 8
packages/fcl-web/src/websocket/fpcustwsserver.pp

@@ -44,7 +44,7 @@ Type
 
 
   TWSConnectionList = Class(TThreadList)
   TWSConnectionList = Class(TThreadList)
     Function ForEach(aIterator : TConnectionIterator) : Boolean;
     Function ForEach(aIterator : TConnectionIterator) : Boolean;
-    Function FindConnectionById(aID : String) : TWSConnection;
+    Function FindConnectionById(const aID : String) : TWSConnection;
   end;
   end;
 
 
 
 
@@ -171,7 +171,7 @@ Type
     FOnConnectionHandshake: TWSConnectionHandshakeEvent;
     FOnConnectionHandshake: TWSConnectionHandshakeEvent;
     function GetActiveConnectionCount: Integer;
     function GetActiveConnectionCount: Integer;
     procedure SetOptions(const Value: TWSOptions);
     procedure SetOptions(const Value: TWSOptions);
-    procedure SetResource(AValue: string);
+    procedure SetResource(const AValue: string);
   protected
   protected
     // Virtual so it can be overriden;
     // Virtual so it can be overriden;
     procedure SetThreadMode(AValue: TWSThreadMode); virtual;
     procedure SetThreadMode(AValue: TWSThreadMode); virtual;
@@ -216,13 +216,13 @@ Type
     // Broadcast text data to all connections
     // Broadcast text data to all connections
     procedure BroadcastFrame(aFrame : TWSFrame); virtual;
     procedure BroadcastFrame(aFrame : TWSFrame); virtual;
     // Broadcast text data to all connections
     // Broadcast text data to all connections
-    procedure BroadcastMessage(AMessage: string); virtual;
+    procedure BroadcastMessage(const AMessage: string); virtual;
     // Broadcast binary data to all connections
     // Broadcast binary data to all connections
     procedure BroadcastData(AData: TBytes); virtual;
     procedure BroadcastData(AData: TBytes); virtual;
     // Send frame to connections, calling aSelector to see whether frame must be sent to a particular connection
     // Send frame to connections, calling aSelector to see whether frame must be sent to a particular connection
     procedure SendFrameTo(aFrame : TWSFrame; aSelector : TWSSendToFilter); virtual;
     procedure SendFrameTo(aFrame : TWSFrame; aSelector : TWSSendToFilter); virtual;
     // Send message to connections, calling aSelector to see whether data must be sent to a particular connection
     // Send message to connections, calling aSelector to see whether data must be sent to a particular connection
-    procedure SendMessageTo(AMessage: string; aSelector : TWSSendToFilter); virtual;
+    procedure SendMessageTo(const AMessage: string; aSelector : TWSSendToFilter); virtual;
     // Send binary data to connections, calling aSelector to see whether data must be sent to a particular connection
     // Send binary data to connections, calling aSelector to see whether data must be sent to a particular connection
     procedure SendDataTo(AData: TBytes; aSelector : TWSSendToFilter); virtual;
     procedure SendDataTo(AData: TBytes; aSelector : TWSSendToFilter); virtual;
     // Do something for all connections. Stop when iterator indicates to stop
     // Do something for all connections. Stop when iterator indicates to stop
@@ -284,7 +284,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-function TWSConnectionList.FindConnectionById(aID: String): TWSConnection;
+function TWSConnectionList.FindConnectionById(const aID: String): TWSConnection;
 Var
 Var
   L : TList;
   L : TList;
   I : Integer;
   I : Integer;
@@ -364,7 +364,7 @@ begin
   Result:=TWSConnectionList.Create;
   Result:=TWSConnectionList.Create;
 end;
 end;
 
 
-procedure TCustomWSServer.BroadcastMessage(AMessage: string);
+procedure TCustomWSServer.BroadcastMessage(const AMessage: string);
 
 
 begin
 begin
   SendMessageTo(aMessage,@DoAllowAll);
   SendMessageTo(aMessage,@DoAllowAll);
@@ -475,7 +475,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-procedure TCustomWSServer.SendMessageTo(AMessage: string; aSelector: TWSSendToFilter);
+procedure TCustomWSServer.SendMessageTo(const AMessage: string; aSelector: TWSSendToFilter);
 
 
   Function DoAllow(Conn : TWSServerConnection) : Boolean;
   Function DoAllow(Conn : TWSServerConnection) : Boolean;
   begin
   begin
@@ -530,7 +530,7 @@ begin
   FOptions := Value;
   FOptions := Value;
 end;
 end;
 
 
-procedure TCustomWSServer.SetResource(AValue: string);
+procedure TCustomWSServer.SetResource(const AValue: string);
 begin
 begin
   if FResource=AValue then Exit;
   if FResource=AValue then Exit;
   CheckInactive;
   CheckInactive;

+ 4 - 4
packages/fcl-web/src/websocket/wsupgrader.pp

@@ -22,8 +22,8 @@ Type
     FHost: String;
     FHost: String;
     function GetHandshakeRequest(aRequest: TFPHTTPConnectionRequest): TWSHandShakeRequest;
     function GetHandshakeRequest(aRequest: TFPHTTPConnectionRequest): TWSHandShakeRequest;
     function GetUpgradeName: String;
     function GetUpgradeName: String;
-    procedure SetHost(AValue: String);
-    procedure SetUpgradeName(AValue: String);
+    procedure SetHost(const AValue: String);
+    procedure SetUpgradeName(const AValue: String);
     procedure SetWebServer(AValue: TFPCustomHttpServer);
     procedure SetWebServer(AValue: TFPCustomHttpServer);
   Protected
   Protected
     // Override from custom server
     // Override from custom server
@@ -117,7 +117,7 @@ begin
   FreeConnectionHandler;
   FreeConnectionHandler;
 end;
 end;
 
 
-procedure TCustomWebsocketUpgrader.SetHost(AValue: String);
+procedure TCustomWebsocketUpgrader.SetHost(const AValue: String);
 begin
 begin
   if Host=AValue then Exit;
   if Host=AValue then Exit;
   CheckInactive;
   CheckInactive;
@@ -216,7 +216,7 @@ begin
 end;
 end;
 
 
 
 
-procedure TCustomWebsocketUpgrader.SetUpgradeName(AValue: String);
+procedure TCustomWebsocketUpgrader.SetUpgradeName(const AValue: String);
 begin
 begin
   if aValue=GetUpgradeName then
   if aValue=GetUpgradeName then
     exit;
     exit;