Lines Matching refs:_throw
82 #define _throw(m) {__bmperr=m; retcode=-1; goto finally;} macro
83 #define _unix(f) {if((f)==-1) _throw(strerror(errno));}
87 if((bytesread=read(fd, addr, (size)))==-1) _throw(strerror(errno)); \
88 if(bytesread!=(size)) _throw("Read error");
118 if((fs=fdopen(*fd, "r"))==NULL) _throw(strerror(errno)); in loadppm()
122 if(!fgets(temps, 255, fs)) _throw("Read error"); in loadppm()
129 _throw("Read error"); in loadppm()
133 _throw("Read error"); in loadppm()
137 _throw("Read error"); in loadppm()
142 if((*w)<1 || (*h)<1 || scalefactor<1) _throw("Corrupt PPM header"); in loadppm()
146 _throw("Memory allocation error"); in loadppm()
154 _throw("Read error"); in loadppm()
164 _throw("Binary PPMs must have 8-bit components"); in loadppm()
166 _throw("Memory allocation error"); in loadppm()
167 if(fread(tempbuf, (*w)*(*h)*3, 1, fs)!=1) _throw("Read error"); in loadppm()
191 _throw("invalid argument to loadbmp()"); in loadbmp()
193 _throw("Alignment must be a power of 2"); in loadbmp()
245 _throw("Corrupt bitmap header"); in loadbmp()
247 _throw("Only uncompessed RGB bitmaps are supported"); in loadbmp()
254 if(srcpitch*(*h)+bh.bfOffBits!=bh.bfSize) _throw("Corrupt bitmap header"); in loadbmp()
257 _throw("Memory allocation error"); in loadbmp()
259 _throw(strerror(errno)); in loadbmp()
261 if(bytesread!=srcpitch*(*h)) _throw("Read error"); in loadbmp()
273 if((byteswritten=write(fd, addr, (size)))==-1) _throw(strerror(errno)); \
274 if(byteswritten!=(size)) _throw("Write error");
282 if((fs=fopen(filename, "wb"))==NULL) _throw(strerror(errno)); in saveppm()
283 if(fprintf(fs, "P6\n")<1) _throw("Write error"); in saveppm()
284 if(fprintf(fs, "%d %d\n", w, h)<1) _throw("Write error"); in saveppm()
285 if(fprintf(fs, "255\n")<1) _throw("Write error"); in saveppm()
288 _throw("Memory allocation error"); in saveppm()
293 if((fwrite(tempbuf, w*h*3, 1, fs))!=1) _throw("Write error"); in saveppm()
315 _throw("bad argument to savebmp()"); in savebmp()
376 _throw("Memory allocation error"); in savebmp()
382 _throw(strerror(errno)); in savebmp()
386 _throw(strerror(errno)); in savebmp()