From a691971b9d41ad2e330db9c98fd37ba0d3f34c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A1roly=20Balogh?= Date: Tue, 5 Nov 2013 18:52:27 +0000 Subject: [PATCH] fixed RawByteString PathConv() return value, removed the no longer needed dosLock() function, and related cleanups git-svn-id: trunk@25939 - --- rtl/morphos/sysutils.pp | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/rtl/morphos/sysutils.pp b/rtl/morphos/sysutils.pp index 2657b32f86..5b281aa5d1 100644 --- a/rtl/morphos/sysutils.pp +++ b/rtl/morphos/sysutils.pp @@ -1,6 +1,6 @@ { 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 @@ -64,7 +64,7 @@ uses dos,sysconst; { * Followings are implemented in the system unit! * } 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'; function RemoveFromList(var l: Pointer; h: LongInt): boolean; external name 'REMOVEFROMLIST'; function CheckInList(var l: Pointer; h: LongInt): pointer; external name 'CHECKINLIST'; @@ -73,16 +73,6 @@ var 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; var tmpSecs: DWord; @@ -335,7 +325,6 @@ end; function FileAge (const FileName : RawByteString): Longint; var - tmpName: RawByteString; tmpLock: Longint; tmpFIB : PFileInfoBlock; tmpDateTime: TDateTime; @@ -343,9 +332,8 @@ var begin validFile:=false; - tmpName := PathConv(ToSingleByteFileSystemEncodedFileName(FileName)); - tmpLock := dosLock(tmpName, SHARED_LOCK); - + tmpLock := Lock(PChar(PathConv(ToSingleByteFileSystemEncodedFileName(FileName))), SHARED_LOCK); + if (tmpLock <> 0) then begin new(tmpFIB); if Examine(tmpLock,tmpFIB) then begin @@ -366,11 +354,9 @@ function FileExists (const FileName : RawByteString) : Boolean; var tmpLock: LongInt; tmpFIB : PFileInfoBlock; - SystemFileName: RawByteString; begin result:=false; - SystemFileName:=PathConv(ToSingleByteFileSystemEncodedFileName(FileName)); - tmpLock := dosLock(PChar(SystemFileName), SHARED_LOCK); + tmpLock := Lock(PChar(PathConv(ToSingleByteFileSystemEncodedFileName(FileName))), SHARED_LOCK); if (tmpLock <> 0) then begin new(tmpFIB); @@ -545,13 +531,11 @@ function DirectoryExists(const Directory: RawByteString): Boolean; var tmpLock: LongInt; FIB : PFileInfoBlock; - SystemFileName: RawByteString; begin result:=false; 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; FIB:=nil; new(FIB);