summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2006-05-10 22:29:25 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2006-05-10 22:29:25 (GMT)
commitb415a49c9e0978f75abbe6e8916dbaa376d2f6c5 (patch)
tree2bc703210e014be804be0a9f19d07c49f50a69b7 /src
parent40054ee38738b26dad65a961e4f7980582222b2c (diff)
downloadhdf5-b415a49c9e0978f75abbe6e8916dbaa376d2f6c5.zip
hdf5-b415a49c9e0978f75abbe6e8916dbaa376d2f6c5.tar.gz
hdf5-b415a49c9e0978f75abbe6e8916dbaa376d2f6c5.tar.bz2
[svn-r12342] Purpose:
bug fix. Description: Previous H5private.h would attempt to use the off64_t/stat64/etc by checking just sizeof __INT64 being 8. This caused errors in some machines like alpha cluster which is a 64bit machine. Its compiler supports the type __int64 but it does not support off64_t since its off_t is already 64bits big. The above code casued the compiler to complain about the unknown off64_t and such. Solution: H5private.h: Changed the code to use the pseudo standard of off64_t/stat64/etc only if sizeof(off_t) is not 64 bits AND sizeof(off64_t) exists and is 64 bits. This assumes if off64_t is defined, all those stat64, fstat64, etc are supported too. configure.in: configure: Added the testing of sizeof(off64_t) to support the above solution. Platforms tested: h5committested. Also tested at LANL QSC.
Diffstat (limited to 'src')
-rw-r--r--src/H5config.h.in3
-rw-r--r--src/H5private.h58
2 files changed, 32 insertions, 29 deletions
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 0f8d607..062ab9a 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -476,6 +476,9 @@
/* The size of a `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
+/* The size of a `off64_t', as computed by sizeof. */
+#undef SIZEOF_OFF64_T
+
/* The size of a `off_t', as computed by sizeof. */
#undef SIZEOF_OFF_T
diff --git a/src/H5private.h b/src/H5private.h
index df96165..f400f88 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -656,27 +656,29 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
/* fscanf() variable arguments */
#define HDfseek(F,O,W) fseek(F,O,W)
#define HDfsetpos(F,P) fsetpos(F,P)
-/* definitions related to the file stat utilities */
+/* definitions related to the file stat utilities.
+ * Windows have its own function names.
+ * For Unix, if off_t is not 64bit big, try use the pseudo-standard
+ * xxx64 versions if available.
+ */
#ifdef WIN32
- #ifdef __MWERKS__
- #define HDfstat(F,B) fstat(F,B)
- typedef struct stat h5_stat_t;
- typedef off_t h5_stat_size_t;
- #else /*MSVC*/
- #define HDfstat(F,B) _fstati64(F,B)
- typedef struct _stati64 h5_stat_t;
- typedef __int64 h5_stat_size_t;
- #endif
+ #ifdef __MWERKS__
+ #define HDfstat(F,B) fstat(F,B)
+ typedef struct stat h5_stat_t;
+ typedef off_t h5_stat_size_t;
+ #else /*MSVC*/
+ #define HDfstat(F,B) _fstati64(F,B)
+ typedef struct _stati64 h5_stat_t;
+ typedef __int64 h5_stat_size_t;
+ #endif
+#elif H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8
+ #define HDfstat(F,B) fstat64(F,B)
+ typedef struct stat64 h5_stat_t;
+ typedef off64_t h5_stat_size_t;
#else
- #if H5_SIZEOF___INT64==8
- #define HDfstat(F,B) fstat64(F,B)
- typedef struct stat64 h5_stat_t;
- typedef off64_t h5_stat_size_t;
- #else
- #define HDfstat(F,B) fstat(F,B)
- typedef struct stat h5_stat_t;
- typedef off_t h5_stat_size_t;
- #endif
+ #define HDfstat(F,B) fstat(F,B)
+ typedef struct stat h5_stat_t;
+ typedef off_t h5_stat_size_t;
#endif
#define HDftell(F) ftell(F)
@@ -850,17 +852,15 @@ H5_DLL void HDsrand(unsigned int seed);
/* sscanf() variable arguments */
#ifdef WIN32
- #ifdef __MWERKS__
- #define HDstat(S,B) stat(S,B)
- #else /*MSVC*/
- #define HDstat(S,B) _stati64(S,B)
- #endif
+ #ifdef __MWERKS__
+ #define HDstat(S,B) stat(S,B)
+ #else /*MSVC*/
+ #define HDstat(S,B) _stati64(S,B)
+ #endif
+#elif H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8
+ #define HDstat(S,B) stat64(S,B)
#else
- #if H5_SIZEOF___INT64==8
- #define HDstat(S,B) stat64(S,B)
- #else
-#define HDstat(S,B) stat(S,B)
-#endif
+ #define HDstat(S,B) stat(S,B)
#endif
#define HDstrcat(X,Y) strcat(X,Y)