1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
|
Submitted upstream as:
https://sourceforge.net/p/openil/bugs/212/
--- lib/Makefile.am.orig 2009-03-08 20:45:36 UTC
+++ lib/Makefile.am
@@ -41,5 +41,5 @@ endif #BUILD_ILUT
libIL_la_CPPFLAGS = -I $(il_include) -I $(all_include)
libIL_la_CFLAGS = $(AM_CFLAGS) @IL_CFLAGS@
-libIL_la_CXXFLAGS = $(AM_CFLAGS) @IL_CFLAGS@
+libIL_la_CXXFLAGS = $(filter-out -std=% -fgnu89-inline,$(AM_CFLAGS)) @IL_CFLAGS@
--- src-IL/include/il_internal.h 2009-03-08 03:10:08.000000000 -0400
+++ src-IL/include/il_internal.h 2014-12-20 01:11:39.000000000 -0500
@@ -228,5 +228,5 @@
ILboolean ilLoadBlpF(ILHANDLE File);
ILboolean ilLoadBlpL(const void *Lump, ILuint Size);
-ILboolean ilIsValidBmp(ILconst_string CONST_RESTRICT FileName);
+ILboolean ilIsValidBmp(ILconst_string FileName);
ILboolean ilIsValidBmpF(ILHANDLE File);
ILboolean ilIsValidBmpL(const void *Lump, ILuint Size);
--- src-IL/src/il_exr.cpp 2009-03-08 03:10:09.000000000 -0400
+++ src-IL/src/il_exr.cpp 2014-12-20 01:15:55.000000000 -0500
@@ -11,5 +11,5 @@
//-----------------------------------------------------------------------------
-
+#include <machine/endian.h>
#include "il_internal.h"
#ifndef IL_NO_EXR
@@ -246,5 +246,5 @@
in.readPixels (dataWindow.min.y, dataWindow.max.y);
}
- catch (const exception &e)
+ catch (const exception)
{
// If some of the pixels in the file cannot be read,
@@ -252,5 +252,4 @@
// to the caller.
ilSetError(IL_LIB_EXR_ERROR); // Could I use something a bit more descriptive based on e?
- e; // Prevent the compiler from yelling at us about this being unused.
return IL_FALSE;
}
--- src-IL/include/il_endian.h 2009-03-08 03:10:08.000000000 -0400
+++ src-IL/include/il_endian.h 2014-12-20 01:28:47.000000000 -0500
@@ -15,14 +15,7 @@
#include "il_internal.h"
+#include <machine/endian.h>
-#ifdef WORDS_BIGENDIAN // This is defined by ./configure.
- #ifndef __BIG_ENDIAN__
- #define __BIG_ENDIAN__ 1
- #endif
-#endif
-
-#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __BIG_ENDIAN__) \
- || (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__))
- #undef __LITTLE_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
#define Short(s) iSwapShort(s)
#define UShort(s) iSwapUShort(s)
@@ -39,7 +32,4 @@
#define BigDouble(d)
#else
- #undef __BIG_ENDIAN__
- #undef __LITTLE_ENDIAN__ // Not sure if it's defined by any compiler...
- #define __LITTLE_ENDIAN__
#define Short(s)
#define UShort(s)
@@ -168,5 +158,5 @@
ILushort s;
iread(&s, sizeof(ILushort), 1);
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
iSwapUShort(&s);
#endif
@@ -177,5 +167,5 @@
ILshort s;
iread(&s, sizeof(ILshort), 1);
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
iSwapShort(&s);
#endif
@@ -186,5 +176,5 @@
ILuint i;
iread(&i, sizeof(ILuint), 1);
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
iSwapUInt(&i);
#endif
@@ -195,5 +185,5 @@
ILint i;
iread(&i, sizeof(ILint), 1);
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
iSwapInt(&i);
#endif
@@ -204,5 +194,5 @@
ILfloat f;
iread(&f, sizeof(ILfloat), 1);
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
iSwapFloat(&f);
#endif
@@ -213,5 +203,5 @@
ILdouble d;
iread(&d, sizeof(ILdouble), 1);
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
iSwapDouble(&d);
#endif
@@ -223,5 +213,5 @@
ILushort s;
iread(&s, sizeof(ILushort), 1);
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
iSwapUShort(&s);
#endif
@@ -233,5 +223,5 @@
ILshort s;
iread(&s, sizeof(ILshort), 1);
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
iSwapShort(&s);
#endif
@@ -243,5 +233,5 @@
ILuint i;
iread(&i, sizeof(ILuint), 1);
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
iSwapUInt(&i);
#endif
@@ -253,5 +243,5 @@
ILint i;
iread(&i, sizeof(ILint), 1);
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
iSwapInt(&i);
#endif
@@ -263,5 +253,5 @@
ILfloat f;
iread(&f, sizeof(ILfloat), 1);
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
iSwapFloat(&f);
#endif
@@ -273,5 +263,5 @@
ILdouble d;
iread(&d, sizeof(ILdouble), 1);
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
iSwapDouble(&d);
#endif
@@ -280,5 +270,5 @@
INLINE ILubyte SaveLittleUShort(ILushort s) {
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
iSwapUShort(&s);
#endif
@@ -287,5 +277,5 @@
INLINE ILubyte SaveLittleShort(ILshort s) {
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
iSwapShort(&s);
#endif
@@ -295,5 +285,5 @@
INLINE ILubyte SaveLittleUInt(ILuint i) {
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
iSwapUInt(&i);
#endif
@@ -303,5 +293,5 @@
INLINE ILubyte SaveLittleInt(ILint i) {
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
iSwapInt(&i);
#endif
@@ -310,5 +300,5 @@
INLINE ILubyte SaveLittleFloat(ILfloat f) {
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
iSwapFloat(&f);
#endif
@@ -318,5 +308,5 @@
INLINE ILubyte SaveLittleDouble(ILdouble d) {
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
iSwapDouble(&d);
#endif
@@ -326,5 +316,5 @@
INLINE ILubyte SaveBigUShort(ILushort s) {
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
iSwapUShort(&s);
#endif
@@ -334,5 +324,5 @@
INLINE ILubyte SaveBigShort(ILshort s) {
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
iSwapShort(&s);
#endif
@@ -342,5 +332,5 @@
INLINE ILubyte SaveBigUInt(ILuint i) {
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
iSwapUInt(&i);
#endif
@@ -350,5 +340,5 @@
INLINE ILubyte SaveBigInt(ILint i) {
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
iSwapInt(&i);
#endif
@@ -358,5 +348,5 @@
INLINE ILubyte SaveBigFloat(ILfloat f) {
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
iSwapFloat(&f);
#endif
@@ -366,5 +356,5 @@
INLINE ILubyte SaveBigDouble(ILdouble d) {
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
iSwapDouble(&d);
#endif
--- src-IL/src/il_convert.c 2009-03-08 03:10:09.000000000 -0400
+++ src-IL/src/il_convert.c 2014-12-20 01:36:37.000000000 -0500
@@ -1018,5 +1018,5 @@
}
/* Swap Colors on Big Endian !!!!!
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
// Swap endian
EndianSwapData(iCurImage);
--- src-IL/src/il_dicom.c 2009-03-08 03:10:09.000000000 -0400
+++ src-IL/src/il_dicom.c 2014-12-20 01:36:37.000000000 -0500
@@ -536,5 +536,5 @@
// We may have to swap the order of the data.
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
if (!Header.BigEndian) {
if (Header.Format == IL_RGB)
--- src-IL/src/il_icon.c 2009-03-08 08:10:09.000000000 +0100
+++ src-IL/src/il_icon.c 2014-12-20 01:36:37.000000000 -0500
@@ -555,5 +555,5 @@
//fix endianess
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
if (bit_depth == 16)
png_set_swap(ico_png_ptr);
--- src-IL/src/il_png.c 2009-03-08 08:10:09.000000000 +0100
+++ src-IL/src/il_png.c 2014-12-20 01:36:37.000000000 -0500
@@ -308,5 +308,5 @@
//fix endianess
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
if (bit_depth == 16)
png_set_swap(png_ptr);
--- src-IL/src/il_psd.c 2009-03-08 03:10:09.000000000 -0400
+++ src-IL/src/il_psd.c 2014-12-20 01:36:37.000000000 -0500
@@ -542,5 +542,5 @@
return NULL;
}
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
for (i = 0; i < Head->Height * ChannelNum; i++) {
iSwapUShort(&RleTable[i]);
--- src-IL/src/il_tiff.c 2009-03-08 03:10:09.000000000 -0400
+++ src-IL/src/il_tiff.c 2014-12-20 01:36:37.000000000 -0500
@@ -611,5 +611,5 @@
Image->Origin = IL_ORIGIN_LOWER_LEFT; // eiu...dunno if this is right
-#ifdef __BIG_ENDIAN__ //TIFFReadRGBAImage reads abgr on big endian, convert to rgba
+#if BYTE_ORDER == BIG_ENDIAN //TIFFReadRGBAImage reads abgr on big endian, convert to rgba
EndianSwapData(Image);
#endif
@@ -636,5 +636,5 @@
case 3:
//TODO: why the ifdef??
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
ilConvertImage(IL_RGB, IL_UNSIGNED_BYTE);
#endif
@@ -647,5 +647,5 @@
/*
//invert alpha
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
pImageData += 3;
#endif
--- src-ILUT/src/ilut_sdlsurface.c 2009-03-08 03:10:11.000000000 -0400
+++ src-ILUT/src/ilut_sdlsurface.c 2014-12-20 01:36:37.000000000 -0500
@@ -28,5 +28,5 @@
{
//#if SDL_BYTEORDER == SDL_BIG_ENDIAN
-#ifdef __BIG_ENDIAN__
+#if BYTE_ORDER == BIG_ENDIAN
isBigEndian = 1;
rmask = 0xFF000000;
@@ -81,5 +81,5 @@
}
else if (Image->Format != IL_COLOR_INDEX) { // We have to convert the image.
- #ifdef __BIG_ENDIAN__
+ #if BYTE_ORDER == BIG_ENDIAN
Image = iConvertImage(Image, IL_RGBA, IL_UNSIGNED_BYTE);
#else
--- src-IL/src/il_ilbm.c 2009-03-08 04:30:11.000000000 -0400
+++ src-IL/src/il_ilbm.c 2014-12-20 01:38:51.000000000 -0500
@@ -620,5 +620,5 @@
finalcolor = pixelcolor;
}
-#if defined( __LITTLE_ENDIAN__ )
+#if BYTE_ORDER == LITTLE_ENDIAN
{
*ptr++ = (Uint8)(finalcolor>>16);
--- src-IL/src/il_sgi.c 2009-03-08 03:10:09.000000000 -0400
+++ src-IL/src/il_sgi.c 2014-12-20 01:40:37.000000000 -0500
@@ -213,5 +213,5 @@
ILboolean iReadRleSgi(iSgiHeader *Head)
{
- #ifdef __LITTLE_ENDIAN__
+ #if BYTE_ORDER == LITTLE_ENDIAN
ILuint ixTable;
#endif
@@ -234,5 +234,5 @@
goto cleanup_error;
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
// Fix the offset/len table (it's big endian format)
for (ixTable = 0; ixTable < TableSize; ixTable++) {
@@ -290,5 +290,5 @@
}
- #ifdef __LITTLE_ENDIAN__
+ #if BYTE_ORDER == LITTLE_ENDIAN
if (Head->Bpc == 2)
sgiSwitchData(iCurImage->Data, iCurImage->SizeOfData);
@@ -331,5 +331,5 @@
return -1;
-#ifndef __LITTLE_ENDIAN__
+#if BYTE_ORDER != LITTLE_ENDIAN
iSwapUShort(&Pixel);
#endif
@@ -347,5 +347,5 @@
if (iread(&Pixel, Head->Bpc, 1) != 1)
return -1;
-#ifndef __LITTLE_ENDIAN__
+#if BYTE_ORDER != LITTLE_ENDIAN
iSwapUShort(&Pixel);
#endif
@@ -742,5 +742,5 @@
StartTable[y] = DataOff;
DataOff += LenTable[y];
-#ifdef __LITTLE_ENDIAN__
+#if BYTE_ORDER == LITTLE_ENDIAN
iSwapUInt(&StartTable[y]);
iSwapUInt(&LenTable[y]);
|