ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/bmpfile.c
(Generate patch)

Comparing ray/src/common/bmpfile.c (file contents):
Revision 2.6 by greg, Sat Mar 27 16:33:31 2004 UTC vs.
Revision 2.9 by greg, Thu Apr 29 14:36:49 2004 UTC

# Line 10 | Line 10 | static const char RCSid[] = "$Id$";
10   #include <string.h>
11   #include "bmpfile.h"
12  
13 + #ifdef getc_unlocked            /* avoid horrendous overhead of flockfile */
14 + #define getc    getc_unlocked
15 + #define putc    putc_unlocked
16 + #endif
17 +
18   /* get corresponding error message */
19   const char *
20   BMPerrorMessage(int ec)
# Line 600 | Line 605 | wrseek(uint32 pos, BMPWriter *bw)
605   {
606          if (pos == bw->fpos)
607                  return BIR_OK;
608 <        if (bw->seek == NULL) {
609 <                if (pos < bw->fpos)
605 <                        return BIR_SEEKERR;
606 <                while (bw->fpos < pos)
607 <                        wrbyte(0, bw);
608 <                return BIR_OK;
609 <        }
608 >        if (bw->seek == NULL)
609 >                return BIR_SEEKERR;
610          if ((*bw->seek)(pos, bw->c_data) != 0)
611                  return BIR_SEEKERR;
612          bw->fpos = pos;
# Line 753 | Line 753 | BMPwriteScanline(BMPWriter *bw)
753                          break;
754                  val = *sp;                      /* output run */
755                  for (cnt = 1; cnt < 255; cnt++)
756 <                        if (!--n | *++sp != val)
756 >                        if ((!--n) | (*++sp != val))
757                                  break;
758                  wrbyte(cnt, bw);
759                  wrbyte(val, bw);
# Line 761 | Line 761 | BMPwriteScanline(BMPWriter *bw)
761          bw->yscan++;                            /* write line break or EOD */
762          if (bw->yscan == bw->hdr->height) {
763                  wrbyte(0, bw); wrbyte(1, bw);   /* end of bitmap marker */
764 <                if (bw->seek == NULL || (*bw->seek)(2, bw->c_data) != 0)
764 >                if (wrseek(2, bw) != BIR_OK)
765                          return BIR_OK;          /* no one may care */
766 <                bw->fpos = 2;
766 >                wrint32(bw->flen, bw);          /* correct file length */
767 >                if (wrseek(34, bw) != BIR_OK)
768 >                        return BIR_OK;
769                  wrint32(bw->flen-bw->fbmp, bw); /* correct bitmap length */
770          } else {
771                  wrbyte(0, bw); wrbyte(0, bw);   /* end of line marker */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines