Skip to content

Commit

Permalink
Coders: eliminate compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Mar 17, 2022
1 parent de6ada9 commit ee332c5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
12 changes: 7 additions & 5 deletions coders/dcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2709,6 +2709,7 @@ typedef struct _DCMInfo
mask,
max_value,
samples_per_pixel,
scale_size,
signed_data,
significant_bits,
width,
Expand Down Expand Up @@ -4017,7 +4018,8 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
ThrowDCMException(CorruptImageError,"InsufficientImageDataInFile");
if (info.scale != (Quantum *) NULL)
info.scale=(Quantum *) RelinquishMagickMemory(info.scale);
info.scale=(Quantum *) AcquireQuantumMemory(MagickMax(length,MaxMap)+1,
info.scale_size=MagickMax(length,MaxMap);
info.scale=(Quantum *) AcquireQuantumMemory(info.scale_size+1,
sizeof(*info.scale));
if (info.scale == (Quantum *) NULL)
ThrowDCMException(ResourceLimitError,"MemoryAllocationFailed");
Expand Down Expand Up @@ -4116,7 +4118,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
index=redmap[i];
if ((info.scale != (Quantum *) NULL) && (index >= 0) &&
(index <= (int) info.scale_size))
(index < (int) info.scale_size))
index=(int) info.scale[index];
image->colormap[i].red=(Quantum) index;
}
Expand All @@ -4125,7 +4127,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
index=greenmap[i];
if ((info.scale != (Quantum *) NULL) && (index >= 0) &&
(index <= (int) info.scale_size))
(index < (int) info.scale_size))
index=(int) info.scale[index];
image->colormap[i].green=(Quantum) index;
}
Expand All @@ -4134,7 +4136,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
index=bluemap[i];
if ((info.scale != (Quantum *) NULL) && (index >= 0) &&
(index <= (int) info.scale_size))
(index < (int) info.scale_size))
index=(int) info.scale[index];
image->colormap[i].blue=(Quantum) index;
}
Expand All @@ -4143,7 +4145,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
{
index=graymap[i];
if ((info.scale != (Quantum *) NULL) && (index >= 0) &&
(index <= (int) info.scale_size))
(index < (int) info.scale_size))
index=(int) info.scale[index];
image->colormap[i].red=(Quantum) index;
image->colormap[i].green=(Quantum) index;
Expand Down
24 changes: 14 additions & 10 deletions coders/tiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,15 @@
# include <zstd.h>
# endif

#if defined(MAGICKCORE_HAVE_STDINT_H) && (TIFFLIB_VERSION >= 20201219)
#if (TIFFLIB_VERSION >= 20201219)
#if defined(MAGICKCORE_HAVE_STDINT_H) || defined(MAGICKCORE_WINDOWS_SUPPORT)
# undef uint16
# define uint16 uint16_t
# undef uint32
# define uint32 uint32_t
# undef uint64
# define uint64 uint64_t
#endif
#endif

/*
Expand Down Expand Up @@ -849,10 +853,10 @@ static tsize_t TIFFReadBlob(thandle_t image,tdata_t data,tsize_t size)
return(count);
}

static int32 TIFFReadPixels(TIFF *tiff,const tsample_t sample,const ssize_t row,
static int TIFFReadPixels(TIFF *tiff,const tsample_t sample,const ssize_t row,
tdata_t scanline)
{
int32
int
status;

status=TIFFReadScanline(tiff,scanline,(uint32) row,sample);
Expand Down Expand Up @@ -2830,18 +2834,14 @@ static MagickBooleanType GetTIFFInfo(const ImageInfo *image_info,TIFF *tiff,
return(MagickTrue);
}

static int32 TIFFWritePixels(TIFF *tiff,TIFFInfo *tiff_info,ssize_t row,
static tmsize_t TIFFWritePixels(TIFF *tiff,TIFFInfo *tiff_info,ssize_t row,
tsample_t sample,Image *image)
{
int32
status;

ssize_t
i;

unsigned char
*p,
*q;
tmsize_t
status;

size_t
number_tiles,
Expand All @@ -2853,6 +2853,10 @@ static int32 TIFFWritePixels(TIFF *tiff,TIFFInfo *tiff_info,ssize_t row,
k,
l;

unsigned char
*p,
*q;

if (TIFFIsTiled(tiff) == 0)
return(TIFFWriteScanline(tiff,tiff_info->scanline,(uint32) row,sample));
/*
Expand Down

0 comments on commit ee332c5

Please sign in to comment.