Unify the Win32 check to _WIN32 check which is defined by both VC and MinGW

master
Ondřej Surý 2013-04-23 06:03:59 +02:00
parent 3f2813e139
commit c60d9fe577
8 changed files with 28 additions and 31 deletions

View File

@ -26,7 +26,7 @@ extern "C" {
the gd sources in a project. */
/* http://gcc.gnu.org/wiki/Visibility */
#if defined(WIN32) || defined(CYGWIN) || defined(_WIN32_WCE)
#if defined(_WIN32) || defined(CYGWIN) || defined(_WIN32_WCE)
# if BGDWIN32
# ifdef NONDLL
# ifdef __GNUC__

View File

@ -266,7 +266,7 @@ BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression)
cleanup:
if (tmpfile_for_compression) {
#ifdef WIN32
#ifdef _WIN32
_rmtmp();
#else
fclose(tmpfile_for_compression);

View File

@ -1,7 +1,7 @@
#ifndef GD_ERRORS_H
#define GD_ERRORS_H
#ifndef WIN32
#ifndef _WIN32
# include <syslog.h>
#else
/*
@ -21,7 +21,6 @@
# define LOG_NOTICE 5 /* normal but significant condition */
# define LOG_INFO 6 /* informational */
# define LOG_DEBUG 7 /* debug-level messages */
#endif
/*

View File

@ -4,7 +4,7 @@
#include "gd.h"
#ifdef WIN32
#ifdef _WIN32
# include <windows.h>
#else
# include <unistd.h>
@ -18,7 +18,7 @@ typedef int (BGD_STDCALL *FuncPtr)(gdImagePtr, int, int);
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)<(b)?(b):(a))
#ifdef WIN32
#ifdef _WIN32
# define GD_SCATTER_SEED() (unsigned int)(time(0) * GetCurrentProcessId())
#else
# define GD_SCATTER_SEED() (unsigned int)(time(0) * getpid())

View File

@ -39,7 +39,7 @@
#ifdef HAVE_LIBJPEG
#include "gdhelpers.h"
#if defined(WIN32) && defined(__MINGW32__)
#if defined(_WIN32) && defined(__MINGW32__)
# define HAVE_BOOLEAN
#endif

View File

@ -4,7 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
#ifndef WIN32
#ifndef _WIN32
#include <unistd.h> /* For unlink function */
#endif

View File

@ -20,7 +20,7 @@
#include "entities.h"
/* 2.0.10: WIN32, not MSWIN32 */
#if !defined(WIN32) && !defined(_WIN32_WCE)
#if !defined(_WIN32) && !defined(_WIN32_WCE)
#include <unistd.h>
#elif defined(_WIN32_WCE)
#include <wce_stdlib.h> /* getenv() */

View File

@ -33,30 +33,28 @@ extern "C" {
/* 2.0.16: portable mutex support for thread safety. */
#ifdef WIN32
#if defined(_WIN32)
/* 2.0.18: must include windows.h to get CRITICAL_SECTION. */
#include <windows.h>
#define gdMutexDeclare(x) CRITICAL_SECTION x
#define gdMutexSetup(x) InitializeCriticalSection(&x)
#define gdMutexShutdown(x) DeleteCriticalSection(&x)
#define gdMutexLock(x) EnterCriticalSection(&x)
#define gdMutexUnlock(x) LeaveCriticalSection(&x)
# include <windows.h>
# define gdMutexDeclare(x) CRITICAL_SECTION x
# define gdMutexSetup(x) InitializeCriticalSection(&x)
# define gdMutexShutdown(x) DeleteCriticalSection(&x)
# define gdMutexLock(x) EnterCriticalSection(&x)
# define gdMutexUnlock(x) LeaveCriticalSection(&x)
#elif defined(HAVE_PTHREAD)
# include <pthread.h>
# define gdMutexDeclare(x) pthread_mutex_t x
# define gdMutexSetup(x) pthread_mutex_init(&x, 0)
# define gdMutexShutdown(x) pthread_mutex_destroy(&x)
# define gdMutexLock(x) pthread_mutex_lock(&x)
# define gdMutexUnlock(x) pthread_mutex_unlock(&x)
#else
#ifdef HAVE_PTHREAD
#include <pthread.h>
#define gdMutexDeclare(x) pthread_mutex_t x
#define gdMutexSetup(x) pthread_mutex_init(&x, 0)
#define gdMutexShutdown(x) pthread_mutex_destroy(&x)
#define gdMutexLock(x) pthread_mutex_lock(&x)
#define gdMutexUnlock(x) pthread_mutex_unlock(&x)
#else
#define gdMutexDeclare(x)
#define gdMutexSetup(x)
#define gdMutexShutdown(x)
#define gdMutexLock(x)
#define gdMutexUnlock(x)
#endif /* HAVE_PTHREAD */
#endif /* WIN32 */
# define gdMutexDeclare(x)
# define gdMutexSetup(x)
# define gdMutexShutdown(x)
# define gdMutexLock(x)
# define gdMutexUnlock(x)
#endif /* _WIN32 || HAVE_PTHREAD */
#define DPCM2DPI(dpcm) (unsigned int)((dpcm)*2.54 + 0.5)
#define DPM2DPI(dpm) (unsigned int)((dpm)*0.0254 + 0.5)