]> granicus.if.org Git - imagemagick/commitdiff
Fixed compiler warnings.
authordirk <dirk@git.imagemagick.org>
Sat, 16 Nov 2013 16:03:36 +0000 (16:03 +0000)
committerdirk <dirk@git.imagemagick.org>
Sat, 16 Nov 2013 16:03:36 +0000 (16:03 +0000)
37 files changed:
MagickCore/compress.c
MagickCore/draw.c
MagickCore/fx.c
MagickCore/magick.c
MagickCore/memory.c
MagickCore/module.c
MagickCore/morphology.c
MagickCore/nt-base.c
MagickCore/property.c
MagickCore/quantum-import.c
MagickCore/shear.c
MagickCore/signature.c
MagickCore/statistic.c
MagickCore/studio.h
MagickCore/xml-tree.c
MagickWand/magick-cli.c
MagickWand/mogrify-private.h
MagickWand/operation.c
MagickWand/script-token.c
MagickWand/studio.h
coders/braille.c
coders/cin.c
coders/dds.c
coders/dpx.c
coders/jpeg.c
coders/mat.c
coders/meta.c
coders/msl.c
coders/pdb.c
coders/pdf.c
coders/ps.c
coders/psd.c
coders/tiff.c
coders/url.c
coders/viff.c
coders/wpg.c
coders/xpm.c

index f8ecb9620fe930729eafdb675b5de5568c83fc8e..91ff25bf1c71d9eb2393f60bfbece33cc900dfa0 100644 (file)
@@ -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)   \
     {  \
index af7d11eb7da4188a57f2ba8b2ac88486596840b0..e43ec536890a59034f77d4e8b4f3ad5f05a448f4 100644 (file)
@@ -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) ||
index 745a0c6d4a645320ddb98b1264a1cb26f6fe015e..e3baaaf2c6ae49683bc945fbf1b2698f84739d20 100644 (file)
@@ -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);
index 72246fd7d9d6475b616d98d70387be70b39e8213..9bb69499293da5b221a28cc5c00c6d89e4f7b366 100644 (file)
@@ -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
index 3da116035c22ea5f7101f8113242d1fe4adbc1af..1bc83a6cc1c22d196462058160a377a331399828 100644 (file)
@@ -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;
index 3f12cbbb38fe4b32a56ff1fb5dde3544574ab912..cad62cdacd20b08e64b3ccdeceabfb01faa96671 100644 (file)
@@ -814,7 +814,6 @@ static MagickBooleanType GetMagickModulePath(const char *filename,
   if (exception->severity < ConfigureError)
     ThrowFileException(exception,ConfigureWarning,"UnableToOpenModuleFile",
       path);
-  return(MagickFalse);
 #endif
   return(MagickFalse);
 }
index 06f5ea4c68e52a295eb36102c42dcdca52f3cecc..0914c1ff6e464de9a6e6e2e78dc13a1b04dab2d9 100644 (file)
@@ -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 )
index 160c1d56f1f35ee33602a47a1a53e9861ec7a0c0..4763cb2f87b8858ea4496e5aa3e15c866fb4edd7 100644 (file)
@@ -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);
 }
 \f
 #if !defined(__MINGW32__) && !defined(__MINGW64__)
index c6f16ee962ce41b5dab9d22a3efe9345adb0bcc6..e393867767653a6672f3303fe540a86a9c799a4e 100644 (file)
@@ -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)
index 17642c19b2fffdf86d156d7cb7abae781d19dd2e..8599a2d885ce5b9fc0875416ee58c146f50f1377 100644 (file)
@@ -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)
index a80ad8fb1a0bcf5fc9d13b1b9dbd0b4e94dff4d2..e939719579a6d6c6bdaeed0958ee435240986c5d 100644 (file)
@@ -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)
index edff6cb2f3bc80615feebbb736fd97e1b17beeba..d9f81b00ab85c0284cbddecf1a4986eb4efffecb 100644 (file)
@@ -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));
index 59b2142dc673d8e1567fcbc48f6ca453740176cb..6ebe5d7254f91e8b3406b642bae3ee45904d7f81 100644 (file)
@@ -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++)
index 1c817fdb19d859d3b9d59866bc37ca9093d2c8d2..666d7e88f9014bd714795000a319ef60035fca20 100644 (file)
@@ -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)
 }
