Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for missing const for unmodified string warning from Pascal Analy… #545

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/Core/IdCmdTCPClient.pas
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ TIdCmdTCPClient = class(TIdTCPClient)
procedure DoAfterCommandHandler(ASender: TIdCommandHandlers; AContext: TIdContext);
procedure DoBeforeCommandHandler(ASender: TIdCommandHandlers; var AData: string;
AContext: TIdContext);
procedure DoReplyUnknownCommand(AContext: TIdContext; ALine: string); virtual;
procedure DoReplyUnknownCommand(AContext: TIdContext; const ALine: string); virtual;
function GetCmdHandlerClass: TIdCommandHandlerClass; virtual;
procedure InitComponent; override;
procedure SetCommandHandlers(AValue: TIdCommandHandlers);
Expand Down Expand Up @@ -273,7 +273,7 @@ procedure TIdCmdTCPClient.DoBeforeCommandHandler(ASender: TIdCommandHandlers;
end;
end;

procedure TIdCmdTCPClient.DoReplyUnknownCommand(AContext: TIdContext; ALine: string);
procedure TIdCmdTCPClient.DoReplyUnknownCommand(AContext: TIdContext; const ALine: string);
begin
end;

Expand Down
4 changes: 2 additions & 2 deletions Lib/Core/IdCmdTCPServer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ TIdCmdTCPServer = class(TIdTCPServer)
function DoExecute(AContext: TIdContext): Boolean; override;
procedure DoMaxConnectionsExceeded(AIOHandler: TIdIOHandler); override;
// This is here to allow servers to override this functionality, such as IMAP4 server
procedure DoReplyUnknownCommand(AContext: TIdContext; ALine: string); virtual;
procedure DoReplyUnknownCommand(AContext: TIdContext; const ALine: string); virtual;
function GetExceptionReply: TIdReply;
function GetGreeting: TIdReply;
function GetHelpReply: TIdReply;
Expand Down Expand Up @@ -313,7 +313,7 @@ function TIdCmdTCPServer.DoExecute(AContext: TIdContext): Boolean;
// the return value is used to determine if the DoExecute needs to be called again by the thread
end;

procedure TIdCmdTCPServer.DoReplyUnknownCommand(AContext: TIdContext; ALine: string);
procedure TIdCmdTCPServer.DoReplyUnknownCommand(AContext: TIdContext; const ALine: string);
var
LReply: TIdReply;
begin
Expand Down
8 changes: 4 additions & 4 deletions Lib/Core/IdCommandHandlers.pas
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ TIdCommandHandler = class(TCollectionItem)
procedure SetResponse(AValue: TStrings);
public
function Check(const AData: string; AContext: TIdContext): boolean; virtual;
procedure DoCommand(const AData: string; AContext: TIdContext; AUnparsedParams: string); virtual;
procedure DoParseParams(AUnparsedParams: string; AParams: TStrings); virtual;
procedure DoCommand(const AData: string; AContext: TIdContext; const AUnparsedParams: string); virtual;
procedure DoParseParams(const AUnparsedParams: string; AParams: TStrings); virtual;
constructor Create(ACollection: TCollection); override;
destructor Destroy; override;
// function GetNamePath: string; override;
Expand Down Expand Up @@ -418,7 +418,7 @@ procedure TIdCommandHandlers.SetItem(AIndex: Integer; const AValue: TIdCommandHa

{ TIdCommandHandler }

procedure TIdCommandHandler.DoCommand(const AData: string; AContext: TIdContext; AUnparsedParams: string);
procedure TIdCommandHandler.DoCommand(const AData: string; AContext: TIdContext; const AUnparsedParams: string);
var
LCommand: TIdCommand;
begin
Expand Down Expand Up @@ -513,7 +513,7 @@ procedure TIdCommandHandler.DoCommand(const AData: string; AContext: TIdContext;
end;
end;

procedure TIdCommandHandler.DoParseParams(AUnparsedParams: string; AParams: TStrings);
procedure TIdCommandHandler.DoParseParams(const AUnparsedParams: string; AParams: TStrings);
// AUnparsedParams is not preparsed and is completely left up to the command handler. This will
// allow for future expansion such as multiple delimiters etc, and allow the logic to properly
// remain in each of the command handler implementations. In the future there may be a base type
Expand Down
8 changes: 4 additions & 4 deletions Lib/Core/IdIOHandler.pas
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ TIdIOHandler = class(TIdComponent)
function ReadLn(AByteEncoding: IIdTextEncoding = nil
{$IFDEF STRING_IS_ANSI}; ADestEncoding: IIdTextEncoding = nil{$ENDIF}
): string; overload; // .Net overload
function ReadLn(ATerminator: string; AByteEncoding: IIdTextEncoding
function ReadLn(const ATerminator: string; AByteEncoding: IIdTextEncoding
{$IFDEF STRING_IS_ANSI}; ADestEncoding: IIdTextEncoding = nil{$ENDIF}
): string; overload;
function ReadLn(ATerminator: string; ATimeout: Integer = IdTimeoutDefault;
Expand All @@ -672,7 +672,7 @@ TIdIOHandler = class(TIdComponent)
{$IFDEF STRING_IS_ANSI}; ADestEncoding: IIdTextEncoding = nil{$ENDIF}
): string; virtual;
// Added for retrieving lines over 16K long}
function ReadLnSplit(var AWasSplit: Boolean; ATerminator: string = LF;
function ReadLnSplit(var AWasSplit: Boolean; const ATerminator: string = LF;
ATimeout: Integer = IdTimeoutDefault; AMaxLineLength: Integer = -1;
AByteEncoding: IIdTextEncoding = nil
{$IFDEF STRING_IS_ANSI}; ADestEncoding: IIdTextEncoding = nil{$ENDIF}
Expand Down Expand Up @@ -1428,7 +1428,7 @@ function TIdIOHandler.ReadLn(AByteEncoding: IIdTextEncoding = nil
);
end;

function TIdIOHandler.ReadLn(ATerminator: string; AByteEncoding: IIdTextEncoding
function TIdIOHandler.ReadLn(const ATerminator: string; AByteEncoding: IIdTextEncoding
{$IFDEF STRING_IS_ANSI}; ADestEncoding: IIdTextEncoding = nil{$ENDIF}
): string;
{$IFDEF USE_CLASSINLINE}inline;{$ENDIF}
Expand Down Expand Up @@ -1588,7 +1588,7 @@ function TIdIOHandler.ReadLnRFC(var VMsgEnd: Boolean; const ALineTerminator: str
VMsgEnd := False;
end;

function TIdIOHandler.ReadLnSplit(var AWasSplit: Boolean; ATerminator: string = LF;
function TIdIOHandler.ReadLnSplit(var AWasSplit: Boolean; const ATerminator: string = LF;
ATimeout: Integer = IdTimeoutDefault; AMaxLineLength: Integer = -1;
AByteEncoding: IIdTextEncoding = nil
{$IFDEF STRING_IS_ANSI}; ADestEncoding: IIdTextEncoding = nil{$ENDIF}
Expand Down
4 changes: 2 additions & 2 deletions Lib/Core/IdTCPConnection.pas
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ TIdTCPConnection = class(TIdComponent)
procedure RaiseExceptionForLastCmdResult(AException: TClassIdException);
overload; virtual;
// These are extended GetResponses, so see the comments for GetResponse
function SendCmd(AOut: string; const AResponse: Int16 = -1;
function SendCmd(const AOut: string; const AResponse: Int16 = -1;
AEncoding: IIdTextEncoding = nil): Int16; overload;
function SendCmd(AOut: string; const AResponse: array of Int16;
AEncoding: IIdTextEncoding = nil): Int16; overload; virtual;
Expand Down Expand Up @@ -794,7 +794,7 @@ procedure TIdTCPConnection.WriteHeader(AHeader: TStrings);
end;
end;

function TIdTCPConnection.SendCmd(AOut: string; const AResponse: Int16 = -1;
function TIdTCPConnection.SendCmd(const AOut: string; const AResponse: Int16 = -1;
AEncoding: IIdTextEncoding = nil): Int16;
begin
if AResponse < 0 then begin
Expand Down
4 changes: 2 additions & 2 deletions Lib/Protocols/IdAuthentication.pas
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ TIdAuthentication = class(TPersistent)
FAuthParams: TIdHeaderList;
FCharset: string;

function ReadAuthInfo(AuthName: String): String;
function ReadAuthInfo(const AuthName: String): String;
function DoNext: TIdAuthWhatsNext; virtual; abstract;
procedure SetAuthParams(AValue: TIdHeaderList);
function GetPassword: String;
Expand Down Expand Up @@ -226,7 +226,7 @@ procedure TIdAuthentication.SetAuthParams(AValue: TIdHeaderList);
FAuthParams.Assign(AValue);
end;

function TIdAuthentication.ReadAuthInfo(AuthName: String): String;
function TIdAuthentication.ReadAuthInfo(const AuthName: String): String;
Var
i: Integer;
begin
Expand Down
8 changes: 4 additions & 4 deletions Lib/Protocols/IdCoderHeader.pas
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ interface
// Procs
function EncodeAddressItem(EmailAddr: TIdEmailAddressItem; const HeaderEncoding: Char;
const MimeCharSet: string; AUseAddressForNameIfNameMissing: Boolean = False): string;
function EncodeHeader(const Header: string; Specials: String; const HeaderEncoding: Char;
function EncodeHeader(const Header: string; const Specials: String; const HeaderEncoding: Char;
const MimeCharSet: string): string;
function EncodeAddress(EmailAddr: TIdEMailAddressList; const HeaderEncoding: Char;
const MimeCharSet: string; AUseAddressForNameIfNameMissing: Boolean = False): string;
function DecodeHeader(const Header: string): string;
procedure DecodeAddress(EMailAddr: TIdEmailAddressItem);
procedure DecodeAddresses(AEMails: String; EMailAddr: TIdEmailAddressList);
procedure DecodeAddresses(const AEMails: String; EMailAddr: TIdEmailAddressList);

implementation

Expand Down Expand Up @@ -385,7 +385,7 @@ procedure DecodeAddress(EMailAddr : TIdEmailAddressItem);
EMailAddr.Name := UnquotedStr(DecodeHeader(EMailAddr.Name));
end;

procedure DecodeAddresses(AEMails : String; EMailAddr: TIdEmailAddressList);
procedure DecodeAddresses(const AEMails : String; EMailAddr: TIdEmailAddressList);
var
idx : Integer;
begin
Expand All @@ -412,7 +412,7 @@ function EncodeAddress(EmailAddr: TIdEMailAddressList; const HeaderEncoding: Cha
end;

{ encode a header field if non-ASCII characters are used }
function EncodeHeader(const Header: string; Specials: String; const HeaderEncoding: Char;
function EncodeHeader(const Header: string; const Specials: String; const HeaderEncoding: Char;
const MimeCharSet: string): string;
const
SPACES = [Ord(' '), 9, 13, 10]; {Do not Localize}
Expand Down
8 changes: 4 additions & 4 deletions Lib/Protocols/IdDNSCommon.pas
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ TIdTextModeResourceRecord = class(TObject)
property RRDatas : TStrings read FRRDatas write SetRRDatas;
property TTL : integer read FTTL write SetTTL;
property TimeOut : string read FTimeOut write FTimeOut;
function ifAddFullName(AFullName: string; AGivenName: string = ''): boolean;
function ifAddFullName(const AFullName: string; const AGivenName: string = ''): boolean;
function GetValue(const AName: String): String;
procedure SetValue(const AName: String; const AValue: String);
function ItemCount : Integer;
Expand Down Expand Up @@ -610,7 +610,7 @@ function ConvertToCanonical6IP(const OrgIP : String) : string;
function IPv6AAAAToDNSStr(const AIPv6Address : String): TIdBytes;
function GetErrorStr(const Code, Id: Integer): String;
function GetRCodeStr(RCode : Integer): String;
function ReplaceSpecString(Source, Target, NewString : string; ReplaceAll : boolean = True) : string;
function ReplaceSpecString(const Source, Target, NewString : string; ReplaceAll : boolean = True) : string;
function IsBig5(ch1, ch2: Char) : Boolean;

implementation
Expand Down Expand Up @@ -1292,7 +1292,7 @@ procedure TIdTextModeResourceRecord.SetValue(const AName: String; const AValue:
RRDatas.Values[AName] := AValue;
end;

function TIdTextModeResourceRecord.ifAddFullName(AFullName, AGivenName: string): boolean;
function TIdTextModeResourceRecord.ifAddFullName(const AFullName, AGivenName: string): boolean;
var
LTailString, LBackString, LDestination : string;
LTS, LRR : integer;
Expand Down Expand Up @@ -1994,7 +1994,7 @@ constructor TIdRR_Error.Create;
inherited CreateInit('', TypeCode_Error); {do not localize}
end;

function ReplaceSpecString(Source, Target, NewString : string; ReplaceAll : boolean = True) : string;
function ReplaceSpecString(const Source, Target, NewString : string; ReplaceAll : boolean = True) : string;
var
FixingString, MiddleString, FixedString : string;
begin
Expand Down
9 changes: 5 additions & 4 deletions Lib/Protocols/IdDNSResolver.pas
Original file line number Diff line number Diff line change
Expand Up @@ -545,11 +545,11 @@ TIdDNSResolver = class(TIdTCPConnection)
procedure ClearInternalQuery;
destructor Destroy; override;
procedure ParseAnswers(DNSHeader: TDNSHeader; Answer: TIdBytes; ResetResult: Boolean = True);
procedure CreateQuery(ADomain: string; SOARR : TIdRR_SOA; QueryClass:integer = Class_IN);
procedure CreateQuery(const ADomain: string; SOARR : TIdRR_SOA; QueryClass:integer = Class_IN);
procedure FillResult(AResult: TIdBytes; checkID : boolean = true;
ResetResult : boolean = true);
procedure FillResultWithOutCheckId(AResult: TIdBytes); {$IFDEF HAS_DEPRECATED}deprecated{$IFDEF HAS_DEPRECATED_MSG} 'Use FillResult() with checkID=False'{$ENDIF};{$ENDIF}
procedure Resolve(ADomain: string; SOARR : TIdRR_SOA = nil; QClass: integer = Class_IN);
procedure Resolve(const ADomain: string; SOARR : TIdRR_SOA = nil; QClass: integer = Class_IN);
property QueryResult: TQueryResult read FQueryResult;
property InternalQuery: TIdBytes read FInternalQuery write SetInternalQuery;
property PlainTextResult: TIdBytes read FPlainTextResult write SetPlainTextResult;
Expand Down Expand Up @@ -1202,13 +1202,14 @@ procedure TIdDNSResolver.ClearInternalQuery;
FQuestionLength := 0;
end;

procedure TIdDNSResolver.CreateQuery(ADomain: string; SOARR : TIdRR_SOA;
procedure TIdDNSResolver.CreateQuery(const ADomain: string; SOARR : TIdRR_SOA;
QueryClass:integer=1);

function DoDomainName(ADNS : String): TIdBytes;
var
BufStr : String;
LLen : Byte;
LDNS : String;
begin
SetLength(Result, 0);
while Length(ADNS) > 0 do begin
Expand Down Expand Up @@ -1596,7 +1597,7 @@ procedure TIdDNSResolver.ParseAnswers(DNSHeader: TDNSHeader; Answer: TIdBytes;
end;
end;

procedure TIdDNSResolver.Resolve(ADomain: string; SOARR : TIdRR_SOA = nil;
procedure TIdDNSResolver.Resolve(const ADomain: string; SOARR : TIdRR_SOA = nil;
QClass: integer = Class_IN);
var
UDP_Tunnel : TIdUDPClient;
Expand Down
Loading