Kaynağa Gözat

* Char -> AnsiChar

Michael VAN CANNEYT 2 yıl önce
ebeveyn
işleme
304372262a

+ 14 - 14
rtl/netwlibc/dos.pp

@@ -155,7 +155,7 @@ const maxargs=256;
 procedure exec(const path : pathstr;const comline : comstr);
 var c : comstr;
     i : integer;
-    args : array[0..maxargs] of pchar;
+    args : array[0..maxargs] of PAnsiChar;
     arg0 : pathstr;
     numargs,wstat : integer;
     Wiring : TWiring;
@@ -189,13 +189,13 @@ begin
   //writeln (stderr,'calling procve');
   i := procve(args[0],
               PROC_CURRENT_SPACE+PROC_INHERIT_CWD,
-              envP,         // const char * env[] If passed as NULL, the child process inherits the parent.s environment at the time of the call.
+              envP,         // const AnsiChar * env[] If passed as NULL, the child process inherits the parent.s environment at the time of the call.
               @Wiring,      // wiring_t *wiring, Pass NULL to inherit system defaults for wiring.
               nil,          // struct fd_set *fds, Not currently implemented. Pass in NULL.
               nil,          // void *appdata, Not currently implemented. Pass in NULL.
               0,            // size_t appdata_size, Not currently implemented. Pass in 0
               nil,          // void *reserved, Reserved. Pass NULL.
-              @args);       // const char *argv[]
+              @args);       // const AnsiChar *argv[]
   //writeln (stderr,'Ok');
   if i <> -1 then
   begin
@@ -243,7 +243,7 @@ end;
 
 
 function diskfree(drive : byte) : int64;
