瀏覽代碼

amicommon: backported seeking fixes from AROS branch, which actually apply to all Am*ga platforms

git-svn-id: trunk@28516 -
Károly Balogh 11 年之前
父節點
當前提交
cba1962284
共有 2 個文件被更改,包括 5 次插入4 次删除
  1. 1 3
      rtl/amicommon/sysfile.inc
  2. 4 1
      rtl/amicommon/sysutils.pp

+ 1 - 3
rtl/amicommon/sysfile.inc

@@ -273,7 +273,7 @@ begin
     if dosResult<0 then begin
       dosError2InOut(IoErr);
     end else begin
-      do_seekend:=dosResult;
+      do_seekend:=dosSeek(handle,0,OFFSET_CURRENT);
     end;
   end;
 end;
@@ -286,8 +286,6 @@ begin
   if CheckInList(ASYS_fileList,handle)<>nil then begin
 
     currfilepos:=do_filepos(handle);
-    { We have to do this twice, because seek returns the OLD position }
-    do_filesize:=do_seekend(handle);
     do_filesize:=do_seekend(handle);
     do_seek(handle,currfilepos);
 

+ 4 - 1
rtl/amicommon/sysutils.pp

@@ -267,7 +267,10 @@ begin
     fsFromEnd      : seekMode:=OFFSET_END;
   end;
 
-  FileSeek:=dosSeek(Handle, FOffset, seekMode);
+  dosSeek(Handle, FOffset, seekMode);
+  { get the current position when FileSeek ends, which should return 
+    the *NEW* position, while Amiga Seek() returns the old one }
+  FileSeek:=dosSeek(Handle, 0, OFFSET_CURRENT);
 end;
 
 function FileSeek(Handle: LongInt; FOffset: Int64; Origin: Longint): Int64;