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