Fixed compiler warnings.
diff --git a/MagickCore/compress.c b/MagickCore/compress.c
index f8ecb96..91ff25b 100644
--- a/MagickCore/compress.c
+++ b/MagickCore/compress.c
@@ -693,8 +693,10 @@
 
 #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 af7d11e..e43ec53 100644
--- a/MagickCore/draw.c
+++ b/MagickCore/draw.c
@@ -3819,8 +3819,10 @@
   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 745a0c6..e3baaaf 100644
--- a/MagickCore/fx.c
+++ b/MagickCore/fx.c
@@ -1610,7 +1610,6 @@
             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 72246fd..9bb6949 100644
--- a/MagickCore/magick.c
+++ b/MagickCore/magick.c
@@ -870,15 +870,8 @@
           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 @@
         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 3da1160..1bc83a6 100644
--- a/MagickCore/memory.c
+++ b/MagickCore/memory.c
@@ -163,14 +163,34 @@
 /*
   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 3f12cbb..cad62cd 100644
--- a/MagickCore/module.c
+++ b/MagickCore/module.c
@@ -814,7 +814,6 @@
   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 06f5ea4..0914c1f 100644
--- a/MagickCore/morphology.c
+++ b/MagickCore/morphology.c
@@ -2420,7 +2420,9 @@
     *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 160c1d5..4763cb2 100644
--- a/MagickCore/nt-base.c
+++ b/MagickCore/nt-base.c
@@ -236,9 +236,11 @@
 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 c6f16ee..e393867 100644
--- a/MagickCore/property.c
+++ b/MagickCore/property.c
@@ -557,7 +557,7 @@
     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 @@
 
 /* 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 @@
        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 @@
       } \
      (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 @@
       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 17642c1..8599a2d 100644
--- a/MagickCore/quantum-import.c
+++ b/MagickCore/quantum-import.c
@@ -1930,6 +1930,7 @@
       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 a80ad8f..e939719 100644
--- a/MagickCore/shear.c
+++ b/MagickCore/shear.c
@@ -443,6 +443,7 @@
   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 edff6cb..d9f81b0 100644
--- a/MagickCore/signature.c
+++ b/MagickCore/signature.c
@@ -659,7 +659,9 @@
   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 @@
         }
     }
   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 59b2142..6ebe5d7 100644
--- a/MagickCore/statistic.c
+++ b/MagickCore/statistic.c
@@ -1534,7 +1534,7 @@
   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 1c817fd..666d7e8 100644
--- a/MagickCore/studio.h
+++ b/MagickCore/studio.h
@@ -359,6 +359,14 @@
   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 23f1a94..f24fb31 100644
--- a/MagickCore/xml-tree.c
+++ b/MagickCore/xml-tree.c
@@ -1389,7 +1389,6 @@
         (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 955fbd2..796541d 100644
--- a/MagickWand/magick-cli.c
+++ b/MagickWand/magick-cli.c
@@ -149,7 +149,9 @@
 
   /* 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 @@
       /* 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 @@
       /* 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 459c9ff..b0bd401 100644
--- a/MagickWand/mogrify-private.h
+++ b/MagickWand/mogrify-private.h
@@ -46,6 +46,7 @@
 #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 @@
               j=i+1; \
             pend=MagickFalse; \
           } \
+RestoreMSCWarning \
     }
 #define MaxImageStackDepth  128
 #define NewImageStack() \
diff --git a/MagickWand/operation.c b/MagickWand/operation.c
index db10ac0..3411673 100644
--- a/MagickWand/operation.c
+++ b/MagickWand/operation.c
@@ -4837,7 +4837,9 @@
 
     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 @@
     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 571735c..870ac20 100644
--- a/MagickWand/script-token.c
+++ b/MagickWand/script-token.c
@@ -373,7 +373,9 @@
   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 fd8c2ce..6f3b91a 100644
--- a/MagickWand/studio.h
+++ b/MagickWand/studio.h
@@ -366,6 +366,18 @@
   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 f2a440e..0e41d10 100644
--- a/coders/braille.c
+++ b/coders/braille.c
@@ -279,7 +279,9 @@
           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 @@
         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 899bfe5..8635723 100644
--- a/coders/cin.c
+++ b/coders/cin.c
@@ -476,7 +476,7 @@
   */
   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 @@
   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 5f0831b..75d5d49 100644
--- a/coders/dds.c
+++ b/coders/dds.c
@@ -2600,7 +2600,7 @@
         }
     }
 
-  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 cb6bf8e..efb35d2 100644
--- a/coders/dpx.c
+++ b/coders/dpx.c
@@ -902,9 +902,10 @@
         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 5dbe2fe..b74bc5c 100644
--- a/coders/jpeg.c
+++ b/coders/jpeg.c
@@ -2158,8 +2158,7 @@
   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 390e2bf..321db1a 100644
--- a/coders/mat.c
+++ b/coders/mat.c
@@ -820,7 +820,9 @@
         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 f1c25fd..caef586 100644
--- a/coders/meta.c
+++ b/coders/meta.c
@@ -994,7 +994,7 @@
         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 411c2e3..673ad0d 100644
--- a/coders/msl.c
+++ b/coders/msl.c
@@ -671,6 +671,7 @@
   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 d8f4149..50e85b1 100644
--- a/coders/pdb.c
+++ b/coders/pdb.c
@@ -110,8 +110,7 @@
 {
   char
     name[32],
-    version,
-    type;
+    version;
 
   size_t
     reserved_1,
@@ -125,10 +124,15 @@
     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 @@
   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 @@
   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 @@
   */
   (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 a4692f0..8f402d5 100644
--- a/coders/pdf.c
+++ b/coders/pdf.c
@@ -942,6 +942,7 @@
 #define CFormat  "/Filter [ /%s ]\n"
 #define ObjectsPerImage  14
 
+DisableMSCWarning(4310)
   static const char
     XMPProfile[]=
     {
@@ -983,6 +984,7 @@
       "<?xpacket end=\"w\"?>\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 608a29e..c4d9ea0 100644
--- a/coders/ps.c
+++ b/coders/ps.c
@@ -1575,7 +1575,9 @@
             (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 5f6c351..ecd59c2 100644
--- a/coders/psd.c
+++ b/coders/psd.c
@@ -2383,7 +2383,7 @@
         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 9bf864c..578bd01 100644
--- a/coders/tiff.c
+++ b/coders/tiff.c
@@ -993,7 +993,9 @@
     }
   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 @@
       (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 @@
     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 8372dfd..8b54a59 100644
--- a/coders/url.c
+++ b/coders/url.c
@@ -176,7 +176,7 @@
 #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 75c81c1..ca82207 100644
--- a/coders/viff.c
+++ b/coders/viff.c
@@ -983,7 +983,9 @@
     */
     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 bacb379..ba9cd78 100644
--- a/coders/wpg.c
+++ b/coders/wpg.c
@@ -524,10 +524,12 @@
 /* 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 56e93ee..f0d227c 100644
--- a/coders/xpm.c
+++ b/coders/xpm.c
@@ -305,6 +305,7 @@
     Remove comments.
   */
   count=0;
+  width=0;
   for (p=xpm_buffer; *p != '\0'; p++)
   {
     if (*p != '"')