mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 13:30:42 +02:00
fixed RawByteString PathConv() return value, removed the no longer needed dosLock() function, and related cleanups
git-svn-id: trunk@25939 -
This commit is contained in:
parent
628149d923
commit
a691971b9d
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
This file is part of the Free Pascal run time library.
|
This file is part of the Free Pascal run time library.
|
||||||
Copyright (c) 2004-2006 by Karoly Balogh
|
Copyright (c) 2004-2013 by Karoly Balogh
|
||||||
|
|
||||||
Sysutils unit for MorphOS
|
Sysutils unit for MorphOS
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ uses dos,sysconst;
|
|||||||
|
|
||||||
{ * Followings are implemented in the system unit! * }
|
{ * Followings are implemented in the system unit! * }
|
||||||
function PathConv(path: shortstring): shortstring; external name 'PATHCONV';
|
function PathConv(path: shortstring): shortstring; external name 'PATHCONV';
|
||||||
function PathConv(path: RawByteString): shortstring; external name 'PATHCONVRBS';
|
function PathConv(path: RawByteString): RawByteString; external name 'PATHCONVRBS';
|
||||||
procedure AddToList(var l: Pointer; h: LongInt); external name 'ADDTOLIST';
|
procedure AddToList(var l: Pointer; h: LongInt); external name 'ADDTOLIST';
|
||||||
function RemoveFromList(var l: Pointer; h: LongInt): boolean; external name 'REMOVEFROMLIST';
|
function RemoveFromList(var l: Pointer; h: LongInt): boolean; external name 'REMOVEFROMLIST';
|
||||||
function CheckInList(var l: Pointer; h: LongInt): pointer; external name 'CHECKINLIST';
|
function CheckInList(var l: Pointer; h: LongInt): pointer; external name 'CHECKINLIST';
|
||||||
@ -73,16 +73,6 @@ var
|
|||||||
MOS_fileList: Pointer; external name 'MOS_FILELIST';
|
MOS_fileList: Pointer; external name 'MOS_FILELIST';
|
||||||
|
|
||||||
|
|
||||||
function dosLock(const name: String;
|
|
||||||
accessmode: Longint) : LongInt;
|
|
||||||
var
|
|
||||||
buffer: array[0..255] of Char;
|
|
||||||
begin
|
|
||||||
move(name[1],buffer,length(name));
|
|
||||||
buffer[length(name)]:=#0;
|
|
||||||
dosLock:=Lock(buffer,accessmode);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function AmigaFileDateToDateTime(aDate: TDateStamp; out success: boolean): TDateTime;
|
function AmigaFileDateToDateTime(aDate: TDateStamp; out success: boolean): TDateTime;
|
||||||
var
|
var
|
||||||
tmpSecs: DWord;
|
tmpSecs: DWord;
|
||||||
@ -335,7 +325,6 @@ end;
|
|||||||
|
|
||||||
function FileAge (const FileName : RawByteString): Longint;
|
function FileAge (const FileName : RawByteString): Longint;
|
||||||
var
|
var
|
||||||
tmpName: RawByteString;
|
|
||||||
tmpLock: Longint;
|
tmpLock: Longint;
|
||||||
tmpFIB : PFileInfoBlock;
|
tmpFIB : PFileInfoBlock;
|
||||||
tmpDateTime: TDateTime;
|
tmpDateTime: TDateTime;
|
||||||
@ -343,9 +332,8 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
validFile:=false;
|
validFile:=false;
|
||||||
tmpName := PathConv(ToSingleByteFileSystemEncodedFileName(FileName));
|
tmpLock := Lock(PChar(PathConv(ToSingleByteFileSystemEncodedFileName(FileName))), SHARED_LOCK);
|
||||||
tmpLock := dosLock(tmpName, SHARED_LOCK);
|
|
||||||
|
|
||||||
if (tmpLock <> 0) then begin
|
if (tmpLock <> 0) then begin
|
||||||
new(tmpFIB);
|
new(tmpFIB);
|
||||||
if Examine(tmpLock,tmpFIB) then begin
|
if Examine(tmpLock,tmpFIB) then begin
|
||||||
@ -366,11 +354,9 @@ function FileExists (const FileName : RawByteString) : Boolean;
|
|||||||
var
|
var
|
||||||
tmpLock: LongInt;
|
tmpLock: LongInt;
|
||||||
tmpFIB : PFileInfoBlock;
|
tmpFIB : PFileInfoBlock;
|
||||||
SystemFileName: RawByteString;
|
|
||||||
begin
|
begin
|
||||||
result:=false;
|
result:=false;
|
||||||
SystemFileName:=PathConv(ToSingleByteFileSystemEncodedFileName(FileName));
|
tmpLock := Lock(PChar(PathConv(ToSingleByteFileSystemEncodedFileName(FileName))), SHARED_LOCK);
|
||||||
tmpLock := dosLock(PChar(SystemFileName), SHARED_LOCK);
|
|
||||||
|
|
||||||
if (tmpLock <> 0) then begin
|
if (tmpLock <> 0) then begin
|
||||||
new(tmpFIB);
|
new(tmpFIB);
|
||||||
@ -545,13 +531,11 @@ function DirectoryExists(const Directory: RawByteString): Boolean;
|
|||||||
var
|
var
|
||||||
tmpLock: LongInt;
|
tmpLock: LongInt;
|
||||||
FIB : PFileInfoBlock;
|
FIB : PFileInfoBlock;
|
||||||
SystemFileName: RawByteString;
|
|
||||||
begin
|
begin
|
||||||
result:=false;
|
result:=false;
|
||||||
if (Directory='') or (InOutRes<>0) then exit;
|
if (Directory='') or (InOutRes<>0) then exit;
|
||||||
SystemFileName:=PathConv(ToSingleByteFileSystemEncodedFileName(Directory));
|
|
||||||
|
|
||||||
tmpLock:=dosLock(PChar(SystemFileName),SHARED_LOCK);
|
tmpLock:=Lock(PChar(PathConv(ToSingleByteFileSystemEncodedFileName(Directory))),SHARED_LOCK);
|
||||||
if tmpLock=0 then exit;
|
if tmpLock=0 then exit;
|
||||||
|
|
||||||
FIB:=nil; new(FIB);
|
FIB:=nil; new(FIB);
|
||||||
|
Loading…
Reference in New Issue
Block a user