diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2001-06-29 19:49:53 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2001-06-29 19:49:53 (GMT) |
commit | 8c2c4cd51cb8dd1393acad65e3f015d76bfd9563 (patch) | |
tree | a663d3ab5cc66e53485a66d973b55dbb571640be /src | |
parent | 098ed81ec88483581d08974f27a62bf42a836fc3 (diff) | |
download | hdf5-8c2c4cd51cb8dd1393acad65e3f015d76bfd9563.zip hdf5-8c2c4cd51cb8dd1393acad65e3f015d76bfd9563.tar.gz hdf5-8c2c4cd51cb8dd1393acad65e3f015d76bfd9563.tar.bz2 |
[svn-r4088] Purpose:
Code cleanup
Description:
Recent CodeWarrior patches have broken the Unix builds and moved code
around in non-portable ways.
Solution:
Patched things back up to try to accomodate CodeWarrior and still let the
Unix builds work correctly.
Platforms tested:
FreeBSD 4.3 (hawkwind)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDlog.c | 31 | ||||
-rw-r--r-- | src/H5FDsec2.c | 31 | ||||
-rw-r--r-- | src/H5FDstdio.c | 7 | ||||
-rw-r--r-- | src/H5FDstream.c | 11 | ||||
-rw-r--r-- | src/H5Oefl.c | 2 | ||||
-rw-r--r-- | src/H5Ppublic.h | 2 | ||||
-rw-r--r-- | src/H5private.h | 48 |
7 files changed, 81 insertions, 51 deletions
diff --git a/src/H5FDlog.c b/src/H5FDlog.c index a9ba785..4c37651 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -105,6 +105,35 @@ typedef struct H5FD_log_t { } H5FD_log_t; +/* + * This driver supports systems that have the lseek64() function by defining + * some macros here so we don't have to have conditional compilations later + * throughout the code. + * + * file_offset_t: The datatype for file offsets, the second argument of + * the lseek() or lseek64() call. + * + * file_seek: The function which adjusts the current file position, + * either lseek() or lseek64(). + */ +/* adding for windows NT file system support. */ +/* pvn: added __MWERKS__ support. */ + +#ifdef H5_HAVE_LSEEK64 +# define file_offset_t off64_t +# define file_seek lseek64 +#elif defined (WIN32) +# ifdef __MWERKS__ +# define file_offset_t off_t +# define file_seek lseek +# else /*MSVC*/ +# define file_offset_t __int64 +# define file_seek _lseeki64 +# endif +#else +# define file_offset_t off_t +# define file_seek lseek +#endif /* @@ -957,7 +986,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd while (size>0) { do { assert(size==(hsize_t)((size_t)size)); /*check for overflow*/ - nbytes = HDwrite(file->fd, (void*)buf, (size_t)size); + nbytes = HDwrite(file->fd, buf, (size_t)size); } while (-1==nbytes && EINTR==errno); if (-1==nbytes) { /* error */ diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 6e77bf5..14481f3 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -76,6 +76,35 @@ typedef struct H5FD_sec2_t { } H5FD_sec2_t; +/* + * This driver supports systems that have the lseek64() function by defining + * some macros here so we don't have to have conditional compilations later + * throughout the code. + * + * file_offset_t: The datatype for file offsets, the second argument of + * the lseek() or lseek64() call. + * + * file_seek: The function which adjusts the current file position, + * either lseek() or lseek64(). + */ +/* adding for windows NT file system support. */ +/* pvn: added __MWERKS__ support. */ + +#ifdef H5_HAVE_LSEEK64 +# define file_offset_t off64_t +# define file_seek lseek64 +#elif defined (WIN32) +# ifdef __MWERKS__ +# define file_offset_t off_t +# define file_seek lseek +# else /*MSVC*/ +# define file_offset_t __int64 +# define file_seek _lseeki64 +# endif +#else +# define file_offset_t off_t +# define file_seek lseek +#endif /* * These macros check for overflow of various quantities. These macros @@ -636,7 +665,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had while (size>0) { do { assert(size==(hsize_t)((size_t)size)); /*check for overflow*/ - nbytes = HDwrite(file->fd, (void*)buf, (size_t)size); + nbytes = HDwrite(file->fd, buf, (size_t)size); } while (-1==nbytes && EINTR==errno); if (-1==nbytes) { /* error */ diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index eccba8f..c852208 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -20,7 +20,12 @@ #include <unistd.h> #endif - +#ifdef WIN32 +#include <windows.h> +#include <io.h> +#endif /*kent yang 6/21/2001, must be added for defination of open,write.... + also the defination of longlong is valid, will investigate this to + make sure int64 can replace longlong. Otherwise, keep windows.h*/ #ifdef MAX #undef MAX diff --git a/src/H5FDstream.c b/src/H5FDstream.c index 9db2b18..924ab9e 100644 --- a/src/H5FDstream.c +++ b/src/H5FDstream.c @@ -26,8 +26,6 @@ /* Only build this driver if it was configured with --with-Stream-VFD */ #ifdef H5_HAVE_STREAM -#include "H5private.h" - #include "H5Eprivate.h" /* error handling */ #include "H5FDpublic.h" /* VFD structures */ #include "H5MMprivate.h" /* memory allocation */ @@ -134,10 +132,11 @@ static const H5FD_stream_fapl_t default_fapl = * REGION_OVERFLOW: Checks whether an address and size pair describe data * which can be addressed entirely in memory. */ - - - - +#ifdef H5_HAVE_LSEEK64 +# define file_offset_t off64_t +#else +# define file_offset_t off_t +#endif #define MAXADDR (((haddr_t)1<<(8*sizeof(file_offset_t)-1))-1) #define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \ ((A) & ~(haddr_t)MAXADDR)) diff --git a/src/H5Oefl.c b/src/H5Oefl.c index de6595b..c5ac308 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -537,7 +537,7 @@ H5O_efl_write (H5F_t UNUSED *f, const H5O_efl_t *efl, haddr_t addr, "unable to seek in external raw data file"); } to_write = MIN(efl->slot[i].size-skip, size); - if ((size_t)HDwrite (fd, (void*)buf, to_write)!=to_write) { + if ((size_t)HDwrite (fd, buf, to_write)!=to_write) { HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file"); } diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 1fa1bf1..74efab1 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -20,7 +20,6 @@ /* Default Template for creation, access, etc. templates */ #define H5P_DEFAULT 0 -#include <H5private.h> /* Public headers needed by this file */ #include "H5public.h" #include "H5Ipublic.h" @@ -29,7 +28,6 @@ #include "H5MMpublic.h" #include "H5Zpublic.h" - /* Property list classes */ typedef enum H5P_class_t { H5P_NO_CLASS = -1, /*error return value */ diff --git a/src/H5private.h b/src/H5private.h index 02c5bbf..b001d86 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -173,41 +173,9 @@ MS doesn't recognize it yet (as of April 2001) typedef long off_t; /* Metroworks does not define EINTR in <errno.h> */ # define EINTR 4 -#endif -/*__MWERKS__*/ +#endif /*__MWERKS__*/ -#endif -/*WIN32*/ - -/* - * This driver supports systems that have the lseek64() function by defining - * some macros here so we don't have to have conditional compilations later - * throughout the code. - * - * file_offset_t: The datatype for file offsets, the second argument of - * the lseek() or lseek64() call. - * - * file_seek: The function which adjusts the current file position, - * either lseek() or lseek64(). - * - * adding for windows NT file system support. - */ - -#ifdef H5_HAVE_LSEEK64 -# define file_offset_t off64_t -# define file_seek lseek64 -#elif defined (WIN32) -# ifdef __MWERKS__ -# define file_offset_t off_t -# define file_seek lseek -# else /*MSVC*/ -# define file_offset_t __int64 -# define file_seek _lseeki64 -# endif -#else -# define file_offset_t off_t -# define file_seek lseek -#endif +#endif /*WIN32*/ #ifndef F_OK # define F_OK 00 @@ -215,9 +183,6 @@ typedef long off_t; # define R_OK 04 #endif - - - /* * Pablo support files. */ @@ -572,7 +537,12 @@ __DLL__ void H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds); #define HDexecve(S,AV,E) execve(S,AV,E) #define HDexecvp(S,AV) execvp(S,AV) #define HDexit(N) exit(N) +#if defined __MWERKS__ +#include <abort_exit.h> +#define HD_exit(N) __exit(N) +#else /* __MWERKS __ */ #define HD_exit(N) _exit(N) +#endif /* __MWERKS __ */ #define HDexp(X) exp(X) #define HDfabs(X) fabs(X) #define HDfclose(F) fclose(F) @@ -796,9 +766,9 @@ __DLL__ int64_t HDstrtoll (const char *s, const char **rest, int base); * And now for a couple non-Posix functions... Watch out for systems that * define these in terms of macros. */ -#if defined (__MWERKS__) +#ifdef WIN32 #define HDstrdup(S) _strdup(S) -#else +#else /* WIN32 */ #if !defined strdup && !defined H5_HAVE_STRDUP extern char *strdup(const char *s); |