index 23f1a9443740629f5c8b60371473c7da414dbba5..f24fb3156675268bb49763d36cef030eb61474a8 100644 (file)
@@ -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,
index 955fbd21d719234b7da3ce7368b52d96ec62861d..796541db320f06aa8820eea8283140ae09171575 100644 (file)
@@ -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",
index 459c9ffd59fa14a536adad482d65632a89ec786f..b0bd401d5d606e33e71d91ccd4356e612c463158 100644 (file)
@@ -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() \
index db10ac0804cd8d34f672b2e6fcc4530edbe92944..34116736fbf6ac6a15315e54a4e096e0a61867df 100644 (file)
@@ -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 */
 }
index 571735cb0c13f6d8f44799be68ef28ff5f11abc3..870ac20ce9534c0ec915002f664ef1d79c6d01d3 100644 (file)
@@ -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);
index fd8c2ced4fe27680c15320618395248e31d76732..6f3b91a7021cf907a58a7fa8c42ea8fc654797a1 100644 (file)
@@ -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
index f2a440ea8a561e369f42148fb62b9d216f067045..0e41d109e0bb07eb1e273672b6b72110f880fe16 100644 (file)
@@ -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)
         {
index 899bfe5a56352363b750d728d6f7f77c2cc2215d..8635723e2b83f6fe8090941e626553e83e8d6150 100644 (file)
@@ -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);
index 5f0831b5772db185a772b0f484eb81b942b849ae..75d5d499c0d9cb923b61a3dd229b60e866cd7660 100644 (file)
@@ -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)
index cb6bf8ec6ea7b16ad5f837c4126263dafd24196a..efb35d28bf0e31be4541e139e3721eb01e9d3435 100644 (file)
@@ -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++)
       {
index 5dbe2fe508787a8ab04d5636454f3b15995277d9..b74bc5c704291c79ef05cba26941c72338f26c11 100644 (file)
@@ -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(),
index 390e2bff8c8e67e9d6fc28dcffaeee6b9a8de06f..321db1a252086b3dd0872d647213ce4757628a02 100644 (file)
@@ -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 */        
index f1c25fdae1d02a65c755ca47f1bf905d6762ff7f..caef5864da6d92f920ddf580bdd1ca5b28b9c843 100644 (file)
@@ -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)
index 411c2e3d62d87a69f670161256b2ba5ae82b8d1d..673ad0dbf7dd96f3abab2c54687e8658d418cb9f 100644 (file)
@@ -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)
   {
index d8f414935fe1c33480221600c308419f7a45dea7..50e85b12bb8be8e8da5b3ae3409adf4fe3c40d05 100644 (file)
@@ -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);
index a4692f077671c56869c7c0c5ae85da07c097c619..8f402d58c1be1a492e98ac144aac15b4f0c73c98 100644 (file)
@@ -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,
       "<?xpacket end=\"w\"?>\n"
     },
     XMPProfileMagick[4]= { (char) 0xef, (char) 0xbb, (char) 0xbf, (char) 0x00 };
+RestoreMSCWarning
 
   char
     basename[MaxTextExtent],
index 608a29e99b3ec52642648fb74a5d5ce8c9f6b45c..c4d9ea0f5982cec5eea0534a96c2b798de66f632 100644 (file)
@@ -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.
index 5f6c351c00a0ef4e01470e960733472ad053b566..ecd59c251f51a690023143adb5fa1894f711d711 100644 (file)
@@ -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);
index 9bf864c9be64b367b80b77ccf67ea1546d703118..578bd014509ac27df25d762a704013c0f26649ae 100644 (file)
@@ -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);
index 8372dfdac4e58f963e25965e88ef2dd6a77f155e..8b54a590e11026ac2a22f1b4a9cb6283b3311958 100644 (file)
@@ -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);
index 75c81c135b4eaa199c1a97bdd4cab27a32512d6d..ca822070ab3eebb1b3fad0f6e707d7f1cbd49d98 100644 (file)
@@ -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;
index bacb37992cc87200b0e81d2bcfa188da60c73d7c..ba9cd78a6aeaad012cbd0161bfc4bee978aa6692 100644 (file)
@@ -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) \
   { \
index 56e93ee2d7531795f6aae805cf86b8f528e6f75e..f0d227cc3c6e050ca130116ee8126d4be76bfa50 100644 (file)
@@ -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 != '"')