2005-03-09 Lutz Mueller <lutz@users.sourceforge.net>
authorLutz Mueller <lutz.s.mueller@gmail.com>
Wed, 9 Mar 2005 21:00:56 +0000 (22:00 +0100)
committerLutz Mueller <lutz.s.mueller@gmail.com>
Wed, 9 Mar 2005 21:00:56 +0000 (22:00 +0100)
* libexif/exif-data.c (exif_data_save_data_entry): According to the TIFF
specification, the offset must be an even number. If we need to introduce
  a padding byte, we set it to 0.

ChangeLog
libexif/exif-data.c

index 58402a4..3da8f7e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-03-09  Lutz Mueller <lutz@users.sourceforge.net>
 
+       * libexif/exif-data.c (exif_data_save_data_entry): According to the TIFF
+               specification, the offset must be an even number. If we need to introduce
+         a padding byte, we set it to 0.
+
+2005-03-09  Lutz Mueller <lutz@users.sourceforge.net>
+
        * libexif/exif-utils.[c,h] (exif_array_set_byte_order): New function.
        * libexif/exif-data.c
        * libexif/canon/exif-mnote-data-canon.c
index cc9c91b..57cd521 100644 (file)
@@ -225,13 +225,21 @@ exif_data_save_data_entry (ExifData *data, ExifEntry *e,
        if (s > 4) {
                doff = *ds - 6;
                *ds += s;
+
+               /*
+                * According to the TIFF specification,
+                * the offset must be an even number. If we need to introduce
+                * a padding byte, we set it to 0.
+                */
+               if (s & 1) *ds++;
                *d = exif_mem_realloc (data->priv->mem, *d, *ds);
                if (!*d) {
                        EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData", *ds);
                        return;
                }
-               exif_set_long (*d + 6 + offset + 8,
-                              data->priv->order, doff);
+               exif_set_long (*d + 6 + offset + 8, data->priv->order, doff);
+               if (s & 1) *(*d + *ds - 1) = '\0';
+
        } else
                doff = offset + 8;