From: Jan P. <pa...@us...> - 2004-04-02 16:08:00
|
Update of /cvsroot/libexif/libexif/libexif/pentax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15901 Modified Files: mnote-pentax-entry.c Log Message: A few changes & fixes of the code compaction dated 2004-03-15: 1) maxlen instead of maxlen-1 (it has been decreased by one for that reason) 2) items[i].elem[j] searched while items[i].elem[j].string is not NULL and not index (nothing would have been found) 3) MNOTE_PENTAX_TAG_ISO_SPEED: value of 100: used to get printed as "100", now it was unknown value -> added to items.elem I am afraid 200 would also have the same problem (I don't have any sample file) -> also added to items.elem 4) items.elem[10] -> items.elem[7]: 7 is enough, less static memory & smaller executable Index: mnote-pentax-entry.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/pentax/mnote-pentax-entry.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- mnote-pentax-entry.c 15 Mar 2004 21:42:20 -0000 1.3 +++ mnote-pentax-entry.c 2 Apr 2004 15:55:51 -0000 1.4 @@ -59,7 +59,7 @@ struct { int index; const char *string; - } elem[10]; + } elem[7]; } items[] = { { MNOTE_PENTAX_TAG_MODE, { {0, N_("Auto")}, @@ -104,9 +104,11 @@ {2, N_("High")}, {0, NULL}}}, { MNOTE_PENTAX_TAG_ISO_SPEED, - { {10, N_("100")}, - {16, N_("200")}, - { 0, NULL}}}, + { {10, N_("100")}, + {16, N_("200")}, + {100, N_("100")}, + {200, N_("200")}, + { 0, NULL}}}, { MNOTE_PENTAX_TAG_COLOR, { {1, N_("Full")}, {2, N_("Black & White")}, @@ -145,19 +147,19 @@ /* search the tag */ for (i = 0; (items[i].tag && items[i].tag != entry->tag); i++); if (!items[i].tag) { - strncpy (val, "Internal error", maxlen - 1); + strncpy (val, "Internal error", maxlen); break; } /* find the value */ - for (j = 0; items[i].elem[j].index && + for (j = 0; items[i].elem[j].string && (items[i].elem[j].index < vs); j++); if (items[i].elem[j].index != vs) { - snprintf (val, maxlen - 1, + snprintf (val, maxlen, "Internal error (unknown value %i)", vs); break; } - snprintf (val, maxlen - 1, items[i].elem[j].string); + snprintf (val, maxlen, items[i].elem[j].string); break; case MNOTE_PENTAX_TAG_ZOOM: |