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.29 by greg, Sat Dec 23 17:27:46 2006 UTC vs.
Revision 2.40 by greg, Tue Jun 30 22:30:29 2020 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 90 | 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 146 | 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 155 | Line 173 | main(
173                                  }
174                                  break;
175                          case 'd':               /* data only (no indices) */
176 <                                dataonly = argv[i][0] == '-';
176 >                                dataonly = (argv[i][0] == '-');
177                                  switch (argv[i][2]) {
178                                  case '\0':
179                                  case 'a':               /* ascii */
# Line 234 | 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 262 | 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 279 | Line 309 | unkopt:
309          }
310  
311          if (reverse) {
282 #ifdef _WIN32
312                  SET_FILE_BINARY(stdout);
284                if (format != 'a' && format != 'i')
285                        SET_FILE_BINARY(fin);
286 #endif
313                                          /* get header */
314                  if (header) {
315 <                        if (checkheader(fin, fmtid, stdout) < 0) {
316 <                                fprintf(stderr, "%s: wrong input format\n",
317 <                                                progname);
315 >                        getheader(fin, checkhead, stdout);
316 >                        if (wrongformat) {
317 >                                fprintf(stderr, "%s: wrong input format (expected %s)\n",
318 >                                                progname, fmtid);
319                                  quit(1);
320                          }
321                          if (fin2 != NULL) {
# Line 322 | Line 349 | unkopt:
349                  printargs(i, argv, stdout);
350                  if (expval < .99 || expval > 1.01)
351                          fputexpos(expval, stdout);
352 <                fputformat(COLRFMT, stdout);
352 >                if (outprims != NULL) {
353 >                        if (outprims != stdprims)
354 >                                fputprims(outprims, stdout);
355 >                        fputformat(COLRFMT, stdout);
356 >                } else                          /* XYZ data */
357 >                        fputformat(CIEFMT, stdout);
358                  putchar('\n');
359                  fputsresolu(&picres, stdout);   /* always put resolution */
360                  valtopix();
361          } else {
362 < #ifdef _WIN32
331 <                SET_FILE_BINARY(fin);
332 <                if (format != 'a' && format != 'i')
362 >                if ((format != 'a') & (format != 'i'))
363                          SET_FILE_BINARY(stdout);
334 #endif
364                                                  /* get header */
365 <                getheader(fin, checkhead, NULL);
365 >                getheader(fin, checkhead, header ? stdout : (FILE *)NULL);
366                  if (wrongformat) {
367                          fprintf(stderr,
368                                  "%s: input not a Radiance RGBE picture\n",
# Line 346 | Line 375 | unkopt:
375                  }
376                  if (header) {
377                          printargs(i, argv, stdout);
378 +                        printf("NCOMP=%d\n", putprim==ALL ? 3 : 1);
379 +                        if (!resolution && dataonly && !uniq)
380 +                                printf("NCOLS=%d\nNROWS=%d\n", scanlen(&picres),
381 +                                                numscans(&picres));
382                          if (expval < .99 || expval > 1.01)
383                                  fputexpos(expval, stdout);
384 +                        if (swapbytes) {
385 +                                if (nativebigendian())
386 +                                        puts("BigEndian=0");
387 +                                else
388 +                                        puts("BigEndian=1");
389 +                        } else if ((format != 'a') & (format != 'i') &
390 +                                                (format != 'b'))
391 +                                fputendian(stdout);
392                          fputformat(fmtid, stdout);
393                          putchar('\n');
394                  }
# Line 367 | Line 408 | checkhead(                             /* deal with line from header */
408          void    *p
409   )
410   {
411 <        char    fmt[32];
411 >        FILE    *fout = (FILE *)p;
412 >        char    fmt[MAXFMTLEN];
413          double  d;
414          COLOR   ctmp;
415 +        int     rv;
416  
417          if (formatval(fmt, line)) {
418 <                if (!strcmp(fmt, CIEFMT))
418 >                if (reverse)
419 >                        wrongformat = strcmp(fmt, fmtid);
420 >                else if (!strcmp(fmt, CIEFMT))
421                          mybright = &xyz_bright;
422                  else if (!strcmp(fmt, COLRFMT))
423                          mybright = &rgb_bright;
424                  else
425                          wrongformat++;
426 <        } else if (original && isexpos(line)) {
426 >                return(1);
427 >        }
428 >        if (original && isexpos(line)) {
429                  d = 1.0/exposval(line);
430                  scalecolor(exposure, d);
431                  doexposure++;
432 <        } else if (original && iscolcor(line)) {
432 >                return(1);
433 >        }
434 >        if (original && iscolcor(line)) {
435                  colcorval(ctmp, line);
436                  setcolor(exposure, colval(exposure,RED)/colval(ctmp,RED),
437                                  colval(exposure,GRN)/colval(ctmp,GRN),
438                                  colval(exposure,BLU)/colval(ctmp,BLU));
439                  doexposure++;
440 <        } else if (header)
441 <                fputs(line, stdout);
440 >                return(1);
441 >        }
442 >        if ((rv = isbigendian(line)) >= 0) {
443 >                if (reverse)
444 >                        swapbytes = (nativebigendian() != rv);
445 >                return(1);
446 >        }
447 >        if (fout != NULL)
448 >                fputs(line, fout);
449          return(0);
450   }
451  
# Line 397 | Line 453 | checkhead(                             /* deal with line from header */
453   static void
454   pixtoval(void)                          /* convert picture to values */
455   {
456 <        register COLOR  *scanln;
456 >        COLOR   *scanln;
457          int  dogamma;
458          COLOR  lastc;
459          RREAL  hv[2];
460          int  startprim, endprim;
461          long  startpos;
462 <        int  y;
407 <        register int  x;
462 >        int  x, y;
463  
464          scanln = (COLOR *)malloc(scanlen(&picres)*sizeof(COLOR));
465          if (scanln == NULL) {
# Line 412 | Line 467 | pixtoval(void)                         /* convert picture to values */
467                  quit(1);
468          }
469          dogamma = gamcor < .95 || gamcor > 1.05;
470 <        if (putprim == ALL && !interleave) {
470 >        if ((putprim == ALL) & !interleave) {
471                  startprim = RED; endprim = BLU;
472                  startpos = ftell(fin);
473          } else {
474                  startprim = putprim; endprim = putprim;
475          }
476          for (putprim = startprim; putprim <= endprim; putprim++) {
477 <                if (putprim != startprim && fseek(fin, startpos, 0)) {
477 >                if (putprim != startprim && fseek(fin, startpos, SEEK_SET)) {
478                          fprintf(stderr, "%s: seek error on input file\n",
479                                          progname);
480                          quit(1);
# Line 471 | Line 526 | pixtoval(void)                         /* convert picture to values */
526   static void
527   valtopix(void)                  /* convert values to a pixel file */
528   {
529 <        int  dogamma;
530 <        register COLOR  *scanln;
531 <        int  y;
532 <        register int  x;
529 >        int     dogamma;
530 >        COLOR   *scanln;
531 >        COLR    rgbe;
532 >        int     x, y;
533  
534          scanln = (COLOR *)malloc(scanlen(&picres)*sizeof(COLOR));
535          if (scanln == NULL) {
# Line 503 | Line 558 | valtopix(void)                 /* convert values to a pixel file */
558                                          pow(colval(scanln[x],BLU), gamcor));
559                          if (doexposure)
560                                  multcolor(scanln[x], exposure);
561 +                        if (uniq) {             /* uncompressed? */
562 +                                setcolr(rgbe,   scanln[x][RED],
563 +                                                scanln[x][GRN],
564 +                                                scanln[x][BLU]);
565 +                                if (putbinary(rgbe, sizeof(COLR), 1, stdout) != 1)
566 +                                        goto writerr;
567 +                        }
568                  }
569 <                if (fwritescan(scanln, scanlen(&picres), stdout) < 0) {
570 <                        fprintf(stderr, "%s: write error\n", progname);
571 <                        quit(1);
510 <                }
569 >                                                /* write scan if compressed */
570 >                if (!uniq && fwritescan(scanln, scanlen(&picres), stdout) < 0)
571 >                        goto writerr;
572          }
573          free((void *)scanln);
574 +        return;
575 + writerr:
576 +        fprintf(stderr, "%s: write error\n", progname);
577 +        quit(1);
578   }
579  
580  
# Line 550 | Line 615 | getcdouble(            /* get a double color value from stream(s
615          double  vd[3];
616  
617          if (fin2 == NULL) {
618 <                if (fread((char *)vd, sizeof(double), 3, fin) != 3)
618 >                if (getbinary(vd, sizeof(double), 3, fin) != 3)
619                          return(-1);
620          } else {
621 <                if (fread((char *)vd, sizeof(double), 1, fin) != 1 ||
622 <                        fread((char *)(vd+1), sizeof(double), 1, fin2) != 1 ||
623 <                        fread((char *)(vd+2), sizeof(double), 1, fin3) != 1)
621 >                if (getbinary(vd, sizeof(double), 1, fin) != 1 ||
622 >                        getbinary(vd+1, sizeof(double), 1, fin2) != 1 ||
623 >                        getbinary(vd+2, sizeof(double), 1, fin3) != 1)
624                          return(-1);
625          }
626          if (swapbytes)
# Line 573 | Line 638 | getcfloat(             /* get a float color value from stream(s)
638          float  vf[3];
639  
640          if (fin2 == NULL) {
641 <                if (fread((char *)vf, sizeof(float), 3, fin) != 3)
641 >                if (getbinary(vf, sizeof(float), 3, fin) != 3)
642                          return(-1);
643          } else {
644 <                if (fread((char *)vf, sizeof(float), 1, fin) != 1 ||
645 <                        fread((char *)(vf+1), sizeof(float), 1, fin2) != 1 ||
646 <                        fread((char *)(vf+2), sizeof(float), 1, fin3) != 1)
644 >                if (getbinary(vf, sizeof(float), 1, fin) != 1 ||
645 >                        getbinary(vf+1, sizeof(float), 1, fin2) != 1 ||
646 >                        getbinary(vf+2, sizeof(float), 1, fin3) != 1)
647                          return(-1);
648          }
649          if (swapbytes)
# Line 615 | Line 680 | getcbyte(              /* get a byte color value from stream(s) */
680          COLOR  col
681   )
682   {
683 <        BYTE  vb[3];
683 >        uby8  vb[3];
684  
685          if (fin2 == NULL) {
686 <                if (fread((char *)vb, sizeof(BYTE), 3, fin) != 3)
686 >                if (getbinary(vb, sizeof(uby8), 3, fin) != 3)
687                          return(-1);
688          } else {
689 <                if (fread((char *)vb, sizeof(BYTE), 1, fin) != 1 ||
690 <                        fread((char *)(vb+1), sizeof(BYTE), 1, fin2) != 1 ||
691 <                        fread((char *)(vb+2), sizeof(BYTE), 1, fin3) != 1)
689 >                if (getbinary(vb, sizeof(uby8), 1, fin) != 1 ||
690 >                        getbinary(vb+1, sizeof(uby8), 1, fin2) != 1 ||
691 >                        getbinary(vb+2, sizeof(uby8), 1, fin3) != 1)
692                          return(-1);
693          }
694          setcolor(col, (vb[rord[RED]]+.5)/256.,
# Line 640 | Line 705 | getcword(              /* get a 16-bit color value from stream(s)
705          uint16  vw[3];
706  
707          if (fin2 == NULL) {
708 <                if (fread((char *)vw, sizeof(uint16), 3, fin) != 3)
708 >                if (getbinary(vw, sizeof(uint16), 3, fin) != 3)
709                          return(-1);
710          } else {
711 <                if (fread((char *)vw, sizeof(uint16), 1, fin) != 1 ||
712 <                        fread((char *)(vw+1), sizeof(uint16), 1, fin2) != 1 ||
713 <                        fread((char *)(vw+2), sizeof(uint16), 1, fin3) != 1)
711 >                if (getbinary(vw, sizeof(uint16), 1, fin) != 1 ||
712 >                        getbinary(vw+1, sizeof(uint16), 1, fin2) != 1 ||
713 >                        getbinary(vw+2, sizeof(uint16), 1, fin3) != 1)
714                          return(-1);
715          }
716          if (swapbytes)
# Line 677 | Line 742 | getbdouble(            /* get a double brightness value from fin
742   {
743          double  vd;
744  
745 <        if (fread((char *)&vd, sizeof(double), 1, fin) != 1)
745 >        if (getbinary(&vd, sizeof(double), 1, fin) != 1)
746                  return(-1);
747          if (swapbytes)
748                  swap64((char *)&vd, 1);
# Line 693 | Line 758 | getbfloat(             /* get a float brightness value from fin *
758   {
759          float  vf;
760  
761 <        if (fread((char *)&vf, sizeof(float), 1, fin) != 1)
761 >        if (getbinary(&vf, sizeof(float), 1, fin) != 1)
762                  return(-1);
763          if (swapbytes)
764                  swap32((char *)&vf, 1);
# Line 723 | Line 788 | getbbyte(              /* get a byte brightness value from fin */
788          COLOR  col
789   )
790   {
791 <        BYTE  vb;
791 >        uby8  vb;
792          double  d;
793  
794 <        if (fread((char *)&vb, sizeof(BYTE), 1, fin) != 1)
794 >        if (getbinary(&vb, sizeof(uby8), 1, fin) != 1)
795                  return(-1);
796          d = (vb+.5)/256.;
797          setcolor(col, d, d, d);
# Line 742 | Line 807 | getbword(              /* get a 16-bit brightness value from fin *
807          uint16  vw;
808          double  d;
809  
810 <        if (fread((char *)&vw, sizeof(uint16), 1, fin) != 1)
810 >        if (getbinary(&vw, sizeof(uint16), 1, fin) != 1)
811                  return(-1);
812          if (swapbytes)
813                  swap16((char *)&vw, 1);
# Line 778 | Line 843 | putcfloat(                     /* put a float color to stdout */
843          vf[2] = colval(col,ord[2]);
844          if (swapbytes)
845                  swap32((char *)vf, 3);
846 <        fwrite((char *)vf, sizeof(float), 3, stdout);
846 >        putbinary(vf, sizeof(float), 3, stdout);
847  
848          return(ferror(stdout) ? -1 : 0);
849   }
# Line 796 | Line 861 | putcdouble(                    /* put a double color to stdout */
861          vd[2] = colval(col,ord[2]);
862          if (swapbytes)
863                  swap64((char *)vd, 3);
864 <        fwrite((char *)vd, sizeof(double), 3, stdout);
864 >        putbinary(vd, sizeof(double), 3, stdout);
865  
866          return(ferror(stdout) ? -1 : 0);
867   }
# Line 822 | Line 887 | putcbyte(                      /* put a byte color to stdout */
887   )
888   {
889          long  i;
890 <        BYTE  vb[3];
890 >        uby8  vb[3];
891  
892          i = colval(col,ord[0])*256.;
893          vb[0] = min(i,255);
# Line 830 | Line 895 | putcbyte(                      /* put a byte color to stdout */
895          vb[1] = min(i,255);
896          i = colval(col,ord[2])*256.;
897          vb[2] = min(i,255);
898 <        fwrite((char *)vb, sizeof(BYTE), 3, stdout);
898 >        putbinary(vb, sizeof(uby8), 3, stdout);
899  
900          return(ferror(stdout) ? -1 : 0);
901   }
# Line 852 | Line 917 | putcword(                      /* put a 16-bit color to stdout */
917          vw[2] = min(i,65535);
918          if (swapbytes)
919                  swap16((char *)vw, 3);
920 <        fwrite((char *)vw, sizeof(uint16), 3, stdout);
920 >        putbinary(vw, sizeof(uint16), 3, stdout);
921  
922          return(ferror(stdout) ? -1 : 0);
923   }
# Line 879 | Line 944 | putbfloat(                     /* put a float brightness to stdout */
944          vf = (*mybright)(col);
945          if (swapbytes)
946                  swap32((char *)&vf, 1);
947 <        fwrite((char *)&vf, sizeof(float), 1, stdout);
947 >        putbinary(&vf, sizeof(float), 1, stdout);
948  
949          return(ferror(stdout) ? -1 : 0);
950   }
# Line 895 | Line 960 | putbdouble(                    /* put a double brightness to stdout */
960          vd = (*mybright)(col);
961          if (swapbytes)
962                  swap64((char *)&vd, 1);
963 <        fwrite((char *)&vd, sizeof(double), 1, stdout);
963 >        putbinary(&vd, sizeof(double), 1, stdout);
964  
965          return(ferror(stdout) ? -1 : 0);
966   }
# Line 917 | Line 982 | putbbyte(                      /* put a byte brightness to stdout */
982          COLOR  col
983   )
984   {
985 <        register int  i;
986 <        BYTE  vb;
985 >        int  i;
986 >        uby8  vb;
987  
988          i = (*mybright)(col)*256.;
989          vb = min(i,255);
990 <        fwrite((char *)&vb, sizeof(BYTE), 1, stdout);
990 >        putbinary(&vb, sizeof(uby8), 1, stdout);
991  
992          return(ferror(stdout) ? -1 : 0);
993   }
# Line 940 | Line 1005 | putbword(                      /* put a 16-bit brightness to stdout */
1005          vw = min(i,65535);
1006          if (swapbytes)
1007                  swap16((char *)&vw, 1);
1008 <        fwrite((char *)&vw, sizeof(uint16), 1, stdout);
1008 >        putbinary(&vw, sizeof(uint16), 1, stdout);
1009  
1010          return(ferror(stdout) ? -1 : 0);
1011   }
# Line 967 | Line 1032 | putpfloat(                     /* put a float primary to stdout */
1032          vf = colval(col,putprim);
1033          if (swapbytes)
1034                  swap32((char *)&vf, 1);
1035 <        fwrite((char *)&vf, sizeof(float), 1, stdout);
1035 >        putbinary(&vf, sizeof(float), 1, stdout);
1036  
1037          return(ferror(stdout) ? -1 : 0);
1038   }
# Line 983 | Line 1048 | putpdouble(                    /* put a double primary to stdout */
1048          vd = colval(col,putprim);
1049          if (swapbytes)
1050                  swap64((char *)&vd, 1);
1051 <        fwrite((char *)&vd, sizeof(double), 1, stdout);
1051 >        putbinary(&vd, sizeof(double), 1, stdout);
1052  
1053          return(ferror(stdout) ? -1 : 0);
1054   }
# Line 1006 | Line 1071 | putpbyte(                      /* put a byte primary to stdout */
1071   )
1072   {
1073          long  i;
1074 <        BYTE  vb;
1074 >        uby8  vb;
1075  
1076          i = colval(col,putprim)*256.;
1077          vb = min(i,255);
1078 <        fwrite((char *)&vb, sizeof(BYTE), 1, stdout);
1078 >        putbinary(&vb, sizeof(uby8), 1, stdout);
1079  
1080          return(ferror(stdout) ? -1 : 0);
1081   }
# Line 1028 | Line 1093 | putpword(                      /* put a 16-bit primary to stdout */
1093          vw = min(i,65535);
1094          if (swapbytes)
1095                  swap16((char *)&vw, 1);
1096 <        fwrite((char *)&vw, sizeof(uint16), 1, stdout);
1096 >        putbinary(&vw, sizeof(uint16), 1, stdout);
1097  
1098          return(ferror(stdout) ? -1 : 0);
1099   }
# Line 1070 | Line 1135 | set_io(void)                   /* set put and get functions */
1135                                  if (fin2 == NULL)
1136                                          goto namerr;
1137                                  if (fseek(fin2,
1138 <                                (long)sizeof(float)*picres.xr*picres.yr, 1))
1138 >                                (long)sizeof(float)*picres.xr*picres.yr, SEEK_CUR))
1139                                          goto seekerr;
1140                                  if (fseek(fin3,
1141 <                                (long)sizeof(float)*2*picres.xr*picres.yr, 1))
1141 >                                (long)sizeof(float)*2*picres.xr*picres.yr, SEEK_CUR))
1142                                          goto seekerr;
1143                          }
1144                  }
# Line 1092 | Line 1157 | set_io(void)                   /* set put and get functions */
1157                                  if (fin2 == NULL)
1158                                          goto namerr;
1159                                  if (fseek(fin2,
1160 <                                (long)sizeof(double)*picres.xr*picres.yr, 1))
1160 >                                (long)sizeof(double)*picres.xr*picres.yr, SEEK_CUR))
1161                                          goto seekerr;
1162                                  if (fseek(fin3,
1163 <                                (long)sizeof(double)*2*picres.xr*picres.yr, 1))
1163 >                                (long)sizeof(double)*2*picres.xr*picres.yr, SEEK_CUR))
1164                                          goto seekerr;
1165                          }
1166                  }
# Line 1132 | Line 1197 | set_io(void)                   /* set put and get functions */
1197                                  if (fin2 == NULL)
1198                                          goto namerr;
1199                                  if (fseek(fin2,
1200 <                                (long)sizeof(BYTE)*picres.xr*picres.yr, 1))
1200 >                                (long)sizeof(uby8)*picres.xr*picres.yr, SEEK_CUR))
1201                                          goto seekerr;
1202                                  if (fseek(fin3,
1203 <                                (long)sizeof(BYTE)*2*picres.xr*picres.yr, 1))
1203 >                                (long)sizeof(uby8)*2*picres.xr*picres.yr, SEEK_CUR))
1204                                          goto seekerr;
1205                          }
1206                  }
# Line 1154 | Line 1219 | set_io(void)                   /* set put and get functions */
1219                                  if (fin2 == NULL)
1220                                          goto namerr;
1221                                  if (fseek(fin2,
1222 <                                (long)sizeof(uint16)*picres.xr*picres.yr, 1))
1222 >                                (long)sizeof(uint16)*picres.xr*picres.yr, SEEK_CUR))
1223                                          goto seekerr;
1224                                  if (fseek(fin3,
1225 <                                (long)sizeof(uint16)*2*picres.xr*picres.yr, 1))
1225 >                                (long)sizeof(uint16)*2*picres.xr*picres.yr, SEEK_CUR))
1226                                          goto seekerr;
1227                          }
1228                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines