Re: [patch] gqview 2.1 and FUJI raw files (.raf)
Lars Ellenberg <l.g.e-S0/[email protected]> Mon, 16 May 2005 11:48:33 +0200
| Newsgroups | gmane.comp.gnome.apps.gqview.devel |
|---|---|
| Message-ID | <[email protected]> |
/ 2005-05-15 23:42:21 -0400
\ John Ellis:
> Ok, I have integrated your proposed patch - with many changes, and the new files
> you had created are now named format_raw.[ch].
>
> The patch for 2.1.0 is here:
>
> http://gqview.sourceforge.net/patches/gqview-2.1.0-raw1.patch.gz
great.
btw,
my paranoia is most likely too strict for the general case:
if (!found ||
io >= len - 4 ||
eo >= len ||
memcmp(data + io, "\xff\xd8\xff\xe1", 4) != 0) /* jpeg marker */
{
return FALSE;
}
this is basically an assertion and expects ALL raw format embeded "previews"
to be jpegs (which is probably valid), and expects them to start with
SOI APP1 (which is too strict). There are probably others that do not
contain APP1 (typically exif), or do not place it as the first record.
So maybe better:
- memcmp(data + io, "\xff\xd8\xff\xe1", 4) != 0) /* jpeg marker */
+ memcmp(data + io, "\xff\xd8\xff", 3) != 0) /* jpeg marker */
and an other paranoia might be good:
make sure the file is at the same position it was on entry.
so in case some other "detectors" (e.g. cannon) need to seek,
seek back in the generic function, something like
current_pos = ftell(fd);
/* tests and possible seeks here */
seek(fd,current_pos,SEEK_SET);
hm. one could also disallow seeking in these helpers, but mmap the
file if not already done... probably best by creating some
"gqview-filehandle" object, which contains in a struct the fd,
stat_info, current data buffer and length, whether or not it is already
mmap'ed, some other useful info, and some methods to open, close and
access it safely...
well, thats a todo item for the time when there are other formats added.
cheers,
Lars Ellenberg
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click