summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Luu <tluu@ti.com>2011-11-17 19:34:29 -0600
committerIliyan Malchev <malchev@google.com>2011-11-22 09:31:41 -0800
commit658ad712aea2756b797d1042b3b4171fccdc5ecf (patch)
tree2a344ead46cf73459d9a08d9eb3b31aea43e0247
parent56c2f1eebaaa22c7b7531c42cbe22b41f3d158c9 (diff)
downloadjhead-658ad712aea2756b797d1042b3b4171fccdc5ecf.tar.gz
jhead: Add handling for short tags with unknown length
Part of the fix for b/5582076 SHORT tags with a variable length need to be places in the data write section. Fixes issue with ISOSpeedRating not being inserted correctly. Change-Id: I9b1810de9102f2e2d63eca1a90547aba7e18a0d7 Signed-off-by: Tyler Luu <tluu@ti.com> Signed-off-by: Iliyan Malchev <malchev@google.com>
-rw-r--r--exif.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/exif.c b/exif.c
index 60aec70..4cabb6a 100644
--- a/exif.c
+++ b/exif.c
@@ -1134,7 +1134,9 @@ static void writeExifTagAndData(int tag,
Put32u(Buffer+(*DirIndex) + 8, (*DataWriteIndex)-8); // Pointer
char* curElement = strtok((char*)value, ",");
int i;
- for (i = 0; i < components && curElement != NULL; i++) {
+
+ // (components == -1) Need to handle lists with unknown length too
+ for (i = 0; ((i < components) || (components == -1)) && curElement != NULL; i++) {
#ifdef SUPERDEBUG
printf("processing component %s format %s", curElement, formatStr(format));
#endif
@@ -1157,6 +1159,11 @@ static void writeExifTagAndData(int tag,
Put32u(Buffer+(*DataWriteIndex) + 4, denominator);
(*DataWriteIndex) += 8;
}
+ } else if ((components == -1) && ((format == FMT_USHORT) || (format == FMT_SSHORT))) {
+ // variable components need to go into data write area
+ value = atoi(curElement);
+ Put16u(Buffer+(*DataWriteIndex), value);
+ (*DataWriteIndex) += 4;
} else {
// TODO: doesn't handle multiple components yet -- if more than one, have to put in data write area.
value = atoi(curElement);