Drop support of not C99+ compilers (including old MSVC)

This commit is contained in:
Aleksandr Karpinskii 2024-09-01 20:34:55 +04:00 committed by Александр Карпинский
parent 2a7c9670c1
commit 34488d1d4e
8 changed files with 13 additions and 77 deletions

View File

@ -620,12 +620,6 @@ cms_profile_is_intent_supported(CmsProfileObject *self, PyObject *args) {
#ifdef _WIN32 #ifdef _WIN32
#ifdef _WIN64
#define F_HANDLE "K"
#else
#define F_HANDLE "k"
#endif
static PyObject * static PyObject *
cms_get_display_profile_win32(PyObject *self, PyObject *args) { cms_get_display_profile_win32(PyObject *self, PyObject *args) {
char filename[MAX_PATH]; char filename[MAX_PATH];

View File

@ -34,12 +34,6 @@
#include "libImaging/ImDib.h" #include "libImaging/ImDib.h"
#if SIZEOF_VOID_P == 8
#define F_HANDLE "K"
#else
#define F_HANDLE "k"
#endif
typedef struct { typedef struct {
PyObject_HEAD ImagingDIB dib; PyObject_HEAD ImagingDIB dib;
} ImagingDisplayObject; } ImagingDisplayObject;

View File

@ -19,10 +19,9 @@
* See the README file for information on usage and redistribution. * See the README file for information on usage and redistribution.
*/ */
#include "Imaging.h"
#ifdef _WIN32 #ifdef _WIN32
#include "Imaging.h"
#include "ImDib.h" #include "ImDib.h"
char * char *

View File

@ -35,7 +35,6 @@
#include "Imaging.h" #include "Imaging.h"
#include <math.h> #include <math.h>
#include <stdint.h>
#define CEIL(v) (int)ceil(v) #define CEIL(v) (int)ceil(v)
#define FLOOR(v) ((v) >= 0.0 ? (int)(v) : (int)floor(v)) #define FLOOR(v) ((v) >= 0.0 ? (int)(v) : (int)floor(v))

View File

@ -12,8 +12,6 @@
#ifdef _WIN32 #ifdef _WIN32
#include "ImagingPlatform.h"
#if defined(__cplusplus) #if defined(__cplusplus)
extern "C" { extern "C" {
#endif #endif

View File

@ -8,7 +8,7 @@
*/ */
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#include "Python.h" #include <Python.h>
/* Check that we have an ANSI compliant compiler */ /* Check that we have an ANSI compliant compiler */
#ifndef HAVE_PROTOTYPES #ifndef HAVE_PROTOTYPES
@ -18,34 +18,25 @@
#error Sorry, this library requires ANSI header files. #error Sorry, this library requires ANSI header files.
#endif #endif
#if defined(PIL_NO_INLINE)
#define inline
#else
#if defined(_MSC_VER) && !defined(__GNUC__) #if defined(_MSC_VER) && !defined(__GNUC__)
#define inline __inline #define inline __inline
#endif #endif
#endif
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
#ifdef __CYGWIN__ #ifdef _WIN64
#undef _WIN64 #define F_HANDLE "K"
#undef _WIN32 #else
#undef __WIN32__ #define F_HANDLE "k"
#undef WIN32
#endif #endif
#else /* not WIN */ #endif /* _WIN32 */
/* For System that are not Windows, we'll need to define these. */
/* We have to define them instead of using typedef because the JPEG lib also /* We have to define types instead of using typedef because the JPEG lib also
defines their own types with the same names, so we need to be able to undef defines their own types with the same names, so we need to be able to undef
ours before including the JPEG code. */ ours before including the JPEG code. */
#if __STDC_VERSION__ >= 199901L /* C99+ */
#include <stdint.h> #include <stdint.h>
#define INT8 int8_t #define INT8 int8_t
@ -55,45 +46,11 @@
#define INT32 int32_t #define INT32 int32_t
#define UINT32 uint32_t #define UINT32 uint32_t
#else /* < C99 */
#define INT8 signed char
#if SIZEOF_SHORT == 2
#define INT16 short
#elif SIZEOF_INT == 2
#define INT16 int
#else
#error Cannot find required 16-bit integer type
#endif
#if SIZEOF_SHORT == 4
#define INT32 short
#elif SIZEOF_INT == 4
#define INT32 int
#elif SIZEOF_LONG == 4
#define INT32 long
#else
#error Cannot find required 32-bit integer type
#endif
#define UINT8 unsigned char
#define UINT16 unsigned INT16
#define UINT32 unsigned INT32
#endif /* < C99 */
#endif /* not WIN */
/* assume IEEE; tweak if necessary (patches are welcome) */ /* assume IEEE; tweak if necessary (patches are welcome) */
#define FLOAT16 UINT16 #define FLOAT16 UINT16
#define FLOAT32 float #define FLOAT32 float
#define FLOAT64 double #define FLOAT64 double
#ifdef _MSC_VER
typedef signed __int64 int64_t;
#endif
#ifdef __GNUC__ #ifdef __GNUC__
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif #endif

View File

@ -28,7 +28,7 @@
#include <string.h> #include <string.h>
#include <limits.h> #include <limits.h>
#include "ImagingUtils.h" #include "Imaging.h"
#include "QuantOctree.h" #include "QuantOctree.h"
typedef struct _ColorBucket { typedef struct _ColorBucket {

View File

@ -9,15 +9,10 @@
* See the README file for information on usage and redistribution. * See the README file for information on usage and redistribution.
*/ */
#ifndef __TYPES_H__ #ifndef __QUANTTYPES_H__
#define __TYPES_H__ #define __QUANTTYPES_H__
#ifdef _MSC_VER
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h> #include <stdint.h>
#endif
typedef union { typedef union {
struct { struct {