Browse Source

* PChar -> PAnsiChar

Michaël Van Canneyt 2 years ago
parent
commit
3c6f64ac91

+ 1 - 1
packages/fcl-res/src/cofftypes.pp

@@ -23,7 +23,7 @@ type
   TCoffMachineType = (cmti386, cmtarm, cmtx8664, cmtppc32aix, cmtppc64aix, cmtaarch64);
   TCoffMachineType = (cmti386, cmtarm, cmtx8664, cmtppc32aix, cmtppc64aix, cmtaarch64);
 
 
 type
 type
-  TSectionName = array [0..7] of char;
+  TSectionName = array [0..7] of AnsiChar;
 
 
 const
 const
   RSRCSectName : TSectionName = '.rsrc'+#0+#0+#0;
   RSRCSectName : TSectionName = '.rsrc'+#0+#0+#0;

+ 12 - 12
packages/fcl-res/src/dfmreader.pp

@@ -30,7 +30,7 @@ type
   private
   private
     fExtensions : string;
     fExtensions : string;
     fDescription : string;
     fDescription : string;
-    fLine : string;
+    fLine : ansistring;
     fLinePos : integer;
     fLinePos : integer;
     fObjectName : string;
     fObjectName : string;
     dummyType : TResourceDesc;
     dummyType : TResourceDesc;
@@ -41,7 +41,7 @@ type
     function IsAlphaNum : boolean;
     function IsAlphaNum : boolean;
     function IsSpace : boolean;
     function IsSpace : boolean;
     procedure SkipSpaces;
     procedure SkipSpaces;
-    function GetIdent : string;
+    function GetIdent : ansistring;
     procedure ReadLine(aStream : TStream);
     procedure ReadLine(aStream : TStream);
     
     
     function CheckTextDfm(aStream : TStream) : boolean;
     function CheckTextDfm(aStream : TStream) : boolean;
@@ -63,21 +63,21 @@ uses
   resdatastream, resfactory;
   resdatastream, resfactory;
 
 
 type
 type
-  TSignature = array[0..3] of char;
+  TSignature = array[0..3] of AnsiChar;
 
 
 const
 const
-  FilerSignature = 'TPF0';
+  FilerSignature : AnsiString = 'TPF0';
 
 
 { TDfmResourceReader }
 { TDfmResourceReader }
 
 
 function TDfmResourceReader.IsAlpha: boolean;
 function TDfmResourceReader.IsAlpha: boolean;
 begin
 begin
-  Result:=pchar(fLine)[fLinePos] in ['_','A'..'Z','a'..'z'];
+  Result:=PAnsiChar(fLine)[fLinePos] in ['_','A'..'Z','a'..'z'];
 end;
 end;
 
 
 function TDfmResourceReader.IsNum: boolean;
 function TDfmResourceReader.IsNum: boolean;
 begin
 begin
-  Result:=pchar(fLine)[fLinePos] in ['0'..'9'];
+  Result:=PAnsiChar(fLine)[fLinePos] in ['0'..'9'];
 end;
 end;
 
 
 function TDfmResourceReader.IsAlphaNum: boolean;
 function TDfmResourceReader.IsAlphaNum: boolean;
@@ -88,7 +88,7 @@ end;
 function TDfmResourceReader.IsSpace: boolean;
 function TDfmResourceReader.IsSpace: boolean;
 const TAB = #9;
 const TAB = #9;
 begin
 begin
-  Result:=pchar(fLine)[fLinePos] in [' ',TAB];
+  Result:=PAnsiChar(fLine)[fLinePos] in [' ',TAB];
 end;
 end;
 
 
 procedure TDfmResourceReader.SkipSpaces;
 procedure TDfmResourceReader.SkipSpaces;
@@ -96,14 +96,14 @@ begin
   while IsSpace do inc(fLinePos);
   while IsSpace do inc(fLinePos);
 end;
 end;
 
 
-function TDfmResourceReader.GetIdent: string;
+function TDfmResourceReader.GetIdent: ansistring;
 begin
 begin
   Result:='';
   Result:='';
   SkipSpaces;
   SkipSpaces;
   if not IsAlpha then exit;
   if not IsAlpha then exit;
   while IsAlphaNum do
   while IsAlphaNum do
   begin
   begin
-    Result:=Result+pchar(fLine)[fLinePos];
+    Result:=Result+PAnsiChar(fLine)[fLinePos];
     inc(fLinePos);
     inc(fLinePos);
   end;
   end;
 end;
 end;
@@ -111,7 +111,7 @@ end;
 procedure TDfmResourceReader.ReadLine(aStream : TStream);
 procedure TDfmResourceReader.ReadLine(aStream : TStream);
 const CR = #13;
 const CR = #13;
       LF = #10;
       LF = #10;
-var c : char;
+var c : AnsiChar;
 begin
 begin
   fLine:='';
   fLine:='';
   
   
@@ -125,7 +125,7 @@ end;
 
 
 (*should be:  object Name: Type  or inherited Name: Type*)
 (*should be:  object Name: Type  or inherited Name: Type*)
 function TDfmResourceReader.CheckTextDfm(aStream: TStream): boolean;
 function TDfmResourceReader.CheckTextDfm(aStream: TStream): boolean;
-var tmp : string;
+var tmp : ansistring;
 begin
 begin
   Result:=false;
   Result:=false;
   fLine:='';
   fLine:='';
@@ -138,7 +138,7 @@ begin
   if (tmp <> 'object') and (tmp<>'inherited') then exit;
   if (tmp <> 'object') and (tmp<>'inherited') then exit;
   if GetIdent='' then exit;
   if GetIdent='' then exit;
   SkipSpaces;
   SkipSpaces;
-  if pchar(fLine)[fLinePos]<>':' then exit;
+  if PAnsiChar(fLine)[fLinePos]<>':' then exit;
   inc(fLinePos);
   inc(fLinePos);
   SkipSpaces;
   SkipSpaces;
   fObjectName:=UpperCase(GetIdent);
   fObjectName:=UpperCase(GetIdent);

+ 3 - 3
packages/fcl-res/src/elfreader.pp

@@ -78,7 +78,7 @@ type
 
 
     function FindSection(const aName : string) : integer; virtual; abstract;
     function FindSection(const aName : string) : integer; virtual; abstract;
     function FindResSection : boolean;
     function FindResSection : boolean;
-    function ReadString(aStream : TStream; aPos : longword) : string;
+    function ReadString(aStream : TStream; aPos : longword) : AnsiString;
     procedure ReadNode(aStream : TStream; aParent : TResourceTreeNode;
     procedure ReadNode(aStream : TStream; aParent : TResourceTreeNode;
       aResources : TResources; named : boolean); virtual; abstract;
       aResources : TResources; named : boolean); virtual; abstract;
     procedure ReadResData(aStream : TStream; aNode : TResourceTreeNode;
     procedure ReadResData(aStream : TStream; aNode : TResourceTreeNode;
@@ -155,9 +155,9 @@ begin
 end;
 end;
 
 
 function TAbstractElfSubReader.ReadString(aStream: TStream; aPos: longword
 function TAbstractElfSubReader.ReadString(aStream: TStream; aPos: longword
-  ): string;
+  ): AnsiString;
 var oldpos : int64;
 var oldpos : int64;
-    c : char;
+    c : AnsiChar;
     maxleft : int64;
     maxleft : int64;
 begin
 begin
   Result:='';
   Result:='';

+ 1 - 1
packages/fcl-res/src/elftypes.pp

@@ -20,7 +20,7 @@ unit elftypes;
 interface
 interface
 
 
 type
 type
-  TElfMagic = array[0..3] of char;
+  TElfMagic = array[0..3] of AnsiChar;
 
 
 type
 type
   TElfIdent = packed record
   TElfIdent = packed record

+ 1 - 1
packages/fcl-res/src/externalreader.pp

@@ -64,7 +64,7 @@ uses
 function TExternalResourceReader.ReadString(aStream: TStream; aOfs: longword
 function TExternalResourceReader.ReadString(aStream: TStream; aOfs: longword
   ): string;
   ): string;
 var oldpos : int64;
 var oldpos : int64;
-    c : char;
+    c : AnsiChar;
     maxleft : int64;
     maxleft : int64;
 begin
 begin
   Result:='';
   Result:='';

+ 1 - 1
packages/fcl-res/src/externaltypes.pp

@@ -20,7 +20,7 @@ unit externaltypes;
 interface
 interface
 
 
 type
 type
-  TExternalResMagic = array[1..6] of char;
+  TExternalResMagic = array[1..6] of AnsiChar;
 
 
 type
 type
   TExtHeader = packed record
   TExtHeader = packed record

+ 1 - 1
packages/fcl-res/src/machoreader.pp

@@ -121,7 +121,7 @@ Generics don't work with record types, so use macros to do this task
 function TAbstractMachOSubReader.ReadString(aStream: TStream; aPos: longword
 function TAbstractMachOSubReader.ReadString(aStream: TStream; aPos: longword
   ): string;
   ): string;
 var oldpos : int64;
 var oldpos : int64;
-    c : char;
+    c : AnsiChar;
     maxleft : int64;
     maxleft : int64;
 begin
 begin
   Result:='';
   Result:='';

+ 1 - 1
packages/fcl-res/src/machotypes.pp

@@ -32,7 +32,7 @@ type
   TMachOSubMachineTypex64 = (msmx64_all, msmx64_haswell);
   TMachOSubMachineTypex64 = (msmx64_all, msmx64_haswell);
   TMachOSubMachineTypeArm = (msmarm_all,msmarm_v4t,msmarm_v6,msmarm_v5tej,msmarm_xscale,msmarm_v7);
   TMachOSubMachineTypeArm = (msmarm_all,msmarm_v4t,msmarm_v6,msmarm_v5tej,msmarm_xscale,msmarm_v7);
   TMachOSubMachineTypeAarch64 = (msmaarch64_all, msmaarch64_v8, msmaarch64_e);
   TMachOSubMachineTypeAarch64 = (msmaarch64_all, msmaarch64_v8, msmaarch64_e);
-  TSegSectName = array[0..15] of char;
+  TSegSectName = array[0..15] of AnsiChar;
 
 
   TMachOSubMachineType = record
   TMachOSubMachineType = record
     case TMachOMachineType of
     case TMachOMachineType of

+ 1 - 1
packages/fcl-res/src/rclex.inc

@@ -154,7 +154,7 @@ end(*yyaction*);
 (* DFA table: *)
 (* DFA table: *)
 
 
 type YYTRec = record
 type YYTRec = record
-                cc : set of Char;
+                cc : set of AnsiChar;
                 s  : Integer;
                 s  : Integer;
               end;
               end;
 
 

+ 13 - 13
packages/fcl-res/src/rcparserfn.inc

@@ -25,7 +25,7 @@ uses
   bitmapresource, versionresource, versiontypes, groupcursorresource;
   bitmapresource, versionresource, versiontypes, groupcursorresource;
 
 
 type
 type
-  TStringHashTable = specialize TFPGMap<String, String>;
+  TStringHashTable = specialize TFPGMap<AnsiString, AnsiString>;
 
 
 function yyparse : Integer;
 function yyparse : Integer;
 
 
@@ -46,7 +46,7 @@ procedure PragmaCodePage(cp: string);
 
 
 implementation
 implementation
 
 
-procedure yyerror ( msg : String );
+procedure yyerror ( msg : AnsiString );
 begin
 begin
   writeln(ErrOutput, yyfilename, '(',yylineno,':',yycolno,'): at "',yytext,'": ', msg);
   writeln(ErrOutput, yyfilename, '(',yylineno,':',yycolno,'): at "',yytext,'": ', msg);
   WriteLn(ErrOutput, yyline);
   WriteLn(ErrOutput, yyline);
@@ -64,9 +64,9 @@ const max_chars = 2048;
 
 
 var
 var
   bufptr : Integer;
   bufptr : Integer;
-  buf    : array [1..max_chars] of Char;
+  buf    : array [1..max_chars] of AnsiChar;
 
 
-function rc_get_char : Char;
+function rc_get_char : AnsiChar;
   var i : Integer;
   var i : Integer;
       ok : boolean;
       ok : boolean;
   begin
   begin
@@ -94,7 +94,7 @@ function rc_get_char : Char;
       rc_get_char := #0;
       rc_get_char := #0;
   end(*get_char*);
   end(*get_char*);
 
 
-procedure rc_unget_char ( c : Char );
+procedure rc_unget_char ( c : AnsiChar );
   begin
   begin
     if bufptr=max_chars then yyerror('input buffer overflow');
     if bufptr=max_chars then yyerror('input buffer overflow');
     inc(bufptr);
     inc(bufptr);
@@ -102,7 +102,7 @@ procedure rc_unget_char ( c : Char );
     buf[bufptr] := c;
     buf[bufptr] := c;
   end(*unget_char*);
   end(*unget_char*);
 
 
-procedure unget_string(s: string);
+procedure unget_string(s: ansistring);
 var
 var
   i: integer;
   i: integer;
 begin
 begin
@@ -110,7 +110,7 @@ begin
     rc_unget_char(s[i]);
     rc_unget_char(s[i]);
 end;
 end;
 
 
-procedure PragmaCodePage(cp: string);
+procedure PragmaCodePage(cp: ansistring);
 var cpi: integer;
 var cpi: integer;
 begin
 begin
   if Uppercase(cp) = 'DEFAULT' then
   if Uppercase(cp) = 'DEFAULT' then
@@ -134,7 +134,7 @@ type
     cp: TSystemCodePage;
     cp: TSystemCodePage;
   end;
   end;
 
 
-function str_to_cbase(s: string): LongWord;
+function str_to_cbase(s: ansistring): LongWord;
 begin
 begin
   if s = '0' then
   if s = '0' then
     Exit(0);
     Exit(0);
@@ -147,7 +147,7 @@ begin
   Result:= StrToInt(s);
   Result:= StrToInt(s);
 end;
 end;
 
 
-function str_to_num(s:string): rcnumtype;
+function str_to_num(s:ansistring): rcnumtype;
 begin
 begin
   // this does not handle empty strings - should never get them from the lexer
   // this does not handle empty strings - should never get them from the lexer
   Result.long:= s[Length(s)] = 'L';
   Result.long:= s[Length(s)] = 'L';
@@ -166,7 +166,7 @@ type
 const
 const
   MAX_RCSTR_LEN = 4096;
   MAX_RCSTR_LEN = 4096;
 var
 var
-  strbuf: array[0..MAX_RCSTR_LEN + 1] of char;
+  strbuf: array[0..MAX_RCSTR_LEN + 1] of AnsiChar;
   strbuflen: Integer;
   strbuflen: Integer;
   stringpool: PStrPoolItem = nil;
   stringpool: PStrPoolItem = nil;
 
 
@@ -176,7 +176,7 @@ begin
   strbuflen:= 0;
   strbuflen:= 0;
 end;
 end;
 
 
-procedure strbuf_append(s: string);
+procedure strbuf_append(s: ansistring);
 var
 var
   rem: integer;
   rem: integer;
 begin
 begin
@@ -256,7 +256,7 @@ begin
             if cp = CP_UTF16 then
             if cp = CP_UTF16 then
               wc^:= WideChar(StrToInt(h))
               wc^:= WideChar(StrToInt(h))
             else
             else
-              wc^:= translateChar(Char(StrToInt(h)));
+              wc^:= translateChar(AnsiChar(StrToInt(h)));
           end;
           end;
           '0'..'7': begin
           '0'..'7': begin
             h:= '&' + rc^;
             h:= '&' + rc^;
@@ -271,7 +271,7 @@ begin
             if cp = CP_UTF16 then
             if cp = CP_UTF16 then
               wc^:= WideChar(StrToInt(h))
               wc^:= WideChar(StrToInt(h))
             else
             else
-              wc^:= translateChar(Char(StrToInt(h)));
+              wc^:= translateChar(AnsiChar(StrToInt(h)));
           end;
           end;
         else
         else
           wc^:= translateChar(rc^);
           wc^:= translateChar(rc^);

+ 7 - 7
packages/fcl-res/src/strtable.pp

@@ -35,7 +35,7 @@ type
   public
   public
     constructor Create;
     constructor Create;
     destructor Destroy; override;
     destructor Destroy; override;
-    function Add(s : string) : longword;
+    function Add(s : AnsiString) : longword;
     procedure Clear;
     procedure Clear;
     procedure WriteToStream(aStream : TStream);
     procedure WriteToStream(aStream : TStream);
     property StartOfs : longword read fStartOfs write fStartOfs;
     property StartOfs : longword read fStartOfs write fStartOfs;
@@ -54,8 +54,8 @@ type
   public
   public
     constructor Create(aStream : TStream; aSize : longword);
     constructor Create(aStream : TStream; aSize : longword);
     destructor Destroy; override;
     destructor Destroy; override;
-    function Get(aOffset : longword) : string;
-    function Add(aString : string) : longword;
+    function Get(aOffset : longword) : AnsiString;
+    function Add(aString : AnsiString) : longword;
     procedure Clear;
     procedure Clear;
     procedure WriteToStream(aStream : TStream);
     procedure WriteToStream(aStream : TStream);
     property Size : longword read GetSize;
     property Size : longword read GetSize;
@@ -86,7 +86,7 @@ begin
   fData.Free;
   fData.Free;
 end;
 end;
 
 
-function TResStringTable.Add(s: string): longword;
+function TResStringTable.Add(s: AnsiString): longword;
 var b : byte;
 var b : byte;
 begin
 begin
   fUsed:=true;
   fUsed:=true;
@@ -146,8 +146,8 @@ begin
   fData.Free;
   fData.Free;
 end;
 end;
 
 
-function TObjectStringTable.Get(aOffset: longword): string;
-var c : char;
+function TObjectStringTable.Get(aOffset: longword): AnsiString;
+var c : AnsiChar;
 begin
 begin
   Result:='';
   Result:='';
   fData.Position:=aOffset;
   fData.Position:=aOffset;
@@ -157,7 +157,7 @@ begin
   until (c=#0) or (fData.Position>=fData.Size);
   until (c=#0) or (fData.Position>=fData.Size);
 end;
 end;
 
 
-function TObjectStringTable.Add(aString: string) : longword;
+function TObjectStringTable.Add(aString: AnsiString) : longword;
 var b : byte;
 var b : byte;
 begin
 begin
   Result:=fData.Position;
   Result:=fData.Position;

+ 1 - 1
packages/fcl-res/src/tlbreader.pp

@@ -47,7 +47,7 @@ uses
   resdatastream, resfactory;
   resdatastream, resfactory;
 
 
 type
 type
-  TSignature = array[0..3] of char;
+  TSignature = array[0..3] of AnsiChar;
 
 
 const
 const
   TypeLibSig1 = 'MSFT';
   TypeLibSig1 = 'MSFT';

+ 2 - 2
packages/fcl-res/src/xcoffwriter.pp

@@ -41,7 +41,7 @@ type
     procedure WriteNodeInfo(aStream: TStream; aNode: TResourceTreeNode);
     procedure WriteNodeInfo(aStream: TStream; aNode: TResourceTreeNode);
     procedure WriteSubNodes(aStream : TStream; aNode : TResourceTreeNode);
     procedure WriteSubNodes(aStream : TStream; aNode : TResourceTreeNode);
     procedure WriteResStringTable(aStream: TStream); override;
     procedure WriteResStringTable(aStream: TStream); override;
-    procedure WriteDataSymbol(aStream: TStream; const name: String; aStorageClass, aAuxStorageType: byte; aSecNum, aSecOffset, aSize: qword);
+    procedure WriteDataSymbol(aStream: TStream; const name: AnsiString; aStorageClass, aAuxStorageType: byte; aSecNum, aSecOffset, aSize: qword);
     procedure WriteSymbolTable(aStream : TStream; aResources : TResources); override;
     procedure WriteSymbolTable(aStream : TStream; aResources : TResources); override;
     procedure WriteResHeader(aStream : TStream; aResources : TResources);
     procedure WriteResHeader(aStream : TStream; aResources : TResources);
     procedure Write(aResources : TResources; aStream : TStream); override;
     procedure Write(aResources : TResources; aStream : TStream); override;
@@ -275,7 +275,7 @@ begin
   Align(fDataAlignment,aStream);
   Align(fDataAlignment,aStream);
 end;
 end;
 
 
-procedure TXCoffResourceWriter.WriteDataSymbol(aStream: TStream; const name: String; aStorageClass, aAuxStorageType: byte; aSecNum, aSecOffset, aSize: qword);
+procedure TXCoffResourceWriter.WriteDataSymbol(aStream: TStream; const name: AnsiString; aStorageClass, aAuxStorageType: byte; aSecNum, aSecOffset, aSize: qword);
 var
 var
   st : TCoffSymtableEntry;
   st : TCoffSymtableEntry;
   aux : TXCoffAuxSymbol32;
   aux : TXCoffAuxSymbol32;

+ 3 - 3
packages/fcl-res/src/yyinclude.pp

@@ -23,7 +23,7 @@ type
   var
   var
     stack: array[0..yi_maxlevels] of record
     stack: array[0..yi_maxlevels] of record
       yyinput           : Text;        (* input and output file *)
       yyinput           : Text;        (* input and output file *)
-      yyline            : String;      (* current input line *)
+      yyline            : AnsiString;      (* current input line *)
       yylineno, yycolno : Integer;     (* current input position *)
       yylineno, yycolno : Integer;     (* current input position *)
       fn                : AnsiString;
       fn                : AnsiString;
       prev_wrap         : yywrap_t;
       prev_wrap         : yywrap_t;
@@ -50,7 +50,7 @@ begin
   Result:= yinclude.pop;
   Result:= yinclude.pop;
 end;
 end;
 
 
-function tyinclude.push(const incfile: ansistring): Boolean;
+function tyinclude.push(const incfile: string): Boolean;
 begin
 begin
   stack[level].yyinput:= yyinput;
   stack[level].yyinput:= yyinput;
   stack[level].yyline:= yyline;
   stack[level].yyline:= yyline;
@@ -90,7 +90,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-function tyinclude.expand(fn: AnsiString): AnsiString;
+function tyinclude.expand(fn: string): string;
 var
 var
   i: integer;
   i: integer;
   f: string;
   f: string;