GraphicsMagick: oders/tiff.c: Copy uint16_t EXIF arrays.
GraphicsMagick Commits <[email protected]> Tue, 23 Jan 2024 16:25:56 -0600
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.5517.1706048772.19238.graphicsmagick-commit@lists.sourceforge.net> |
changeset 60db14ad87f1 in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=60db14ad87f1 summary: oders/tiff.c: Copy uint16_t EXIF arrays. diffstat: ChangeLog | 4 ++++ coders/tiff.c | 34 ++++++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 4 deletions(-) diffs (69 lines): diff -r b56492d98281 -r 60db14ad87f1 ChangeLog --- a/ChangeLog Sun Jan 21 16:48:26 2024 -0600 +++ b/ChangeLog Tue Jan 23 23:25:33 2024 +0100 @@ -1,3 +1,7 @@ +2024-01-23 Fojtik Jaroslav <[email protected]> + + coders/tiff.c: Copy uint16_t EXIF arrays. + 2024-01-20 Fojtik Jaroslav <[email protected]> coders/tiff.c: Do not copy TIFFTAG_XRESOLUTION & TIFFTAG_YRESOLUTION diff -r b56492d98281 -r 60db14ad87f1 coders/tiff.c --- a/coders/tiff.c Sun Jan 21 16:48:26 2024 -0600 +++ b/coders/tiff.c Tue Jan 23 23:25:33 2024 +0100 @@ -4473,7 +4473,6 @@ if(*profile_data!='I') return 0; LD_UINT32 = LD_UINT32_LO; LD_UINT16 = LD_UINT16_LO; - } do @@ -4540,16 +4539,43 @@ FieldCount++; } break; + + case TIFF_SHORT: + if(WriteCount!=1) + { + uint16_t *Array; + uint32_t i; + if(FDT!=Field) break; /* Incompatible array type, might be converted in future. */ + if(WriteCount!=TIFF_VARIABLE && WriteCount!=TIFF_VARIABLE2) + break; /* Fixed size arrays not handled. */ + if(Value+2*Long2>=profile_length-1) break; + if(Long2==0) break; + Array = (uint16_t *)malloc(2*Long2); + if(Array==NULL) break; + for(i=0; i<Long2;i++) + Array[i] = LD_UINT16(profile_data+Value+2*i); + if(WriteCount==TIFF_VARIABLE) + { + if(TIFFSetField(tiff, Tag, (int)Long2, Array)) /* Argument 3 type int. */ + FieldCount++; + } else if(WriteCount==TIFF_VARIABLE2) + { + if(TIFFSetField(tiff, Tag, Long2, Array)) /* Argument 3 type uint32_t. */ + FieldCount++; + } + free(Array); + break; + } + goto Scalar; + case TIFF_BYTE: - case TIFF_SHORT: case TIFF_LONG: if(WriteCount!=1) break; - if(FDT==TIFF_SHORT) +Scalar: if(FDT==TIFF_SHORT) { if(TIFFSetField(tiff, Tag, (unsigned)Value & 0xFFFF)) FieldCount++; - break; } if(FDT!=TIFF_BYTE && FDT!=TIFF_LONG) break;