# HG changeset patch # User jwe # Date 1051209662 0 # Node ID 112a509bd2e64fa14ce507059c9934d50136c9ec # Parent de8c1d2ee7288a4badf148c7ed2d97d8bd6dd2af [project @ 2003-04-24 18:41:02 by jwe] diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +2003-04-24 John W. Eaton + + * kpse.cc (xclosedir): Don't define or declare for Windows. + (READABLE): Now a static function to avoid warnings from MinGW + compiler. + 2003-04-23 John W. Eaton * kpse.cc: Move most functions from kpse-xfns.c here and make diff --git a/liboctave/kpse.cc b/liboctave/kpse.cc --- a/liboctave/kpse.cc +++ b/liboctave/kpse.cc @@ -339,7 +339,9 @@ unsigned long xftell (FILE *f, char *filename); +#ifndef WIN32 static void xclosedir (DIR *d); +#endif static void *xmalloc (unsigned size); @@ -2800,6 +2802,7 @@ return where; } +#ifndef WIN32 void xclosedir (DIR *d) { @@ -2812,6 +2815,7 @@ FATAL ("closedir failed"); #endif } +#endif /* xmalloc.c: malloc with error checking. */ @@ -2881,7 +2885,7 @@ dir_p (const char *fn) { #ifdef WIN32 - int fa = GetFileAttributes(fn); + unsigned int fa = GetFileAttributes(fn); return (fa != 0xFFFFFFFF && (fa & FILE_ATTRIBUTE_DIRECTORY)); #else struct stat stats; @@ -3282,12 +3286,20 @@ kinds of devices. */ #ifdef WIN32 -#define READABLE(fn, st) \ - (GetFileAttributes(fn) != 0xFFFFFFFF && \ - !(GetFileAttributes(fn) & FILE_ATTRIBUTE_DIRECTORY)) +static inline bool +READABLE (const char *fn, struct stat&) +{ + return (GetFileAttributes(fn) != 0xFFFFFFFF + && !(GetFileAttributes(fn) & FILE_ATTRIBUTE_DIRECTORY)); +} #else -#define READABLE(fn, st) \ - (access (fn, R_OK) == 0 && stat (fn, &(st)) == 0 && !S_ISDIR (st.st_mode)) +static inline bool +READABLE (const char *fn, struct stat& st) +{ + return (access (fn, R_OK) == 0 + && stat (fn, &(st)) == 0 + && !S_ISDIR (st.st_mode)); +} #endif /* POSIX invented the brain-damage of not necessarily truncating