mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-10 04:49:07 +02:00
* some string parameters made const in fppdf units.
Resolves #40044 by Alexey T. Note that AddIntArray was not changed, the variable is changed inside the method
This commit is contained in:
parent
ce44efdae3
commit
a74bee2cb1
@ -343,7 +343,7 @@ type
|
||||
procedure AddItem(const AValue: TPDFObject);
|
||||
// Add integers in S as TPDFInteger elements to the array
|
||||
Procedure AddIntArray(S : String);
|
||||
procedure AddFreeFormArrayValues(S: string);
|
||||
procedure AddFreeFormArrayValues(Const S: string);
|
||||
public
|
||||
constructor Create(Const ADocument : TPDFDocument); override;
|
||||
destructor Destroy; override;
|
||||
@ -842,7 +842,7 @@ type
|
||||
FTextMappingList: TTextMappingList;
|
||||
FSubsetFont: TStream;
|
||||
procedure PrepareTextMapping;
|
||||
procedure SetFontFilename(AValue: string);
|
||||
procedure SetFontFilename(const AValue: string);
|
||||
procedure GenerateSubsetFont;
|
||||
public
|
||||
constructor Create(ACollection: TCollection); override;
|
||||
@ -1104,9 +1104,9 @@ type
|
||||
function CreatePagesEntry(Parent: integer): integer;virtual;
|
||||
function CreatePageEntry(Parent, PageNum: integer): integer;virtual;
|
||||
function CreateOutlines: integer;virtual;
|
||||
function CreateOutlineEntry(Parent, SectNo, PageNo: integer; ATitle: string): integer;virtual;
|
||||
function CreateOutlineEntry(Parent, SectNo, PageNo: integer; const ATitle: string): integer;virtual;
|
||||
function LoadFont(AFont: TPDFFont): boolean;
|
||||
procedure CreateStdFont(EmbeddedFontName: string; EmbeddedFontNum: integer);virtual;
|
||||
procedure CreateStdFont(const EmbeddedFontName: string; EmbeddedFontNum: integer);virtual;
|
||||
procedure CreateTTFFont(const EmbeddedFontNum: integer);virtual;
|
||||
procedure CreateTTFDescendantFont(const EmbeddedFontNum: integer);virtual;
|
||||
procedure CreateTTFCIDSystemInfo;virtual;
|
||||
@ -1660,7 +1660,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPDFFont.SetFontFilename(AValue: string);
|
||||
procedure TPDFFont.SetFontFilename(const AValue: string);
|
||||
begin
|
||||
if FFontFilename = AValue then
|
||||
Exit;
|
||||
@ -3246,7 +3246,7 @@ end;
|
||||
function TPDFImages.AddFromFile(const AFileName: String; KeepImage: Boolean): Integer;
|
||||
|
||||
{$IF NOT (FPC_FULLVERSION >= 30101)}
|
||||
function FindReaderFromExtension(extension: String): TFPCustomImageReaderClass;
|
||||
function FindReaderFromExtension(const extension: String): TFPCustomImageReaderClass;
|
||||
var
|
||||
s: string;
|
||||
r: integer;
|
||||
@ -3635,7 +3635,7 @@ begin
|
||||
AddItem(Document.CreateInteger(StrToInt(S)));
|
||||
end;
|
||||
|
||||
procedure TPDFArray.AddFreeFormArrayValues(S: string);
|
||||
procedure TPDFArray.AddFreeFormArrayValues(const S: string);
|
||||
begin
|
||||
AddItem(TPDFFreeFormString.Create(nil, S));
|
||||
end;
|
||||
@ -5286,7 +5286,7 @@ begin
|
||||
Result:=GLobalXRefCount-1;
|
||||
end;
|
||||
|
||||
function TPDFDocument.CreateOutlineEntry(Parent, SectNo, PageNo: integer; ATitle: string): integer;
|
||||
function TPDFDocument.CreateOutlineEntry(Parent, SectNo, PageNo: integer; const ATitle: string): integer;
|
||||
var
|
||||
ODict: TPDFDictionary;
|
||||
S: String;
|
||||
@ -5325,7 +5325,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPDFDocument.CreateStdFont(EmbeddedFontName: string; EmbeddedFontNum: integer);
|
||||
procedure TPDFDocument.CreateStdFont(const EmbeddedFontName: string; EmbeddedFontNum: integer);
|
||||
var
|
||||
FDict: TPDFDictionary;
|
||||
N: TPDFName;
|
||||
|
@ -166,7 +166,7 @@ Type
|
||||
class function ElementType : TPDFElementType; override;
|
||||
|
||||
function GetDescription : String; override;
|
||||
Function IsKeyword (aKeyWord : string) : Boolean;
|
||||
Function IsKeyword (const aKeyWord : string) : Boolean;
|
||||
Function IsInteger : Boolean;
|
||||
Function IsInt64 : Boolean;
|
||||
Property TokenType : TPDFTokentype Read FTokenType;
|
||||
@ -328,7 +328,7 @@ Type
|
||||
Public
|
||||
class function ElementType : TPDFElementType; override;
|
||||
function GetDescription: String; override;
|
||||
Function AddEntry(aKey : String; aValue : TPDFObject) : TPDFDictEntry;
|
||||
Function AddEntry(const aKey : String; aValue : TPDFObject) : TPDFDictEntry;
|
||||
Function AddEntry(aEntry : TPDFDictEntry) : Integer;
|
||||
function ContainsKey(const aKeyword : RawByteString) : boolean;
|
||||
function IndexofKey(const aKeyword : RawByteString) : Integer;
|
||||
@ -395,9 +395,9 @@ Type
|
||||
Constructor Create(aSource : TPDFIndirect); overload; virtual;
|
||||
Destructor Destroy; override;
|
||||
Function ResolveObjectType : TPDFIndirect;
|
||||
Class function FindClassForType(aType : String) : TPDFIndirectClass;
|
||||
Class Procedure RegisterType(aType : String; aClass : TPDFIndirectClass);
|
||||
Class Procedure UnRegisterType(aType : String);
|
||||
Class function FindClassForType(const aType : String) : TPDFIndirectClass;
|
||||
Class Procedure RegisterType(const aType : String; aClass : TPDFIndirectClass);
|
||||
Class Procedure UnRegisterType(const aType : String);
|
||||
Class Procedure Register;
|
||||
Class Procedure UnRegister;
|
||||
class function ElementType : TPDFElementType; override;
|
||||
@ -463,8 +463,8 @@ Type
|
||||
Constructor Create; override; overload;
|
||||
Destructor Destroy; override;
|
||||
function FindResources: TPDFDictionary;
|
||||
Function FindFontRefObj(aFontName : String) : TPDFRef;
|
||||
Function FindFontRef(aFontName : String) : TPDFRefData;
|
||||
Function FindFontRefObj(const aFontName : String) : TPDFRef;
|
||||
Function FindFontRef(const aFontName : String) : TPDFRefData;
|
||||
Property ParentRef : TPDFRef Read GetParentRef;
|
||||
Property Parent : TPDFIndirect Read GetParent;
|
||||
Property Contents[aIndex : integer] : TPDFIndirect Read GetContent;
|
||||
@ -1785,7 +1785,7 @@ begin
|
||||
Result:=Fresources;
|
||||
end;
|
||||
|
||||
function TPDFPageObject.FindFontRefObj(aFontName: String): TPDFRef;
|
||||
function TPDFPageObject.FindFontRefObj(const aFontName: String): TPDFRef;
|
||||
|
||||
var
|
||||
aDict : TPDFDictionary;
|
||||
@ -1802,7 +1802,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TPDFPageObject.FindFontRef(aFontName: String): TPDFRefData;
|
||||
function TPDFPageObject.FindFontRef(const aFontName: String): TPDFRefData;
|
||||
|
||||
var
|
||||
aRef : TPDFRef;
|
||||
@ -2604,7 +2604,7 @@ begin
|
||||
Result:='Value ('+Value+')';
|
||||
end;
|
||||
|
||||
function TPDFValue.IsKeyword(aKeyWord: string): Boolean;
|
||||
function TPDFValue.IsKeyword(const aKeyWord: string): Boolean;
|
||||
begin
|
||||
Result:=(Value=aKeyWord)
|
||||
end;
|
||||
@ -2649,7 +2649,7 @@ begin
|
||||
Result:=Result+sLineBreak+'>>';
|
||||
end;
|
||||
|
||||
function TPDFDictionary.AddEntry(aKey: String; aValue: TPDFObject): TPDFDictEntry;
|
||||
function TPDFDictionary.AddEntry(const aKey: String; aValue: TPDFObject): TPDFDictEntry;
|
||||
begin
|
||||
Result:=TPDFDictEntry.Create();
|
||||
if (aKey<>'') and (aKey[1]='/') then
|
||||
@ -3015,18 +3015,18 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TPDFIndirect.FindClassForType(aType: String): TPDFIndirectClass;
|
||||
class function TPDFIndirect.FindClassForType(const aType: String): TPDFIndirectClass;
|
||||
begin
|
||||
Result:=TPDFIndirectClass(_ClassList.Items[LowerCase(aType)]);
|
||||
end;
|
||||
|
||||
class procedure TPDFIndirect.RegisterType(aType: String;
|
||||
class procedure TPDFIndirect.RegisterType(const aType: String;
|
||||
aClass: TPDFIndirectClass);
|
||||
begin
|
||||
_ClassList.Add(LowerCase(aType),aClass);
|
||||
end;
|
||||
|
||||
class procedure TPDFIndirect.UnRegisterType(aType: String);
|
||||
class procedure TPDFIndirect.UnRegisterType(const aType: String);
|
||||
begin
|
||||
_ClassList.Delete(LowerCase(aType));
|
||||
end;
|
||||
|
@ -88,7 +88,7 @@ Type
|
||||
Procedure DoWarning(Const Fmt : string; Const args : Array of const);
|
||||
Procedure DoError(const Nr : Integer; Const Msg : string);
|
||||
Procedure DoError(const Nr : Integer; Const Fmt : string; Const Args : Array of const);
|
||||
Procedure DoUnknownStruct(aID : String);
|
||||
Procedure DoUnknownStruct(const aID : String);
|
||||
Protected
|
||||
// Factory methods
|
||||
Function CreateScanner(aFile : TStream; aBufferSize : Cardinal) : TPDFScanner; virtual;
|
||||
@ -103,7 +103,7 @@ Type
|
||||
function VerifyDocument: Int64;
|
||||
// Stream Filters
|
||||
function FindStreamLength(aReposition : Int64): Integer;
|
||||
function FilterStream(aStream: TStream; aFilterName: String; aParams: TPDFDictionary): TStream;
|
||||
function FilterStream(aStream: TStream; const aFilterName: String; aParams: TPDFDictionary): TStream;
|
||||
function GetUnfilteredStream(aObj: TPDFIndirect): TStream;
|
||||
function ResolveFilters(aStream: TStream; aDict: TPDFDictionary): TStream;
|
||||
// XRef handling
|
||||
@ -380,7 +380,7 @@ end;
|
||||
Var
|
||||
aFileCount : Integer = 0;
|
||||
|
||||
procedure SaveStreamToFile(aContext : String; aStream : TStream; const aFileName : String = '');
|
||||
procedure SaveStreamToFile(const aContext : String; aStream : TStream; const aFileName : String = '');
|
||||
|
||||
Var
|
||||
FN : String;
|
||||
@ -1647,7 +1647,7 @@ Var
|
||||
aPredictor,aColors,aColumns,aBitsPerComponent : Integer;
|
||||
aStream : TPDFPredictStream;
|
||||
|
||||
Function MaybeInt(aKey : string; aDefault : integer) : Integer;
|
||||
Function MaybeInt(aKey : string; const aDefault : integer) : Integer;
|
||||
|
||||
begin
|
||||
if Data.ParamDict.ContainsKey(aKey) then
|
||||
@ -1697,7 +1697,7 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function TPDFParser.FilterStream(aStream : TStream; aFilterName : String; aParams : TPDFDictionary) : TStream;
|
||||
function TPDFParser.FilterStream(aStream : TStream; const aFilterName : String; aParams : TPDFDictionary) : TStream;
|
||||
|
||||
Var
|
||||
Data : TPDFFilterData;
|
||||
@ -2110,7 +2110,7 @@ begin
|
||||
DoError(Nr,Format(Fmt,Args))
|
||||
end;
|
||||
|
||||
procedure TPDFParser.DoUnknownStruct(aID: String);
|
||||
procedure TPDFParser.DoUnknownStruct(const aID: String);
|
||||
begin
|
||||
DoError(penUnknownConstruct,SErrUnknownConstruct,[aID]);
|
||||
end;
|
||||
|
@ -34,11 +34,11 @@ Type
|
||||
PTTFEncodingValues = ^TTTFEncodingValues;
|
||||
|
||||
Procedure GetEncodingTables(E : TTTFEncoding; Out ANames: PTTFEncodingNames; Out AValues: PTTFEncodingValues);
|
||||
Function GetEncoding(AName : String) : TTTFEncoding;
|
||||
Function GetEncoding(const AName : String) : TTTFEncoding;
|
||||
|
||||
Implementation
|
||||
|
||||
Function GetEncoding(AName : String) : TTTFEncoding;
|
||||
Function GetEncoding(const AName : String) : TTTFEncoding;
|
||||
|
||||
Var
|
||||
Names : Array[TTTFEncoding] of string =
|
||||
|
Loading…
Reference in New Issue
Block a user