Update of /cvsroot/libexif/libexif/libexif
In directory sc8-pr-cvs1:/tmp/cvs-serv21169/libexif
Modified Files:
exif-loader.c
Log Message:
2003-10-30 Lutz Mueller <lu...@us...>
* libexif/exif-loader.c: Fix APP0-bug. Patch by Jan Patera
<pa...@pi...>.
Index: exif-loader.c
===================================================================
RCS file: /cvsroot/libexif/libexif/libexif/exif-loader.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- exif-loader.c 29 Apr 2003 20:13:50 -0000 1.3
+++ exif-loader.c 30 Oct 2003 21:10:35 -0000 1.4
@@ -18,10 +18,10 @@
struct _ExifLoader {
ExifLoaderState state;
- int size;
- int last_marker;
+ unsigned int size;
+ int last_marker;
unsigned char *buf;
- int bytes_read;
+ unsigned int bytes_read;
unsigned int ref_count;
};
@@ -29,23 +29,22 @@
#undef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-/* This function imitates code from libexif, written by Lutz
+/*
+ * This function imitates code from libexif, written by Lutz
* Müller. See libexif/exif-data.c:exif_data_new_from_file. Here, it
* can cope with a sequence of data chunks.
*/
unsigned char
exif_loader_write (ExifLoader *eld, unsigned char *buf, unsigned int len)
{
- int i;
- int len_remain;
+ int i, len_remain;
if (!eld) return 0;
if (eld->state == EL_FAILED) return 0;
if (eld->size && eld->bytes_read == eld->size) return 0;
for (i = 0; (i < len) && (eld->state != EL_EXIF_FOUND) &&
- (eld->state != EL_FAILED); i++) {
-
+ (eld->state != EL_FAILED); i++)
switch (eld->state) {
case EL_SKIP_BYTES:
eld->size--;
@@ -65,6 +64,7 @@
switch (eld->last_marker) {
case JPEG_MARKER_APP0:
eld->state = EL_SKIP_BYTES;
+ eld->size -= 2;
break;
case JPEG_MARKER_APP1:
@@ -107,7 +107,6 @@
}
}
}
- }
len_remain = len - i;
if (!len_remain) return 1;
|