Skip to content

Commit 1348161

Browse files
committed
Drop support of not C99+ compilers (including old MSVC)
1 parent 9470bba commit 1348161

File tree

8 files changed

+13
-77
lines changed

8 files changed

+13
-77
lines changed

src/_imagingcms.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -619,12 +619,6 @@ cms_profile_is_intent_supported(CmsProfileObject *self, PyObject *args) {
619619

620620
#ifdef _WIN32
621621

622-
#ifdef _WIN64
623-
#define F_HANDLE "K"
624-
#else
625-
#define F_HANDLE "k"
626-
#endif
627-
628622
static PyObject *
629623
cms_get_display_profile_win32(PyObject *self, PyObject *args) {
630624
char filename[MAX_PATH];

src/display.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,6 @@
3434

3535
#include "libImaging/ImDib.h"
3636

37-
#if SIZEOF_VOID_P == 8
38-
#define F_HANDLE "K"
39-
#else
40-
#define F_HANDLE "k"
41-
#endif
42-
4337
typedef struct {
4438
PyObject_HEAD ImagingDIB dib;
4539
} ImagingDisplayObject;

src/libImaging/Dib.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919
* See the README file for information on usage and redistribution.
2020
*/
2121

22-
#include "Imaging.h"
23-
2422
#ifdef _WIN32
2523

24+
#include "Imaging.h"
2625
#include "ImDib.h"
2726

2827
char *

src/libImaging/Draw.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include "Imaging.h"
3636

3737
#include <math.h>
38-
#include <stdint.h>
3938

4039
#define CEIL(v) (int)ceil(v)
4140
#define FLOOR(v) ((v) >= 0.0 ? (int)(v) : (int)floor(v))

src/libImaging/ImDib.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
#ifdef _WIN32
1414

15-
#include "ImagingPlatform.h"
16-
1715
#if defined(__cplusplus)
1816
extern "C" {
1917
#endif

src/libImaging/ImagingPlatform.h

Lines changed: 9 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (c) Fredrik Lundh 1995-2003.
88
*/
99

10-
#include "Python.h"
10+
#include <Python.h>
1111

1212
/* Check that we have an ANSI compliant compiler */
1313
#ifndef HAVE_PROTOTYPES
@@ -17,34 +17,25 @@
1717
#error Sorry, this library requires ANSI header files.
1818
#endif
1919

20-
#if defined(PIL_NO_INLINE)
21-
#define inline
22-
#else
2320
#if defined(_MSC_VER) && !defined(__GNUC__)
2421
#define inline __inline
2522
#endif
26-
#endif
27-
28-
#if defined(_WIN32) || defined(__CYGWIN__) /* WIN */
2923

24+
#ifdef _WIN32
3025
#define WIN32_LEAN_AND_MEAN
3126
#include <Windows.h>
3227

33-
#ifdef __CYGWIN__
34-
#undef _WIN64
35-
#undef _WIN32
36-
#undef __WIN32__
37-
#undef WIN32
28+
#ifdef _WIN64
29+
#define F_HANDLE "K"
30+
#else
31+
#define F_HANDLE "k"
3832
#endif
3933

40-
#else /* not WIN */
41-
/* For System that are not Windows, we'll need to define these. */
42-
/* We have to define them instead of using typedef because the JPEG lib also
34+
#endif /* _WIN32 */
35+
36+
/* We have to define types instead of using typedef because the JPEG lib also
4337
defines their own types with the same names, so we need to be able to undef
4438
ours before including the JPEG code. */
45-
46-
#if __STDC_VERSION__ >= 199901L /* C99+ */
47-
4839
#include <stdint.h>
4940

5041
#define INT8 int8_t
@@ -54,45 +45,11 @@
5445
#define INT32 int32_t
5546
#define UINT32 uint32_t
5647

57-
#else /* < C99 */
58-
59-
#define INT8 signed char
60-
61-
#if SIZEOF_SHORT == 2
62-
#define INT16 short
63-
#elif SIZEOF_INT == 2
64-
#define INT16 int
65-
#else
66-
#error Cannot find required 16-bit integer type
67-
#endif
68-
69-
#if SIZEOF_SHORT == 4
70-
#define INT32 short
71-
#elif SIZEOF_INT == 4
72-
#define INT32 int
73-
#elif SIZEOF_LONG == 4
74-
#define INT32 long
75-
#else
76-
#error Cannot find required 32-bit integer type
77-
#endif
78-
79-
#define UINT8 unsigned char
80-
#define UINT16 unsigned INT16
81-
#define UINT32 unsigned INT32
82-
83-
#endif /* < C99 */
84-
85-
#endif /* not WIN */
86-
8748
/* assume IEEE; tweak if necessary (patches are welcome) */
8849
#define FLOAT16 UINT16
8950
#define FLOAT32 float
9051
#define FLOAT64 double
9152

92-
#ifdef _MSC_VER
93-
typedef signed __int64 int64_t;
94-
#endif
95-
9653
#ifdef __GNUC__
9754
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
9855
#endif

src/libImaging/QuantOctree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include <string.h>
2929
#include <limits.h>
3030

31-
#include "ImagingUtils.h"
31+
#include "Imaging.h"
3232
#include "QuantOctree.h"
3333

3434
typedef struct _ColorBucket {

src/libImaging/QuantTypes.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,10 @@
99
* See the README file for information on usage and redistribution.
1010
*/
1111

12-
#ifndef __TYPES_H__
13-
#define __TYPES_H__
12+
#ifndef __QUANTTYPES_H__
13+
#define __QUANTTYPES_H__
1414

15-
#ifdef _MSC_VER
16-
typedef unsigned __int32 uint32_t;
17-
typedef unsigned __int64 uint64_t;
18-
#else
1915
#include <stdint.h>
20-
#endif
2116

2217
typedef union {
2318
struct {

0 commit comments

Comments
 (0)