--- ray/src/common/bmpfile.h 2004/03/27 05:43:37 2.3 +++ ray/src/common/bmpfile.h 2007/04/12 22:13:28 2.5 @@ -1,4 +1,4 @@ -/* RCSid $Id: bmpfile.h,v 2.3 2004/03/27 05:43:37 greg Exp $ */ +/* RCSid $Id: bmpfile.h,v 2.5 2007/04/12 22:13:28 greg Exp $ */ /* * Windows and OS/2 BMP file support */ @@ -41,15 +41,12 @@ typedef struct { /* but the color table should be filled by writer before open call */ RGBquad palette[3]; /* color palette (extends struct) */ } BMPHeader; - - /* color palette length */ -#define BMPpalLen(h) ((h)->bpp <= 8 ? 1<<(h)->bpp : 0) /* access to bit field triple */ #define BMPbitField(h) ((uint32 *)(h)->palette) /* info buffer access */ -#define BMPinfo(h) ((char *)((h)->palette + BMPpalLen(h))) +#define BMPinfo(h) ((char *)((h)->palette + (h)->nColors)) /* function return values */ #define BIR_OK 0 /* all is well */ @@ -141,7 +138,7 @@ int stdio_fseek(uint32 pos, void *p); /* open input file */ #define BMPopenInputFile(fn) BMPopenReader(&stdio_getc, &stdio_fseek, \ - (void *)fopen(fn, "r")) + (void *)fopen(fn, "rb")) /* close stdio input file or stream */ #define BMPcloseInput(br) ( fclose((FILE *)(br)->c_data), \ @@ -154,7 +151,7 @@ int stdio_fseek(uint32 pos, void *p); /* open stdio output file */ #define BMPopenOutputFile(fn,hdr) \ BMPopenWriter(&stdio_putc, &stdio_fseek, \ - (void *)fopen(fn, "w"), hdr) + (void *)fopen(fn, "wb"), hdr) /* close stdio output file or stream */ #define BMPcloseOutput(bw) ( fclose((FILE *)(bw)->c_data), \