SetFileSize and more size Optimization

Posted by ALB42 on 5. Februar 2017No Comments

Found a bug that the FP-IDE does not save it’s settings, like the last used size, recent files or Clipboard. All this Data are saved into the fp.dsk file in the same folder where the fp executable resists. I checked it and the file was just zero. I remember that I fixed that problem already once, but It could be that this was before FPC entered the official FreePascal repository and this change did not make it.
I checked on the old branch and really found it. The problem is that a seek behind the end of the file does not work on Amiga systems. The FreePascal Seek documentation does not define what should happen if you seek behind the end of the file. But it seems FP-IDE assumes it fills the File with zeros from the end of file to the new position. I included a fix for it and it nicely work on Amiga m68k. But on AROS it stays 0 bytes after some more debugging I noticed it writes the file successfully, but then at the end it gets reseted to 0 bytes. The call doing that is truncate, which resolves to SetFileSize() on the AROS size. It seems this function does not work as expected or I misunderstand it. Wrote a little test program and really if you write 4096 bytes to a file and try to SetFileSize to a 1024 bytes you get a 0 byte file. a Retest on Amiga results into a 1024 bytes files, as expected. Strange that such a basic function should be non functional in AROS and nobody noticed. The bug seems to be present for ABIv0 and ABIv1 as well. So nothing to do for me here.

This days I used the FP-IDE a lot on a native AGA-Amiga1200 and it is really usable, but I noticed the FPC archive for m68k-amiga is very big for a real Amiga. The download and unpacking needs ages so I got an idea to make a small Release for Amiga which only contains the most important RTL and Amiga units. Today I found some time to create such an archive. It is 6 MB download and around 20 MB after unpacking (the complete archive is around 52MB and 305MB after unpacking). Both archives are available on the nightly page.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert