--- ray/src/util/cmatrix.h 2014/08/02 17:10:43 2.6 +++ ray/src/util/cmatrix.h 2018/10/31 22:19:57 2.8 @@ -1,4 +1,4 @@ -/* RCSid $Id: cmatrix.h,v 2.6 2014/08/02 17:10:43 greg Exp $ */ +/* RCSid $Id: cmatrix.h,v 2.8 2018/10/31 22:19:57 greg Exp $ */ /* * Color matrix routine declarations. * @@ -8,6 +8,7 @@ #ifndef _RAD_CMATRIX_H_ #define _RAD_CMATRIX_H_ +#include #include "color.h" #ifdef __cplusplus @@ -28,7 +29,7 @@ typedef struct { #define COLSPEC (sizeof(COLORV)==sizeof(float) ? "%f %f %f" : "%lf %lf %lf") -#define cm_lval(cm,r,c) ((cm)->cmem + 3*((r)*(cm)->ncols + (c))) +#define cm_lval(cm,r,c) ((cm)->cmem + 3*((size_t)(r)*(cm)->ncols + (c))) #define cv_lval(cm,i) ((cm)->cmem + 3*(i)) @@ -43,8 +44,8 @@ extern CMATRIX *cm_resize(CMATRIX *cm, int nrows); /* Load header to obtain/check data type and matrix dimensions */ extern char *cm_getheader(int *dt, int *nr, int *nc, FILE *fp); -/* Allocate and load a matrix from the given file (or stdin if NULL) */ -extern CMATRIX *cm_load(const char *fname, int nrows, int ncols, int dtype); +/* Allocate and load a matrix from the given input (or stdin if NULL) */ +extern CMATRIX *cm_load(const char *inspec, int nrows, int ncols, int dtype); /* Extract a column vector from a matrix */ extern CMATRIX *cm_column(const CMATRIX *cm, int c);