@@ -8,9 +8,6 @@ OIIO_PLUGIN_NAMESPACE_BEGIN
88
99using namespace iff_pvt ;
1010
11- #define STRINGIZE2 (a ) #a
12- #define STRINGIZE (a ) STRINGIZE2(a)
13-
1411
1512
1613bool
@@ -30,7 +27,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
3027 for (;;) {
3128 // get type and length
3229 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__);
3431 return false ;
3532 }
3633
@@ -40,7 +37,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
4037 && type[3 ] == ' 4' ) {
4138 // get type
4239 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__);
4441 return false ;
4542 }
4643
@@ -50,7 +47,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
5047 // read TBHD.
5148 for (;;) {
5249 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 (
5451 __LINE__);
5552 return false ;
5653 }
@@ -63,7 +60,8 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
6360
6461 // test if table header size is correct
6562 if (tbhdsize != 24 && tbhdsize != 32 ) {
66- err = " bad table header @ L" STRINGIZE (__LINE__);
63+ err = " bad table header @ L" OIIO_STRINGIZE (
64+ __LINE__);
6765 return false ; // bad table header
6866 }
6967
@@ -72,14 +70,14 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
7270 || !read (fd, prnum) || !read (fd, prden)
7371 || !read (fd, flags) || !read (fd, bytes)
7472 || !read (fd, tiles) || !read (fd, compression)) {
75- err = " @ L" STRINGIZE (__LINE__);
73+ err = " @ L" OIIO_STRINGIZE (__LINE__);
7674 return false ;
7775 }
7876
7977 // get xy
8078 if (tbhdsize == 32 ) {
8179 if (!read (fd, x) || !read (fd, y)) {
82- err = " could not get xy @ L" STRINGIZE (
80+ err = " could not get xy @ L" OIIO_STRINGIZE (
8381 __LINE__);
8482 return false ;
8583 }
@@ -90,7 +88,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
9088
9189 // tiles
9290 if (tiles == 0 ) {
93- err = " non-tiles not supported @ L" STRINGIZE (
91+ err = " non-tiles not supported @ L" OIIO_STRINGIZE (
9492 __LINE__);
9593 return false ;
9694 } // non-tiles not supported
@@ -100,7 +98,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
10098 // 2 QRL (not supported)
10199 // 3 QR4 (not supported)
102100 if (compression > 1 ) {
103- err = " only RLE compression is supported @ L" STRINGIZE (
101+ err = " only RLE compression is supported @ L" OIIO_STRINGIZE (
104102 __LINE__);
105103 return false ;
106104 }
@@ -135,7 +133,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
135133 for (;;) {
136134 // get type
137135 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 (
139137 __LINE__);
140138 return false ;
141139 }
@@ -146,7 +144,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
146144 && type[2 ] == ' T' && type[3 ] == ' H' ) {
147145 std::vector<char > str (chunksize);
148146 if (!fread (&str[0 ], 1 , chunksize, fd)) {
149- err = " could not read author @ L" STRINGIZE (
147+ err = " could not read author @ L" OIIO_STRINGIZE (
150148 __LINE__);
151149 return false ;
152150 }
@@ -155,15 +153,15 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
155153 && type[2 ] == ' T' && type[3 ] == ' E' ) {
156154 std::vector<char > str (chunksize);
157155 if (!fread (&str[0 ], 1 , chunksize, fd)) {
158- err = " could not read date @ L" STRINGIZE (
156+ err = " could not read date @ L" OIIO_STRINGIZE (
159157 __LINE__);
160158 return false ;
161159 }
162160 date = std::string (&str[0 ], size);
163161 } else if (type[0 ] == ' F' && type[1 ] == ' O'
164162 && type[2 ] == ' R' && type[3 ] == ' 4' ) {
165163 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 (
167165 __LINE__);
168166 return false ;
169167 }
@@ -180,7 +178,8 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
180178
181179 for (unsigned int t = 0 ; t < tiles; t++) {
182180 if (!read_typesize (fd, type, size)) {
183- err = " xxx @ L" STRINGIZE (__LINE__);
181+ err = " xxx @ L" OIIO_STRINGIZE (
182+ __LINE__);
184183 return false ;
185184 }
186185 chunksize = align_size (size, 4 );
@@ -195,7 +194,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
195194 || !read (fd, ymin)
196195 || !read (fd, xmax)
197196 || !read (fd, ymax)) {
198- err = " xxx @ L" STRINGIZE (
197+ err = " xxx @ L" OIIO_STRINGIZE (
199198 __LINE__);
200199 return false ;
201200 }
@@ -204,7 +203,7 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
204203 if (xmin > xmax || ymin > ymax
205204 || xmax >= width
206205 || ymax >= height) {
207- err = " tile min/max nonsensical @ L" STRINGIZE (
206+ err = " tile min/max nonsensical @ L" OIIO_STRINGIZE (
208207 __LINE__);
209208 return false ;
210209 }
@@ -219,23 +218,23 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
219218
220219 // skip to the next block.
221220 if (fseek (fd, chunksize, SEEK_CUR)) {
222- err = " could not fseek @ L" STRINGIZE (
221+ err = " could not fseek @ L" OIIO_STRINGIZE (
223222 __LINE__);
224223 return false ;
225224 }
226225 }
227226 } else {
228227 // skip to the next block.
229228 if (fseek (fd, chunksize, SEEK_CUR)) {
230- err = " could not fseek @ L" STRINGIZE (
229+ err = " could not fseek @ L" OIIO_STRINGIZE (
231230 __LINE__);
232231 return false ;
233232 }
234233 }
235234 } else {
236235 // skip to the next block.
237236 if (fseek (fd, chunksize, SEEK_CUR)) {
238- err = " could not fseek @ L" STRINGIZE (
237+ err = " could not fseek @ L" OIIO_STRINGIZE (
239238 __LINE__);
240239 return false ;
241240 }
@@ -247,19 +246,19 @@ IffFileHeader::read_header(FILE* fd, std::string& err)
247246
248247 // skip to the next block.
249248 if (fseek (fd, chunksize, SEEK_CUR)) {
250- err = " could not fseek @ L" STRINGIZE (__LINE__);
249+ err = " could not fseek @ L" OIIO_STRINGIZE (__LINE__);
251250 return false ;
252251 }
253252 }
254253 }
255254 }
256255 // skip to the next block.
257256 if (fseek (fd, chunksize, SEEK_CUR)) {
258- err = " could not fseek @ L" STRINGIZE (__LINE__);
257+ err = " could not fseek @ L" OIIO_STRINGIZE (__LINE__);
259258 return false ;
260259 }
261260 }
262- err = " unknown error, ended early @ L" STRINGIZE (__LINE__);
261+ err = " unknown error, ended early @ L" OIIO_STRINGIZE (__LINE__);
263262 return false ;
264263}
265264
0 commit comments