From: Yoshihiro Yamazaki Date: Wed, 13 Feb 2019 02:30:00 +0000 (+0900) Subject: fit the coding style around. (bmp) X-Git-Tag: 7.0.8-28~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fb307679b692dcfcdb2f11ce1ea45e3eddcc3a80;p=imagemagick fit the coding style around. (bmp) ref) https://github.com/ImageMagick/ImageMagick/pull/1467 --- diff --git a/coders/bmp.c b/coders/bmp.c index 498b55418..bcbb1506b 100644 --- a/coders/bmp.c +++ b/coders/bmp.c @@ -2244,14 +2244,14 @@ static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image, profile_data=0; profile_size=0; profile_size_pad=0; - if (profile) { - profile_data=(MagickOffsetType) bmp_info.file_size-14; /* from head of BMP info header */ - profile_size=(MagickOffsetType) GetStringInfoLength(profile); - if (profile_size%4) { - profile_size_pad=4-(profile_size%4); + if (profile != (StringInfo *) NULL) + { + profile_data=(MagickOffsetType) bmp_info.file_size-14; /* from head of BMP info header */ + profile_size=(MagickOffsetType) GetStringInfoLength(profile); + if ((profile_size % 4) > 0) + profile_size_pad=4-(profile_size%4); + bmp_info.file_size+=profile_size+profile_size_pad; } - bmp_info.file_size+=profile_size+profile_size_pad; - } (void) WriteBlob(image,2,(unsigned char *) "BM"); (void) WriteBlobLSBLong(image,bmp_info.file_size); (void) WriteBlobLSBLong(image,bmp_info.ba_offset); /* always 0 */ @@ -2294,11 +2294,10 @@ static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image, (void) WriteBlobLSBLong(image,bmp_info.green_mask); (void) WriteBlobLSBLong(image,bmp_info.blue_mask); (void) WriteBlobLSBLong(image,bmp_info.alpha_mask); - if (profile) { + if (profile != (StringInfo *) NULL) (void) WriteBlobLSBLong(image,0x4D424544U); /* PROFILE_EMBEDDED */ - } else { + else (void) WriteBlobLSBLong(image,0x73524742U); /* sRGB */ - } (void) WriteBlobLSBLong(image,(unsigned int) (image->chromaticity.red_primary.x*0x40000000)); (void) WriteBlobLSBLong(image,(unsigned int) @@ -2414,15 +2413,15 @@ static MagickBooleanType WriteBMPImage(const ImageInfo *image_info,Image *image, (void) LogMagickEvent(CoderEvent,GetMagickModule(), " Pixels: %u bytes",bmp_info.image_size); (void) WriteBlob(image,(size_t) bmp_info.image_size,pixels); - if (profile) { - if (image->debug != MagickFalse) - (void) LogMagickEvent(CoderEvent,GetMagickModule(), - " Profile: %g bytes",(double) profile_size+profile_size_pad); - (void) WriteBlob(image,(size_t) profile_size,GetStringInfoDatum(profile)); - if (profile_size_pad) { /* padding for 4 bytes multiple */ - (void) WriteBlob(image,(size_t) profile_size_pad,"\0\0\0"); + if (profile != (StringInfo *) NULL) + { + if (image->debug != MagickFalse) + (void) LogMagickEvent(CoderEvent,GetMagickModule(), + " Profile: %g bytes",(double) profile_size+profile_size_pad); + (void) WriteBlob(image,(size_t) profile_size,GetStringInfoDatum(profile)); + if (profile_size_pad > 0) /* padding for 4 bytes multiple */ + (void) WriteBlob(image,(size_t) profile_size_pad,"\0\0\0"); } - } pixel_info=RelinquishVirtualMemory(pixel_info); if (GetNextImageInList(image) == (Image *) NULL) break;