-{VAR Buf                 : ARRAY [0..255] OF CHAR;
+{VAR Buf                 : ARRAY [0..255] OF AnsiChar;
     TotalBlocks         : WORD;
     SectorsPerBlock     : WORD;
     availableBlocks     : WORD;
@@ -274,7 +274,7 @@ end;
 
 
 function disksize(drive : byte) : int64;
-{VAR Buf                 : ARRAY [0..255] OF CHAR;
+{VAR Buf                 : ARRAY [0..255] OF AnsiChar;
     TotalBlocks         : WORD;
     SectorsPerBlock     : WORD;
     availableBlocks     : WORD;
@@ -370,7 +370,7 @@ end;
 
 procedure findfirst(const path : pathstr;attr : word;var f : searchRec);
 var
-  path0 : array[0..256] of char;
+  path0 : array[0..256] of AnsiChar;
   p     : longint;
 begin
   IF path = '' then
@@ -559,14 +559,14 @@ var
 {$ifndef FPC_ANSI_TEXTFILEREC}
   r: rawbytestring;
 {$endif not FPC_ANSI_TEXTFILEREC}
-  p: pchar;
+  p: PAnsiChar;
 begin
   doserror := 0;
 {$ifdef FPC_ANSI_TEXTFILEREC}
   p := @filerec(f).name;
 {$else FPC_ANSI_TEXTFILEREC}
   r := ToSingleByteFileSystemEncodedFileName(filerec(f).name);
-  p := pchar(r);
+  p := PAnsiChar(r);
 {$endif FPC_ANSI_TEXTFILEREC}
   if Fpstat (p, StatBuf) = 0 then
     attr := nwattr2dosattr (StatBuf.st_mode)
@@ -585,13 +585,13 @@ var
 {$ifndef FPC_ANSI_TEXTFILEREC}
   r: rawbytestring;
 {$endif not FPC_ANSI_TEXTFILEREC}
-  p: pchar;
+  p: PAnsiChar;
 begin
 {$ifdef FPC_ANSI_TEXTFILEREC}
   p := @filerec(f).name;
 {$else FPC_ANSI_TEXTFILEREC}
   r := ToSingleByteFileSystemEncodedFileName(filerec(f).name);
-  p := pchar(r);
+  p := PAnsiChar(r);
 {$endif FPC_ANSI_TEXTFILEREC}
   if Fpstat (p,StatBuf) = 0 then
   begin
@@ -620,7 +620,7 @@ end;
 Function EnvCount: Longint;
 var
   envcnt : longint;
-  p      : ppchar;
+  p      : PPAnsiChar;
 Begin
   envcnt:=0;
   p:=envp;      {defined in system}
@@ -636,7 +636,7 @@ End;
 Function EnvStr (Index: longint): String;
 Var
   i : longint;
-  p : ppchar;
+  p : PPAnsiChar;
 Begin
   if Index <= 0 then
     envstr:=''
@@ -659,8 +659,8 @@ end;
 
 { works fine (at least with netware 6.5) }
 Function  GetEnv(envvar: string): string;
-var envvar0 : array[0..512] of char;
-    p       : pchar;
+var envvar0 : array[0..512] of AnsiChar;
+    p       : PAnsiChar;
     SearchElement : string[255];
     i,isDosPath,res : longint;
 begin

+ 1 - 1
rtl/netwlibc/dynlibs.inc

@@ -30,7 +30,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;

Dosya farkı çok büyük olduğundan ihmal edildi
+ 294 - 294
rtl/netwlibc/libc.pp


+ 3 - 3
rtl/netwlibc/sysdir.inc

@@ -20,7 +20,7 @@
 Procedure do_MkDir(const s: rawbytestring);
 var Res: LONGINT;
 BEGIN
-  Res := FpMkdir (pchar(s),S_IRWXU);
+  Res := FpMkdir (PAnsiChar(s),S_IRWXU);
   if Res = 0 then
     InOutRes:=0
   else
@@ -30,7 +30,7 @@ end;
 procedure do_RmDir(const s: rawbytestring);
 var Res: longint;
 begin
-  Res := FpRmdir (pchar(s));
+  Res := FpRmdir (PAnsiChar(s));
   if Res = 0 then
     InOutRes:=0
   else
@@ -50,7 +50,7 @@ end;
 
 
 procedure do_getdir(drivenr : byte;var dir : rawbytestring);
-var P : array [0..255] of CHAR;
+var P : array [0..255] of AnsiChar;
     i : LONGINT;
 begin
   P[0] := #0;

+ 4 - 4
rtl/netwlibc/sysfile.inc

@@ -84,7 +84,7 @@ begin
     InOutRes := 0;
 end;
 
-procedure do_erase(p : pchar; pchangeable: boolean);
+procedure do_erase(p : PAnsiChar; pchangeable: boolean);
 VAR res : LONGINT;
 begin
   res := unlink (p);
@@ -94,7 +94,7 @@ begin
     InOutRes := 0;
 end;
 
-procedure do_rename(p1,p2 : pchar; p1changeable, p2changeable: boolean);
+procedure do_rename(p1,p2 : PAnsiChar; p1changeable, p2changeable: boolean);
 VAR res : LONGINT;
 begin
   res := rename (p1,p2);
@@ -221,7 +221,7 @@ end;
 
 {$ifdef IOpossix}
 // mostly stolen from syslinux
-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.
@@ -306,7 +306,7 @@ end;
 
 
 {$else}
-procedure do_open(var f;p:pchar;flags:longint);
+procedure do_open(var f;p:PAnsiChar;flags:longint);
 {
   filerec and textrec have both handle and mode as the first items so
   they could use the same routine for opening/creating.

+ 16 - 16
rtl/netwlibc/system.pp

@@ -48,8 +48,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 separately below!!! }
  maxExitCode = $ffff;
  MaxPathLen = 256;
@@ -76,7 +76,7 @@ type
 
 VAR
    ArgC                : INTEGER;
-   ArgV                : ppchar;
+   ArgV                : PPAnsiChar;
    NetwareCheckFunction: TNWCheckFunction;
    NWLoggerScreen      : pointer = nil;
 
@@ -86,7 +86,7 @@ const
   Dll_Thread_Attach_Hook  : TDLL_Entry_Hook = nil;
   Dll_Thread_Detach_Hook  : TDLL_Entry_Hook = nil;
   NetwareUnloadProc       : pointer = nil;  {like exitProc but for nlm unload only}
-  envp : ppchar = nil;
+  envp : PPAnsiChar = nil;
 
 
 
@@ -101,11 +101,11 @@ procedure NWSysSetThreadFunctions (atv:TSysReleaseThreadVars;
 
 
 procedure _ConsolePrintf (s :shortstring);
-procedure _ConsolePrintf (FormatStr : PCHAR; Param : LONGINT);
-procedure _ConsolePrintf (FormatStr : PCHAR; Param : pchar);
-procedure _ConsolePrintf (FormatStr : PCHAR; P1,P2 : LONGINT);
-procedure _ConsolePrintf (FormatStr : PCHAR; P1,P2,P3 : LONGINT);
-procedure _ConsolePrintf (FormatStr : PCHAR);
+procedure _ConsolePrintf (FormatStr : PAnsiChar; Param : LONGINT);
+procedure _ConsolePrintf (FormatStr : PAnsiChar; Param : PAnsiChar);
+procedure _ConsolePrintf (FormatStr : PAnsiChar; P1,P2 : LONGINT);
+procedure _ConsolePrintf (FormatStr : PAnsiChar; P1,P2,P3 : LONGINT);
+procedure _ConsolePrintf (FormatStr : PAnsiChar);
 procedure __EnterDebugger;cdecl;external '!netware' name 'EnterDebugger';
 
 function NWGetCodeStart : pointer;  // needed for Lineinfo
@@ -255,7 +255,7 @@ begin
   _ConsolePrintf (@s[1]);
 end;
 
-procedure _ConsolePrintf (FormatStr : PCHAR);
+procedure _ConsolePrintf (FormatStr : PAnsiChar);
 begin
   if NWLoggerScreen = nil then
     NWLoggerScreen := getnetwarelogger;
@@ -263,7 +263,7 @@ begin
     screenprintf (NWLoggerScreen,FormatStr);
 end;
 
-procedure _ConsolePrintf (FormatStr : PCHAR; Param : LONGINT);
+procedure _ConsolePrintf (FormatStr : PAnsiChar; Param : LONGINT);
 begin
   if NWLoggerScreen = nil then
     NWLoggerScreen := getnetwarelogger;
@@ -271,12 +271,12 @@ begin
     screenprintf (NWLoggerScreen,FormatStr,Param);
 end;
 
-procedure _ConsolePrintf (FormatStr : PCHAR; Param : pchar);
+procedure _ConsolePrintf (FormatStr : PAnsiChar; Param : PAnsiChar);
 begin
   _ConsolePrintf (FormatStr,longint(Param));
 end;
 
-procedure _ConsolePrintf (FormatStr : PCHAR; P1,P2 : LONGINT);
+procedure _ConsolePrintf (FormatStr : PAnsiChar; P1,P2 : LONGINT);
 begin
   if NWLoggerScreen = nil then
     NWLoggerScreen := getnetwarelogger;
@@ -284,7 +284,7 @@ begin
     screenprintf (NWLoggerScreen,FormatStr,P1,P2);
 end;
 
-procedure _ConsolePrintf (FormatStr : PCHAR; P1,P2,P3 : LONGINT);
+procedure _ConsolePrintf (FormatStr : PAnsiChar; P1,P2,P3 : LONGINT);
 begin
   if NWLoggerScreen = nil then
     NWLoggerScreen := getnetwarelogger;
@@ -326,7 +326,7 @@ end;
 
 
 {$ifdef StdErrToConsole}
-var ConsoleBuff : array [0..512] of char;
+var ConsoleBuff : array [0..512] of AnsiChar;
 
 Function ConsoleWrite(Var F: TextRec): Integer;
 var
@@ -447,7 +447,7 @@ begin
 end;
 
 // this is called by main.as, setup args and call PASCALMAIN
-procedure nlm_main (_ArgC : LONGINT; _ArgV : ppchar); cdecl; [public,alias: '_FPC_NLM_Entry'];
+procedure nlm_main (_ArgC : LONGINT; _ArgV : PPAnsiChar); cdecl; [public,alias: '_FPC_NLM_Entry'];
 BEGIN
   ArgC := _ArgC;
   ArgV := _ArgV;

+ 22 - 22
rtl/netwlibc/sysutils.pp

@@ -108,7 +108,7 @@ begin
     1 : NWOpenFlags:=NWOpenFlags or O_WRONLY;
     2 : NWOpenFlags:=NWOpenFlags or O_RDWR;
   end;
-  FileOpen := Fpopen (pchar(SystemFileName),NWOpenFlags);
+  FileOpen := Fpopen (PAnsiChar(SystemFileName),NWOpenFlags);
 
   //!! We need to set locking based on Mode !!
 end;
@@ -118,7 +118,7 @@ Function FileCreate (Const FileName : RawByteString) : THandle;
 var SystemFileName: RawByteString;
 begin
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
-  FileCreate:=Fpopen(Pchar(SystemFileName),O_RdWr or O_Creat or O_Trunc or O_Binary);
+  FileCreate:=Fpopen(PAnsiChar(SystemFileName),O_RdWr or O_Creat or O_Trunc or O_Binary);
   if FileCreate >= 0 then
     FileSetAttr (Filename, 0);  // dont know why but open always sets ReadOnly flag
 end;
@@ -207,7 +207,7 @@ var Info : TStat;
     SystemFileName: RawByteString;
 begin
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
-  If Fpstat (pchar(SystemFileName),Info) <> 0 then
+  If Fpstat (PAnsiChar(SystemFileName),Info) <> 0 then
     exit(-1)
   else
     begin
@@ -229,7 +229,7 @@ VAR Info : TStat;
     SystemFileName: RawByteString;
 begin
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
-  FileExists:=(Fpstat(pchar(SystemFileName),Info) = 0);
+  FileExists:=(Fpstat(PAnsiChar(SystemFileName),Info) = 0);
 end;
 
 
@@ -258,7 +258,7 @@ begin
       name := Pdirent(FindData.EntryP)^.d_name;
       SetCodePage(name, DefaultFileSystemCodePage, False);
       fname := FindData._dir + name;
-      if Fpstat (pchar(fname),StatBuf) = 0 then
+      if Fpstat (PAnsiChar(fname),StatBuf) = 0 then
         time := UnixToWinAge (StatBuf.st_mtim.tv_sec)
       else
         time := 0;
@@ -309,7 +309,7 @@ begin
   if Rslt.FindData._mask = '*' then Rslt.FindData._mask := '';
   if Rslt.FindData._mask = '*.*' then Rslt.FindData._mask := '';
   //writeln (stderr,'mask: "',Rslt._mask,'" dir:"',path0,'"');
-  Pdirent(Rslt.FindData.DirP) := opendir (pchar(Rslt.FindData._dir));
+  Pdirent(Rslt.FindData.DirP) := opendir (PAnsiChar(Rslt.FindData._dir));
   if Rslt.FindData.DirP = nil then
     result := 18
   else begin
@@ -384,7 +384,7 @@ Var Info : TStat;
     SystemFileName: RawByteString;
 begin
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
-  If Fpstat (pchar(SystemFileName),Info) <> 0 then
+  If Fpstat (PAnsiChar(SystemFileName),Info) <> 0 then
     Result:=-1
   Else
     Result := (Info.st_mode shr 16) and $ffff;
@@ -398,7 +398,7 @@ var
   SystemFileName: RawByteString;
 begin
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
-  if Fpstat (pchar(SystemFilename),StatBuf) = 0 then
+  if Fpstat (PAnsiChar(SystemFilename),StatBuf) = 0 then
   begin
     {what should i do here ?
      only support sysutils-standard attributes or also support the extensions defined
@@ -414,7 +414,7 @@ begin
       newmode := StatBuf.st_mode and ($ffff0000-M_A_RDONLY-M_A_HIDDEN- M_A_SYSTEM-M_A_SUBDIR-M_A_ARCH);
       newmode := newmode or (attr shl 16) or M_A_BITS_SIGNIFICANT;
     end;
-    if Fpchmod (pchar(SystemFilename),newMode) < 0 then
+    if Fpchmod (PAnsiChar(SystemFilename),newMode) < 0 then
       result := ___errno^ else
       result := 0;
   end else
@@ -427,7 +427,7 @@ var
   SystemFileName: RawByteString;
 begin
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(FileName);
-  Result:= (libc.UnLink (pchar(SystemFileName)) = 0);
+  Result:= (libc.UnLink (PAnsiChar(SystemFileName)) = 0);
 end;
 
 
@@ -437,7 +437,7 @@ var
 begin
   OldSystemFileName:=ToSingleByteFileSystemEncodedFileName(OldName);
   NewSystemFileName:=ToSingleByteFileSystemEncodedFileName(NewName);
-  RenameFile:=(libc.rename(pchar(OldSystemFileName),pchar(NewSystemFileName)) = 0);
+  RenameFile:=(libc.rename(PAnsiChar(OldSystemFileName),PAnsiChar(NewSystemFileName)) = 0);
 end;
 
 
@@ -458,7 +458,7 @@ end;
   They both return -1 when a failure occurs.
 }
 Const
-  FixDriveStr : array[0..3] of pchar=(
+  FixDriveStr : array[0..3] of PAnsiChar=(
     '.',
     'a:.',
     'b:.',
@@ -466,7 +466,7 @@ Const
     );
 var
   Drives   : byte;
-  DriveStr : array[4..26] of pchar;
+  DriveStr : array[4..26] of PAnsiChar;
 
 Procedure AddDisk(const path:string);
 begin
@@ -515,7 +515,7 @@ var
   SystemFileName: RawByteString;
 begin
   SystemFileName:=ToSingleByteFileSystemEncodedFileName(Directory);
-  If Fpstat (pchar(SystemFileName),Info) <> 0 then
+  If Fpstat (PAnsiChar(SystemFileName),Info) <> 0 then
     exit(false)
   else
     Exit ((Info.st_mode and M_A_SUBDIR) <> 0);
@@ -596,7 +596,7 @@ end;
 Function GetEnvironmentVariable(Const EnvVar : String) : String;
 
 begin
-  Result:=libc.getenv(PChar(EnvVar));
+  Result:=libc.getenv(PAnsiChar(EnvVar));
 end;
 
 Function GetEnvironmentVariableCount : Integer;
@@ -616,12 +616,12 @@ function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString;Flags:
 var
   params:array of AnsiString;
   count,i: longint;
-  Buf  : pchar;
-  p    : pchar;
+  Buf  : PAnsiChar;
+  p    : PAnsiChar;
   CLine: AnsiString;
 begin
   cLine := ComLine;
-  buf:=pchar(CLine);
+  buf:=PAnsiChar(CLine);
   count:=0;
   while(buf^<>#0) do
   begin
@@ -633,7 +633,7 @@ begin
   end;
   i := 0;
   setlength(params,count);
-  buf:=pchar(CLine);
+  buf:=PAnsiChar(CLine);
   while(buf^<>#0) do
   begin
     while (buf^ in [' ',#9,#10]) do
@@ -668,7 +668,7 @@ function ExecuteProcess (const Path: AnsiString;
                                   const ComLine: array of AnsiString;Flags:TExecuteFlags=[]): integer;
 var c : comstr;
     i : integer;
-    args : array[0..maxargs+1] of pchar;
+    args : array[0..maxargs+1] of PAnsiChar;
     arg0 : string;
     numargs,wstat : integer;
     Wiring : TWiring;
@@ -679,13 +679,13 @@ begin
     arg0 := fexpand(path+'.nlm')
   else
     arg0 := fexpand (path);
-  args[0] := pchar(arg0);
+  args[0] := PAnsiChar(arg0);
   numargs := 0;
   for I := 0 to High (ComLine) do
     if numargs < maxargs then
     begin
       inc(numargs);
-      args[numargs] := pchar(ComLine[i]);
+      args[numargs] := PAnsiChar(ComLine[i]);
     end;
   args[numargs+1] := nil;
   Wiring.infd := StdInputHandle;  //textrec(Stdin).Handle;

+ 3 - 3
rtl/netwlibc/tthread.inc

@@ -89,7 +89,7 @@ begin
 end;
 
 procedure SemaphorePost(const FSem: Pointer);
-var c : char;
+var c : AnsiChar;
 begin
   c := #0;
   fpwrite(PFilDes(FSem)^[1], c, 1);
@@ -206,7 +206,7 @@ end;
 function ThreadFunc(parameter: Pointer): LongInt;
 var
   LThread: TThread;
-  c: char;
+  c: AnsiChar;
 begin
   WRITE_DEBUG('ThreadFunc is here...'#13#10);
   LThread := TThread(parameter);
@@ -237,7 +237,7 @@ begin
     end;
   except
     on e: exception do begin
-      WRITE_DEBUG('got exception: %s'#13#10,pchar(e.message));
+      WRITE_DEBUG('got exception: %s'#13#10,PAnsiChar(e.message));
       LThread.FFatalException :=  TObject(AcquireExceptionObject);
       // not sure if we should really do this...
       // but .Destroy was called, so why not try FreeOnTerminate?

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor