--- ray/src/util/radcompare.c 2018/10/19 23:56:15 2.14 +++ ray/src/util/radcompare.c 2018/10/26 23:45:56 2.16 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: radcompare.c,v 2.14 2018/10/19 23:56:15 greg Exp $"; +static const char RCSid[] = "$Id: radcompare.c,v 2.16 2018/10/26 23:45:56 greg Exp $"; #endif /* * Compare Radiance files for significant differences @@ -109,6 +109,8 @@ usage() static int read_line(LINEBUF *bp, FILE *fp) { + static int doneWarn = 0; + bp->len = 0; if (!bp->str) { bp->str = (char *)malloc(bp->siz = 512); @@ -121,8 +123,15 @@ read_line(LINEBUF *bp, FILE *fp) break; /* found EOL */ if (bp->len < bp->siz - 4) continue; /* at EOF? */ - if (bp->siz >= MAXBUF) - break; /* don't go to extremes */ + if (bp->siz >= MAXBUF) { + if ((report >= REP_WARN) & !doneWarn) { + fprintf(stderr, + "%s: warning - input line(s) past %ld MByte limit\n", + progname, MAXBUF>>20); + doneWarn++; + } + break; /* return MAXBUF partial line */ + } if ((bp->siz += bp->siz/2) > MAXBUF) bp->siz = MAXBUF; bp->str = (char *)realloc(bp->str, bp->siz); @@ -768,13 +777,13 @@ main(int argc, char *argv[]) ign_header |= !has_header(typ1); /* check headers if indicated */ if (!ign_header && !headers_match()) return(1); - lu_done(&hdr1); lu_done(&hdr2); + lu_done(&hdr1); lu_done(&hdr2); /* done with header info. */ if (!ign_header & (report >= REP_WARN)) { - if (typ1 == TYP_UNKNOWN) - printf("%s: warning - unrecognized format, comparing as binary\n", - progname); if (lin1cnt != lin2cnt) printf("%s: warning - headers are different lengths\n", + progname); + if (typ1 == TYP_UNKNOWN) + printf("%s: warning - unrecognized format\n", progname); } if (report >= REP_VERBOSE)