mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-27 10:31:41 +01:00
* made the ansistring parameters of the fp*() overloads constant, changed
them to rawbytestring and added DefaultFileSystemCodePage conversions git-svn-id: branches/cpstrrtl@25133 -
This commit is contained in:
parent
e132a77709
commit
8538f48fda
@ -16,38 +16,58 @@
|
|||||||
{$I textrec.inc}
|
{$I textrec.inc}
|
||||||
{$I filerec.inc}
|
{$I filerec.inc}
|
||||||
|
|
||||||
Function FpLink (existing : AnsiString; newone : AnsiString): cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpLink (const existing : RawByteString; const newone : RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemExistingFileName, SystemNewOneFileName: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpLink:=FpLink(pchar(existing),pchar(newone));
|
SystemExistingFileName:=ToSingleByteFileSystemEncodedFileName(existing);
|
||||||
|
SystemNewOneFileName:=ToSingleByteFileSystemEncodedFileName(newone);
|
||||||
|
FpLink:=FpLink(pchar(SystemExistingFileName),pchar(SystemNewOneFileName));
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function FpMkfifo (path : AnsiString; Mode : TMode): cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpMkfifo (const path : RawByteString; Mode : TMode): cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemPath: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpMkfifo:=FpMkfifo(pchar(path),mode);
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
FpMkfifo:=FpMkfifo(pchar(SystemPath),mode);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function FpChmod (path : AnsiString; Mode : TMode): cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpChmod (const path : RawByteString; Mode : TMode): cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemPath: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpChmod:=FpChmod(pchar(path),mode);
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
FpChmod:=FpChmod(pchar(SystemPath),mode);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function FpChown (path : AnsiString; owner : TUid; group : TGid): cInt;{$ifdef VER2_0}inline;{$endif}
|
Function FpChown (const path : RawByteString; owner : TUid; group : TGid): cInt;{$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemPath: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpChown:=FpChown(pchar(path),owner,group);
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
FpChown:=FpChown(pchar(SystemPath),owner,group);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function FpUtime (path : AnsiString; times : putimbuf): cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpUtime (const path : RawByteString; times : putimbuf): cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemPath: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpUtime:=FpUtime(pchar(path),times);
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
FpUtime:=FpUtime(pchar(SystemPath),times);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
{
|
{
|
||||||
Function FpGetcwd (path:AnsiString; siz:TSize):AnsiString; {$ifdef VER2_0}inline;{$endif}
|
Function FpGetcwd (const path:RawByteString; siz:TSize):RawByteString; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemPath: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpGetcwd:=ansistring(pchar(FpGetcwd(pchar(path),siz)));
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
FpGetcwd:=RawByteString(pchar(FpGetcwd(pchar(SystemPath),siz)));
|
||||||
|
SetCodePage(FpGetcwd,DefaultFileSystemCodePage,false);
|
||||||
End;
|
End;
|
||||||
}
|
}
|
||||||
Function FpGetcwd :AnsiString;
|
Function FpGetcwd: RawByteString;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
Buf : Array[0..PATH_MAX+1] of char;
|
Buf : Array[0..PATH_MAX+1] of char;
|
||||||
@ -56,59 +76,93 @@ Begin
|
|||||||
If FpGetcwd(@Buf[0],PATH_MAX)=Nil then
|
If FpGetcwd(@Buf[0],PATH_MAX)=Nil then
|
||||||
FpGetcwd:=''
|
FpGetcwd:=''
|
||||||
else
|
else
|
||||||
FpGetcwd:=Buf;
|
begin
|
||||||
|
FpGetcwd:=Buf;
|
||||||
|
SetCodePage(FpGetcwd,DefaultFileSystemCodePage,false);
|
||||||
|
end;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function FpExecve (path : AnsiString; argv : ppchar; envp: ppchar): cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpExecve (const path : RawByteString; argv : ppchar; envp: ppchar): cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemPath: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpExecve:=FpExecve (pchar(path),argv,envp);
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
FpExecve:=FpExecve (pchar(SystemPath),argv,envp);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function FpExecv (path : AnsiString; argv : ppchar): cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpExecv (const path : RawByteString; argv : ppchar): cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemPath: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpExecv:=FpExecve (pchar(path),argv,envp);
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
FpExecv:=FpExecve (pchar(SystemPath),argv,envp);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
Function FpChdir (path : AnsiString): cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpChdir (const path : RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemPath: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpChDir:=FpChdir(pchar(Path));
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
FpChDir:=FpChdir(pchar(SystemPath));
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function FpOpen (path : AnsiString; flags : cInt; Mode: TMode):cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpOpen (const path : RawByteString; flags : cInt; Mode: TMode):cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemPath: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpOpen:=FpOpen(pchar(Path),flags,mode);
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
FpOpen:=FpOpen(pchar(SystemPath),flags,mode);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
Function FpMkdir (path : AnsiString; Mode: TMode):cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpMkdir (const path : RawByteString; Mode: TMode):cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemPath: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpMkdir:=FpMkdir(pchar(Path),mode);
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
FpMkdir:=FpMkdir(pchar(SystemPath),mode);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function FpUnlink (path : AnsiString): cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpUnlink (const path : RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemPath: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpUnlink:=FpUnlink(pchar(path));
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
FpUnlink:=FpUnlink(pchar(SystemPath));
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function FpRmdir (path : AnsiString): cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpRmdir (const path : RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemPath: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpRmdir:=FpRmdir(pchar(path));
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
FpRmdir:=FpRmdir(pchar(SystemPath));
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function FpRename (old : AnsiString;newpath: AnsiString): cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpRename (const old : RawByteString; const newpath: RawByteString): cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
OldSystemPath, NewSystemPath: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpRename:=FpRename(pchar(old),pchar(newpath));
|
OldSystemPath:=ToSingleByteFileSystemEncodedFileName(old);
|
||||||
|
NewSystemPath:=ToSingleByteFileSystemEncodedFileName(newpath);
|
||||||
|
FpRename:=FpRename(pchar(OldSystemPath),pchar(NewSystemPath));
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function FpStat (path: AnsiString; var buf : stat): cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpStat (const path: RawByteString; var buf : stat): cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
begin
|
var
|
||||||
FpStat:=FpStat(pchar(path),buf);
|
SystemPath: RawByteString;
|
||||||
|
Begin
|
||||||
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
FpStat:=FpStat(pchar(SystemPath),buf);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function fpLstat (path: Ansistring; Info: pstat):cint; inline;
|
Function fpLstat (const path: RawByteString; Info: pstat):cint; inline;
|
||||||
begin
|
var
|
||||||
fplstat:=fplstat(pchar(path), info);
|
SystemPath: RawByteString;
|
||||||
|
Begin
|
||||||
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
fplstat:=fplstat(pchar(SystemPath), info);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function fpLstat (path:pchar;var Info:stat):cint; inline;
|
Function fpLstat (path:pchar;var Info:stat):cint; inline;
|
||||||
@ -117,15 +171,17 @@ begin
|
|||||||
fpLstat:=fplstat(path,@info);
|
fpLstat:=fplstat(path,@info);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function fpLstat (Filename: ansistring;var Info:stat):cint; inline;
|
Function fpLstat (const Filename: RawByteString;var Info:stat):cint; inline;
|
||||||
|
Begin
|
||||||
begin
|
|
||||||
fpLstat:=fplstat(filename,@info);
|
fpLstat:=fplstat(filename,@info);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function FpAccess (pathname : AnsiString; aMode : cInt): cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpAccess (const pathname : RawByteString; aMode : cInt): cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemPathName: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpAccess:=FpAccess(pchar(pathname),amode);
|
SystemPathName:=ToSingleByteFileSystemEncodedFileName(pathname);
|
||||||
|
FpAccess:=FpAccess(pchar(SystemPathName),amode);
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Function FPFStat(var F:Text;Var Info:stat):Boolean; {$ifdef VER2_0}inline;{$endif}
|
Function FPFStat(var F:Text;Var Info:stat):Boolean; {$ifdef VER2_0}inline;{$endif}
|
||||||
@ -201,10 +257,12 @@ begin
|
|||||||
FpOpen:=FpOpen(path,flags,438);
|
FpOpen:=FpOpen(path,flags,438);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function FpOpen (path : AnsiString; flags : cInt):cInt; {$ifdef VER2_0}inline;{$endif}
|
Function FpOpen (const path : RawByteString; flags : cInt):cInt; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
begin
|
SystemPath: RawByteString;
|
||||||
FpOpen:=FpOpen(pchar(path),flags,438);
|
Begin
|
||||||
|
SystemPath:=ToSingleByteFileSystemEncodedFileName(path);
|
||||||
|
FpOpen:=FpOpen(pchar(SystemPath),flags,438);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function FpOpen (path : String; flags : cInt):cInt;
|
Function FpOpen (path : String; flags : cInt):cInt;
|
||||||
@ -221,9 +279,12 @@ begin
|
|||||||
FpOpen:=FpOpen(@path[1],flags,Mode);
|
FpOpen:=FpOpen(@path[1],flags,Mode);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function FpOpendir (dirname : AnsiString): pDir; {$ifdef VER2_0}inline;{$endif}
|
Function FpOpendir (const dirname : RawByteString): pDir; {$ifdef VER2_0}inline;{$endif}
|
||||||
|
var
|
||||||
|
SystemDirName: RawByteString;
|
||||||
Begin
|
Begin
|
||||||
FpOpenDir:=FpOpenDir(pchar(dirname));
|
SystemDirName:=ToSingleByteFileSystemEncodedFileName(dirname);
|
||||||
|
FpOpenDir:=FpOpenDir(pchar(SystemDirName));
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
@ -373,20 +434,21 @@ begin
|
|||||||
fpWaitPID:=fpWaitPID(Pid,@Status,Options);
|
fpWaitPID:=fpWaitPID(Pid,@Status,Options);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function fpReadLink(Name:ansistring):ansistring;
|
Function fpReadLink(const Name: RawByteString): RawByteString;
|
||||||
{
|
{
|
||||||
Read a link (where it points to)
|
Read a link (where it points to)
|
||||||
}
|
}
|
||||||
var
|
var
|
||||||
LinkName : ansistring;
|
SystemFileName : RawByteString;
|
||||||
i : cint;
|
i : cint;
|
||||||
begin
|
begin
|
||||||
SetLength(linkname,PATH_MAX);
|
SetLength(fpReadLink,PATH_MAX);
|
||||||
i:=fpReadLink(pchar(name),pchar(linkname),PATH_MAX);
|
SystemFileName:=ToSingleByteFileSystemEncodedFileName(Name);
|
||||||
|
i:=fpReadLink(pchar(SystemFileName),pchar(fpReadLink),PATH_MAX);
|
||||||
if i>0 then
|
if i>0 then
|
||||||
begin
|
begin
|
||||||
SetLength(linkname,i);
|
SetLength(fpReadLink,i);
|
||||||
fpReadLink:=LinkName;
|
SetCodePage(fpReadLink,DefaultFileSystemCodePage,false);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
fpReadLink:='';
|
fpReadLink:='';
|
||||||
|
|||||||
@ -15,32 +15,32 @@
|
|||||||
|
|
||||||
**********************************************************************}
|
**********************************************************************}
|
||||||
|
|
||||||
Function FpLink (existing : AnsiString; newone : AnsiString): cInt; inline;
|
Function FpLink (const existing : RawByteString; const newone : RawByteString): cInt; inline;
|
||||||
Function FpMkfifo (path : AnsiString; Mode : TMode): cInt; inline;
|
Function FpMkfifo (const path : RawByteString; Mode : TMode): cInt; inline;
|
||||||
Function FpChmod (path : AnsiString; Mode : TMode): cInt; inline;
|
Function FpChmod (const path : RawByteString; Mode : TMode): cInt; inline;
|
||||||
Function FpChown (path : AnsiString; owner : TUid; group : TGid): cInt; inline;
|
Function FpChown (const path : RawByteString; owner : TUid; group : TGid): cInt; inline;
|
||||||
Function FpUtime (path : AnsiString; times : putimbuf): cInt; inline;
|
Function FpUtime (const path : RawByteString; times : putimbuf): cInt; inline;
|
||||||
Function FpGetcwd : AnsiString;
|
Function FpGetcwd : RawByteString;
|
||||||
Function FpExecve (path : AnsiString; argv : ppchar; envp: ppchar): cInt; inline;
|
Function FpExecve (const path : RawByteString; argv : ppchar; envp: ppchar): cInt; inline;
|
||||||
Function FpExecv (path : AnsiString; argv : ppchar): cInt; inline;
|
Function FpExecv (const path : RawByteString; argv : ppchar): cInt; inline;
|
||||||
Function FpOpendir (dirname : AnsiString): pDir; inline;
|
Function FpOpendir (const dirname : RawByteString): pDir; inline;
|
||||||
Function FpOpendir (dirname : shortString): pDir; inline;
|
Function FpOpendir (dirname : ShortString): pDir; inline;
|
||||||
Function FpOpen (path : pChar; flags : cInt):cInt; inline;
|
Function FpOpen (path : pChar; flags : cInt):cInt; inline;
|
||||||
Function FpOpen (path : AnsiString; flags : cInt):cInt; inline;
|
Function FpOpen (const path : RawByteString; flags : cInt):cInt; inline;
|
||||||
Function FpOpen (path : AnsiString; flags : cInt; Mode: TMode):cInt; inline;
|
Function FpOpen (const path : RawByteString; flags : cInt; Mode: TMode):cInt; inline;
|
||||||
Function FpOpen (path : String; flags : cInt):cInt;
|
Function FpOpen (path : ShortString; flags : cInt):cInt;
|
||||||
Function FpOpen (path : String; flags : cInt; Mode: TMode):cInt;
|
Function FpOpen (path : ShortString; flags : cInt; Mode: TMode):cInt;
|
||||||
Function FpChdir (path : AnsiString): cInt; inline;
|
Function FpChdir (const path : RawByteString): cInt; inline;
|
||||||
Function FpMkdir (path : AnsiString; Mode: TMode):cInt; inline;
|
Function FpMkdir (const path : RawByteString; Mode: TMode):cInt; inline;
|
||||||
Function FpUnlink (path : AnsiString): cInt; inline;
|
Function FpUnlink (const path : RawByteString): cInt; inline;
|
||||||
Function FpRmdir (path : AnsiString): cInt; inline;
|
Function FpRmdir (const path : RawByteString): cInt; inline;
|
||||||
Function FpRename (old : AnsiString;newpath: AnsiString): cInt; inline;
|
Function FpRename (const old : RawByteString; const newpath: RawByteString): cInt; inline;
|
||||||
Function FpStat (path: AnsiString; var buf : stat): cInt; inline;
|
Function FpStat (const path: RawByteString; var buf : stat): cInt; inline;
|
||||||
Function FpStat (path: String; var buf : stat): cInt;
|
Function FpStat (path: ShortString; var buf : stat): cInt;
|
||||||
Function fpLstat (path: Ansistring; Info: pstat):cint; inline;
|
Function fpLstat (const path: RawByteString; Info: pstat):cint; inline;
|
||||||
Function fpLstat (path:pchar;var Info:stat):cint; inline;
|
Function fpLstat (path:pchar;var Info:stat):cint; inline;
|
||||||
Function fpLstat (Filename: ansistring;var Info:stat):cint; inline;
|
Function fpLstat (const Filename: RawByteString;var Info:stat):cint; inline;
|
||||||
Function FpAccess (pathname : AnsiString; aMode : cInt): cInt; inline;
|
Function FpAccess (const pathname : RawByteString; aMode : cInt): cInt; inline;
|
||||||
function FpWaitPid (pid : TPid; Var Status : cInt; Options : cint) : TPid;
|
function FpWaitPid (pid : TPid; Var Status : cInt; Options : cint) : TPid;
|
||||||
|
|
||||||
Function FPFStat (var F:Text;Var Info:stat):Boolean; inline;
|
Function FPFStat (var F:Text;Var Info:stat):Boolean; inline;
|
||||||
@ -96,6 +96,6 @@ Function wstopsig (Status : cInt): cInt;
|
|||||||
Function wifsignaled (Status : cInt): boolean;
|
Function wifsignaled (Status : cInt): boolean;
|
||||||
Function wtermsig (Status : cInt): cInt;
|
Function wtermsig (Status : cInt): cInt;
|
||||||
|
|
||||||
Function fpReadLink(Name:ansistring):ansistring;
|
Function fpReadLink(const Name: RawByteString): RawByteString;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user