Forráskód Böngészése

* Char -> AnsiChar

Michael VAN CANNEYT 2 éve
szülő
commit
bcb2aa1323

+ 2 - 2
rtl/amicommon/athreads.pp

@@ -458,7 +458,7 @@ begin
       { this line can't be before threadvar allocation }
       SysDebugLn('FPC AThreads: Renaming thread ID:'+hexStr(threadInfo)+' to '+threadInfo^.name);
 {$endif}
-      thisThread^.pr_Task.tc_Node.ln_Name:=PChar(@threadInfo^.name[1]);
+      thisThread^.pr_Task.tc_Node.ln_Name:=PAnsiChar(@threadInfo^.name[1]);
     end;
 
   { Reply the message, so the calling thread could continue }
@@ -995,7 +995,7 @@ begin
   end;
 end;
 
-function CreatePort(Name: PChar; Pri: LongInt): PMsgPort;
+function CreatePort(Name: PAnsiChar; Pri: LongInt): PMsgPort;
 var
   SigBit: ShortInt;
   Port: PMsgPort;

+ 22 - 22
rtl/amicommon/dos.pp

@@ -110,7 +110,7 @@ function PathConv(path: string): string; external name 'PATHCONV';
 function dosLock(const name: String;
                  accessmode: Longint) : BPTR;
 var
- buffer: array[0..255] of Char;
+ buffer: array[0..255] of AnsiChar;
 begin
   move(name[1],buffer,length(name));
   buffer[length(name)]:=#0;
@@ -126,21 +126,21 @@ begin
   {$endif}
 end;
 
-function BSTR2STRING(s : Pointer): PChar; Inline;
+function BSTR2STRING(s : Pointer): PAnsiChar; Inline;
 begin
   {$if defined(AROS)}  // deactivated for now //and (not defined(AROS_BINCOMPAT))}
-  BSTR2STRING:=PChar(s);
+  BSTR2STRING:=PAnsiChar(s);
   {$else}
-  BSTR2STRING:=PChar(BADDR(PtrInt(s)))+1;
+  BSTR2STRING:=PAnsiChar(BADDR(PtrInt(s)))+1;
   {$endif}
 end;
 
-function BSTR2STRING(s : PtrInt): PChar; Inline;
+function BSTR2STRING(s : PtrInt): PAnsiChar; Inline;
 begin
   {$if defined(AROS)}  // deactivated for now //and (not defined(AROS_BINCOMPAT))}
-  BSTR2STRING:=PChar(s);
+  BSTR2STRING:=PAnsiChar(s);
   {$else}
-  BSTR2STRING:=PChar(BADDR(s))+1;
+  BSTR2STRING:=PAnsiChar(BADDR(s))+1;
   {$endif}
 end;
 
@@ -231,7 +231,7 @@ end;
 
 function dosSetProtection(const name: string; mask:longint): Boolean;
 var
-  buffer : array[0..255] of Char;
+  buffer : array[0..255] of AnsiChar;
 begin
   move(name[1],buffer,length(name));
   buffer[length(name)]:=#0;
@@ -240,7 +240,7 @@ end;
 
 function dosSetFileDate(const name: string; p : PDateStamp): Boolean;
 var
-  buffer : array[0..255] of Char;
+  buffer : array[0..255] of AnsiChar;
 begin
   move(name[1],buffer,length(name));
   buffer[length(name)]:=#0;
@@ -303,7 +303,7 @@ begin
     end
 end;
 
-function Createport(name : PChar; pri : longint): pMsgPort;
+function Createport(name : PAnsiChar; pri : longint): pMsgPort;
 var
    sigbit : ShortInt;
    port    : pMsgPort;
@@ -497,7 +497,7 @@ end;
 
 procedure Exec(const Path: PathStr; const ComLine: ComStr);
 var
-  tmpPath: array[0..515] of char;
+  tmpPath: array[0..515] of AnsiChar;
   result : longint;
   tmpLock: BPTR;
 begin
@@ -628,7 +628,7 @@ end;
 function RefreshDeviceList: Integer;
 var
   List: PDosList;
-  Temp: PChar;
+  Temp: PAnsiChar;
   Str: string;
 begin
   NumDevices := 0;
@@ -665,7 +665,7 @@ begin
   //
   OldWinPtr:=SetProcessWinPtr(PROC_WIN_DISABLE);
   //
-  DirLock := Lock(PChar(Drive), SHARED_LOCK);
+  DirLock := Lock(PAnsiChar(Drive), SHARED_LOCK);
   if DirLock <> 0 then
   begin
     if Info(DirLock, @Inf) <> 0 then
@@ -695,7 +695,7 @@ begin
   //
   OldWinPtr:=SetProcessWinPtr(PROC_WIN_DISABLE);
   //
-  DirLock := Lock(PChar(Drive), SHARED_LOCK);
+  DirLock := Lock(PAnsiChar(Drive), SHARED_LOCK);
   if DirLock <> 0 then
   begin
     if Info(DirLock, @Inf) <> 0 then
@@ -771,7 +771,7 @@ end;
 
 procedure FindFirst(const Path: PathStr; Attr: Word; Var f: SearchRec);
 var
- tmpStr: array[0..255] of Char;
+ tmpStr: array[0..255] of AnsiChar;
  Anchor: PAnchorPath;
 begin
   tmpStr:=PathConv(path)+#0;
@@ -980,13 +980,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}
   r := ToSingleByteFileSystemEncodedFileName(filerec(f).Name);
-  p := pchar(r);
+  p := PAnsiChar(r);
 {$endif}
   DosError:=0;
   flags:=FIBF_WRITE;
@@ -1015,7 +1015,7 @@ end;
 var
   strofpaths : string;
 
-function SystemTags(const command: PChar; const tags: array of PtrUInt): LongInt;
+function SystemTags(const command: PAnsiChar; const tags: array of PtrUInt): LongInt;
 begin
   SystemTags:=SystemTagList(command,@tags);
 end;
@@ -1074,7 +1074,7 @@ Var
   ThisProcess: PProcess;
   LocalVars_List: PMinList;  // Local Var structure in struct process (pr_LocalVarsis is actually a minlist
   LocalVar_Node: PLocalVar;
-  Buffer: array[0..BUFFER_SIZE] of Char; // Buffer to hold a value for GetVar()
+  Buffer: array[0..BUFFER_SIZE] of AnsiChar; // Buffer to hold a value for GetVar()
   TempLen: LongInt;      // hold returnlength of GetVar()
   // for env: searching
   Anchor: TAnchorPath;
@@ -1107,7 +1107,7 @@ begin
       begin
         SetLength(EnvList, Length(EnvList) + 1);
         EnvList[High(EnvList)].Name := LocalVar_Node^.lv_Node.ln_Name;
-        EnvList[High(EnvList)].Value := string(PChar(@Buffer[0]));
+        EnvList[High(EnvList)].Value := string(PAnsiChar(@Buffer[0]));
         EnvList[High(EnvList)].Local := True;
       end;
     end;
@@ -1147,8 +1147,8 @@ end;
 
 function GetEnvFromEnv(envvar : String): String;
 var
-   bufarr : array[0..255] of char;
-   strbuffer : array[0..255] of char;
+   bufarr : array[0..255] of AnsiChar;
+   strbuffer : array[0..255] of AnsiChar;
    temp : Longint;
 begin
    GetEnvFromEnv := '';

+ 4 - 4
rtl/amicommon/paramhandling.inc

@@ -31,7 +31,7 @@ function GetWBArg(Idx: Integer): string;
 var
   startup: PWBStartup;
   wbarg: PWBArgList;
-  Path: array[0..254] of Char;
+  Path: array[0..254] of AnsiChar;
   strPath: string;
   Len: Integer;
 begin
@@ -84,7 +84,7 @@ var
   Ende: Word;
   LocalIndex: Word;
   i: Integer;
