]> granicus.if.org Git - imagemagick/blobdiff - magick/nt-base.c
(no commit message)
[imagemagick] / magick / nt-base.c
index 9786fad75e68748020a1e46e608a7b2afcbe95a2..166fc6f04b94b1be35a3d641bd4ed3b12cab9eab 100644 (file)
@@ -17,7 +17,7 @@
 %                                December 1996                                %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -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 @@ static void
 /*
   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 @@ MagickExport int Exit(int status)
   return(0);
 }
 \f
+#if !defined(__MINGW32__)
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %                                                                             %
@@ -260,7 +261,6 @@ MagickExport int Exit(int status)
 %    o time_zone: the time zone.
 %
 */
-#if !defined(__MINGW32__)
 MagickExport int gettimeofday (struct timeval *time_value,
   struct timezone *time_zone)
 {
@@ -286,8 +286,8 @@ MagickExport int gettimeofday (struct timeval *time_value,
       time=date_time.QuadPart;
       time-=EpochFiletime;
       time/=10;
-      time_value->tv_sec=(long) (time / 1000000);
-      time_value->tv_usec=(long) (time % 1000000);
+      time_value->tv_sec=(ssize_t) (time / 1000000);
+      time_value->tv_usec=(ssize_t) (time % 1000000);
     }
   if (time_zone != (struct timezone *) NULL)
     {
@@ -786,7 +786,7 @@ MagickExport MagickBooleanType NTGetModulePath(const char *module,char *path)
   HMODULE
     handle;
 
-  long
+  ssize_t
     length;
 
   *path='\0';
@@ -892,7 +892,7 @@ static int NTLocateGhostscript(const char **product_family,int *major_version,
   *product_family=NULL;
   *major_version=5;
   *minor_version=49; /* min version of Ghostscript is 5.50 */
-  for (i=0; i < (long) (sizeof(products)/sizeof(products[0])); i++)
+  for (i=0; i < (ssize_t) (sizeof(products)/sizeof(products[0])); i++)
   {
     char
       key[MaxTextExtent];
@@ -946,7 +946,6 @@ static int NTLocateGhostscript(const char **product_family,int *major_version,
   }
   if (status == FALSE)
     {
-      i=0;
       *major_version=0;
       *minor_version=0;
     }
@@ -996,7 +995,7 @@ static int NTGhostscriptGetString(const char *name,char *value,
     return(FALSE);
   (void) FormatMagickString(key,MaxTextExtent,"SOFTWARE\\%s\\%d.%02d",
     product_family,major_version,minor_version);
-  for (i=0; i < (long) (sizeof(hkeys)/sizeof(hkeys[0])); i++)
+  for (i=0; i < (ssize_t) (sizeof(hkeys)/sizeof(hkeys[0])); i++)
   {
     extent=(int) length;
     if (NTGetRegistryValue(hkeys[i].hkey,key,name,value,&extent) == 0)
@@ -1380,7 +1379,7 @@ MagickExport DIR *NTOpenDirectory(const char *path)
     MaxTextExtent);
   if (length >= MaxTextExtent)
     return((DIR *) NULL);
-  entry=(DIR *) AcquireAlignedMemory(1,sizeof(DIR));
+  entry=(DIR *) AcquireMagickMemory(sizeof(DIR));
   if (entry != (DIR *) NULL)
     {
       entry->firsttime=TRUE;
@@ -1778,7 +1777,7 @@ MagickExport unsigned char *NTResourceToBlob(const char *id)
 %
 %  The format of the NTSeekDirectory method is:
 %
-%      void NTSeekDirectory(DIR *entry,long position)
+%      void NTSeekDirectory(DIR *entry,ssize_t position)
 %
 %  A description of each parameter follows:
 %
@@ -1788,7 +1787,7 @@ MagickExport unsigned char *NTResourceToBlob(const char *id)
 %      stream.
 %
 */
-MagickExport void NTSeekDirectory(DIR *entry,long position)
+MagickExport void NTSeekDirectory(DIR *entry,ssize_t position)
 {
   (void) position;
   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
@@ -1958,14 +1957,14 @@ MagickExport int NTSystemCommand(const char *command)
 %
 %  The format of the exit method is:
 %
-%      long NTSystemConfiguration(int name)
+%      ssize_t NTSystemConfiguration(int name)
 %
 %  A description of each parameter follows:
 %
 %    o name: _SC_PAGE_SIZE or _SC_PHYS_PAGES.
 %
 */
-MagickExport long NTSystemConfiguration(int name)
+MagickExport ssize_t NTSystemConfiguration(int name)
 {
   switch (name)
   {
@@ -2002,12 +2001,12 @@ MagickExport long NTSystemConfiguration(int name)
             status;
 
           GlobalMemoryStatus(&status);
-          return((long) status.dwTotalPhys/system_info.dwPageSize);
+          return((ssize_t) status.dwTotalPhys/system_info.dwPageSize);
         }
       status.dwLength=sizeof(status);
       if (module(&status) == 0)
         return(0L);
-      return((long) status.ullTotalPhys/system_info.dwPageSize);
+      return((ssize_t) status.ullTotalPhys/system_info.dwPageSize);
     }
     case _SC_OPEN_MAX:
       return(2048);
@@ -2033,14 +2032,14 @@ MagickExport long NTSystemConfiguration(int name)
 %
 %  The format of the NTTellDirectory method is:
 %
-%      long NTTellDirectory(DIR *entry)
+%      ssize_t NTTellDirectory(DIR *entry)
 %
 %  A description of each parameter follows:
 %
 %    o entry: Specifies a pointer to a DIR structure.
 %
 */
-MagickExport long NTTellDirectory(DIR *entry)
+MagickExport ssize_t NTTellDirectory(DIR *entry)
 {
   assert(entry != (DIR *) NULL);
   return(0);