--- ray/src/util/rmatrix.c 2023/12/12 18:45:53 2.76 +++ ray/src/util/rmatrix.c 2024/02/29 03:11:13 2.78 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rmatrix.c,v 2.76 2023/12/12 18:45:53 greg Exp $"; +static const char RCSid[] = "$Id: rmatrix.c,v 2.78 2024/02/29 03:11:13 greg Exp $"; #endif /* * General matrix operations. @@ -393,8 +393,10 @@ rmx_load(const char *inspec, RMPref rmp) } /* else open it ourselves */ fp = fopen(inspec, "r"); } - if (!fp) + if (!fp) { + fprintf(stderr, "Cannot open for reading: %s\n", inspec); return(NULL); + } #ifdef getc_unlocked flockfile(fp); #endif @@ -499,7 +501,7 @@ rmx_write_spec(const double *dp, int nc, int len, FILE if (nc < 3) return(0); scan = (uby8 *)tempbuffer((nc+1)*len); if (!scan) return(0); - for (j = len; j--; dp += nc) { + for (j = 0; j < len; j++, dp += nc) { for (k = nc; k--; ) scol[k] = dp[k]; scolor2scolr(scan+j*(nc+1), scol, nc);