From: Arnaud L. <as...@us...> - 2003-09-17 11:26:05
|
Update of /cvsroot/libexif/libmnote/libmnote/canon In directory sc8-pr-cvs1:/tmp/cvs-serv24005/libmnote/canon Modified Files: mnote-canon-data.c mnote-canon-entry.c Log Message: Drop EOL blanks and // comments Index: mnote-canon-data.c =================================================================== RCS file: /cvsroot/libexif/libmnote/libmnote/canon/mnote-canon-data.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- mnote-canon-data.c 29 Aug 2003 11:18:21 -0000 1.7 +++ mnote-canon-data.c 17 Sep 2003 11:25:59 -0000 1.8 @@ -1,17 +1,17 @@ /* mnote-canon-data.c * * Copyright © 2002 Lutz Müller <lu...@us...> - * Copyright © 2003 Matthieu Castet <ma...@us...> + * Copyright © 2003 Matthieu Castet <ma...@us...> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the @@ -30,14 +30,14 @@ #include <libexif/exif-utils.h> #include <libexif/exif-data.h> -//#define DEBUG +/* #define DEBUG */ static void mnote_canon_data_free (MNoteData *n) { MNoteCanonData *note = (MNoteCanonData *) n; unsigned int i; - + if (note->entries) { for (i = 0; i < note->count; i++) mnote_canon_entry_unref (note->entries[i]); @@ -50,7 +50,7 @@ static char * mnote_canon_data_get_value (MNoteData *n, MNoteTag t) { - + char *value = NULL; unsigned int i, count; @@ -63,7 +63,7 @@ } } - return (value); + return (value); } static void @@ -77,10 +77,10 @@ static void mnote_canon_data_add_entry (MNoteCanonData *note, MNoteCanonEntry *entry) -{ +{ if (!note || !entry) - return; - + return; + entry->parent = note; note->entries = realloc (note->entries, sizeof (MNoteCanonEntry) * (note->count + 1)); @@ -94,13 +94,13 @@ MNoteCanonEntry *entry, const unsigned char *d, unsigned int size, unsigned int offset, - const unsigned char *exifdata, + const unsigned char *exifdata, unsigned int exifsize) { unsigned int s, doff, sizetmp = size; const unsigned char *temp = d; ExifByteOrder order = mnote_data_get_byte_order ((MNoteData *) note); - + entry->tag = exif_get_short (d + offset + 0, order); entry->format = exif_get_short (d + offset + 2, order); entry->components = exif_get_long (d + offset + 4, order); @@ -113,7 +113,7 @@ if (!s) return; if (s > 4) - { + { doff = exif_get_long (d + offset + 8, order) + 0xC; sizetmp = exifsize; temp = exifdata; @@ -132,10 +132,10 @@ return; entry->size = s; memcpy (entry->data, temp + doff, s); - + } -static void +static void mnote_canon_data_load_data_entry (MNoteCanonData *note, MNoteCanonEntry *entry, const unsigned char *d, @@ -143,7 +143,7 @@ { unsigned int s, doff; ExifByteOrder order = mnote_data_get_byte_order ((MNoteData *) note); - + entry->tag = exif_get_short (d + offset + 0, order); entry->format = exif_get_short (d + offset + 2, order); entry->components = exif_get_long (d + offset + 4, order); @@ -156,7 +156,7 @@ if (!s) return; if (s > 4) - //FIXME works on g3, but other should send exif data... + /* FIXME works on g3, but other should send exif data... */ doff = exif_get_long (d + offset + 8, order)-0x3B0 ; else doff = offset + 8; @@ -180,7 +180,7 @@ unsigned int size_exif) { MNoteCanonData *data = (MNoteCanonData *) ne; - + const unsigned char *d = d_exif; ExifData *ed = NULL; ExifEntry *e = NULL; @@ -190,19 +190,19 @@ unsigned int size = size_exif; MNoteCanonEntry *entry; MNoteCanonTag tag; - + if (!data) return; if (!d_exif || !size_exif) return; - + /* If we got EXIF data, go to the MakerNote tag. */ ed = exif_data_new_from_data (d_exif, size); if (ed) { e = exif_content_get_entry (ed->ifd[EXIF_IFD_EXIF], EXIF_TAG_MAKER_NOTE); if (e) - { + { d = e->data; size = e->size; order = exif_data_get_byte_order (ed); @@ -211,13 +211,13 @@ #endif } } - + mnote_data_set_byte_order (ne,order); #ifdef DEBUG printf ("Parsing %i byte(s) Mnote data...\n", size); #endif -#ifdef DEBUG +#ifdef DEBUG int j; for (j=0;j<size;j++) { @@ -226,57 +226,57 @@ printf("\n%d\n",size); printf("%d\n",order); -#endif - +#endif + /* Read the number of entries */ n = exif_get_short (d ,order); #ifdef DEBUG printf ("Loading %i entries...\n", n); -#endif +#endif d+=2; size-=2; - + if ( 12 * n > size ) - return; - + return; + for (i = 0; i < n; i++) { tag = exif_get_short (d + 12 * i, order); #ifdef DEBUG printf ("Loading entry '%s' (%i of %i)...\n", mnote_canon_tag_get_name (tag), i + 1, n); -#endif +#endif entry = mnote_canon_entry_new (); mnote_canon_data_add_entry (data, entry); - if (e) //we have exif data + if (e) /* we have exif data */ mnote_canon_data_load_data_entry_with_exif (data, entry, - d, size, 12 * i, + d, size, 12 * i, d_exif, size_exif); else mnote_canon_data_load_data_entry (data, entry, d, size, 12 * i); - mnote_canon_entry_unref (entry); + mnote_canon_entry_unref (entry); } exif_data_unref (ed); } -static unsigned int +static unsigned int mnote_canon_get_count (MNoteData *n) { MNoteCanonData *note = (MNoteCanonData *) n; - + return (note->count); } -static MNoteEntry * +static MNoteEntry * mnote_canon_get_entry (MNoteData *n, MNoteTag t) { MNoteCanonData *note = (MNoteCanonData *) n; MNoteCanonTag tag = (MNoteCanonTag) t; unsigned int i; MNoteEntry *entry = NULL; - + for (i = 0; !entry && i < note->count; i++) { if (note->entries[i]->tag == tag) { entry = note->entries[i]; @@ -321,6 +321,6 @@ ((MNoteData *) note)->methods.get_tag_description = mnote_canon_tag_get_description; ((MNoteData *) note)->methods.get_value = mnote_canon_data_get_value; ((MNoteData *) note)->methods.dump_entry = mnote_canon_entry_dump; - + return ((MNoteData *) note); } Index: mnote-canon-entry.c =================================================================== RCS file: /cvsroot/libexif/libmnote/libmnote/canon/mnote-canon-entry.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- mnote-canon-entry.c 29 Aug 2003 11:18:21 -0000 1.7 +++ mnote-canon-entry.c 17 Sep 2003 11:25:59 -0000 1.8 @@ -8,10 +8,10 @@ * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. + * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the @@ -31,7 +31,7 @@ #include <libexif/exif-format.h> #include <libexif/exif-utils.h> -//#define DEBUG +/* #define DEBUG */ struct _MNoteCanonEntryPrivate { unsigned int ref_count; @@ -171,8 +171,8 @@ order = mnote_data_get_byte_order ((MNoteData *) &entry->parent->parent); #ifdef DEBUG printf ("Processing Tag %x\n",entry->tag); -#endif - switch (entry->tag) { +#endif + switch (entry->tag) { case MNOTE_CANON_TAG_SETTINGS_1: CF (entry->format, EXIF_FORMAT_SHORT, v); n = exif_get_short (data, order)/2; @@ -181,7 +181,7 @@ #ifdef DEBUG printf ("Setting1 size %d %d\n",n,entry->size); #endif - for (i=1;i<n;i++) + for (i=1;i<n;i++) { vs = exif_get_short (data, order); data+=2; @@ -199,7 +199,7 @@ snprintf (buf, sizeof (buf), "%i???", vs); strncat (v,buf, sizeof (v) - 1 - strlen(v)); } - break; + break; case 2: if (vs) { @@ -233,7 +233,7 @@ break; case 16: strncat (v, _("external"), sizeof (v) - 1 - strlen(v)); - break; + break; default: snprintf (buf, sizeof (buf), "%i???", vs); strncat (v,buf, sizeof (v) - 1 - strlen(v)); @@ -276,12 +276,12 @@ break; case 6: strncat (v, _("MF"), sizeof (v) - 1 - strlen(v)); - break; + break; default: snprintf (buf, sizeof (buf), "%i???", vs); strncat (v,buf, sizeof (v) - 1 - strlen(v)); } - break; + break; case 10: strncat (v, _(" / Image size : "), sizeof (v) - 1 - strlen(v)); switch (vs) { @@ -337,7 +337,7 @@ break; case 11: strncat (v, _("Pan Focus"), sizeof (v) - 1 - strlen(v)); - break; + break; default: snprintf (buf, sizeof (buf), "%i???", vs); strncat (v,buf, sizeof (v) - 1 - strlen(v)); @@ -413,7 +413,7 @@ break; case 19: strncat (v, _("400"), sizeof (v) - 1 - strlen(v)); - break; + break; default: snprintf (buf, sizeof (buf), "%i???", vs); strncat (v,buf, sizeof (v) - 1 - strlen(v)); @@ -480,7 +480,7 @@ break; case 5: strncat (v, _("A-DEP"), sizeof (v) - 1 - strlen(v)); - break; + break; default: snprintf (buf, sizeof (buf), "%i???", vs); strncat (v,buf, sizeof (v) - 1 - strlen(v)); @@ -493,7 +493,7 @@ case 24: snprintf (buf, sizeof (buf), " / %s : %u", _("short focal length of lens (in focal units)"), vs); strncat (v,buf, sizeof (v) - 1 - strlen(v)); - break; + break; case 25: snprintf (buf, sizeof (buf), " / %s : %u", _("focal units per mm"), vs); strncat (v,buf, sizeof (v) - 1 - strlen(v)); @@ -508,7 +508,7 @@ strncat (v, _("FP sync used"), sizeof (v) - 1 - strlen(v)); if ((vs>>4)&1) strncat (v, _("FP sync enabled"), sizeof (v) - 1 - strlen(v)); -#ifdef DEBUG +#ifdef DEBUG printf ("Value29=0x%08x\n", vs); #endif break; @@ -527,15 +527,15 @@ strncat (v,buf, sizeof (v) - 1 - strlen(v)); } break; -#ifdef DEBUG - default: +#ifdef DEBUG + default: printf ("Value%d=%d\n", i, vs); #endif } - } - + } + break; - + case MNOTE_CANON_TAG_SETTINGS_2: CF (entry->format, EXIF_FORMAT_SHORT, v); n = exif_get_short (data, order)/2; @@ -544,7 +544,7 @@ #ifdef DEBUG printf ("Setting2 size %d %d\n",n,entry->size); #endif - for (i=1;i<n;i++) + for (i=1;i<n;i++) { vs = exif_get_short (data, order); data+=2; @@ -572,7 +572,7 @@ break; case 6: strncat (v, _("Custom"), sizeof (v) - 1 - strlen(v)); - break; + break; default: snprintf (buf, sizeof (buf), "%i???", vs); strncat (v,buf, sizeof (v) - 1 - strlen(v)); @@ -581,7 +581,7 @@ case 9: snprintf (buf, sizeof (buf), " / %s : %u", _("Sequence number"), vs); strncat (v, buf, sizeof (v) - 1 - strlen(v)); - + break; case 14: if (vs>>12) @@ -596,60 +596,60 @@ snprintf (buf, sizeof (buf), " (%u %s)", vs>>12, _("available focus point")); strncat (v, buf, sizeof (v) - 1 - strlen(v)); } -#ifdef DEBUG +#ifdef DEBUG printf ("0x%08x\n", vs); #endif break; case 15: snprintf (buf, sizeof (buf), " / %s : %.2f EV", _("Flash bias"), vs/32.0); strncat (v, buf, sizeof (v) - 1 - strlen(v)); - + break; case 19: snprintf (buf, sizeof (buf), " / %s : %u", _("Subject Distance (mm)"), vs); strncat (v,buf, sizeof (v) - 1 - strlen(v)); - break; + break; #ifdef DEBUG default: printf ("Value%d=%d\n", i, vs); #endif } - } - + } + break; - + case MNOTE_CANON_TAG_IMAGE_TYPE: CF (entry->format, EXIF_FORMAT_ASCII, v); CC (entry->components, 32, v); strncpy (v,data,sizeof (v)); break; - + case MNOTE_CANON_TAG_FIRMWARE: CF (entry->format, EXIF_FORMAT_ASCII, v); CC (entry->components, 24, v); strncpy (v,data,sizeof (v)); break; - + case MNOTE_CANON_TAG_IMAGE_NUMBER: CF (entry->format, EXIF_FORMAT_LONG, v); CC (entry->components, 1, v); vl = exif_get_long (data, order); snprintf (v, sizeof (v), "%03lu-%04lu", vl/10000,vl%10000); break; - + case MNOTE_CANON_TAG_OWNER: CF (entry->format, EXIF_FORMAT_ASCII, v); CC (entry->components, 32, v); strncpy (v,data,sizeof (v)); break; - + case MNOTE_CANON_TAG_SERIAL_NUMBER: CF (entry->format, EXIF_FORMAT_LONG, v); CC (entry->components, 1, v); vl = exif_get_long (data, order); snprintf (v, sizeof (v), "%04X-%05d", (int)vl>>16,(int)vl&0xffff); break; - + case MNOTE_CANON_TAG_CUSTOM_FUNCS: CF (entry->format, EXIF_FORMAT_SHORT, v); n = exif_get_short (data, order)/2; @@ -658,13 +658,13 @@ #ifdef DEBUG printf ("Custom Function size %d %d\n",n,entry->size); #endif - for (i=1;i<n;i++) + for (i=1;i<n;i++) { vs = exif_get_short (data, order); data += 2; snprintf (buf, sizeof(buf), "C.F%d : %u", i, vs); strncat (v,buf, sizeof (v) - 1 - strlen(v)); - } + } break; default: @@ -685,7 +685,7 @@ strncpy (v, data, sizeof (v)); #endif break; - } - + } + return strdup (v); } |