From: cristy Date: Sun, 20 May 2012 16:14:14 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~5563 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=181c99c38ff5a621612dda47a46e7c6866863c3b;p=imagemagick --- diff --git a/coders/mpc.c b/coders/mpc.c index 4b22426ce..a156a73c9 100644 --- a/coders/mpc.c +++ b/coders/mpc.c @@ -1298,20 +1298,24 @@ static MagickBooleanType WriteMPCImage(const ImageInfo *image_info,Image *image, value=GetImageProperty(image,property,exception); if (value != (const char *) NULL) { - for (i=0; i < (ssize_t) strlen(value); i++) + length=strlen(value); + for (i=0; i < (ssize_t) length; i++) if (isspace((int) ((unsigned char) value[i])) != 0) break; - if (i == (ssize_t) strlen(value)) - (void) WriteBlob(image,strlen(value),(const unsigned char *) value); + if (i == (ssize_t) length) + (void) WriteBlob(image,length,(const unsigned char *) value); else { (void) WriteBlobByte(image,'{'); - for (i=0; i < (ssize_t) strlen(value); i++) - { - if (value[i] == (int) '}') - (void) WriteBlobByte(image,'\\'); - (void) WriteBlobByte(image,value[i]); - } + if (strchr(value,'}') == (char *) NULL) + (void) WriteBlob(image,length,(const unsigned char *) value); + else + for (i=0; i < (ssize_t) length; i++) + { + if (value[i] == (int) '}') + (void) WriteBlobByte(image,'\\'); + (void) WriteBlobByte(image,value[i]); + } (void) WriteBlobByte(image,'}'); } }