diff src/image-load.c @ 45:7cfa60beda76

Thu May 26 13:57:19 2005 John Ellis <johne@verizon.net> * format_raw.[ch]: Move camera specific code to manufacturer specific format_*.c files. Change code so that file descripter version is now a separate functions that wraps the standard parser by using mmap. * format_canon.[ch]: Moved Canon specific raw support here, removed file descriptor versions of parser. This Canon raw file parser written by Daniel M. German. * format_fuji.[ch]: Move Fuji specific raw support here, parser written by Lars Ellenberg. * exif.c: Update for change to format_raw_img_exif_offsets. * filelist.c: Add cr2 extension to Canon raw format list. * image-load.c: Fixes for changes to format_raw_img_exif_offset_fd so that buffer is refilled using new offset of file descriptor. * src/Makefile.am: Add format_canon.[ch], format_fuji.[ch] to build. ##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. #####
author gqview
date Thu, 26 May 2005 18:10:52 +0000
parents ee03f36e9e4b
children b58cac75ad12
line wrap: on
line diff
--- a/src/image-load.c	Wed May 18 23:52:16 2005 +0000
+++ b/src/image-load.c	Thu May 26 18:10:52 2005 +0000
@@ -217,17 +217,23 @@
 
 	b = read(il->load_fd, &buf, sizeof(buf));
 
+	if (b > 1 &&
+	    format_raw_img_exif_offsets_fd(il->load_fd, buf, b, &offset, NULL))
+		{
+		if (debug) printf("Raw file %s contains embedded image\n", il->path);
+
+		b = read(il->load_fd, &buf, sizeof(buf));
+		}
+
 	if (b < 1)
 		{
 		image_loader_stop(il);
 		return FALSE;
 		}
 
-	format_raw_img_exif_offsets(il->load_fd, buf, b, &offset, NULL);
-
-	if (gdk_pixbuf_loader_write(il->loader, buf + offset, b - offset, NULL))
+	if (gdk_pixbuf_loader_write(il->loader, buf, b, NULL))
 		{
-		il->bytes_read += b;
+		il->bytes_read += b + offset;
 
 		if (b < sizeof(buf))
 			{