@@ -8,9 +8,6 @@ OIIO_PLUGIN_NAMESPACE_BEGIN
8
8
9
9
using namespace iff_pvt ;
10
10
11
- #define STRINGIZE2 (a ) #a
12
- #define STRINGIZE (a ) STRINGIZE2(a)
13
-
14
11
15
12
16
13
bool
@@ -30,7 +27,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
30
27
for (;;) {
31
28
// get type and length
32
29
if (!read_typesize (fd, type, size)) {
33
- err = " could not read type/size @ L" STRINGIZE (__LINE__);
30
+ err = " could not read type/size @ L" OIIO_STRINGIZE (__LINE__);
34
31
return false ;
35
32
}
36
33
@@ -40,7 +37,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
40
37
&& type[3 ] == ' 4' ) {
41
38
// get type
42
39
if (!fread (&type, 1 , sizeof (type), fd)) {
43
- err = " could not read FDR4 type @ L" STRINGIZE (__LINE__);
40
+ err = " could not read FDR4 type @ L" OIIO_STRINGIZE (__LINE__);
44
41
return false ;
45
42
}
46
43
@@ -50,7 +47,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
50
47
// read TBHD.
51
48
for (;;) {
52
49
if (!read_typesize (fd, type, size)) {
53
- err = " could not read CIMG length @ L" STRINGIZE (
50
+ err = " could not read CIMG length @ L" OIIO_STRINGIZE (
54
51
__LINE__);
55
52
return false ;
56
53
}
@@ -63,7 +60,8 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
63
60
64
61
// test if table header size is correct
65
62
if (tbhdsize != 24 && tbhdsize != 32 ) {
66
- err = " bad table header @ L" STRINGIZE (__LINE__);
63
+ err = " bad table header @ L" OIIO_STRINGIZE (
64
+ __LINE__);
67
65
return false ; // bad table header
68
66
}
69
67
@@ -72,14 +70,14 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
72
70
|| !read (fd, prnum) || !read (fd, prden)
73
71
|| !read (fd, flags) || !read (fd, bytes)
74
72
|| !read (fd, tiles) || !read (fd, compression)) {
75
- err = " @ L" STRINGIZE (__LINE__);
73
+ err = " @ L" OIIO_STRINGIZE (__LINE__);
76
74
return false ;
77
75
}
78
76
79
77
// get xy
80
78
if (tbhdsize == 32 ) {
81
79
if (!read (fd, x) || !read (fd, y)) {
82
- err = " could not get xy @ L" STRINGIZE (
80
+ err = " could not get xy @ L" OIIO_STRINGIZE (
83
81
__LINE__);
84
82
return false ;
85
83
}
@@ -90,7 +88,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
90
88
91
89
// tiles
92
90
if (tiles == 0 ) {
93
- err = " non-tiles not supported @ L" STRINGIZE (
91
+ err = " non-tiles not supported @ L" OIIO_STRINGIZE (
94
92
__LINE__);
95
93
return false ;
96
94
} // non-tiles not supported
@@ -100,7 +98,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
100
98
// 2 QRL (not supported)
101
99
// 3 QR4 (not supported)
102
100
if (compression > 1 ) {
103
- err = " only RLE compression is supported @ L" STRINGIZE (
101
+ err = " only RLE compression is supported @ L" OIIO_STRINGIZE (
104
102
__LINE__);
105
103
return false ;
106
104
}
@@ -135,7 +133,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
135
133
for (;;) {
136
134
// get type
137
135
if (!read_typesize (fd, type, size)) {
138
- err = " could not read type/size @ L" STRINGIZE (
136
+ err = " could not read type/size @ L" OIIO_STRINGIZE (
139
137
__LINE__);
140
138
return false ;
141
139
}
@@ -146,7 +144,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
146
144
&& type[2 ] == ' T' && type[3 ] == ' H' ) {
147
145
std::vector<char > str (chunksize);
148
146
if (!fread (&str[0 ], 1 , chunksize, fd)) {
149
- err = " could not read author @ L" STRINGIZE (
147
+ err = " could not read author @ L" OIIO_STRINGIZE (
150
148
__LINE__);
151
149
return false ;
152
150
}
@@ -155,15 +153,15 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
155
153
&& type[2 ] == ' T' && type[3 ] == ' E' ) {
156
154
std::vector<char > str (chunksize);
157
155
if (!fread (&str[0 ], 1 , chunksize, fd)) {
158
- err = " could not read date @ L" STRINGIZE (
156
+ err = " could not read date @ L" OIIO_STRINGIZE (
159
157
__LINE__);
160
158
return false ;
161
159
}
162
160
date = std::string (&str[0 ], size);
163
161
} else if (type[0 ] == ' F' && type[1 ] == ' O'
164
162
&& type[2 ] == ' R' && type[3 ] == ' 4' ) {
165
163
if (!fread (&type, 1 , sizeof (type), fd)) {
166
- err = " could not read FOR4 type @ L" STRINGIZE (
164
+ err = " could not read FOR4 type @ L" OIIO_STRINGIZE (
167
165
__LINE__);
168
166
return false ;
169
167
}
@@ -180,7 +178,8 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
180
178
181
179
for (unsigned int t = 0 ; t < tiles; t++) {
182
180
if (!read_typesize (fd, type, size)) {
183
- err = " xxx @ L" STRINGIZE (__LINE__);
181
+ err = " xxx @ L" OIIO_STRINGIZE (
182
+ __LINE__);
184
183
return false ;
185
184
}
186
185
chunksize = align_size (size, 4 );
@@ -195,7 +194,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
195
194
|| !read (fd, ymin)
196
195
|| !read (fd, xmax)
197
196
|| !read (fd, ymax)) {
198
- err = " xxx @ L" STRINGIZE (
197
+ err = " xxx @ L" OIIO_STRINGIZE (
199
198
__LINE__);
200
199
return false ;
201
200
}
@@ -204,7 +203,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
204
203
if (xmin > xmax || ymin > ymax
205
204
|| xmax >= width
206
205
|| ymax >= height) {
207
- err = " tile min/max nonsensical @ L" STRINGIZE (
206
+ err = " tile min/max nonsensical @ L" OIIO_STRINGIZE (
208
207
__LINE__);
209
208
return false ;
210
209
}
@@ -219,23 +218,23 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
219
218
220
219
// skip to the next block.
221
220
if (fseek (fd, chunksize, SEEK_CUR)) {
222
- err = " could not fseek @ L" STRINGIZE (
221
+ err = " could not fseek @ L" OIIO_STRINGIZE (
223
222
__LINE__);
224
223
return false ;
225
224
}
226
225
}
227
226
} else {
228
227
// skip to the next block.
229
228
if (fseek (fd, chunksize, SEEK_CUR)) {
230
- err = " could not fseek @ L" STRINGIZE (
229
+ err = " could not fseek @ L" OIIO_STRINGIZE (
231
230
__LINE__);
232
231
return false ;
233
232
}
234
233
}
235
234
} else {
236
235
// skip to the next block.
237
236
if (fseek (fd, chunksize, SEEK_CUR)) {
238
- err = " could not fseek @ L" STRINGIZE (
237
+ err = " could not fseek @ L" OIIO_STRINGIZE (
239
238
__LINE__);
240
239
return false ;
241
240
}
@@ -247,19 +246,19 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
247
246
248
247
// skip to the next block.
249
248
if (fseek (fd, chunksize, SEEK_CUR)) {
250
- err = " could not fseek @ L" STRINGIZE (__LINE__);
249
+ err = " could not fseek @ L" OIIO_STRINGIZE (__LINE__);
251
250
return false ;
252
251
}
253
252
}
254
253
}
255
254
}
256
255
// skip to the next block.
257
256
if (fseek (fd, chunksize, SEEK_CUR)) {
258
- err = " could not fseek @ L" STRINGIZE (__LINE__);
257
+ err = " could not fseek @ L" OIIO_STRINGIZE (__LINE__);
259
258
return false ;
260
259
}
261
260
}
262
- err = " unknown error, ended early @ L" STRINGIZE (__LINE__);
261
+ err = " unknown error, ended early @ L" OIIO_STRINGIZE (__LINE__);
263
262
return false ;
264
263
}
265
264
0 commit comments