Lines Matching refs:_throw
79 #define _throw(m) {__bmperr=m; retcode=-1; goto finally;} macro
80 #define _unix(f) {if((f)==-1) _throw(strerror(errno));}
84 if((bytesread=read(fd, addr, (size)))==-1) _throw(strerror(errno)); \
85 if(bytesread!=(size)) _throw("Read error");
115 if((fs=fdopen(*fd, "r"))==NULL) _throw(strerror(errno)); in loadppm()
119 if(!fgets(temps, 255, fs)) _throw("Read error"); in loadppm()
126 _throw("Read error"); in loadppm()
130 _throw("Read error"); in loadppm()
134 _throw("Read error"); in loadppm()
139 if((*w)<1 || (*h)<1 || scalefactor<1) _throw("Corrupt PPM header"); in loadppm()
143 _throw("Memory allocation error"); in loadppm()
151 _throw("Read error"); in loadppm()
161 _throw("Binary PPMs must have 8-bit components"); in loadppm()
163 _throw("Memory allocation error"); in loadppm()
164 if(fread(tempbuf, (*w)*(*h)*3, 1, fs)!=1) _throw("Read error"); in loadppm()
188 _throw("invalid argument to loadbmp()"); in loadbmp()
190 _throw("Alignment must be a power of 2"); in loadbmp()
242 _throw("Corrupt bitmap header"); in loadbmp()
244 _throw("Only uncompessed RGB bitmaps are supported"); in loadbmp()
251 if(srcpitch*(*h)+bh.bfOffBits!=bh.bfSize) _throw("Corrupt bitmap header"); in loadbmp()
254 _throw("Memory allocation error"); in loadbmp()
256 _throw(strerror(errno)); in loadbmp()
258 if(bytesread!=srcpitch*(*h)) _throw("Read error"); in loadbmp()
270 if((byteswritten=write(fd, addr, (size)))==-1) _throw(strerror(errno)); \
271 if(byteswritten!=(size)) _throw("Write error");
279 if((fs=fopen(filename, "wb"))==NULL) _throw(strerror(errno)); in saveppm()
280 if(fprintf(fs, "P6\n")<1) _throw("Write error"); in saveppm()
281 if(fprintf(fs, "%d %d\n", w, h)<1) _throw("Write error"); in saveppm()
282 if(fprintf(fs, "255\n")<1) _throw("Write error"); in saveppm()
285 _throw("Memory allocation error"); in saveppm()
290 if((fwrite(tempbuf, w*h*3, 1, fs))!=1) _throw("Write error"); in saveppm()
312 _throw("bad argument to savebmp()"); in savebmp()
372 _throw("Memory allocation error"); in savebmp()
378 _throw(strerror(errno)); in savebmp()