-  P : PChar;
+  P : PAnsiChar;
   Temp : AnsiString;
   InQuotes: boolean;
 begin
@@ -177,7 +177,7 @@ begin
       Counter := 1;
       while (s1[Counter] <> #0) and (Counter <> 0) do
         Inc(Counter);
-      s1[0] := char(Counter - 1);
+      s1[0] := AnsiChar(Counter - 1);
       GetProgDir := s1;
     end;
   end;
@@ -197,7 +197,7 @@ begin
     Counter := 1;
     while (s1[Counter] <> #0) and (Counter <> 0) do
       Inc(Counter);
-    s1[0] := char(Counter - 1);
+    s1[0] := AnsiChar(Counter - 1);
 
     { now remove any component path which should not be there }
     for Counter := Length(s1) downto 1 do

+ 4 - 4
rtl/amicommon/sysdir.inc

@@ -24,7 +24,7 @@ var
 begin
   checkCTRLC;
   tmpStr:=PathConv(s);
-  tmpLock:=dosCreateDir(pchar(tmpStr));
+  tmpLock:=dosCreateDir(PAnsiChar(tmpStr));
   if tmpLock=0 then begin
     dosError2InOut(IoErr);
     exit;
@@ -43,7 +43,7 @@ begin
       exit;
     end;
   tmpStr:=PathConv(s);
-  if not dosDeleteFile(pchar(tmpStr)) then
+  if not dosDeleteFile(PAnsiChar(tmpStr)) then
     dosError2InOut(IoErr);
 end;
 
@@ -60,7 +60,7 @@ begin
   { Changing the directory is a pretty complicated affair }
   {   1) Obtain a lock on the directory                   }
   {   2) CurrentDir the lock                              }
-  tmpLock:=Lock(pchar(tmpStr),SHARED_LOCK);
+  tmpLock:=Lock(PAnsiChar(tmpStr),SHARED_LOCK);
   if tmpLock=0 then begin
     dosError2InOut(IoErr);
     exit;
@@ -85,7 +85,7 @@ end;
 
 procedure do_GetDir (DriveNr: byte; var Dir: RawByteString);
 var
-  tmpbuf: array[0..255] of char;
+  tmpbuf: array[0..255] of AnsiChar;
   lockDir: BPTR;
 begin
   checkCTRLC;

+ 7 - 7
rtl/amicommon/sysfile.inc

@@ -181,9 +181,9 @@ begin
   end;
 end;
 
-procedure do_erase(p : pchar; pchangeable: boolean);
+procedure do_erase(p : PAnsiChar; pchangeable: boolean);
 var
-  tmpStr: array[0..255] of Char;
+  tmpStr: array[0..255] of AnsiChar;
 begin
   tmpStr:=PathConv(strpas(p))+#0;
   checkCTRLC;
@@ -191,11 +191,11 @@ begin
     dosError2InOut(IoErr);
 end;
 
-procedure do_rename(p1,p2 : pchar; p1changeable, p2changeable: boolean);
+procedure do_rename(p1,p2 : PAnsiChar; p1changeable, p2changeable: boolean);
 { quite stack-effective code, huh? :) damn path conversions... (KB) }
 var
-  tmpStr1: array[0..255] of Char;
-  tmpStr2: array[0..255] of Char;
+  tmpStr1: array[0..255] of AnsiChar;
+  tmpStr2: array[0..255] of AnsiChar;
 begin
   tmpStr1:=PathConv(strpas(p1))+#0;
   tmpStr2:=PathConv(strpas(p2))+#0;
@@ -351,7 +351,7 @@ begin
 {$ENDIF}
 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.
@@ -362,7 +362,7 @@ procedure do_open(var f;p:pchar;flags:longint; pchangeable: boolean);
 var
   handle   : THandle;
   openflags: LongInt;
-  tmpStr   : array[0..255] of Char;
+  tmpStr   : array[0..255] of AnsiChar;
 begin
   tmpStr:=PathConv(strpas(p))+#0;
 

+ 22 - 22
rtl/amicommon/sysutils.pp

