Pārlūkot izejas kodu

* Char -> AnsiChar

Michael VAN CANNEYT 2 gadi atpakaļ
vecāks
revīzija
6ffa3d4a89

+ 25 - 25
rtl/unix/bunxh.inc

@@ -29,11 +29,11 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
 {$endif ndef FPC_SYS_SIGTIMEDWAIT_UNAVAILABLE}
 
     Function  FpUmask      (cmask : TMode): TMode;
-    Function  FpLink       (existing : pChar; newone : pChar): cInt;
-    Function  FpMkfifo     (path : pChar; Mode : TMode): cInt;
-    Function  FpChmod      (path : pChar; Mode : TMode): cInt;
-    Function  FpChown      (path : pChar; owner : TUid; group : TGid): cInt;
-    Function  FpUtime      (path : pChar; times : putimbuf): cInt;
+    Function  FpLink       (existing : PAnsiChar; newone : PAnsiChar): cInt;
+    Function  FpMkfifo     (path : PAnsiChar; Mode : TMode): cInt;
+    Function  FpChmod      (path : PAnsiChar; Mode : TMode): cInt;
+    Function  FpChown      (path : PAnsiChar; owner : TUid; group : TGid): cInt;
+    Function  FpUtime      (path : PAnsiChar; times : putimbuf): cInt;
 {$if defined(freebsd)}
     Function  FpPipe       (var fildes : tfildes; flags : cInt=0):cInt;
 {$else}
@@ -63,34 +63,34 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     Function  FpFcntl      (fildes : cInt; cmd : cInt; arg : cInt): cInt;
     Function  FpFcntl      (fildes : cInt; cmd : cInt; var arg : flock): cInt;
 
-    Function  FpGetcwd     (path:pChar; siz:TSize):pChar;  external name 'FPC_SYSC_GETCWD';
+    Function  FpGetcwd     (path:PAnsiChar; siz:TSize):PAnsiChar;  external name 'FPC_SYSC_GETCWD';
     Function  FpFork : TPid; external name 'FPC_SYSC_FORK';
-    Function  FpExecve     (path : pChar; argv : ppChar; envp: ppChar): cInt;
-    Function  FpExecv      (path : pChar; argv : ppChar): cInt;
+    Function  FpExecve     (path : PAnsiChar; argv : PPAnsiChar; envp: PPAnsiChar): cInt;
+    Function  FpExecv      (path : PAnsiChar; argv : PPAnsiChar): cInt;
     Function  FpWaitpid    (pid : TPid; stat_loc : pcInt; options: cInt): TPid; external name 'FPC_SYSC_WAITPID';
     Function  FpWait       (var stat_loc : cInt): TPid;
     Procedure FpExit       (Status : cInt);  external name 'FPC_SYSC_EXIT';
     Function  FpKill       (pid : TPid; sig: cInt): cInt;
     Function  FpUname      (var name: utsname): cInt;
-    Function  FpOpendir    (dirname : pChar): pDir;  external name 'FPC_SYSC_OPENDIR';
+    Function  FpOpendir    (dirname : PAnsiChar): pDir;  external name 'FPC_SYSC_OPENDIR';
     Function  FpReaddir    (var dirp : Dir) : pDirent; external name 'FPC_SYSC_READDIR';
     Function  FpClosedir   (var dirp : Dir): cInt; external name 'FPC_SYSC_CLOSEDIR';
-    Function  FpChdir      (path : pChar): cInt;  external name 'FPC_SYSC_CHDIR';
-    Function  FpOpen       (path : pChar; flags : cInt; Mode: TMode):cInt; external name 'FPC_SYSC_OPEN';
-    Function  FpMkdir      (path : pChar; Mode: TMode):cInt;  external name 'FPC_SYSC_MKDIR';
-    Function  FpUnlink     (path : pChar): cInt;  external name 'FPC_SYSC_UNLINK';
-    Function  FpRmdir      (path : pChar): cInt; external name 'FPC_SYSC_RMDIR';
-    Function  FpRename     (old  : pChar; newpath: pChar): cInt;   external name 'FPC_SYSC_RENAME';
+    Function  FpChdir      (path : PAnsiChar): cInt;  external name 'FPC_SYSC_CHDIR';
+    Function  FpOpen       (path : PAnsiChar; flags : cInt; Mode: TMode):cInt; external name 'FPC_SYSC_OPEN';
+    Function  FpMkdir      (path : PAnsiChar; Mode: TMode):cInt;  external name 'FPC_SYSC_MKDIR';
+    Function  FpUnlink     (path : PAnsiChar): cInt;  external name 'FPC_SYSC_UNLINK';
+    Function  FpRmdir      (path : PAnsiChar): cInt; external name 'FPC_SYSC_RMDIR';
+    Function  FpRename     (old  : PAnsiChar; newpath: PAnsiChar): cInt;   external name 'FPC_SYSC_RENAME';
     Function  FpFStat      (fd : cInt; var sb : stat): cInt; external name 'FPC_SYSC_FSTAT';
-    Function  FpStat       (path: pChar; var buf : stat): cInt;  external name 'FPC_SYSC_STAT';
-    Function  FpAccess     (pathname : pChar; aMode : cInt): cInt; external name 'FPC_SYSC_ACCESS';
+    Function  FpStat       (path: PAnsiChar; var buf : stat): cInt;  external name 'FPC_SYSC_STAT';
+    Function  FpAccess     (pathname : PAnsiChar; aMode : cInt): cInt; external name 'FPC_SYSC_ACCESS';
     Function  FpClose      (fd : cInt): cInt;  external name 'FPC_SYSC_CLOSE';
 
-    Function  FpRead       (fd : cInt; buf: pChar; nbytes : TSize): TSsize; external name 'FPC_SYSC_READ';
-    Function  FpPRead      (fd : cInt; buf: pChar; nbytes : TSize; offset:Toff): TSsize;
+    Function  FpRead       (fd : cInt; buf: PAnsiChar; nbytes : TSize): TSsize; external name 'FPC_SYSC_READ';
+    Function  FpPRead      (fd : cInt; buf: PAnsiChar; nbytes : TSize; offset:Toff): TSsize;
     function  FpReadV	   (fd: cint; const iov : piovec; iovcnt : cint):TSSize;
-    Function  FpWrite      (fd : cInt; buf:pChar; nbytes : TSize): TSsize;  external name 'FPC_SYSC_WRITE';
-    Function  FpPWrite     (fd : cInt; buf:pChar; nbytes : TSize; offset:Toff): TSSize;
+    Function  FpWrite      (fd : cInt; buf:PAnsiChar; nbytes : TSize): TSsize;  external name 'FPC_SYSC_WRITE';
+    Function  FpPWrite     (fd : cInt; buf:PAnsiChar; nbytes : TSize; offset:Toff): TSSize;
     function  FpWriteV	   (fd: cint; const iov : piovec; iovcnt : cint):TSSize;
 
     Function  FpLseek      (fd : cInt; offset : TOff; whence : cInt): TOff; external name 'FPC_SYSC_LSEEK';
@@ -101,9 +101,9 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     Function  FpPoll       (fds: ppollfd; nfds: cuint; timeout: clong): cint;
     Function  FpIOCtl      (Handle:cint;Ndx: TIOCtlRequest; Data: Pointer):cint; external name  'FPC_SYSC_IOCTL';
     Function  FpNanoSleep  (req : ptimespec;rem : ptimespec):cint; external name 'FPC_SYSC_NANOSLEEP';
-    Function  fpLstat(path:pchar;Info:pstat):cint;
-    Function  fpSymlink(oldname,newname:pchar):cint;
-    Function  fpReadLink(name,linkname:pchar;maxlen:size_t):cint; external name  'FPC_SYSC_READLINK';
+    Function  fpLstat(path:PAnsiChar;Info:pstat):cint;
+    Function  fpSymlink(oldname,newname:PAnsiChar):cint;
+    Function  fpReadLink(name,linkname:PAnsiChar;maxlen:size_t):cint; external name  'FPC_SYSC_READLINK';
 
     function  fpNice(N:cint):cint;
     Function  fpGetPriority(Which,Who:cint):cint;
@@ -112,7 +112,7 @@ Type TGrpArr = Array [0..0] of TGid;            { C style array workarounds}
     Function  Fpmunmap(start:pointer;len:size_t):cint;  external name 'FPC_SYSC_MUNMAP';
     Function  Fpmprotect(start:pointer;len:size_t;prot:cint):cint; external name 'FPC_SYSC_MPROTECT';
 
-    Function  FpGetEnv (name : pChar): pChar; external name 'FPC_SYSC_FPGETENVPCHAR';
+    Function  FpGetEnv (name : PAnsiChar): PAnsiChar; external name 'FPC_SYSC_FPGETENVPCHAR';
     function  fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint;
 
     function FpGetRLimit(resource:cint;rlim:PRLimit):cint; external name 'FPC_SYSC_GETRLIMIT';

+ 33 - 33
rtl/unix/bunxovl.inc

@@ -19,7 +19,7 @@ var
 Begin
   SystemExistingFileName:=ToSingleByteFileSystemEncodedFileName(existing);
   SystemNewOneFileName:=ToSingleByteFileSystemEncodedFileName(newone);
-  FpLink:=FpLink(pchar(SystemExistingFileName),pchar(SystemNewOneFileName));
+  FpLink:=FpLink(PAnsiChar(SystemExistingFileName),PAnsiChar(SystemNewOneFileName));
 End;
 
 Function  FpMkfifo (const path : RawByteString; Mode : TMode): cInt; {$ifdef VER2_0}inline;{$endif}
@@ -27,7 +27,7 @@ var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpMkfifo:=FpMkfifo(pchar(SystemPath),mode);
+  FpMkfifo:=FpMkfifo(PAnsiChar(SystemPath),mode);
 End;
 
 Function  FpChmod (const path : RawByteString; Mode : TMode): cInt; {$ifdef VER2_0}inline;{$endif}
@@ -35,7 +35,7 @@ var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpChmod:=FpChmod(pchar(SystemPath),mode);
+  FpChmod:=FpChmod(PAnsiChar(SystemPath),mode);
 End;
 
 Function  FpChown (const path : RawByteString; owner : TUid; group : TGid): cInt;{$ifdef VER2_0}inline;{$endif}
@@ -43,7 +43,7 @@ var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpChown:=FpChown(pchar(SystemPath),owner,group);
+  FpChown:=FpChown(PAnsiChar(SystemPath),owner,group);
 End;
 
 Function  FpUtime (const path : RawByteString; times : putimbuf): cInt; {$ifdef VER2_0}inline;{$endif}
@@ -51,7 +51,7 @@ var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpUtime:=FpUtime(pchar(SystemPath),times);
+  FpUtime:=FpUtime(PAnsiChar(SystemPath),times);
 End;
 
 {
@@ -60,14 +60,14 @@ var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpGetcwd:=RawByteString(pchar(FpGetcwd(pchar(SystemPath),siz)));
+  FpGetcwd:=RawByteString(PAnsiChar(FpGetcwd(PAnsiChar(SystemPath),siz)));
   SetCodePage(FpGetcwd,DefaultFileSystemCodePage,false);
 End;
 }
 Function  FpGetcwd: RawByteString;
 
 Var
-  Buf : Array[0..PATH_MAX+1]  of char;
+  Buf : Array[0..PATH_MAX+1]  of AnsiChar;
 Begin
   Buf[PATH_MAX+1]:=#0;
   If FpGetcwd(@Buf[0],PATH_MAX)=Nil then
@@ -79,20 +79,20 @@ Begin
     end;
 End;
 
-Function  FpExecve (const path : RawByteString; argv : ppchar; envp: ppchar): cInt; {$ifdef VER2_0}inline;{$endif}
+Function  FpExecve (const path : RawByteString; argv : PPAnsiChar; envp: PPAnsiChar): cInt; {$ifdef VER2_0}inline;{$endif}
 var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpExecve:=FpExecve (pchar(SystemPath),argv,envp);
+  FpExecve:=FpExecve (PAnsiChar(SystemPath),argv,envp);
 End;
 
-Function  FpExecv (const path : RawByteString; argv : ppchar): cInt; {$ifdef VER2_0}inline;{$endif}
+Function  FpExecv (const path : RawByteString; argv : PPAnsiChar): cInt; {$ifdef VER2_0}inline;{$endif}
 var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpExecv:=FpExecve (pchar(SystemPath),argv,envp);
+  FpExecv:=FpExecve (PAnsiChar(SystemPath),argv,envp);
 End;
 
 
@@ -101,7 +101,7 @@ var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpChDir:=FpChdir(pchar(SystemPath));
+  FpChDir:=FpChdir(PAnsiChar(SystemPath));
 End;
 
 Function  FpOpen (const path : RawByteString; flags : cInt; Mode: TMode):cInt; {$ifdef VER2_0}inline;{$endif}
@@ -109,7 +109,7 @@ var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpOpen:=FpOpen(pchar(SystemPath),flags,mode);
+  FpOpen:=FpOpen(PAnsiChar(SystemPath),flags,mode);
 End;
 
 
