diff options
author | Andrey Kiselev <dron@ak4719.spb.edu> | 2005-07-25 14:22:27 +0000 |
---|---|---|
committer | Andrey Kiselev <dron@ak4719.spb.edu> | 2005-07-25 14:22:27 +0000 |
commit | f65a681de262df7ca4504548fd6de95acac06de7 (patch) | |
tree | 1d59cb6c4b5b73c2c00dd97048ded66584d04bd6 | |
parent | 7f535ed3f15232b34dca345b558274c7962bd514 (diff) | |
download | libtiff-git-f65a681de262df7ca4504548fd6de95acac06de7.tar.gz |
Fixed printing of the BYTE and SBYTE arrays.
-rw-r--r-- | libtiff/tif_print.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/libtiff/tif_print.c b/libtiff/tif_print.c index a4fa6710..0147ff0e 100644 --- a/libtiff/tif_print.c +++ b/libtiff/tif_print.c @@ -1,4 +1,4 @@ -/* $Id: tif_print.c,v 1.26 2005-07-06 11:23:55 dron Exp $ */ +/* $Id: tif_print.c,v 1.27 2005-07-25 14:22:27 dron Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -466,8 +466,10 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags) _TIFFDataSize(fip->field_type) * value_count); mem_alloc = 1; - if(TIFFGetField(tif, tag, raw_data) != 1) + if(TIFFGetField(tif, tag, raw_data) != 1) { + _TIFFfree(raw_data); continue; + } } } @@ -475,29 +477,26 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags) for(j = 0; j < value_count; j++) { if(fip->field_type == TIFF_BYTE) - fprintf(fd, "%u", - (unsigned int) ((uint16 *) raw_data)[j]); + fprintf(fd, "%u", ((uint8 *) raw_data)[j]); else if(fip->field_type == TIFF_UNDEFINED) fprintf(fd, "0x%x", (unsigned int) ((unsigned char *) raw_data)[j]); else if(fip->field_type == TIFF_SBYTE) - fprintf(fd, "%d", (int) ((uint16 *) raw_data)[j]); + fprintf(fd, "%d", ((int8 *) raw_data)[j]); else if(fip->field_type == TIFF_SHORT) - fprintf(fd, "%u", - (unsigned int)((unsigned short *) raw_data)[j]); + fprintf(fd, "%u", ((uint16 *) raw_data)[j]); else if(fip->field_type == TIFF_SSHORT) - fprintf(fd, "%d", (int)((short *) raw_data)[j]); + fprintf(fd, "%d", ((int16 *) raw_data)[j]); else if(fip->field_type == TIFF_LONG) fprintf(fd, "%lu", - (unsigned long)((unsigned long *) raw_data)[j]); + (unsigned long)((uint32 *) raw_data)[j]); else if(fip->field_type == TIFF_SLONG) - fprintf(fd, "%ld", (long)((long *) raw_data)[j]); + fprintf(fd, "%ld", (long)((int32 *) raw_data)[j]); else if(fip->field_type == TIFF_RATIONAL || fip->field_type == TIFF_SRATIONAL || fip->field_type == TIFF_FLOAT) fprintf(fd, "%f", ((float *) raw_data)[j]); else if(fip->field_type == TIFF_IFD) - fprintf(fd, "0x%x", - (int)((unsigned long *) raw_data)[j]); + fprintf(fd, "0x%lx", ((uint32 *) raw_data)[j]); else if(fip->field_type == TIFF_ASCII) { fprintf(fd, "%s", (char *) raw_data); break; |