|
@@ -278,17 +278,41 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
+{$DEFINE ASYS_FILESIZE_NO_DOUBLE_SEEK}
|
|
|
+{ I changed the double-Seek filesize method which we
|
|
|
+ were using for 10+ years to the new ExamineFH() method.
|
|
|
+ It should be available AmigaOS 2.0+, and much faster.
|
|
|
+
|
|
|
+ (I actually measured several magnitudes of improvement,
|
|
|
+ especially on large files.)
|
|
|
+
|
|
|
+ It should be safe since there are several libc implementations
|
|
|
+ using the same method on all Amiga flavors, but if anyone has
|
|
|
+ a problem with it, disable this define to revert to the old
|
|
|
+ method and report the issue. (KB) }
|
|
|
function do_filesize(handle : longint) : longint;
|
|
|
-var currfilepos: longint;
|
|
|
+var
|
|
|
+{$IFDEF ASYS_FILESIZE_NO_DOUBLE_SEEK}
|
|
|
+ fib: PFileInfoBlock;
|
|
|
+{$ENDIF}
|
|
|
+ currfilepos: longint;
|
|
|
begin
|
|
|
checkCTRLC;
|
|
|
do_filesize:=-1;
|
|
|
if CheckInList(ASYS_fileList,handle)<>nil then begin
|
|
|
|
|
|
+{$IFDEF ASYS_FILESIZE_NO_DOUBLE_SEEK}
|
|
|
+ fib:=AllocDosObject(DOS_FIB,nil);
|
|
|
+ if fib <> nil then begin
|
|
|
+ if ExamineFH(handle, fib) then
|
|
|
+ do_filesize:=fib^.fib_Size;
|
|
|
+ FreeDosObject(DOS_FIB,fib);
|
|
|
+ end;
|
|
|
+{$ELSE}
|
|
|
currfilepos:=do_filepos(handle);
|
|
|
do_filesize:=do_seekend(handle);
|
|
|
do_seek(handle,currfilepos);
|
|
|
-
|
|
|
+{$ENDIF}
|
|
|
end;
|
|
|
end;
|
|
|
|