From: Bram R. <bra...@ph...> - 2006-02-03 08:48:23
|
Hi Erwin, Indeed, file length shall only be adapted if file is modified (i.e. written). This is not only important to ratain the original file attributes, but even more to allow reading files when the user has no write access. Are you interested in becoming a developer? Then you can perform the update yourself. I will have a look at it anyhow. Otherwise, it is probably simplest to hand-over the patch to me directly. Regards, Bram. -- A.K. (Bram) Riemens Principal Scientist, DSP group, Philips Research Office: WO-p-94, Postbox WO02 High Tech Campus 36 (WO), 5656 AE Eindhoven, The Netherlands Tel: +31 40 27 43833, Fax: +31 40 27 44675 E-mail: bra...@ph... Erwin de Kock Sent by: pfs...@li... 02-02-2006 18:43 To pfs...@li... cc Subject Re: [Pfs...@sf...] Linux, cygwin, and different yuv file sizes Classification Hi Bram and others I have implemented the file truncation using the extended approach: 1- perform regular close of the file 2- reopen the file in read mode to avoid calling of p_close_idx() in p_read_hdr() 3- read the header using p_read_hdr() 4- calculate file length 5- close file 6- set file length by a) reopening the file in update mode, b) advancing the file pointer to file length using fio_fp_set_filepointer(), c) calling SetEndOfFile(), d) and closing the file To this end, I have added code to p_close_idx() and I have added a function p_fio_set_end_of_file(const char* filename, fio_offset_t offset) to cpfspd_fio to implement step 6. Currently this is done for all files, so also for files that were opened for reading only. This is not ok, since the date and time attributes of read-only files will be updated. I do not know if it is save to assume in p_close_idx() that if p_files[idx].mode equals p_mode_read, then the file should not be truncated. Any comments on this? How do you want me to send the changes? Shall I submit a patch file through the sourceforge site? Best regards, --Erwin |