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 */
(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)
(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;