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

Comparing ray/src/px/pinterp.c (file contents):
Revision 2.32 by gwlarson, Fri Jul 16 16:11:31 1999 UTC vs.
Revision 2.41 by schorsch, Sun Mar 28 20:33:14 2004 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1999 Silicon Graphics, Inc. */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ SGI";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Interpolate and extrapolate pictures with different view parameters.
6   *
7   *      Greg Ward       09Dec89
8   */
9  
10 < #include "standard.h"
10 > #include "copyright.h"
11  
12   #include <ctype.h>
13 + #include <string.h>
14  
15 + #include "platform.h"
16 + #include "standard.h"
17 + #include "rtprocess.h" /* Windows: must come before color.h */
18   #include "view.h"
18
19   #include "color.h"
20  
21 #include "resolu.h"
22
21   #define LOG2            0.69314718055994530942
22  
23   #define pscan(y)        (ourpict+(y)*hresolu)
# Line 30 | Line 28 | static char SCCSid[] = "$SunId$ SGI";
28   #define averaging       (ourweigh != NULL)
29   #define blurring        (ourbpict != NULL)
30   #define usematrix       (hasmatrix & !averaging)
31 < #define zisnorm         (!usematrix | ourview.type != VT_PER)
31 > #define zisnorm         ((!usematrix) | (ourview.type != VT_PER))
32  
33   #define MAXWT           1000.           /* maximum pixel weight (averaging) */
34  
# Line 70 | Line 68 | char   *progname;
68  
69   int     fillo = F_FORE|F_BACK;          /* selected fill options */
70   int     fillsamp = 0;                   /* sample separation (0 == inf) */
73 extern int      backfill(), rcalfill(); /* fill functions */
74 int     (*fillfunc)() = backfill;       /* selected fill function */
71   COLR    backcolr = BLKCOLR;             /* background color */
72   COLOR   backcolor = BLKCOLOR;           /* background color (float) */
73   double  backz = 0.0;                    /* background z value */
# Line 89 | Line 85 | double theirexp;                       /* input picture exposure */
85   MAT4    theirs2ours;                    /* transformation matrix */
86   int     hasmatrix = 0;                  /* has transformation matrix */
87  
88 < int     PDesc[3] = {-1,-1,-1};          /* rtrace process descriptor */
93 < #define childpid        (PDesc[2])
88 > static SUBPROC PDesc = SP_INACTIVE; /* rtrace process descriptor */
89   unsigned short  queue[PACKSIZ][2];      /* pending pixels */
90   int     packsiz;                        /* actual packet size */
91   int     queuesiz = 0;                   /* number of pixels pending */
92  
93 < extern double   movepixel();
93 > typedef void fillfunc_t(int x, int y);
94  
95 + static gethfunc headline;
96 + static int nextview(FILE *fp);
97 + static void compavgview(void);
98 + static void addpicture(char *pfile, char *zspec);
99 + static int pixform(MAT4 xfmat, VIEW *vw1, VIEW *vw2);
100 + static void addscanline(struct bound *xl, int y,
101 +        COLR *pline, float *zline, struct position *lasty);
102 + static void addpixel(struct position *p0, struct position *p1,
103 +        struct position *p2, COLR pix, double w, double z);
104 + static double movepixel(FVECT pos);
105 + static int getperim(struct bound *xl, struct bound *yl, float *zline, int zfd);
106 + static void backpicture(fillfunc_t *fill, int samp);
107 + static void fillpicture(fillfunc_t *fill);
108 + static int clipaft(void);
109 + static int addblur(void);
110 + static void writepicture(void);
111 + static void writedistance(char *fname);
112 + static fillfunc_t backfill;
113 + static fillfunc_t rcalfill;
114 + static void calstart(char *prog, char *args);
115 + static void caldone(void);
116 + static void clearqueue(void);
117 + static void syserror(char *s);
118  
119 < main(argc, argv)                        /* interpolate pictures */
120 < int     argc;
121 < char    *argv[];
119 > fillfunc_t *fillfunc = backfill;        /* selected fill function */
120 >
121 > int
122 > main(                   /* interpolate pictures */
123 >        int     argc,
124 >        char    *argv[]
125 > )
126   {
127   #define  check(ol,al)           if (argv[an][ol] || \
128                                  badarg(argc-an-1,argv+an+1,al)) \
# Line 213 | Line 235 | char   *argv[];
235                          if (argv[an][2] != 'f')
236                                  goto badopt;
237                          check(3,"s");
238 <                        gotvfile = viewfile(argv[++an], &ourview, 0, 0);
238 >                        gotvfile = viewfile(argv[++an], &ourview, NULL);
239                          if (gotvfile < 0)
240                                  syserror(argv[an]);
241                          else if (gotvfile == 0) {
# Line 236 | Line 258 | char   *argv[];
258                  fillo &= ~F_BACK;
259          if (doavg < 0)
260                  doavg = (argc-an) > 2;
261 <        if (expcomp != NULL)
262 <                if (expcomp[0] == '+' | expcomp[0] == '-') {
261 >        if (expcomp != NULL) {
262 >                if ((expcomp[0] == '+') | (expcomp[0] == '-')) {
263                          expadj = atof(expcomp) + (expcomp[0]=='+' ? .5 : -.5);
264                          if (doavg | doblur)
265                                  rexpadj = pow(2.0, atof(expcomp));
# Line 251 | Line 273 | char   *argv[];
273                          if (!(doavg | doblur))
274                                  rexpadj = pow(2.0, (double)expadj);
275                  }
276 +        }
277                                                  /* set view */
278          if (nextview(doblur ? stdin : (FILE *)NULL) == EOF) {
279                  fprintf(stderr, "%s: no view on standard input!\n",
# Line 262 | Line 285 | char   *argv[];
285          if (doavg) {
286                  ourspict = (COLOR *)bmalloc(hresolu*vresolu*sizeof(COLOR));
287                  ourweigh = (float *)bmalloc(hresolu*vresolu*sizeof(float));
288 <                if (ourspict == NULL | ourweigh == NULL)
288 >                if ((ourspict == NULL) | (ourweigh == NULL))
289                          syserror(progname);
290          } else {
291                  ourpict = (COLR *)bmalloc(hresolu*vresolu*sizeof(COLR));
# Line 279 | Line 302 | char   *argv[];
302                  syserror(progname);
303                                                          /* new header */
304          newheader("RADIANCE", stdout);
305 +        fputnow(stdout);
306                                                          /* run pictures */
307          do {
308 <                bzero((char *)ourzbuf, hresolu*vresolu*sizeof(float));
308 >                memset((char *)ourzbuf, '\0', hresolu*vresolu*sizeof(float));
309                  for (i = an; i < argc; i += 2)
310                          addpicture(argv[i], argv[i+1]);
311                  if (fillo&F_BACK)                       /* fill in spaces */
# Line 301 | Line 325 | char   *argv[];
325                  fprintview(&avgview, stdout);
326                  putc('\n', stdout);
327          }
328 <        if (pixaspect < .99 | pixaspect > 1.01)
328 >        if ((pixaspect < .99) | (pixaspect > 1.01))
329                  fputaspect(pixaspect, stdout);
330          if (ourexp > 0)
331                  ourexp *= rexpadj;
332          else
333                  ourexp = rexpadj;
334 <        if (ourexp < .995 | ourexp > 1.005)
334 >        if ((ourexp < .995) | (ourexp > 1.005))
335                  fputexpos(ourexp, stdout);
336          if (strcmp(ourfmt, PICFMT))             /* print format if known */
337                  fputformat(ourfmt, stdout);
# Line 328 | Line 352 | userr:
352   }
353  
354  
355 < int
356 < headline(s)                             /* process header string */
357 < char    *s;
355 > static int
356 > headline(                               /* process header string */
357 >        char    *s,
358 >        void    *p
359 > )
360   {
361          char    fmt[32];
362  
# Line 358 | Line 384 | char   *s;
384   }
385  
386  
387 < nextview(fp)                            /* get and set next view */
388 < FILE    *fp;
387 > static int
388 > nextview(                               /* get and set next view */
389 >        FILE    *fp
390 > )
391   {
392          char    linebuf[256];
393          char    *err;
# Line 377 | Line 405 | FILE   *fp;
405                  exit(1);
406          }
407          if (!nvavg) {                   /* first view */
408 <                copystruct(&avgview, &ourview);
408 >                avgview = ourview;
409                  return(nvavg++);
410          }
411                                          /* add to average view */
# Line 396 | Line 424 | FILE   *fp;
424   }
425  
426  
427 < compavgview()                           /* compute average view */
427 > static void
428 > compavgview(void)                               /* compute average view */
429   {
430          register int    i;
431          double  f;
# Line 416 | Line 445 | compavgview()                          /* compute average view */
445          avgview.vfore *= f;
446          avgview.vaft *= f;
447          if (setview(&avgview) != NULL)          /* in case of emergency... */
448 <                copystruct(&avgview, &ourview);
448 >                avgview = ourview;
449          pixaspect = viewaspect(&avgview) * hresolu / vresolu;
450   }
451  
452  
453 < addpicture(pfile, zspec)                /* add picture to output */
454 < char    *pfile, *zspec;
453 > static void
454 > addpicture(             /* add picture to output */
455 >        char    *pfile,
456 >        char    *zspec
457 > )
458   {
459          FILE    *pfp;
460          int     zfd;
# Line 437 | Line 469 | char   *pfile, *zspec;
469                  syserror(pfile);
470                                          /* get header with exposure and view */
471          theirexp = 1.0;
472 <        copystruct(&theirview, &stdview);
472 >        theirview = stdview;
473          gotview = 0;
474          if (nvavg < 2)
475                  printf("%s:\n", pfile);
# Line 450 | Line 482 | char   *pfile, *zspec;
482                  ourexp = theirexp;
483          else if (ABS(theirexp-ourexp) > .01*ourexp)
484                  fprintf(stderr, "%s: different exposure (warning)\n", pfile);
485 <        if (err = setview(&theirview)) {
485 >        if ( (err = setview(&theirview)) ) {
486                  fprintf(stderr, "%s: %s\n", pfile, err);
487                  exit(1);
488          }
# Line 473 | Line 505 | char   *pfile, *zspec;
505          if (xlim == NULL)
506                  syserror(progname);
507          if (!getperim(xlim, &ylim, zin, zfd)) { /* overlapping area? */
508 <                free((char *)zin);
509 <                free((char *)xlim);
508 >                free((void *)zin);
509 >                free((void *)xlim);
510                  if (zfd != -1)
511                          close(zfd);
512                  fclose(pfp);
# Line 484 | Line 516 | char   *pfile, *zspec;
516          scanin = (COLR *)malloc(scanlen(&tresolu)*sizeof(COLR));
517          plast = (struct position *)calloc(scanlen(&tresolu),
518                          sizeof(struct position));
519 <        if (scanin == NULL | plast == NULL)
519 >        if ((scanin == NULL) | (plast == NULL))
520                  syserror(progname);
521                                          /* skip to starting point */
522          for (y = 0; y < ylim.min; y++)
# Line 493 | Line 525 | char   *pfile, *zspec;
525                          exit(1);
526                  }
527          if (zfd != -1 && lseek(zfd,
528 <                        (long)ylim.min*scanlen(&tresolu)*sizeof(float), 0) < 0)
528 >                        (off_t)ylim.min*scanlen(&tresolu)*sizeof(float),
529 >                        SEEK_SET) < 0)
530                  syserror(zspec);
531                                          /* load image */
532          for (y = ylim.min; y <= ylim.max; y++) {
# Line 508 | Line 541 | char   *pfile, *zspec;
541                  addscanline(xlim+y, y, scanin, zin, plast);
542          }
543                                          /* clean up */
544 <        free((char *)xlim);
545 <        free((char *)scanin);
546 <        free((char *)zin);
547 <        free((char *)plast);
544 >        free((void *)xlim);
545 >        free((void *)scanin);
546 >        free((void *)zin);
547 >        free((void *)plast);
548          fclose(pfp);
549          if (zfd != -1)
550                  close(zfd);
551   }
552  
553  
554 < pixform(xfmat, vw1, vw2)                /* compute view1 to view2 matrix */
555 < register MAT4   xfmat;
556 < register VIEW   *vw1, *vw2;
554 > static int
555 > pixform(                /* compute view1 to view2 matrix */
556 >        register MAT4   xfmat,
557 >        register VIEW   *vw1,
558 >        register VIEW   *vw2
559 > )
560   {
561          double  m4t[4][4];
562  
563 <        if (vw1->type != VT_PER & vw1->type != VT_PAR)
563 >        if ((vw1->type != VT_PER) & (vw1->type != VT_PAR))
564                  return(0);
565 <        if (vw2->type != VT_PER & vw2->type != VT_PAR)
565 >        if ((vw2->type != VT_PER) & (vw2->type != VT_PAR))
566                  return(0);
567          setident4(xfmat);
568          xfmat[0][0] = vw1->hvec[0];
# Line 559 | Line 595 | register VIEW  *vw1, *vw2;
595   }
596  
597  
598 < addscanline(xl, y, pline, zline, lasty) /* add scanline to output */
599 < struct bound    *xl;
600 < int     y;
601 < COLR    *pline;
602 < float   *zline;
603 < struct position *lasty;         /* input/output */
598 > static void
599 > addscanline(    /* add scanline to output */
600 >        struct bound    *xl,
601 >        int     y,
602 >        COLR    *pline,
603 >        float   *zline,
604 >        struct position *lasty          /* input/output */
605 > )
606   {
607          FVECT   pos;
608          struct position lastx, newpos;
# Line 591 | Line 629 | struct position        *lasty;         /* input/output */
629   }
630  
631  
632 < addpixel(p0, p1, p2, pix, w, z)         /* fill in pixel parallelogram */
633 < struct position *p0, *p1, *p2;
634 < COLR    pix;
635 < double  w;
636 < double  z;
632 > static void
633 > addpixel(               /* fill in pixel parallelogram */
634 >        struct position *p0,
635 >        struct position *p1,
636 >        struct position *p2,
637 >        COLR    pix,
638 >        double  w,
639 >        double  z
640 > )
641   {
642          double  zt = 2.*zeps*p0->z;             /* threshold */
643          COLOR   pval;                           /* converted+weighted pixel */
# Line 610 | Line 652 | double z;
652                  s1x = p1->x - p0->x;
653                  s1y = p1->y - p0->y;
654                  l1 = ABS(s1x);
655 <                if (p1isy = (ABS(s1y) > l1))
655 >                if ( (p1isy = (ABS(s1y) > l1)) )
656                          l1 = ABS(s1y);
657                  else if (l1 < 1)
658                          l1 = 1;
# Line 643 | Line 685 | double z;
685                  y1 = p0->y + c1*s1y/l1;
686                  for (c2 = l2; c2-- > 0; ) {
687                          x = x1 + c2*s2x/l2;
688 <                        if (x < 0 | x >= hresolu)
688 >                        if ((x < 0) | (x >= hresolu))
689                                  continue;
690                          y = y1 + c2*s2y/l2;
691 <                        if (y < 0 | y >= vresolu)
691 >                        if ((y < 0) | (y >= vresolu))
692                                  continue;
693                          if (averaging) {
694                                  if (zscan(y)[x] <= 0 || zscan(y)[x]-z
# Line 668 | Line 710 | double z;
710   }
711  
712  
713 < double
714 < movepixel(pos)                          /* reposition image point */
715 < register FVECT  pos;
713 > static double
714 > movepixel(                              /* reposition image point */
715 >        register FVECT  pos
716 > )
717   {
718          FVECT   pt, tdir, odir;
719          double  d;
# Line 680 | Line 723 | register FVECT pos;
723          if (usematrix) {
724                  pos[0] += theirview.hoff - .5;
725                  pos[1] += theirview.voff - .5;
726 <                if (normdist & theirview.type == VT_PER)
726 >                if (normdist & (theirview.type == VT_PER))
727                          d = sqrt(1. + pos[0]*pos[0]*theirview.hn2
728                                          + pos[1]*pos[1]*theirview.vn2);
729                  else
# Line 704 | Line 747 | register FVECT pos;
747          } else {
748                  if (viewray(pt, tdir, &theirview, pos[0], pos[1]) < -FTINY)
749                          return(0);
750 <                if (!normdist & theirview.type == VT_PER)       /* adjust */
750 >                if ((!normdist) & (theirview.type == VT_PER))   /* adjust */
751                          pos[2] *= sqrt(1. + pos[0]*pos[0]*theirview.hn2
752                                          + pos[1]*pos[1]*theirview.vn2);
753                  pt[0] += tdir[0]*pos[2];
# Line 714 | Line 757 | register FVECT pos;
757                  if (pos[2] <= 0)
758                          return(0);
759          }
760 <        if (pos[0] < 0 | pos[0] >= 1-FTINY | pos[1] < 0 | pos[1] >= 1-FTINY)
760 >        if ((pos[0] < 0) | (pos[0] >= 1-FTINY) | (pos[1] < 0) | (pos[1] >= 1-FTINY))
761                  return(0);
762          if (!averaging)
763                  return(1);
# Line 733 | Line 776 | register FVECT pos;
776   }
777  
778  
779 < getperim(xl, yl, zline, zfd)            /* compute overlapping image area */
780 < register struct bound   *xl;
781 < struct bound    *yl;
782 < float   *zline;
783 < int     zfd;
779 > static int
780 > getperim(               /* compute overlapping image area */
781 >        register struct bound   *xl,
782 >        struct bound    *yl,
783 >        float   *zline,
784 >        int     zfd
785 > )
786   {
787          int     step;
788          FVECT   pos;
# Line 760 | Line 805 | int    zfd;
805          yl->min = 32000; yl->max = 0;           /* search for points on image */
806          for (y = step - 1; y < numscans(&tresolu); y += step) {
807                  if (zfd != -1) {
808 <                        if (lseek(zfd, (long)y*scanlen(&tresolu)*sizeof(float),
809 <                                        0) < 0)
808 >                        if (lseek(zfd, (off_t)y*scanlen(&tresolu)*sizeof(float),
809 >                                        SEEK_SET) < 0)
810                                  syserror("lseek");
811                          if (read(zfd, (char *)zline,
812                                          scanlen(&tresolu)*sizeof(float))
# Line 806 | Line 851 | int    zfd;
851                                  xl[y-1].max = xl[y-step].max;
852                  }
853                  for (x = 2; x < step; x++)
854 <                        copystruct(xl+y-x, xl+y-1);
854 >                        *(xl+y-x) = *(xl+y-1);
855          }
856          if (yl->max >= numscans(&tresolu))
857                  yl->max = numscans(&tresolu) - 1;
858          y -= step;
859          for (x = numscans(&tresolu) - 1; x > y; x--)    /* fill bottom rows */
860 <                copystruct(xl+x, xl+y);
860 >                *(xl+x) = *(xl+y);
861          return(yl->max >= yl->min);
862   }
863  
864  
865 < backpicture(fill, samp)                 /* background fill algorithm */
866 < int     (*fill)();
867 < int     samp;
865 > static void
866 > backpicture(                    /* background fill algorithm */
867 >        fillfunc_t *fill,
868 >        int     samp
869 > )
870   {
871          int     *yback, xback;
872          int     y;
# Line 921 | Line 968 | int    samp;
968                                  xback = -2;
969                          }
970          }
971 <        free((char *)yback);
971 >        free((void *)yback);
972   }
973  
974  
975 < fillpicture(fill)               /* paint in empty pixels using fill */
976 < int     (*fill)();
975 > static void
976 > fillpicture(            /* paint in empty pixels using fill */
977 >        fillfunc_t *fill
978 > )
979   {
980          register int    x, y;
981  
# Line 939 | Line 988 | int    (*fill)();
988   }
989  
990  
991 < clipaft()                       /* perform aft clipping as indicated */
991 > static int
992 > clipaft(void)                   /* perform aft clipping as indicated */
993   {
994          register int    x, y;
995 <        int     adjtest = ourview.type == VT_PER & zisnorm;
995 >        int     adjtest = (ourview.type == VT_PER) & zisnorm;
996          double  tstdist;
997          double  yzn2, vx;
998  
# Line 965 | Line 1015 | clipaft()                      /* perform aft clipping as indicated */
1015                                                  continue;
1016                                  }
1017                                  if (averaging)
1018 <                                        bzero(sscan(y)[x], sizeof(COLOR));
1018 >                                        memset(sscan(y)[x], '\0', sizeof(COLOR));
1019                                  else
1020 <                                        bzero(pscan(y)[x], sizeof(COLR));
1020 >                                        memset(pscan(y)[x], '\0', sizeof(COLR));
1021                                  zscan(y)[x] = 0.0;
1022                          }
1023          }
# Line 975 | Line 1025 | clipaft()                      /* perform aft clipping as indicated */
1025   }
1026  
1027  
1028 < addblur()                               /* add to blurred picture */
1028 > static int
1029 > addblur(void)                           /* add to blurred picture */
1030   {
1031          COLOR   cval;
1032          double  d;
# Line 1015 | Line 1066 | addblur()                              /* add to blurred picture */
1066   }
1067  
1068  
1069 < writepicture()                          /* write out picture (alters buffer) */
1069 > static void
1070 > writepicture(void)                              /* write out picture (alters buffer) */
1071   {
1072          int     y;
1073          register int    x;
# Line 1046 | Line 1098 | writepicture()                         /* write out picture (alters buffer)
1098   }
1099  
1100  
1101 < writedistance(fname)                    /* write out z file (alters buffer) */
1102 < char    *fname;
1101 > static void
1102 > writedistance(                  /* write out z file (alters buffer) */
1103 >        char    *fname
1104 > )
1105   {
1106          int     donorm = normdist & !zisnorm ? 1 :
1107 <                        ourview.type == VT_PER & !normdist & zisnorm ? -1 : 0;
1107 >                        (ourview.type == VT_PER) & !normdist & zisnorm ? -1 : 0;
1108          int     fd;
1109          int     y;
1110  
# Line 1079 | Line 1133 | char   *fname;
1133   }
1134  
1135  
1136 < backfill(x, y)                          /* fill pixel with background */
1137 < int     x, y;
1136 > static void
1137 > backfill(                               /* fill pixel with background */
1138 >        int     x,
1139 >        int     y
1140 > )
1141   {
1142          if (averaging) {
1143                  copycolor(sscan(y)[x], backcolor);
# Line 1091 | Line 1148 | int    x, y;
1148   }
1149  
1150  
1151 < calstart(prog, args)                    /* start fill calculation */
1152 < char    *prog, *args;
1151 > static void
1152 > calstart(                    /* start fill calculation */
1153 >        char    *prog,
1154 >        char    *args
1155 > )
1156   {
1157          char    combuf[512];
1158          char    *argv[64];
1159          int     rval;
1160          register char   **wp, *cp;
1161  
1162 <        if (childpid != -1) {
1162 >        if (PDesc.running) {
1163                  fprintf(stderr, "%s: too many calculations\n", progname);
1164                  exit(1);
1165          }
# Line 1118 | Line 1178 | char   *prog, *args;
1178          }
1179          *wp = NULL;
1180                                                  /* start process */
1181 <        if ((rval = open_process(PDesc, argv)) < 0)
1181 >        if ((rval = open_process(&PDesc, argv)) < 0)
1182                  syserror(progname);
1183          if (rval == 0) {
1184                  fprintf(stderr, "%s: command not found\n", argv[0]);
# Line 1131 | Line 1191 | char   *prog, *args;
1191   }
1192  
1193  
1194 < caldone()                               /* done with calculation */
1194 > static void
1195 > caldone(void)                               /* done with calculation */
1196   {
1197 <        if (childpid == -1)
1197 >        if (!PDesc.running)
1198                  return;
1199          clearqueue();
1200 <        close_process(PDesc);
1140 <        childpid = -1;
1200 >        close_process(&PDesc);
1201   }
1202  
1203  
1204 < rcalfill(x, y)                          /* fill with ray-calculated pixel */
1205 < int     x, y;
1204 > static void
1205 > rcalfill(                               /* fill with ray-calculated pixel */
1206 >        int     x,
1207 >        int     y
1208 > )
1209   {
1210          if (queuesiz >= packsiz)        /* flush queue if needed */
1211                  clearqueue();
# Line 1153 | Line 1216 | int    x, y;
1216   }
1217  
1218  
1219 < clearqueue()                            /* process queue */
1219 > static void
1220 > clearqueue(void)                                /* process queue */
1221   {
1222          FVECT   orig, dir;
1223          float   fbuf[6*(PACKSIZ+1)];
# Line 1172 | Line 1236 | clearqueue()                           /* process queue */
1236                  *fbp++ = dir[0]; *fbp++ = dir[1]; *fbp++ = dir[2];
1237          }
1238                                          /* mark end and get results */
1239 <        bzero((char *)fbp, 6*sizeof(float));
1240 <        if (process(PDesc, fbuf, fbuf, 4*sizeof(float)*(queuesiz+1),
1239 >        memset((char *)fbp, '\0', 6*sizeof(float));
1240 >        if (process(&PDesc, (char *)fbuf, (char *)fbuf,
1241 >                        4*sizeof(float)*(queuesiz+1),
1242                          6*sizeof(float)*(queuesiz+1)) !=
1243                          4*sizeof(float)*(queuesiz+1)) {
1244                  fprintf(stderr, "%s: error reading from rtrace process\n",
# Line 1208 | Line 1273 | clearqueue()                           /* process queue */
1273   }
1274  
1275  
1276 < syserror(s)                     /* report error and exit */
1277 < char    *s;
1276 > static void
1277 > syserror(                       /* report error and exit */
1278 >        char    *s
1279 > )
1280   {
1281          perror(s);
1282          exit(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines