From: Lutz M. <lu...@us...> - 2004-10-05 19:14:49
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19252/libexif Modified Files: exif-data.c i18n.h Log Message: 2004-10-05 Lutz Mueller <lu...@us...> * libexif/exif-data.c: Support for WatCom. Convert debugging code to exif-log API. * libexif/i18n.h: Support for WatCom. Patch by Angela Wrobel. Index: i18n.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/i18n.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- i18n.h 28 Apr 2003 18:22:18 -0000 1.3 +++ i18n.h 5 Oct 2004 19:14:12 -0000 1.4 @@ -35,8 +35,13 @@ # define gettext(String) (String) # define dgettext(Domain,Message) (Message) # define dcgettext(Domain,Message,Type) (Message) -# define bind_textdomain_codeset(Domain,Codeset) (Codeset) -# define bindtextdomain(Domain,Directory) (Domain) +#ifdef __WATCOMC__ +# define bind_textdomain_codeset(Domain,Codeset) +# define bindtextdomain(Domain,Directory) +#else +# define bind_textdomain_codeset(Domain,Codeset) (Codeset) +# define bindtextdomain(Domain,Directory) (Domain) +#endif # define _(String) (String) # define N_(String) (String) #endif Index: exif-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- exif-data.c 4 Oct 2004 06:26:59 -0000 1.50 +++ exif-data.c 5 Oct 2004 19:14:12 -0000 1.51 @@ -40,7 +40,9 @@ #undef MAX #define MAX(a, b) (((a) > (b)) ? (a) : (b)) -/* #define DEBUG */ +#ifdef __WATCOMC__ +# define strncasecmp strnicmp +#endif static const unsigned char ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00}; @@ -166,6 +168,7 @@ memcpy (entry->data, d + doff, s); } +#ifndef EXIF_DONT_CHANGE_MAKER_NOTE /* If this is the MakerNote, remember the offset */ if (entry->tag == EXIF_TAG_MAKER_NOTE) { if (entry->size > 6) exif_log (data->priv->log, @@ -177,6 +180,7 @@ entry->data[6]); data->priv->offset_mnote = doff; } +#endif exif_entry_fix (entry); } @@ -300,9 +304,6 @@ data->ifd[EXIF_IFD_INTEROPERABILITY], d, ds, o); break; case EXIF_TAG_JPEG_INTERCHANGE_FORMAT: -#ifdef DEBUG - printf ("Thumbnail at %i.\n", (int) o); -#endif thumbnail_offset = o; if (thumbnail_offset && thumbnail_length) exif_data_load_data_thumbnail (data, d, @@ -310,9 +311,6 @@ thumbnail_length); break; case EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH: -#ifdef DEBUG - printf ("Thumbnail size: %i.\n", (int) o); -#endif thumbnail_length = o; if (thumbnail_offset && thumbnail_length) exif_data_load_data_thumbnail (data, d, @@ -402,12 +400,10 @@ (ExifShort) (ifd->count + n_ptr + n_thumb)); offset += 2; -#ifdef DEBUG - printf ("Saving %i entries (IFD '%s', offset: %i)...\n", - ifd->count, exif_ifd_get_name (i), offset); -#endif - /* Save each entry */ + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "Saving %i entries (IFD '%s', offset: %i)...", + ifd->count, exif_ifd_get_name (i), offset); for (j = 0; j < ifd->count; j++) exif_data_save_data_entry (data, ifd->entries[j], d, ds, offset + 12 * j); @@ -502,11 +498,6 @@ } memcpy (*d + *ds - data->size, data->data, data->size); offset += 12; -#ifdef DEBUG - printf ("Wrote %i bytes of thumbnail data at offset " - "%i.\n", data->size, *ds - data->size); - printf ("We currently have %i bytes EXIF data.\n", *ds); -#endif /* EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH */ exif_set_short (*d + 6 + offset + 0, data->priv->order, @@ -561,20 +552,14 @@ * not, search the EXIF marker. */ if (ds < 6) { -#ifdef DEBUG - printf ("Size too small.\n"); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "Size too small."); return; } if (!memcmp (d, ExifHeader, 6)) { -#ifdef DEBUG - printf ("Found EXIF header.\n"); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "Found EXIF header."); } else { -#ifdef DEBUG - printf ("Data begins with 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x " - "0x%x...\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6]); -#endif while (1) { while ((d[0] == 0xff) && ds) { d++; @@ -605,23 +590,21 @@ break; /* Unknown marker or data. Give up. */ -#ifdef DEBUG - printf ("EXIF marker not found.\n"); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, + "ExifData", "EXIF marker not found."); return; } d++; ds--; if (ds < 2) { -#ifdef DEBUG - printf ("Size too small.\n"); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, + "ExifData", "Size too small."); return; } len = (d[0] << 8) | d[1]; -#ifdef DEBUG - printf ("We have to deal with %i byte(s) of EXIF data.\n", len); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "We have to deal with %i byte(s) of EXIF data.", + len); d += 2; ds -= 2; } @@ -631,21 +614,18 @@ * (offset 2, length 6). */ if (ds < 6) { -#ifdef DEBUG - printf ("Size too small.\n"); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "Size too small."); return; } if (memcmp (d, ExifHeader, 6)) { -#ifdef DEBUG - printf ("EXIF header not found.\n"); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "EXIF header not found."); return; } -#ifdef DEBUG - printf ("Found EXIF header.\n"); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "Found EXIF header."); /* Byte order (offset 6, length 2) */ if (ds < 12) @@ -663,9 +643,8 @@ /* IFD 0 offset */ offset = exif_get_long (d + 10, data->priv->order); -#ifdef DEBUG - printf ("IFD 0 at %i.\n", (int) offset); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "IFD 0 at %i.", (int) offset); /* Parse the actual exif data (offset 14) */ exif_data_load_data_content (data, data->ifd[EXIF_IFD_0], d + 6, @@ -675,15 +654,13 @@ n = exif_get_short (d + 6 + offset, data->priv->order); offset = exif_get_long (d + 6 + offset + 2 + 12 * n, data->priv->order); if (offset) { -#ifdef DEBUG - printf ("IFD 1 at %i.\n", (int) offset); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "IFD 1 at %i.", (int) offset); /* Sanity check. */ if (offset > ds - 6) { -#ifdef DEBUG - printf ("Bogus offset!\n"); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, + "ExifData", "Bogus offset!"); return; } @@ -771,15 +748,12 @@ exif_set_long (*d + 10, data->priv->order, 8); /* Now save IFD 0. IFD 1 will be saved automatically. */ -#ifdef DEBUG - printf ("Saving IFDs...\n"); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "Saving IFDs..."); exif_data_save_data_content (data, data->ifd[EXIF_IFD_0], d, ds, *ds - 6); - -#ifdef DEBUG - printf ("Saved %i byte(s) EXIF data.\n", *ds); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "Saved %i byte(s) EXIF data.", *ds); } ExifData * |