From: dirk Date: Sat, 16 Nov 2013 16:03:36 +0000 (+0000) Subject: Fixed compiler warnings. X-Git-Tag: 7.0.1-0~3116 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=93b02b797c4127ce2b06dbd3b2d75ecc33fca759;p=imagemagick Fixed compiler warnings. --- diff --git a/MagickCore/compress.c b/MagickCore/compress.c index f8ecb9620..91ff25bf1 100644 --- a/MagickCore/compress.c +++ b/MagickCore/compress.c @@ -693,8 +693,10 @@ MagickExport MagickBooleanType HuffmanEncodeImage(const ImageInfo *image_info, #define OutputBit(count) \ { \ +DisableMSCWarning(4127) \ if (count > 0) \ byte=byte | bit; \ +RestoreMSCWarning \ bit>>=1; \ if ((int) (bit & 0xff) == 0) \ { \ diff --git a/MagickCore/draw.c b/MagickCore/draw.c index af7d11eb7..e43ec5368 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -3819,8 +3819,10 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image, polygon_info=AcquirePolygonThreadSet(draw_info,primitive_info); if (polygon_info == (PolygonInfo **) NULL) return(MagickFalse); +DisableMSCWarning(4127) if (0) DrawBoundingRectangles(image,draw_info,polygon_info[0],exception); +RestoreMSCWarning if (image->debug != MagickFalse) (void) LogMagickEvent(DrawEvent,GetMagickModule()," begin draw-polygon"); fill=(primitive_info->method == FillToBorderMethod) || diff --git a/MagickCore/fx.c b/MagickCore/fx.c index 745a0c6d4..e3baaaf2c 100644 --- a/MagickCore/fx.c +++ b/MagickCore/fx.c @@ -1610,7 +1610,6 @@ static double FxGetSymbol(FxInfo *fx_info,const PixelChannel channel, default: return(0.0); } - return(0.0); } if (LocaleCompare(symbol,"c") == 0) return(QuantumScale*pixel.red); diff --git a/MagickCore/magick.c b/MagickCore/magick.c index 72246fd7d..9bb694992 100644 --- a/MagickCore/magick.c +++ b/MagickCore/magick.c @@ -870,15 +870,8 @@ static MagickBooleanType InitializeMagickList(ExceptionInfo *exception) magick_info->stealth=MagickTrue; status=AddValueToSplayTree(magick_list,magick_info->name,magick_info); if (status == MagickFalse) - { - char - *message; - - message=GetExceptionMessage(errno); - ThrowFatalException(ResourceLimitFatalError, - "MemoryAllocationFailed"); - message=DestroyString(message); - } + ThrowFatalException(ResourceLimitFatalError, + "MemoryAllocationFailed"); #if defined(MAGICKCORE_MODULES_SUPPORT) (void) GetModuleInfo((char *) NULL,exception); #endif @@ -1282,13 +1275,9 @@ MagickExport void MagickCoreGenesis(const char *path, debug; debug=_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); - debug|=_CRTDBG_CHECK_ALWAYS_DF |_CRTDBG_DELAY_FREE_MEM_DF | - _CRTDBG_LEAK_CHECK_DF; - if (0) - { - debug=_CrtSetDbgFlag(debug); - _ASSERTE(_CrtCheckMemory()); - } + debug|=_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_LEAK_CHECK_DF; + debug=_CrtSetDbgFlag(debug); + _ASSERTE(_CrtCheckMemory()); } #endif #endif diff --git a/MagickCore/memory.c b/MagickCore/memory.c index 3da116035..1bc83a6cc 100644 --- a/MagickCore/memory.c +++ b/MagickCore/memory.c @@ -163,14 +163,34 @@ typedef struct _MemoryPool /* Global declarations. */ +#if defined _MSC_VER +static void* MSCMalloc(size_t size) +{ + return malloc(size); +} +static void* MSCRealloc(void* ptr, size_t size) +{ + return realloc(ptr, size); +} +static void MSCFree(void* ptr) +{ + free(ptr); +} +#endif + static MagickMemoryMethods memory_methods = { +#if defined _MSC_VER + (AcquireMemoryHandler) MSCMalloc, + (ResizeMemoryHandler) MSCRealloc, + (DestroyMemoryHandler) MSCFree +#else (AcquireMemoryHandler) malloc, (ResizeMemoryHandler) realloc, (DestroyMemoryHandler) free +#endif }; - #if defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT) static MemoryPool memory_pool; diff --git a/MagickCore/module.c b/MagickCore/module.c index 3f12cbbb3..cad62cdac 100644 --- a/MagickCore/module.c +++ b/MagickCore/module.c @@ -814,7 +814,6 @@ static MagickBooleanType GetMagickModulePath(const char *filename, if (exception->severity < ConfigureError) ThrowFileException(exception,ConfigureWarning,"UnableToOpenModuleFile", path); - return(MagickFalse); #endif return(MagickFalse); } diff --git a/MagickCore/morphology.c b/MagickCore/morphology.c index 06f5ea4c6..0914c1ff6 100644 --- a/MagickCore/morphology.c +++ b/MagickCore/morphology.c @@ -2420,7 +2420,9 @@ static void ExpandRotateKernelInfo(KernelInfo *kernel, const double angle) *last; last = kernel; +DisableMSCWarning(4127) while(1) { +RestoreMSCWarning clone = CloneKernelInfo(last); RotateKernelInfo(clone, angle); if ( SameKernelInfo(kernel, clone) == MagickTrue ) diff --git a/MagickCore/nt-base.c b/MagickCore/nt-base.c index 160c1d56f..4763cb2f8 100644 --- a/MagickCore/nt-base.c +++ b/MagickCore/nt-base.c @@ -236,9 +236,11 @@ BOOL WINAPI DllMain(HINSTANCE handle,DWORD reason,LPVOID lpvReserved) MagickPrivate int Exit(int status) { if (IsWindows95()) - TerminateProcess(GetCurrentProcess(),(unsigned int) status); + { + TerminateProcess(GetCurrentProcess(),(unsigned int) status); + return(0); + } exit(status); - return(0); } #if !defined(__MINGW32__) && !defined(__MINGW64__) diff --git a/MagickCore/property.c b/MagickCore/property.c index c6f16ee96..e39386776 100644 --- a/MagickCore/property.c +++ b/MagickCore/property.c @@ -557,7 +557,7 @@ static inline unsigned short ReadPropertyMSBShort(const unsigned char **p, value; if (*length < 2) - return((unsigned short) ~0UL); + return((unsigned short) ~0); for (i=0; i < 2; i++) { c=(int) (*(*p)++); @@ -3102,6 +3102,7 @@ MagickExport char *GetNextImageProperty(const Image *image) /* common inline code to expand the interpreted text string */ #define ExtendInterpretText(string_length) do { \ +DisableMSCWarning(4127) \ size_t length=(string_length); \ if ((size_t) (q-interpret_text+length+1) >= extent) \ { extent+=length; \ @@ -3110,10 +3111,12 @@ MagickExport char *GetNextImageProperty(const Image *image) if (interpret_text == (char *) NULL) \ return((char *)NULL); \ q=interpret_text+strlen(interpret_text); \ - } } while (0) /* no trailing ; */ + } } while (0) /* no trailing ; */ \ +RestoreMSCWarning /* same but append the given string */ #define AppendString2Text(string) do { \ +DisableMSCWarning(4127) \ size_t length=strlen((string)); \ if ((size_t) (q-interpret_text+length+1) >= extent) \ { extent+=length; \ @@ -3125,10 +3128,12 @@ MagickExport char *GetNextImageProperty(const Image *image) } \ (void) CopyMagickString(q,(string),extent); \ q+=length; \ - } while (0) /* no trailing ; */ + } while (0) /* no trailing ; */ \ +RestoreMSCWarning /* same but append a 'key' and 'string' pair */ #define AppendKeyValue2Text(key,string) do { \ +DisableMSCWarning(4127) \ size_t length=strlen(key)+strlen(string)+2; \ if ((size_t) (q-interpret_text+length+1) >= extent) \ { extent+=length; \ @@ -3139,7 +3144,8 @@ MagickExport char *GetNextImageProperty(const Image *image) q=interpret_text+strlen(interpret_text); \ } \ q+=FormatLocaleString(q,extent,"%s=%s\n",(key),(string)); \ - } while (0) /* no trailing ; */ + } while (0) /* no trailing ; */ \ +RestoreMSCWarning MagickExport char *InterpretImageProperties(ImageInfo *image_info, Image *image,const char *embed_text,ExceptionInfo *exception) diff --git a/MagickCore/quantum-import.c b/MagickCore/quantum-import.c index 17642c19b..8599a2d88 100644 --- a/MagickCore/quantum-import.c +++ b/MagickCore/quantum-import.c @@ -1930,6 +1930,7 @@ static void ImportGrayAlphaQuantum(const Image *image,QuantumInfo *quantum_info, register unsigned char pixel; + bit=0; for (x=((ssize_t) number_pixels-3); x > 0; x-=4) { for (bit=0; bit < 8; bit+=2) diff --git a/MagickCore/shear.c b/MagickCore/shear.c index a80ad8fb1..e93971957 100644 --- a/MagickCore/shear.c +++ b/MagickCore/shear.c @@ -443,6 +443,7 @@ static inline ssize_t WriteRadonCell(const RadonInfo *radon_info, ssize_t count; + i=0; #if !defined(MAGICKCORE_HAVE_PWRITE) #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_WriteRadonCell) diff --git a/MagickCore/signature.c b/MagickCore/signature.c index edff6cb2f..d9f81b00a 100644 --- a/MagickCore/signature.c +++ b/MagickCore/signature.c @@ -659,7 +659,9 @@ static void TransformSignature(SignatureInfo *signature_info) p=GetStringInfoDatum(signature_info->message); if (signature_info->lsb_first == MagickFalse) { +DisableMSCWarning(4127) if (sizeof(unsigned int) <= 4) +RestoreMSCWarning for (i=0; i < 16; i++) { T=(*((unsigned int *) p)); @@ -676,7 +678,9 @@ static void TransformSignature(SignatureInfo *signature_info) } } else +DisableMSCWarning(4127) if (sizeof(unsigned int) <= 4) +RestoreMSCWarning for (i=0; i < 16; i++) { T=(*((unsigned int *) p)); diff --git a/MagickCore/statistic.c b/MagickCore/statistic.c index 59b2142dc..6ebe5d725 100644 --- a/MagickCore/statistic.c +++ b/MagickCore/statistic.c @@ -1534,7 +1534,7 @@ MagickExport ChannelStatistics *GetImageStatistics(const Image *image, channel_statistics=(ChannelStatistics *) AcquireQuantumMemory( MaxPixelChannels+1,sizeof(*channel_statistics)); if (channel_statistics == (ChannelStatistics *) NULL) - return(MagickFalse); + return(channel_statistics); (void) ResetMagickMemory(channel_statistics,0,(MaxPixelChannels+1)* sizeof(*channel_statistics)); for (i=0; i <= (ssize_t) MaxPixelChannels; i++) diff --git a/MagickCore/studio.h b/MagickCore/studio.h index 1c817fdb1..666d7e88f 100644 --- a/MagickCore/studio.h +++ b/MagickCore/studio.h @@ -359,6 +359,14 @@ extern int vsnprintf(char *,size_t,const char *,va_list); Magick defines. */ #define Swap(x,y) ((x)^=(y), (y)^=(x), (x)^=(y)) +#if defined(_MSC_VER) +# define DisableMSCWarning(nr) __pragma(warning(push)) \ + __pragma(warning(disable:nr)) +# define RestoreMSCWarning __pragma(warning(pop)) +#else +# define DisableMSCWarning(nr) +# define RestoreMSCWarning +#endif #if defined(__cplusplus) || defined(c_plusplus) } diff --git a/MagickCore/xml-tree.c b/MagickCore/xml-tree.c index 23f1a9443..f24fb3156 100644 --- a/MagickCore/xml-tree.c +++ b/MagickCore/xml-tree.c @@ -1389,7 +1389,6 @@ static MagickBooleanType ValidateEntities(char *tag,char *xml,char **entities) (ValidateEntities(tag,entities[i+1],entities) == 0)) return(MagickFalse); } - return(MagickTrue); } static void ParseProcessingInstructions(XMLTreeRoot *root,char *xml, diff --git a/MagickWand/magick-cli.c b/MagickWand/magick-cli.c index 955fbd21d..796541db3 100644 --- a/MagickWand/magick-cli.c +++ b/MagickWand/magick-cli.c @@ -149,7 +149,9 @@ WandExport void ProcessScriptOptions(MagickCLI *cli_wand,const char *filename, /* Process Options from Script */ option = arg1 = arg2 = (char*)NULL; +DisableMSCWarning(4127) while (1) { +RestoreMSCWarning { MagickBooleanType status = GetScriptToken(token_info); cli_wand->line=token_info->token_line; @@ -244,7 +246,9 @@ WandExport void ProcessScriptOptions(MagickCLI *cli_wand,const char *filename, /* Process non-specific Option */ CLIOption(cli_wand, option, arg1, arg2); +DisableMSCWarning(4127) } while (0); /* break block to next option */ +RestoreMSCWarning #if MagickCommandDebug >= 5 fprintf(stderr, "Script Image Count = %ld\n", @@ -465,7 +469,9 @@ WandExport int ProcessCommandOptions(MagickCLI *cli_wand, int argc, /* Process standard image option */ CLIOption(cli_wand, option, arg1, arg2); +DisableMSCWarning(4127) } while (0); /* break block to next option */ +RestoreMSCWarning #if MagickCommandDebug >= 5 (void) FormatLocaleFile(stderr, "CLI-post Image Count = %ld\n", diff --git a/MagickWand/mogrify-private.h b/MagickWand/mogrify-private.h index 459c9ffd5..b0bd401d5 100644 --- a/MagickWand/mogrify-private.h +++ b/MagickWand/mogrify-private.h @@ -46,6 +46,7 @@ extern "C" { #define FireImageStack(postfix,advance,fire) \ if ((j <= i) && (i < (ssize_t) argc)) \ { \ +DisableMSCWarning(4127) \ if (image_stack[k].image == (Image *) NULL) \ status&=MogrifyImageInfo(image_stack[k].image_info,(int) (i-j+1), \ (const char **) (argv+j),exception); \ @@ -60,6 +61,7 @@ extern "C" { j=i+1; \ pend=MagickFalse; \ } \ +RestoreMSCWarning \ } #define MaxImageStackDepth 128 #define NewImageStack() \ diff --git a/MagickWand/operation.c b/MagickWand/operation.c index db10ac080..34116736f 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -4837,7 +4837,9 @@ WandPrivate void CLINoImageOperator(MagickCLI *cli_wand, CLIWandException(OptionError,"UnrecognizedOption",option); +DisableMSCWarning(4127) } while (0); /* break to exit code. */ +RestoreMSCWarning /* clean up percent escape interpreted strings */ if (arg1 != arg1n ) @@ -4996,7 +4998,9 @@ WandExport void CLIOption(MagickCLI *cli_wand,const char *option,...) if ( (option_type & ListOperatorFlag) != 0 ) CLIListOperatorImages(cli_wand, option, arg1, arg2); +DisableMSCWarning(4127) } while (0); /* end Break code block */ +RestoreMSCWarning cli_wand->command = (const OptionInfo *) NULL; /* prevent re-use later */ } diff --git a/MagickWand/script-token.c b/MagickWand/script-token.c index 571735cb0..870ac20ce 100644 --- a/MagickWand/script-token.c +++ b/MagickWand/script-token.c @@ -373,7 +373,9 @@ WandExport MagickBooleanType GetScriptToken(ScriptTokenInfo *token_info) state=IN_WHITE; quote='\0'; offset=0; +DisableMSCWarning(4127) while(1) +RestoreMSCWarning { /* get character */ GetChar(c); diff --git a/MagickWand/studio.h b/MagickWand/studio.h index fd8c2ced4..6f3b91a70 100644 --- a/MagickWand/studio.h +++ b/MagickWand/studio.h @@ -366,6 +366,18 @@ extern int vsnprintf(char *,size_t,const char *,va_list); fatal_exception=DestroyExceptionInfo(fatal_exception); \ } +/* + Magick defines. +*/ +#if defined(_MSC_VER) +# define DisableMSCWarning(nr) __pragma(warning(push)) \ + __pragma(warning(disable:nr)) +# define RestoreMSCWarning __pragma(warning(pop)) +#else +# define DisableMSCWarning(nr) +# define RestoreMSCWarning +#endif + #if defined(__cplusplus) || defined(c_plusplus) } #endif diff --git a/coders/braille.c b/coders/braille.c index f2a440ea8..0e41d109e 100644 --- a/coders/braille.c +++ b/coders/braille.c @@ -279,7 +279,9 @@ static MagickBooleanType WriteBRAILLEImage(const ImageInfo *image_info, cell |= (GetPixelIndex(image,p+x+dx+dy*image->columns) == polarity) << bit; \ else \ cell |= (GetPixelGreen(image,p+x+dx+dy*image->columns) == 0) << bit; \ -} while (0) +DisableMSCWarning(4127) \ +} while (0) \ +RestoreMSCWarning do_cell(0,0,0); if (two_columns) @@ -302,7 +304,9 @@ static MagickBooleanType WriteBRAILLEImage(const ImageInfo *image_info, do_cell(0,3,6); if (two_columns) do_cell(1,3,7); +DisableMSCWarning(4127) } while(0); +RestoreMSCWarning if (unicode) { diff --git a/coders/cin.c b/coders/cin.c index 899bfe5a5..8635723e2 100644 --- a/coders/cin.c +++ b/coders/cin.c @@ -476,7 +476,7 @@ static Image *ReadCINImage(const ImageInfo *image_info,ExceptionInfo *exception) */ cin.image.orientation=(unsigned char) ReadBlobByte(image); offset++; - if (cin.image.orientation != (unsigned char) (~0UL)) + if (cin.image.orientation != (unsigned char) (~0)) (void) FormatImageProperty(image,"dpx:image.orientation","%d", cin.image.orientation); switch (cin.image.orientation) @@ -1163,7 +1163,9 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image, quantum_type=RGBQuantum; pixels=GetQuantumPixels(quantum_info); length=GetBytesPerRow(image->columns,3,image->depth,MagickTrue); +DisableMSCWarning(4127) if (0) +RestoreMSCWarning { quantum_type=GrayQuantum; length=GetBytesPerRow(image->columns,1,image->depth,MagickTrue); diff --git a/coders/dds.c b/coders/dds.c index 5f0831b57..75d5d499c 100644 --- a/coders/dds.c +++ b/coders/dds.c @@ -2600,7 +2600,7 @@ static MagickBooleanType WriteDDSImage(const ImageInfo *image_info, } } - maxMipmaps=-1; + maxMipmaps=SIZE_MAX; mipmaps=0; if ((image->columns & (image->columns - 1)) == 0 && (image->rows & (image->rows - 1)) == 0) diff --git a/coders/dpx.c b/coders/dpx.c index cb6bf8ec6..efb35d28b 100644 --- a/coders/dpx.c +++ b/coders/dpx.c @@ -902,9 +902,10 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception) dpx.orientation.border[i]=ReadBlobShort(image); offset+=2; } - if ((dpx.orientation.border[0] != (unsigned short) (~0UL)) && - (dpx.orientation.border[1] != (unsigned short) (~0UL))) - (void) FormatImageProperty(image,"dpx:orientation.border","%dx%d%+d%+d", dpx.orientation.border[0],dpx.orientation.border[1], + if ((dpx.orientation.border[0] != (unsigned short) (~0)) && + (dpx.orientation.border[1] != (unsigned short) (~0))) + (void) FormatImageProperty(image,"dpx:orientation.border","%dx%d%+d%+d", + dpx.orientation.border[0],dpx.orientation.border[1], dpx.orientation.border[2],dpx.orientation.border[3]); for (i=0; i < 2; i++) { diff --git a/coders/jpeg.c b/coders/jpeg.c index 5dbe2fe50..b74bc5c70 100644 --- a/coders/jpeg.c +++ b/coders/jpeg.c @@ -2158,8 +2158,7 @@ static MagickBooleanType WriteJPEGImage(const ImageInfo *image_info, if ((jpeg_info.data_precision != 12) && (image->depth <= 8)) jpeg_info.data_precision=8; else - if (sizeof(JSAMPLE) > 1) - jpeg_info.data_precision=12; + jpeg_info.data_precision=BITS_IN_JSAMPLE; jpeg_info.density_unit=(UINT8) 1; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), diff --git a/coders/mat.c b/coders/mat.c index 390e2bff8..321db1a25 100644 --- a/coders/mat.c +++ b/coders/mat.c @@ -820,7 +820,9 @@ MATLAB_KO: ThrowReaderException(CorruptImageError,"ImproperImageHeader"); sample_size = 64; image->depth = 64; /* double type cell */ (void) SetImageOption(clone_info,"quantum:format","floating-point"); +DisableMSCWarning(4127) if (sizeof(double) != 8) +RestoreMSCWarning ThrowReaderException(CoderError, "IncompatibleSizeOfDouble"); if (MATLAB_HDR.StructureFlag & FLAG_COMPLEX) { /* complex double type cell */ diff --git a/coders/meta.c b/coders/meta.c index f1c25fdae..caef5864d 100644 --- a/coders/meta.c +++ b/coders/meta.c @@ -994,7 +994,7 @@ static int jpeg_embed(Image *ifile, Image *ofile, Image *iptc) if (iptc != (Image *)NULL) { char - psheader[] = "\xFF\xED\0\0Photoshop 3.0\08BIM\x04\x04\0\0\0\0"; + psheader[] = "\xFF\xED\0\0Photoshop 3.0\0" "8BIM\x04\x04\0\0\0\0"; len=(unsigned int) GetBlobSize(iptc); if (len & 1) diff --git a/coders/msl.c b/coders/msl.c index 411c2e3d6..673ad0dbf 100644 --- a/coders/msl.c +++ b/coders/msl.c @@ -671,6 +671,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, keyword=(const char *) NULL; value=(char *) NULL; SetGeometryInfo(&geometry_info); + (void) ResetMagickMemory(&geometry,0,sizeof(geometry)); channel=DefaultChannels; switch (*tag) { diff --git a/coders/pdb.c b/coders/pdb.c index d8f414935..50e85b12b 100644 --- a/coders/pdb.c +++ b/coders/pdb.c @@ -110,8 +110,7 @@ typedef struct _PDBImage { char name[32], - version, - type; + version; size_t reserved_1, @@ -125,10 +124,15 @@ typedef struct _PDBImage reserved_2; short int - x_anchor, - y_anchor, width, height; + + unsigned char + type; + + unsigned short + x_anchor, + y_anchor; } PDBImage; /* Forward declarations. @@ -375,8 +379,8 @@ static Image *ReadPDBImage(const ImageInfo *image_info,ExceptionInfo *exception) pdb_image.x_last=(short) ReadBlobMSBShort(image); pdb_image.y_last=(short) ReadBlobMSBShort(image); pdb_image.reserved_2=ReadBlobMSBLong(image); - pdb_image.x_anchor=(short) ReadBlobMSBShort(image); - pdb_image.y_anchor=(short) ReadBlobMSBShort(image); + pdb_image.x_anchor=ReadBlobMSBShort(image); + pdb_image.y_anchor=ReadBlobMSBShort(image); pdb_image.width=(short) ReadBlobMSBShort(image); pdb_image.height=(short) ReadBlobMSBShort(image); /* @@ -789,17 +793,17 @@ static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image, pdb_image.version=1; /* RLE Compressed */ switch (bits_per_pixel) { - case 1: pdb_image.type=(char) 0xff; break; /* monochrome */ - case 2: pdb_image.type=(char) 0x00; break; /* 2 bit gray */ - default: pdb_image.type=(char) 0x02; /* 4 bit gray */ + case 1: pdb_image.type=(unsigned char) 0xff; break; /* monochrome */ + case 2: pdb_image.type=(unsigned char) 0x00; break; /* 2 bit gray */ + default: pdb_image.type=(unsigned char) 0x02; /* 4 bit gray */ } pdb_image.reserved_1=0; pdb_image.note=0; pdb_image.x_last=0; pdb_image.y_last=0; pdb_image.reserved_2=0; - pdb_image.x_anchor=(short) 0xffff; - pdb_image.y_anchor=(short) 0xffff; + pdb_image.x_anchor=(unsigned short) 0xffff; + pdb_image.y_anchor=(unsigned short) 0xffff; pdb_image.width=(short) image->columns; if (image->columns % 16) pdb_image.width=(short) (16*(image->columns/16+1)); @@ -919,14 +923,14 @@ static MagickBooleanType WritePDBImage(const ImageInfo *image_info,Image *image, */ (void) WriteBlob(image,32,(unsigned char *) pdb_image.name); (void) WriteBlobByte(image,(unsigned char) pdb_image.version); - (void) WriteBlobByte(image,(unsigned char) pdb_image.type); + (void) WriteBlobByte(image,pdb_image.type); (void) WriteBlobMSBLong(image,(unsigned int) pdb_image.reserved_1); (void) WriteBlobMSBLong(image,(unsigned int) pdb_image.note); (void) WriteBlobMSBShort(image,(unsigned short) pdb_image.x_last); (void) WriteBlobMSBShort(image,(unsigned short) pdb_image.y_last); (void) WriteBlobMSBLong(image,(unsigned int) pdb_image.reserved_2); - (void) WriteBlobMSBShort(image,(unsigned short) pdb_image.x_anchor); - (void) WriteBlobMSBShort(image,(unsigned short) pdb_image.y_anchor); + (void) WriteBlobMSBShort(image,pdb_image.x_anchor); + (void) WriteBlobMSBShort(image,pdb_image.y_anchor); (void) WriteBlobMSBShort(image,(unsigned short) pdb_image.width); (void) WriteBlobMSBShort(image,(unsigned short) pdb_image.height); (void) WriteBlob(image,(size_t) (q-runlength),runlength); diff --git a/coders/pdf.c b/coders/pdf.c index a4692f077..8f402d58c 100644 --- a/coders/pdf.c +++ b/coders/pdf.c @@ -942,6 +942,7 @@ static MagickBooleanType WritePDFImage(const ImageInfo *image_info,Image *image, #define CFormat "/Filter [ /%s ]\n" #define ObjectsPerImage 14 +DisableMSCWarning(4310) static const char XMPProfile[]= { @@ -983,6 +984,7 @@ static MagickBooleanType WritePDFImage(const ImageInfo *image_info,Image *image, "\n" }, XMPProfileMagick[4]= { (char) 0xef, (char) 0xbb, (char) 0xbf, (char) 0x00 }; +RestoreMSCWarning char basename[MaxTextExtent], diff --git a/coders/ps.c b/coders/ps.c index 608a29e99..c4d9ea0f5 100644 --- a/coders/ps.c +++ b/coders/ps.c @@ -1575,7 +1575,9 @@ static MagickBooleanType WritePSImage(const ImageInfo *image_info,Image *image, (void) WriteBlobString(image,"\n%EndPhotoshop\n"); } profile=GetImageProfile(image,"xmp"); +DisableMSCWarning(4127) if (0 && (profile != (StringInfo *) NULL)) +RestoreMSCWarning { /* Embed XML profile. diff --git a/coders/psd.c b/coders/psd.c index 5f6c351c0..ecd59c251 100644 --- a/coders/psd.c +++ b/coders/psd.c @@ -2383,7 +2383,7 @@ static MagickBooleanType WritePSDImage(const ImageInfo *image_info,Image *image, property=(const char *) GetImageProperty(next_image,"label",exception); if (property == (const char *) NULL) { - unsigned char + char layer_name[MaxTextExtent]; (void) WriteBlobMSBLong(image,16); diff --git a/coders/tiff.c b/coders/tiff.c index 9bf864c9b..578bd0145 100644 --- a/coders/tiff.c +++ b/coders/tiff.c @@ -993,7 +993,9 @@ static Image *ReadTIFFImage(const ImageInfo *image_info, } do { +DisableMSCWarning(4127) if (0 && (image_info->verbose != MagickFalse)) +RestoreMSCWarning TIFFPrintDirectory(tiff,stdout,MagickFalse); #if defined(MAGICKCORE_HAVE_TIFFISBIGENDIAN) (void) SetImageProperty(image,"tiff:endian",TIFFIsBigEndian(tiff) == 0 ? @@ -3280,7 +3282,9 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info, (void) TIFFSetField(tiff,TIFFTAG_PAGENUMBER,page,pages); } (void) TIFFSetProperties(tiff,image,exception); +DisableMSCWarning(4127) if (0) +RestoreMSCWarning (void) TIFFSetEXIFProperties(tiff,image,exception); /* Write image scanlines. @@ -3526,7 +3530,9 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info, if (image->colorspace == LabColorspace) DecodeLabImage(image,exception); DestroyTIFFInfo(&tiff_info); +DisableMSCWarning(4127) if (0 && (image_info->verbose == MagickTrue)) +RestoreMSCWarning TIFFPrintDirectory(tiff,stdout,MagickFalse); (void) TIFFWriteDirectory(tiff); image=SyncNextImageInList(image); diff --git a/coders/url.c b/coders/url.c index 8372dfdac..8b54a590e 100644 --- a/coders/url.c +++ b/coders/url.c @@ -176,7 +176,7 @@ static Image *ReadURLImage(const ImageInfo *image_info,ExceptionInfo *exception) #if defined(MAGICKCORE_WINDOWS_SUPPORT) && \ !(defined(__MINGW32__) || defined(__MINGW64__)) (void) fclose(file); - if (URLDownloadToFile(NULL,filename,read_info->filename,NULL,NULL) != S_OK) + if (URLDownloadToFile(NULL,filename,read_info->filename,0,NULL) != S_OK) { ThrowFileException(exception,FileOpenError,"UnableToOpenFile", filename); diff --git a/coders/viff.c b/coders/viff.c index 75c81c135..ca822070a 100644 --- a/coders/viff.c +++ b/coders/viff.c @@ -983,7 +983,9 @@ static MagickBooleanType WriteVIFFImage(const ImageInfo *image_info, */ if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse) (void) TransformImageColorspace(image,sRGBColorspace,exception); +DisableMSCWarning(4310) viff_info.identifier=(char) 0xab; +RestoreMSCWarning viff_info.file_type=1; viff_info.release=1; viff_info.version=3; diff --git a/coders/wpg.c b/coders/wpg.c index bacb37992..ba9cd78a6 100644 --- a/coders/wpg.c +++ b/coders/wpg.c @@ -524,10 +524,12 @@ static int UnpackWPGRaster(Image *image,int bpp,ExceptionInfo *exception) /* Helper for WPG2 reader. */ #define InsertByte6(b) \ { \ +DisableMSCWarning(4310) \ if(XorMe)\ BImgBuff[x] = (unsigned char)~b;\ else\ BImgBuff[x] = b;\ +RestoreMSCWarning \ x++; \ if((ssize_t) x >= ldblk) \ { \ diff --git a/coders/xpm.c b/coders/xpm.c index 56e93ee2d..f0d227cc3 100644 --- a/coders/xpm.c +++ b/coders/xpm.c @@ -305,6 +305,7 @@ static Image *ReadXPMImage(const ImageInfo *image_info,ExceptionInfo *exception) Remove comments. */ count=0; + width=0; for (p=xpm_buffer; *p != '\0'; p++) { if (*p != '"')