summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMuQun Yang <ymuqun@hdfgroup.org>2002-03-27 20:47:24 (GMT)
committerMuQun Yang <ymuqun@hdfgroup.org>2002-03-27 20:47:24 (GMT)
commit631b344df28c16bff9ee04fbc047c29818feddc9 (patch)
tree7cd3d97890a6a0cb0e85f9e9a1aec72904a2c3b4 /src
parentcdb3596858342529bd5138a951e24390e0b500a2 (diff)
downloadhdf5-631b344df28c16bff9ee04fbc047c29818feddc9.zip
hdf5-631b344df28c16bff9ee04fbc047c29818feddc9.tar.gz
hdf5-631b344df28c16bff9ee04fbc047c29818feddc9.tar.bz2
[svn-r5101]
Purpose: fix a windows bug Description: 1. To create a >4GB file, fstati64 has to be used instead of fstat. change fstat to fstati64 for WIN32 macroes. Some discussions are going on the general issue on how to better handle with WIN32 or other similar platform. This check-in is just a reminder not to forget the windows bug. 2. erase a WIN32 macro(include winsock2.h) at h5detect.c. It is not a problem now. Solution: use fstati64 instead of fstat for win32. Platforms tested: windows2000(confirmed at linux machine eirene)
Diffstat (limited to 'src')
-rw-r--r--src/H5FDgass.c8
-rw-r--r--src/H5FDlog.c4
-rw-r--r--src/H5FDsec2.c6
-rw-r--r--src/H5detect.c3
-rw-r--r--src/H5private.h6
5 files changed, 18 insertions, 9 deletions
diff --git a/src/H5FDgass.c b/src/H5FDgass.c
index 12040cd..5ef425a 100644
--- a/src/H5FDgass.c
+++ b/src/H5FDgass.c
@@ -327,12 +327,16 @@ H5FD_gass_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr)
{
int fd;
- struct stat sb;
H5FD_gass_t *file=NULL;
const H5FD_gass_fapl_t *fa=NULL;
H5FD_gass_fapl_t _fa;
char *filename = (char *) H5MM_malloc(80 * sizeof(char));
H5P_genplist_t *plist; /* Property list pointer */
+#ifdef WIN32
+ struct _stati64 sb;
+#else
+ struct stat sb;
+#endif
FUNC_ENTER(H5FD_gass_open, NULL);
@@ -408,7 +412,7 @@ H5FD_gass_open(const char *name, unsigned flags, hid_t fapl_id,
}
- if (fstat(fd, &sb)<0) {
+ if (HDfstat(fd, &sb)<0) {
close(fd);
HRETURN_ERROR(H5E_IO, H5E_BADFILE, NULL, "fstat failed");
}
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index b1a9848..ee5dc14 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -469,13 +469,15 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id,
{
int o_flags;
int fd;
- struct stat sb;
H5FD_log_t *file=NULL;
H5FD_log_fapl_t *fa; /* File access property list information */
#ifdef WIN32
HFILE filehandle;
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
int results;
+ struct _stati64 sb;
+#else
+ struct stat sb;
#endif
H5P_genplist_t *plist; /* Property list */
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index df150a7..8841b2b 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -271,12 +271,14 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
{
int o_flags;
int fd;
- struct stat sb;
H5FD_sec2_t *file=NULL;
#ifdef WIN32
HFILE filehandle;
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
int results;
+ struct _stati64 sb;
+#else
+ struct stat sb;
#endif
FUNC_ENTER(H5FD_sec2_open, NULL);
@@ -298,7 +300,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
/* Open the file */
if ((fd=HDopen(name, o_flags, 0666))<0)
HRETURN_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file");
- if (fstat(fd, &sb)<0) {
+ if (HDfstat(fd, &sb)<0) {
close(fd);
HRETURN_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file");
}
diff --git a/src/H5detect.c b/src/H5detect.c
index 5955f23..39aeafa 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -30,9 +30,6 @@ static const char *FileHeader = "\n\
*-------------------------------------------------------------------------
*/
#undef NDEBUG
-#ifdef WIN32
-#include "winsock2.h"
-#endif /*kent yang 6/21/2001, make sure to put this before H5private.h*/
#include "H5private.h"
#define MAXDETECT 64
diff --git a/src/H5private.h b/src/H5private.h
index 9888bd9..e8c5056 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -562,7 +562,11 @@ __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)
-#define HDfstat(F,B) fstat(F,B)
+#ifdef WIN32
+#define HDfstat(F,B) _fstati64(F,B)
+#else
+#define HDfstat(F,B) fstat(F,B)
+#endif
#define HDftell(F) ftell(F)
#define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F)
#define HDgetc(F) getc(F)