Browse Source

AROS: unlike on other Amiga-flavors, file handles can be negative but -1 on AROS

git-svn-id: trunk@28506 -
Károly Balogh 11 years ago
parent
commit
ae0cc5d9e3
2 changed files with 7 additions and 7 deletions
  1. 2 2
      rtl/aros/sysfile.inc
  2. 5 5
      rtl/aros/sysutils.pp

+ 2 - 2
rtl/aros/sysfile.inc

@@ -198,7 +198,7 @@ var dosResult: LongInt;
 begin
   checkCTRLC;
   do_write:=0;
-  if (len<=0) or (h<=0) then exit;
+  if (len<=0) or (h=0) or (h=-1) then exit;
 
 {$IFDEF MOSFPC_FILEDEBUG}
   if not ((h=StdOutputHandle) or (h=StdInputHandle) or
@@ -218,7 +218,7 @@ var dosResult: LongInt;
 begin
   checkCTRLC;
   do_read:=0;
-  if (len<=0) or (h<=0) then exit;
+  if (len<=0) or (h=0) or (h=-1) then exit;
 
 {$IFDEF MOSFPC_FILEDEBUG}
   if not ((h=StdOutputHandle) or (h=StdInputHandle) or

+ 5 - 5
rtl/aros/sysutils.pp

@@ -236,7 +236,7 @@ end;
 function FileRead(Handle: LongInt; out Buffer; Count: LongInt): LongInt;
 begin
   FileRead:=-1;
-  if (Count<=0) or (Handle<=0) then exit;
+  if (Count<=0) or (Handle=0) or (Handle=-1) then exit;
 
   FileRead:=dosRead(Handle,@Buffer,Count);
 end;
@@ -245,7 +245,7 @@ end;
 function FileWrite(Handle: LongInt; const Buffer; Count: LongInt): LongInt;
 begin
   FileWrite:=-1;
-  if (Count<=0) or (Handle<=0) then exit;
+  if (Count<=0) or (Handle=0) or (Handle=-1) then exit;
 
   FileWrite:=dosWrite(Handle,@Buffer,Count);
 end;
@@ -256,7 +256,7 @@ var
   seekMode: LongInt;
 begin
   FileSeek:=-1;
-  if (Handle<=0) then exit;
+  if (Handle=0) or (Handle=-1) then exit;
 
   case Origin of
     fsFromBeginning: seekMode:=OFFSET_BEGINNING;
@@ -276,7 +276,7 @@ end;
 
 procedure FileClose(Handle: LongInt);
 begin
-  if (Handle<=0) then exit;
+  if (Handle=0) or (Handle=-1) then exit;
 
   dosClose(Handle);
   RemoveFromList(MOS_fileList,Handle);
@@ -292,7 +292,7 @@ begin
   if Size > high (longint) then exit;
 {$WARNING Possible support for 64-bit FS to be checked!}
 
-  if (Handle<=0) then exit;
+  if (Handle=0) or (Handle=-1) then exit;
 
   dosResult:=SetFileSize(Handle, Size, OFFSET_BEGINNING);
   if (dosResult<0) then exit;