From 109e557e6e08aa0f8a920137b6dd666172e22d20 Mon Sep 17 00:00:00 2001 From: cristy Date: Thu, 16 Sep 2010 18:38:17 +0000 Subject: [PATCH] --- ChangeLog | 3 +++ coders/jpeg.c | 40 +++++++++++++++++++--------------------- coders/meta.c | 4 ++-- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f5e23dd5..417cbed59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2010-09-16 6.6.4-2 Cristy + * IPTC profile not always wrapped properly inside an 8BIM profile. + 2010-09-15 6.6.4-2 Anthony Thyssen * Rename of SincPolynomial to SincFast for easier user understanding * Ditto for LanczosChebyshev to LanzcosFast diff --git a/coders/jpeg.c b/coders/jpeg.c index b2d768a86..e855783b6 100644 --- a/coders/jpeg.c +++ b/coders/jpeg.c @@ -510,7 +510,7 @@ static boolean ReadIPTCProfile(j_decompress_ptr jpeg_info) ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); p=GetStringInfoDatum(profile); - for (i=(ssize_t) GetStringInfoLength(profile)-1; i >= 0; i--) + for (i=0; i < (ssize_t) GetStringInfoLength(profile); i++) *p++=(unsigned char) GetCharacter(jpeg_info); iptc_profile=(StringInfo *) GetImageProfile(image,"8bim"); if (iptc_profile != (StringInfo *) NULL) @@ -1507,7 +1507,11 @@ static void WriteProfile(j_compress_ptr jpeg_info,Image *image) ResetImageProfileIterator(image); for (name=GetNextImageProfile(image); name != (const char *) NULL; ) { + register unsigned char + *p; + profile=GetImageProfile(image,name); + p=GetStringInfoDatum(custom_profile); if (LocaleCompare(name,"EXIF") == 0) for (i=0; i < (ssize_t) GetStringInfoLength(profile); i+=65533L) { @@ -1521,7 +1525,6 @@ static void WriteProfile(j_compress_ptr jpeg_info,Image *image) *p; tag_length=14; - p=GetStringInfoDatum(custom_profile); (void) CopyMagickMemory(p,ICC_PROFILE,tag_length); for (i=0; i < (ssize_t) GetStringInfoLength(profile); i+=65519L) { @@ -1538,33 +1541,28 @@ static void WriteProfile(j_compress_ptr jpeg_info,Image *image) if (((LocaleCompare(name,"IPTC") == 0) || (LocaleCompare(name,"8BIM") == 0)) && (iptc == MagickFalse)) { - register unsigned char - *p; - size_t roundup; iptc=MagickTrue; - p=GetStringInfoDatum(custom_profile); - if (LocaleNCompare((char *) GetStringInfoDatum(profile),"8BIM",4) == 0) - { - (void) CopyMagickMemory(p,"Photoshop 3.0\0",14); - tag_length=14; - } - else - { - (void) CopyMagickMemory(p,"Photoshop 3.0\08BIM\04\04\0\0\0\0",24); - p[13]=0x00; - p[24]=(unsigned char) (GetStringInfoLength(profile) >> 8); - p[25]=(unsigned char) (GetStringInfoLength(profile) & 0xff); - tag_length=26; - } for (i=0; i < (ssize_t) GetStringInfoLength(profile); i+=65500L) { length=MagickMin(GetStringInfoLength(profile)-i,65500L); roundup=(size_t) (length & 0x01); - (void) CopyMagickMemory(p+tag_length,GetStringInfoDatum(profile)+i, - length); + if (LocaleNCompare((char *) GetStringInfoDatum(profile),"8BIM",4) == 0) + { + (void) memcpy(p,"Photoshop 3.0 ",14); + tag_length=14; + } + else + { + (void) CopyMagickMemory(p,"Photoshop 3.0 8BIM\04\04\0\0\0\0",24); + tag_length=26; + p[24]=(unsigned char) (length >> 8); + p[25]=(unsigned char) (length & 0xff); + } + p[13]=0x00; + (void) memcpy(p+tag_length,GetStringInfoDatum(profile)+i,length); if (roundup != 0) p[length+tag_length]='\0'; jpeg_write_marker(jpeg_info,IPTC_MARKER,GetStringInfoDatum( diff --git a/coders/meta.c b/coders/meta.c index 167708407..b5bafa87f 100644 --- a/coders/meta.c +++ b/coders/meta.c @@ -1307,8 +1307,8 @@ static Image *ReadMETAImage(const ImageInfo *image_info, } AttachBlob(buff->blob,blob,length); /* write out the header - length field patched below */ - (void) WriteBlob(buff,11,(unsigned char *) "8BIM\04\04\0\0\0\0\01"); - (void) WriteBlobByte(buff,0xe0); + (void) WriteBlob(buff,11,(unsigned char *) "8BIM\04\04\0\0\0\0\0"); + (void) WriteBlobByte(buff,0xc6); if (LocaleCompare(image_info->magick,"IPTCTEXT") == 0) { length=(size_t) parse8BIM(image,buff); -- 2.50.1