]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/nt-base.h
Added caNv, eXIf, and pHYs to the list of PNG chunks to be removed
[imagemagick] / MagickCore / nt-base.h
index 39d980fc925ae6fe5a7706498a779d529fc7e449..518c45b563bae68ea483bad82115b83c32a6283a 100644 (file)
@@ -1,12 +1,12 @@
 /*
-  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization
+  Copyright 1999-2017 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.
   obtain a copy of the License at
-
-    http://www.imagemagick.org/script/license.php
-
+  
+    https://www.imagemagick.org/script/license.php
+  
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
   MagickCore Windows NT utility methods.
 */
-#ifndef _MAGICKCORE_NT_BASE_H
-#define _MAGICKCORE_NT_BASE_H
+#ifndef MAGICKCORE_NT_BASE_H
+#define MAGICKCORE_NT_BASE_H
+
+#include "MagickCore/exception.h"
+#include "MagickCore/geometry.h"
 
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {
 #endif
 
-#include "MagickCore/delegate.h"
-#include "MagickCore/delegate-private.h"
-#include "MagickCore/exception.h"
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
 
 #define WIN32_LEAN_AND_MEAN
 #define VC_EXTRALEAN
@@ -36,7 +37,9 @@ extern "C" {
 #include <io.h>
 #include <process.h>
 #include <errno.h>
-#if defined(_DEBUG) && !defined(__MINGW32__)
+#include <malloc.h>
+#include <sys/utime.h>
+#if defined(_DEBUG) && !defined(__MINGW32__) && !defined(__MINGW64__)
 #include <crtdbg.h>
 #endif
 
@@ -64,6 +67,10 @@ extern "C" {
     1310 Visual c++ .NET 2003
     1400 Visual C++ 2005
     1500 Visual C++ 2008
+    1600 Visual C++ 2010
+    1700 Visual C++ 2012
+    1800 Visual C++ 2013
+    1900 Visual C++ 2015
 */
 
 #if !defined(chsize)
@@ -88,21 +95,27 @@ extern "C" {
 #if !defined(closedir)
 #  define closedir(directory)  NTCloseDirectory(directory)
 #endif
+#define MAGICKCORE_HAVE_ERF
+#if defined(_VISUALC_) && (_MSC_VER < 1700)
+#  define erf(x)  NTErf(x)
+#endif
 #if !defined(fdopen)
 #  define fdopen  _fdopen
 #endif
 #if !defined(fileno)
 #  define fileno  _fileno
 #endif
-#if !defined(fseek) && !defined(__MINGW32__)
+#if !defined(fseek) && !defined(__MINGW32__) && !defined(__MINGW64__)
 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
-  !(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
+  !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
+  !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
 #  define fseek  _fseeki64
 #endif
 #endif
 #if !defined(fstat) && !defined(__BORLANDC__)
 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
-  !(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
+  !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
+  !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
 #  define fstat  _fstati64
 #else
 #  define fstat  _fstat
@@ -111,9 +124,10 @@ extern "C" {
 #if !defined(fsync)
 #  define fsync  _commit
 #endif
-#if !defined(ftell) && !defined(__MINGW32__)
+#if !defined(ftell) && !defined(__MINGW32__) && !defined(__MINGW64__)
 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
-  !(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
+  !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
+  !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
 #  define ftell  _ftelli64
 #endif
 #endif
@@ -129,21 +143,23 @@ extern "C" {
 #if !defined(hypot)
 #  define hypot  _hypot
 #endif
-#if !defined(inline)
-#  define inline __inline
-#endif
 #if !defined(isatty)
-#  define isatty _isatty
+#  define isatty  _isatty
 #endif
 #if !defined(locale_t)
 #define locale_t _locale_t
 #endif
 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
-  !(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
+  !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
+  !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
+#if !defined(lseek)
 #  define lseek  _lseeki64
+#endif
 #else
+#if !defined(lseek)
 #  define lseek  _lseek
 #endif
+#endif
 #if !defined(MAGICKCORE_LTDL_DELEGATE)
 #if !defined(lt_dlclose)
 #  define lt_dlclose(handle)  NTCloseLibrary(handle)
@@ -196,7 +212,7 @@ extern "C" {
 #define fprintf_l  _fprintf_s_l
 #endif
 #if !defined(read)
-#  define read  _read
+#  define read(fd,buffer,count)  _read(fd,buffer,(unsigned int) count)
 #endif
 #if !defined(readdir)
 #  define readdir(directory)  NTReadDirectory(directory)
@@ -215,14 +231,15 @@ extern "C" {
 #endif
 #if !defined(stat) && !defined(__BORLANDC__)
 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
-  !(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
+  !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
+  !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
 #  define stat  _stati64
 #else
 #  define stat  _stat
 #endif
 #endif
 #if !defined(strcasecmp)
-#  define strcasecmp  _strcmpi
+#  define strcasecmp  _stricmp
 #endif
 #if !defined(strncasecmp)
 #  define strncasecmp  _strnicmp
@@ -231,7 +248,8 @@ extern "C" {
 #  define sysconf(name)  NTSystemConfiguration(name)
 #endif
 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
-  !(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
+  !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
+  !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
 #  define tell  _telli64
 #else
 #  define tell  _tell
@@ -242,6 +260,15 @@ extern "C" {
 #if !defined(tempnam)
 #  define tempnam  _tempnam_s
 #endif
+#if !defined(umask)
+#  define umask  _umask
+#endif
+#if !defined(unlink)
+#  define unlink  _unlink
+#endif
+#if !defined(utime)
+#  define utime(filename,time)  _utime(filename,(struct _utimbuf*) time)
+#endif
 #if !defined(vfprintf_l)
 #define vfprintf_l  _vfprintf_l
 #endif
@@ -254,23 +281,18 @@ extern "C" {
 #define vsnprintf_l  _vsnprintf_l
 #endif
 #if !defined(write)
-#  define write  _write
+#  define write(fd,buffer,count)  _write(fd,buffer,(unsigned int) count)
 #endif
 #if !defined(wstat) && !defined(__BORLANDC__)
 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
-  !(defined(_MSC_VER) && (_MSC_VER < 1400)) && (__MSVCRT_VERSION__ < 0x800)
+  !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
+  !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
 #  define wstat  _wstati64
 #else
 #  define wstat  _wstat
 #endif
 #endif
 
-#if defined(_MT) && defined(MAGICKCORE_WINDOWS_SUPPORT)
-#  define SAFE_GLOBAL  __declspec(thread)
-#else
-#  define SAFE_GLOBAL
-#endif
-
 #if defined(__BORLANDC__)
 #undef _O_RANDOM
 #define _O_RANDOM 0
@@ -282,145 +304,25 @@ extern "C" {
 #define _O_TEMPORARY 0
 #endif
 
-#if !defined(XS_VERSION)
-struct dirent
-{
-  char
-    d_name[2048];
-
-  int
-    d_namlen;
-};
-
-typedef struct _DIR
-{
-  HANDLE
-    hSearch;
+#undef gettimeofday
 
-  WIN32_FIND_DATA
-    Win32FindData;
-
-  BOOL
-    firsttime;
-
-  struct dirent
-    file_info;
-} DIR;
-
-typedef struct _NTMEMORYSTATUSEX
-{
-  DWORD
-    dwLength,
-    dwMemoryLoad;
-
-  DWORDLONG
-    ullTotalPhys,
-    ullAvailPhys,
-    ullTotalPageFile,
-    ullAvailPageFile,
-    ullTotalVirtual,
-    ullAvailVirtual,
-    ullAvailExtendedVirtual;
-} NTMEMORYSTATUSEX;
-
-#if !defined(__MINGW32__)
-struct timezone
-{
-  int
-    tz_minuteswest,
-    tz_dsttime;
-};
-#endif
-
-typedef UINT
-  (CALLBACK *LPFNDLLFUNC1)(DWORD,UINT);
-
-typedef UINT
-  (CALLBACK *LPFNDLLFUNC2)(NTMEMORYSTATUSEX *);
-
-#endif
-
-#if defined(MAGICKCORE_BZLIB_DELEGATE)
-#  if defined(_WIN32)
-#    define BZ_IMPORT 1
-#  endif
-#endif
+typedef struct _GhostInfo
+  GhostInfo_;
 
 extern MagickExport char
-  *NTGetLastError(void),
   **NTArgvToUTF8(const int argc,wchar_t **);
 
-extern MagickExport const GhostInfo
+extern MagickExport const GhostInfo_
   *NTGhostscriptDLLVectors(void);
 
-#if !defined(MAGICKCORE_LTDL_DELEGATE)
-extern MagickExport const char
-  *NTGetLibraryError(void);
-#endif
-
-#if !defined(XS_VERSION)
-extern MagickExport const char
-  *NTGetLibraryError(void);
-
-extern MagickExport DIR
-  *NTOpenDirectory(const char *);
-
-extern MagickExport double
-  NTElapsedTime(void),
-  NTUserTime(void);
-
-extern MagickExport int
-  Exit(int),
-#if !defined(__MINGW32__)
-  gettimeofday(struct timeval *,struct timezone *),
-#endif
-  IsWindows95(),
-  NTCloseDirectory(DIR *),
-  NTCloseLibrary(void *),
-  NTControlHandler(void),
-  NTExitLibrary(void),
-  NTTruncateFile(int,off_t),
-  NTGhostscriptDLL(char *,int),
-  NTGhostscriptEXE(char *,int),
-  NTGhostscriptFonts(char *,int),
-  NTGhostscriptLoadDLL(void),
-  NTGhostscriptUnLoadDLL(void),
-  NTInitializeLibrary(void),
-  NTSetSearchPath(const char *),
-  NTSyncMemory(void *,size_t,int),
-  NTUnmapMemory(void *,size_t),
-  NTSystemCommand(const char *);
-
-extern MagickExport ssize_t
-  NTSystemConfiguration(int),
-  NTTellDirectory(DIR *);
-
-extern MagickExport MagickBooleanType
-  NTGatherRandomData(const size_t,unsigned char *),
-  NTGetExecutionPath(char *,const size_t),
-  NTGetModulePath(const char *,char *),
-  NTReportEvent(const char *,const MagickBooleanType),
-  NTReportException(const char *,const MagickBooleanType);
-
-extern MagickExport struct dirent
-  *NTReadDirectory(DIR *);
-
-extern MagickExport unsigned char
-  *NTRegistryKeyLookup(const char *),
-  *NTResourceToBlob(const char *);
-
 extern MagickExport void
   NTErrorHandler(const ExceptionType,const char *,const char *),
-  *NTGetLibrarySymbol(void *,const char *),
-  *NTMapMemory(char *,size_t,int,int,int,MagickOffsetType),
-  *NTOpenLibrary(const char *),
-  NTSeekDirectory(DIR *,ssize_t),
+  NTGhostscriptUnLoadDLL(void),
   NTWarningHandler(const ExceptionType,const char *,const char *);
-
-#endif /* !XS_VERSION */
+#endif
 
 #if defined(__cplusplus) || defined(c_plusplus)
 }
-#endif /* !C++ */
+#endif
 
-#endif /* !_MAGICKCORE_NT_BASE_H */
+#endif