--- ray/src/common/rtio.h 2021/02/19 16:15:23 3.25 +++ ray/src/common/rtio.h 2024/10/29 00:35:06 3.31 @@ -1,4 +1,4 @@ -/* RCSid $Id: rtio.h,v 3.25 2021/02/19 16:15:23 greg Exp $ */ +/* RCSid $Id: rtio.h,v 3.31 2024/10/29 00:35:06 greg Exp $ */ /* * Radiance i/o and string routines */ @@ -17,13 +17,13 @@ #undef getchar #undef putc #undef putchar -#undef feof -#undef ferror #define getc getc_unlocked #define getchar getchar_unlocked #define putc putc_unlocked #define putchar putchar_unlocked #ifndef __cplusplus +#undef feof +#undef ferror #define feof feof_unlocked #define ferror ferror_unlocked #endif @@ -41,9 +41,9 @@ extern "C" { #define LATLONSTR "LATLONG=" #define LLATLONSTR 8 -#define islatlon(hl) (!strncmp(hl,LATLONSTR,LLATLONSTR)) -#define latlonval(ll,hl) sscanf((hl)+LLATLONSTR, "%f %f", \ - &(ll)[0],&(ll)[1]) +#define islatlon(hl) !strncmp(hl,LATLONSTR,LLATLONSTR) +#define latlonval(ll,hl) (sscanf((hl)+LLATLONSTR, "%f %f", \ + &(ll)[0],&(ll)[1]) == 2) #define fputlatlon(lat,lon,fp) fprintf(fp,"%s %.6f %.6f\n",LATLONSTR,lat,lon) /* defined in header.c */ extern void newheader(const char *t, FILE *fp); @@ -65,13 +65,14 @@ extern int checkheader(FILE *fin, char fmt[MAXFMTLEN], /* defined in fltdepth.c */ extern int open_float_depth(const char *fname, long expected_length); /* defined in badarg.c */ -extern int badarg(int ac, char **av, char *fl); +extern int badarg(int ac, char **av, const char *fl); /* defined in expandarg.c */ extern int envexpchr, filexpchr; extern int expandarg(int *acp, char ***avp, int n); /* defined in fdate.c */ -extern time_t fdate(char *fname); -extern int setfdate(char *fname, long ftim); +extern time_t fdate(const char *fname); +extern time_t fddate(int fd); +extern int setfdate(const char *fname, long ftim); /* defined in fgetline.c */ extern char *fgetline(char *s, int n, FILE *fp); /* defined in fgetval.c */ @@ -107,11 +108,11 @@ extern char *expsave(void); extern void expset(char *ep); extern char *eindex(char *sp); /* defined in savestr.c */ -extern char *savestr(char *str); +extern char *savestr(const char *str); extern void freestr(char *s); -extern int shash(char *s); +extern int shash(const char *s); /* defined in savqstr.c */ -extern char *savqstr(char *s); +extern char *savqstr(const char *s); extern void freeqstr(char *s); /* defined in wordfile.c */ extern int wordfile(char **words, int nargs, char *fname);