Skip to content

Commit

Permalink
eliminate coverity defects
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Apr 16, 2022
1 parent 83bd597 commit 68fe465
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Magick++/lib/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3119,7 +3119,7 @@ void Magick::Image::fontTypeMetricsMultiline(const std::string &text_,

drawInfo=options()->drawInfo();
drawInfo->text=const_cast<char *>(text_.c_str());
GetMultilineTypeMetrics(image(),drawInfo,&(metrics->_typeMetric));
(void) GetMultilineTypeMetrics(image(),drawInfo,&(metrics->_typeMetric));
drawInfo->text=0;
}

Expand Down
2 changes: 1 addition & 1 deletion coders/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ static MagickBooleanType EncodeImageAttributes(Image *image,FILE *file)
JSONFormatLocaleFile(file," \"baseType\": %s,\n",
CommandOptionToMnemonic(MagickTypeOptions,(ssize_t) image->type));
if (version < 1.0)
JSONFormatLocaleFile(file," \"endianness\": %s,\n",
JSONFormatLocaleFile(file," \"endianess\": %s,\n",
CommandOptionToMnemonic(MagickEndianOptions,(ssize_t) image->endian));
else
JSONFormatLocaleFile(file," \"endianness\": %s,\n",
Expand Down
6 changes: 3 additions & 3 deletions coders/tiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -2790,13 +2790,13 @@ static MagickBooleanType GetTIFFInfo(const ImageInfo *image_info,TIFF *tiff,
extent;

uint32
rows,
rows_per_strip;
rows = 0,
rows_per_strip = 0;

extent=TIFFScanlineSize(tiff);
rows_per_strip=TIFFStripSizeDefault/(extent == 0 ? 1 : (uint32) extent);
rows_per_strip=16*(((rows_per_strip < 16 ? 16 : rows_per_strip)+1)/16);
TIFFGetField(tiff,TIFFTAG_IMAGELENGTH,&rows);
(void) TIFFGetField(tiff,TIFFTAG_IMAGELENGTH,&rows);
if (rows_per_strip > rows)
rows_per_strip=rows;
option=GetImageOption(image_info,"tiff:rows-per-strip");
Expand Down
7 changes: 5 additions & 2 deletions coders/webp.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,12 +867,15 @@ static MagickBooleanType WriteAnimatedWEBPImage(const ImageInfo *image_info,
WebPPicture
picture;

image=CoalesceImages(image, exception);
if (image == (Image *) NULL)
return(MagickFalse);
first_image=image;

WebPAnimEncoderOptionsInit(&enc_options);
if (image_info->verbose)
enc_options.verbose = 1;

image=CoalesceImages(image, exception);
first_image=image;
enc=WebPAnimEncoderNew((int) image->page.width,(int) image->page.height,
&enc_options);

Expand Down
2 changes: 2 additions & 0 deletions magick/attribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ static double GetEdgeBackgroundFactor(const Image *image,
break;
}
}
if (p == (const PixelPacket *) NULL)
return(0.0);
GetMagickPixelPacket(image,&background);
SetMagickPixelPacket(image,p,(IndexPacket *) NULL,&background);
artifact=GetImageArtifact(image,"background");
Expand Down
5 changes: 4 additions & 1 deletion magick/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@ MagickExport void ClonePixelCacheMethods(Cache clone,const Cache cache)
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
%
% ClonePixelCacheRepository() clones the source pixel cache to the destination
% cache.
%
Expand Down Expand Up @@ -4310,7 +4311,9 @@ MagickExport MagickBooleanType PersistPixelCache(Image *image,
clone_info->length=cache_info->length;
clone_info->channels=cache_info->channels;
clone_info->offset=(*offset);
status=ClonePixelCacheRepository(clone_info,cache_info,exception);
status=OpenPixelCacheOnDisk(clone_info,WriteMode);
if (status != MagickFalse)
status=ClonePixelCacheRepository(clone_info,cache_info,exception);
*offset+=cache_info->length+page_size-(cache_info->length % page_size);
clone_info=(CacheInfo *) DestroyPixelCache(clone_info);
return(status);
Expand Down
2 changes: 2 additions & 0 deletions magick/geometry.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ MagickExport MagickStatusType GetGeometry(const char *geometry,ssize_t *x,
{
if (*(p+1) == ')')
return(flags);
(void) CopyMagickString(p,p+1,MaxTextExtent);
break;
}
case ')':
{
Expand Down
8 changes: 2 additions & 6 deletions magick/statistic.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,8 @@ static MagickRealType ApplyEvaluateOperator(RandomInfo *random_info,
}
case PowEvaluateOperator:
{
if (pixel < 0)
result=(MagickRealType) -(QuantumRange*pow((double) -(QuantumScale*
pixel),(double) value));
else
result=(MagickRealType) (QuantumRange*pow((double) (QuantumScale*pixel),
(double) value));
result=(MagickRealType) (QuantumRange*pow((double) (QuantumScale*pixel),
(double) value));
break;
}
case RightShiftEvaluateOperator:
Expand Down

0 comments on commit 68fe465

Please sign in to comment.