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

Comparing src/px/ra_bmp.c (file contents):
Revision 2.18 by greg, Sun Sep 14 04:39:53 2025 UTC vs.
Revision 2.19 by greg, Sun Sep 14 15:08:26 2025 UTC

# Line 31 | Line 31 | extern void info2rad(char *infs, int len, FILE *fout);
31   extern char *growInfo(int n);
32   extern gethfunc headline;
33  
34 < #define add2info(s)     strcpy(growInfo(strlen(s)), s)
34 > #define add2info(s)     {int _n=strlen(s); memcpy(growInfo(_n), s, _n+1);}
35   #define clearInfo()     growInfo(-infolen)
36  
37   RGBPRIMP        rgbinp = stdprims;      /* RGB input primitives */
# Line 289 | Line 289 | headline(char *s, void *p)
289   void
290   addBMPcspace(RGBPRIMP pp, double gamma)
291   {
292 <        char    ibuf[128];
292 >        char    ibuf[196];
293 >        char    *cp = ibuf;
294  
295 +        sprintf(cp, "GAMMA=%.2f\n", gamma);
296 +        cp += strlen(cp);
297          if (pp != NULL) {
298 <                sprintf(ibuf,
298 >                sprintf(cp,
299                          "%s %.4f %.4f %.4f %.4f %.4f %.4f %.4f %.4f\n",
300                                  PRIMARYSTR,
301                                  pp[RED][CIEX],pp[RED][CIEY],
302                                  pp[GRN][CIEX],pp[GRN][CIEY],
303                                  pp[BLU][CIEX],pp[BLU][CIEY],
304                                  pp[WHT][CIEX],pp[WHT][CIEY]);
305 <                add2info(ibuf);
305 >                /* cp += strlen(cp); */
306          }
304        sprintf(ibuf, "GAMMA=%.2f\n", gamma);
307          add2info(ibuf);
308   }
309  
# Line 319 | Line 321 | info2rad(char *infs, int len, FILE *fout)
321                                          /* check for gamma */
322          if ((cp = strstr(infs, "GAMMA=")) != NULL) {
323                                          /* copy what came before */
324 <                fwrite(infs, cp-infs, 1, fout);
324 >                fwrite(infs, 1, cp-infs, fout);
325                  cp += 6;
326                  gamcor = atof(cp);      /* record setting */
327                  while (*cp++ != '\n')

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines