Package: src:imagemagick Severity: wishlist Tags: patch Dear Maintainer,
while building the package for i386 (as the current version failed on the buildds some time ago), I noticed there are some C warnings while building the code. These are some format warnings, some pointer casts and an erroneous use of sizeof in random.c. Please, look at it and maybe apply the attached patch. Regards Jiri Palecek
Index: imagemagick-6.9.9.39+dfsg/coders/pgx.c =================================================================== --- imagemagick-6.9.9.39+dfsg.orig/coders/pgx.c +++ imagemagick-6.9.9.39+dfsg/coders/pgx.c @@ -365,7 +365,7 @@ static MagickBooleanType WritePGXImage(c status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); if (status == MagickFalse) return(status); - (void) FormatLocaleString(buffer,MaxTextExtent,"PG ML + %ld %lu %lu\n", + (void) FormatLocaleString(buffer,MaxTextExtent,"PG ML + %zd %zu %zu\n", image->depth,image->columns,image->rows); (void) WriteBlob(image,strlen(buffer),(unsigned char *) buffer); (void) TransformImageColorspace(image,sRGBColorspace); Index: imagemagick-6.9.9.39+dfsg/coders/svg.c =================================================================== --- imagemagick-6.9.9.39+dfsg.orig/coders/svg.c +++ imagemagick-6.9.9.39+dfsg/coders/svg.c @@ -2915,11 +2915,11 @@ static Image *ReadSVGImage(const ImageIn image->x_resolution,image->y_resolution); (void) FormatLocaleString(background,MaxTextExtent, "rgb(%.20g%%,%.20g%%,%.20g%%)", - 100.0*QuantumScale*image->background_color.red, - 100.0*QuantumScale*image->background_color.green, - 100.0*QuantumScale*image->background_color.blue); - (void) FormatLocaleString(opacity,MaxTextExtent,"%.20g",QuantumScale* - (QuantumRange-image->background_color.opacity)); + (double)(100.0*QuantumScale*image->background_color.red), + (double)(100.0*QuantumScale*image->background_color.green), + (double)(100.0*QuantumScale*image->background_color.blue)); + (void) FormatLocaleString(opacity,MaxTextExtent,"%.20g",(double)(QuantumScale* + (QuantumRange-image->background_color.opacity))); (void) FormatLocaleString(command,MaxTextExtent,GetDelegateCommands( delegate_info),input_filename,output_filename,density,background, opacity,unique); Index: imagemagick-6.9.9.39+dfsg/magick/color.c =================================================================== --- imagemagick-6.9.9.39+dfsg.orig/magick/color.c +++ imagemagick-6.9.9.39+dfsg/magick/color.c @@ -1200,7 +1200,7 @@ MagickExport void ConcatenateColorCompon if (channel == OpacityChannel) { (void) FormatLocaleString(component,MaxTextExtent,"%.*g", - GetMagickPrecision(),QuantumScale*ClampToQuantum(color)); + GetMagickPrecision(),(double)(QuantumScale*ClampToQuantum(color))); (void) ConcatenateMagickString(tuple,component,MaxTextExtent); return; } Index: imagemagick-6.9.9.39+dfsg/magick/effect.c =================================================================== --- imagemagick-6.9.9.39+dfsg.orig/magick/effect.c +++ imagemagick-6.9.9.39+dfsg/magick/effect.c @@ -3391,10 +3391,10 @@ MagickExport Image *RotationalBlurImageC if ((cos_theta == (MagickRealType *) NULL) || (sin_theta == (MagickRealType *) NULL)) { - if (cos_theta != (double *) NULL) - cos_theta=(double *) RelinquishMagickMemory(cos_theta); - if (sin_theta != (double *) NULL) - sin_theta=(double *) RelinquishMagickMemory(sin_theta); + if (cos_theta != (MagickRealType *) NULL) + cos_theta=(MagickRealType *) RelinquishMagickMemory(cos_theta); + if (sin_theta != (MagickRealType *) NULL) + sin_theta=(MagickRealType *) RelinquishMagickMemory(sin_theta); blur_image=DestroyImage(blur_image); ThrowImageException(ResourceLimitError,"MemoryAllocationFailed"); } Index: imagemagick-6.9.9.39+dfsg/magick/magick-type.h =================================================================== --- imagemagick-6.9.9.39+dfsg.orig/magick/magick-type.h +++ imagemagick-6.9.9.39+dfsg/magick/magick-type.h @@ -67,7 +67,11 @@ typedef ssize_t SignedQuantum; #if defined(MAGICKCORE_HDRI_SUPPORT) typedef MagickFloatType Quantum; #define QuantumRange 255.0 +#if MAGICKCORE_SIZEOF_DOUBLE_T == 0 || (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_DOUBLE) #define QuantumFormat "%g" +#elif (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_LONG_DOUBLE) +#define QuantumFormat "%Lg" +#endif #else typedef unsigned char Quantum; #define QuantumRange ((Quantum) 255) @@ -80,7 +84,11 @@ typedef ssize_t SignedQuantum; #if defined(MAGICKCORE_HDRI_SUPPORT) typedef MagickFloatType Quantum; #define QuantumRange 65535.0 +#if MAGICKCORE_SIZEOF_DOUBLE_T == 0 || (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_DOUBLE) #define QuantumFormat "%g" +#elif (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_LONG_DOUBLE) +#define QuantumFormat "%Lg" +#endif #else typedef unsigned short Quantum; #define QuantumRange ((Quantum) 65535) @@ -93,7 +101,11 @@ typedef MagickDoubleType SignedQuantum; #if defined(MAGICKCORE_HDRI_SUPPORT) typedef MagickDoubleType Quantum; #define QuantumRange 4294967295.0 +#if MAGICKCORE_SIZEOF_DOUBLE_T == 0 || (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_DOUBLE) #define QuantumFormat "%g" +#elif (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_LONG_DOUBLE) +#define QuantumFormat "%Lg" +#endif #else typedef unsigned int Quantum; #define QuantumRange ((Quantum) 4294967295) @@ -106,7 +118,11 @@ typedef unsigned int Quantum; typedef MagickDoubleType SignedQuantum; typedef MagickDoubleType Quantum; #define QuantumRange 18446744073709551615.0 +#if MAGICKCORE_SIZEOF_DOUBLE_T == 0 || (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_DOUBLE) #define QuantumFormat "%g" +#elif (MAGICKCORE_SIZEOF_DOUBLE_T == MAGICKCORE_SIZEOF_LONG_DOUBLE) +#define QuantumFormat "%Lg" +#endif #else #if !defined(_CH_) # error "MAGICKCORE_QUANTUM_DEPTH must be one of 8, 16, 32, or 64" Index: imagemagick-6.9.9.39+dfsg/magick/random.c =================================================================== --- imagemagick-6.9.9.39+dfsg.orig/magick/random.c +++ imagemagick-6.9.9.39+dfsg/magick/random.c @@ -237,7 +237,7 @@ MagickExport RandomInfo *AcquireRandomIn digest=GetSignatureDigest(signature_info); (void) memcpy(random_info->seed,GetStringInfoDatum(digest), MagickMin(GetSignatureDigestsize(signature_info), - sizeof(*random_info->seed))); + sizeof(random_info->seed))); signature_info=DestroySignatureInfo(signature_info); } random_info->seed[1]=0x50a7f451UL; @@ -282,7 +282,7 @@ MagickExport RandomInfo *DestroyRandomIn if (random_info->signature_info != (SignatureInfo *) NULL) random_info->signature_info=DestroySignatureInfo( random_info->signature_info); - (void) memset(random_info->seed,0,sizeof(*random_info->seed)); + (void) memset(random_info->seed,0,sizeof(random_info->seed)); random_info->signature=(~MagickCoreSignature); UnlockSemaphoreInfo(random_info->semaphore); DestroySemaphoreInfo(&random_info->semaphore);
-- System Information: Debian Release: buster/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'unstable'), (1, 'experimental-debug'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 4.17.0-rc3-686-pae (SMP w/2 CPU cores) Locale: LANG=cs_CZ, LC_CTYPE=cs_CZ (charmap=ISO-8859-2), LANGUAGE=cs_CZ (charmap=ISO-8859-2) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system)