@@ -118,7 +118,7 @@ var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpMkdir:=FpMkdir(pchar(SystemPath),mode);
+  FpMkdir:=FpMkdir(PAnsiChar(SystemPath),mode);
 End;
 
 Function  FpUnlink (const path : RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
@@ -126,7 +126,7 @@ var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpUnlink:=FpUnlink(pchar(SystemPath));
+  FpUnlink:=FpUnlink(PAnsiChar(SystemPath));
 End;
 
 Function  FpRmdir (const path : RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
@@ -134,7 +134,7 @@ var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpRmdir:=FpRmdir(pchar(SystemPath));
+  FpRmdir:=FpRmdir(PAnsiChar(SystemPath));
 End;
 
 Function  FpRename (const old  : RawByteString; const newpath: RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
@@ -143,7 +143,7 @@ var
 Begin
   OldSystemPath:=ToSingleByteFileSystemEncodedFileName(old);
   NewSystemPath:=ToSingleByteFileSystemEncodedFileName(newpath);
-  FpRename:=FpRename(pchar(OldSystemPath),pchar(NewSystemPath));
+  FpRename:=FpRename(PAnsiChar(OldSystemPath),PAnsiChar(NewSystemPath));
 End;
 
 Function  FpStat (const path: RawByteString; var buf : stat): cInt; {$ifdef VER2_0}inline;{$endif}
@@ -151,7 +151,7 @@ var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpStat:=FpStat(pchar(SystemPath),buf);
+  FpStat:=FpStat(PAnsiChar(SystemPath),buf);
 End;
 
 Function  fpLstat   (const path: RawByteString; Info: pstat):cint; inline;
@@ -159,10 +159,10 @@ var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  fplstat:=fplstat(pchar(SystemPath), info);
+  fplstat:=fplstat(PAnsiChar(SystemPath), info);
 end;
 
-Function  fpLstat   (path:pchar;var Info:stat):cint; inline;
+Function  fpLstat   (path:PAnsiChar;var Info:stat):cint; inline;
 
 begin
   fpLstat:=fplstat(path,@info);
@@ -178,7 +178,7 @@ var
   SystemPathName: RawByteString;
 Begin
   SystemPathName:=ToSingleByteFileSystemEncodedFileName(pathname);
-  FpAccess:=FpAccess(pchar(SystemPathName),amode);
+  FpAccess:=FpAccess(PAnsiChar(SystemPathName),amode);
 End;
 
 Function  FPFStat(var F:Text;Var Info:stat):Boolean; {$ifdef VER2_0}inline;{$endif}
@@ -218,33 +218,33 @@ begin
 end;
 
 {$ifdef FPC_USE_LIBC} // can't remember why this is the case. Might be legacy.
-function xFpread(fd: cint; buf: pchar; nbytes : size_t): ssize_t; cdecl; external clib name 'read';
+function xFpread(fd: cint; buf: PAnsiChar; nbytes : size_t): ssize_t; cdecl; external clib name 'read';
 {$else}
-function xFpread(fd: cint; buf: pchar; nbytes : size_t): ssize_t; external name 'FPC_SYSC_READ';
+function xFpread(fd: cint; buf: PAnsiChar; nbytes : size_t): ssize_t; external name 'FPC_SYSC_READ';
 {$endif}
 
 Function  FpRead           (fd : cInt;var buf; nbytes : TSize): TSsize; {$ifdef VER2_0}inline;{$endif}
 
 begin
-  FPRead:=xFpRead(fd,pchar(@buf),nbytes);
+  FPRead:=xFpRead(fd,PAnsiChar(@buf),nbytes);
 end;
 
 Function  FpWrite          (fd : cInt;const buf; nbytes : TSize): TSsize; {$ifdef VER2_0}inline;{$endif}
 begin
- FpWrite:=FpWrite(fd,pchar(@buf),nbytes);
+ FpWrite:=FpWrite(fd,PAnsiChar(@buf),nbytes);
 end;
 
 {$ifdef linux}
 function  FppRead           (fd : cInt;var buf; nbytes : TSize; offset:Toff): TSsize; {$ifdef VER2_0}inline;{$endif}
 
 begin
-  FppRead:=FppRead(fd,pchar(@buf),nbytes,offset);
+  FppRead:=FppRead(fd,PAnsiChar(@buf),nbytes,offset);
 end;
 
 function  FppWrite          (fd : cInt;const buf; nbytes : TSize; offset:Toff): TSsize; {$ifdef VER2_0}inline;{$endif}
 
 begin
-  FppWrite:=FppWrite(fd,pchar(@buf),nbytes,offset);
+  FppWrite:=FppWrite(fd,PAnsiChar(@buf),nbytes,offset);
 end;
 {$endif}
 
@@ -254,7 +254,7 @@ const
                 S_IWGRP OR S_IRGRP OR
                 S_IWOTH OR S_IROTH;
 
-Function  FpOpen    (path : pChar; flags : cInt):cInt; {$ifdef VER2_0}inline;{$endif}
+Function  FpOpen    (path : PAnsiChar; flags : cInt):cInt; {$ifdef VER2_0}inline;{$endif}
 
 begin
  FpOpen:=FpOpen(path,flags,MODE_FPOPEN);
@@ -265,7 +265,7 @@ var
   SystemPath: RawByteString;
 Begin
   SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
-  FpOpen:=FpOpen(pchar(SystemPath),flags,MODE_FPOPEN);
+  FpOpen:=FpOpen(PAnsiChar(SystemPath),flags,MODE_FPOPEN);
 end;
 
 Function  FpOpen    (path : String; flags : cInt):cInt;
@@ -287,14 +287,14 @@ var
   SystemDirName: RawByteString;
 Begin
   SystemDirName:=ToSingleByteFileSystemEncodedFileName(dirname);
-  FpOpenDir:=FpOpenDir(pchar(SystemDirName));
+  FpOpenDir:=FpOpenDir(PAnsiChar(SystemDirName));
 End;
 
 
 Function  FpOpendir (dirname : shortString): pDir; {$ifdef VER2_0}inline;{$endif}
 Begin
   dirname:=dirname+#0;
-  FpOpenDir:=FpOpenDir(pchar(@dirname[1]));
+  FpOpenDir:=FpOpenDir(PAnsiChar(@dirname[1]));
 End;
 
 
@@ -302,7 +302,7 @@ Function  FpStat (path: String; var buf : stat): cInt;
 
 begin
  path:=path+#0;
- FpStat:=FpStat(pchar(@path[1]),buf);
+ FpStat:=FpStat(PAnsiChar(@path[1]),buf);
 end;
 
 Function fpDup(var oldfile,newfile:text):cint;
@@ -447,7 +447,7 @@ var
 begin
   SetLength(fpReadLink,PATH_MAX);
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(Name);
-  i:=fpReadLink(pchar(SystemFileName),pchar(fpReadLink),PATH_MAX);
+  i:=fpReadLink(PAnsiChar(SystemFileName),PAnsiChar(fpReadLink),PATH_MAX);
   if i>0 then
    begin
      SetLength(fpReadLink,i);

+ 5 - 5
rtl/unix/bunxovlh.inc

@@ -21,11 +21,11 @@ Function  FpChmod   (const path : RawByteString; Mode : TMode): cInt; inline;
 Function  FpChown   (const path : RawByteString; owner : TUid; group : TGid): cInt; inline;
 Function  FpUtime   (const path : RawByteString; times : putimbuf): cInt; inline;
 Function  FpGetcwd : RawByteString;
-Function  FpExecve  (const path : RawByteString; argv : ppchar; envp: ppchar): cInt; inline;
-Function  FpExecv   (const path : RawByteString; argv : ppchar): cInt; inline;
+Function  FpExecve  (const path : RawByteString; argv : ppansichar; envp: ppansichar): cInt; inline;
+Function  FpExecv   (const path : RawByteString; argv : ppansichar): cInt; inline;
 Function  FpOpendir (const dirname : RawByteString): pDir; inline;
 Function  FpOpendir (dirname : ShortString): pDir; inline;
-Function  FpOpen    (path : pChar; flags : cInt):cInt; inline;
+Function  FpOpen    (path : PAnsiChar; flags : cInt):cInt; inline;
 Function  FpOpen    (const path : RawByteString; flags : cInt):cInt; inline;
 Function  FpOpen    (const path : RawByteString; flags : cInt; Mode: TMode):cInt; inline;
 Function  FpOpen    (path : ShortString; flags : cInt):cInt;
@@ -38,7 +38,7 @@ Function  FpRename  (const old  : RawByteString; const newpath: RawByteString):
 Function  FpStat    (const path: RawByteString; var buf : stat): cInt; inline;
 Function  FpStat    (path: ShortString; var buf : stat): cInt;
 Function  fpLstat   (const path: RawByteString; Info: pstat):cint; inline;
-Function  fpLstat   (path:pchar;var Info:stat):cint; inline;
+Function  fpLstat   (path: PAnsiChar;var Info:stat):cint; inline;
 Function  fpLstat   (const Filename: RawByteString;var Info:stat):cint; inline;
 Function  FpAccess  (const pathname : RawByteString; aMode : cInt): cInt; inline;
 function  FpWaitPid (pid : TPid; Var Status : cInt; Options : cint) : TPid;
@@ -65,7 +65,7 @@ function  fptime    :time_t; inline;
 Function fpSelect   (N:cint;readfds,writefds,exceptfds:pfdset;TimeOut:cint):cint;
 Function fpSelect   (var T:Text;TimeOut :PTimeval):cint;
 Function fpSelect   (var T:Text;TimeOut :time_t):cint;
-Function FpGetEnv   (name : String): pChar; deprecated; // because shortstring
+Function FpGetEnv   (name : ShortString): PAnsiChar; deprecated; // because shortstring
 
 // macro's
 

+ 8 - 8
rtl/unix/cwstraix.inc

@@ -13,15 +13,15 @@
 
  **********************************************************************}
 
-function Ansi2AnsiMove(source:pchar; fromcp:TSystemCodePage; const tocp: pchar; out dest:rawbytestring; len:SizeInt): boolean;
+function Ansi2AnsiMove(source:PAnsiChar; fromcp:TSystemCodePage; const tocp: PAnsiChar; out dest:rawbytestring; len:SizeInt): boolean;
   var
     outlength,
     outoffset,
     outleft : size_t;
     use_iconv: iconv_t;
     srcpos,
-    destpos: pchar;
-    mynil : pchar;
+    destpos: PAnsiChar;
+    mynil : PAnsiChar;
     my0 : size_t;
     err: cint;
   begin
@@ -35,7 +35,7 @@ function Ansi2AnsiMove(source:pchar; fromcp:TSystemCodePage; const tocp: pchar;
     outlength:=len;
     setlength(dest,outlength);
     srcpos:=source;
-    destpos:=pchar(dest);
+    destpos:=PAnsiChar(dest);
     outleft:=outlength;
     while iconv(use_iconv,@srcpos,psize(@len),@destpos,@outleft)=size_t(-1) do
       begin
@@ -47,7 +47,7 @@ function Ansi2AnsiMove(source:pchar; fromcp:TSystemCodePage; const tocp: pchar;
               { skip and set to '?' }
               inc(srcpos);
               dec(len);
-              pchar(destpos)^:='?';
+              PAnsiChar(destpos)^:='?';
               inc(destpos,2);
               dec(outleft,2);
               { reset }
@@ -57,13 +57,13 @@ function Ansi2AnsiMove(source:pchar; fromcp:TSystemCodePage; const tocp: pchar;
             end;
           ESysE2BIG:
             begin
-              outoffset:=destpos-pchar(dest);
+              outoffset:=destpos-PAnsiChar(dest);
               { extend }
               setlength(dest,outlength+len);
               inc(outleft,len);
               inc(outlength,len);
               { string could have been moved }
-              destpos:=pchar(dest)+outoffset;
+              destpos:=PAnsiChar(dest)+outoffset;
             end;
           else
             runerror(231);
@@ -76,7 +76,7 @@ function Ansi2AnsiMove(source:pchar; fromcp:TSystemCodePage; const tocp: pchar;
   end;
 
 
-function handle_aix_intermediate(source: pchar; sourcecp: TSystemCodePage; out newcp: TSystemCodePage; out str: rawbytestring; len: SizeInt): boolean;
+function handle_aix_intermediate(source: PAnsiChar; sourcecp: TSystemCodePage; out newcp: TSystemCodePage; out str: rawbytestring; len: SizeInt): boolean;
   begin
     result:=false;
     { for some reason, IBM's iconv only supports converting cp866 to/from

+ 65 - 65
rtl/unix/cwstring.pp

@@ -101,22 +101,22 @@ function towlower(__wc:wint_t):wint_t;cdecl;external clib name 'towlower';
 function towupper(__wc:wint_t):wint_t;cdecl;external clib name 'towupper';
 
 function wcscoll (__s1:pwchar_t; __s2:pwchar_t):cint;cdecl;external clib name 'wcscoll';
-function strcoll (__s1:pchar; __s2:pchar):cint;cdecl;external clib name 'strcoll';
+function strcoll (__s1:PAnsiChar; __s2:PAnsiChar):cint;cdecl;external clib name 'strcoll';
 {$ifdef netbsd}
   { NetBSD has a new setlocale function defined in /usr/include/locale.h
     that should be used }
-function setlocale(category: cint; locale: pchar): pchar; cdecl; external clib name '__setlocale50';
+function setlocale(category: cint; locale: PAnsiChar): PAnsiChar; cdecl; external clib name '__setlocale50';
 {$else}
-function setlocale(category: cint; locale: pchar): pchar; cdecl; external clib name 'setlocale';
+function setlocale(category: cint; locale: PAnsiChar): PAnsiChar; cdecl; external clib name 'setlocale';
 {$endif}
 {$if not(defined(beos) and not defined(haiku))}
-function mbrtowc(pwc: pwchar_t; const s: pchar; n: size_t; ps: pmbstate_t): size_t; cdecl; external clib name 'mbrtowc';
-function wcrtomb(s: pchar; wc: wchar_t; ps: pmbstate_t): size_t; cdecl; external clib name 'wcrtomb';
-function mbrlen(const s: pchar; n: size_t; ps: pmbstate_t): size_t; cdecl; external clib name 'mbrlen';
+function mbrtowc(pwc: pwchar_t; const s: PAnsiChar; n: size_t; ps: pmbstate_t): size_t; cdecl; external clib name 'mbrtowc';
+function wcrtomb(s: PAnsiChar; wc: wchar_t; ps: pmbstate_t): size_t; cdecl; external clib name 'wcrtomb';
+function mbrlen(const s: PAnsiChar; n: size_t; ps: pmbstate_t): size_t; cdecl; external clib name 'mbrlen';
 {$else beos}
-function mbtowc(pwc: pwchar_t; const s: pchar; n: size_t): size_t; cdecl; external clib name 'mbtowc';
-function wctomb(s: pchar; wc: wchar_t): size_t; cdecl; external clib name 'wctomb';
-function mblen(const s: pchar; n: size_t): size_t; cdecl; external clib name 'mblen';
+function mbtowc(pwc: pwchar_t; const s: PAnsiChar; n: size_t): size_t; cdecl; external clib name 'mbtowc';
+function wctomb(s: PAnsiChar; wc: wchar_t): size_t; cdecl; external clib name 'wctomb';
+function mblen(const s: PAnsiChar; n: size_t): size_t; cdecl; external clib name 'mblen';
 {$endif beos}
 
 
@@ -207,22 +207,22 @@ type
   nl_item = cint;
 
 {$ifdef haiku}
-  function nl_langinfo(__item:nl_item):pchar;cdecl;external 'root' name 'nl_langinfo';
+  function nl_langinfo(__item:nl_item):PAnsiChar;cdecl;external 'root' name 'nl_langinfo';
 {$else}
   {$ifndef beos}
-  function nl_langinfo(__item:nl_item):pchar;cdecl;external libiconvname name 'nl_langinfo';
+  function nl_langinfo(__item:nl_item):PAnsiChar;cdecl;external libiconvname name 'nl_langinfo';
   {$endif}
 {$endif}
 
 {$if (not defined(bsd) and not defined(beos)) or defined(iconv_is_in_libc) or (defined(darwin) and not defined(cpupowerpc32))}
-function iconv_open(__tocode:pchar; __fromcode:pchar):iconv_t;cdecl;external libiconvname name 'iconv_open';
-function iconv(__cd:iconv_t; __inbuf:ppchar; __inbytesleft:psize_t; __outbuf:ppchar; __outbytesleft:psize_t):size_t;cdecl;external libiconvname name 'iconv';
+function iconv_open(__tocode:PAnsiChar; __fromcode:PAnsiChar):iconv_t;cdecl;external libiconvname name 'iconv_open';
+function iconv(__cd:iconv_t; __inbuf:PPAnsiChar; __inbytesleft:psize_t; __outbuf:PPAnsiChar; __outbytesleft:psize_t):size_t;cdecl;external libiconvname name 'iconv';
 function iconv_close(__cd:iconv_t):cint;cdecl;external libiconvname name 'iconv_close';
 const
   iconvctlname='iconvctl';
 {$else}
-function iconv_open(__tocode:pchar; __fromcode:pchar):iconv_t;cdecl;external libiconvname name 'libiconv_open';
-function iconv(__cd:iconv_t; __inbuf:ppchar; __inbytesleft:psize_t; __outbuf:ppchar; __outbytesleft:psize_t):size_t;cdecl;external libiconvname name 'libiconv';
+function iconv_open(__tocode:PAnsiChar; __fromcode:PAnsiChar):iconv_t;cdecl;external libiconvname name 'libiconv_open';
+function iconv(__cd:iconv_t; __inbuf:PPAnsiChar; __inbytesleft:psize_t; __outbuf:PPAnsiChar; __outbytesleft:psize_t):size_t;cdecl;external libiconvname name 'libiconv';
 function iconv_close(__cd:iconv_t):cint;cdecl;external libiconvname name 'libiconv_close';
 const
   iconvctlname='libiconvctl';
@@ -268,8 +268,8 @@ begin
   toencoding:=iconvname;
   if not assigned(iconvctl) then
     toencoding:=toencoding+'//TRANSLIT';
-  iconv_wide2ansi:=iconv_open(pchar(toencoding),unicode_encoding2);
-  iconv_ansi2wide:=iconv_open(unicode_encoding2,pchar(iconvname));
+  iconv_wide2ansi:=iconv_open(PAnsiChar(toencoding),unicode_encoding2);
+  iconv_ansi2wide:=iconv_open(unicode_encoding2,PAnsiChar(iconvname));
   if assigned(iconvctl) and
      (iconv_wide2ansi<>iconv_t(-1)) then
   begin
@@ -289,7 +289,7 @@ end;
 
 
 {$if defined(beos) and not defined(haiku)}
-function nl_langinfo(__item:nl_item):pchar;
+function nl_langinfo(__item:nl_item):PAnsiChar;
 begin
   {$warning TODO BeOS nl_langinfo or more uptodate port of iconv...}
   // Now implement the minimum required to correctly initialize WideString support
@@ -305,7 +305,7 @@ end;
 {$endif}
 
 
-function open_iconv_for_cps(cp: TSystemCodePage; const otherencoding: pchar; cp_is_from: boolean): iconv_t;
+function open_iconv_for_cps(cp: TSystemCodePage; const otherencoding: PAnsiChar; cp_is_from: boolean): iconv_t;
   var
     iconvindex: longint;
     toencoding: rawbytestring;
@@ -314,7 +314,7 @@ function open_iconv_for_cps(cp: TSystemCodePage; const otherencoding: pchar; cp_
     { TODO: add caching (then we also don't need separate code for
       the default system page and other ones)
 
-      -- typecasting an ansistring function result to pchar is
+      -- typecasting an ansistring function result to PAnsiChar is
         unsafe normally, but these are constant strings -> no
         problem }
     open_iconv_for_cps:=iconv_t(-1);
@@ -323,13 +323,13 @@ function open_iconv_for_cps(cp: TSystemCodePage; const otherencoding: pchar; cp_
       exit;
     repeat
       if cp_is_from then
-        open_iconv_for_cps:=iconv_open(otherencoding,pchar(UnixCpMap[iconvindex].name))
+        open_iconv_for_cps:=iconv_open(otherencoding,PAnsiChar(UnixCpMap[iconvindex].name))
       else
       begin
         toencoding:=UnixCpMap[iconvindex].name;
         if not assigned(iconvctl) then
           toencoding:=toencoding+'//TRANSLIT';
-        open_iconv_for_cps:=iconv_open(pchar(toencoding),otherencoding);
+        open_iconv_for_cps:=iconv_open(PAnsiChar(toencoding),otherencoding);
       end;
       inc(iconvindex);
     until (open_iconv_for_cps<>iconv_t(-1)) or
@@ -357,8 +357,8 @@ procedure Wide2AnsiMove(source:pwidechar; var dest:RawByteString; cp:TSystemCode
     outleft : size_t;
     use_iconv: iconv_t;
     srcpos : pwidechar;
-    destpos: pchar;
-    mynil : pchar;
+    destpos: PAnsiChar;
+    mynil : PAnsiChar;
     my0 : size_t;
     err : longint;
     transliterate: cint;
@@ -373,7 +373,7 @@ procedure Wide2AnsiMove(source:pwidechar; var dest:RawByteString; cp:TSystemCode
     if cp=866 then
       begin
         Wide2AnsiMove(source,intermediate,28595,len);
-        if handle_aix_intermediate(pchar(intermediate),28595,cp,dest,len) then
+        if handle_aix_intermediate(PAnsiChar(intermediate),28595,cp,dest,len) then
           exit;
       end;
 {$endif aix}
@@ -413,9 +413,9 @@ procedure Wide2AnsiMove(source:pwidechar; var dest:RawByteString; cp:TSystemCode
     outlength:=len*3;
     srclen:=len*2;
     srcpos:=source;
-    destpos:=pchar(dest);
+    destpos:=PAnsiChar(dest);
     outleft:=outlength;
-    while iconv(use_iconv,ppchar(@srcpos),@srclen,@destpos,@outleft)=size_t(-1) do
+    while iconv(use_iconv,PPAnsiChar(@srcpos),@srclen,@destpos,@outleft)=size_t(-1) do
       begin
         err:=fpgetCerrno;
         case err of
@@ -437,13 +437,13 @@ procedure Wide2AnsiMove(source:pwidechar; var dest:RawByteString; cp:TSystemCode
             end;
           ESysE2BIG:
             begin
-              outoffset:=destpos-pchar(dest);
+              outoffset:=destpos-PAnsiChar(dest);
               { extend }
               setlength(dest,outlength+len*3);
               inc(outleft,len*3);
               inc(outlength,len*3);
               { string could have been moved }
-              destpos:=pchar(dest)+outoffset;
+              destpos:=PAnsiChar(dest)+outoffset;
             end;
           else
             runerror(231);
@@ -457,15 +457,15 @@ procedure Wide2AnsiMove(source:pwidechar; var dest:RawByteString; cp:TSystemCode
   end;
 
 
-procedure Ansi2WideMove(source:pchar; cp:TSystemCodePage; var dest:widestring; len:SizeInt);
+procedure Ansi2WideMove(source:PAnsiChar; cp:TSystemCodePage; var dest:widestring; len:SizeInt);
   var
     outlength,
     outoffset,
     outleft : size_t;
     use_iconv: iconv_t;
     srcpos,
-    destpos: pchar;
-    mynil : pchar;
+    destpos: PAnsiChar;
+    mynil : PAnsiChar;
     my0 : size_t;
     err: cint;
     iconvindex: longint;
@@ -480,7 +480,7 @@ procedure Ansi2WideMove(source:pchar; cp:TSystemCodePage; var dest:widestring; l
     if cp=866 then
       begin
         if handle_aix_intermediate(source,cp,cp,intermediate,len) then
-          source:=pchar(intermediate);
+          source:=PAnsiChar(intermediate);
       end;
 {$endif aix}
     if (cp=DefaultSystemCodePage) then
@@ -500,7 +500,7 @@ procedure Ansi2WideMove(source:pchar; cp:TSystemCodePage; var dest:widestring; l
         { TODO: add caching (then we also don't need separate code for
           the default system page and other ones)
 
-          -- typecasting an ansistring function result to pchar is
+          -- typecasting an ansistring function result to PAnsiChar is
             unsafe normally, but these are constant strings -> no
             problem }
         use_iconv:=open_iconv_for_cps(cp,unicode_encoding2,true);
@@ -518,7 +518,7 @@ procedure Ansi2WideMove(source:pchar; cp:TSystemCodePage; var dest:widestring; l
     outlength:=len+1;
     setlength(dest,outlength);
     srcpos:=source;
-    destpos:=pchar(dest);
+    destpos:=PAnsiChar(dest);
     outleft:=outlength*2;
     while iconv(use_iconv,@srcpos,psize(@len),@destpos,@outleft)=size_t(-1) do
       begin
@@ -540,13 +540,13 @@ procedure Ansi2WideMove(source:pchar; cp:TSystemCodePage; var dest:widestring; l
             end;
           ESysE2BIG:
             begin
-              outoffset:=destpos-pchar(dest);
+              outoffset:=destpos-PAnsiChar(dest);
               { extend }
               setlength(dest,outlength+len);
               inc(outleft,len*2);
               inc(outlength,len);
               { string could have been moved }
-              destpos:=pchar(dest)+outoffset;
+              destpos:=PAnsiChar(dest)+outoffset;
             end;
           else
             runerror(231);
@@ -589,28 +589,28 @@ begin
 end;
 
 
-procedure ConcatCharToAnsiStr(const c: char; var S: AnsiString; var index: SizeInt);
+procedure ConcatCharToAnsiStr(const c: AnsiChar; var S: AnsiString; var index: SizeInt);
 begin
   EnsureAnsiLen(s,index);
-  pchar(@s[index])^:=c;
+  PAnsiChar(@s[index])^:=c;
   inc(index);
 end;
 
 
-{ concatenates an utf-32 char to a widestring. S *must* be unique when entering. }
+{ concatenates an utf-32 Char to a ansistring. S *must* be unique when entering. }
 {$if not(defined(beos) and not defined(haiku))}
 procedure ConcatUTF32ToAnsiStr(const nc: wint_t; var S: AnsiString; var index: SizeInt; var mbstate: mbstate_t);
 {$else not beos}
 procedure ConcatUTF32ToAnsiStr(const nc: wint_t; var S: AnsiString; var index: SizeInt);
 {$endif beos}
 var
-  p     : pchar;
+  p     : PAnsiChar;
   mblen : size_t;
 begin
   { we know that s is unique -> avoid uniquestring calls}
   p:=@s[index];
   if (nc<=127) then
-    ConcatCharToAnsiStr(char(nc),s,index)
+    ConcatCharToAnsiStr(AnsiChar(nc),s,index)
   else
     begin
       EnsureAnsiLen(s,index+MB_CUR_MAX);
@@ -623,7 +623,7 @@ begin
         inc(index,mblen)
       else
         begin
-          { invalid wide char }
+          { invalid wide AnsiChar }
           p^:='?';
           inc(index);
         end;
@@ -659,9 +659,9 @@ function LowerAnsiString(const s : AnsiString) : AnsiString;
           end
         else
 {$if not(defined(beos) and not defined(haiku))}
-          mblen:=mbrtowc(@wc, pchar(@s[i]), slen-i+1, @ombstate);
+          mblen:=mbrtowc(@wc, PAnsiChar(@s[i]), slen-i+1, @ombstate);
 {$else not beos}
-          mblen:=mbtowc(@wc, pchar(@s[i]), slen-i+1);
+          mblen:=mbtowc(@wc, PAnsiChar(@s[i]), slen-i+1);
 {$endif not beos}
         case mblen of
           size_t(-2):
@@ -726,9 +726,9 @@ function UpperAnsiString(const s : AnsiString) : AnsiString;
           end
         else
 {$if not(defined(beos) and not defined(haiku))}
-          mblen:=mbrtowc(@wc, pchar(@s[i]), slen-i+1, @ombstate);
+          mblen:=mbrtowc(@wc, PAnsiChar(@s[i]), slen-i+1, @ombstate);
 {$else not beos}
-          mblen:=mbtowc(@wc, pchar(@s[i]), slen-i+1);
+          mblen:=mbtowc(@wc, PAnsiChar(@s[i]), slen-i+1);
 {$endif beos}
         case mblen of
           size_t(-2):
@@ -867,10 +867,10 @@ function CompareWideString(const s1, s2 : WideString; Options : TCompareOptions)
   code point is encountered, all characters part of this invalid code point
   are considered to form one "character" and the next character is
   considered to be the start of a new (possibly also invalid) code point }
-function CharLengthPChar(const Str: PChar): PtrInt;
+function CharLengthPChar(const Str: PAnsiChar): PtrInt;
   var
     nextlen: ptrint;
-    s: pchar;
+    s: PAnsiChar;
 {$if not(defined(beos) and not defined(haiku))}
     mbstate: mbstate_t;
 {$endif not beos}
@@ -895,7 +895,7 @@ function CharLengthPChar(const Str: PChar): PtrInt;
   end;
 
 
-function CodePointLength(const Str: PChar; maxlookahead: ptrint): PtrInt;
+function CodePointLength(const Str: PAnsiChar; maxlookahead: ptrint): PtrInt;
 {$if not(defined(beos) and not defined(haiku))}
   var
     mbstate: mbstate_t;
@@ -914,9 +914,9 @@ function CodePointLength(const Str: PChar; maxlookahead: ptrint): PtrInt;
   end;
 
 
-function StrCompAnsiIntern(s1,s2 : PChar; len1, len2: PtrInt; canmodifys1, canmodifys2: boolean): PtrInt;
+function StrCompAnsiIntern(s1,s2 : PAnsiChar; len1, len2: PtrInt; canmodifys1, canmodifys2: boolean): PtrInt;
   var
-    a,b: pchar;
+    a,b: PAnsiChar;
     i: PtrInt;
   begin
     if not(canmodifys1) then
@@ -950,11 +950,11 @@ function StrCompAnsiIntern(s1,s2 : PChar; len1, len2: PtrInt; canmodifys1, canmo
 
 function CompareStrAnsiString(const s1, s2: ansistring): PtrInt;
   begin
-    result:=StrCompAnsiIntern(pchar(s1),pchar(s2),length(s1),length(s2),false,false);
+    result:=StrCompAnsiIntern(PAnsiChar(s1),PAnsiChar(s2),length(s1),length(s2),false,false);
   end;
 
 
-function StrCompAnsi(s1,s2 : PChar): PtrInt;
+function StrCompAnsi(s1,s2 : PAnsiChar): PtrInt;
   begin
     result:=strcoll(s1,s2);
   end;
@@ -966,19 +966,19 @@ function AnsiCompareText(const S1, S2: ansistring): PtrInt;
   begin
     a:=UpperAnsistring(s1);
     b:=UpperAnsistring(s2);
-    result:=StrCompAnsiIntern(pchar(a),pchar(b),length(a),length(b),true,true);
+    result:=StrCompAnsiIntern(PAnsiChar(a),PAnsiChar(b),length(a),length(b),true,true);
   end;
 
 
-function AnsiStrIComp(S1, S2: PChar): PtrInt;
+function AnsiStrIComp(S1, S2: PAnsiChar): PtrInt;
   begin
     result:=AnsiCompareText(ansistring(s1),ansistring(s2));
   end;
 
 
-function AnsiStrLComp(S1, S2: PChar; MaxLen: PtrUInt): PtrInt;
+function AnsiStrLComp(S1, S2: PAnsiChar; MaxLen: PtrUInt): PtrInt;
   var
-    a, b: pchar;
+    a, b: PAnsiChar;
 begin
   if (maxlen=0) then
     exit(0);
@@ -1006,7 +1006,7 @@ begin
 end;
 
 
-function AnsiStrLIComp(S1, S2: PChar; MaxLen: PtrUInt): PtrInt;
+function AnsiStrLIComp(S1, S2: PAnsiChar; MaxLen: PtrUInt): PtrInt;
   var
     a, b: ansistring;
 begin
@@ -1020,7 +1020,7 @@ begin
 end;
 
 
-procedure ansi2pchar(const s: ansistring; const orgp: pchar; out p: pchar);
+procedure ansi2pchar(const s: ansistring; const orgp: PAnsiChar; out p: PAnsiChar);
 var
   newlen: sizeint;
 begin
@@ -1034,7 +1034,7 @@ begin
 end;
 
 
-function AnsiStrLower(Str: PChar): PChar;
+function AnsiStrLower(Str: PAnsiChar): PAnsiChar;
 var
   temp: ansistring;
 begin
@@ -1043,7 +1043,7 @@ begin
 end;
 
 
-function AnsiStrUpper(Str: PChar): PChar;
+function AnsiStrUpper(Str: PAnsiChar): PAnsiChar;
 var
   temp: ansistring;
 begin
@@ -1052,9 +1052,9 @@ begin
 end;
 
 
-function envvarset(const varname: pchar): boolean;
+function envvarset(const varname: PAnsiChar): boolean;
 var
-  varval: pchar;
+  varval: PAnsiChar;
 begin
   varval:=fpgetenv(varname);
   result:=
@@ -1065,7 +1065,7 @@ end;
 
 function GetStandardCodePage(const stdcp: TStandardCodePageEnum): TSystemCodePage;
 var
-  langinfo: pchar;
+  langinfo: PAnsiChar;
 begin
 {$ifdef FPCRTL_FILESYSTEM_UTF8}
   if stdcp=scpFileSystemSingleByte then

+ 9 - 9
rtl/unix/dl.pp

@@ -79,22 +79,22 @@ const
 type
   Pdl_info = ^dl_info;
   dl_info = record
-    dli_fname      : Pchar;
+    dli_fname      : PAnsiChar;
     dli_fbase      : pointer;
-    dli_sname      : Pchar;
+    dli_sname      : PAnsiChar;
     dli_saddr      : pointer;
   end;
 
-function dlopen(Name : PChar; Flags : longint) : Pointer; cdecl; external libdl;
-function dlsym(Lib : Pointer; Name : Pchar) : Pointer; cdecl; external Libdl;
+function dlopen(Name : PAnsiChar; Flags : longint) : Pointer; cdecl; external libdl;
+function dlsym(Lib : Pointer; Name : PAnsiChar) : Pointer; cdecl; external Libdl;
 {$ifdef ELF}
-function dlvsym(Lib : Pointer; Name : Pchar; Version: Pchar) : Pointer; cdecl; external Libdl;
+function dlvsym(Lib : Pointer; Name : PAnsiChar; Version: PAnsiChar) : Pointer; cdecl; external Libdl;
 {$endif}
 function dlclose(Lib : Pointer) : Longint; cdecl; external libdl;
-function dlerror() : Pchar; cdecl; external libdl;
+function dlerror() : PAnsiChar; cdecl; external libdl;
 
 { overloaded for compatibility with hmodule }
-function dlsym(Lib : PtrInt; Name : Pchar) : Pointer; cdecl; external Libdl;
+function dlsym(Lib : PtrInt; Name : PAnsiChar) : Pointer; cdecl; external Libdl;
 function dlclose(Lib : PtrInt) : Longint; cdecl; external libdl;
 function dladdr(Lib: pointer; info: Pdl_info): Longint; cdecl; {$if not defined(aix) and not defined(android)} external; {$endif}
 
@@ -102,7 +102,7 @@ type
   plink_map = ^link_map;
   link_map = record
     l_addr:pointer;  { Difference between the address in the ELF file and the address in memory }
-    l_name:Pchar;  { Absolute pathname where object was found }
+    l_name:PAnsiChar;  { Absolute pathname where object was found }
     l_ld:pointer;    { Dynamic section of the shared object }
     l_next, l_prev:^link_map; { Chain of loaded objects }
     {Plus additional fields private to the implementation }
@@ -138,7 +138,7 @@ uses
     end;
 
 
-  procedure UnixGetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: openstring);
+  procedure UnixGetModuleByAddr(addr: pointer; var baseaddr: pointer; var filename: ansistring);
     var
       dlinfo: dl_info;
     begin

+ 19 - 19
rtl/unix/dos.pp

@@ -65,7 +65,7 @@ Uses
 {$DEFINE HAS_GETMSCOUNT}
 
 {$DEFINE FPC_FEXPAND_TILDE} { Tilde is expanded to home }
-{$DEFINE FPC_FEXPAND_GETENVPCHAR} { GetEnv result is a PChar }
+{$DEFINE FPC_FEXPAND_GETENVPCHAR} { GetEnv result is a PAnsiChar }
 
 {$I dos.inc}
 
@@ -91,7 +91,7 @@ type
 
 Function DosVersion:Word;
 Var
-  Buffer : Array[0..255] of Char;
+  Buffer : Array[0..255] of AnsiChar;
   Tmp2,
   TmpStr : String[40];
   TmpPos,
@@ -227,7 +227,7 @@ end;
 Procedure Exec (Const Path: PathStr; Const ComLine: ComStr);
 var
   pid      : longint; // pid_t?
-  cmdline2 : ppchar;
+  cmdline2 : PPAnsiChar;
   commandline : RawByteString;
   realpath : ansistring;
 
@@ -248,16 +248,16 @@ Begin
        begin
          CommandLine:=ToSingleByteFileSystemEncodedFileName(ComLine);  // conversion must live till after fpexec!
          cmdline2:=StringtoPPChar(CommandLine,1);
-         cmdline2^:=pchar(realPath);
+         cmdline2^:=PAnsiChar(realPath);
        end
      else
        begin
-         getmem(cmdline2,2*sizeof(pchar));
-         cmdline2^:=pchar(realPath);
+         getmem(cmdline2,2*sizeof(PAnsiChar));
+         cmdline2^:=PAnsiChar(realPath);
          cmdline2[1]:=nil;
        end;
      {The child does the actual exec, and then exits}
-     fpExecv(pchar(realPath),cmdline2);
+     fpExecv(PAnsiChar(realPath),cmdline2);
      {If the execve fails, we return an exitvalue of 127, to let it be known}
      fpExit(127);
    end
@@ -293,7 +293,7 @@ End;
   They both return -1 when a failure occurs.
 }
 Const
-  FixDriveStr : array[0..3] of pchar=(
+  FixDriveStr : array[0..3] of PAnsiChar=(
     '.',
     '/fd0/.',
     '/fd1/.',
@@ -302,7 +302,7 @@ Const
 const
   Drives   : byte = 4;
 var
-  DriveStr : array[4..26] of pchar;
+  DriveStr : array[4..26] of PAnsiChar;
 
 Function AddDisk(const path:string) : byte;
 begin
@@ -551,7 +551,7 @@ Procedure FindNext(Var f: SearchRec);
 }
 Var
 
-  DirName  : Array[0..256] of Char;
+  DirName  : Array[0..256] of AnsiChar;
   i,
   ArrayPos : Longint;
   FName,
@@ -699,7 +699,7 @@ Procedure GetFAttr(var f; var attr : word);
 Var
   info    : baseunix.stat;
   LinAttr : longint;
-  p       : pchar;
+  p       : PAnsiChar;
 {$ifndef FPC_ANSI_TEXTFILEREC}
   r       : RawByteString;
 {$endif not FPC_ANSI_TEXTFILEREC}
@@ -710,9 +710,9 @@ Begin
   p:=@textrec(f).name;
 {$else}
   r:=ToSingleByteFileSystemEncodedFileName(textrec(f).name);
-  p:=pchar(r);
+  p:=PAnsiChar(r);
 {$endif}
-  { use the pchar rather than the rawbytestring version so that we don't check
+  { use the PAnsiChar rather than the rawbytestring version so that we don't check
     a second time whether the string needs to be converted to the right code
     page
   }
@@ -756,7 +756,7 @@ Procedure setftime(var f; time : longint);
 Var
   utim: utimbuf;
   DT: DateTime;
-  p : pchar;
+  p : PAnsiChar;
 {$ifndef FPC_ANSI_TEXTFILEREC}
   r : Rawbytestring;
 {$endif not FPC_ANSI_TEXTFILEREC}
@@ -773,9 +773,9 @@ Begin
   p:=@textrec(f).name;
 {$else}
   r:=ToSingleByteFileSystemEncodedFileName(textrec(f).name);
-  p:=pchar(r);
+  p:=PAnsiChar(r);
 {$endif}
-  { use the pchar rather than the rawbytestring version so that we don't check
+  { use the PAnsiChar rather than the rawbytestring version so that we don't check
     a second time whether the string needs to be converted to the right code
     page
   }
@@ -793,7 +793,7 @@ End;
 Function EnvCount: Longint;
 var
   envcnt : longint;
-  p      : ppchar;
+  p      : PPAnsiChar;
 Begin
   envcnt:=0;
   p:=envp;      {defined in syslinux}
@@ -809,7 +809,7 @@ End;
 Function EnvStr (Index: longint): String;
 Var
   i : longint;
-  p : ppchar;
+  p : PPAnsiChar;
 Begin
   if Index <= 0 then
     envstr:=''
@@ -832,7 +832,7 @@ end;
 
 Function GetEnv(EnvVar: String): String;
 var
-  p     : pchar;
+  p     : PAnsiChar;
 Begin
   p:=BaseUnix.fpGetEnv(EnvVar);
   if p=nil then

+ 2 - 2
rtl/unix/dynlibs.inc

@@ -46,7 +46,7 @@ end;
 Function SysGetProcedureAddress(Lib : TLibHandle; const ProcName : AnsiString) : Pointer;
 
 begin
-  Result:=dlsym(lib,pchar(ProcName));
+  Result:=dlsym(lib,PAnsiChar(ProcName));
 end;
 
 Function SysUnloadLibrary(Lib : TLibHandle) : Boolean;
@@ -55,7 +55,7 @@ begin
   Result:=dlClose(Lib)=0;
 end;
 
-Function SysGetLoadErrorStr: string;
+Function SysGetLoadErrorStr: ansistring;
 
 begin
   Result:=dl.dlerror;

+ 3 - 3
rtl/unix/genfunch.inc

@@ -14,8 +14,8 @@
 
  **********************************************************************}
 
-function CreateShellArgV(const prog:string):ppchar; deprecated;
+function CreateShellArgV(const prog:string):PPAnsiChar; deprecated;
 
-function CreateShellArgV(const prog:RawByteString):ppchar; deprecated;
+function CreateShellArgV(const prog:RawByteString):PPAnsiChar; deprecated;
 
-procedure FreeShellArgV(p:ppchar); deprecated;
+procedure FreeShellArgV(p:PPAnsiChar); deprecated;

+ 9 - 9
rtl/unix/genfuncs.inc

@@ -14,13 +14,13 @@
 
  **********************************************************************}
 
-function InternalCreateShellArgV(cmd:pChar; len:longint):ppchar;
+function InternalCreateShellArgV(cmd:PAnsiChar; len:longint):PPAnsiChar;
 {
   Create an argv which executes a command in a shell using /bin/sh -c
 }
 const   Shell   = '/bin/sh'#0'-c'#0;
 var
-  pp,p : ppchar;
+  pp,p : PPAnsiChar;
 //  temp : string; !! Never pass a local var back!!
 begin
   getmem(pp,4*sizeof(pointer));
@@ -31,18 +31,18 @@ begin
   inc(p);
   getmem(p^,len+1);
   move(cmd^,p^^,len);
-  pchar(p^)[len]:=#0;
+  PAnsiChar(p^)[len]:=#0;
   inc(p);
   p^:=Nil;
   InternalCreateShellArgV:=pp;
 end;
 
-function CreateShellArgV(const prog:string):ppchar;
+function CreateShellArgV(const prog:string):PPAnsiChar;
 begin
   CreateShellArgV:=InternalCreateShellArgV(@prog[1],length(prog));
 end;
 
-function CreateShellArgV(const prog:RawByteString):ppchar;
+function CreateShellArgV(const prog:RawByteString):PPAnsiChar;
 {
   Create an argv which executes a command in a shell using /bin/sh -c
   using a AnsiString;
@@ -52,7 +52,7 @@ begin
 end;
 
 
-procedure FreeShellArgV(p:ppchar);
+procedure FreeShellArgV(p:PPAnsiChar);
 begin
   if (p<>nil) then begin
     freemem(p[2]);
@@ -60,11 +60,11 @@ begin
    end;
 end;
 
-Function fpgetenv(name:string):Pchar; [public, alias : 'FPC_SYSC_FPGETENV'];
+Function fpgetenv(name:string):PAnsiChar; [public, alias : 'FPC_SYSC_FPGETENV'];
 {
   Searches the environment for a string with name p and
-  returns a pchar to it's value.
-  A pchar is used to accomodate for strings of length > 255
+  returns a PAnsiChar to it's value.
+  A PAnsiChar is used to accomodate for strings of length > 255
 }
 
 Begin

+ 2 - 2
rtl/unix/oscdecl.inc

@@ -57,9 +57,9 @@ end;
 { fpopen                                                                }
 { ********************************************************************* }
 
-function  real_FpOpen(path: pchar; flags : cint):cint; varargs; cdecl; external clib name 'open'{$ifdef aix}+suffix64bit{$endif};
+function  real_FpOpen(path: PAnsiChar; flags : cint):cint; varargs; cdecl; external clib name 'open'{$ifdef aix}+suffix64bit{$endif};
 
-function  FpOpen    (path: pchar; flags : cint; mode: TMode):cint;
+function  FpOpen    (path: PAnsiChar; flags : cint; mode: TMode):cint;
 begin
 {$if defined(linux) and defined(fs32bit)}
   flags:=flags or O_LARGEFILE;

+ 28 - 28
rtl/unix/oscdeclh.inc

@@ -50,11 +50,11 @@ const
     Function  FpSigTimedWait (Constref sigset : TSigSet; info : Psiginfo; timeout:Ptimespec): cInt; cdecl; external clib name 'sigtimedwait';
 {$endif}
     Function  FpUmask       (cmask : TMode): TMode; cdecl; external clib name 'umask';
-    Function  FpLink       (existing : pChar; newone : pChar): cInt; cdecl; external clib name 'link';
-    Function  FpMkfifo     (path: pchar; mode: tmode): cint; cdecl; external clib name 'mkfifo';
-    Function  FpChmod      (path : pChar; Mode : TMode): cInt; cdecl; external clib name 'chmod';
-    Function  FpChown   (path : pChar; owner : TUid; group : TGid): cInt; cdecl; external clib name 'chown';
-    Function  FPUtime(path:pchar;times:putimbuf):cint; cdecl; external clib name 'utime';
+    Function  FpLink       (existing : PAnsiChar; newone : PAnsiChar): cInt; cdecl; external clib name 'link';
+    Function  FpMkfifo     (path: PAnsiChar; mode: tmode): cint; cdecl; external clib name 'mkfifo';
+    Function  FpChmod      (path : PAnsiChar; Mode : TMode): cInt; cdecl; external clib name 'chmod';
+    Function  FpChown   (path : PAnsiChar; owner : TUid; group : TGid): cInt; cdecl; external clib name 'chown';
+    Function  FPUtime(path:PAnsiChar;times:putimbuf):cint; cdecl; external clib name 'utime';
     Function  FpPipe       (var fildes : tfildes):cInt; cdecl;external clib name 'pipe';
     function  FpDup     (oldd:cint):cint; cdecl; external clib name 'dup';
     function  FpDup2    (oldd:cint;newd:cint):cint; cdecl; external clib name 'dup2';
@@ -83,46 +83,46 @@ const
     Function  FpFcntl      (fildes : cInt; cmd : cInt; arg :cInt): cInt; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
     Function  FpFcntl      (fildes : cInt; cmd : cInt; var arg : flock): cInt; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
 
-    Function  FpGetcwd  (path:pChar; siz:TSize):pChar; cdecl;  external clib name 'getcwd';
+    Function  FpGetcwd  (path:PAnsiChar; siz:TSize):PAnsiChar; cdecl;  external clib name 'getcwd';
     function  FpFork  : TPid; cdecl; external clib name 'fork';
-    function  FpExecve  (path : pchar; argv : ppchar; envp: ppchar): cint; cdecl; external clib name 'execve';
-    function  FpExecv  (path : pchar; argv : ppchar): cint; cdecl; external clib name 'execv';
+    function  FpExecve  (path : PAnsiChar; argv : PPAnsiChar; envp: PPAnsiChar): cint; cdecl; external clib name 'execve';
+    function  FpExecv  (path : PAnsiChar; argv : PPAnsiChar): cint; cdecl; external clib name 'execv';
     function  FpWaitpid (pid : TPid; stat_loc : pcint; options: cint): TPid; cdecl; external clib name 'waitpid';
     Function  FpWait       (var stat_loc : cInt): TPid; cdecl; external clib name 'wait';
     procedure FpExit    (status : cint); cdecl; external clib name '_exit';
     Function  FpKill       (pid : TPid; sig: cInt): cInt; cdecl; external clib name 'kill';
     function  FpUname   (var name: utsname): cint; cdecl; external clib name 'uname';
-    function  FpOpendir (dirname : pchar): pdir; cdecl; external clib name 'opendir'{$ifdef aix}+suffix64bit{$endif};
+    function  FpOpendir (dirname : PAnsiChar): pdir; cdecl; external clib name 'opendir'{$ifdef aix}+suffix64bit{$endif};
     Function  FpReaddir (var dirp : Dir) : pDirent;cdecl; external clib name 'readdir'+suffix64bit+darwinsuffix64bit;
     Function  FpClosedir (var dirp : Dir): cInt; cdecl; external clib name 'closedir'{$ifdef aix}+suffix64bit{$endif};
-    function  FpChdir   (path : pchar): cint; cdecl; external clib name 'chdir';
+    function  FpChdir   (path : PAnsiChar): cint; cdecl; external clib name 'chdir';
     { emulate the bunxovl version that automatically passes
      638 as mode }
-    function  FpOpen    (path: pchar; flags : cint; mode: TMode):cint; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
-    function  FpMkdir   (path : pchar; mode: TMode):cint; cdecl; external clib name 'mkdir';
-    function  FpUnlink  (path: pchar): cint; cdecl; external clib name 'unlink';
-    function  FpRmdir   (path : pchar): cint; cdecl; external clib name 'rmdir';
-    function  FpRename  (old : pchar; newpath: pchar): cint; cdecl;external clib name 'rename';
+    function  FpOpen    (path: PAnsiChar; flags : cint; mode: TMode):cint; {$ifdef FPC_IS_SYSTEM}forward;{$endif}
+    function  FpMkdir   (path : PAnsiChar; mode: TMode):cint; cdecl; external clib name 'mkdir';
+    function  FpUnlink  (path: PAnsiChar): cint; cdecl; external clib name 'unlink';
+    function  FpRmdir   (path : PAnsiChar): cint; cdecl; external clib name 'rmdir';
+    function  FpRename  (old : PAnsiChar; newpath: PAnsiChar): cint; cdecl;external clib name 'rename';
 {$ifdef linux}
 {$ifndef FPC_IS_SYSTEM}
     { those functions are macros on linux }
     function  FpFstat   (fd : cint; var sb : stat): cint;inline;
-    Function  fpLstat       (path:pchar;Info:pstat):cint;inline;
-    function  FpStat      (path: pchar; var buf : stat): cint;inline;
+    Function  fpLstat       (path:PAnsiChar;Info:pstat):cint;inline;
+    function  FpStat      (path: PAnsiChar; var buf : stat): cint;inline;
 {$endif FPC_IS_SYSTEM}
 {$else linux}
     function  FpFstat   (fd : cint; var sb : stat): cint; cdecl; external clib name 'fstat'+suffix64bit+darwinsuffix64bit;
-    Function  fpLstat   (path:pchar;Info:pstat):cint;     cdecl; external clib name 'lstat'+suffix64bit+darwinsuffix64bit;
-    function  FpStat    (path: pchar; var buf : stat): cint; cdecl; external clib name 'stat'+suffix64bit+darwinsuffix64bit;
+    Function  fpLstat   (path:PAnsiChar;Info:pstat):cint;     cdecl; external clib name 'lstat'+suffix64bit+darwinsuffix64bit;
+    function  FpStat    (path: PAnsiChar; var buf : stat): cint; cdecl; external clib name 'stat'+suffix64bit+darwinsuffix64bit;
 {$endif linux}
-    function  FpAccess  (pathname : pchar; amode : cint): cint; cdecl; external clib name 'access';
+    function  FpAccess  (pathname : PAnsiChar; amode : cint): cint; cdecl; external clib name 'access';
     function  FpClose   (fd : cint): cint; cdecl; external clib name 'close';
 
-    function  FpRead    (fd: cint; buf: pchar; nbytes : TSize): TSSize; cdecl; external clib name 'read';
-    Function  FpPRead      (fd : cInt; buf: pChar; nbytes : TSize; offset:Toff): TSsize;   cdecl; external clib name 'pread'+suffix64bit;
+    function  FpRead    (fd: cint; buf: PAnsiChar; nbytes : TSize): TSSize; cdecl; external clib name 'read';
+    Function  FpPRead      (fd : cInt; buf: PAnsiChar; nbytes : TSize; offset:Toff): TSsize;   cdecl; external clib name 'pread'+suffix64bit;
     function  FpReadV	   (fd: cint; const iov : piovec; iovcnt : cint):TSSize;  cdecl; external clib name 'readv';
-    function  FpWrite   (fd: cint;buf:pchar; nbytes : TSize): TSSize; cdecl; external clib name 'write';
-    Function  FpPWrite     (fd : cInt; buf:pChar; nbytes : TSize; offset:Toff): TSSize;  cdecl; external clib name 'pwrite'+suffix64bit;
+    function  FpWrite   (fd: cint;buf:PAnsiChar; nbytes : TSize): TSSize; cdecl; external clib name 'write';
+    Function  FpPWrite     (fd : cInt; buf:PAnsiChar; nbytes : TSize; offset:Toff): TSSize;  cdecl; external clib name 'pwrite'+suffix64bit;
     function  FpWriteV	   (fd: cint; const iov : piovec; iovcnt : cint):TSSize;  cdecl; external clib name 'writev';
 
     function  FpLseek   (fd : cint; offset : TOff; whence : cint): TOff; cdecl; external clib name 'lseek'+suffix64bit;
@@ -153,8 +153,8 @@ const
     Function  FPnanosleep  (const rqtp: ptimespec; rmtp: ptimespec): cint; cdecl; external clib name 'nanosleep';
 {$endif}
 {$endif solaris}
-    Function  fpSymlink    (oldname,newname:pchar):cint;   cdecl; external clib name 'symlink';
-    Function  fpReadLink           (name,linkname:pchar;maxlen:size_t):cint;  cdecl; external clib name 'readlink';
+    Function  fpSymlink    (oldname,newname:PAnsiChar):cint;   cdecl; external clib name 'symlink';
+    Function  fpReadLink           (name,linkname:PAnsiChar;maxlen:size_t):cint;  cdecl; external clib name 'readlink';
 
     function  fpNice       (N:cint):cint; cdecl; external clib name 'nice';
     Function  fpGetPriority (Which,Who:cint):cint;      cdecl; external clib name 'getpriority';
@@ -163,7 +163,7 @@ const
     function  fpmunmap  (addr:pointer;len:size_t):cint; cdecl; external clib name 'munmap';
     function  fpmprotect(addr:pointer;len:size_t;prot:cint):cint; cdecl; external clib name 'mprotect';
 
-    function  fpgetenv  (name : pchar):pchar; cdecl; external clib name 'getenv';
+    function  fpgetenv  (name : PAnsiChar):PAnsiChar; cdecl; external clib name 'getenv';
 {$ifndef beos}
     function  fpsettimeofday(tp:ptimeval;tzp:ptimezone):cint; cdecl; external clib name 'settimeofday';
 {$else}
@@ -188,5 +188,5 @@ const
 {$if defined(linux)}
     function  FpSchedGetAffinity(pid : pid_t;cpusetsize : size_t;mask : pcpu_set_t) : cint; cdecl; external clib name 'sched_getaffinity';
 {$endif}
-    Function FpPathconf(path : pchar;name : cint) : clong; cdecl; external clib name 'pathconf';
+    Function FpPathconf(path : PAnsiChar;name : cint) : clong; cdecl; external clib name 'pathconf';
 

+ 3 - 3
rtl/unix/syscgen.inc

@@ -2,11 +2,11 @@
 // general purpose unix routines for syscall based *nix system unit.
 
 {$ifndef FPC_USE_LIBC}
-Function fpgetenv(name:pchar):pchar;[public, alias : 'FPC_SYSC_FPGETENVPCHAR'];
+Function fpgetenv(name:pansichar):pansichar;[public, alias : 'FPC_SYSC_FPGETENVPCHAR'];
 
 var
-  p     : ppchar;
-  np,cp : pchar;
+  p     : ppansichar;
+  np,cp : pansichar;
   len,i : longint;
 Begin
   if (name=nil) or (envp=NIL) Then

+ 5 - 5
rtl/unix/sysdir.inc

@@ -28,7 +28,7 @@ const
 Procedure Do_MkDir(s: rawbytestring);
 
 Begin
-  If Fpmkdir(pchar(s), MODE_MKDIR)<0 Then
+  If Fpmkdir(PAnsiChar(s), MODE_MKDIR)<0 Then
    Errno2Inoutres
 End;
 
@@ -41,7 +41,7 @@ begin
       InOutRes := 16;
       exit;
     end;
-  If Fprmdir(pchar(S))<0 Then
+  If Fprmdir(PAnsiChar(S))<0 Then
    Errno2Inoutres
 End;
 
@@ -49,7 +49,7 @@ End;
 Procedure do_ChDir(s: rawbytestring);
 
 Begin
-  If Fpchdir(pchar(s))<0 Then
+  If Fpchdir(PAnsiChar(s))<0 Then
    Errno2Inoutres;
   { file not exists is path not found under tp7 }
   if InOutRes=2 then
@@ -66,7 +66,7 @@ End;
 
 procedure do_getdir(drivenr : byte;var dir : rawbytestring);
 var
-  buf          : array[0..2047] of char;
+  buf          : array[0..2047] of AnsiChar;
 {$ifndef FPC_USE_LIBC}
   cwdinfo      : stat;
   rootinfo     : stat;
@@ -121,7 +121,7 @@ begin
             { then do not set the name.               }
             if (not ((d^.d_name[0]='.') and ((d^.d_name[1]=#0) or
                     ((d^.d_name[1]='.') and (d^.d_name[2]=#0))))) then
-              { d^.d_name is an array[0..x] of char -> will be assigned the
+              { d^.d_name is an array[0..x] of AnsiChar -> will be assigned the
                 ansi code page on conversion to ansistring -> also typecast
                 '/' to ansistring rather than rawbytestring so code pages match
                 (will be unconditionally set to DefaultFileSystemCodePage at

+ 3 - 3
rtl/unix/sysfile.inc

@@ -24,7 +24,7 @@ Begin
     Errno2Inoutres;
 End;
 
-Procedure Do_Erase(p: pchar; pchangeable: boolean);
+Procedure Do_Erase(p: PAnsiChar; pchangeable: boolean);
 var
  fileinfo : stat;
 Begin
@@ -60,7 +60,7 @@ end;
 
 
 
-Procedure Do_Rename(p1,p2:pchar; p1changeable, p2changeable: boolean);
+Procedure Do_Rename(p1,p2:PAnsiChar; p1changeable, p2changeable: boolean);
 Begin
   If Fprename(p1,p2)<0 Then
    Errno2Inoutres
@@ -147,7 +147,7 @@ Begin
    InOutRes:=0;
 End;
 
-Procedure Do_Open(var f; p: pchar; flags: longint; pchangeable: boolean);
+Procedure Do_Open(var f; p: PAnsiChar; flags: longint; pchangeable: boolean);
 {
   FileRec and textrec have both Handle and mode as the first items so
   they could use the same routine for opening/creating.

+ 8 - 7
rtl/unix/sysunixh.inc

@@ -32,8 +32,8 @@ const
  DriveSeparator = '';
  ExtensionSeparator = '.';
  PathSeparator = ':';
- AllowDirectorySeparators : set of char = ['\','/'];
- AllowDriveSeparators : set of char = [];
+ AllowDirectorySeparators : set of AnsiChar = ['\','/'];
+ AllowDriveSeparators : set of AnsiChar = [];
 { FileNameCaseSensitive and FileNameCasePreserving are defined below! }
  maxExitCode = 255;
  {$ifdef LINUX}
@@ -59,12 +59,12 @@ const
 {$if not defined(solaris) and not defined(darwin) and not defined(aix)}
 {$ifdef FPC_HAS_INDIRECT_ENTRY_INFORMATION}
 var argc:longint;
-    argv:PPchar;
-    envp:PPchar;
+    argv:PPAnsiChar;
+    envp:PPAnsiChar;
 {$else FPC_HAS_INDIRECT_ENTRY_INFORMATION}
 var argc:longint;external name 'operatingsystem_parameter_argc';
-    argv:PPchar;external name 'operatingsystem_parameter_argv';
-    envp:PPchar;external name 'operatingsystem_parameter_envp';
+    argv:PPAnsiChar;external name 'operatingsystem_parameter_argv';
+    envp:PPAnsiChar;external name 'operatingsystem_parameter_envp';
 {$endif FPC_HAS_INDIRECT_ENTRY_INFORMATION}
 {$endif}
 
@@ -73,5 +73,6 @@ const
   { hook for lineinfo, to get the module name from an address,
     unit dl sets it if it is used
   }
-  UnixGetModuleByAddrHook : procedure (addr: pointer; var baseaddr: pointer; var filename: string) = nil;
+  UnixGetModuleByAddrHook : procedure (addr: pointer; var baseaddr: pointer; var filename:
+  ansistring) = nil;
 {$endif unix}

+ 25 - 25
rtl/unix/sysutils.pp

@@ -297,7 +297,7 @@ procedure UnhookSignal(RtlSigNum: Integer; OnlyIfHooked: Boolean = True);
 {$Define OS_FILEISREADONLY} // Specific implementation for Unix.
 
 {$DEFINE FPC_FEXPAND_TILDE} { Tilde is expanded to home }
-{$DEFINE FPC_FEXPAND_GETENVPCHAR} { GetEnv result is a PChar }
+{$DEFINE FPC_FEXPAND_GETENVPCHAR} { GetEnv result is a PAnsiChar }
 
 { Include platform independent implementation part }
 
@@ -581,14 +581,14 @@ begin
 {$ifdef USE_STATX}
   { first try statx }
   if {$ifdef FPC_USE_LIBC} (@statx<>nil) and {$endif}
-     (statx(AT_FDCWD,pchar(SystemFileName),0,STATX_MTIME or STATX_MODE,Infox)>=0) and not(fpS_ISDIR(Infox.stx_mode)) then
+     (statx(AT_FDCWD,PAnsiChar(SystemFileName),0,STATX_MTIME or STATX_MODE,Infox)>=0) and not(fpS_ISDIR(Infox.stx_mode)) then
     begin
       Result:=Infox.stx_mtime.tv_sec;
       exit;
     end;
 {$endif USE_STATX}
 
-  If  (fpstat(pchar(SystemFileName),Info)<0) or fpS_ISDIR(info.st_mode) then
+  If  (fpstat(PAnsiChar(SystemFileName),Info)<0) or fpS_ISDIR(info.st_mode) then
     exit(-1)
   else 
     Result:=info.st_mtime;
@@ -652,7 +652,7 @@ begin
     begin
       Result:=Result or faSymLink;
       // Windows reports if the link points to a directory.
-      if (fpstat(pchar(FN),LinkInfo)>=0) and fpS_ISDIR(LinkInfo.st_mode) then
+      if (fpstat(PAnsiChar(FN),LinkInfo)>=0) and fpS_ISDIR(LinkInfo.st_mode) then
         Result := Result or faDirectory;
     end;
 end;
@@ -681,7 +681,7 @@ begin
       Result:=Result or faSymLink;
       // Windows reports if the link points to a directory.
       { as we are only interested in the st_mode field here, we do not need to use statx }
-      if (fpstat(pchar(FN),LinkInfo)>=0) and fpS_ISDIR(LinkInfo.st_mode) then
+      if (fpstat(PAnsiChar(FN),LinkInfo)>=0) and fpS_ISDIR(LinkInfo.st_mode) then
         Result := Result or faDirectory;
     end;
 end;
@@ -1061,7 +1061,7 @@ Begin
         DirName:='./'
       Else
         DirName:=Copy(UnixFindData^.SearchSpec,1,UnixFindData^.NamePos);
-      UnixFindData^.DirPtr := fpopendir(Pchar(DirName));
+      UnixFindData^.DirPtr := fpopendir(PAnsiChar(DirName));
     end;
   SName:=Copy(UnixFindData^.SearchSpec,UnixFindData^.NamePos+1,Length(UnixFindData^.SearchSpec));
   Found:=False;
@@ -1137,7 +1137,7 @@ Var
 {$ifdef USE_STATX}
   Infox : TStatx;
 {$endif USE_STATX}
-  Char0 : char;
+  Char0 : AnsiChar;
 begin
   Result:=-1;
 {$ifdef USE_STATX}
@@ -1202,7 +1202,7 @@ var
   SystemFileName: RawByteString;
 begin
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
-  Result:=fpUnLink (pchar(SystemFileName))>=0;
+  Result:=fpUnLink (PAnsiChar(SystemFileName))>=0;
 end;
 
 
@@ -1221,7 +1221,7 @@ var
   SystemFileName: RawByteString;
 begin
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
-  Result:=fpAccess(PChar(SystemFileName),W_OK)<>0;
+  Result:=fpAccess(PAnsiChar(SystemFileName),W_OK)<>0;
 end;
 
 Function FileSetDate (Const FileName : RawByteString; Age : Int64) : Longint;
@@ -1239,7 +1239,7 @@ begin
   times[0].tv_nsec:=0;
   times[1].tv_sec:=Age;
   times[1].tv_nsec:=0;
-  if utimensat(AT_FDCWD,PChar(SystemFileName),times,0) = -1 then
+  if utimensat(AT_FDCWD,PAnsiChar(SystemFileName),times,0) = -1 then
     Result:=fpgeterrno;
   if fpgeterrno=ESysENOSYS then
 {$endif USE_UTIMENSAT}
@@ -1247,7 +1247,7 @@ begin
       Result:=0;
       t.actime:= Age;
       t.modtime:=Age;
-      if fputime(PChar(SystemFileName), @t) = -1 then
+      if fputime(PAnsiChar(SystemFileName), @t) = -1 then
         Result:=fpgeterrno;
     end
 end;
@@ -1257,7 +1257,7 @@ Function IsFileNameCaseSensitive(Const aFileName : RawByteString) : Boolean;
 var
   res : clong;
 begin
-  res:=FpPathconf(PChar(aFileName),11 {_PC_CASE_SENSITIVE });
+  res:=FpPathconf(PAnsiChar(aFileName),11 {_PC_CASE_SENSITIVE });
   { fall back to default if path is not found }
   if res<0 then
     Result:=FileNameCaseSensitive
@@ -1274,7 +1274,7 @@ Function IsFileNameCasePreserving(Const aFileName : RawByteString) : Boolean;
 var
   res : clong;
 begin
-  res:=FpPathconf(PChar(aFileName),12 { _PC_CASE_PRESERVING });
+  res:=FpPathconf(PAnsiChar(aFileName),12 { _PC_CASE_PRESERVING });
   if res<0 then
     { fall back to default if path is not found }
     Result:=FileNameCasePreserving
@@ -1305,7 +1305,7 @@ end;
   They both return -1 when a failure occurs.
 }
 Const
-  FixDriveStr : array[0..3] of pchar=(
+  FixDriveStr : array[0..3] of PAnsiChar=(
     '.',
     '/fd0/.',
     '/fd1/.',
@@ -1313,9 +1313,9 @@ Const
     );
 var
   Drives   : byte = 4;
-  DriveStr : array[4..26] of pchar;
+  DriveStr : array[4..26] of PAnsiChar;
 
-Function GetDriveStr(Drive : Byte) : Pchar;
+Function GetDriveStr(Drive : Byte) : PAnsiChar;
 
 begin
   case Drive of
@@ -1330,7 +1330,7 @@ end;
 
 Function DiskFree(Drive: Byte): int64;
 var
-  p : PChar;
+  p : PAnsiChar;
   fs : TStatfs;
 Begin
   p:=GetDriveStr(Drive);
@@ -1342,7 +1342,7 @@ End;
 
 Function DiskSize(Drive: Byte): int64;
 var
-  p : PChar;
+  p : PAnsiChar;
   fs : TStatfs;
 Begin
   p:=GetDriveStr(Drive);
@@ -1532,7 +1532,7 @@ Function GetEnvironmentVariable(Const EnvVar : String) : String;
 begin
   { no need to adjust the code page of EnvVar to DefaultSystemCodePage, as only
     ASCII identifiers are supported }
-  Result:=BaseUnix.FPGetenv(PChar(pointer(EnvVar)));
+  Result:=BaseUnix.FPGetenv(PAnsiChar(pointer(EnvVar)));
 end;
 
 Function GetEnvironmentVariableCount : Integer;
@@ -1554,7 +1554,7 @@ var
   e      : EOSError;
   CommandLine: RawByteString;
   LPath  : RawByteString;
-  cmdline2 : ppchar;
+  cmdline2 : PPAnsiChar;
 
 Begin
   { always surround the name of the application by quotes
@@ -1576,12 +1576,12 @@ Begin
        UniqueString(CommandLine);
        SetCodePage(CommandLine,DefaultFileSystemCodePage,true);
        cmdline2:=StringtoPPChar(CommandLine,1);
-       cmdline2^:=pchar(pointer(LPath));
+       cmdline2^:=PAnsiChar(pointer(LPath));
      end
    else
      begin
-       getmem(cmdline2,2*sizeof(pchar));
-       cmdline2^:=pchar(LPath);
+       getmem(cmdline2,2*sizeof(PAnsiChar));
+       cmdline2^:=PAnsiChar(LPath);
        cmdline2[1]:=nil;
      end;
 
@@ -1593,7 +1593,7 @@ Begin
   if pid=0 then
    begin
    {The child does the actual exec, and then exits}
-      fpexecve(pchar(pointer(LPath)),Cmdline2,envp);
+      fpexecv(PAnsiChar(pointer(LPath)),Cmdline2);
      { If the execve fails, we return an exitvalue of 127, to let it be known}
      fpExit(127);
    end
@@ -1701,7 +1701,7 @@ begin
         begin
           SetLength(Result, MAX_PATH);
           SetLength(Result, FileRead(h, Result[1], Length(Result)));
-          SetLength(Result, strlen(PChar(Result)));
+          SetLength(Result, strlen(PAnsiChar(Result)));
           FileClose(h);
           Result:='/data/data/' + Result;
           _HasPackageDataDir:=DirectoryExists(Result);

+ 2 - 2
rtl/unix/timezone.inc

@@ -40,7 +40,7 @@ var
   transitions  : PInt64 = nil;
   type_idxs    : pbyte = Nil;
   types        : pttinfo = Nil;
-  zone_names   : pchar = Nil;
+  zone_names   : PAnsiChar = Nil;
   leaps        : pleap = Nil;
 
 function find_transition(timer:int64;timerIsUTC:Boolean;var trans_start,trans_end:int64):pttinfo;
@@ -138,7 +138,7 @@ end;
 procedure DoGetLocalTimezoneEx(timer:int64;info:pttinfo;var ATZInfoEx:TTZInfoEx);
 var
   i : longint;
-  names: array[Boolean] of pchar;
+  names: array[Boolean] of PAnsiChar;
 begin
   names[true]:=nil;
   names[false]:=nil;

+ 42 - 42
rtl/unix/unix.pp

@@ -105,13 +105,13 @@ Function GregorianToJulian(Year,Month,Day:Longint):LongInt; // use DateUtils.Jul
 
 {**  Process Handling  **}
 
-function FpExecLE (Const PathName:RawByteString;const S:Array Of RawByteString;MyEnv:ppchar):cint;
+function FpExecLE (Const PathName:RawByteString;const S:Array Of RawByteString;MyEnv:PPAnsiChar):cint;
 function FpExecL  (Const PathName:RawByteString;const S:Array Of RawByteString):cint;
 function FpExecLP (Const PathName:RawByteString;const S:Array Of RawByteString):cint;
-function FpExecLPE(Const PathName:RawByteString;const S:Array Of RawByteString;env:ppchar):cint;
-function FpExecV  (Const PathName:RawByteString;args:ppchar):cint;
-function FpExecVP (Const PathName:RawByteString;args:ppchar):cint;
-function FpExecVPE(Const PathName:RawByteString;args,env:ppchar):cint;
+function FpExecLPE(Const PathName:RawByteString;const S:Array Of RawByteString;env:PPAnsiChar):cint;
+function FpExecV  (Const PathName:RawByteString;args:PPAnsiChar):cint;
+function FpExecVP (Const PathName:RawByteString;args:PPAnsiChar):cint;
+function FpExecVPE(Const PathName:RawByteString;args,env:PPAnsiChar):cint;
 
 Function fpSystem(const Command:RawByteString):cint;
 
@@ -135,10 +135,10 @@ function  TellDir(p:pdir):TOff;
 Function AssignPipe  (var pipe_in,pipe_out:cint):cint;
 Function AssignPipe  (var pipe_in,pipe_out:text):cint;
 Function AssignPipe  (var pipe_in,pipe_out:file):cint;
-Function POpen       (var F:text;const Prog:RawByteString;rw:char):cint;
-Function POpen       (var F:file;const Prog:RawByteString;rw:char):cint;
-Function POpen       (var F:text;const Prog:UnicodeString;rw:char):cint;
-Function POpen       (var F:file;const Prog:UnicodeString;rw:char):cint;
+Function POpen       (var F:text;const Prog:RawByteString;rw:AnsiChar):cint;
+Function POpen       (var F:file;const Prog:RawByteString;rw:AnsiChar):cint;
+Function POpen       (var F:text;const Prog:UnicodeString;rw:AnsiChar):cint;
+Function POpen       (var F:file;const Prog:UnicodeString;rw:AnsiChar):cint;
 Function AssignStream(Var StreamIn,Streamout:text;Const Prog:ansiString;const args : array of ansistring) : cint;
 Function AssignStream(Var StreamIn,Streamout,streamerr:text;Const Prog:ansiString;const args : array of ansistring) : cint;
 Function GetDomainName:String; deprecated; // because linux only.
@@ -185,7 +185,7 @@ Uses
 
 {$i unxfunc.inc}   { Platform specific implementations }
 
-Function getenv(name:string):Pchar; external name 'FPC_SYSC_FPGETENV';
+Function getenv(name:string):PAnsiChar; external name 'FPC_SYSC_FPGETENV';
 
 {******************************************************************************
                           timezone support
@@ -403,7 +403,7 @@ begin
    end;
 end;
 
-function intFpExecVEMaybeP (Const PathName:RawByteString;Args,MyEnv:ppchar;SearchPath:Boolean):cint;
+function intFpExecVEMaybeP (Const PathName:RawByteString;Args,MyEnv:PPAnsiChar;SearchPath:Boolean):cint;
 // does an ExecVE, but still has to handle P
 // execv variants call this directly, execl variants indirectly via
 //     intfpexecl
@@ -432,11 +432,11 @@ Begin
       // Stevens says "try each path prefix"
 
       // execp puts newcmd here.
-        args^:=pchar(newcmd);
+        args^:=PAnsiChar(newcmd);
    End else
       newcmd:=ToSingleByteFileSystemEncodedFileName(pathname);
  // repeat
-//      if searchpath then args^:=pchar(commandtorun)
+//      if searchpath then args^:=PAnsiChar(commandtorun)
 
   IntFpExecVEMaybeP:=fpExecVE(newcmd,Args,MyEnv);
 {
@@ -459,11 +459,11 @@ Begin
 }
 end;
 
-function intFpExecl (Const PathName:RawByteString;const s:array of RawByteString;MyEnv:ppchar;SearchPath:Boolean):cint;
-{ Handles the array of ansistring -> ppchar conversion.
+function intFpExecl (Const PathName:RawByteString;const s:array of RawByteString;MyEnv:PPAnsiChar;SearchPath:Boolean):cint;
+{ Handles the array of ansistring -> PPAnsiChar conversion.
   Base for the the "l" variants.
 }
-var p:ppchar;
+var p:PPAnsiChar;
     i:integer;
     s2:array of Rawbytestring;
 begin
@@ -478,7 +478,7 @@ begin
   p:=ArrayStringToPPchar(s2,1);
   if p=NIL Then
     Begin
-      GetMem(p,2*sizeof(pchar));
+      GetMem(p,2*sizeof(PAnsiChar));
       if p=nil then
        begin
         {$ifdef xunix}
@@ -489,13 +489,13 @@ begin
        end;
       p[1]:=nil;
     End;
-  p^:=pchar(PathName);
+  p^:=PAnsiChar(PathName);
   IntFPExecL:=intFpExecVEMaybeP(PathName,p,MyEnv,SearchPath);
   // If we come here, no attempts were executed successfully.
   Freemem(p);
 end;
 
-function FpExecLE (Const PathName:RawByteString;const S:Array Of RawByteString;MyEnv:ppchar):cint;
+function FpExecLE (Const PathName:RawByteString;const S:Array Of RawByteString;MyEnv:PPAnsiChar):cint;
 
 Begin
   FpExecLE:=intFPExecl(PathName,s,MyEnv,false);
@@ -514,25 +514,25 @@ Begin
   FpExecLP:=intFPExecl(PathName,S,EnvP,True);
 End;
 
-function FpExecLPE(Const PathName:RawByteString;const S:Array Of RawByteString;env:ppchar):cint;
+function FpExecLPE(Const PathName:RawByteString;const S:Array Of RawByteString;env:PPAnsiChar):cint;
 
 Begin
   FpExecLPE:=intFPExecl(PathName,S,Env,True);
 End;
 
-function FpExecV(Const PathName:RawByteString;args:ppchar):cint;
+function FpExecV(Const PathName:RawByteString;args:PPAnsiChar):cint;
 
 Begin
  fpexecV:=intFpExecVEMaybeP (PathName,args,envp,false);
 End;
 
-function FpExecVP(Const PathName:RawByteString;args:ppchar):cint;
+function FpExecVP(Const PathName:RawByteString;args:PPAnsiChar):cint;
 
 Begin
  fpexecVP:=intFpExecVEMaybeP (PathName,args,envp,true);
 End;
 
-function FpExecVPE(Const PathName:RawByteString;args,env:ppchar):cint;
+function FpExecVPE(Const PathName:RawByteString;args,env:PPAnsiChar):cint;
 
 Begin
  fpexecVPE:=intFpExecVEMaybeP (PathName,args,env,true);
@@ -541,7 +541,7 @@ End;
 // exect and execvP (ExecCapitalP) are not implement
 // Non POSIX anyway.
 // Exect turns on tracing for the process
-// execvP has the searchpath as array of ansistring ( const char *search_path)
+// execvP has the searchpath as array of ansistring ( const AnsiChar *search_path)
 
 {$define FPC_USE_FPEXEC}
 {$if defined(FPC_USE_FPEXEC) and not defined(USE_VFORK)}
@@ -549,14 +549,14 @@ End;
 {$endif}
 
 {$ifdef FPC_USE_LIBC}
-function xfpsystem(p:pchar):cint; cdecl; external clib name 'system';
+function xfpsystem(p:PAnsiChar):cint; cdecl; external clib name 'system';
 
 Function fpSystem(const Command:RawByteString):cint;
 var
   cmd: RawByteString;
 begin
   cmd:=ToSingleByteFileSystemEncodedFileName(Command);
-  fpsystem:=xfpsystem(pchar(cmd));
+  fpsystem:=xfpsystem(PAnsiChar(cmd));
 end;
 
 {$else}
@@ -569,7 +569,7 @@ var
   newsigblock,
   oldsigblock    : tsigset;
  {$ifndef SHELL_USE_FPEXEC}
-   p      : ppchar;
+   p      : PPAnsiChar;
  {$endif}
   cmd     : RawByteString;
 
@@ -765,10 +765,10 @@ begin
         { first check if we need something to write, else we may
           get a SigPipe when Close() is called (PFV) }
         if textrec(f).bufpos>0 then
-          IOPipe:=fpwrite(textrec(f).handle,pchar(textrec(f).bufptr),textrec(f).bufpos);
+          IOPipe:=fpwrite(textrec(f).handle,PAnsiChar(textrec(f).bufptr),textrec(f).bufpos);
       end;
     fminput : Begin
-                textrec(f).bufend:=fpread(textrec(f).handle,pchar(textrec(f).bufptr),textrec(f).bufsize);
+                textrec(f).bufend:=fpread(textrec(f).handle,PAnsiChar(textrec(f).bufptr),textrec(f).bufsize);
                 IOPipe:=textrec(f).bufend;
               End;
   end;
@@ -857,7 +857,7 @@ begin
 end;
 
 
-Function POpen_internal(var F:text;const Prog:RawByteString;rw:char):cint;
+Function POpen_internal(var F:text;const Prog:RawByteString;rw:AnsiChar):cint;
 {
   Starts the program in 'Prog' and makes it's input or out put the
   other end of a pipe. If rw is 'w' or 'W', then whatever is written to
@@ -871,7 +871,7 @@ var
   pid  : cint;
   pl   : ^cint;
 {$if not defined(FPC_USE_FPEXEC) or defined(USE_VFORK)}
-  pp : array[0..3] of pchar;
+  pp : array[0..3] of PAnsiChar;
   temp : string[255];
 {$endif not FPC_USE_FPEXEC or USE_VFORK}
   ret  : cint;
@@ -938,7 +938,7 @@ begin
          fpexit(127);
       end;
      {$if defined(FPC_USE_FPEXEC) and not defined(USE_VFORK)}
-     fpexecl(pchar('/bin/sh'),['-c',Prog]);
+     fpexecl(PAnsiChar('/bin/sh'),['-c',Prog]);
      {$else}
      temp:='/bin/sh'#0'-c'#0;
      pp[0]:=@temp[1];
@@ -972,7 +972,7 @@ begin
  POpen_internal:=0;
 end;
 
-Function POpen_internal(var F:file;const Prog:RawByteString;rw:char):cint;
+Function POpen_internal(var F:file;const Prog:RawByteString;rw:AnsiChar):cint;
 {
   Starts the program in 'Prog' and makes it's input or out put the
   other end of a pipe. If rw is 'w' or 'W', then whatever is written to
@@ -986,7 +986,7 @@ var
   pid  : cint;
   pl   : ^cint;
 {$if not defined(FPC_USE_FPEXEC) or defined(USE_VFORK)}
-  pp : array[0..3] of pchar;
+  pp : array[0..3] of PAnsiChar;
   temp : string[255];
 {$endif not FPC_USE_FPEXEC or USE_VFORK}
   ret  : cint;
@@ -1053,7 +1053,7 @@ begin
          fpexit(127);
       end;
      {$if defined(FPC_USE_FPEXEC) and not defined(USE_VFORK)}
-     fpexecl(pchar('/bin/sh'),['-c',Prog]);
+     fpexecl(PAnsiChar('/bin/sh'),['-c',Prog]);
      {$else}
      temp:='/bin/sh'#0'-c'#0;
      pp[0]:=@temp[1];
@@ -1085,7 +1085,7 @@ begin
  POpen_internal:=0;
 end;
 
-Function POpen(var F:text;const Prog:RawByteString;rw:char):cint;
+Function POpen(var F:text;const Prog:RawByteString;rw:AnsiChar):cint;
 begin
   { can't do the ToSingleByteFileSystemEncodedFileName() conversion inside
     POpen_internal, because this may destroy the temp rawbytestring result
@@ -1093,7 +1093,7 @@ begin
   POpen:=POpen_internal(F,ToSingleByteFileSystemEncodedFileName(Prog),rw);
 end;
 
-Function POpen(var F:file;const Prog:RawByteString;rw:char):cint;
+Function POpen(var F:file;const Prog:RawByteString;rw:AnsiChar):cint;
 begin
   { can't do the ToSingleByteFileSystemEncodedFileName() conversion inside
     POpen_internal, because this may destroy the temp rawbytestring result
@@ -1101,13 +1101,13 @@ begin
   POpen:=POpen_internal(F,ToSingleByteFileSystemEncodedFileName(Prog),rw);
 end;
 
-function POpen(var F: text; const Prog: UnicodeString; rw: char): cint;
+function POpen(var F: text; const Prog: UnicodeString; rw: AnsiChar): cint;
 begin
   POpen:=POpen_internal(F,ToSingleByteFileSystemEncodedFileName(Prog),rw);
 end;
 
 
-function POpen(var F: file; const Prog: UnicodeString; rw: char): cint;
+function POpen(var F: file; const Prog: UnicodeString; rw: AnsiChar): cint;
 begin
   POpen:=POpen_internal(F,ToSingleByteFileSystemEncodedFileName(Prog),rw);
 end;
@@ -1325,7 +1325,7 @@ Function GetDomainName:String;
 
 {$if defined(BSD) or defined(aix)}
 
-function intGetDomainName(Name:PChar; NameLen:Cint):cint;
+function intGetDomainName(Name:PAnsiChar; NameLen:Cint):cint;
 {$ifndef FPC_USE_LIBC}
  external name 'FPC_SYSC_GETDOMAINNAME';
 {$else FPC_USE_LIBC}
@@ -1380,7 +1380,7 @@ Var
   p1     : cint;
   Info   : Stat;
   i,j      : cint;
-  p      : pchar;
+  p      : PAnsiChar;
 Begin
  SetCodePage(dirlist,DefaultFileSystemCodePage);
  if CurrentDirStrategy=CurrentDirectoryFirst Then
@@ -1400,7 +1400,7 @@ Begin
   Else
    Begin
      mypath:=ToSingleByteFileSystemEncodedFileName(path);
-     p:=pchar(dirlist);
+     p:=PAnsiChar(dirlist);
      i:=length(dirlist);
      j:=1;
      Repeat

+ 15 - 15
rtl/unix/unixutil.pp

@@ -27,22 +27,22 @@ unit unixutil;
 
 interface
 
-Function StringToPPChar(S: PChar;ReserveEntries:integer):ppchar;
-Function StringToPPChar(Var S:RawByteString;ReserveEntries:integer):ppchar;
-function ArrayStringToPPchar(const S:Array of RawByteString;reserveentries:Longint):ppchar; // const ?
+Function StringToPPChar(S: PAnsiChar;ReserveEntries:integer):PPAnsiChar;
+Function StringToPPChar(Var S:RawByteString;ReserveEntries:integer):PPAnsiChar;
+function ArrayStringToPPchar(const S:Array of RawByteString;reserveentries:Longint):PPAnsiChar; // const ?
 
 implementation
 
-function ArrayStringToPPchar(const S:Array of RawByteString;reserveentries:Longint):ppchar; // const ?
-// Extra allocate reserveentries pchar's at the beginning (default param=0 after 1.0.x ?)
+function ArrayStringToPPchar(const S:Array of RawByteString;reserveentries:Longint):PPAnsiChar; // const ?
+// Extra allocate reserveentries PAnsiChar's at the beginning (default param=0 after 1.0.x ?)
 // Note: for internal use by skilled programmers only
 // if "s" goes out of scope in the parent procedure, the pointer is dangling.
 
-var p   : ppchar;
+var p   : PPAnsiChar;
     i   : LongInt;
 begin
   if High(s)<Low(s) Then Exit(NIL);
-  Getmem(p,sizeof(pchar)*(high(s)-low(s)+ReserveEntries+2));  // one more for NIL, one more
+  Getmem(p,sizeof(PAnsiChar)*(high(s)-low(s)+ReserveEntries+2));  // one more for NIL, one more
                                               // for cmd
   if p=nil then
     begin
@@ -52,27 +52,27 @@ begin
       exit(NIL);
     end;
   for i:=low(s) to high(s) do
-     p[i+Reserveentries]:=pchar(s[i]);
+     p[i+Reserveentries]:=PAnsiChar(s[i]);
   p[high(s)+1+Reserveentries]:=nil;
   ArrayStringToPPchar:=p;
 end;
 
-Function StringToPPChar(Var S:RawByteString;ReserveEntries:integer):ppchar;
+Function StringToPPChar(Var S:RawByteString;ReserveEntries:integer):PPAnsiChar;
 {
-  Create a PPChar to structure of pchars which are the arguments specified
+  Create a PPAnsiChar to structure of pchars which are the arguments specified
   in the string S. Especially useful for creating an ArgV for Exec-calls
 }
 
 begin
-  StringToPPChar:=StringToPPChar(PChar(S),ReserveEntries);
+  StringToPPChar:=StringToPPChar(PAnsiChar(S),ReserveEntries);
 end;
 
-Function StringToPPChar(S: PChar;ReserveEntries:integer):ppchar;
+Function StringToPPChar(S: PAnsiChar;ReserveEntries:integer):PPAnsiChar;
 
 var
   i,nr  : longint;
-  Buf : ^char;
-  p   : ppchar;
+  Buf : ^AnsiChar;
+  p   : PPAnsiChar;
 
 begin
   buf:=s;
@@ -96,7 +96,7 @@ begin
            inc(buf);
        end;
    end;
-  getmem(p,(ReserveEntries+nr)*sizeof(pchar));
+  getmem(p,(ReserveEntries+nr)*sizeof(PAnsiChar));
   StringToPPChar:=p;
   if p=nil then
    begin

+ 2 - 2
rtl/unix/unxdeclh.inc

@@ -39,9 +39,9 @@ Function fpfStatFS(Fd:Longint; Info:pstatfs):cint; cdecl; external clib name 'fs
 Function fpfsync (fd : cint) : cint; cdecl; external clib name 'fsync';
 
 {$if defined(beos) or defined(solaris) }
-Function fpStatFS  (Path:pchar; Info:pstatfs):cint; cdecl; external clib name 'statvfs';
+Function fpStatFS  (Path:PAnsiChar; Info:pstatfs):cint; cdecl; external clib name 'statvfs';
 {$else beos or solaris }
-Function fpStatFS  (Path:pchar; Info:pstatfs):cint; cdecl; external clib name 'statfs'{$ifdef darin_new_iostructs_suffix}+'$INODE64'{$endif};
+Function fpStatFS  (Path:PAnsiChar; Info:pstatfs):cint; cdecl; external clib name 'statfs'{$ifdef darin_new_iostructs_suffix}+'$INODE64'{$endif};
 {$endif beos or solaris }
 
 function pipe (var fildes: filedesarray):cint;  cdecl; external clib name 'pipe';

+ 1 - 1
rtl/unix/unxovl.inc

@@ -16,6 +16,6 @@
 Function fpStatFS(Path:ansistring;Info:PStatfs):cint;
 
 begin
-  fpstatfs:=fpstatfs(pchar(path),info);
+  fpstatfs:=fpstatfs(PAnsiChar(path),info);
 end;
 

+ 2 - 2
rtl/unix/x86.pp

@@ -412,12 +412,12 @@ type
 
     i386_vm86_args = record
         sub_op   : cint;             { sub-operation to perform }
-        sub_args : pchar;               { args }
+        sub_args : PAnsiChar;               { args }
         end;
 
    sysarch_args     = record
                         op    : longint;
-                        parms : pchar;
+                        parms : PAnsiChar;
                        end;
 
 Function fpIOPerm(From,Num:CARDINAL;Value:cint):cint;