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.26 by schorsch, Sun Mar 28 20:33:14 2004 UTC vs.
Revision 2.36 by greg, Mon Jul 15 23:42:44 2019 UTC

# Line 36 | Line 36 | int  original = 0;             /* convert to original values? */
36   int  wrongformat = 0;           /* wrong input format? */
37   double  gamcor = 1.0;           /* gamma correction */
38  
39 + RGBPRIMP  outprims = stdprims;  /* output primaries for reverse conversion */
40 + RGBPRIMS  myprims;
41 +
42   int  ord[3] = {RED, GRN, BLU};  /* RGB ordering */
43   int  rord[4];                   /* reverse ordering */
44  
# Line 66 | Line 69 | static putfunc_t putpascii, putpint, putpdouble, putpf
69   static void set_io(void);
70   static void pixtoval(void);
71   static void valtopix(void);
69 static void swap16(uint16  *wp, int  n);
70 static void swap32(uint32  *wp, int  n);
71 static void swap64(char  *wp, int  n);
72  
73  
74   static double
# Line 93 | Line 93 | main(
93          char  **argv
94   )
95   {
96 <        double  d, expval = 1.0;
97 <        int  i;
96 >        const char      *inpmode = "r";
97 >        double          d, expval = 1.0;
98 >        int             i;
99  
100          progname = argv[0];
101          mybright = &rgb_bright; /* default */
# Line 149 | Line 150 | main(
150                          case 'b':               /* brightness values */
151                                  putprim = argv[i][0] == '-' ? BRIGHT : ALL;
152                                  break;
153 <                        case 'p':               /* put primary */
153 >                        case 'p':               /* primary controls */
154                                  switch (argv[i][2]) {
155 +                                /* these two options affect -r conversion */
156 +                                case '\0':
157 +                                        myprims[RED][CIEX] = atof(argv[++i]);
158 +                                        myprims[RED][CIEY] = atof(argv[++i]);
159 +                                        myprims[GRN][CIEX] = atof(argv[++i]);
160 +                                        myprims[GRN][CIEY] = atof(argv[++i]);
161 +                                        myprims[BLU][CIEX] = atof(argv[++i]);
162 +                                        myprims[BLU][CIEY] = atof(argv[++i]);
163 +                                        myprims[WHT][CIEX] = atof(argv[++i]);
164 +                                        myprims[WHT][CIEY] = atof(argv[++i]);
165 +                                        outprims = myprims;
166 +                                        break;
167 +                                case 'x': case 'X': outprims = NULL; break;
168 +                                /* the following options affect +r only */
169                                  case 'r': case 'R': putprim = RED; break;
170                                  case 'g': case 'G': putprim = GRN; break;
171                                  case 'b': case 'B': putprim = BLU; break;
# Line 237 | Line 252 | unkopt:
252                  else
253                          fmtid = "16-bit_grey";
254          }
255 +        if (!reverse || (format != 'a') & (format != 'i'))
256 +                inpmode = "rb";
257                                          /* assign reverse ordering */
258          rord[ord[0]] = 0;
259          rord[ord[1]] = 1;
260          rord[ord[2]] = 2;
261                                          /* get input */
262          if (i == argc) {
263 +                long    n = skipbytes;
264 +                if (inpmode[1] == 'b')
265 +                        SET_FILE_BINARY(stdin);
266 +                while (n-- > 0)
267 +                        if (getchar() == EOF) {
268 +                                fprintf(stderr,
269 +                                "%s: cannot skip %ld bytes on standard input\n",
270 +                                                progname, skipbytes);
271 +                                quit(1);
272 +                        }
273                  fin = stdin;
274          } else if (i < argc) {
275 <                if ((fin = fopen(argv[i], "r")) == NULL) {
275 >                if ((fin = fopen(argv[i], inpmode)) == NULL) {
276                          fprintf(stderr, "%s: can't open file \"%s\"\n",
277                                                  progname, argv[i]);
278                          quit(1);
279                  }
280                  if (reverse && putprim != BRIGHT && i == argc-3) {
281 <                        if ((fin2 = fopen(argv[i+1], "r")) == NULL) {
281 >                        if ((fin2 = fopen(argv[i+1], inpmode)) == NULL) {
282                                  fprintf(stderr, "%s: can't open file \"%s\"\n",
283                                                  progname, argv[i+1]);
284                                  quit(1);
285                          }
286 <                        if ((fin3 = fopen(argv[i+2], "r")) == NULL) {
286 >                        if ((fin3 = fopen(argv[i+2], inpmode)) == NULL) {
287                                  fprintf(stderr, "%s: can't open file \"%s\"\n",
288                                                  progname, argv[i+2]);
289                                  quit(1);
# Line 265 | Line 292 | unkopt:
292                  } else if (i != argc-1)
293                          fin = NULL;
294                  if (reverse && putprim != BRIGHT && !interleave) {
295 <                        fin2 = fopen(argv[i], "r");
296 <                        fin3 = fopen(argv[i], "r");
295 >                        fin2 = fopen(argv[i], inpmode);
296 >                        fin3 = fopen(argv[i], inpmode);
297                  }
298 <                if (skipbytes && (fseek(fin, skipbytes, 0) || (fin2 != NULL &&
299 <                                (fseek(fin2, skipbytes, 0) ||
300 <                                fseek(fin3, skipbytes, 0))))) {
298 >                if (skipbytes && (fseek(fin, skipbytes, SEEK_SET) || (fin2 != NULL &&
299 >                                fseek(fin2, skipbytes, SEEK_SET) |
300 >                                fseek(fin3, skipbytes, SEEK_SET)))) {
301                          fprintf(stderr, "%s: cannot skip %ld bytes on input\n",
302                                          progname, skipbytes);
303                          quit(1);
# Line 282 | Line 309 | unkopt:
309          }
310  
311          if (reverse) {
285 #ifdef _WIN32
312                  SET_FILE_BINARY(stdout);
287                if (format != 'a' && format != 'i')
288                        SET_FILE_BINARY(fin);
289 #endif
313                                          /* get header */
314                  if (header) {
315                          if (checkheader(fin, fmtid, stdout) < 0) {
# Line 325 | Line 348 | unkopt:
348                  printargs(i, argv, stdout);
349                  if (expval < .99 || expval > 1.01)
350                          fputexpos(expval, stdout);
351 <                fputformat(COLRFMT, stdout);
351 >                if (outprims != NULL) {
352 >                        if (outprims != stdprims)
353 >                                fputprims(outprims, stdout);
354 >                        fputformat(COLRFMT, stdout);
355 >                } else                          /* XYZ data */
356 >                        fputformat(CIEFMT, stdout);
357                  putchar('\n');
358                  fputsresolu(&picres, stdout);   /* always put resolution */
359                  valtopix();
360          } else {
361 < #ifdef _WIN32
334 <                SET_FILE_BINARY(fin);
335 <                if (format != 'a' && format != 'i')
361 >                if ((format != 'a') & (format != 'i'))
362                          SET_FILE_BINARY(stdout);
337 #endif
363                                                  /* get header */
364                  getheader(fin, checkhead, NULL);
365                  if (wrongformat) {
# Line 370 | Line 395 | checkhead(                             /* deal with line from header */
395          void    *p
396   )
397   {
398 <        char    fmt[32];
398 >        char    fmt[MAXFMTLEN];
399          double  d;
400          COLOR   ctmp;
401  
402          if (formatval(fmt, line)) {
403 <                if (!strcmp(fmt, CIEFMT)) {
403 >                if (!strcmp(fmt, CIEFMT))
404                          mybright = &xyz_bright;
405 <                        if (original) {
381 <                                scalecolor(exposure, 1./WHTEFFICACY);
382 <                                doexposure++;
383 <                        }
384 <                } else if (!strcmp(fmt, COLRFMT))
405 >                else if (!strcmp(fmt, COLRFMT))
406                          mybright = &rgb_bright;
407                  else
408                          wrongformat++;
# Line 404 | Line 425 | checkhead(                             /* deal with line from header */
425   static void
426   pixtoval(void)                          /* convert picture to values */
427   {
428 <        register COLOR  *scanln;
428 >        COLOR   *scanln;
429          int  dogamma;
430          COLOR  lastc;
431          RREAL  hv[2];
432          int  startprim, endprim;
433          long  startpos;
434 <        int  y;
414 <        register int  x;
434 >        int  x, y;
435  
436          scanln = (COLOR *)malloc(scanlen(&picres)*sizeof(COLOR));
437          if (scanln == NULL) {
# Line 419 | Line 439 | pixtoval(void)                         /* convert picture to values */
439                  quit(1);
440          }
441          dogamma = gamcor < .95 || gamcor > 1.05;
442 <        if (putprim == ALL && !interleave) {
442 >        if ((putprim == ALL) & !interleave) {
443                  startprim = RED; endprim = BLU;
444                  startpos = ftell(fin);
445          } else {
446                  startprim = putprim; endprim = putprim;
447          }
448          for (putprim = startprim; putprim <= endprim; putprim++) {
449 <                if (putprim != startprim && fseek(fin, startpos, 0)) {
449 >                if (putprim != startprim && fseek(fin, startpos, SEEK_SET)) {
450                          fprintf(stderr, "%s: seek error on input file\n",
451                                          progname);
452                          quit(1);
# Line 478 | Line 498 | pixtoval(void)                         /* convert picture to values */
498   static void
499   valtopix(void)                  /* convert values to a pixel file */
500   {
501 <        int  dogamma;
502 <        register COLOR  *scanln;
503 <        int  y;
504 <        register int  x;
501 >        int     dogamma;
502 >        COLOR   *scanln;
503 >        COLR    rgbe;
504 >        int     x, y;
505  
506          scanln = (COLOR *)malloc(scanlen(&picres)*sizeof(COLOR));
507          if (scanln == NULL) {
# Line 510 | Line 530 | valtopix(void)                 /* convert values to a pixel file */
530                                          pow(colval(scanln[x],BLU), gamcor));
531                          if (doexposure)
532                                  multcolor(scanln[x], exposure);
533 +                        if (uniq) {             /* uncompressed? */
534 +                                setcolr(rgbe,   scanln[x][RED],
535 +                                                scanln[x][GRN],
536 +                                                scanln[x][BLU]);
537 +                                if (putbinary(rgbe, sizeof(COLR), 1, stdout) != 1)
538 +                                        goto writerr;
539 +                        }
540                  }
541 <                if (fwritescan(scanln, scanlen(&picres), stdout) < 0) {
542 <                        fprintf(stderr, "%s: write error\n", progname);
543 <                        quit(1);
517 <                }
541 >                                                /* write scan if compressed */
542 >                if (!uniq && fwritescan(scanln, scanlen(&picres), stdout) < 0)
543 >                        goto writerr;
544          }
545          free((void *)scanln);
546 +        return;
547 + writerr:
548 +        fprintf(stderr, "%s: write error\n", progname);
549 +        quit(1);
550   }
551  
552  
# Line 528 | Line 558 | int  code;
558   }
559  
560  
531 static void
532 swap16(         /* swap n 16-bit words */
533        register uint16  *wp,
534        int  n
535 )
536 {
537        while (n-- > 0) {
538                *wp = *wp << 8 | ((*wp >> 8) & 0xff);
539                wp++;
540        }
541 }
542
543
544 static void
545 swap32(         /* swap n 32-bit words */
546        register uint32  *wp,
547        int  n
548 )
549 {
550        while (n-- > 0) {
551                *wp = *wp << 24 | ((*wp >> 24) & 0xff) |
552                        (*wp & 0xff00) << 8 | (*wp & 0xff0000) >> 8;
553                wp++;
554        }
555 }
556
557
558 static void
559 swap64(         /* swap n 64-bit words */
560        register char  *wp,
561        int  n
562 )
563 {
564        register int    t;
565
566        while (n-- > 0) {
567                t = wp[0]; wp[0] = wp[7]; wp[7] = t;
568                t = wp[1]; wp[1] = wp[6]; wp[6] = t;
569                t = wp[2]; wp[2] = wp[5]; wp[5] = t;
570                t = wp[3]; wp[3] = wp[4]; wp[4] = t;
571                wp += 8;
572        }
573 }
574
575
561   static int
562   getcascii(              /* get an ascii color value from stream(s) */
563          COLOR  col
# Line 602 | Line 587 | getcdouble(            /* get a double color value from stream(s
587          double  vd[3];
588  
589          if (fin2 == NULL) {
590 <                if (fread((char *)vd, sizeof(double), 3, fin) != 3)
590 >                if (getbinary(vd, sizeof(double), 3, fin) != 3)
591                          return(-1);
592          } else {
593 <                if (fread((char *)vd, sizeof(double), 1, fin) != 1 ||
594 <                        fread((char *)(vd+1), sizeof(double), 1, fin2) != 1 ||
595 <                        fread((char *)(vd+2), sizeof(double), 1, fin3) != 1)
593 >                if (getbinary(vd, sizeof(double), 1, fin) != 1 ||
594 >                        getbinary(vd+1, sizeof(double), 1, fin2) != 1 ||
595 >                        getbinary(vd+2, sizeof(double), 1, fin3) != 1)
596                          return(-1);
597          }
598          if (swapbytes)
# Line 625 | Line 610 | getcfloat(             /* get a float color value from stream(s)
610          float  vf[3];
611  
612          if (fin2 == NULL) {
613 <                if (fread((char *)vf, sizeof(float), 3, fin) != 3)
613 >                if (getbinary(vf, sizeof(float), 3, fin) != 3)
614                          return(-1);
615          } else {
616 <                if (fread((char *)vf, sizeof(float), 1, fin) != 1 ||
617 <                        fread((char *)(vf+1), sizeof(float), 1, fin2) != 1 ||
618 <                        fread((char *)(vf+2), sizeof(float), 1, fin3) != 1)
616 >                if (getbinary(vf, sizeof(float), 1, fin) != 1 ||
617 >                        getbinary(vf+1, sizeof(float), 1, fin2) != 1 ||
618 >                        getbinary(vf+2, sizeof(float), 1, fin3) != 1)
619                          return(-1);
620          }
621          if (swapbytes)
622 <                swap32((uint32 *)vf, 3);
622 >                swap32((char *)vf, 3);
623          setcolor(col, vf[rord[RED]], vf[rord[GRN]], vf[rord[BLU]]);
624          return(0);
625   }
# Line 667 | Line 652 | getcbyte(              /* get a byte color value from stream(s) */
652          COLOR  col
653   )
654   {
655 <        BYTE  vb[3];
655 >        uby8  vb[3];
656  
657          if (fin2 == NULL) {
658 <                if (fread((char *)vb, sizeof(BYTE), 3, fin) != 3)
658 >                if (getbinary(vb, sizeof(uby8), 3, fin) != 3)
659                          return(-1);
660          } else {
661 <                if (fread((char *)vb, sizeof(BYTE), 1, fin) != 1 ||
662 <                        fread((char *)(vb+1), sizeof(BYTE), 1, fin2) != 1 ||
663 <                        fread((char *)(vb+2), sizeof(BYTE), 1, fin3) != 1)
661 >                if (getbinary(vb, sizeof(uby8), 1, fin) != 1 ||
662 >                        getbinary(vb+1, sizeof(uby8), 1, fin2) != 1 ||
663 >                        getbinary(vb+2, sizeof(uby8), 1, fin3) != 1)
664                          return(-1);
665          }
666          setcolor(col, (vb[rord[RED]]+.5)/256.,
# Line 692 | Line 677 | getcword(              /* get a 16-bit color value from stream(s)
677          uint16  vw[3];
678  
679          if (fin2 == NULL) {
680 <                if (fread((char *)vw, sizeof(uint16), 3, fin) != 3)
680 >                if (getbinary(vw, sizeof(uint16), 3, fin) != 3)
681                          return(-1);
682          } else {
683 <                if (fread((char *)vw, sizeof(uint16), 1, fin) != 1 ||
684 <                        fread((char *)(vw+1), sizeof(uint16), 1, fin2) != 1 ||
685 <                        fread((char *)(vw+2), sizeof(uint16), 1, fin3) != 1)
683 >                if (getbinary(vw, sizeof(uint16), 1, fin) != 1 ||
684 >                        getbinary(vw+1, sizeof(uint16), 1, fin2) != 1 ||
685 >                        getbinary(vw+2, sizeof(uint16), 1, fin3) != 1)
686                          return(-1);
687          }
688          if (swapbytes)
689 <                swap16(vw, 3);
689 >                swap16((char *)vw, 3);
690          setcolor(col, (vw[rord[RED]]+.5)/65536.,
691                          (vw[rord[GRN]]+.5)/65536., (vw[rord[BLU]]+.5)/65536.);
692          return(0);
# Line 729 | Line 714 | getbdouble(            /* get a double brightness value from fin
714   {
715          double  vd;
716  
717 <        if (fread((char *)&vd, sizeof(double), 1, fin) != 1)
717 >        if (getbinary(&vd, sizeof(double), 1, fin) != 1)
718                  return(-1);
719          if (swapbytes)
720                  swap64((char *)&vd, 1);
# Line 745 | Line 730 | getbfloat(             /* get a float brightness value from fin *
730   {
731          float  vf;
732  
733 <        if (fread((char *)&vf, sizeof(float), 1, fin) != 1)
733 >        if (getbinary(&vf, sizeof(float), 1, fin) != 1)
734                  return(-1);
735          if (swapbytes)
736 <                swap32((uint32 *)&vf, 1);
736 >                swap32((char *)&vf, 1);
737          setcolor(col, vf, vf, vf);
738          return(0);
739   }
# Line 775 | Line 760 | getbbyte(              /* get a byte brightness value from fin */
760          COLOR  col
761   )
762   {
763 <        BYTE  vb;
763 >        uby8  vb;
764          double  d;
765  
766 <        if (fread((char *)&vb, sizeof(BYTE), 1, fin) != 1)
766 >        if (getbinary(&vb, sizeof(uby8), 1, fin) != 1)
767                  return(-1);
768          d = (vb+.5)/256.;
769          setcolor(col, d, d, d);
# Line 794 | Line 779 | getbword(              /* get a 16-bit brightness value from fin *
779          uint16  vw;
780          double  d;
781  
782 <        if (fread((char *)&vw, sizeof(uint16), 1, fin) != 1)
782 >        if (getbinary(&vw, sizeof(uint16), 1, fin) != 1)
783                  return(-1);
784          if (swapbytes)
785 <                swap16(&vw, 1);
785 >                swap16((char *)&vw, 1);
786          d = (vw+.5)/65536.;
787          setcolor(col, d, d, d);
788          return(0);
# Line 829 | Line 814 | putcfloat(                     /* put a float color to stdout */
814          vf[1] = colval(col,ord[1]);
815          vf[2] = colval(col,ord[2]);
816          if (swapbytes)
817 <                swap32((uint32 *)vf, 3);
818 <        fwrite((char *)vf, sizeof(float), 3, stdout);
817 >                swap32((char *)vf, 3);
818 >        putbinary(vf, sizeof(float), 3, stdout);
819  
820          return(ferror(stdout) ? -1 : 0);
821   }
# Line 848 | Line 833 | putcdouble(                    /* put a double color to stdout */
833          vd[2] = colval(col,ord[2]);
834          if (swapbytes)
835                  swap64((char *)vd, 3);
836 <        fwrite((char *)vd, sizeof(double), 3, stdout);
836 >        putbinary(vd, sizeof(double), 3, stdout);
837  
838          return(ferror(stdout) ? -1 : 0);
839   }
# Line 874 | Line 859 | putcbyte(                      /* put a byte color to stdout */
859   )
860   {
861          long  i;
862 <        BYTE  vb[3];
862 >        uby8  vb[3];
863  
864          i = colval(col,ord[0])*256.;
865          vb[0] = min(i,255);
# Line 882 | Line 867 | putcbyte(                      /* put a byte color to stdout */
867          vb[1] = min(i,255);
868          i = colval(col,ord[2])*256.;
869          vb[2] = min(i,255);
870 <        fwrite((char *)vb, sizeof(BYTE), 3, stdout);
870 >        putbinary(vb, sizeof(uby8), 3, stdout);
871  
872          return(ferror(stdout) ? -1 : 0);
873   }
# Line 903 | Line 888 | putcword(                      /* put a 16-bit color to stdout */
888          i = colval(col,ord[2])*65536.;
889          vw[2] = min(i,65535);
890          if (swapbytes)
891 <                swap16(vw, 3);
892 <        fwrite((char *)vw, sizeof(uint16), 3, stdout);
891 >                swap16((char *)vw, 3);
892 >        putbinary(vw, sizeof(uint16), 3, stdout);
893  
894          return(ferror(stdout) ? -1 : 0);
895   }
# Line 930 | Line 915 | putbfloat(                     /* put a float brightness to stdout */
915  
916          vf = (*mybright)(col);
917          if (swapbytes)
918 <                swap32((uint32 *)&vf, 1);
919 <        fwrite((char *)&vf, sizeof(float), 1, stdout);
918 >                swap32((char *)&vf, 1);
919 >        putbinary(&vf, sizeof(float), 1, stdout);
920  
921          return(ferror(stdout) ? -1 : 0);
922   }
# Line 947 | Line 932 | putbdouble(                    /* put a double brightness to stdout */
932          vd = (*mybright)(col);
933          if (swapbytes)
934                  swap64((char *)&vd, 1);
935 <        fwrite((char *)&vd, sizeof(double), 1, stdout);
935 >        putbinary(&vd, sizeof(double), 1, stdout);
936  
937          return(ferror(stdout) ? -1 : 0);
938   }
# Line 969 | Line 954 | putbbyte(                      /* put a byte brightness to stdout */
954          COLOR  col
955   )
956   {
957 <        register int  i;
958 <        BYTE  vb;
957 >        int  i;
958 >        uby8  vb;
959  
960          i = (*mybright)(col)*256.;
961          vb = min(i,255);
962 <        fwrite((char *)&vb, sizeof(BYTE), 1, stdout);
962 >        putbinary(&vb, sizeof(uby8), 1, stdout);
963  
964          return(ferror(stdout) ? -1 : 0);
965   }
# Line 991 | Line 976 | putbword(                      /* put a 16-bit brightness to stdout */
976          i = (*mybright)(col)*65536.;
977          vw = min(i,65535);
978          if (swapbytes)
979 <                swap16(&vw, 1);
980 <        fwrite((char *)&vw, sizeof(uint16), 1, stdout);
979 >                swap16((char *)&vw, 1);
980 >        putbinary(&vw, sizeof(uint16), 1, stdout);
981  
982          return(ferror(stdout) ? -1 : 0);
983   }
# Line 1018 | Line 1003 | putpfloat(                     /* put a float primary to stdout */
1003  
1004          vf = colval(col,putprim);
1005          if (swapbytes)
1006 <                swap32((uint32 *)&vf, 1);
1007 <        fwrite((char *)&vf, sizeof(float), 1, stdout);
1006 >                swap32((char *)&vf, 1);
1007 >        putbinary(&vf, sizeof(float), 1, stdout);
1008  
1009          return(ferror(stdout) ? -1 : 0);
1010   }
# Line 1035 | Line 1020 | putpdouble(                    /* put a double primary to stdout */
1020          vd = colval(col,putprim);
1021          if (swapbytes)
1022                  swap64((char *)&vd, 1);
1023 <        fwrite((char *)&vd, sizeof(double), 1, stdout);
1023 >        putbinary(&vd, sizeof(double), 1, stdout);
1024  
1025          return(ferror(stdout) ? -1 : 0);
1026   }
# Line 1058 | Line 1043 | putpbyte(                      /* put a byte primary to stdout */
1043   )
1044   {
1045          long  i;
1046 <        BYTE  vb;
1046 >        uby8  vb;
1047  
1048          i = colval(col,putprim)*256.;
1049          vb = min(i,255);
1050 <        fwrite((char *)&vb, sizeof(BYTE), 1, stdout);
1050 >        putbinary(&vb, sizeof(uby8), 1, stdout);
1051  
1052          return(ferror(stdout) ? -1 : 0);
1053   }
# Line 1079 | Line 1064 | putpword(                      /* put a 16-bit primary to stdout */
1064          i = colval(col,putprim)*65536.;
1065          vw = min(i,65535);
1066          if (swapbytes)
1067 <                swap16(&vw, 1);
1068 <        fwrite((char *)&vw, sizeof(uint16), 1, stdout);
1067 >                swap16((char *)&vw, 1);
1068 >        putbinary(&vw, sizeof(uint16), 1, stdout);
1069  
1070          return(ferror(stdout) ? -1 : 0);
1071   }
# Line 1122 | Line 1107 | set_io(void)                   /* set put and get functions */
1107                                  if (fin2 == NULL)
1108                                          goto namerr;
1109                                  if (fseek(fin2,
1110 <                                (long)sizeof(float)*picres.xr*picres.yr, 1))
1110 >                                (long)sizeof(float)*picres.xr*picres.yr, SEEK_CUR))
1111                                          goto seekerr;
1112                                  if (fseek(fin3,
1113 <                                (long)sizeof(float)*2*picres.xr*picres.yr, 1))
1113 >                                (long)sizeof(float)*2*picres.xr*picres.yr, SEEK_CUR))
1114                                          goto seekerr;
1115                          }
1116                  }
# Line 1144 | Line 1129 | set_io(void)                   /* set put and get functions */
1129                                  if (fin2 == NULL)
1130                                          goto namerr;
1131                                  if (fseek(fin2,
1132 <                                (long)sizeof(double)*picres.xr*picres.yr, 1))
1132 >                                (long)sizeof(double)*picres.xr*picres.yr, SEEK_CUR))
1133                                          goto seekerr;
1134                                  if (fseek(fin3,
1135 <                                (long)sizeof(double)*2*picres.xr*picres.yr, 1))
1135 >                                (long)sizeof(double)*2*picres.xr*picres.yr, SEEK_CUR))
1136                                          goto seekerr;
1137                          }
1138                  }
# Line 1184 | Line 1169 | set_io(void)                   /* set put and get functions */
1169                                  if (fin2 == NULL)
1170                                          goto namerr;
1171                                  if (fseek(fin2,
1172 <                                (long)sizeof(BYTE)*picres.xr*picres.yr, 1))
1172 >                                (long)sizeof(uby8)*picres.xr*picres.yr, SEEK_CUR))
1173                                          goto seekerr;
1174                                  if (fseek(fin3,
1175 <                                (long)sizeof(BYTE)*2*picres.xr*picres.yr, 1))
1175 >                                (long)sizeof(uby8)*2*picres.xr*picres.yr, SEEK_CUR))
1176                                          goto seekerr;
1177                          }
1178                  }
# Line 1206 | Line 1191 | set_io(void)                   /* set put and get functions */
1191                                  if (fin2 == NULL)
1192                                          goto namerr;
1193                                  if (fseek(fin2,
1194 <                                (long)sizeof(uint16)*picres.xr*picres.yr, 1))
1194 >                                (long)sizeof(uint16)*picres.xr*picres.yr, SEEK_CUR))
1195                                          goto seekerr;
1196                                  if (fseek(fin3,
1197 <                                (long)sizeof(uint16)*2*picres.xr*picres.yr, 1))
1197 >                                (long)sizeof(uint16)*2*picres.xr*picres.yr, SEEK_CUR))
1198                                          goto seekerr;
1199                          }
1200                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines