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

Comparing ray/src/px/pvalue.c (file contents):
Revision 2.30 by greg, Thu Dec 16 21:34:41 2010 UTC vs.
Revision 2.31 by greg, Fri May 20 02:06:39 2011 UTC

# Line 637 | Line 637 | getcbyte(              /* get a byte color value from stream(s) */
637          COLOR  col
638   )
639   {
640 <        BYTE  vb[3];
640 >        uby8  vb[3];
641  
642          if (fin2 == NULL) {
643 <                if (fread((char *)vb, sizeof(BYTE), 3, fin) != 3)
643 >                if (fread((char *)vb, sizeof(uby8), 3, fin) != 3)
644                          return(-1);
645          } else {
646 <                if (fread((char *)vb, sizeof(BYTE), 1, fin) != 1 ||
647 <                        fread((char *)(vb+1), sizeof(BYTE), 1, fin2) != 1 ||
648 <                        fread((char *)(vb+2), sizeof(BYTE), 1, fin3) != 1)
646 >                if (fread((char *)vb, sizeof(uby8), 1, fin) != 1 ||
647 >                        fread((char *)(vb+1), sizeof(uby8), 1, fin2) != 1 ||
648 >                        fread((char *)(vb+2), sizeof(uby8), 1, fin3) != 1)
649                          return(-1);
650          }
651          setcolor(col, (vb[rord[RED]]+.5)/256.,
# Line 745 | Line 745 | getbbyte(              /* get a byte brightness value from fin */
745          COLOR  col
746   )
747   {
748 <        BYTE  vb;
748 >        uby8  vb;
749          double  d;
750  
751 <        if (fread((char *)&vb, sizeof(BYTE), 1, fin) != 1)
751 >        if (fread((char *)&vb, sizeof(uby8), 1, fin) != 1)
752                  return(-1);
753          d = (vb+.5)/256.;
754          setcolor(col, d, d, d);
# Line 844 | Line 844 | putcbyte(                      /* put a byte color to stdout */
844   )
845   {
846          long  i;
847 <        BYTE  vb[3];
847 >        uby8  vb[3];
848  
849          i = colval(col,ord[0])*256.;
850          vb[0] = min(i,255);
# Line 852 | Line 852 | putcbyte(                      /* put a byte color to stdout */
852          vb[1] = min(i,255);
853          i = colval(col,ord[2])*256.;
854          vb[2] = min(i,255);
855 <        fwrite((char *)vb, sizeof(BYTE), 3, stdout);
855 >        fwrite((char *)vb, sizeof(uby8), 3, stdout);
856  
857          return(ferror(stdout) ? -1 : 0);
858   }
# Line 940 | Line 940 | putbbyte(                      /* put a byte brightness to stdout */
940   )
941   {
942          register int  i;
943 <        BYTE  vb;
943 >        uby8  vb;
944  
945          i = (*mybright)(col)*256.;
946          vb = min(i,255);
947 <        fwrite((char *)&vb, sizeof(BYTE), 1, stdout);
947 >        fwrite((char *)&vb, sizeof(uby8), 1, stdout);
948  
949          return(ferror(stdout) ? -1 : 0);
950   }
# Line 1028 | Line 1028 | putpbyte(                      /* put a byte primary to stdout */
1028   )
1029   {
1030          long  i;
1031 <        BYTE  vb;
1031 >        uby8  vb;
1032  
1033          i = colval(col,putprim)*256.;
1034          vb = min(i,255);
1035 <        fwrite((char *)&vb, sizeof(BYTE), 1, stdout);
1035 >        fwrite((char *)&vb, sizeof(uby8), 1, stdout);
1036  
1037          return(ferror(stdout) ? -1 : 0);
1038   }
# Line 1154 | Line 1154 | set_io(void)                   /* set put and get functions */
1154                                  if (fin2 == NULL)
1155                                          goto namerr;
1156                                  if (fseek(fin2,
1157 <                                (long)sizeof(BYTE)*picres.xr*picres.yr, 1))
1157 >                                (long)sizeof(uby8)*picres.xr*picres.yr, 1))
1158                                          goto seekerr;
1159                                  if (fseek(fin3,
1160 <                                (long)sizeof(BYTE)*2*picres.xr*picres.yr, 1))
1160 >                                (long)sizeof(uby8)*2*picres.xr*picres.yr, 1))
1161                                          goto seekerr;
1162                          }
1163                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines