diff --git a/ChangeLog b/ChangeLog
index 68787f4..814b057 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
2010-04-24.6.1-6 Cristy <quetzlzacatenango@image...>
* Do not declare timestruct under MinGW.
+ * Respect -compose option for the montag utility (bug report by Anthony).
2010-04-17 6.6.1-5 Cristy <quetzlzacatenango@image...>
* Only write one ICC profile to PSD image.
diff --git a/coders/bmp.c b/coders/bmp.c
index 13a4c2e..a172411 100644
--- a/coders/bmp.c
+++ b/coders/bmp.c
@@ -71,7 +71,7 @@
#define BI_JPEG 4
#undef BI_PNG
#define BI_PNG 5
-#if !defined(__WINDOWS__) || defined(__MINGW32__)
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__MINGW32__)
#define BI_RGB 0
#define BI_RLE8 1
#define BI_RLE4 2
diff --git a/coders/dib.c b/coders/dib.c
index c6ac332..96f2b98 100644
--- a/coders/dib.c
+++ b/coders/dib.c
@@ -150,7 +150,7 @@
static MagickBooleanType DecodeImage(Image *image,
const MagickBooleanType compression,unsigned char *pixels)
{
-#if !defined(__WINDOWS__) || defined(__MINGW32__)
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__MINGW32__)
#define BI_RGB 0
#define BI_RLE8 1
#define BI_RLE4 2
diff --git a/coders/fpx.c b/coders/fpx.c
index f43e558..47e3d45 100644
--- a/coders/fpx.c
+++ b/coders/fpx.c
@@ -64,7 +64,7 @@
#include "magick/string_.h"
#include "magick/module.h"
#if defined(MAGICKCORE_FPX_DELEGATE)
-#if !defined(vms) && !defined(macintosh) && !defined(__WINDOWS__)
+#if !defined(vms) && !defined(macintosh) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
#include <fpxlib.h>
#else
#include "Fpxlib.h"
diff --git a/coders/icon.c b/coders/icon.c
index db7b5ce..27b05a1 100644
--- a/coders/icon.c
+++ b/coders/icon.c
@@ -64,7 +64,7 @@
/*
Define declarations.
*/
-#if !defined(__WINDOWS__) || defined(__MINGW32__)
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__MINGW32__)
#define BI_RGB 0
#define BI_RLE8 1
#define BI_BITFIELDS 3
diff --git a/coders/meta.c b/coders/meta.c
index d9105ea..8f6ac7e 100644
--- a/coders/meta.c
+++ b/coders/meta.c
@@ -1785,7 +1785,7 @@
break;
}
}
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
(void) WriteBlobString(ofile,"\"\r\n");
#else
#if defined(macintosh)
diff --git a/coders/msl.c b/coders/msl.c
index af0596b..ccdb620 100644
--- a/coders/msl.c
+++ b/coders/msl.c
@@ -88,7 +88,7 @@
#include "magick/threshold.h"
#include "magick/utility.h"
#if defined(MAGICKCORE_XML_DELEGATE)
-# if defined(__WINDOWS__)
+# if defined(MAGICKCORE_WINDOWS_SUPPORT)
# if defined(__MINGW32__)
# define _MSC_VER
# else
diff --git a/coders/pdf.c b/coders/pdf.c
index 8514bf4..6fcd1c3 100644
--- a/coders/pdf.c
+++ b/coders/pdf.c
@@ -124,7 +124,7 @@
int
status;
-#if defined(MAGICKCORE_GS_DELEGATE) || defined(__WINDOWS__)
+#if defined(MAGICKCORE_GS_DELEGATE) || defined(MAGICKCORE_WINDOWS_SUPPORT)
char
**argv;
@@ -141,7 +141,7 @@
register long
i;
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
ghost_info=NTGhostscriptDLLVectors();
#else
GhostInfo
@@ -182,7 +182,7 @@
0,&code);
(ghost_info->exit)(interpreter);
(ghost_info->delete_instance)(interpreter);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
NTGhostscriptUnLoadDLL();
#endif
for (i=0; i < (long) argc; i++)
diff --git a/coders/ps.c b/coders/ps.c
index c2f02cc..47767da 100644
--- a/coders/ps.c
+++ b/coders/ps.c
@@ -116,7 +116,7 @@
int
status;
-#if defined(MAGICKCORE_GS_DELEGATE) || defined(__WINDOWS__)
+#if defined(MAGICKCORE_GS_DELEGATE) || defined(MAGICKCORE_WINDOWS_SUPPORT)
char
**argv;
@@ -133,7 +133,7 @@
register long
i;
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
ghost_info=NTGhostscriptDLLVectors();
#else
GhostInfo
@@ -174,7 +174,7 @@
0,&code);
(ghost_info->exit)(interpreter);
(ghost_info->delete_instance)(interpreter);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
NTGhostscriptUnLoadDLL();
#endif
for (i=0; i < (long) argc; i++)
diff --git a/coders/svg.c b/coders/svg.c
index b9a8338..746833b 100644
--- a/coders/svg.c
+++ b/coders/svg.c
@@ -72,7 +72,7 @@
#include "magick/token.h"
#include "magick/utility.h"
#if defined(MAGICKCORE_XML_DELEGATE)
-# if defined(__WINDOWS__)
+# if defined(MAGICKCORE_WINDOWS_SUPPORT)
# if defined(__MINGW32__)
# define _MSC_VER
# else
diff --git a/coders/url.c b/coders/url.c
index 00c5126..4df19b4 100644
--- a/coders/url.c
+++ b/coders/url.c
@@ -57,7 +57,7 @@
#include "magick/string_.h"
#include "magick/module.h"
#if defined(MAGICKCORE_XML_DELEGATE)
-# if defined(__WINDOWS__)
+# if defined(MAGICKCORE_WINDOWS_SUPPORT)
# if defined(__MINGW32__)
# define _MSC_VER
# else
diff --git a/config/configure.xml b/config/configure.xml
index ef58eed..5be36be 100644
--- a/config/configure.xml
+++ b/config/configure.xml
@@ -9,7 +9,7 @@
<configure name="NAME" value="ImageMagick"/>
<configure name="LIB_VERSION" value="0x661"/>
<configure name="LIB_VERSION_NUMBER" value="6,6,1,6"/>
- <configure name="RELEASE_DATE" value="2010-04-23"/>
+ <configure name="RELEASE_DATE" value="2010-04-24"/>
<configure name="CONFIGURE" value="./configure "/>
<configure name="PREFIX" value="/usr/local"/>
<configure name="EXEC-PREFIX" value="/usr/local"/>
diff --git a/configure b/configure
index 89728bd..7303eb0 100755
--- a/configure
+++ b/configure
@@ -21024,7 +21024,6 @@
fi
-AC_TYPE_BOOLEAN
# Define off_t to a suitable type, if standard headers do not define it.
ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
diff --git a/ltdl/lt__dirent.c b/ltdl/lt__dirent.c
index 30dc072..c9533b6 100644
--- a/ltdl/lt__dirent.c
+++ b/ltdl/lt__dirent.c
@@ -35,7 +35,7 @@
#include "lt__dirent.h"
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
void
closedir (DIR *entry)
@@ -104,4 +104,4 @@
return &entry->file_info;
}
-#endif /*defined(__WINDOWS__)*/
+#endif /*defined(MAGICKCORE_WINDOWS_SUPPORT)*/
diff --git a/magick/MagickCore.h b/magick/MagickCore.h
index dfd2dbc..a845082 100644
--- a/magick/MagickCore.h
+++ b/magick/MagickCore.h
@@ -46,37 +46,13 @@
#include <stdlib.h>
#include <sys/types.h>
-#if defined(__CYGWIN32__)
-# if !defined(__CYGWIN__)
-# define __CYGWIN__ __CYGWIN32__
-# endif
-#endif
+#if defined(WIN32) || defined(WIN64)
+# define MAGICKCORE_WINDOWS_SUPPORT
+#else
+# define MAGICKCORE_POSIX_SUPPORT
+#endif
-#if defined(_WIN32) || defined(WIN32)
-# if !defined(__WINDOWS__)
-# if defined(_WIN32)
-# define __WINDOWS__ _WIN32
-# else
-# if defined(WIN32)
-# define __WINDOWS__ WIN32
-# endif
-# endif
-# endif
-#endif
-
-#if defined(_WIN64) || defined(WIN64)
-# if !defined(__WINDOWS__)
-# if defined(_WIN64)
-# define __WINDOWS__ _WIN64
-# else
-# if !defined(WIN64)
-# define __WINDOWS__ WIN64
-# endif
-# endif
-# endif
-#endif
-
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB) && !defined(MAGICK_STATIC_LINK)
# define _MAGICKDLL_
# endif
diff --git a/magick/blob.c b/magick/blob.c
index 71d70be..f3b5458 100644
--- a/magick/blob.c
+++ b/magick/blob.c
@@ -61,7 +61,7 @@
#include "magick/string-private.h"
#include "magick/token.h"
#include "magick/utility.h"
-#if defined(MAGICKCORE_HAVE_MMAP_FILEIO) && !defined(__WINDOWS__)
+#if defined(MAGICKCORE_HAVE_MMAP_FILEIO) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
# include <sys/mman.h>
#endif
#if defined(MAGICKCORE_ZLIB_DELEGATE)
@@ -2263,7 +2263,7 @@
((*filename == '\0') && (image_info->file == (FILE *) NULL)))
{
image->blob->file=(*type == 'r') ? stdin : stdout;
-#if defined(__WINDOWS__) || defined(__OS2__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__)
if (strchr(type,'b') != (char *) NULL)
setmode(_fileno(image->blob->file),_O_BINARY);
#endif
@@ -2279,7 +2279,7 @@
*mode=(*type);
mode[1]='\0';
image->blob->file=fdopen(StringToLong(filename+3),mode);
-#if defined(__WINDOWS__) || defined(__OS2__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__)
if (strchr(type,'b') != (char *) NULL)
setmode(_fileno(image->blob->file),_O_BINARY);
#endif
diff --git a/magick/colormap.c b/magick/colormap.c
index 2c87945..fc0370a 100644
--- a/magick/colormap.c
+++ b/magick/colormap.c
@@ -73,6 +73,92 @@
% %
% %
% %
+% A c q u i r e I m a g e C o l o r m a p %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% AcquireImageColormap() allocates an image colormap and initializes
+% it to a linear gray colorspace. If the image already has a colormap,
+% it is replaced. AcquireImageColormap() returns MagickTrue if successful,
+% otherwise MagickFalse if there is not enough memory.
+%
+% The format of the AcquireImageColormap method is:
+%
+% MagickBooleanType AcquireImageColormap(Image *image,
+% const unsigned long colors)
+%
+% A description of each parameter follows:
+%
+% o image: the image.
+%
+% o colors: the number of colors in the image colormap.
+%
+*/
+
+static inline unsigned long MagickMax(const unsigned long x,
+ const unsigned long y)
+{
+ if (x > y)
+ return(x);
+ return(y);
+}
+
+static inline unsigned long MagickMin(const unsigned long x,
+ const unsigned long y)
+{
+ if (x < y)
+ return(x);
+ return(y);
+}
+
+MagickExport MagickBooleanType AcquireImageColormap(Image *image,
+ const unsigned long colors)
+{
+ register long
+ i;
+
+ size_t
+ length;
+
+ /*
+ Allocate image colormap.
+ */
+ assert(image != (Image *) NULL);
+ assert(image->signature == MagickSignature);
+ if (image->debug != MagickFalse)
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
+ image->colors=colors;
+ length=(size_t) colors;
+ if (image->colormap == (PixelPacket *) NULL)
+ image->colormap=(PixelPacket *) AcquireQuantumMemory(length,
+ sizeof(*image->colormap));
+ else
+ image->colormap=(PixelPacket *) ResizeQuantumMemory(image->colormap,length,
+ sizeof(*image->colormap));
+ if (image->colormap == (PixelPacket *) NULL)
+ ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
+ image->filename);
+ for (i=0; i < (long) image->colors; i++)
+ {
+ unsigned long
+ pixel;
+
+ pixel=(unsigned long) (i*(QuantumRange/MagickMax(colors-1,1)));
+ image->colormap[i].red=(Quantum) pixel;
+ image->colormap[i].green=(Quantum) pixel;
+ image->colormap[i].blue=(Quantum) pixel;
+ image->colormap[i].opacity=OpaqueOpacity;
+ }
+ return(SetImageStorageClass(image,PseudoClass));
+}
+
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% C y c l e C o l o r m a p I m a g e %
% %
% %
diff --git a/magick/colormap.h b/magick/colormap.h
index 2d2bef3..235960a 100644
--- a/magick/colormap.h
+++ b/magick/colormap.h
@@ -23,6 +23,7 @@
#endif
extern MagickExport MagickBooleanType
+ AcquireImageColormap(Image *,const unsigned long),
CycleColormapImage(Image *,const long),
SortColormapByIntensity(Image *);
diff --git a/magick/configure.c b/magick/configure.c
index 823f294..a4c9cab 100644
--- a/magick/configure.c
+++ b/magick/configure.c
@@ -570,7 +570,7 @@
}
paths=DestroyLinkedList(paths,RelinquishMagickMemory);
}
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
{
char
*blob;
@@ -678,7 +678,7 @@
#if defined(MAGICKCORE_SHARE_PATH)
(void) AppendValueToLinkedList(paths,ConstantString(MAGICKCORE_SHARE_PATH));
#endif
-#if defined(__WINDOWS__) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_CONFIGURE_PATH))
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_CONFIGURE_PATH))
{
char
*registry_key;
@@ -768,7 +768,7 @@
home=DestroyString(home);
}
}
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
{
char
module_path[MaxTextExtent];
diff --git a/magick/delegate-private.h b/magick/delegate-private.h
index 4a988fa..d5a5352 100644
--- a/magick/delegate-private.h
+++ b/magick/delegate-private.h
@@ -34,7 +34,7 @@
#endif
#if !defined(MagickDLLCall)
-# if defined(__WINDOWS__)
+# if defined(MAGICKCORE_WINDOWS_SUPPORT)
# define MagickDLLCall __stdcall
# else
# define MagickDLLCall
diff --git a/magick/delegate.c b/magick/delegate.c
index 8ddb2e2..d37a256 100644
--- a/magick/delegate.c
+++ b/magick/delegate.c
@@ -1347,7 +1347,7 @@
*commands;
commands=AcquireString(token);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
if (strchr(commands,'@') != (char *) NULL)
{
char
diff --git a/magick/deprecate.c b/magick/deprecate.c
index bb91fde..52d1f45 100644
--- a/magick/deprecate.c
+++ b/magick/deprecate.c
@@ -2106,7 +2106,7 @@
blob=FileToBlob(path,~0,length,exception);
}
#endif
-#if defined(__WINDOWS__) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_CONFIGURE_PATH))
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !(defined(MAGICKCORE_CONFIGURE_PATH) || defined(MAGICKCORE_SHARE_CONFIGURE_PATH))
if (blob == (void *) NULL)
{
char
@@ -2189,7 +2189,7 @@
*/
if ((blob == (void *) NULL) && (IsPathAccessible(path) != MagickFalse))
blob=FileToBlob(path,~0,length,exception);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
/*
Search Windows registry.
*/
diff --git a/magick/image.c b/magick/image.c
index a5f9b69..9bfcd48 100644
--- a/magick/image.c
+++ b/magick/image.c
@@ -268,92 +268,6 @@
% %
% %
% %
-% A c q u i r e I m a g e C o l o r m a p %
-% %
-% %
-% %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% AcquireImageColormap() allocates an image colormap and initializes
-% it to a linear gray colorspace. If the image already has a colormap,
-% it is replaced. AcquireImageColormap() returns MagickTrue if successful,
-% otherwise MagickFalse if there is not enough memory.
-%
-% The format of the AcquireImageColormap method is:
-%
-% MagickBooleanType AcquireImageColormap(Image *image,
-% const unsigned long colors)
-%
-% A description of each parameter follows:
-%
-% o image: the image.
-%
-% o colors: the number of colors in the image colormap.
-%
-*/
-
-static inline unsigned long MagickMax(const unsigned long x,
- const unsigned long y)
-{
- if (x > y)
- return(x);
- return(y);
-}
-
-static inline unsigned long MagickMin(const unsigned long x,
- const unsigned long y)
-{
- if (x < y)
- return(x);
- return(y);
-}
-
-MagickExport MagickBooleanType AcquireImageColormap(Image *image,
- const unsigned long colors)
-{
- register long
- i;
-
- size_t
- length;
-
- /*
- Allocate image colormap.
- */
- assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
- if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- image->colors=colors;
- length=(size_t) colors;
- if (image->colormap == (PixelPacket *) NULL)
- image->colormap=(PixelPacket *) AcquireQuantumMemory(length,
- sizeof(*image->colormap));
- else
- image->colormap=(PixelPacket *) ResizeQuantumMemory(image->colormap,length,
- sizeof(*image->colormap));
- if (image->colormap == (PixelPacket *) NULL)
- ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
- image->filename);
- for (i=0; i < (long) image->colors; i++)
- {
- unsigned long
- pixel;
-
- pixel=(unsigned long) (i*(QuantumRange/MagickMax(colors-1,1)));
- image->colormap[i].red=(Quantum) pixel;
- image->colormap[i].green=(Quantum) pixel;
- image->colormap[i].blue=(Quantum) pixel;
- image->colormap[i].opacity=OpaqueOpacity;
- }
- return(SetImageStorageClass(image,PseudoClass));
-}
-
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% %
-% %
-% %
% A c q u i r e I m a g e I n f o %
% %
% %
diff --git a/magick/image.h b/magick/image.h
index d557b28..4143346 100644
--- a/magick/image.h
+++ b/magick/image.h
@@ -510,7 +510,6 @@
GetImageReferenceCount(Image *);
extern MagickExport MagickBooleanType
- AcquireImageColormap(Image *,const unsigned long),
ClipImage(Image *),
ClipImagePath(Image *,const char *,const MagickBooleanType),
GetImageAlphaChannel(const Image *),
diff --git a/magick/locale.c b/magick/locale.c
index 799e412..728a62c 100644
--- a/magick/locale.c
+++ b/magick/locale.c
@@ -474,7 +474,7 @@
}
paths=DestroyLinkedList(paths,RelinquishMagickMemory);
}
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
{
char
*blob;
diff --git a/magick/log.c b/magick/log.c
index 027f5a5..1d7ecee 100644
--- a/magick/log.c
+++ b/magick/log.c
@@ -1156,13 +1156,13 @@
}
if ((log_info->handler_mask & DebugHandler) != 0)
{
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
OutputDebugString(text);
#endif
}
if ((log_info->handler_mask & EventHandler) != 0)
{
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
(void) NTReportEvent(text,MagickFalse);
#endif
}
diff --git a/magick/magick-type.h b/magick/magick-type.h
index 72a1878..423eb61 100644
--- a/magick/magick-type.h
+++ b/magick/magick-type.h
@@ -28,7 +28,7 @@
#define MAGICKCORE_QUANTUM_DEPTH 16
#endif
-#if defined(__WINDOWS__) && !defined(__MINGW32__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__MINGW32__)
# define MagickLLConstant(c) (MagickOffsetType) (c ## i64)
# define MagickULLConstant(c) (MagickSizeType) (c ## ui64)
#else
@@ -111,7 +111,7 @@
Typedef declarations.
*/
typedef unsigned int MagickStatusType;
-#if !defined(__WINDOWS__)
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT)
#if (MAGICKCORE_SIZEOF_UNSIGNED_LONG_LONG == 8)
typedef long long MagickOffsetType;
typedef unsigned long long MagickSizeType;
diff --git a/magick/magick.c b/magick/magick.c
index b6eaeb3..c94ae65 100644
--- a/magick/magick.c
+++ b/magick/magick.c
@@ -59,7 +59,7 @@
#include "magick/memory_.h"
#include "magick/mime.h"
#include "magick/module.h"
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include "magick/nt-feature.h"
#endif
#include "magick/random_.h"
@@ -897,7 +897,7 @@
return(MACIsMagickConflict(magick));
#elif defined(vms)
return(VMSIsMagickConflict(magick));
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
return(NTIsMagickConflict(magick));
#else
return(MagickFalse);
@@ -1169,7 +1169,7 @@
if (signal_number == SIGHUP)
exit(signal_number);
#endif
-#if defined(SIGINT) && !defined(__WINDOWS__)
+#if defined(SIGINT) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
if (signal_number == SIGINT)
exit(signal_number);
#endif
@@ -1218,7 +1218,7 @@
(void) SetLogEventMask(events);
events=DestroyString(events);
}
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
#if defined(_DEBUG) && !defined(__BORLANDC__) && !defined(__MINGW32__)
if (IsEventLogging() != MagickFalse)
{
@@ -1263,7 +1263,7 @@
if (signal_handlers[SIGHUP] == (SignalHandler *) NULL)
signal_handlers[SIGHUP]=RegisterMagickSignalHandler(SIGHUP);
#endif
-#if defined(SIGINT) && !defined(__WINDOWS__)
+#if defined(SIGINT) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
if (signal_handlers[SIGINT] == (SignalHandler *) NULL)
signal_handlers[SIGINT]=RegisterMagickSignalHandler(SIGINT);
#endif
@@ -1303,7 +1303,9 @@
(void) TypeComponentGenesis();
(void) MimeComponentGenesis();
(void) ConstituteComponentGenesis();
+#if defined(MAGICKCORE_X11_DELEGATE)
(void) XComponentGenesis();
+#endif
}
/*
@@ -1333,7 +1335,7 @@
MimeComponentTerminus();
TypeComponentTerminus();
ColorComponentTerminus();
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
NTGhostscriptUnLoadDLL();
#endif
MagicComponentTerminus();
diff --git a/magick/module.c b/magick/module.c
index e714e04..46976cb 100644
--- a/magick/module.c
+++ b/magick/module.c
@@ -628,7 +628,7 @@
return(MagickTrue);
}
#else
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
{
const char
*registery_key;
@@ -673,8 +673,8 @@
}
#endif
#endif
-#if !defined(MAGICKCORE_CODER_PATH) && !defined(__WINDOWS__)
-# error MAGICKCORE_CODER_PATH or __WINDOWS__ must be defined when MAGICKCORE_INSTALLED_SUPPORT is defined
+#if !defined(MAGICKCORE_CODER_PATH) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
+# error MAGICKCORE_CODER_PATH or MAGICKCORE_WINDOWS_SUPPORT must be defined when MAGICKCORE_INSTALLED_SUPPORT is defined
#endif
#else
{
@@ -754,7 +754,7 @@
if (IsPathAccessible(path) != MagickFalse)
return(MagickTrue);
}
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
{
/*
Search module path.
@@ -1408,7 +1408,7 @@
(void) FormatMagickString(name,MaxTextExtent,"%s.la",tag);
(void) LocaleLower(name);
#else
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
if (LocaleNCompare("IM_MOD_",tag,7) == 0)
(void) CopyMagickString(name,tag,MaxTextExtent);
else
diff --git a/magick/nt-base.c b/magick/nt-base.c
index 9786fad..fe3fdb6 100644
--- a/magick/nt-base.c
+++ b/magick/nt-base.c
@@ -39,7 +39,7 @@
Include declarations.
*/
#include "magick/studio.h"
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
#include "magick/client.h"
#include "magick/log.h"
#include "magick/magick.h"
@@ -82,7 +82,7 @@
/*
External declarations.
*/
-#if !defined(__WINDOWS__)
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT)
extern "C" BOOL WINAPI
DllMain(HINSTANCE handle,DWORD reason,LPVOID lpvReserved);
#endif
@@ -236,6 +236,7 @@
return(0);
}
+#if !defined(__MINGW32__)
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
@@ -260,7 +261,6 @@
% o time_zone: the time zone.
%
*/
-#if !defined(__MINGW32__)
MagickExport int gettimeofday (struct timeval *time_value,
struct timezone *time_zone)
{
diff --git a/magick/nt-base.h b/magick/nt-base.h
index d70515a..e024148 100644
--- a/magick/nt-base.h
+++ b/magick/nt-base.h
@@ -96,7 +96,7 @@
# define fseeko _fseeki64
#endif
#if !defined(fstat) && !defined(__BORLANDC__)
-#if defined(__WINDOWS__) && !defined(Windows95) && \
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
!(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
# define fstat _fstati64
#else
@@ -191,7 +191,7 @@
# define spawnvp _spawnvp
#endif
#if !defined(stat) && !defined(__BORLANDC__)
-#if defined(__WINDOWS__) && !defined(Windows95) && \
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
!(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
# define stat _stati64
#else
@@ -222,7 +222,7 @@
# define write _write
#endif
#if !defined(wstat) && !defined(__BORLANDC__)
-#if defined(__WINDOWS__) && !defined(Windows95) && \
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
!(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
# define wstat _wstati64
#else
@@ -230,7 +230,7 @@
#endif
#endif
-#if defined(_MT) && defined(__WINDOWS__)
+#if defined(_MT) && defined(MAGICKCORE_WINDOWS_SUPPORT)
# define SAFE_GLOBAL __declspec(thread)
#else
# define SAFE_GLOBAL
diff --git a/magick/nt-feature.c b/magick/nt-feature.c
index aad7f80..e091b5f 100644
--- a/magick/nt-feature.c
+++ b/magick/nt-feature.c
@@ -41,7 +41,7 @@
Include declarations.
*/
#include "magick/studio.h"
-#if defined(__WINDOWS__) || defined(__CYGWIN__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__)
#define WIN32_LEAN_AND_MEAN
#define VC_EXTRALEAN
#include <windows.h>
diff --git a/magick/quantize.c b/magick/quantize.c
index 4008fbd..72e4d0f 100644
--- a/magick/quantize.c
+++ b/magick/quantize.c
@@ -2440,6 +2440,49 @@
% o image: the image.
%
*/
+static MagickBooleanType DirectToColormapImage(Image *image,
+ ExceptionInfo *exception)
+{
+ CacheView
+ *image_view;
+
+ long
+ y;
+
+ MagickBooleanType
+ status;
+
+ register long
+ i;
+
+ unsigned long
+ number_colors;
+
+ status=MagickTrue;
+ number_colors=(unsigned long) (image->columns*image->rows);
+ if (AcquireImageColormap(image,number_colors) == MagickFalse)
+ ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
+ image->filename);
+ i=0;
+ image_view=AcquireCacheView(image);
+ for (y=0; y < (long) image->rows; y++)
+ {
+ register const PixelPacket
+ *restrict p;
+
+ register long
+ x;
+
+ p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception);
+ if (p == (const PixelPacket *) NULL)
+ break;
+ for (x=0; x < (long) image->columns; x++)
+ image->colormap[i++]=(*p++);
+ }
+ image_view=DestroyCacheView(image_view);
+ return(status);
+}
+
MagickExport MagickBooleanType QuantizeImage(const QuantizeInfo *quantize_info,
Image *image)
{
@@ -2470,6 +2513,8 @@
if ((image->storage_class == PseudoClass) &&
(image->colors <= maximum_colors))
return(MagickTrue);
+ if ((image->columns*image->rows) <= maximum_colors)
+ return(DirectToColormapImage(image,&image->exception));
depth=quantize_info->tree_depth;
if (depth == 0)
{
diff --git a/magick/random.c b/magick/random.c
index fe31891..4b6fb2b 100644
--- a/magick/random.c
+++ b/magick/random.c
@@ -315,7 +315,7 @@
%
*/
-#if !defined(__WINDOWS__)
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT)
static ssize_t ReadRandom(int file,unsigned char *source,size_t length)
{
register unsigned char
@@ -461,7 +461,7 @@
filename=DestroyString(filename);
}
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
{
double
seconds;
diff --git a/magick/resource.c b/magick/resource.c
index 39eb8f1..d21247d 100644
--- a/magick/resource.c
+++ b/magick/resource.c
@@ -365,7 +365,7 @@
directory=GetPolicyValue("temporary-path");
if (directory == (char *) NULL)
directory=GetEnvironmentValue("TMPDIR");
-#if defined(__WINDOWS__) || defined(__OS2__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__OS2__)
if (directory == (char *) NULL)
directory=GetEnvironmentValue("TMP");
if (directory == (char *) NULL)
diff --git a/magick/studio.h b/magick/studio.h
index 06a722a..03a1e3e 100644
--- a/magick/studio.h
+++ b/magick/studio.h
@@ -22,38 +22,10 @@
extern "C" {
#endif
-#if defined(__CYGWIN32__)
-# if !defined(__CYGWIN__)
-# define __CYGWIN__ __CYGWIN32__
-# endif
-#endif
-
-#if defined(_WIN32) || defined(WIN32)
-# if !defined(__WINDOWS__)
-# if defined(_WIN32)
-# define __WINDOWS__ _WIN32
-# else
-# if defined(WIN32)
-# define __WINDOWS__ WIN32
-# endif
-# endif
-# endif
-#endif
-
-#if defined(_WIN64) || defined(WIN64)
-# if !defined(__WINDOWS__)
-# if defined(_WIN64)
-# define __WINDOWS__ _WIN64
-# else
-# if defined(WIN64)
-# define __WINDOWS__ WIN64
-# endif
-# endif
-# endif
-#endif
-
-#if !defined(vms) && !defined(macintosh) && !defined(__WINDOWS__)
-# define MAGICKCORE_POSIX_SUPPORT
+#if defined(WIN32) || defined(WIN64)
+# define MAGICKCORE_WINDOWS_SUPPORT
+#else
+# define MAGICKCORE_POSIX_SUPPORT
#endif
#define MAGICKCORE_IMPLEMENTATION 1
@@ -98,7 +70,7 @@
# undef MAGICKCORE_BUILD_MODULES
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
# define _MAGICKDLL_
# endif
@@ -188,10 +160,10 @@
#if defined(MAGICKCORE_HAVE_UNISTD_H)
# include <unistd.h>
#endif
-#if defined(__WINDOWS__) && defined(_DEBUG)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include <direct.h>
# if !defined(MAGICKCORE_HAVE_STRERROR)
# define HAVE_STRERROR
@@ -210,7 +182,7 @@
#if defined(MAGICKCORE_HAVE_PTHREAD)
# include <pthread.h>
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
# define MAGICKCORE_HAVE_WINTHREADS 1
#include <windows.h>
#endif
@@ -270,7 +242,7 @@
# endif
#endif
-#if defined(__WINDOWS__) || defined(MAGICKCORE_POSIX_SUPPORT)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
# include <sys/types.h>
# include <sys/stat.h>
# if defined(MAGICKCORE_HAVE_FTIME)
@@ -303,7 +275,7 @@
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
# endif
# include "magick/magick-type.h"
-# if !defined(__WINDOWS__)
+# if !defined(MAGICKCORE_WINDOWS_SUPPORT)
# include <sys/time.h>
# if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
# include <sys/times.h>
@@ -327,13 +299,13 @@
#if defined(S_IRUSR) && defined(S_IWUSR)
# define S_MODE (S_IRUSR | S_IWUSR)
-#elif defined (__WINDOWS__)
+#elif defined (MAGICKCORE_WINDOWS_SUPPORT)
# define S_MODE (_S_IREAD | _S_IWRITE)
#else
# define S_MODE 0600
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include "magick/nt-base.h"
#endif
#if defined(macintosh)
@@ -416,7 +388,7 @@
SetWarningHandler(MACWarningHandler)
# endif
# endif
-# if defined(__WINDOWS__)
+# if defined(MAGICKCORE_WINDOWS_SUPPORT)
# define DirectorySeparator "\\"
# define DirectoryListSeparator ';'
# define EditorOptions ""
@@ -454,7 +426,7 @@
#define PATH_MAX 4096
#endif
-#if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(__WINDOWS__) && defined(_DLL) && !defined(_LIB))
+#if defined(MAGICKCORE_LTDL_DELEGATE) || (defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DLL) && !defined(_LIB))
# define MAGICKCORE_MODULES_SUPPORT
#endif
@@ -466,7 +438,7 @@
/*
I/O defines.
*/
-#if defined(__WINDOWS__) && !defined(Windows95) && !defined(__BORLANDC__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && !defined(__BORLANDC__)
#define MagickSeek(file,offset,whence) _lseeki64(file,offset,whence)
#define MagickTell(file) _telli64(file)
#else
diff --git a/magick/thread-private.h b/magick/thread-private.h
index 9a35859..b8902c4 100644
--- a/magick/thread-private.h
+++ b/magick/thread-private.h
@@ -33,7 +33,7 @@
#if defined(MAGICKCORE_HAVE_PTHREAD)
typedef pthread_mutex_t MagickMutexType;
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
typedef CRITICAL_SECTION MagickMutexType;
#else
typedef unsigned long MagickMutexType;
@@ -43,7 +43,7 @@
{
#if defined(MAGICKCORE_HAVE_PTHREAD)
return(pthread_self());
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
return(GetCurrentThreadId());
#else
return(getpid());
@@ -67,7 +67,7 @@
magick_thread.id=pthread_self();
return(magick_thread.signature);
}
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
return((unsigned long) GetCurrentThreadId());
#else
return((unsigned long) getpid());
@@ -79,7 +79,7 @@
#if defined(MAGICKCORE_HAVE_PTHREAD)
if (pthread_equal(id,pthread_self()) != 0)
return(MagickTrue);
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
if (id == GetCurrentThreadId())
return(MagickTrue);
#else
diff --git a/magick/timer.c b/magick/timer.c
index 4adc2d2..ac8e366 100644
--- a/magick/timer.c
+++ b/magick/timer.c
@@ -196,7 +196,7 @@
return((double) times(&timer)/CLK_TCK);
#else
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
return(NTElapsedTime());
#else
return((double) clock()/CLK_TCK);
@@ -451,7 +451,7 @@
(void) times(&timer);
return((double) (timer.tms_utime+timer.tms_stime)/CLK_TCK);
#else
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
return(NTUserTime());
#else
return((double) clock()/CLK_TCK);
diff --git a/magick/type.c b/magick/type.c
index 2204ff0..fd0392f 100644
--- a/magick/type.c
+++ b/magick/type.c
@@ -90,7 +90,7 @@
#define FC_WEIGHT_HEAVY FC_WEIGHT_BLACK
#endif
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include "magick/nt-feature.h"
#endif
@@ -779,7 +779,7 @@
(instantiate_type == MagickFalse))
{
(void) LoadTypeLists(MagickTypeFilename,exception);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
(void) NTLoadTypeLists(type_list,exception);
#endif
#if defined(MAGICKCORE_FONTCONFIG_DELEGATE)
@@ -975,7 +975,7 @@
status=MagickTrue;
type_info=(TypeInfo *) NULL;
token=AcquireString(xml);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
/*
Determine the Ghostscript font path.
*/
@@ -1137,7 +1137,7 @@
*path;
path=ConstantString(token);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
if (strchr(path,'@') != (char *) NULL)
SubstituteString(&path,"@ghostscript_font_path@",font_path);
#endif
@@ -1167,7 +1167,7 @@
*path;
path=ConstantString(token);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
if (strchr(path,'@') != (char *) NULL)
SubstituteString(&path,"@ghostscript_font_path@",font_path);
#endif
diff --git a/magick/utility.c b/magick/utility.c
index 62c8006..b61adc6 100644
--- a/magick/utility.c
+++ b/magick/utility.c
@@ -963,7 +963,7 @@
}
}
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
NTGetExecutionPath(path,extent);
#endif
#if defined(__GNU__)
@@ -1168,7 +1168,7 @@
/*
Not UTF-8, just copy.
*/
- length=strlen(source);
+ length=strlen((const char *) source);
utf16=(wchar_t *) AcquireQuantumMemory(length+1,sizeof(*utf16));
if (utf16 == (wchar_t *) NULL)
return((wchar_t *) NULL);
@@ -1685,7 +1685,7 @@
if (*entry->d_name == '.')
continue;
if ((IsPathDirectory(entry->d_name) > 0) ||
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
(GlobExpression(entry->d_name,pattern,MagickTrue) != MagickFalse))
#else
(GlobExpression(entry->d_name,pattern,MagickFalse) != MagickFalse))
@@ -1961,7 +1961,7 @@
}
}
#endif
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
{
int
mode;
diff --git a/magick/version.h b/magick/version.h
index 205fb0b..48d1e8e 100644
--- a/magick/version.h
+++ b/magick/version.h
@@ -33,8 +33,8 @@
#define MagickLibAddendum "-6"
#define MagickLibInterface 3
#define MagickLibMinInterface 3
-#define MagickReleaseDate "2010-04-23"
-#define MagickChangeDate "20100417"
+#define MagickReleaseDate "2010-04-24"
+#define MagickChangeDate "20100424"
#define MagickAuthoritativeURL "http://www.imagemagick.org"
#define MagickHomeURL "file:///usr/local/share/doc/ImageMagick-6.6.1/index.html"
#if (MAGICKCORE_QUANTUM_DEPTH == 8)
diff --git a/magick/xwindow.c b/magick/xwindow.c
index d1c2592..7fb7577 100644
--- a/magick/xwindow.c
+++ b/magick/xwindow.c
@@ -1777,7 +1777,7 @@
(void) XFlush(display);
if (milliseconds == 0)
return;
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
Sleep(milliseconds);
#elif defined(vms)
{
@@ -5142,7 +5142,7 @@
windows->im_retain_colors=XInternAtom(display,"IM_RETAIN_COLORS",MagickFalse);
windows->im_exit=XInternAtom(display,"IM_EXIT",MagickFalse);
windows->dnd_protocols=XInternAtom(display,"DndProtocol",MagickFalse);
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
(void) XSynchronize(display,IsWindows95());
#endif
if (IsEventLogging())
diff --git a/tests/validate.h b/tests/validate.h
index 2eba388..dacd320 100644
--- a/tests/validate.h
+++ b/tests/validate.h
@@ -351,7 +351,7 @@
{ "XPM", UndefinedCompression, 0.0 },
{ "XPS", UndefinedCompression, 0.0 },
{ "XV", UndefinedCompression, 0.0 },
-#if !defined(__WINDOWS__)
+#if !defined(MAGICKCORE_WINDOWS_SUPPORT)
{ "XWD", UndefinedCompression, 0.0 },
#endif
{ "YUV", UndefinedCompression, 0.0 },
diff --git a/utilities/animate.c b/utilities/animate.c
index fa74fa2..dff362d 100644
--- a/utilities/animate.c
+++ b/utilities/animate.c
@@ -67,7 +67,7 @@
%
*/
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
int WINAPI WinMain(HINSTANCE instance,HINSTANCE last,LPSTR command,int state)
{
char
diff --git a/utilities/display.c b/utilities/display.c
index 83d94a8..d8b68d4 100644
--- a/utilities/display.c
+++ b/utilities/display.c
@@ -72,7 +72,7 @@
%
*/
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
int WINAPI WinMain(HINSTANCE instance,HINSTANCE last,LPSTR command,int state)
{
char
diff --git a/utilities/import.c b/utilities/import.c
index 71204a5..6fb2fd1 100644
--- a/utilities/import.c
+++ b/utilities/import.c
@@ -64,7 +64,7 @@
%
*/
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
int WINAPI WinMain(HINSTANCE instance,HINSTANCE last,LPSTR command,int state)
{
char
diff --git a/wand/MagickWand.h b/wand/MagickWand.h
index 1dcaf51..7a03ffc 100644
--- a/wand/MagickWand.h
+++ b/wand/MagickWand.h
@@ -46,36 +46,13 @@
#include <stdlib.h>
#include <sys/types.h>
-#if defined(__CYGWIN32__)
-# if !defined(__CYGWIN__)
-# define __CYGWIN__ __CYGWIN32__
-# endif
-#endif
-#if defined(_WIN32) || defined(WIN32)
-# if !defined(__WINDOWS__)
-# if defined(_WIN32)
-# define __WINDOWS__ _WIN32
-# else
-# if defined(WIN32)
-# define __WINDOWS__ WIN32
-# endif
-# endif
-# endif
-#endif
+#if defined(WIN32) || defined(WIN64)
+# define MAGICKCORE_WINDOWS_SUPPORT
+#else
+# define MAGICKCORE_POSIX_SUPPORT
+#endif
-#if defined(_WIN64) || defined(WIN64)
-# if !defined(__WINDOWS__)
-# if defined(_WIN64)
-# define __WINDOWS__ _WIN64
-# else
-# if defined(WIN64)
-# define __WINDOWS__ WIN64
-# endif
-# endif
-# endif
-#endif
-
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
# define _MAGICKDLL_
# endif
diff --git a/wand/studio.h b/wand/studio.h
index c233564..6b8f750 100644
--- a/wand/studio.h
+++ b/wand/studio.h
@@ -22,39 +22,11 @@
extern "C" {
#endif
-#if defined(__CYGWIN32__)
-# if !defined(__CYGWIN__)
-# define __CYGWIN__ __CYGWIN32__
-# endif
-#endif
-
-#if defined(_WIN32) || defined(WIN32)
-# if !defined(__WINDOWS__)
-# if defined(_WIN32)
-# define __WINDOWS__ _WIN32
-# else
-# if defined(WIN32)
-# define __WINDOWS__ WIN32
-# endif
-# endif
-# endif
-#endif
-
-#if defined(_WIN64) || defined(WIN64)
-# if !defined(__WINDOWS__)
-# if defined(_WIN64)
-# define __WINDOWS__ _WIN64
-# else
-# if defined(WIN64)
-# define __WINDOWS__ WIN64
-# endif
-# endif
-# endif
-#endif
-
-#if !defined(vms) && !defined(macintosh) && !defined(__WINDOWS__)
-# define MAGICKCORE_POSIX_SUPPORT
-#endif
+#if defined(WIN32) || defined(WIN64)
+# define MAGICKCORE_WINDOWS_SUPPORT
+#else
+# define MAGICKCORE_POSIX_SUPPORT
+#endif
#define MAGICKWAND_IMPLEMENTATION 1
@@ -92,7 +64,7 @@
# define _MAGICKLIB_
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# if defined(_MT) && defined(_DLL) && !defined(_MAGICKDLL_) && !defined(_LIB)
# define _MAGICKDLL_
# endif
@@ -188,20 +160,20 @@
#if defined(MAGICKCORE_HAVE_UNISTD_H)
# include <unistd.h>
#endif
-#if defined(__WINDOWS__) && defined(_DEBUG)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include <direct.h>
# if !defined(MAGICKCORE_HAVE_STRERROR)
# define HAVE_STRERROR
# endif
#endif
-#if defined(__WINDOWS__) && defined(_DEBUG)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include <direct.h>
# if !defined(MAGICKCORE_HAVE_STRERROR)
# define HAVE_STRERROR
@@ -220,7 +192,7 @@
#if defined(MAGICKCORE_HAVE_PTHREAD)
# include <pthread.h>
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
# define MAGICKCORE_HAVE_WINTHREADS 1
#include <windows.h>
#endif
@@ -280,7 +252,7 @@
# endif
#endif
-#if defined(__WINDOWS__) || defined(MAGICKCORE_POSIX_SUPPORT)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(MAGICKCORE_POSIX_SUPPORT)
# include <sys/types.h>
# include <sys/stat.h>
# if defined(MAGICKCORE_HAVE_FTIME)
@@ -313,7 +285,7 @@
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
# endif
# include "wand/MagickWand.h"
-# if !defined(__WINDOWS__)
+# if !defined(MAGICKCORE_WINDOWS_SUPPORT)
# include <sys/time.h>
# if defined(MAGICKCORE_HAVE_SYS_TIMES_H)
# include <sys/times.h>
@@ -337,13 +309,13 @@
#if defined(S_IRUSR) && defined(S_IWUSR)
# define S_MODE (S_IRUSR | S_IWUSR)
-#elif defined (__WINDOWS__)
+#elif defined (MAGICKCORE_WINDOWS_SUPPORT)
# define S_MODE (_S_IREAD | _S_IWRITE)
#else
# define S_MODE 0600
#endif
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
# include "magick/nt-base.h"
#endif
#if defined(macintosh)
@@ -426,7 +398,7 @@
SetWarningHandler(MACWarningHandler)
# endif
# endif
-# if defined(__WINDOWS__)
+# if defined(MAGICKCORE_WINDOWS_SUPPORT)
# define DirectorySeparator "\\"
# define DirectoryListSeparator ';'
# define EditorOptions ""
@@ -467,7 +439,7 @@
/*
I/O defines.
*/
-#if defined(__WINDOWS__) && !defined(Windows95) && !defined(__BORLANDC__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && !defined(__BORLANDC__)
#define MagickSeek(file,offset,whence) _lseeki64(file,offset,whence)
#define MagickTell(file) _telli64(file)
#else