--- ray/src/util/radcompare.c 2019/08/24 02:22:02 2.22 +++ ray/src/util/radcompare.c 2020/07/09 17:29:04 2.25 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: radcompare.c,v 2.22 2019/08/24 02:22:02 greg Exp $"; +static const char RCSid[] = "$Id: radcompare.c,v 2.25 2020/07/09 17:29:04 greg Exp $"; #endif /* * Compare Radiance files for significant differences @@ -317,6 +317,7 @@ equiv_string(char *s1, char *s2) static int setheadvar(char *val, void *p) { + char newval[128]; LUTAB *htp = (LUTAB *)p; LUENT *tep; char *key; @@ -359,8 +360,13 @@ setheadvar(char *val, void *p) return(-1); /* memory allocation error */ if (!tep->key) tep->key = strcpy(malloc(kln+1), key); - if (tep->data) + if (tep->data) { /* check for special cases */ + if (!strcmp(key, "EXPOSURE")) { + sprintf(newval, "%f", atof(tep->data)*atof(val)); + vln = strlen(val = newval); + } free(tep->data); + } tep->data = strcpy(malloc(vln+1), val); return(1); } @@ -469,7 +475,6 @@ identify_type(const char *name, FILE *fin, LUTAB *htp) } if (c) return(TYP_BINARY); - SET_FILE_TEXT(fin); /* originally set to binary */ return(TYP_TEXT); badeof: if (report != REP_QUIET) { @@ -554,6 +559,8 @@ compare_text() fputs(progname, stdout); fputs(": comparing inputs as ASCII text\n", stdout); } + SET_FILE_TEXT(f1in); /* originally set to binary */ + SET_FILE_TEXT(f2in); init_line(&l1buf); init_line(&l2buf); /* compare a line at a time */ while (read_line(&l1buf, f1in)) { lin1cnt++; @@ -696,7 +703,7 @@ set_refdepth(DEPTHCODEC *dcp, LUTAB *htp) static char depthvar[] = DEPTHSTR; const char *drval; - depthvar[LDEPTHSTR] = '\0'; + depthvar[LDEPTHSTR-1] = '\0'; drval = (const char *)lu_find(htp, depthvar)->data; if (!drval) return(0);