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.14 by greg, Fri Apr 8 17:49:55 2005 UTC vs.
Revision 2.17 by schorsch, Thu Mar 10 23:18:59 2016 UTC

# Line 300 | Line 300 | BMPreadScanline(BMPReader *br)
300           * is it specified what we should assume for missing pixels.  This
301           * is undoubtedly the most brain-dead format I've ever encountered.
302           */
303 <        sp = br->scanline;
303 >        sp = (int8 *)br->scanline;
304          n = br->hdr->width;
305          if (br->hdr->compr == BI_RLE4)
306                  n = (n + 1) >> 1;
# Line 549 | Line 549 | BMPmappedHeader(int xr, int yr, int infolen, int ncolo
549          else
550                  return NULL;
551          hdr = (BMPHeader *)malloc(sizeof(BMPHeader) +
552 <                                        sizeof(RGBquad)*(1<<n) -
552 >                                        sizeof(RGBquad)*((size_t)1<<n) -
553                                          sizeof(hdr->palette) +
554                                          infolen);
555          if (hdr == NULL)
# Line 563 | Line 563 | BMPmappedHeader(int xr, int yr, int infolen, int ncolo
563          hdr->nColors = ncolors;
564          hdr->impColors = 0;                     /* says all colors important */
565          hdr->infoSiz = infolen;
566 <        memset((void *)hdr->palette, 0, sizeof(RGBquad)*(1<<n) + infolen);
566 >        memset((void *)hdr->palette, 0, sizeof(RGBquad)*((size_t)1<<n) + infolen);
567          for (n = ncolors; n--; )
568                  hdr->palette[n].r = hdr->palette[n].g =
569                          hdr->palette[n].b = n*255/(ncolors-1);
# Line 736 | Line 736 | BMPwriteScanline(BMPWriter *bw)
736           * (0x0000) except for the last, which ends in a bitmap break
737           * (0x0001).  We don't support RLE4 at all; it's too awkward.
738           */
739 <        sp = bw->scanline;
739 >        sp = (const int8 *)bw->scanline;
740          n = bw->hdr->width;
741          while (n > 0) {
742                  int     cnt, val;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines