If we give a file in command line, fuse open it 3x. e.g. 'fuse ace_2.dsk':
- utils_read_file() at fuse.c:517
- utils_open_file() at fuse.c:661
- utils_read_file() at disk.c:1465
First fuse identify file and add filename to the appropriate 'start_file' _and does not_ free 'file' buffer. Next fuse try to 'load' the file, so 'utils_open_file()' open it, identify and close. Than open with the apropriate routine. Which open the file again...
If we open a file from File->Open, fuse open it 2x. e.g.:
- utils_open_file() at menu.c:71
- utils_read_file() at disk.c:1465
Like before...
This patch fix this bug:
Changes:
* utils.h:
- add `filename', `type' and `class' to `utils_file' structure
- new subroutine `utils_init_file' declaration
- change `utils_open_file', `utils_read_file' and `utils_read_fd' declarations
* utils.c:
- new `utils_init_file', to initialise `utils_file' structure
- `utils_open_file', `utils_read_file' and `utils_read_fd' use `utils_file' struct instead of plain `filename'...
- the type and class identification code move to `utils_read_file'
- `utils_read_file' open and read file, if `buffer' is NULL, so we cannot read files more than once (through `utils_file_read')
- `utils_read_file' try to identify the file, if we ask with `identify' parameter != 0 and type or class is unknown, so we never identify a file more than once (through `utils_read_file)
* fuse.c:
- `start_files_t' struct hold `utils_files' structures instead of 'char *' filenames (except `recording').
- `setup_start_files', `parse_nonoption_args' and `do_start_files' changed to use the new features of `utils_*'
all others:
disk/beta.[ch],plusd.[ch],disk.[ch], upd_fdc.c
machines/specplus3.[ch]
ui/gtk/binary.c,picture.c
ui/win32/win32ui.c,binary.c,picture.c
widget/menu.c,widget.c
- changed to use the new parameters of `utils_*'s
File Added: fuse.ufile_01.diff
Looks reasonable on the face of it to me, but a big patch so I'll leave it to Phil :)
updated to current svn...
File Added: fuse.ufile_02.diff