Browse Source

* Char -> AnsiChar

Michael VAN CANNEYT 2 years ago
parent
commit
2ce2bab2a6
7 changed files with 59 additions and 59 deletions
  1. 8 8
      rtl/wasi/dos.pp
  2. 4 4
      rtl/wasi/sysdir.inc
  3. 6 6
      rtl/wasi/sysfile.inc
  4. 7 7
      rtl/wasi/system.pp
  5. 18 18
      rtl/wasi/sysutils.pp
  6. 13 13
      rtl/wasi/wasiinc/wasiprocs.inc
  7. 3 3
      rtl/wasi/wasiutil.pp

+ 8 - 8
rtl/wasi/dos.pp

@@ -60,7 +60,7 @@ Uses
 {$DEFINE HAS_GETMSCOUNT}
 {$DEFINE HAS_GETMSCOUNT}
 
 
 {$DEFINE FPC_FEXPAND_TILDE} { Tilde is expanded to home }
 {$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}
 {$I dos.inc}
 
 
@@ -222,7 +222,7 @@ End;
   They both return -1 when a failure occurs.
   They both return -1 when a failure occurs.
 }
 }
 Const
 Const
-  FixDriveStr : array[0..3] of pchar=(
+  FixDriveStr : array[0..3] of PAnsiChar=(
     '.',
     '.',
     '/fd0/.',
     '/fd0/.',
     '/fd1/.',
     '/fd1/.',
@@ -231,7 +231,7 @@ Const
 const
 const
   Drives   : byte = 4;
   Drives   : byte = 4;
 var
 var
-  DriveStr : array[4..26] of pchar;
+  DriveStr : array[4..26] of PAnsiChar;
 
 
 Function AddDisk(const path:string) : byte;
 Function AddDisk(const path:string) : byte;
 begin
 begin
@@ -424,7 +424,7 @@ Begin
       DosError:=3;
       DosError:=3;
       exit;
       exit;
     end;
     end;
-  if __wasi_path_filestat_get(fd,__WASI_LOOKUPFLAGS_SYMLINK_FOLLOW,PChar(pr),length(pr),@Info)<>__WASI_ERRNO_SUCCESS then
+  if __wasi_path_filestat_get(fd,__WASI_LOOKUPFLAGS_SYMLINK_FOLLOW,PAnsiChar(pr),length(pr),@Info)<>__WASI_ERRNO_SUCCESS then
     begin
     begin
       DosError:=3;
       DosError:=3;
       exit;
       exit;
@@ -475,7 +475,7 @@ Begin
       doserror:=3;
       doserror:=3;
       exit;
       exit;
     end;
     end;
-  if __wasi_path_filestat_set_times(fd,0,PChar(pr),length(pr),0,modtime,
+  if __wasi_path_filestat_set_times(fd,0,PAnsiChar(pr),length(pr),0,modtime,
      __WASI_FSTFLAGS_MTIM or __WASI_FSTFLAGS_ATIM_NOW)<>__WASI_ERRNO_SUCCESS then
      __WASI_FSTFLAGS_MTIM or __WASI_FSTFLAGS_ATIM_NOW)<>__WASI_ERRNO_SUCCESS then
     doserror:=3;
     doserror:=3;
 End;
 End;
@@ -487,7 +487,7 @@ End;
 Function EnvCount: Longint;
 Function EnvCount: Longint;
 var
 var
   envcnt : longint;
   envcnt : longint;
-  p      : ppchar;
+  p      : PPAnsiChar;
 Begin
 Begin
   envcnt:=0;
   envcnt:=0;
   p:=envp;      {defined in system}
   p:=envp;      {defined in system}
@@ -504,7 +504,7 @@ End;
 Function EnvStr (Index: longint): String;
 Function EnvStr (Index: longint): String;
 Var
 Var
   i : longint;
   i : longint;
-  p : ppchar;
+  p : PPAnsiChar;
 Begin
 Begin
   if (Index <= 0) or (envp=nil) then
   if (Index <= 0) or (envp=nil) then
     envstr:=''
     envstr:=''
@@ -527,7 +527,7 @@ end;
 
 
 Function GetEnv(EnvVar: String): String;
 Function GetEnv(EnvVar: String): String;
 var
 var
-  hp : ppchar;
+  hp : PPAnsiChar;
   hs : string;
   hs : string;
   eqpos : longint;
   eqpos : longint;
 Begin
 Begin

+ 4 - 4
rtl/wasi/sysdir.inc

@@ -27,7 +27,7 @@ begin
   InOutRes:=ConvertToFdRelativePath(s,fd,pr);
   InOutRes:=ConvertToFdRelativePath(s,fd,pr);
   if InOutRes<>0 then
   if InOutRes<>0 then
     exit;
     exit;
-  res:=__wasi_path_create_directory(fd,PChar(pr),Length(pr));
+  res:=__wasi_path_create_directory(fd,PAnsiChar(pr),Length(pr));
   if res<>__WASI_ERRNO_SUCCESS then
   if res<>__WASI_ERRNO_SUCCESS then
     InOutRes:=Errno2InoutRes(res);
     InOutRes:=Errno2InoutRes(res);
 end;
 end;
@@ -41,7 +41,7 @@ begin
   InOutRes:=ConvertToFdRelativePath(s,fd,pr);
   InOutRes:=ConvertToFdRelativePath(s,fd,pr);
   if InOutRes<>0 then
   if InOutRes<>0 then
     exit;
     exit;
-  res:=__wasi_path_remove_directory(fd,PChar(pr),Length(pr));
+  res:=__wasi_path_remove_directory(fd,PAnsiChar(pr),Length(pr));
   if res<>__WASI_ERRNO_SUCCESS then
   if res<>__WASI_ERRNO_SUCCESS then
     InOutRes:=Errno2InoutRes(res);
     InOutRes:=Errno2InoutRes(res);
 end;
 end;
@@ -137,7 +137,7 @@ begin
           InOutRes:=3;
           InOutRes:=3;
           exit;
           exit;
         end;
         end;
-        res:=__wasi_path_filestat_get(fd,0,PChar(pr),Length(pr),@st);
+        res:=__wasi_path_filestat_get(fd,0,PAnsiChar(pr),Length(pr),@st);
         if res<>__WASI_ERRNO_SUCCESS then
         if res<>__WASI_ERRNO_SUCCESS then
         begin
         begin
           if res=__WASI_ERRNO_NOENT then
           if res=__WASI_ERRNO_NOENT then
@@ -148,7 +148,7 @@ begin
         end;
         end;
         if st.filetype=__WASI_FILETYPE_SYMBOLIC_LINK then
         if st.filetype=__WASI_FILETYPE_SYMBOLIC_LINK then
         begin
         begin
-          res:=fpc_wasi_path_readlink_ansistring(fd,PChar(pr),Length(pr),symlink);
+          res:=fpc_wasi_path_readlink_ansistring(fd,PAnsiChar(pr),Length(pr),symlink);
           if res<>__WASI_ERRNO_SUCCESS then
           if res<>__WASI_ERRNO_SUCCESS then
           begin
           begin
             InOutRes:=Errno2InoutRes(res);
             InOutRes:=Errno2InoutRes(res);

+ 6 - 6
rtl/wasi/sysfile.inc

@@ -26,7 +26,7 @@ begin
     InOutRes:=Errno2InoutRes(res);
     InOutRes:=Errno2InoutRes(res);
 end;
 end;
 
 
-procedure Do_Erase(p: pchar; pchangeable: boolean);
+procedure Do_Erase(p: PAnsiChar; pchangeable: boolean);
 var
 var
   fd: __wasi_fd_t;
   fd: __wasi_fd_t;
   pr: RawByteString;
   pr: RawByteString;
@@ -35,7 +35,7 @@ begin
   InOutRes:=ConvertToFdRelativePath(p,fd,pr);
   InOutRes:=ConvertToFdRelativePath(p,fd,pr);
   if InOutRes<>0 then
   if InOutRes<>0 then
     exit;
     exit;
-  res:=__wasi_path_unlink_file(fd,PChar(pr),Length(pr));
+  res:=__wasi_path_unlink_file(fd,PAnsiChar(pr),Length(pr));
   if res<>__WASI_ERRNO_SUCCESS then
   if res<>__WASI_ERRNO_SUCCESS then
     InOutRes:=Errno2InoutRes(res);
     InOutRes:=Errno2InoutRes(res);
 end;
 end;
@@ -51,7 +51,7 @@ begin
     InOutRes:=Errno2InoutRes(res);
     InOutRes:=Errno2InoutRes(res);
 end;
 end;
 
 
-procedure Do_Rename(p1,p2:pchar; p1changeable, p2changeable: boolean);
+procedure Do_Rename(p1,p2:PAnsiChar; p1changeable, p2changeable: boolean);
 var
 var
   fd1,fd2: __wasi_fd_t;
   fd1,fd2: __wasi_fd_t;
   pr1,pr2: RawByteString;
   pr1,pr2: RawByteString;
@@ -63,7 +63,7 @@ begin
   InOutRes:=ConvertToFdRelativePath(p2,fd2,pr2);
   InOutRes:=ConvertToFdRelativePath(p2,fd2,pr2);
   if InOutRes<>0 then
   if InOutRes<>0 then
     exit;
     exit;
-  res:=__wasi_path_rename(fd1,PChar(pr1),Length(pr1),fd2,PChar(pr2),Length(pr2));
+  res:=__wasi_path_rename(fd1,PAnsiChar(pr1),Length(pr1),fd2,PAnsiChar(pr2),Length(pr2));
   if res<>__WASI_ERRNO_SUCCESS then
   if res<>__WASI_ERRNO_SUCCESS then
     InOutRes:=Errno2InoutRes(res);
     InOutRes:=Errno2InoutRes(res);
 end;
 end;
@@ -180,7 +180,7 @@ begin
   end;
   end;
 end;
 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
   FileRec and textrec have both Handle and mode as the first items so
   they could use the same routine for opening/creating.
   they could use the same routine for opening/creating.
@@ -285,7 +285,7 @@ Begin
   repeat
   repeat
     res:=__wasi_path_open(fd,
     res:=__wasi_path_open(fd,
                           0,
                           0,
-                          PChar(pr),
+                          PAnsiChar(pr),
                           length(pr),
                           length(pr),
                           oflags,
                           oflags,
                           fs_rights_base,
                           fs_rights_base,

+ 7 - 7
rtl/wasi/system.pp

@@ -33,8 +33,8 @@ const
   DriveSeparator = '';
   DriveSeparator = '';
   ExtensionSeparator = '.';
   ExtensionSeparator = '.';
   PathSeparator = ':';
   PathSeparator = ':';
-  AllowDirectorySeparators : set of char = ['\','/'];
-  AllowDriveSeparators : set of char = [];
+  AllowDirectorySeparators : set of AnsiChar = ['\','/'];
+  AllowDriveSeparators : set of AnsiChar = [];
 {  FileNameCaseSensitive and FileNameCasePreserving are defined below! }
 {  FileNameCaseSensitive and FileNameCasePreserving are defined below! }
   maxExitCode = 65535;
   maxExitCode = 65535;
   MaxPathLen = 4096;
   MaxPathLen = 4096;
@@ -55,8 +55,8 @@ const
 
 
 var
 var
   argc: longint;
   argc: longint;
-  argv: PPChar;
-  envp: PPChar;
+  argv: PPAnsiChar;
+  envp: PPAnsiChar;
   ___fpc_wasm_suspender: WasmExternRef; section 'WebAssembly.Global';
   ___fpc_wasm_suspender: WasmExternRef; section 'WebAssembly.Global';
 
 
 function __fpc_get_wasm_suspender: WasmExternRef;
 function __fpc_get_wasm_suspender: WasmExternRef;
@@ -98,7 +98,7 @@ function ConvertToFdRelativePath(path: RawByteString; out fd: LongInt; out relfd
 
 
 function fpc_wasi_path_readlink_ansistring(
 function fpc_wasi_path_readlink_ansistring(
                  fd: __wasi_fd_t;
                  fd: __wasi_fd_t;
-                 const path: PChar;
+                 const path: PAnsiChar;
                  path_len: size_t;
                  path_len: size_t;
                  out link: rawbytestring): __wasi_errno_t;[Public, Alias : 'FPC_WASI_PATH_READLINK_ANSISTRING'];
                  out link: rawbytestring): __wasi_errno_t;[Public, Alias : 'FPC_WASI_PATH_READLINK_ANSISTRING'];
 const
 const
@@ -323,7 +323,7 @@ begin
     envp:=nil;
     envp:=nil;
     exit;
     exit;
   end;
   end;
-  envp_size:=(environc+1)*SizeOf(PChar);
+  envp_size:=(environc+1)*SizeOf(PAnsiChar);
   GetMem(envp, envp_size);
   GetMem(envp, envp_size);
   GetMem(environ_buf, environ_buf_size);
   GetMem(environ_buf, environ_buf_size);
   envp[environc]:=nil;
   envp[environc]:=nil;
@@ -345,7 +345,7 @@ begin
     argv:=nil;
     argv:=nil;
     exit;
     exit;
   end;
   end;
-  argv_size:=(argc+1)*SizeOf(PChar);
+  argv_size:=(argc+1)*SizeOf(PAnsiChar);
   GetMem(argv, argv_size);
   GetMem(argv, argv_size);
   GetMem(argv_buf, argv_buf_size);
   GetMem(argv_buf, argv_buf_size);
   if __wasi_args_get(Pointer(argv), argv_buf)<>__WASI_ERRNO_SUCCESS then
   if __wasi_args_get(Pointer(argv), argv_buf)<>__WASI_ERRNO_SUCCESS then

+ 18 - 18
rtl/wasi/sysutils.pp

@@ -94,7 +94,7 @@ end;
                               File Functions
                               File Functions
 ****************************************************************************}
 ****************************************************************************}
 
 
-Function WasiToWinAttr (const FN : RawByteString; fd: __wasi_fd_t; pr: PChar; pr_len: size_t; Const Info : __wasi_filestat_t) : Longint;
+Function WasiToWinAttr (const FN : RawByteString; fd: __wasi_fd_t; pr: PAnsiChar; pr_len: size_t; Const Info : __wasi_filestat_t) : Longint;
 Var
 Var
   LinkInfo : __wasi_filestat_t;
   LinkInfo : __wasi_filestat_t;
   nm : RawByteString;
   nm : RawByteString;
@@ -176,7 +176,7 @@ Begin
   repeat
   repeat
     res:=__wasi_path_open(fd,
     res:=__wasi_path_open(fd,
                           0,
                           0,
-                          PChar(pr),
+                          PAnsiChar(pr),
                           length(pr),
                           length(pr),
                           0,
                           0,
                           fs_rights_base,
                           fs_rights_base,
@@ -221,7 +221,7 @@ Begin
   repeat
   repeat
     res:=__wasi_path_open(fd,
     res:=__wasi_path_open(fd,
                           0,
                           0,
-                          PChar(pr),
+                          PAnsiChar(pr),
                           length(pr),
                           length(pr),
                           __WASI_OFLAGS_CREAT or __WASI_OFLAGS_TRUNC,
                           __WASI_OFLAGS_CREAT or __WASI_OFLAGS_TRUNC,
                           fs_rights_base,
                           fs_rights_base,
@@ -347,7 +347,7 @@ begin
       result:=-1;
       result:=-1;
       exit;
       exit;
     end;
     end;
-  res:=__wasi_path_filestat_get(fd,0,PChar(pr),length(pr),@Info);
+  res:=__wasi_path_filestat_get(fd,0,PAnsiChar(pr),length(pr),@Info);
   if res=__WASI_ERRNO_SUCCESS then
   if res=__WASI_ERRNO_SUCCESS then
     result:=Info.mtim div 1000000000
     result:=Info.mtim div 1000000000
   else
   else
@@ -367,18 +367,18 @@ begin
   result:=false;
   result:=false;
   if ConvertToFdRelativePath(FileName,fd,pr)<>0 then
   if ConvertToFdRelativePath(FileName,fd,pr)<>0 then
     exit;
     exit;
-  if __wasi_path_filestat_get(fd,0,PChar(pr),length(pr),@Info)<>__WASI_ERRNO_SUCCESS then
+  if __wasi_path_filestat_get(fd,0,PAnsiChar(pr),length(pr),@Info)<>__WASI_ERRNO_SUCCESS then
     exit;
     exit;
   if Info.filetype<>__WASI_FILETYPE_SYMBOLIC_LINK then
   if Info.filetype<>__WASI_FILETYPE_SYMBOLIC_LINK then
     exit;
     exit;
-  if fpc_wasi_path_readlink_ansistring(fd,PChar(pr),Length(pr),symlink)<>__WASI_ERRNO_SUCCESS then
+  if fpc_wasi_path_readlink_ansistring(fd,PAnsiChar(pr),Length(pr),symlink)<>__WASI_ERRNO_SUCCESS then
     exit;
     exit;
   SymLinkRec.TargetName:=symlink;
   SymLinkRec.TargetName:=symlink;
 
 
-  res:=__wasi_path_filestat_get(fd,__WASI_LOOKUPFLAGS_SYMLINK_FOLLOW,PChar(pr),length(pr),@Info);
+  res:=__wasi_path_filestat_get(fd,__WASI_LOOKUPFLAGS_SYMLINK_FOLLOW,PAnsiChar(pr),length(pr),@Info);
   if res<>__WASI_ERRNO_SUCCESS then
   if res<>__WASI_ERRNO_SUCCESS then
     raise EDirectoryNotFoundException.Create('Error ' + IntToStr(res){todo: SysErrorMessage SysErrorMessage(GetLastOSError)});
     raise EDirectoryNotFoundException.Create('Error ' + IntToStr(res){todo: SysErrorMessage SysErrorMessage(GetLastOSError)});
-  SymLinkRec.Attr := WasiToWinAttr(FileName,fd,PChar(pr),length(pr),Info);
+  SymLinkRec.Attr := WasiToWinAttr(FileName,fd,PAnsiChar(pr),length(pr),Info);
   SymLinkRec.Size := Info.size;
   SymLinkRec.Size := Info.size;
   result:=true;
   result:=true;
 end;
 end;
@@ -399,7 +399,7 @@ begin
     flags:=__WASI_LOOKUPFLAGS_SYMLINK_FOLLOW
     flags:=__WASI_LOOKUPFLAGS_SYMLINK_FOLLOW
   else
   else
     flags:=0;
     flags:=0;
-  if __wasi_path_filestat_get(fd,flags,PChar(pr),length(pr),@Info)=__WASI_ERRNO_SUCCESS then
+  if __wasi_path_filestat_get(fd,flags,PAnsiChar(pr),length(pr),@Info)=__WASI_ERRNO_SUCCESS then
     result:=Info.filetype<>__WASI_FILETYPE_DIRECTORY
     result:=Info.filetype<>__WASI_FILETYPE_DIRECTORY
   else
   else
     result:=false;
     result:=false;
@@ -421,7 +421,7 @@ begin
     flags:=__WASI_LOOKUPFLAGS_SYMLINK_FOLLOW
     flags:=__WASI_LOOKUPFLAGS_SYMLINK_FOLLOW
   else
   else
     flags:=0;
     flags:=0;
-  if __wasi_path_filestat_get(fd,flags,PChar(pr),length(pr),@Info)=__WASI_ERRNO_SUCCESS then
+  if __wasi_path_filestat_get(fd,flags,PAnsiChar(pr),length(pr),@Info)=__WASI_ERRNO_SUCCESS then
     result:=Info.filetype=__WASI_FILETYPE_DIRECTORY
     result:=Info.filetype=__WASI_FILETYPE_DIRECTORY
   else
   else
     result:=false;
     result:=false;
@@ -508,7 +508,7 @@ begin
       result:=-1;
       result:=-1;
       exit;
       exit;
     end;
     end;
-  if __wasi_path_filestat_set_times(fd,0,PChar(pr),length(pr),Age*1000000000,Age*1000000000,
+  if __wasi_path_filestat_set_times(fd,0,PAnsiChar(pr),length(pr),Age*1000000000,Age*1000000000,
      __WASI_FSTFLAGS_MTIM or __WASI_FSTFLAGS_ATIM)=__WASI_ERRNO_SUCCESS then
      __WASI_FSTFLAGS_MTIM or __WASI_FSTFLAGS_ATIM)=__WASI_ERRNO_SUCCESS then
     result:=0
     result:=0
   else
   else
@@ -527,8 +527,8 @@ begin
       result:=-1;
       result:=-1;
       exit;
       exit;
     end;
     end;
-  if __wasi_path_filestat_get(fd,0,PChar(pr),length(pr),@Info)=__WASI_ERRNO_SUCCESS then
-    result:=WasiToWinAttr(FileName,fd,PChar(pr),length(pr),Info)
+  if __wasi_path_filestat_get(fd,0,PAnsiChar(pr),length(pr),@Info)=__WASI_ERRNO_SUCCESS then
+    result:=WasiToWinAttr(FileName,fd,PAnsiChar(pr),length(pr),Info)
   else
   else
     result:=-1;
     result:=-1;
 end;
 end;
@@ -551,7 +551,7 @@ begin
       result:=false;
       result:=false;
       exit;
       exit;
     end;
     end;
-  result:=__wasi_path_unlink_file(fd,PChar(pr),Length(pr))=__WASI_ERRNO_SUCCESS;
+  result:=__wasi_path_unlink_file(fd,PAnsiChar(pr),Length(pr))=__WASI_ERRNO_SUCCESS;
 end;
 end;
 
 
 
 
@@ -566,7 +566,7 @@ begin
     exit;
     exit;
   if ConvertToFdRelativePath(NewName,fd2,pr2)<>0 then
   if ConvertToFdRelativePath(NewName,fd2,pr2)<>0 then
     exit;
     exit;
-  result:=__wasi_path_rename(fd1,PChar(pr1),Length(pr1),fd2,PChar(pr2),Length(pr2))=__WASI_ERRNO_SUCCESS;
+  result:=__wasi_path_rename(fd1,PAnsiChar(pr1),Length(pr1),fd2,PAnsiChar(pr2),Length(pr2))=__WASI_ERRNO_SUCCESS;
 end;
 end;
 
 
 
 
@@ -663,7 +663,7 @@ end;
 
 
 Function GetEnvironmentVariable(Const EnvVar : String) : String;
 Function GetEnvironmentVariable(Const EnvVar : String) : String;
 var
 var
-  hp : ppchar;
+  hp : PPAnsiChar;
   hs : string;
   hs : string;
   eqpos : longint;
   eqpos : longint;
 begin
 begin
@@ -685,7 +685,7 @@ end;
 
 
 Function GetEnvironmentVariableCount : Integer;
 Function GetEnvironmentVariableCount : Integer;
 var
 var
-  p: ppchar;
+  p: PPAnsiChar;
 begin
 begin
   result:=0;
   result:=0;
   p:=envp;      {defined in system}
   p:=envp;      {defined in system}
@@ -700,7 +700,7 @@ end;
 Function GetEnvironmentString(Index : Integer) : {$ifdef FPC_RTL_UNICODE}UnicodeString{$else}AnsiString{$endif};
 Function GetEnvironmentString(Index : Integer) : {$ifdef FPC_RTL_UNICODE}UnicodeString{$else}AnsiString{$endif};
 Var
 Var
   i : longint;
   i : longint;
-  p : ppchar;
+  p : PPAnsiChar;
 begin
 begin
   if (Index <= 0) or (envp=nil) then
   if (Index <= 0) or (envp=nil) then
     result:=''
     result:=''

+ 13 - 13
rtl/wasi/wasiinc/wasiprocs.inc

@@ -170,14 +170,14 @@ function __wasi_fd_write(
 
 
 function __wasi_path_create_directory(
 function __wasi_path_create_directory(
   fd: __wasi_fd_t;
   fd: __wasi_fd_t;
-  const path: PChar;
+  const path: PAnsiChar;
   path_len: size_t
   path_len: size_t
 ): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_create_directory';
 ): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_create_directory';
 
 
 function __wasi_path_filestat_get(
 function __wasi_path_filestat_get(
   fd: __wasi_fd_t;
   fd: __wasi_fd_t;
   flags: __wasi_lookupflags_t;
   flags: __wasi_lookupflags_t;
-  const path: PChar;
+  const path: PAnsiChar;
   path_len: size_t;
   path_len: size_t;
   buf: P__wasi_filestat_t
   buf: P__wasi_filestat_t
 ): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_filestat_get';
 ): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_filestat_get';
@@ -185,7 +185,7 @@ function __wasi_path_filestat_get(
 function __wasi_path_filestat_set_times(
 function __wasi_path_filestat_set_times(
   fd: __wasi_fd_t;
   fd: __wasi_fd_t;
   flags: __wasi_lookupflags_t;
   flags: __wasi_lookupflags_t;
-  const path: PChar;
+  const path: PAnsiChar;
   path_len: size_t;
   path_len: size_t;
   atim: __wasi_timestamp_t;
   atim: __wasi_timestamp_t;
   mtim: __wasi_timestamp_t;
   mtim: __wasi_timestamp_t;
@@ -195,17 +195,17 @@ function __wasi_path_filestat_set_times(
 function __wasi_path_link(
 function __wasi_path_link(
   old_fd: __wasi_fd_t;
   old_fd: __wasi_fd_t;
   old_flags: __wasi_lookupflags_t;
   old_flags: __wasi_lookupflags_t;
-  const old_path: PChar;
+  const old_path: PAnsiChar;
   old_path_len: size_t;
   old_path_len: size_t;
   new_fd: __wasi_fd_t;
   new_fd: __wasi_fd_t;
-  const new_path: PChar;
+  const new_path: PAnsiChar;
   new_path_len: size_t
   new_path_len: size_t
 ): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_link';
 ): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_link';
 
 
 function __wasi_path_open(
 function __wasi_path_open(
   fd: __wasi_fd_t;
   fd: __wasi_fd_t;
   dirflags: __wasi_lookupflags_t;
   dirflags: __wasi_lookupflags_t;
-  const path: PChar;
+  const path: PAnsiChar;
   path_len: size_t;
   path_len: size_t;
   oflags: __wasi_oflags_t;
   oflags: __wasi_oflags_t;
   fs_rights_base: __wasi_rights_t;
   fs_rights_base: __wasi_rights_t;
@@ -216,7 +216,7 @@ function __wasi_path_open(
 
 
 function __wasi_path_readlink(
 function __wasi_path_readlink(
   fd: __wasi_fd_t;
   fd: __wasi_fd_t;
-  const path: PChar;
+  const path: PAnsiChar;
   path_len: size_t;
   path_len: size_t;
   buf: PUInt8;
   buf: PUInt8;
   buf_len: __wasi_size_t;
   buf_len: __wasi_size_t;
@@ -225,30 +225,30 @@ function __wasi_path_readlink(
 
 
 function __wasi_path_remove_directory(
 function __wasi_path_remove_directory(
   fd: __wasi_fd_t;
   fd: __wasi_fd_t;
-  const path: PChar;
+  const path: PAnsiChar;
   path_len: size_t
   path_len: size_t
 ): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_remove_directory';
 ): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_remove_directory';
 
 
 function __wasi_path_rename(
 function __wasi_path_rename(
   fd: __wasi_fd_t;
   fd: __wasi_fd_t;
-  const old_path: PChar;
+  const old_path: PAnsiChar;
   old_path_len: size_t;
   old_path_len: size_t;
   new_fd: __wasi_fd_t;
   new_fd: __wasi_fd_t;
-  const new_path: PChar;
+  const new_path: PAnsiChar;
   new_path_len: size_t
   new_path_len: size_t
 ): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_rename';
 ): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_rename';
 
 
 function __wasi_path_symlink(
 function __wasi_path_symlink(
-  const old_path: PChar;
+  const old_path: PAnsiChar;
   old_path_len: size_t;
   old_path_len: size_t;
   fd: __wasi_fd_t;
   fd: __wasi_fd_t;
-  const new_path: PChar;
+  const new_path: PAnsiChar;
   new_path_len: size_t
   new_path_len: size_t
 ): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_symlink';
 ): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_symlink';
 
 
 function __wasi_path_unlink_file(
 function __wasi_path_unlink_file(
   fd: __wasi_fd_t;
   fd: __wasi_fd_t;
-  const path: PChar;
+  const path: PAnsiChar;
   path_len: size_t
   path_len: size_t
 ): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_unlink_file';
 ): __wasi_errno_t; external 'wasi_snapshot_preview1' name 'path_unlink_file';
 
 

+ 3 - 3
rtl/wasi/wasiutil.pp

@@ -39,7 +39,7 @@ type
   End;
   End;
 
 
 function ConvertToFdRelativePath(path: RawByteString; out fd: LongInt; out relfd_path: RawByteString): Word; external name 'FPC_WASI_CONVERTTOFDRELATIVEPATH';
 function ConvertToFdRelativePath(path: RawByteString; out fd: LongInt; out relfd_path: RawByteString): Word; external name 'FPC_WASI_CONVERTTOFDRELATIVEPATH';
-function fpc_wasi_path_readlink_ansistring(fd: __wasi_fd_t; const path: PChar; path_len: size_t; out link: rawbytestring): __wasi_errno_t; external name 'FPC_WASI_PATH_READLINK_ANSISTRING';
+function fpc_wasi_path_readlink_ansistring(fd: __wasi_fd_t; const path: PAnsiChar; path_len: size_t; out link: rawbytestring): __wasi_errno_t; external name 'FPC_WASI_PATH_READLINK_ANSISTRING';
 function FNMatch(const Pattern,Name:rawbytestring):Boolean;
 function FNMatch(const Pattern,Name:rawbytestring):Boolean;
 function WasiFindFirst(const Path: RawByteString; Attr: Word; var f: TWasiSearchRec): longint;
 function WasiFindFirst(const Path: RawByteString; Attr: Word; var f: TWasiSearchRec): longint;
 function WasiFindNext(var f: TWasiSearchRec): longint;
 function WasiFindNext(var f: TWasiSearchRec): longint;
@@ -198,7 +198,7 @@ begin
   if ConvertToFdRelativePath(s,fd,pr)<>0 then
   if ConvertToFdRelativePath(s,fd,pr)<>0 then
     exit;
     exit;
   { todo: __WASI_LOOKUPFLAGS_SYMLINK_FOLLOW??? }
   { todo: __WASI_LOOKUPFLAGS_SYMLINK_FOLLOW??? }
-  if __wasi_path_filestat_get(fd,0,PChar(pr),Length(pr),@st)<>__WASI_ERRNO_SUCCESS then
+  if __wasi_path_filestat_get(fd,0,PAnsiChar(pr),Length(pr),@st)<>__WASI_ERRNO_SUCCESS then
     exit;
     exit;
   info.FSize:=st.size;
   info.FSize:=st.size;
   info.FMTime:=st.mtim;
   info.FMTime:=st.mtim;
@@ -290,7 +290,7 @@ Begin
            repeat
            repeat
              res:=__wasi_path_open(fd,
              res:=__wasi_path_open(fd,
                                    0,
                                    0,
-                                   PChar(pr),
+                                   PAnsiChar(pr),
                                    length(pr),
                                    length(pr),
                                    __WASI_OFLAGS_DIRECTORY,
                                    __WASI_OFLAGS_DIRECTORY,
                                    __WASI_RIGHTS_FD_READDIR,
                                    __WASI_RIGHTS_FD_READDIR,