@@ -105,21 +105,21 @@ begin
   {$endif}
 end;
 
-function BSTR2STRING(s : Pointer): PChar; Inline;
+function BSTR2STRING(s : Pointer): PAnsiChar; Inline;
 begin
   {$if defined(AROS)}  // deactivated for now //and (not defined(AROS_BINCOMPAT))}
-  BSTR2STRING:=PChar(s);
+  BSTR2STRING:=PAnsiChar(s);
   {$else}
-  BSTR2STRING:=PChar(BADDR(PtrInt(s)))+1;
+  BSTR2STRING:=PAnsiChar(BADDR(PtrInt(s)))+1;
   {$endif}
 end;
 
-function BSTR2STRING(s : BPTR): PChar; Inline;
+function BSTR2STRING(s : BPTR): PAnsiChar; Inline;
 begin
   {$if defined(AROS)}  // deactivated for now //and (not defined(AROS_BINCOMPAT))}
-  BSTR2STRING:=PChar(s);
+  BSTR2STRING:=PAnsiChar(s);
   {$else}
-  BSTR2STRING:=PChar(BADDR(s))+1;
+  BSTR2STRING:=PAnsiChar(BADDR(s))+1;
   {$endif}
 end;
 
@@ -180,7 +180,7 @@ var
 begin
   SystemFileName:=PathConv(ToSingleByteFileSystemEncodedFileName(FileName));
   {$WARNING FIX ME! To do: FileOpen Access Modes}
-  dosResult:=Open(PChar(SystemFileName),MODE_OLDFILE);
+  dosResult:=Open(PAnsiChar(SystemFileName),MODE_OLDFILE);
   if dosResult=0 then
     dosResult:=-1
   else
@@ -216,7 +216,7 @@ end;
 function FileSetDate(Handle: THandle; Age: Int64) : LongInt;
 var
   tmpDateStamp: TDateStamp;
-  tmpName: array[0..255] of char;
+  tmpName: array[0..255] of AnsiChar;
 begin
   result:=0;
   if (Handle <> 0) then begin
@@ -239,7 +239,7 @@ begin
   result:=0;
   SystemFileName:=PathConv(ToSingleByteFileSystemEncodedFileName(FileName));
   tmpDateStamp:=DateTimeToAmigaDateStamp(FileDateToDateTime(Age));
-  if not SetFileDate(PChar(SystemFileName),@tmpDateStamp) then begin
+  if not SetFileDate(PAnsiChar(SystemFileName),@tmpDateStamp) then begin
     IoErr(); // dump the error code for now (TODO)
     result:=-1;
   end;
@@ -257,7 +257,7 @@ begin
     opening it in MODE_NEWFILE, because that returns an exclusive lock
     so some operations might fail with it (KB) }
   SystemFileName:=PathConv(ToSingleByteFileSystemEncodedFileName(FileName));
-  dosResult:=Open(PChar(SystemFileName),MODE_READWRITE);
+  dosResult:=Open(PAnsiChar(SystemFileName),MODE_READWRITE);
   if dosResult = 0 then exit;
 
   if SetFileSize(dosResult, 0, OFFSET_BEGINNING) = 0 then
@@ -359,7 +359,7 @@ var
   SystemFileName: RawByteString;
 begin
   SystemFileName:=PathConv(ToSingleByteFileSystemEncodedFileName(FileName));
-  DeleteFile:=dosDeleteFile(PChar(SystemFileName));
+  DeleteFile:=dosDeleteFile(PAnsiChar(SystemFileName));
 end;
 
 
@@ -369,7 +369,7 @@ var
 begin
   OldSystemFileName:=PathConv(ToSingleByteFileSystemEncodedFileName(OldName));
   NewSystemFileName:=PathConv(ToSingleByteFileSystemEncodedFileName(NewName));
-  RenameFile:=dosRename(PChar(OldSystemFileName), PChar(NewSystemFileName)) <> 0;
+  RenameFile:=dosRename(PAnsiChar(OldSystemFileName), PAnsiChar(NewSystemFileName)) <> 0;
 end;
 
 
@@ -386,7 +386,7 @@ var
 begin
   validFile:=false;
   SystemFileName := PathConv(ToSingleByteFileSystemEncodedFileName(FileName));
-  tmpLock := Lock(PChar(SystemFileName), SHARED_LOCK);
+  tmpLock := Lock(PAnsiChar(SystemFileName), SHARED_LOCK);
 
   if (tmpLock <> 0) then begin
     new(tmpFIB);
@@ -418,7 +418,7 @@ var
 begin
   result:=false;
   SystemFileName := PathConv(ToSingleByteFileSystemEncodedFileName(FileName));
-  tmpLock := Lock(PChar(SystemFileName), SHARED_LOCK);
+  tmpLock := Lock(PAnsiChar(SystemFileName), SHARED_LOCK);
 
   if (tmpLock <> 0) then begin
     new(tmpFIB);
@@ -449,7 +449,7 @@ begin
   FillChar(Anchor^,sizeof(TAnchorPath),#0);
   Rslt.FindHandle := Anchor;
 
-  if MatchFirst(pchar(tmpStr),Anchor)<>0 then
+  if MatchFirst(PAnsiChar(tmpStr),Anchor)<>0 then
     begin
       InternalFindClose(Rslt.FindHandle);
       exit;
@@ -623,7 +623,7 @@ end;
 function RefreshDeviceList: Integer;
 var
   List: PDosList;
-  Temp: PChar;
+  Temp: PAnsiChar;
   Str: string;
 begin
   NumDevices := 0;
@@ -663,7 +663,7 @@ begin
   OldWinPtr := MyProc^.pr_WindowPtr;
   MyProc^.pr_WindowPtr := Pointer(-1);
   //
-  DirLock := Lock(PChar(Drive), SHARED_LOCK);
+  DirLock := Lock(PAnsiChar(Drive), SHARED_LOCK);
   if DirLock <> 0 then
   begin
     if Info(DirLock, @Inf) <> 0 then
@@ -697,7 +697,7 @@ begin
   OldWinPtr := MyProc^.pr_WindowPtr;
   MyProc^.pr_WindowPtr := Pointer(-1);
   //
-  DirLock := Lock(PChar(Drive), SHARED_LOCK);
+  DirLock := Lock(PAnsiChar(Drive), SHARED_LOCK);
   if DirLock <> 0 then
   begin
     if Info(DirLock, @Inf) <> 0 then
@@ -726,7 +726,7 @@ begin
   if (Directory='') or (InOutRes<>0) then exit;
 
   SystemDirName:=PathConv(ToSingleByteFileSystemEncodedFileName(Directory));
-  tmpLock:=Lock(PChar(SystemDirName),SHARED_LOCK);
+  tmpLock:=Lock(PAnsiChar(SystemDirName),SHARED_LOCK);
   if tmpLock=0 then exit;
 
   FIB:=nil; new(FIB);
@@ -802,7 +802,7 @@ end;
 var
   StrOfPaths: String;
 
-function SystemTags(const command: PChar; const tags: array of PtrUInt): LongInt;
+function SystemTags(const command: PAnsiChar; const tags: array of PtrUInt): LongInt;
 begin
   SystemTags:=SystemTagList(command,@tags);
 end;
@@ -883,12 +883,12 @@ begin
   { _SystemTagList call (program will abort!!)                 }
 
   { Try to open with shared lock }
-  tmpLock:=Lock(PChar(convPath),SHARED_LOCK);
+  tmpLock:=Lock(PAnsiChar(convPath),SHARED_LOCK);
   if tmpLock<>0 then
     begin
       { File exists - therefore unlock it }
       Unlock(tmpLock);
-      result:=SystemTagList(PChar(tmpPath),nil);
+      result:=SystemTagList(PAnsiChar(tmpPath),nil);
       { on return of -1 the shell could not be executed }
       { probably because there was not enough memory    }
       if result = -1 then