Browse Source

* Char -> AnsiChar

Michael VAN CANNEYT 2 years ago
parent
commit
4336599c3a

+ 44 - 44
rtl/objpas/sysutils/dati.inc

@@ -371,7 +371,7 @@ end;
     if S does not represent a valid date value
     an EConvertError will be raised   }
 
-function IntStrToDate(Out ErrorMsg : AnsiString; const S: PChar; Len : integer; const useformat : string; const defs:TFormatSettings; separator : char = #0): TDateTime;
+function IntStrToDate(Out ErrorMsg : AnsiString; const S: PAnsiChar; Len : integer; const useformat : string; const defs:TFormatSettings; separator : AnsiChar = #0): TDateTime;
 
 const SInvalidDateFormat = '"%s" is not a valid date format';
 
@@ -527,7 +527,7 @@ begin
     errormsg:='Invalid date';
 end;
 
-function StrToDate(const S: PChar; Len : integer; const useformat : string; separator : char = #0): TDateTime;
+function StrToDate(const S: PAnsiChar; Len : integer; const useformat : string; separator : AnsiChar = #0): TDateTime;
 
 Var
   MSg : AnsiString;
@@ -542,23 +542,23 @@ function StrToDate(const S: string; FormatSettings: TFormatSettings): TDateTime;
 var
   Msg: AnsiString;
 begin
-  Result:=IntStrToDate(Msg,PChar(S),Length(S),FormatSettings.ShortDateFormat,FormatSettings);
+  Result:=IntStrToDate(Msg,PAnsiChar(S),Length(S),FormatSettings.ShortDateFormat,FormatSettings);
   if Msg<>'' then
     raise EConvertError.Create(Msg);
 end;
 
-function StrToDate(const S: ShortString; const useformat : string; separator : char = #0): TDateTime;
+function StrToDate(const S: ShortString; const useformat : string; separator : AnsiChar = #0): TDateTime;
 begin
   // S[1] always exists for shortstring. Length 0 will trigger an error.
   result := StrToDate(@S[1],Length(s),UseFormat,separator);
 end;
 
-function StrToDate(const S: AnsiString; const useformat : string; separator : char = #0): TDateTime;
+function StrToDate(const S: AnsiString; const useformat : string; separator : AnsiChar = #0): TDateTime;
 begin
-  result := StrToDate(PChar(S),Length(s),UseFormat,separator);
+  result := StrToDate(PAnsiChar(S),Length(s),UseFormat,separator);
 end;
 
-function StrToDate(const S: ShortString; separator : char): TDateTime;
+function StrToDate(const S: ShortString; separator : AnsiChar): TDateTime;
 begin
   // S[1] always exists for shortstring. Length 0 will trigger an error.
   result := StrToDate(@S[1],Length(s),DefaultFormatSettings.ShortDateFormat,separator)
@@ -570,14 +570,14 @@ begin
   result := StrToDate(@S[1],Length(s),DefaultFormatSettings.ShortDateFormat,#0);
 end;
 
-function StrToDate(const S: AnsiString; separator : char): TDateTime;
+function StrToDate(const S: AnsiString; separator : AnsiChar): TDateTime;
 begin
-    result := StrToDate(Pchar(S),Length(s),DefaultFormatSettings.ShortDateFormat,separator)
+    result := StrToDate(PAnsiChar(S),Length(s),DefaultFormatSettings.ShortDateFormat,separator)
 end;
 
 function StrToDate(const S: AnsiString): TDateTime;
 begin
-  result := StrToDate(Pchar(S),Length(s),DefaultFormatSettings.ShortDateFormat,#0);
+  result := StrToDate(PAnsiChar(S),Length(s),DefaultFormatSettings.ShortDateFormat,#0);
 end;
 
 {   StrToTime converts the string S to a TDateTime value
@@ -585,7 +585,7 @@ end;
     EConvertError will be raised   }
 
 
-function IntStrToTime(Out ErrorMsg : AnsiString; const S: PChar; Len : integer;const defs:TFormatSettings; separator : char = #0): TDateTime;
+function IntStrToTime(Out ErrorMsg : AnsiString; const S: PAnsiChar; Len : integer;const defs:TFormatSettings; separator : AnsiChar = #0): TDateTime;
 const
   AMPM_None = 0;
   AMPM_AM = 1;
@@ -600,7 +600,7 @@ var
    AmPm: integer;
    TimeValues: TTimeValues;
 
-    function StrPas(Src : PChar; len: integer = 0) : ShortString;
+    function StrPas(Src : PAnsiChar; len: integer = 0) : ShortString;
     begin
         //this is unsafe for len > 255, it will trash memory (I tested this)
         //reducing it is safe, since whenever we use this a string > 255 is invalid anyway
@@ -618,7 +618,7 @@ var
       Value: Word;
       DigitPending, MSecPending: Boolean;
       AmPmStr: ShortString;
-      CurChar: Char;
+      CurChar: AnsiChar;
    begin
      Result := False;
      AmPm := AMPM_None; //No Am or PM in string found yet
@@ -690,7 +690,7 @@ var
        end
        else
        begin//AM/PM?
-         //None of the above, so this char _must_ be the start of AM/PM string
+         //None of the above, so this AnsiChar _must_ be the start of AM/PM string
          //If we already have found AM/PM or we expect a digit then then timestring must be wrong at this point
          //writeln('AM/PM?');
          if (AmPm <> AMPM_None) or DigitPending then Exit;
@@ -749,7 +749,7 @@ begin
     ErrorMsg:=Format(SErrInvalidTimeFormat,[StrPas(S, Len)]);
 end ;
 
-function StrToTime(const S: PChar; Len : integer; separator : char = #0): TDateTime;
+function StrToTime(const S: PAnsiChar; Len : integer; separator : AnsiChar = #0): TDateTime;
 
 Var
   Msg : AnsiString;
@@ -764,20 +764,20 @@ function StrToTime(const S: string; FormatSettings : TFormatSettings): TDateTime
 Var
   Msg : AnsiString;
 begin
-  Result:=IntStrToTime(Msg, PChar(S), length(S), FormatSettings, #0);
+  Result:=IntStrToTime(Msg, PAnsiChar(S), length(S), FormatSettings, #0);
   If (Msg<>'') then
     Raise EConvertError.Create(Msg);
 end;
 
-function StrToTime(const s: ShortString; separator : char): TDateTime;
+function StrToTime(const s: ShortString; separator : AnsiChar): TDateTime;
 begin
   // S[1] always exists for shortstring. Length 0 will trigger an error.
   result := StrToTime(@s[1], length(s), separator);
 end;
 
-function StrToTime(const s: AnsiString; separator : char): TDateTime;
+function StrToTime(const s: AnsiString; separator : AnsiChar): TDateTime;
 begin
-   result := StrToTime(PChar(S), length(s), separator);
+   result := StrToTime(PAnsiChar(S), length(s), separator);
 end;
 
 function StrToTime(const s: ShortString): TDateTime;
@@ -788,7 +788,7 @@ end;
 
 function StrToTime(const s: AnsiString): TDateTime;
 begin
-   result:= StrToTime(PChar(s), length(s), #0);
+   result:= StrToTime(PAnsiChar(s), length(s), #0);
 end;
 
 {   StrToDateTime converts the string S to a TDateTime value
@@ -925,8 +925,8 @@ procedure DateTimeToString(out Result: string; const FormatStr: string; const Da
   const FormatSettings: TFormatSettings; Options : TFormatDateTimeOptions = []);
 var
   ResultLen: integer;
-  ResultBuffer: array[0..255] of char;
-  ResultCurrent: pchar;
+  ResultBuffer: array[0..255] of AnsiChar;
+  ResultCurrent: PAnsiChar;
 {$if defined(win32) or defined(win64)}
   isEnable_E_Format : Boolean;
   isEnable_G_Format : Boolean;
@@ -964,7 +964,7 @@ var
   end;
 {$endif win32 or win64}
 
-  procedure StoreStr(Str: PChar; Len: Integer);
+  procedure StoreStr(Str: PAnsiChar; Len: Integer);
   begin
     if ResultLen + Len < SizeOf(ResultBuffer) then
     begin
@@ -980,7 +980,7 @@ var
    Len := Length(Str);
    if ResultLen + Len < SizeOf(ResultBuffer) then
      begin
-       StrMove(ResultCurrent, pchar(Str), Len);
+       StrMove(ResultCurrent, PAnsiChar(Str), Len);
        ResultCurrent := ResultCurrent + Len;
        ResultLen := ResultLen + Len;
      end;
@@ -999,7 +999,7 @@ var
       else
         Break;
     end;
-    StoreStr(pchar(@S[1]), Length(S));
+    StoreStr(PAnsiChar(@S[1]), Length(S));
   end ;
 
 var
@@ -1015,12 +1015,12 @@ var
 
   procedure StoreFormat(const FormatStr: string; Nesting: Integer; TimeFlag: Boolean);
   var
-    Token, lastformattoken, prevlasttoken: char;
-    FormatCurrent: pchar;
-    FormatEnd: pchar;
+    Token, lastformattoken, prevlasttoken: AnsiChar;
+    FormatCurrent: PAnsiChar;
+    FormatEnd: PAnsiChar;
     Count: integer;
     Clock12: boolean;
-    P: pchar;
+    P: PAnsiChar;
     tmp: integer;
     isInterval: Boolean;
 
@@ -1028,7 +1028,7 @@ var
     if Nesting > 1 then  // 0 is original string, 1 is included FormatString
       Exit;
 
-    FormatCurrent := PChar(FormatStr);
+    FormatCurrent := PAnsiChar(FormatStr);
     FormatEnd := FormatCurrent + Length(FormatStr);
     Clock12 := false;
     isInterval := false;
@@ -1346,7 +1346,7 @@ begin
 end;
 
 function TryStrToDate(const S: ShortString; out Value: TDateTime;
-                    const useformat : string; separator : char = #0): Boolean;
+                    const useformat : string; separator : AnsiChar = #0): Boolean;
 
 Var
   Msg : Ansistring;
@@ -1358,7 +1358,7 @@ begin
 end;
 
 function TryStrToDate(const S: AnsiString; out Value: TDateTime;
-                    const useformat : string; separator : char = #0): Boolean;
+                    const useformat : string; separator : AnsiChar = #0): Boolean;
 
 Var
   Msg : Ansistring;
@@ -1367,12 +1367,12 @@ begin
   Result:=Length(S)<>0;
   If Result then
     begin
-    Value:=IntStrToDate(Msg,PChar(S),Length(S),useformat,DefaultFormatSettings,Separator);
+    Value:=IntStrToDate(Msg,PAnsiChar(S),Length(S),useformat,DefaultFormatSettings,Separator);
     Result:=(Msg='');
     end;
 end;
 
-function TryStrToDate(const S: ShortString; out Value: TDateTime; separator : char): Boolean;
+function TryStrToDate(const S: ShortString; out Value: TDateTime; separator : AnsiChar): Boolean;
 begin
   Result:=TryStrToDate(S,Value,DefaultFormatSettings.ShortDateFormat,Separator);
 end;
@@ -1383,7 +1383,7 @@ begin
   Result:=TryStrToDate(S,Value,DefaultFormatSettings.ShortDateFormat,#0);
 end;
 
-function TryStrToDate(const S: AnsiString; out Value: TDateTime; separator : char): Boolean;
+function TryStrToDate(const S: AnsiString; out Value: TDateTime; separator : AnsiChar): Boolean;
 
 begin
   Result:=TryStrToDate(S,Value,DefaultFormatSettings.ShortDateFormat,Separator);
@@ -1397,12 +1397,12 @@ begin
   Result:=Length(S)<>0;
   If Result then
     begin
-      Value:=IntStrToDate(Msg,PChar(S),Length(S),FormatSettings.ShortDateFormat,FormatSettings,#0);
+      Value:=IntStrToDate(Msg,PAnsiChar(S),Length(S),FormatSettings.ShortDateFormat,FormatSettings,#0);
       Result:=(Msg='');
     end;
 end;
 
-function TryStrToTime(const S: ShortString; out Value: TDateTime; separator : char): Boolean;
+function TryStrToTime(const S: ShortString; out Value: TDateTime; separator : AnsiChar): Boolean;
 
 Var
   Msg : AnsiString;
@@ -1417,14 +1417,14 @@ begin
   Result := TryStrToTime(S,Value,#0);
 end;
 
-function TryStrToTime(const S: AnsiString; out Value: TDateTime; separator : char): Boolean;
+function TryStrToTime(const S: AnsiString; out Value: TDateTime; separator : AnsiChar): Boolean;
 Var
   Msg : AnsiString;
 begin
   Result:=Length(S)<>0;
   If Result then
     begin
-      Value:=IntStrToTime(Msg,PChar(S),Length(S),DefaultFormatSettings,Separator);
+      Value:=IntStrToTime(Msg,PAnsiChar(S),Length(S),DefaultFormatSettings,Separator);
       Result:=(Msg='');
     end;
 end;
@@ -1440,7 +1440,7 @@ begin
   Result:=Length(S)<>0;
   If Result then
     begin
-      Value:=IntStrToTime(Msg,PChar(S),Length(S),FormatSettings,#0);
+      Value:=IntStrToTime(Msg,PAnsiChar(S),Length(S),FormatSettings,#0);
       Result:=(Msg='');
     end;
 end;
@@ -1503,13 +1503,13 @@ begin
     result:=defvalue;
 end;
 
-function StrToDateDef(const S: ShortString; const Defvalue : TDateTime; separator : char): TDateTime;
+function StrToDateDef(const S: ShortString; const Defvalue : TDateTime; separator : AnsiChar): TDateTime;
 begin
   if not TryStrToDate(s,Result, separator) Then
     result:=defvalue;
 end;
 
-function StrToTimeDef(const S: ShortString; const Defvalue : TDateTime; separator : char): TDateTime;
+function StrToTimeDef(const S: ShortString; const Defvalue : TDateTime; separator : AnsiChar): TDateTime;
 begin
   if not TryStrToTime(s,Result, separator) Then
     result:=defvalue;
@@ -1531,13 +1531,13 @@ begin
     result:=defvalue;
 end;
 
-function StrToDateDef(const S: AnsiString; const Defvalue : TDateTime; separator : char): TDateTime;
+function StrToDateDef(const S: AnsiString; const Defvalue : TDateTime; separator : AnsiChar): TDateTime;
 begin
   if not TryStrToDate(s,Result, separator) Then
     result:=defvalue;
 end;
 
-function StrToTimeDef(const S: AnsiString; const Defvalue : TDateTime; separator : char): TDateTime;
+function StrToTimeDef(const S: AnsiString; const Defvalue : TDateTime; separator : AnsiChar): TDateTime;
 begin
   if not TryStrToTime(s,Result, separator) Then
     result:=defvalue;

+ 18 - 18
rtl/objpas/sysutils/datih.inc

@@ -140,18 +140,18 @@ function DateTimeToStr(DateTime: TDateTime; ForceTimeIfZero : Boolean = False):
 function DateTimeToStr(DateTime: TDateTime; const FormatSettings: TFormatSettings; ForceTimeIfZero : Boolean = False): string;
 function StrToDate(const S: ShortString): TDateTime;                  {$ifdef SYSUTILSINLINE}inline;{$endif}
 function StrToDate(const S: Ansistring): TDateTime;                   {$ifdef SYSUTILSINLINE}inline;{$endif}
-function StrToDate(const S: ShortString; separator : char): TDateTime;{$ifdef SYSUTILSINLINE}inline;{$endif}
-function StrToDate(const S: AnsiString; separator : char): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
+function StrToDate(const S: ShortString; separator : AnsiChar): TDateTime;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function StrToDate(const S: AnsiString; separator : AnsiChar): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
 function StrToDate(const S: string; FormatSettings : TFormatSettings): TDateTime;
 function StrToTime(const S: Shortstring): TDateTime;                  {$ifdef SYSUTILSINLINE}inline;{$endif}
 function StrToTime(const S: Ansistring): TDateTime;                   {$ifdef SYSUTILSINLINE}inline;{$endif}
-function StrToTime(const S: ShortString; separator : char): TDateTime;{$ifdef SYSUTILSINLINE}inline;{$endif}
-function StrToTime(const S: AnsiString; separator : char): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
+function StrToTime(const S: ShortString; separator : AnsiChar): TDateTime;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function StrToTime(const S: AnsiString; separator : AnsiChar): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
 function StrToTime(const S: string; FormatSettings : TFormatSettings): TDateTime;
-function StrToDate(const S: ShortString; const useformat : string; separator : char = #0): TDateTime;{$ifdef SYSUTILSINLINE}inline;{$endif}
-function StrToDate(const S: AnsiString; const useformat : string; separator : char = #0): TDateTime;{$ifdef SYSUTILSINLINE}inline;{$endif}
-function StrToTime(const S: PChar; Len : integer; separator : char = #0): TDateTime;
-function StrToDate(const S: PChar; Len : integer; const useformat : string; separator : char = #0): TDateTime;
+function StrToDate(const S: ShortString; const useformat : string; separator : AnsiChar = #0): TDateTime;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function StrToDate(const S: AnsiString; const useformat : string; separator : AnsiChar = #0): TDateTime;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function StrToTime(const S: PAnsiChar; Len : integer; separator : AnsiChar = #0): TDateTime;
+function StrToDate(const S: PAnsiChar; Len : integer; const useformat : string; separator : AnsiChar = #0): TDateTime;
 function StrToDateTime(const S: AnsiString): TDateTime;
 function StrToDateTime(const s: ShortString; const FormatSettings : TFormatSettings): TDateTime;
 function StrToDateTime(const s: AnsiString; const FormatSettings : TFormatSettings): TDateTime;
@@ -165,16 +165,16 @@ Function FileDateToDateTime (Filedate : Int64) :TDateTime;
 Function FileDateToUniversal (Filedate : Int64) :TDateTime;
 function TryStrToDate(const S: ShortString; out Value: TDateTime): Boolean;                         {$ifdef SYSUTILSINLINE}inline;{$endif}
 function TryStrToDate(const S: AnsiString; out Value: TDateTime): Boolean;                         {$ifdef SYSUTILSINLINE}inline;{$endif}
-function TryStrToDate(const S: ShortString; out Value: TDateTime; separator : char): Boolean;
-function TryStrToDate(const S: AnsiString; out Value: TDateTime; separator : char): Boolean;
+function TryStrToDate(const S: ShortString; out Value: TDateTime; separator : AnsiChar): Boolean;
+function TryStrToDate(const S: AnsiString; out Value: TDateTime; separator : AnsiChar): Boolean;
 function TryStrToTime(const S: ShortString; out Value: TDateTime): Boolean;                         {$ifdef SYSUTILSINLINE}inline;{$endif}
 function TryStrToTime(const S: AnsiString; out Value: TDateTime): Boolean;                         {$ifdef SYSUTILSINLINE}inline;{$endif}
-function TryStrToTime(const S: ShortString; out Value: TDateTime; separator : char): Boolean;
-function TryStrToTime(const S: AnsiString; out Value: TDateTime; separator : char): Boolean;
+function TryStrToTime(const S: ShortString; out Value: TDateTime; separator : AnsiChar): Boolean;
+function TryStrToTime(const S: AnsiString; out Value: TDateTime; separator : AnsiChar): Boolean;
 function TryStrToDate(const S: ShortString; out Value: TDateTime;
-                        const useformat : string; separator : char = #0): Boolean;
+                        const useformat : string; separator : AnsiChar = #0): Boolean;
 function TryStrToDate(const S: AnsiString; out Value: TDateTime;
-                        const useformat : string; separator : char = #0): Boolean;
+                        const useformat : string; separator : AnsiChar = #0): Boolean;
 function TryStrToDateTime(const S: ShortString; out Value: TDateTime): Boolean;
 function TryStrToDateTime(const S: AnsiString; out Value: TDateTime): Boolean;
 
@@ -183,15 +183,15 @@ function TryStrToTime(const S: string; out Value: TDateTime; const FormatSetting
 function TryStrToDateTime(const S: string; out Value: TDateTime; const FormatSettings: TFormatSettings): Boolean;
 
 function StrToDateDef(const S: ShortString; const Defvalue : TDateTime): TDateTime;                   {$ifdef SYSUTILSINLINE}inline;{$endif}
-function StrToDateDef(const S: ShortString; const Defvalue : TDateTime; separator : char): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
+function StrToDateDef(const S: ShortString; const Defvalue : TDateTime; separator : AnsiChar): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
 function StrToTimeDef(const S: ShortString; const Defvalue : TDateTime): TDateTime;                   {$ifdef SYSUTILSINLINE}inline;{$endif}
-function StrToTimeDef(const S: ShortString; const Defvalue : TDateTime; separator : char): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
+function StrToTimeDef(const S: ShortString; const Defvalue : TDateTime; separator : AnsiChar): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
 function StrToDateTimeDef(const S: ShortString; const Defvalue : TDateTime): TDateTime;               {$ifdef SYSUTILSINLINE}inline;{$endif}
 
 function StrToDateDef(const S: AnsiString; const Defvalue : TDateTime): TDateTime;                   {$ifdef SYSUTILSINLINE}inline;{$endif}
-function StrToDateDef(const S: AnsiString; const Defvalue : TDateTime; separator : char): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
+function StrToDateDef(const S: AnsiString; const Defvalue : TDateTime; separator : AnsiChar): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
 function StrToTimeDef(const S: AnsiString; const Defvalue : TDateTime): TDateTime;                   {$ifdef SYSUTILSINLINE}inline;{$endif}
-function StrToTimeDef(const S: AnsiString; const Defvalue : TDateTime; separator : char): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
+function StrToTimeDef(const S: AnsiString; const Defvalue : TDateTime; separator : AnsiChar): TDateTime; {$ifdef SYSUTILSINLINE}inline;{$endif}
 function StrToDateTimeDef(const S: AnsiString; const Defvalue : TDateTime): TDateTime;               {$ifdef SYSUTILSINLINE}inline;{$endif}
 function StrToDateTimeDef(const S: AnsiString; const Defvalue : TDateTime; const FormatSettings: TFormatSettings): TDateTime;               {$ifdef SYSUTILSINLINE}inline;{$endif}
 

+ 6 - 6
rtl/objpas/sysutils/fina.inc

@@ -17,7 +17,7 @@
 function ChangeFileExt(const FileName, Extension: PathStr): PathStr;
 var
   i : longint;
-  EndSep : Set of Char;
+  EndSep : Set of AnsiChar;
   SOF : Boolean;
   
 begin
@@ -39,7 +39,7 @@ end;
 function ExtractFilePath(const FileName: PathStr): PathStr;
 var
   i : longint;
-  EndSep : Set of Char;
+  EndSep : Set of AnsiChar;
 begin
   i := Length(FileName);
   EndSep:=AllowDirectorySeparators+AllowDriveSeparators;
@@ -54,7 +54,7 @@ end;
 function ExtractFileDir(const FileName: PathStr): PathStr;
 var
   i : longint;
-  EndSep : Set of Char;
+  EndSep : Set of AnsiChar;
 begin
   I := Length(FileName);
   EndSep:=AllowDirectorySeparators+AllowDriveSeparators;
@@ -100,7 +100,7 @@ end;
 function ExtractFileName(const FileName: PathStr): PathStr;
 var
   i : longint;
-  EndSep : Set of Char;
+  EndSep : Set of AnsiChar;
 begin
   I := Length(FileName);
   EndSep:=AllowDirectorySeparators+AllowDriveSeparators;
@@ -112,7 +112,7 @@ end;
 function ExtractFileExt(const FileName: PathStr): PathStr;
 var
   i : longint;
-  EndSep : Set of Char;
+  EndSep : Set of AnsiChar;
   SOF : Boolean; // Dot at Start of filename ?
   
 begin
@@ -418,7 +418,7 @@ begin
       or (DirName[i] = DriveSeparator)
     {$endif}
       ) and
-       { avoid error in case last char=pathdelim }
+       { avoid error in case last AnsiChar=pathdelim }
        (length(dirname)>i) then
       begin
         DirName[i]:=#0;

+ 5 - 5
rtl/objpas/sysutils/osutil.inc

@@ -19,7 +19,7 @@
 Const
   FPC_EnvCount : Integer = -1;
 
-Function FPCCountEnvVar(EP : PPChar) : integer;
+Function FPCCountEnvVar(EP : PPAnsiChar) : integer;
 
 begin
   If (FPC_EnvCount=-1) then
@@ -35,10 +35,10 @@ begin
   Result:=FPC_EnvCount;
 end;
 
-Function FPCGetEnvVarFromP(EP : PPChar; EnvVar : String) : String;
+Function FPCGetEnvVarFromP(EP : PPAnsiChar; EnvVar : String) : String;
 
 var
-  hp         : ppchar;
+  hp         : PPAnsiChar;
   lenvvar,hs : string;
   eqpos      : longint;
 
@@ -60,7 +60,7 @@ begin
      end;
 end;
 
-Function FPCGetEnvStrFromP(EP : PPChar; Index : Integer) : String;
+Function FPCGetEnvStrFromP(EP : PPAnsiChar; Index : Integer) : String;
 
 begin
   Result:='';
@@ -257,7 +257,7 @@ begin
 end;
 
 {$if not(defined(win32)) and not(defined(win64))}
-Function GetTempFileName(Dir,Prefix: PChar; uUnique: DWORD; TempFileName: PChar):DWORD;
+Function GetTempFileName(Dir,Prefix: PAnsiChar; uUnique: DWORD; TempFileName: PAnsiChar):DWORD;
 
 Var
   P,Buf : String;

+ 1 - 1
rtl/objpas/sysutils/osutilsh.inc

@@ -40,7 +40,7 @@ Function GetTempDir : String;
 Function GetTempFileName(Const Dir,Prefix : String) : String;
 Function GetTempFileName : String;
 { For windows compatibility }
-function GetTempFileName(Dir,Prefix: PChar; uUnique: DWORD; TempFileName: PChar):DWORD;
+function GetTempFileName(Dir,Prefix: PAnsiChar; uUnique: DWORD; TempFileName: PAnsiChar):DWORD;
 Function GetAppConfigDir(Global : Boolean) : String;
 Function GetAppConfigFile(Global : Boolean) : String;
 Function GetAppConfigFile(Global : Boolean; SubDir : Boolean) : String;

+ 3 - 3
rtl/objpas/sysutils/sysansi.inc

@@ -44,19 +44,19 @@ begin
   Result:=Pos(Substr,S); // No MBCS yet.
 end;
 
-Function AnsiStrPos(Str, SubStr: PChar): PChar;
+Function AnsiStrPos(Str, SubStr: PAnsiChar): PAnsiChar;
 
 begin
   Result:=StrPos(Str,Substr);
 end;
 
-Function AnsiStrRScan(Str: PChar; Chr: Char): PChar;
+Function AnsiStrRScan(Str: PAnsiChar; Chr: AnsiChar): PAnsiChar;
 
 begin
   Result:=StrRScan(Str,Chr);
 end;
 
-Function AnsiStrScan(Str: PChar; Chr: Char): PChar;
+Function AnsiStrScan(Str: PAnsiChar; Chr: AnsiChar): PAnsiChar;
 
 begin
   Result:=StrScan(Str,Chr);

+ 3 - 3
rtl/objpas/sysutils/sysansih.inc

@@ -16,9 +16,9 @@ Function SameFileName(const S1, S2: string): Boolean;
 function AnsiLowerCaseFileName(const s : string) : string;
 function AnsiUpperCaseFileName(const s : string) : string;
 function AnsiPos(const substr,s : string) : SizeInt;
-function AnsiStrPos(str,substr : PChar) : PChar;
-function AnsiStrRScan(Str : PChar;Chr : Char) : PChar;
-function AnsiStrScan(Str : PChar;Chr: Char) : PChar;
+function AnsiStrPos(str,substr : PAnsiChar) : PAnsiChar;
+function AnsiStrRScan(Str : PAnsiChar;Chr : AnsiChar) : PAnsiChar;
+function AnsiStrScan(Str : PAnsiChar;Chr: AnsiChar) : PAnsiChar;
 function HashName(Name: PAnsiChar): LongWord;
 
 function BytesOf(const Val: RawByteString): TBytes;

+ 5 - 5
rtl/objpas/sysutils/sysencoding.inc

@@ -505,7 +505,7 @@ function TMBCSEncoding.GetCharCount(Bytes: PByte; ByteCount: Integer): Integer;
 var
   U: UnicodeString;
 begin
-  widestringmanager.Ansi2UnicodeMoveProc(PChar(Bytes), CodePage, U, ByteCount);
+  widestringmanager.Ansi2UnicodeMoveProc(PAnsiChar(Bytes), CodePage, U, ByteCount);
   Result := Length(U);
 end;
 
@@ -514,7 +514,7 @@ function TMBCSEncoding.GetChars(Bytes: PByte; ByteCount: Integer; Chars: PUnicod
 var
   U: UnicodeString;
 begin
-  widestringmanager.Ansi2UnicodeMoveProc(PChar(Bytes), CodePage, U, ByteCount);
+  widestringmanager.Ansi2UnicodeMoveProc(PAnsiChar(Bytes), CodePage, U, ByteCount);
   Result := Length(U);
   if CharCount < Result then
     Result := CharCount;
@@ -560,7 +560,7 @@ begin
   Result := TMBCSEncoding.Create(FCodePage, FMBToWCharFlags, FWCharToMBFlags);
 end;
 
-function TMBCSEncoding.GetAnsiBytes(Chars: PChar; CharCount: Integer): TBytes;
+function TMBCSEncoding.GetAnsiBytes(Chars: PAnsiChar; CharCount: Integer): TBytes;
 var
   S: RawByteString;
 begin
@@ -723,7 +723,7 @@ begin
   Result := TUnicodeEncoding.Create;
 end;
 
-function TUnicodeEncoding.GetAnsiBytes(Chars: PChar; CharCount: Integer
+function TUnicodeEncoding.GetAnsiBytes(Chars: PAnsiChar; CharCount: Integer
   ): TBytes;
 var
   U: UnicodeString;
@@ -811,7 +811,7 @@ begin
   Result := TBigEndianUnicodeEncoding.Create;
 end;
 
-function TBigEndianUnicodeEncoding.GetAnsiBytes(Chars: PChar; CharCount: Integer
+function TBigEndianUnicodeEncoding.GetAnsiBytes(Chars: PAnsiChar; CharCount: Integer
   ): TBytes;
 begin
   Result := TEncoding.Unicode.GetAnsiBytes(Chars, CharCount);

+ 4 - 4
rtl/objpas/sysutils/sysencodingh.inc

@@ -51,7 +51,7 @@ type
     function GetBytes(Chars: PUnicodeChar; CharCount: Integer; Bytes: PByte; ByteCount: Integer): Integer; overload; virtual; abstract;
     function GetCharCount(Bytes: PByte; ByteCount: Integer): Integer; overload; virtual; abstract;
     function GetChars(Bytes: PByte; ByteCount: Integer; Chars: PUnicodeChar; CharCount: Integer): Integer; overload; virtual; abstract;
-    function GetAnsiBytes(Chars: PChar; CharCount: Integer): TBytes; virtual; abstract;
+    function GetAnsiBytes(Chars: PAnsiChar; CharCount: Integer): TBytes; virtual; abstract;
     function GetAnsiString(Bytes: PByte; ByteCount: Integer): string; virtual; abstract;
     function GetCodePage: Cardinal; virtual; abstract;
     function GetEncodingName: UnicodeString; virtual; abstract;
@@ -118,7 +118,7 @@ type
     function GetBytes(Chars: PUnicodeChar; CharCount: Integer; Bytes: PByte; ByteCount: Integer): Integer; overload; override;
     function GetCharCount(Bytes: PByte; ByteCount: Integer): Integer; overload; override;
     function GetChars(Bytes: PByte; ByteCount: Integer; Chars: PUnicodeChar; CharCount: Integer): Integer; overload; override;
-    function GetAnsiBytes(Chars: PChar; CharCount: Integer): TBytes; override;
+    function GetAnsiBytes(Chars: PAnsiChar; CharCount: Integer): TBytes; override;
     function GetAnsiString(Bytes: PByte; ByteCount: Integer): string; override;
     function GetCodePage: Cardinal; override;
     function GetEncodingName: UnicodeString; override;
@@ -161,7 +161,7 @@ type
     function GetBytes(Chars: PUnicodeChar; CharCount: Integer; Bytes: PByte; ByteCount: Integer): Integer; overload; override;
     function GetCharCount(Bytes: PByte; ByteCount: Integer): Integer; overload; override;
     function GetChars(Bytes: PByte; ByteCount: Integer; Chars: PUnicodeChar; CharCount: Integer): Integer; overload; override;
-    function GetAnsiBytes(Chars: PChar; CharCount: Integer): TBytes; override;
+    function GetAnsiBytes(Chars: PAnsiChar; CharCount: Integer): TBytes; override;
     function GetAnsiString(Bytes: PByte; ByteCount: Integer): string; override;
     function GetCodePage: Cardinal; override;
     function GetEncodingName: UnicodeString; override;
@@ -180,7 +180,7 @@ type
     procedure Swap(var B: TBytes);
     function GetBytes(Chars: PUnicodeChar; CharCount: Integer; Bytes: PByte; ByteCount: Integer): Integer; overload; override;
     function GetChars(Bytes: PByte; ByteCount: Integer; Chars: PUnicodeChar; CharCount: Integer): Integer; overload; override;
-    function GetAnsiBytes(Chars: PChar; CharCount: Integer): TBytes; override;
+    function GetAnsiBytes(Chars: PAnsiChar; CharCount: Integer): TBytes; override;
     function GetAnsiString(Bytes: PByte; ByteCount: Integer): string; override;
     function GetCodePage: Cardinal; override;
     function GetEncodingName: UnicodeString; override;

+ 3 - 3
rtl/objpas/sysutils/sysformt.inc

@@ -41,7 +41,7 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : SizeInt;
     Index : SizeInt;
     Width,Prec : Longint;
     Left : Boolean;
-    Fchar : char;
+    Fchar : TFormatChar;
     vq : qword;
 
   {
@@ -51,7 +51,7 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : SizeInt;
     In case of an error, DoFormatError is called.
   }
 
-  Function ReadFormat : Char;
+  Function ReadFormat : TFormatChar;
 
   Var Value : longint;
 
@@ -208,7 +208,7 @@ end;
 
 
 {$ifdef fmtdebug}
-Procedure DumpFormat (C : char);
+Procedure DumpFormat (C : TFormatChar);
 begin
   Write ('Fmt : ',fmt:10);
   Write (' Index : ',Index:3);

+ 83 - 83
rtl/objpas/sysutils/syshelp.inc

@@ -136,7 +136,7 @@ end;
   TStringHelper
   ---------------------------------------------------------------------}
 
-Function HaveChar(AChar : Char; const AList: array of Char) : Boolean;
+Function HaveChar(AChar : AnsiChar; const AList: array of AnsiChar) : Boolean;
 
 Var
   I : SizeInt;
@@ -151,7 +151,7 @@ begin
     end;
 end;
 
-function TStringHelper.GetChar(AIndex: SizeInt): Char;
+function TStringHelper.GetChar(AIndex: SizeInt): AnsiChar;
 begin
   Result:=Self[AIndex+1];
 end;
@@ -263,20 +263,20 @@ begin
 end;
 
 
-class function TStringHelper.Create(AChar: Char; ACount: SizeInt): string;
+class function TStringHelper.Create(AChar: AnsiChar; ACount: SizeInt): string;
 begin
    Result:=StringOfChar(AChar,ACount);
 end;
 
 
-class function TStringHelper.Create(const AValue: array of Char): string;
+class function TStringHelper.Create(const AValue: array of AnsiChar): string;
 
 begin
   Result:=Create(AValue,0,System.Length(AValue));
 end;
 
 
-class function TStringHelper.Create(const AValue: array of Char;
+class function TStringHelper.Create(const AValue: array of AnsiChar;
   StartIndex: SizeInt; ALen: SizeInt): string;
 begin
   SetLength(Result,ALen);
@@ -378,7 +378,7 @@ class function TStringHelper.Join(const Separator: string;
   const Values: array of string; StartIndex: SizeInt; ACount: SizeInt): string;
 Var
   VLen,I,CountLim,NR,NSep,N : SizeInt;
-  Rp: PChar;
+  Rp: PAnsiChar;
 begin
   VLen:=System.Length(Values);
   If (ACount=0)  then
@@ -400,11 +400,11 @@ begin
      begin
         if I>StartIndex then
           begin
-            Move(separator[1],Rp^,NSep*sizeof(Char));
+            Move(separator[1],Rp^,NSep*sizeof(AnsiChar));
             Rp:=Rp+NSep;
           end;
         N:=System.Length(Values[I]);
-        Move(Values[I][1],Rp^,N*sizeof(Char));
+        Move(Values[I][1],Rp^,N*sizeof(AnsiChar));
         Rp:=Rp+N;
      end;
 end;
@@ -485,13 +485,13 @@ end;
 function TStringHelper.CompareTo(const B: string): Integer;
 begin
   // Order is important
-  Result:=sysUtils.StrComp(PChar(Self),PChar(B));
+  Result:=sysUtils.StrComp(PAnsiChar(Self),PAnsiChar(B));
 end;
 
-procedure TStringHelper.CopyTo(SourceIndex: SizeInt; var destination: array of Char; DestinationIndex: SizeInt; ACount: SizeInt);
+procedure TStringHelper.CopyTo(SourceIndex: SizeInt; var destination: array of AnsiChar; DestinationIndex: SizeInt; ACount: SizeInt);
 
 Var
-  P1,P2 : PChar;
+  P1,P2 : PAnsiChar;
 begin
 //  Writeln('((',DestinationIndex,'+',ACount,')<',System.Length(Destination),')  : ', ((DestinationIndex+ACount)<System.Length(Destination)));
   if ((DestinationIndex+ACount)<=System.Length(Destination)) then
@@ -499,7 +499,7 @@ begin
 //    Writeln('AHA');
     P1:=@Self[SourceIndex+1];
     P2:=@Destination[DestinationIndex];
-    Move(P1^,P2^,ACount*SizeOf(Char));
+    Move(P1^,P2^,ACount*SizeOf(AnsiChar));
     end;
 end;
 
@@ -512,10 +512,10 @@ begin
 end;
 
 
-function TStringHelper.CountChar(const C: Char): SizeInt;
+function TStringHelper.CountChar(const C: AnsiChar): SizeInt;
 
 Var
-  S : Char;
+  S : AnsiChar;
 begin
   Result:=0;
   For S in Self do
@@ -530,12 +530,12 @@ begin
 end;
 
 
-function TStringHelper.DeQuotedString(const AQuoteChar: Char): string;
+function TStringHelper.DeQuotedString(const AQuoteChar: AnsiChar): string;
 
 var
   L,I : SizeInt;
-  Res : Array of Char;
-  PS,PD : PChar;
+  Res : Array of AnsiChar;
+  PS,PD : PAnsiChar;
   IsQuote : Boolean;
 
 begin
@@ -589,7 +589,7 @@ begin
     if IgnoreCase then
       Result:=SameText(System.Copy(Self,NS-L+1,L),AValue)
     else
-      Result:=CompareChar(PChar(Pointer(Self))[NS-L],PChar(Pointer(AValue))^,L)=0;
+      Result:=CompareChar(PAnsiChar(Pointer(Self))[NS-L],PAnsiChar(Pointer(AValue))^,L)=0;
 end;
 
 
@@ -614,12 +614,12 @@ function TStringHelper.GetHashCode: Integer;
 
 // Taken from contnrs, fphash
 var
-  P,pmax : PChar;
+  P,pmax : PAnsiChar;
 begin
 {$push}
 {$Q-}
   Result:=0;
-  P:=Pchar(Self);
+  P:=PAnsiChar(Self);
   pmax:=p+length;
   while (p<pmax) do
     begin
@@ -630,7 +630,7 @@ begin
 end;
 
 
-function TStringHelper.IndexOf(AValue: Char): SizeInt;
+function TStringHelper.IndexOf(AValue: AnsiChar): SizeInt;
 begin
   Result:=IndexOf(AValue,0,Length);
 end;
@@ -642,7 +642,7 @@ begin
 end;
 
 
-function TStringHelper.IndexOf(AValue: Char; StartIndex: SizeInt): SizeInt;
+function TStringHelper.IndexOf(AValue: AnsiChar; StartIndex: SizeInt): SizeInt;
 begin
   Result:=IndexOf(AValue,StartIndex,Length);
 end;
@@ -655,7 +655,7 @@ begin
 end;
 
 
-function TStringHelper.IndexOf(AValue: Char; StartIndex: SizeInt;
+function TStringHelper.IndexOf(AValue: AnsiChar; StartIndex: SizeInt;
   ACount: SizeInt): SizeInt;
 
 Var
@@ -670,7 +670,7 @@ begin
   if ACount<=0 then
     Exit(-1);
   // pointer casts are to access self as 0 based index!
-  Result:=IndexChar(PChar(Pointer(self))[StartIndex],ACount,AValue);
+  Result:=IndexChar(PAnsiChar(Pointer(self))[StartIndex],ACount,AValue);
   if Result>=0 then
     Result:=Result+StartIndex;
 end;
@@ -681,7 +681,7 @@ function TStringHelper.IndexOf(const AValue: string; StartIndex: SizeInt;
 
 Var
   CountLim,NV,Ofs : SizeInt;
-  SP,SE : PChar;
+  SP,SE : PAnsiChar;
 
 begin
   if StartIndex<0 then
@@ -692,22 +692,22 @@ begin
   NV:=System.Length(AValue);
   if (NV>0) and (ACount>=NV) then
     begin
-      SP:=PChar(Pointer(Self))+StartIndex;
+      SP:=PAnsiChar(Pointer(Self))+StartIndex;
       SE:=SP+ACount-NV+1;
       repeat
-        Ofs:=IndexChar(SP^,SE-SP,PChar(Pointer(AValue))[0]);
+        Ofs:=IndexChar(SP^,SE-SP,PAnsiChar(Pointer(AValue))[0]);
         if Ofs<0 then
           Break;
         SP:=SP+Ofs+1;
-        if CompareChar(SP^,PChar(Pointer(AValue))[1],NV-1)=0 then
-          Exit(SP-PChar(Pointer(Self))-1);
+        if CompareChar(SP^,PAnsiChar(Pointer(AValue))[1],NV-1)=0 then
+          Exit(SP-PAnsiChar(Pointer(Self))-1);
       until false;
     end;
   Result:=-1;
 end;
 
 function TStringHelper.IndexOfUnQuoted(const AValue: string; StartQuote,
-  EndQuote: Char; StartIndex: SizeInt = 0): SizeInt;
+  EndQuote: AnsiChar; StartIndex: SizeInt = 0): SizeInt;
 
 Var
   LV : SizeInt;
@@ -763,20 +763,20 @@ begin
 end;
 
 
-function TStringHelper.IndexOfAny(const AnyOf: array of Char): SizeInt;
+function TStringHelper.IndexOfAny(const AnyOf: array of AnsiChar): SizeInt;
 begin
   Result:=IndexOfAny(AnyOf,0,Length);
 end;
 
 
-function TStringHelper.IndexOfAny(const AnyOf: array of Char;
+function TStringHelper.IndexOfAny(const AnyOf: array of AnsiChar;
   StartIndex: SizeInt): SizeInt;
 begin
   Result:=IndexOfAny(AnyOf,StartIndex,Length);
 end;
 
 
-function TStringHelper.IndexOfAny(const AnyOf: array of Char;
+function TStringHelper.IndexOfAny(const AnyOf: array of AnsiChar;
   StartIndex: SizeInt; ACount: SizeInt): SizeInt;
 
 Var
@@ -837,22 +837,22 @@ begin
 end;
 
 
-function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of Char;
-  StartQuote, EndQuote: Char): SizeInt;
+function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of AnsiChar;
+  StartQuote, EndQuote: AnsiChar): SizeInt;
 begin
   Result:=IndexOfAnyUnquoted(AnyOf,StartQuote,EndQuote,0,Length);
 end;
 
 
-function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of Char;
-  StartQuote, EndQuote: Char; StartIndex: SizeInt): SizeInt;
+function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of AnsiChar;
+  StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt): SizeInt;
 begin
   Result:=IndexOfAnyUnquoted(AnyOf,StartQuote,EndQuote,StartIndex,Length);
 end;
 
 
-function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of Char;
-  StartQuote, EndQuote: Char; StartIndex: SizeInt; ACount: SizeInt): SizeInt;
+function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of AnsiChar;
+  StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt;
 
 Var
   I,L : SizeInt;
@@ -893,7 +893,7 @@ begin
 end;
 
 function TStringHelper.IndexOfAnyUnquoted(const AnyOf: array of string;
-  StartQuote, EndQuote: Char; StartIndex: SizeInt; out Matched: SizeInt
+  StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt; out Matched: SizeInt
   ): SizeInt;
 
 Var
@@ -940,7 +940,7 @@ begin
 end;
 
 
-function TStringHelper.LastIndexOf(AValue: Char): SizeInt;
+function TStringHelper.LastIndexOf(AValue: AnsiChar): SizeInt;
 begin
   Result:=LastIndexOf(AValue,Length-1,Length);
 end;
@@ -952,7 +952,7 @@ begin
 end;
 
 
-function TStringHelper.LastIndexOf(AValue: Char; AStartIndex: SizeInt): SizeInt;
+function TStringHelper.LastIndexOf(AValue: AnsiChar; AStartIndex: SizeInt): SizeInt;
 begin
   Result:=LastIndexOf(AValue,AStartIndex,Length);
 end;
@@ -965,7 +965,7 @@ begin
 end;
 
 
-function TStringHelper.LastIndexOf(AValue: Char; AStartIndex: SizeInt;
+function TStringHelper.LastIndexOf(AValue: AnsiChar; AStartIndex: SizeInt;
   ACount: SizeInt): SizeInt;
 
 Var
@@ -990,7 +990,7 @@ function TStringHelper.LastIndexOf(const AValue: string; AStartIndex: SizeInt; A
 var
   I,L,LS,M : SizeInt;
   S : String;
-  P : PChar;
+  P : PAnsiChar;
     
 begin
   Result:=-1;
@@ -998,7 +998,7 @@ begin
   L:=system.Length(AValue);
   if (L=0) or (L>LS) then
     Exit;
-  P:=PChar(AValue);  
+  P:=PAnsiChar(AValue);  
   S:=Self;
   I:=AStartIndex+1; // 1 based
   if (I>LS) then
@@ -1009,27 +1009,27 @@ begin
     M:=1;
   while (Result=-1) and (I>=M) do
     begin
-    if (0=StrLComp(PChar(@S[I]),P,L)) then
+    if (0=StrLComp(PAnsiChar(@S[I]),P,L)) then
       Result:=I-1;
     Dec(I);
     end;
 end;
 
 
-function TStringHelper.LastIndexOfAny(const AnyOf: array of Char): SizeInt;
+function TStringHelper.LastIndexOfAny(const AnyOf: array of AnsiChar): SizeInt;
 begin
   Result:=LastIndexOfAny(AnyOf,Length-1,Length);
 end;
 
 
-function TStringHelper.LastIndexOfAny(const AnyOf: array of Char;
+function TStringHelper.LastIndexOfAny(const AnyOf: array of AnsiChar;
   AStartIndex: SizeInt): SizeInt;
 begin
   Result:=LastIndexOfAny(AnyOf,AStartIndex,Length);
 end;
 
 
-function TStringHelper.LastIndexOfAny(const AnyOf: array of Char;
+function TStringHelper.LastIndexOfAny(const AnyOf: array of AnsiChar;
   AStartIndex: SizeInt; ACount: SizeInt): SizeInt;
 
 Var
@@ -1055,7 +1055,7 @@ begin
 end;
 
 
-function TStringHelper.PadLeft(ATotalWidth: SizeInt; PaddingChar: Char): string;
+function TStringHelper.PadLeft(ATotalWidth: SizeInt; PaddingChar: AnsiChar): string;
 Var
   L : SizeInt;
 
@@ -1073,7 +1073,7 @@ begin
 end;
 
 
-function TStringHelper.PadRight(ATotalWidth: SizeInt; PaddingChar: Char
+function TStringHelper.PadRight(ATotalWidth: SizeInt; PaddingChar: AnsiChar
   ): string;
 
 Var
@@ -1093,7 +1093,7 @@ begin
 end;
 
 
-function TStringHelper.QuotedString(const AQuoteChar: Char): string;
+function TStringHelper.QuotedString(const AQuoteChar: AnsiChar): string;
 begin
   Result:=AnsiQuotedStr(Self,AQuoteChar);
 end;
@@ -1112,31 +1112,31 @@ begin
 end;
 
 
-function TStringHelper.Replace(OldChar: Char; NewChar: Char): string;
+function TStringHelper.Replace(OldChar: AnsiChar; NewChar: AnsiChar): string;
 begin
   Result:=Replace(OldChar,NewChar,[rfReplaceAll]);
 end;
 
 
-function TStringHelper.Replace(OldChar: Char; NewChar: Char;
+function TStringHelper.Replace(OldChar: AnsiChar; NewChar: AnsiChar;
   ReplaceFlags: TReplaceFlags): string;
 var
-  Sp,Se,Rp : PChar;
+  Sp,Se,Rp : PAnsiChar;
   Ofs : SizeInt;
 begin
   if rfIgnoreCase in ReplaceFlags then
     exit(StringReplace(Self,OldChar,NewChar,ReplaceFlags));
 
-  Sp:=PChar(Pointer(Self));
+  Sp:=PAnsiChar(Pointer(Self));
   Se:=Sp+System.Length(Self);
   Ofs:=IndexChar(Sp^,Se-Sp,OldChar);
   if Ofs<0 then
     exit(Self);
   SetLength(Result,Se-Sp);
-  Rp:=PChar(Pointer(Result));
+  Rp:=PAnsiChar(Pointer(Result));
 
   repeat
-    Move(Sp^,Rp^,Ofs*sizeof(Char));
+    Move(Sp^,Rp^,Ofs*sizeof(AnsiChar));
     Sp:=Sp+Ofs+1;
     Rp[Ofs]:=NewChar;
     Rp:=Rp+Ofs+1;
@@ -1151,7 +1151,7 @@ begin
       end;
     Ofs:=IndexChar(Sp^,Se-Sp,OldChar);
   until Ofs<0;
-  Move(Sp^,Rp^,(Se-Sp)*sizeof(Char));
+  Move(Sp^,Rp^,(Se-Sp)*sizeof(AnsiChar));
 end;
 
 
@@ -1169,27 +1169,27 @@ begin
 end;
 
 
-function TStringHelper.Split(const Separators: array of Char): TStringArray;
+function TStringHelper.Split(const Separators: array of AnsiChar): TStringArray;
 begin
   Result:=Split(Separators,#0,#0,Length+1,TStringSplitOptions.None);
 end;
 
 
-function TStringHelper.Split(const Separators: array of Char; ACount: SizeInt
+function TStringHelper.Split(const Separators: array of AnsiChar; ACount: SizeInt
   ): TStringArray;
 begin
   Result:=Split(Separators,#0,#0,ACount,TStringSplitOptions.None);
 end;
 
 
-function TStringHelper.Split(const Separators: array of Char;
+function TStringHelper.Split(const Separators: array of AnsiChar;
   Options: TStringSplitOptions): TStringArray;
 begin
   Result:=Split(Separators,Length+1,Options);
 end;
 
 
-function TStringHelper.Split(const Separators: array of Char; ACount: SizeInt;
+function TStringHelper.Split(const Separators: array of AnsiChar; ACount: SizeInt;
   Options: TStringSplitOptions): TStringArray;
 begin
   Result:=Split(Separators,#0,#0,ACount,Options);
@@ -1223,36 +1223,36 @@ begin
 end;
 
 
-function TStringHelper.Split(const Separators: array of Char; AQuote: Char
+function TStringHelper.Split(const Separators: array of AnsiChar; AQuote: AnsiChar
   ): TStringArray;
 begin
   Result:=Split(Separators,AQuote,AQuote);
 end;
 
 
-function TStringHelper.Split(const Separators: array of Char; AQuoteStart,
-  AQuoteEnd: Char): TStringArray;
+function TStringHelper.Split(const Separators: array of AnsiChar; AQuoteStart,
+  AQuoteEnd: AnsiChar): TStringArray;
 begin
   Result:=Split(Separators,AQuoteStart,AQuoteEnd,TStringSplitOptions.None);
 end;
 
 
-function TStringHelper.Split(const Separators: array of Char; AQuoteStart,
-  AQuoteEnd: Char; Options: TStringSplitOptions): TStringArray;
+function TStringHelper.Split(const Separators: array of AnsiChar; AQuoteStart,
+  AQuoteEnd: AnsiChar; Options: TStringSplitOptions): TStringArray;
 begin
   Result:=Split(Separators,AQuoteStart,AQuoteEnd,Length+1,Options);
 end;
 
 
-function TStringHelper.Split(const Separators: array of Char; AQuoteStart,
-  AQuoteEnd: Char; ACount: SizeInt): TStringArray;
+function TStringHelper.Split(const Separators: array of AnsiChar; AQuoteStart,
+  AQuoteEnd: AnsiChar; ACount: SizeInt): TStringArray;
 begin
   Result:=Split(Separators,AQuoteStart,AQuoteEnd,ACount,TStringSplitOptions.None);
 end;
 
 
-function TStringHelper.Split(const Separators: array of Char; AQuoteStart,
-  AQuoteEnd: Char; ACount: SizeInt; Options: TStringSplitOptions): TStringArray;
+function TStringHelper.Split(const Separators: array of AnsiChar; AQuoteStart,
+  AQuoteEnd: AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TStringArray;
 
   Function NextSep(StartIndex : SizeInt) : SizeInt;
 
@@ -1300,7 +1300,7 @@ begin
 end;
 
 
-function TStringHelper.Split(const Separators: array of string; AQuote: Char
+function TStringHelper.Split(const Separators: array of string; AQuote: AnsiChar
   ): TStringArray;
 begin
   Result:=SPlit(Separators,AQuote,AQuote);
@@ -1308,28 +1308,28 @@ end;
 
 
 function TStringHelper.Split(const Separators: array of string; AQuoteStart,
-  AQuoteEnd: Char): TStringArray;
+  AQuoteEnd: AnsiChar): TStringArray;
 begin
   Result:=SPlit(Separators,AQuoteStart,AQuoteEnd,Length+1,TStringSplitOptions.None);
 end;
 
 
 function TStringHelper.Split(const Separators: array of string; AQuoteStart,
-  AQuoteEnd: Char; Options: TStringSplitOptions): TStringArray;
+  AQuoteEnd: AnsiChar; Options: TStringSplitOptions): TStringArray;
 begin
   Result:=SPlit(Separators,AQuoteStart,AQuoteEnd,Length+1,Options);
 end;
 
 
 function TStringHelper.Split(const Separators: array of string; AQuoteStart,
-  AQuoteEnd: Char; ACount: SizeInt): TStringArray;
+  AQuoteEnd: AnsiChar; ACount: SizeInt): TStringArray;
 begin
   Result:=SPlit(Separators,AQuoteStart,AQuoteEnd,ACount,TStringSplitOptions.None);
 end;
 
 
 function TStringHelper.Split(const Separators: array of string; AQuoteStart,
-  AQuoteEnd: Char; ACount: SizeInt; Options: TStringSplitOptions): TStringArray;
+  AQuoteEnd: AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TStringArray;
 Const
   BlockSize = 10;
 
@@ -1409,7 +1409,7 @@ begin
     if IgnoreCase then
       Result:=SameText(System.Copy(Self,1,L),AValue)
     else
-      Result:=CompareChar(PChar(Pointer(Self))^,PChar(Pointer(AValue))^,L)=0;
+      Result:=CompareChar(PAnsiChar(Pointer(Self))^,PAnsiChar(Pointer(AValue))^,L)=0;
 end;
 
 
@@ -1523,13 +1523,13 @@ begin
 end;
 
 
-function TStringHelper.Trim(const ATrimChars: array of Char): string;
+function TStringHelper.Trim(const ATrimChars: array of AnsiChar): string;
 begin
   Result:=Self.TrimLeft(ATrimChars).TrimRight(ATrimChars);
 end;
 
 
-function TStringHelper.TrimLeft(const ATrimChars: array of Char): string;
+function TStringHelper.TrimLeft(const ATrimChars: array of AnsiChar): string;
 
 Var
   I,Len : SizeInt;
@@ -1547,7 +1547,7 @@ begin
 end;
 
 
-function TStringHelper.TrimRight(const ATrimChars: array of Char): string;
+function TStringHelper.TrimRight(const ATrimChars: array of AnsiChar): string;
 
 Var
   I,Len : SizeInt;
@@ -1565,13 +1565,13 @@ begin
 end;
 
 
-function TStringHelper.TrimEnd(const ATrimChars: array of Char): string;
+function TStringHelper.TrimEnd(const ATrimChars: array of AnsiChar): string;
 begin
   Result:=TrimRight(ATrimChars);
 end;
 
 
-function TStringHelper.TrimStart(const ATrimChars: array of Char): string;
+function TStringHelper.TrimStart(const ATrimChars: array of AnsiChar): string;
 begin
   Result:=TrimLeft(ATrimChars);
 end;

+ 50 - 50
rtl/objpas/sysutils/syshelph.inc

@@ -2,7 +2,7 @@
 
 Type
   TStringArray = Array of string;
-  TCharArray = Array of char;
+  TCharArray = Array of AnsiChar;
   TEndian = ObjPas.TEndian;
   TByteBitIndex = 0..7;
   TShortIntBitIndex = 0..7;
@@ -64,7 +64,7 @@ Type
 
   TStringHelper = Type Helper for AnsiString
   Private
-    Function GetChar(AIndex : SizeInt) : Char;
+    Function GetChar(AIndex : SizeInt) : AnsiChar;
     Function GetLength : SizeInt;
   public
     const Empty = '';
@@ -79,9 +79,9 @@ Type
     Class Function CompareOrdinal(const A: string; IndexA: SizeInt; const B: string; IndexB: SizeInt; ALen: SizeInt): Integer; overload; static;
     Class Function CompareText(const A: string; const B: string): Integer; static; inline;
     Class Function Copy(const Str: string): string; inline; static;
-    Class Function Create(AChar: Char; ACount: SizeInt): string; overload; inline; static;
-    Class Function Create(const AValue: array of Char): string; overload; static;
-    Class Function Create(const AValue: array of Char; StartIndex: SizeInt; ALen: SizeInt): string; overload; static;
+    Class Function Create(AChar: AnsiChar; ACount: SizeInt): string; overload; inline; static;
+    Class Function Create(const AValue: array of AnsiChar): string; overload; static;
+    Class Function Create(const AValue: array of AnsiChar; StartIndex: SizeInt; ALen: SizeInt): string; overload; static;
     Class Function EndsText(const ASubText, AText: string): Boolean; static;
     Class Function Equals(const a: string; const b: string): Boolean; overload; static;
     Class Function Format(const AFormat: string; const args: array of const): string; overload; static;
@@ -104,76 +104,76 @@ Type
     Class Function UpperCase(const S: string): string; overload; static; inline;
     Function CompareTo(const B: string): Integer;
     Function Contains(const AValue: string; IgnoreCase: Boolean = False): Boolean;
-    procedure CopyTo(SourceIndex: SizeInt; var destination: array of Char; DestinationIndex: SizeInt; ACount: SizeInt);
-    Function CountChar(const C: Char): SizeInt;
+    procedure CopyTo(SourceIndex: SizeInt; var destination: array of AnsiChar; DestinationIndex: SizeInt; ACount: SizeInt);
+    Function CountChar(const C: AnsiChar): SizeInt;
     Function DeQuotedString: string; overload;
-    Function DeQuotedString(const AQuoteChar: Char): string; overload;
+    Function DeQuotedString(const AQuoteChar: AnsiChar): string; overload;
     Function EndsWith(const AValue: string): Boolean; overload; inline;
     Function EndsWith(const AValue: string; IgnoreCase: Boolean): Boolean; overload;
     Function Equals(const AValue: string; IgnoreCase: Boolean = False): Boolean; overload;
     Function Format(const args: array of const): string; overload;
     Function GetHashCode: Integer;
-    Function IndexOf(AValue: Char): SizeInt; overload; inline;
+    Function IndexOf(AValue: AnsiChar): SizeInt; overload; inline;
     Function IndexOf(const AValue: string): SizeInt; overload; inline;
-    Function IndexOf(AValue: Char; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOf(AValue: AnsiChar; StartIndex: SizeInt): SizeInt; overload;
     Function IndexOf(const AValue: string; StartIndex: SizeInt): SizeInt; overload;
-    Function IndexOf(AValue: Char; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function IndexOf(AValue: AnsiChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
     Function IndexOf(const AValue: string; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
-    Function IndexOfUnQuoted(const AValue: string; StartQuote, EndQuote: Char; StartIndex: SizeInt = 0): SizeInt; overload;
-    Function IndexOfAny(const AnyOf: array of Char): SizeInt; overload;
-    Function IndexOfAny(const AnyOf: array of Char; StartIndex: SizeInt): SizeInt; overload;
-    Function IndexOfAny(const AnyOf: array of Char; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function IndexOfUnQuoted(const AValue: string; StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt = 0): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of AnsiChar): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of AnsiChar; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOfAny(const AnyOf: array of AnsiChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
     Function IndexOfAny(const AnyOf: array of String): SizeInt; overload;
     Function IndexOfAny(const AnyOf: array of String; StartIndex: SizeInt): SizeInt; overload;
     Function IndexOfAny(const AnyOf: array of String; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
     Function IndexOfAny(const AnyOf: array of String; StartIndex: SizeInt; ACount: SizeInt; Out AMatch : SizeInt): SizeInt; overload;
-    Function IndexOfAnyUnquoted(const AnyOf: array of Char; StartQuote, EndQuote: Char): SizeInt; overload;
-    Function IndexOfAnyUnquoted(const AnyOf: array of Char; StartQuote, EndQuote: Char; StartIndex: SizeInt): SizeInt; overload;
-    Function IndexOfAnyUnquoted(const AnyOf: array of Char; StartQuote, EndQuote: Char; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
-    function IndexOfAnyUnquoted(const AnyOf: array of string; StartQuote, EndQuote: Char; StartIndex: SizeInt; Out Matched: SizeInt): SizeInt; overload;
+    Function IndexOfAnyUnquoted(const AnyOf: array of AnsiChar; StartQuote, EndQuote: AnsiChar): SizeInt; overload;
+    Function IndexOfAnyUnquoted(const AnyOf: array of AnsiChar; StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt): SizeInt; overload;
+    Function IndexOfAnyUnquoted(const AnyOf: array of AnsiChar; StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    function IndexOfAnyUnquoted(const AnyOf: array of string; StartQuote, EndQuote: AnsiChar; StartIndex: SizeInt; Out Matched: SizeInt): SizeInt; overload;
     Function Insert(StartIndex: SizeInt; const AValue: string): string;
     Function IsDelimiter(const Delimiters: string; Index: SizeInt): Boolean;
     Function IsEmpty: Boolean;
     Function LastDelimiter(const Delims: string): SizeInt;
-    Function LastIndexOf(AValue: Char): SizeInt; overload;
+    Function LastIndexOf(AValue: AnsiChar): SizeInt; overload;
     Function LastIndexOf(const AValue: string): SizeInt; overload;
-    Function LastIndexOf(AValue: Char; AStartIndex: SizeInt): SizeInt; overload;
+    Function LastIndexOf(AValue: AnsiChar; AStartIndex: SizeInt): SizeInt; overload;
     Function LastIndexOf(const AValue: string; AStartIndex: SizeInt): SizeInt; overload;
-    Function LastIndexOf(AValue: Char; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function LastIndexOf(AValue: AnsiChar; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
     Function LastIndexOf(const AValue: string; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
-    Function LastIndexOfAny(const AnyOf: array of Char): SizeInt; overload;
-    Function LastIndexOfAny(const AnyOf: array of Char; AStartIndex: SizeInt): SizeInt; overload;
-    Function LastIndexOfAny(const AnyOf: array of Char; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
+    Function LastIndexOfAny(const AnyOf: array of AnsiChar): SizeInt; overload;
+    Function LastIndexOfAny(const AnyOf: array of AnsiChar; AStartIndex: SizeInt): SizeInt; overload;
+    Function LastIndexOfAny(const AnyOf: array of AnsiChar; AStartIndex: SizeInt; ACount: SizeInt): SizeInt; overload;
     Function PadLeft(ATotalWidth: SizeInt): string; overload; inline;
-    Function PadLeft(ATotalWidth: SizeInt; PaddingChar: Char): string; overload; inline;
+    Function PadLeft(ATotalWidth: SizeInt; PaddingChar: AnsiChar): string; overload; inline;
     Function PadRight(ATotalWidth: SizeInt): string; overload; inline;
-    Function PadRight(ATotalWidth: SizeInt; PaddingChar: Char): string; overload; inline;
+    Function PadRight(ATotalWidth: SizeInt; PaddingChar: AnsiChar): string; overload; inline;
     Function QuotedString: string; overload;
-    Function QuotedString(const AQuoteChar: Char): string; overload;
+    Function QuotedString(const AQuoteChar: AnsiChar): string; overload;
     Function Remove(StartIndex: SizeInt): string; overload; inline;
     Function Remove(StartIndex: SizeInt; ACount: SizeInt): string; overload; inline;
-    Function Replace(OldChar: Char; NewChar: Char): string; overload;
-    Function Replace(OldChar: Char; NewChar: Char; ReplaceFlags: TReplaceFlags): string; overload;
+    Function Replace(OldChar: AnsiChar; NewChar: AnsiChar): string; overload;
+    Function Replace(OldChar: AnsiChar; NewChar: AnsiChar; ReplaceFlags: TReplaceFlags): string; overload;
     Function Replace(const OldValue: string; const NewValue: string): string; overload;
     Function Replace(const OldValue: string; const NewValue: string; ReplaceFlags: TReplaceFlags): string; overload;
-    Function Split(const Separators: array of Char): TStringArray; overload;
-    Function Split(const Separators: array of Char; ACount: SizeInt): TStringArray; overload;
-    Function Split(const Separators: array of Char; Options: TStringSplitOptions): TStringArray; overload;
-    Function Split(const Separators: array of Char; ACount: SizeInt; Options: TStringSplitOptions): TStringArray; overload;
+    Function Split(const Separators: array of AnsiChar): TStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; ACount: SizeInt): TStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; Options: TStringSplitOptions): TStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TStringArray; overload;
     Function Split(const Separators: array of string): TStringArray; overload;
     Function Split(const Separators: array of string; ACount: SizeInt): TStringArray; overload;
     Function Split(const Separators: array of string; Options: TStringSplitOptions): TStringArray; overload;
     Function Split(const Separators: array of string; ACount: SizeInt; Options: TStringSplitOptions): TStringArray; overload;
-    Function Split(const Separators: array of Char; AQuote: Char): TStringArray; overload;
-    Function Split(const Separators: array of Char; AQuoteStart, AQuoteEnd: Char): TStringArray; overload;
-    Function Split(const Separators: array of Char; AQuoteStart, AQuoteEnd: Char; Options: TStringSplitOptions): TStringArray; overload;
-    Function Split(const Separators: array of Char; AQuoteStart, AQuoteEnd: Char; ACount: SizeInt): TStringArray; overload;
-    Function Split(const Separators: array of Char; AQuoteStart, AQuoteEnd: Char; ACount: SizeInt; Options: TStringSplitOptions): TStringArray; overload;
-    Function Split(const Separators: array of string; AQuote: Char): TStringArray; overload;
-    Function Split(const Separators: array of string; AQuoteStart, AQuoteEnd: Char): TStringArray; overload;
-    Function Split(const Separators: array of string; AQuoteStart, AQuoteEnd: Char; Options: TStringSplitOptions): TStringArray; overload;
-    Function Split(const Separators: array of string; AQuoteStart, AQuoteEnd: Char; ACount: SizeInt): TStringArray; overload;
-    Function Split(const Separators: array of string; AQuoteStart, AQuoteEnd: Char; ACount: SizeInt; Options: TStringSplitOptions): TStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; AQuote: AnsiChar): TStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar): TStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar; Options: TStringSplitOptions): TStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt): TStringArray; overload;
+    Function Split(const Separators: array of AnsiChar; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TStringArray; overload;
+    Function Split(const Separators: array of string; AQuote: AnsiChar): TStringArray; overload;
+    Function Split(const Separators: array of string; AQuoteStart, AQuoteEnd: AnsiChar): TStringArray; overload;
+    Function Split(const Separators: array of string; AQuoteStart, AQuoteEnd: AnsiChar; Options: TStringSplitOptions): TStringArray; overload;
+    Function Split(const Separators: array of string; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt): TStringArray; overload;
+    Function Split(const Separators: array of string; AQuoteStart, AQuoteEnd: AnsiChar; ACount: SizeInt; Options: TStringSplitOptions): TStringArray; overload;
     Function StartsWith(const AValue: string): Boolean; overload; inline;
     Function StartsWith(const AValue: string; IgnoreCase: Boolean): Boolean; overload;
     Function Substring(AStartIndex: SizeInt): string; overload;
@@ -193,12 +193,12 @@ Type
     Function Trim: string; overload;
     Function TrimLeft: string; overload;
     Function TrimRight: string; overload;
-    Function Trim(const ATrimChars: array of Char): string; overload;
-    Function TrimLeft(const ATrimChars: array of Char): string; overload;
-    Function TrimRight(const ATrimChars: array of Char): string; overload;
-    Function TrimEnd(const ATrimChars: array of Char): string; deprecated 'Use TrimRight';
-    Function TrimStart(const ATrimChars: array of Char): string; deprecated 'Use TrimLeft';
-    property Chars[AIndex: SizeInt]: Char read GetChar;
+    Function Trim(const ATrimChars: array of AnsiChar): string; overload;
+    Function TrimLeft(const ATrimChars: array of AnsiChar): string; overload;
+    Function TrimRight(const ATrimChars: array of AnsiChar): string; overload;
+    Function TrimEnd(const ATrimChars: array of AnsiChar): string; deprecated 'Use TrimRight';
+    Function TrimStart(const ATrimChars: array of AnsiChar): string; deprecated 'Use TrimLeft';
+    property Chars[AIndex: SizeInt]: AnsiChar read GetChar;
     property Length: SizeInt read GetLength;
   end;
 

+ 10 - 10
rtl/objpas/sysutils/sysinth.inc

@@ -33,12 +33,12 @@ type
   TFormatSettings = record
     CurrencyFormat: Byte;
     NegCurrFormat: Byte;
-    ThousandSeparator: Char;
-    DecimalSeparator: Char;
+    ThousandSeparator: AnsiChar;
+    DecimalSeparator: AnsiChar;
     CurrencyDecimals: Byte;
-    DateSeparator: Char;
-    TimeSeparator: Char;
-    ListSeparator: Char;
+    DateSeparator: AnsiChar;
+    TimeSeparator: AnsiChar;
+    ListSeparator: AnsiChar;
     CurrencyString: string;
     ShortDateFormat: string;
     LongDateFormat: string;
@@ -87,7 +87,7 @@ var
 Var
 
    { Character to be put between date, month and year }
-   DateSeparator: char absolute DefaultFormatSettings.DateSeparator deprecated;
+   DateSeparator: AnsiChar absolute DefaultFormatSettings.DateSeparator deprecated;
 
    { Format used for short date notation }
    ShortDateFormat: string absolute DefaultFormatSettings.ShortDateFormat deprecated;
@@ -115,7 +115,7 @@ Var
    LongTimeFormat: string absolute DefaultFormatSettings.LongTimeFormat deprecated;
 
    { Character to be put between hours and minutes }
-   TimeSeparator: char absolute DefaultFormatSettings.TimeSeparator deprecated;
+   TimeSeparator: AnsiChar absolute DefaultFormatSettings.TimeSeparator deprecated;
 
    { String to indicate AM time when using 12 hour clock. }
    TimeAMString: string absolute DefaultFormatSettings.TimeAMString deprecated;
@@ -131,10 +131,10 @@ Var
 
 
   { Character that comes between integer and fractional part of a number }
-  DecimalSeparator : Char absolute DefaultFormatSettings.DecimalSeparator deprecated;
+  DecimalSeparator : AnsiChar absolute DefaultFormatSettings.DecimalSeparator deprecated;
 
   { Character that is put every 3 numbers in a currency }
-  ThousandSeparator : Char absolute DefaultFormatSettings.ThousandSeparator deprecated;
+  ThousandSeparator : AnsiChar absolute DefaultFormatSettings.ThousandSeparator deprecated;
 
   { Number of decimals to use when formatting a currency.  }
   CurrencyDecimals : Byte absolute DefaultFormatSettings.CurrencyDecimals deprecated;
@@ -166,7 +166,7 @@ Var
   { Currency notation. Default is $ for dollars. }
   CurrencyString : String absolute DefaultFormatSettings.CurrencyString deprecated;
 
-  ListSeparator: Char absolute DefaultFormatSettings.ListSeparator deprecated;
+  ListSeparator: AnsiChar absolute DefaultFormatSettings.ListSeparator deprecated;
 
 type
   TSysLocale = record

+ 12 - 12
rtl/objpas/sysutils/syspch.inc

@@ -14,7 +14,7 @@
     System Utilities For Free Pascal
 }
 
-{  PChar functions  }
+{  PAnsiChar functions  }
 
 { Processor dependent part, shared withs strings unit }
 {$ifdef FPC_USE_LIBC}
@@ -28,9 +28,9 @@
 { Processor independent part, shared with strings unit }
 {$i stringsi.inc }
 
-{  StrPas converts a PChar to a pascal string  }
+{  StrPas converts a PAnsiChar to a pascal string  }
 
-function StrPas(Str: PChar): string;
+function StrPas(Str: PAnsiChar): string;
 begin
   Result:=Str;
 end ;
@@ -39,7 +39,7 @@ end ;
    the size of the allocated buffer is stored at result - 4
    StrDispose should be used to destroy the buffer  }
 
-function StrAlloc(Size: cardinal): PChar;
+function StrAlloc(Size: cardinal): PAnsiChar;
 begin
   inc(size,sizeof(cardinal));
   getmem(result,size);
@@ -51,7 +51,7 @@ end;
 { Allocates a new string using StrAlloc, you need StrDispose to dispose the
   string }
 
-function strnew(p : pchar) : pchar;
+function strnew(p : PAnsiChar) : PAnsiChar;
 var
   len : longint;
 begin
@@ -67,15 +67,15 @@ end;
 
 {  StrPCopy copies the pascal string Source to Dest and returns Dest  }
 
-function StrPCopy(Dest: PChar; Const Source: string): PChar;overload;
+function StrPCopy(Dest: PAnsiChar; Const Source: string): PAnsiChar;overload;
 begin
-  result := StrMove(Dest, PChar(Source), length(Source)+1);
+  result := StrMove(Dest, PAnsiChar(Source), length(Source)+1);
 end ;
 
 {  StrPLCopy copies MaxLen or less characters from the pascal string
    Source to Dest and returns Dest  }
 
-function StrPLCopy(Dest: PChar; Const Source: string; MaxLen: SizeUInt): PChar;overload;
+function StrPLCopy(Dest: PAnsiChar; Const Source: string; MaxLen: SizeUInt): PAnsiChar;overload;
 var Count: SizeUInt;
 begin
 Result := Dest;
@@ -84,14 +84,14 @@ if Result <> Nil then
     Count := Length(Source);
     if Count > MaxLen then
       Count := MaxLen;
-    StrMove(Result, PChar(Source), Count);
+    StrMove(Result, PAnsiChar(Source), Count);
     Result[Count] := #0;  { terminate ! }
   end;
 end;
 
 {   StrDispose clears the memory allocated with StrAlloc   }
 
-procedure StrDispose(Str: PChar);
+procedure StrDispose(Str: PAnsiChar);
 begin
   if (Str <> Nil) then
    begin
@@ -100,9 +100,9 @@ begin
    end;
 end;
 
-{  StrBufSize returns the amount of memory allocated for pchar Str allocated with StrAlloc  }
+{  StrBufSize returns the amount of memory allocated for pansichar Str allocated with StrAlloc  }
 
-function StrBufSize(Str: PChar): Cardinal;
+function StrBufSize(Str: PAnsiChar): Cardinal;
 begin
   if Str <> Nil then
    result := cardinal(pointer(Str - SizeOf(cardinal))^)-sizeof(cardinal)

+ 23 - 24
rtl/objpas/sysutils/syspchh.inc

@@ -15,30 +15,29 @@
 }
 
 { shared with strings unit }
-function StrLen(p:pchar):sizeint;external name 'FPC_PCHAR_LENGTH';overload;
-function StrCopy(dest,source : pchar) : pchar;overload;
-function StrLCopy(dest,source : pchar;maxlen : SizeInt) : pchar;overload;
-function StrECopy(dest,source : pchar) : pchar;
-function StrEnd(p : pchar) : pchar;
-function StrCat(dest,source : pchar) : pchar;
-function StrComp(str1,str2 : pchar) : SizeInt;
-function StrLComp(str1,str2 : pchar;l : SizeInt) : SizeInt;
-function StrIComp(str1,str2 : pchar) : SizeInt;
-function StrMove(dest,source : pchar;l : SizeInt) : pchar; overload;
-function StrLCat(dest,source : pchar;l : SizeInt) : pchar;
-function StrScan(p : pchar;c : char) : pchar; overload;
-function StrRScan(p : pchar;c : char) : pchar;
-function StrLower(p : pchar) : pchar;
-function StrUpper(p : pchar) : pchar;
-function StrLIComp(str1,str2 : pchar;l : SizeInt) : SizeInt;
-function StrPos(str1,str2 : pchar) : pchar;
-function StrNew(p : pchar) : pchar; overload;
+function StrLen(p:PAnsiChar):sizeint;external name 'FPC_PCHAR_LENGTH';overload;
+function StrCopy(dest,source : PAnsiChar) : PAnsiChar;overload;
+function StrLCopy(dest,source : PAnsiChar;maxlen : SizeInt) : PAnsiChar;overload;
+function StrECopy(dest,source : PAnsiChar) : PAnsiChar;
+function StrEnd(p : PAnsiChar) : PAnsiChar;
+function StrCat(dest,source : PAnsiChar) : PAnsiChar;
+function StrComp(str1,str2 : PAnsiChar) : SizeInt;
+function StrLComp(str1,str2 : PAnsiChar;l : SizeInt) : SizeInt;
+function StrIComp(str1,str2 : PAnsiChar) : SizeInt;
+function StrMove(dest,source : PAnsiChar;l : SizeInt) : PAnsiChar; overload;
+function StrLCat(dest,source : PAnsiChar;l : SizeInt) : PAnsiChar;
+function StrScan(p : PAnsiChar;c : AnsiChar) : PAnsiChar; overload;
+function StrRScan(p : PAnsiChar;c : AnsiChar) : PAnsiChar;
+function StrLower(p : PAnsiChar) : PAnsiChar;
+function StrUpper(p : PAnsiChar) : PAnsiChar;
+function StrLIComp(str1,str2 : PAnsiChar;l : SizeInt) : SizeInt;
+function StrPos(str1,str2 : PAnsiChar) : PAnsiChar;
+function StrNew(p : PAnsiChar) : PAnsiChar; overload;
 
 { Different from strings unit - ansistrings or different behaviour }
-function StrPas(Str: PChar): string;overload;
-function StrPCopy(Dest: PChar; Const Source: string): PChar;overload;
-function StrPLCopy(Dest: PChar; Const Source: string; MaxLen: SizeUInt): PChar;overload;
-function StrAlloc(Size: cardinal): PChar;
-function StrBufSize(Str: PChar): Cardinal;
-procedure StrDispose(Str: PChar);
+function StrPas(Str: PAnsiChar): string;overload;
+function StrPCopy(Dest: PAnsiChar; Const Source: string): PAnsiChar;overload;
+function StrPLCopy(Dest: PAnsiChar; Const Source: string; MaxLen: SizeUInt): PAnsiChar;overload;
+function StrAlloc(Size: cardinal): PAnsiChar;
+function StrBufSize(Str: PAnsiChar): Cardinal;
 

+ 71 - 71
rtl/objpas/sysutils/sysstr.inc

@@ -87,20 +87,20 @@ function IsLeadChar(B: Byte): Boolean; inline;
 
 
 begin
-  Result:=Char(B) in LeadBytes;
+  Result:=AnsiChar(B) in LeadBytes;
 end;
 
 Function InternalChangeCase(Const S : AnsiString; const Chars: TSysCharSet; const Adjustment: Longint): AnsiString;
   var
     i : Integer;
-    P : PChar;
+    P : PAnsiChar;
     Unique : Boolean;
   begin
     Result := S;
     if Result='' then
       exit;
     Unique:=false;
-    P:=PChar(Result);
+    P:=PAnsiChar(Result);
     for i:=1 to Length(Result) do
       begin
         if CharInSet(P^,Chars) then
@@ -111,7 +111,7 @@ Function InternalChangeCase(Const S : AnsiString; const Chars: TSysCharSet; cons
                 p:=@Result[i];
                 Unique:=true;
               end;
-            P^:=Char(Ord(P^)+Adjustment);
+            P^:=AnsiChar(Ord(P^)+Adjustment);
           end;
         Inc(P);
       end;
@@ -239,7 +239,7 @@ function CompareText(const S1, S2: string): Integer; overload;
 var
   i, count, count1, count2: sizeint;
   Chr1, Chr2: byte;
-  P1, P2: PChar;
+  P1, P2: PAnsiChar;
 begin
   Count1 := Length(S1);
   Count2 := Length(S2);
@@ -321,7 +321,7 @@ end;
 {==============================================================================}
 
 type
-  TCaseTranslationTable = array[0..255] of char;
+  TCaseTranslationTable = array[0..255] of AnsiChar;
 
 var
   { Tables with upper and lowercase forms of character sets.
@@ -385,7 +385,7 @@ begin
     Result:=L1-L2;
 end;
 
-function GenericAnsiStrComp(S1, S2: PChar): PtrInt;
+function GenericAnsiStrComp(S1, S2: PAnsiChar): PtrInt;
 
 begin
   Result:=0;
@@ -413,7 +413,7 @@ begin
 end;
 
 
-function GenericAnsiStrIComp(S1, S2: PChar): PtrInt;
+function GenericAnsiStrIComp(S1, S2: PAnsiChar): PtrInt;
 
 begin
   Result:=0;
@@ -441,7 +441,7 @@ begin
 end;
 
 
-function GenericAnsiStrLComp(S1, S2: PChar; MaxLen: PtrUInt): PtrInt;
+function GenericAnsiStrLComp(S1, S2: PAnsiChar; MaxLen: PtrUInt): PtrInt;
 
 Var I : PtrUInt;
 
@@ -469,7 +469,7 @@ begin
 end;
 
 
-function GenericAnsiStrLIComp(S1, S2: PChar; MaxLen: PtrUInt): PtrInt;
+function GenericAnsiStrLIComp(S1, S2: PAnsiChar; MaxLen: PtrUInt): PtrInt;
 
 Var I : PtrUInt;
 
@@ -497,7 +497,7 @@ begin
 end;
 
 
-function GenericAnsiStrLower(Str: PChar): PChar;
+function GenericAnsiStrLower(Str: PAnsiChar): PAnsiChar;
 begin
 result := Str;
 if Str <> Nil then begin
@@ -509,7 +509,7 @@ if Str <> Nil then begin
 end;
 
 
-function GenericAnsiStrUpper(Str: PChar): PChar;
+function GenericAnsiStrUpper(Str: PAnsiChar): PAnsiChar;
 begin
 result := Str;
 if Str <> Nil then begin
@@ -533,15 +533,15 @@ begin
   AnsiSameStr:=AnsiCompareStr(S1,S2)=0;
 end;
 
-function AnsiLastChar(const S: string): PChar;
+function AnsiLastChar(const S: string): PAnsiChar;
 
 begin
   //!! No multibyte yet, so we return the last one.
-  result:=StrEnd(Pchar(pointer(S)));  // strend checks for nil
+  result:=StrEnd(PAnsiChar(pointer(S)));  // strend checks for nil
   Dec(Result);
 end ;
 
-function AnsiStrLastChar(Str: PChar): PChar;
+function AnsiStrLastChar(Str: PAnsiChar): PAnsiChar;
 begin
   //!! No multibyte yet, so we return the last one.
   result:=StrEnd(Str);
@@ -575,41 +575,41 @@ function AnsiCompareText(const S1, S2: string): integer;{$ifdef SYSUTILSINLINE}i
   end;
 
 
-function AnsiStrComp(S1, S2: PChar): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function AnsiStrComp(S1, S2: PAnsiChar): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
   begin
     // CAPSIZEINT is no-op if Sizeof(Sizeint)<=SizeOF(Integer)
     result:=CAPSIZEINT(widestringmanager.StrCompAnsiStringProc(s1,s2));
   end;
 
 
-function AnsiStrIComp(S1, S2: PChar): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function AnsiStrIComp(S1, S2: PAnsiChar): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
   begin
     // CAPSIZEINT is no-op if Sizeof(Sizeint)<=SizeOF(Integer)
     result:=CAPSIZEINT(widestringmanager.StrICompAnsiStringProc(s1,s2));
   end;
 
 
-function AnsiStrLComp(S1, S2: PChar; MaxLen: SizeUInt): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function AnsiStrLComp(S1, S2: PAnsiChar; MaxLen: SizeUInt): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
   begin
     // CAPSIZEINT is no-op if Sizeof(Sizeint)<=SizeOF(Integer)
     result:=CAPSIZEINT(widestringmanager.StrLCompAnsiStringProc(s1,s2,maxlen));
   end;
 
 
-function AnsiStrLIComp(S1, S2: PChar; MaxLen: SizeUint): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function AnsiStrLIComp(S1, S2: PAnsiChar; MaxLen: SizeUint): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
   begin
     // CAPSIZEINT is no-op if Sizeof(Sizeint)<=SizeOF(Integer)
     result:=CAPSIZEINT(widestringmanager.StrLICompAnsiStringProc(s1,s2,maxlen));
   end;
 
 
-function AnsiStrLower(Str: PChar): PChar;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function AnsiStrLower(Str: PAnsiChar): PAnsiChar;{$ifdef SYSUTILSINLINE}inline;{$endif}
   begin
     result:=widestringmanager.StrLowerAnsiStringProc(Str);
   end;
 
 
-function AnsiStrUpper(Str: PChar): PChar;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function AnsiStrUpper(Str: PAnsiChar): PAnsiChar;{$ifdef SYSUTILSINLINE}inline;{$endif}
   begin
     result:=widestringmanager.StrUpperAnsiStringProc(Str);
   end;
@@ -669,7 +669,7 @@ end ;
 {   AnsiQuotedStr returns S quoted left and right by Quote,
     and every single occurance of Quote replaced by two   }
 
-function AnsiQuotedStr(const S: string; Quote: char): string;
+function AnsiQuotedStr(const S: string; Quote: AnsiChar): string;
 var i, j, count: integer;
 begin
 result := '' + Quote;
@@ -693,9 +693,9 @@ end ;
     of Quote replaced by a single Quote   }
 
 
-function AnsiExtractQuotedStr(var  Src: PChar; Quote: Char): string;
+function AnsiExtractQuotedStr(var  Src: PAnsiChar; Quote: AnsiChar): string;
 var
-  P,Q,R: PChar;
+  P,Q,R: PAnsiChar;
 begin
  result:='';
  if Src=Nil then exit;
@@ -724,7 +724,7 @@ begin
      P := P + 1;
    end ;
  src:=p;
- SetLength(result, (R-pchar(@Result[1])));
+ SetLength(result, (R-PAnsiChar(@Result[1])));
 end ;
 
 
@@ -740,7 +740,7 @@ end;
 
 function AdjustLineBreaks(const S: string; Style: TTextLineBreakStyle): string;
 var
-  Source,Dest: PChar;
+  Source,Dest: PAnsiChar;
   DestLen: Integer;
   I,J,L: Longint;
 
@@ -1124,7 +1124,7 @@ end;
 {$macro on}
 {$define INFORMAT}
 {$define TFormatString:=ansistring}
-{$define TFormatChar:=char}
+{$define TFormatChar:=AnsiChar}
 
 Function Format (Const Fmt : AnsiString; const Args : Array of const; const FormatSettings: TFormatSettings) : AnsiString;
 {$i sysformt.inc}
@@ -1194,26 +1194,26 @@ begin
 end;
 
 
-Function StrFmt(Buffer,Fmt : PChar; Const args: Array of const) : Pchar;
+Function StrFmt(Buffer,Fmt : PAnsiChar; Const args: Array of const) : PAnsiChar;
 
 begin
   Result:=StrFmt(Buffer,Fmt,Args,DefaultFormatSettings);
 end;
 
-Function StrFmt(Buffer,Fmt : PChar; Const Args: Array of const; Const FormatSettings: TFormatSettings): PChar;
+Function StrFmt(Buffer,Fmt : PAnsiChar; Const Args: Array of const; Const FormatSettings: TFormatSettings): PAnsiChar;
 
 begin
   Buffer[FormatBuf(Buffer^,Maxint,Fmt^,strlen(fmt),args,FormatSettings)]:=#0;
   Result:=Buffer;
 end;
 
-Function StrLFmt(Buffer : PCHar; Maxlen : Cardinal;Fmt : PChar; Const args: Array of const) : Pchar;
+Function StrLFmt(Buffer : PAnsiChar; Maxlen : Cardinal;Fmt : PAnsiChar; Const args: Array of const) : PAnsiChar;
 
 begin
   Result:=StrLFmt(Buffer,MaxLen,Fmt,Args,DefaultFormatSettings);
 end;
 
-Function StrLFmt(Buffer : PCHar; Maxlen : Cardinal;Fmt : PChar; Const args: Array of const; Const FormatSettings: TFormatSettings) : Pchar;
+Function StrLFmt(Buffer : PAnsiChar; Maxlen : Cardinal;Fmt : PAnsiChar; Const args: Array of const; Const FormatSettings: TFormatSettings) : PAnsiChar;
 
 begin
   Buffer[FormatBuf(Buffer^,MaxLen,Fmt^,strlen(fmt),args,FormatSettings)]:=#0;
@@ -1231,7 +1231,7 @@ end;
 Function StrToFloat(Const S : String; Const FormatSettings: TFormatSettings) : Extended;
 
 Begin // texttofloat handles NIL properly
-  If Not TextToFloat(Pchar(pointer(S)),Result,FormatSettings) then
+  If Not TextToFloat(PAnsiChar(pointer(S)),Result,FormatSettings) then
     Raise EConvertError.createfmt(SInValidFLoat,[S]);
 End;
 
@@ -1244,11 +1244,11 @@ end;
 Function StrToFloatDef(Const S: String; Const Default: Extended; Const FormatSettings: TFormatSettings): Extended;
 
 begin
-   if not TextToFloat(PChar(pointer(S)),Result,fvExtended,FormatSettings) then
+   if not TextToFloat(PAnsiChar(pointer(S)),Result,fvExtended,FormatSettings) then
      Result:=Default;
 end;
 
-Function TextToFloat(Buffer: PChar; Out Value: Extended; Const FormatSettings: TFormatSettings): Boolean;
+Function TextToFloat(Buffer: PAnsiChar; Out Value: Extended; Const FormatSettings: TFormatSettings): Boolean;
 
 Var
   E,P : Integer;
@@ -1288,19 +1288,19 @@ Begin
 End;
 
 
-Function TextToFloat(Buffer: PChar; Out Value: Extended): Boolean;
+Function TextToFloat(Buffer: PAnsiChar; Out Value: Extended): Boolean;
 
 begin
   Result:=TextToFloat(Buffer,Value,DefaultFormatSettings);
 end;
 
-Function TextToFloat(Buffer: PChar; Out Value; ValueType: TFloatValue): Boolean;
+Function TextToFloat(Buffer: PAnsiChar; Out Value; ValueType: TFloatValue): Boolean;
 
 begin
   Result:=TextToFloat(Buffer,Value,ValueType,DefaultFormatSettings);
 end;
 
-Function TextToFloat(Buffer: PChar; Out Value; ValueType: TFloatValue; Const FormatSettings: TFormatSettings): Boolean;
+Function TextToFloat(Buffer: PAnsiChar; Out Value; ValueType: TFloatValue; Const FormatSettings: TFormatSettings): Boolean;
 
 Var
   E,P : Integer;
@@ -1363,7 +1363,7 @@ end;
 
 Function TryStrToFloat(Const S : String; Out Value: Single; Const FormatSettings: TFormatSettings): Boolean;
 Begin
-  Result := TextToFloat(PChar(pointer(S)), Value, fvSingle,FormatSettings);
+  Result := TextToFloat(PAnsiChar(pointer(S)), Value, fvSingle,FormatSettings);
 End;
 
 Function TryStrToFloat(Const S : String; Out Value: Double): Boolean;
@@ -1374,7 +1374,7 @@ end;
 
 Function TryStrToFloat(Const S : String; Out Value: Double; Const FormatSettings: TFormatSettings): Boolean;
 Begin
-  Result := TextToFloat(PChar(pointer(S)), Value, fvDouble,FormatSettings);
+  Result := TextToFloat(PAnsiChar(pointer(S)), Value, fvDouble,FormatSettings);
 End;
 
 {$ifdef FPC_HAS_TYPE_EXTENDED}
@@ -1386,7 +1386,7 @@ end;
 
 Function TryStrToFloat(Const S : String; Out Value: Extended; Const FormatSettings: TFormatSettings): Boolean;
 Begin
-  Result := TextToFloat(PChar(pointer(S)), Value,FormatSettings);
+  Result := TextToFloat(PAnsiChar(pointer(S)), Value,FormatSettings);
 End;
 {$endif FPC_HAS_TYPE_EXTENDED}
 
@@ -1402,13 +1402,13 @@ Function FloatToStrFIntl(const Value; format: TFloatFormat; Precision, Digits: I
 Var
   P, PE, Q, Exponent: Integer;
   Negative: Boolean;
-  DS: Char;
+  DS: AnsiChar;
 
   function RemoveLeadingNegativeSign(var AValue: String): Boolean;
   // removes negative sign in case when result is zero eg. -0.00
   var
     i: PtrInt;
-    TS: Char;
+    TS: AnsiChar;
     StartPos: PtrInt;
   begin
     Result := False;
@@ -1791,7 +1791,7 @@ End;
 {$endif FPC_COMP_IS_INT64}
 
 
-Function FloatToText(Buffer: PChar; Value: Extended; format: TFloatFormat; Precision, Digits: Integer; Const FormatSettings: TFormatSettings): Longint;
+Function FloatToText(Buffer: PAnsiChar; Value: Extended; format: TFloatFormat; Precision, Digits: Integer; Const FormatSettings: TFormatSettings): Longint;
 Var
   Tmp: String[40];
 Begin
@@ -1801,7 +1801,7 @@ Begin
 End;
 
 
-Function FloatToText(Buffer: PChar; Value: Extended; format: TFloatFormat; Precision, Digits: Integer): Longint;
+Function FloatToText(Buffer: PAnsiChar; Value: Extended; format: TFloatFormat; Precision, Digits: Integer): Longint;
 
 begin
   Result:=FloatToText(Buffer,Value,Format,Precision,Digits,DefaultFormatSettings);
@@ -1957,49 +1957,49 @@ end;
 
 function StrToCurr(const S: string): Currency;
 begin
-  if not TextToFloat(PChar(pointer(S)), Result, fvCurrency) then
+  if not TextToFloat(PAnsiChar(pointer(S)), Result, fvCurrency) then
     Raise EConvertError.createfmt(SInValidFLoat,[S]);
 end;
 
 
 function StrToCurr(const S: string; Const FormatSettings: TFormatSettings): Currency;
 begin
-  if not TextToFloat(PChar(pointer(S)), Result, fvCurrency,FormatSettings) then
+  if not TextToFloat(PAnsiChar(pointer(S)), Result, fvCurrency,FormatSettings) then
     Raise EConvertError.createfmt(SInValidFLoat,[S]);
 end;
 
 
 Function TryStrToCurr(Const S : String; Out Value: Currency): Boolean;
 Begin
-  Result := TextToFloat(PChar(pointer(S)), Value, fvCurrency);
+  Result := TextToFloat(PAnsiChar(pointer(S)), Value, fvCurrency);
 End;
 
 
 function TryStrToCurr(const S: string;Out Value : Currency; Const FormatSettings: TFormatSettings): Boolean;
 Begin
-  Result := TextToFloat(PChar(pointer(S)), Value, fvCurrency,FormatSettings);
+  Result := TextToFloat(PAnsiChar(pointer(S)), Value, fvCurrency,FormatSettings);
 End;
 
 
 function StrToCurrDef(const S: string; Default : Currency): Currency;
 begin
-  if not TextToFloat(PChar(pointer(S)), Result, fvCurrency) then
+  if not TextToFloat(PAnsiChar(pointer(S)), Result, fvCurrency) then
     Result:=Default;
 end;
 
 function StrToCurrDef(const S: string; Default : Currency; Const FormatSettings: TFormatSettings): Currency;
 begin
-  if not TextToFloat(PChar(pointer(S)), Result, fvCurrency,FormatSettings) then
+  if not TextToFloat(PAnsiChar(pointer(S)), Result, fvCurrency,FormatSettings) then
     Result:=Default;
 end;
 {$endif FPUNONE}
 
-function AnsiDequotedStr(const S: string; AQuote: Char): string;
+function AnsiDequotedStr(const S: string; AQuote: AnsiChar): string;
 
-var p : pchar;
+var p : PAnsiChar;
 
 begin
-  p:=pchar(pointer(s)); // work around CONST. Ansiextract is safe for nil
+  p:=PAnsiChar(pointer(s)); // work around CONST. Ansiextract is safe for nil
   result:=AnsiExtractquotedStr(p,AQuote);
 end;
 
@@ -2112,7 +2112,7 @@ end;
 
 {$ifndef FPUNONE}
 
-Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar): Integer;
+Function FloatToTextFmt(Buffer: PAnsiChar; Value: Extended; format: PAnsiChar): Integer;
 
 begin
   Result:=FloatToTextFmt(Buffer,Value,Format,DefaultFormatSettings);
@@ -2125,7 +2125,7 @@ end;
 
 {$I fmtflt.inc}
 
-Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar; FormatSettings : TFormatSettings): Integer;
+Function FloatToTextFmt(Buffer: PAnsiChar; Value: Extended; format: PAnsiChar; FormatSettings : TFormatSettings): Integer;
 
 begin
   Result:=IntFloatToTextFmt(Buffer,Value,fvExtended,Format,FormatSettings);
@@ -2189,7 +2189,7 @@ begin
       else
         begin
           if BeforeDot then
-            begin  // Currently this is always 1 char
+            begin  // Currently this is always 1 AnsiChar
               Inc(Result.Exponent);
               Result.Digits[N-Start] := Buffer[N];
               if Buffer[N] <> '0' then
@@ -2276,10 +2276,10 @@ end;
 Function FormatFloat(Const Format : String; Value : Extended; Const FormatSettings: TFormatSettings) : String;
 
 Var
-  buf : Array[0..1024] of char;
+  buf : Array[0..1024] of AnsiChar;
 
-Begin // not changed to pchar(pointer(). Possibly not safe
-  Buf[FloatToTextFmt(@Buf[0],Value,Pchar(Format),FormatSettings)]:=#0;
+Begin // not changed to PAnsiChar(pointer(). Possibly not safe
+  Buf[FloatToTextFmt(@Buf[0],Value,PAnsiChar(Format),FormatSettings)]:=#0;
   Result:=StrPas(@Buf[0]);
 End;
 
@@ -2368,8 +2368,8 @@ end;
 {$define INSTRINGREPLACE}
 {$define SRString:=String}
 {$define SRUpperCase:=AnsiUppercase}
-{$define SRPCHAR:=PChar}
-{$define SRCHAR:=Char}
+{$define SRPCHAR:=PAnsiChar}
+{$define SRCHAR:=AnsiChar}
 
 Function StringReplace(const S, OldPattern, NewPattern: string;  Flags: TReplaceFlags): string;
 
@@ -2434,19 +2434,19 @@ begin
 end;
 
 
-Function StrByteType(Str: PChar; Index: SizeUInt): TMbcsByteType;
+Function StrByteType(Str: PAnsiChar; Index: SizeUInt): TMbcsByteType;
 begin
   Result:=mbSingleByte;
 end;
 
 
-Function StrCharLength(const Str: PChar): SizeInt;
+Function StrCharLength(const Str: PAnsiChar): SizeInt;
 begin
   result:=widestringmanager.CharLengthPCharProc(Str);
 end;
 
 
-function StrNextChar(const Str: PChar): PChar;
+function StrNextChar(const Str: PAnsiChar): PAnsiChar;
 begin
   result:=Str+StrCharLength(Str);
 end;
@@ -2497,7 +2497,7 @@ const
 
 Var
   L : String;
-  C,LQ,BC : Char;
+  C,LQ,BC : AnsiChar;
   P,BLen,Len : Integer;
   HB,IBC : Boolean;
 
@@ -2570,7 +2570,7 @@ cd    it is better to not use those, since most implementation are not 100%
 const
 {$if defined(MSDOS) or defined(GO32V2) or defined(WATCOM) or defined(WIN16) }
    { upper case translation table for character set 850 }
-   CP850UCT: array[128..255] of char =
+   CP850UCT: array[128..255] of AnsiChar =
    (#128,#154,#144,#182,#142,#182,#143,#128,#210,#211,#212,#216,#215,#222,#142,#143,
     #144,#146,#146,#226,#153,#227,#234,#235,'Y',#153,#154,#157,#156,#157,#158,#159,
     #181,#214,#224,#233,#165,#165,#166,#167,#168,#169,#170,#171,#172,#173,#174,#175,
@@ -2581,7 +2581,7 @@ const
     #240,#241,#242,#243,#244,#245,#246,#247,#248,#249,#250,#251,#252,#253,#254,#255);
 
    { lower case translation table for character set 850 }
-   CP850LCT: array[128..255] of char =
+   CP850LCT: array[128..255] of AnsiChar =
    (#135,#129,#130,#131,#132,#133,#134,#135,#136,#137,#138,#139,#140,#141,#132,#134,
     #130,#145,#145,#147,#148,#149,#150,#151,#152,#148,#129,#155,#156,#155,#158,#159,
     #160,#161,#162,#163,#164,#164,#166,#167,#168,#169,#170,#171,#172,#173,#174,#175,
@@ -2593,7 +2593,7 @@ const
 {$endif}
 
    { upper case translation table for character set ISO 8859/1  Latin 1  }
-   CPISO88591UCT: array[192..255] of char =
+   CPISO88591UCT: array[192..255] of AnsiChar =
    ( #192, #193, #194, #195, #196, #197, #198, #199,
      #200, #201, #202, #203, #204, #205, #206, #207,
      #208, #209, #210, #211, #212, #213, #214, #215,
@@ -2604,7 +2604,7 @@ const
      #216, #217, #218, #219, #220, #221, #222, #89 );
 
    { lower case translation table for character set ISO 8859/1  Latin 1  }
-   CPISO88591LCT: array[192..255] of char =
+   CPISO88591LCT: array[192..255] of AnsiChar =
    ( #224, #225, #226, #227, #228, #229, #230, #231,
      #232, #233, #234, #235, #236, #237, #238, #239,
      #240, #241, #242, #243, #244, #245, #246, #215,
@@ -2681,7 +2681,7 @@ function sscanf(const s: string; const fmt : string;const Pointers : array of Po
     end;
 
 
-  function ScanStr(c : Char) : Boolean;
+  function ScanStr(c : AnsiChar) : Boolean;
     begin
       while (Length(s) > n) and (s[n] <> c) do
         inc(n);
@@ -2758,7 +2758,7 @@ function sscanf(const s: string; const fmt : string;const Pointers : array of Po
             begin
               if Length(s)>n then
                 begin
-                  pchar(Pointers[i])^:=s[n];
+                  PAnsiChar(Pointers[i])^:=s[n];
                   inc(n);
                   inc(Result);
                 end

+ 29 - 29
rtl/objpas/sysutils/sysstrh.inc

@@ -30,7 +30,7 @@ type
    TFloatRec = Record
       Exponent: Integer;
       Negative: Boolean;
-      Digits: Array[0..18] Of Char;
+      Digits: Array[0..18] Of AnsiChar;
    End;
 
 const
@@ -52,7 +52,7 @@ const
 {$endif}
 
 Const
-  LeadBytes: set of Char = [];
+  LeadBytes: set of AnsiChar = [];
   EmptyStr : string = '';
   NullStr : PString = @EmptyStr;
 
@@ -73,7 +73,7 @@ function UpperCase(const s: string): string; overload;
 function UpperCase(const s: string; LocaleOptions: TLocaleOptions): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
 function LowerCase(const s: string): string; overload;
 function LowerCase(const s: string; LocaleOptions: TLocaleOptions): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
-{ the compiler can't decide else if it should use the char or the ansistring
+{ the compiler can't decide else if it should use the AnsiChar or the ansistring
   version for a variant }
 function LowerCase(const V: variant): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
 function CompareStr(const S1, S2: string): Integer; overload;
@@ -93,22 +93,22 @@ function AnsiCompareStr(const S1, S2: string): Integer;{$ifdef SYSUTILSINLINE}in
 function AnsiCompareText(const S1, S2: string): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
 function AnsiSameText(const s1,s2:String):Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
 function AnsiSameStr(const s1,s2:String):Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
-function AnsiStrComp(S1, S2: PChar): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
-function AnsiStrIComp(S1, S2: PChar): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
-function AnsiStrLComp(S1, S2: PChar; MaxLen: SizeUInt): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
-function AnsiStrLIComp(S1, S2: PChar; MaxLen: SizeUInt): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
-function AnsiStrLower(Str: PChar): PChar;{$ifdef SYSUTILSINLINE}inline;{$endif}
-function AnsiStrUpper(Str: PChar): PChar;{$ifdef SYSUTILSINLINE}inline;{$endif}
-function AnsiLastChar(const S: string): PChar;
-function AnsiStrLastChar(Str: PChar): PChar;
+function AnsiStrComp(S1, S2: PAnsiChar): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function AnsiStrIComp(S1, S2: PAnsiChar): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function AnsiStrLComp(S1, S2: PAnsiChar; MaxLen: SizeUInt): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function AnsiStrLIComp(S1, S2: PAnsiChar; MaxLen: SizeUInt): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function AnsiStrLower(Str: PAnsiChar): PAnsiChar;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function AnsiStrUpper(Str: PAnsiChar): PAnsiChar;{$ifdef SYSUTILSINLINE}inline;{$endif}
+function AnsiLastChar(const S: string): PAnsiChar;
+function AnsiStrLastChar(Str: PAnsiChar): PAnsiChar;
 
 function Trim(const S: string): string;
 function TrimLeft(const S: string): string;
 function TrimRight(const S: string): string;
 function QuotedStr(const S: string): string; {$ifdef SYSUTILSINLINE}inline;{$endif}
-function AnsiQuotedStr(const S: string; Quote: char): string;
-function AnsiDequotedStr(const S: string; AQuote: Char): string;
-function AnsiExtractQuotedStr(var Src: PChar; Quote: Char): string;
+function AnsiQuotedStr(const S: string; Quote: AnsiChar): string;
+function AnsiDequotedStr(const S: string; AQuote: AnsiChar): string;
+function AnsiExtractQuotedStr(var Src: PAnsiChar; Quote: AnsiChar): string;
 function AdjustLineBreaks(const S: string): string;
 function AdjustLineBreaks(const S: string; Style: TTextLineBreakStyle): string;
 function IsValidIdent(const Ident: string; AllowDots: Boolean = False; StrictDots: Boolean = False): Boolean;
@@ -152,10 +152,10 @@ Function Format (Const Fmt : String; const Args : Array of const) : String;
 Function Format (Const Fmt: string; const Args: array of const; const FormatSettings: TFormatSettings): string;
 Function FormatBuf (Var Buffer; BufLen : Cardinal; Const Fmt; fmtLen : Cardinal; Const Args : Array of const) : Cardinal;
 Function FormatBuf (Var Buffer; BufLen : Cardinal; Const Fmt; fmtLen : Cardinal; Const Args : Array of const; Const FormatSettings: TFormatSettings) : Cardinal;
-Function StrFmt(Buffer,Fmt : PChar; Const args: Array of const) : Pchar;
-Function StrFmt(Buffer,Fmt : PChar; Const Args: Array of const; Const FormatSettings: TFormatSettings): PChar;
-Function StrLFmt(Buffer : PCHar; Maxlen : Cardinal;Fmt : PChar; Const args: Array of const) : Pchar;
-Function StrLFmt(Buffer : PCHar; Maxlen : Cardinal;Fmt : PChar; Const args: Array of const; Const FormatSettings: TFormatSettings) : Pchar;
+Function StrFmt(Buffer,Fmt : PAnsiChar; Const args: Array of const) : PAnsiChar;
+Function StrFmt(Buffer,Fmt : PAnsiChar; Const Args: Array of const; Const FormatSettings: TFormatSettings): PAnsiChar;
+Function StrLFmt(Buffer : PAnsiChar; Maxlen : Cardinal;Fmt : PAnsiChar; Const args: Array of const) : PAnsiChar;
+Function StrLFmt(Buffer : PAnsiChar; Maxlen : Cardinal;Fmt : PAnsiChar; Const args: Array of const; Const FormatSettings: TFormatSettings) : PAnsiChar;
 Procedure FmtStr(Var Res: String; Const Fmt : String; Const args: Array of const);
 Procedure FmtStr(Var Res: string; const Fmt : string; Const args: Array of const; Const FormatSettings: TFormatSettings);
 {$ifndef FPUNONE}
@@ -205,12 +205,12 @@ Function TryStrToFloat(Const S : String; Out Value: Double; Const FormatSettings
 Function TryStrToFloat(Const S : String; Out Value: Extended): Boolean;
 Function TryStrToFloat(Const S : String; Out Value: Extended; Const FormatSettings: TFormatSettings): Boolean;
 {$endif FPC_HAS_TYPE_EXTENDED}
-Function TextToFloat(Buffer: PChar; Out Value: Extended): Boolean;
-Function TextToFloat(Buffer: PChar; Out Value: Extended; Const FormatSettings: TFormatSettings): Boolean;
-Function TextToFloat(Buffer: PChar; Out Value; ValueType: TFloatValue): Boolean;
-Function TextToFloat(Buffer: PChar; Out Value; ValueType: TFloatValue; Const FormatSettings: TFormatSettings): Boolean;
-Function FloatToText(Buffer: PChar; Value: Extended; format: TFloatFormat; Precision, Digits: Integer): Longint;
-Function FloatToText(Buffer: PChar; Value: Extended; format: TFloatFormat; Precision, Digits: Integer; Const FormatSettings: TFormatSettings): Longint;
+Function TextToFloat(Buffer: PAnsiChar; Out Value: Extended): Boolean;
+Function TextToFloat(Buffer: PAnsiChar; Out Value: Extended; Const FormatSettings: TFormatSettings): Boolean;
+Function TextToFloat(Buffer: PAnsiChar; Out Value; ValueType: TFloatValue): Boolean;
+Function TextToFloat(Buffer: PAnsiChar; Out Value; ValueType: TFloatValue; Const FormatSettings: TFormatSettings): Boolean;
+Function FloatToText(Buffer: PAnsiChar; Value: Extended; format: TFloatFormat; Precision, Digits: Integer): Longint;
+Function FloatToText(Buffer: PAnsiChar; Value: Extended; format: TFloatFormat; Precision, Digits: Integer; Const FormatSettings: TFormatSettings): Longint;
 Function FloatToDateTime (Const Value : Extended) : TDateTime;
 Function FloattoCurr (Const Value : Extended) : Currency;
 function TryFloatToCurr(const Value: Extended; var AResult: Currency): Boolean;
@@ -224,8 +224,8 @@ function TryStrToCurr(const S: string;Out Value : Currency; Const FormatSettings
 function StrToCurrDef(const S: string; Default : Currency): Currency;
 function StrToCurrDef(const S: string; Default : Currency; Const FormatSettings: TFormatSettings): Currency;
 
-Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar; FormatSettings : TFormatSettings): Integer;
-Function FloatToTextFmt(Buffer: PChar; Value: Extended; format: PChar): Integer;
+Function FloatToTextFmt(Buffer: PAnsiChar; Value: Extended; format: PAnsiChar; FormatSettings : TFormatSettings): Integer;
+Function FloatToTextFmt(Buffer: PAnsiChar; Value: Extended; format: PAnsiChar): Integer;
 Procedure FloatToDecimal(Out Result: TFloatRec; const Value; ValueType: TFloatValue; Precision, Decimals : integer);
 Procedure FloatToDecimal(Out Result: TFloatRec; Value: Extended; Precision, Decimals : integer);
 Function FormatFloat(Const Format : String; Value : Extended) : String;
@@ -256,12 +256,12 @@ Type
   TMbcsByteType = (mbSingleByte, mbLeadByte, mbTrailByte);
 
 Function ByteType(const S: string; Index: SizeUInt): TMbcsByteType;
-Function StrByteType(Str: PChar; Index: SizeUInt): TMbcsByteType;
+Function StrByteType(Str: PAnsiChar; Index: SizeUInt): TMbcsByteType;
 Function ByteToCharLen(const S: string; MaxLen: SizeInt): SizeInt;
 Function CharToByteLen(const S: string; MaxLen: SizeInt): SizeInt;
 Function ByteToCharIndex(const S: string; Index: SizeInt): SizeInt;
-Function StrCharLength(const Str: PChar): SizeInt;
-function StrNextChar(const Str: PChar): PChar;
+Function StrCharLength(const Str: PAnsiChar): SizeInt;
+function StrNextChar(const Str: PAnsiChar): PAnsiChar;
 function IsLeadChar(C: AnsiChar): Boolean; inline; overload;
 function IsLeadChar(B: Byte): Boolean; inline; overload;
 

+ 4 - 4
rtl/objpas/sysutils/sysuintf.inc

@@ -88,7 +88,7 @@ end;
 function TryStringToGUID(const S: string; out Guid: TGUID): Boolean;
 var
   e: Boolean;
-  p: PChar;
+  p: PAnsiChar;
 
   function rb: Byte;
   begin
@@ -101,7 +101,7 @@ var
     Inc(p);
   end;
 
-  procedure nextChar(c: Char); inline;
+  procedure nextChar(c: AnsiChar); inline;
   begin
     if p^ <> c then
       e := False;
@@ -111,7 +111,7 @@ var
 begin
   if Length(S)<>38 then Exit(False);
   e := True;
-  p := PChar(S);
+  p := PAnsiChar(S);
   nextChar('{');
   Guid.D1 := rb shl 28 or rb shl 24 or rb shl 20 or rb shl 16 or rb shl 12 or rb shl 8 or rb shl 4 or rb;
   nextChar('-');
@@ -155,7 +155,7 @@ end;
 function GUIDToString(const GUID: TGUID): string;
 begin
   SetLength(Result, 38);
-  StrLFmt(PChar(Result), 38,'{%.8x-%.4x-%.4x-%.2x%.2x-%.2x%.2x%.2x%.2x%.2x%.2x}',
+  StrLFmt(PAnsiChar(Result), 38,'{%.8x-%.4x-%.4x-%.2x%.2x-%.2x%.2x%.2x%.2x%.2x%.2x}',
     [
      Longint(GUID.D1), GUID.D2, GUID.D3,
      GUID.D4[0], GUID.D4[1], GUID.D4[2], GUID.D4[3],

+ 1 - 1
rtl/objpas/sysutils/sysuni.inc

@@ -411,7 +411,7 @@ function strupper(p : pwidechar) : pwidechar;
 function strlicomp(str1,str2 : pwidechar;l : SizeInt) : SizeInt;
   var
    counter: sizeint;
-   c1, c2: char;
+   c1, c2: AnsiChar;
   begin
     counter := 0;
     if l=0 then

+ 2 - 2
rtl/objpas/sysutils/sysutilh.inc

@@ -239,7 +239,7 @@ type
    function ExceptFrameCount: Longint;
    function ExceptFrames: PCodePointer;
    function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer;
-                                  Buffer: PChar; Size: Integer): Integer;
+                                  Buffer: PAnsiChar; Size: Integer): Integer;
    procedure ShowException(ExceptObject: TObject; ExceptAddr: Pointer);
    procedure Abort;
    procedure OutOfMemoryError;
@@ -289,7 +289,7 @@ Type
    TTextRec=TextRec;
 
 
-  { Read pchar handling functions declaration }
+  { Read PAnsiChar handling functions declaration }
   {$i syspchh.inc}
 
   { MCBS functions }

+ 2 - 2
rtl/objpas/sysutils/sysutils.inc

@@ -130,7 +130,7 @@ begin
 end;
 {$ENDIF}
 
-  { Read pchar handling functions implementation }
+  { Read PAnsiChar handling functions implementation }
   {$i syspch.inc}
 
   { generic internationalisation code }
@@ -571,7 +571,7 @@ begin
 end;
 
 function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer;
-                               Buffer: PChar; Size: Integer): Integer;
+                               Buffer: PAnsiChar; Size: Integer): Integer;
 
 Var
   S : AnsiString;