diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2011-09-06 16:50:32 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2011-09-06 16:50:32 (GMT) |
commit | 2457d8ecaf8a2195a2966ad6e0f649473bdb7177 (patch) | |
tree | a2de17f6db50218ffbde5ea230a6c65f62ba7cf8 /src | |
parent | 85726e28fc864da521234244802a39d5a1ac23c2 (diff) | |
download | hdf5-2457d8ecaf8a2195a2966ad6e0f649473bdb7177.zip hdf5-2457d8ecaf8a2195a2966ad6e0f649473bdb7177.tar.gz hdf5-2457d8ecaf8a2195a2966ad6e0f649473bdb7177.tar.bz2 |
[svn-r21366] JIRA HDFFV-2748 replace use of _WIN32 in source. Created new defines H5_HAVE_WIN32_API and H5_HAVE_VISUAL_STUDIO defines to use. These can be properly set during configurration.
Tested: windows and local linux - reviewed internally
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDcore.c | 16 | ||||
-rw-r--r-- | src/H5FDdirect.c | 778 | ||||
-rw-r--r-- | src/H5FDlog.c | 20 | ||||
-rw-r--r-- | src/H5FDmpiposix.c | 604 | ||||
-rw-r--r-- | src/H5FDsec2.c | 20 | ||||
-rw-r--r-- | src/H5FDstdio.c | 427 | ||||
-rw-r--r-- | src/H5FDwindows.c | 2 | ||||
-rw-r--r-- | src/H5TS.c | 38 | ||||
-rw-r--r-- | src/H5api_adpt.h | 22 | ||||
-rw-r--r-- | src/H5private.h | 1170 | ||||
-rw-r--r-- | src/H5system.c | 2 | ||||
-rw-r--r-- | src/H5win32defs.h | 55 |
12 files changed, 1574 insertions, 1580 deletions
diff --git a/src/H5FDcore.c b/src/H5FDcore.c index a978555..b9a7eee 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -53,7 +53,7 @@ typedef struct H5FD_core_t { hbool_t backing_store; /*write to file name on flush */ int fd; /*backing store file descriptor */ /* Information for determining uniqueness of a file with a backing store */ -#ifndef _WIN32 +#ifndef H5_HAVE_WIN32_API /* * On most systems the combination of device and i-node number uniquely * identify a file. @@ -66,7 +66,7 @@ typedef struct H5FD_core_t { #endif /*H5_VMS*/ #else /* - * On _WIN32 the low-order word of a unique identifier associated with the + * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the * file and the volume serial number uniquely identify a file. This number * (which, both? -rpm) may change when the system is restarted or when the * file is opened. After a process opens a file, the identifier is @@ -416,7 +416,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, H5FD_core_t *file=NULL; H5FD_core_fapl_t *fa=NULL; H5P_genplist_t *plist; /* Property list pointer */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif @@ -473,12 +473,12 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, if(fd >= 0) { /* Retrieve information for determining uniqueness of file */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API filehandle = _get_osfhandle(fd); (void)GetFileInformationByHandle((HANDLE)filehandle, &fileinfo); file->fileindexhi = fileinfo.nFileIndexHigh; file->fileindexlo = fileinfo.nFileIndexLow; -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ file->device = sb.st_dev; #ifdef H5_VMS file->inode[0] = sb.st_ino[0]; @@ -488,7 +488,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, file->inode = sb.st_ino; #endif /* H5_VMS */ -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ } /* end if */ /* If an existing file is opened, load the whole file into memory. */ @@ -598,7 +598,7 @@ H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2) if(f1->fd >= 0 && f2->fd >= 0) { /* Compare low level file information for backing store */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) @@ -626,7 +626,7 @@ H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2) if(HDmemcmp(&(f1->inode),&(f2->inode),3*sizeof(ino_t))>0) HGOTO_DONE(1) #endif /* H5_VMS */ -#endif /*_WIN32*/ +#endif /*H5_HAVE_WIN32_API*/ } /* end if */ else { if (NULL==f1->name && NULL==f2->name) { diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 469fe9d..3cd40be 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -17,27 +17,27 @@ * Programmer: Raymond Lu <slu@hdfgroup.uiuc.edu> * Wednesday, 20 September 2006 * - * Purpose: The Direct I/O file driver forces the data to be written to - * the file directly without being copied into system kernel - * buffer. The main system support this feature is Linux. + * Purpose: The Direct I/O file driver forces the data to be written to + * the file directly without being copied into system kernel + * buffer. The main system support this feature is Linux. */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_direct_init_interface +#define H5_INTERFACE_INIT_FUNC H5FD_direct_init_interface /* For system function posix_memalign - Commented it out because copper isn't able to compile * this file. */ /* #define _XOPEN_SOURCE 600 */ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDdirect.h" /* Direct file driver */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDdirect.h" /* Direct file driver */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Pprivate.h" /* Property lists */ #ifdef H5_HAVE_DIRECT @@ -45,15 +45,15 @@ static hid_t H5FD_DIRECT_g = 0; /* File operations */ -#define OP_UNKNOWN 0 -#define OP_READ 1 -#define OP_WRITE 2 +#define OP_UNKNOWN 0 +#define OP_READ 1 +#define OP_WRITE 2 /* Driver-specific file access properties */ typedef struct H5FD_direct_fapl_t { - size_t mboundary; /* Memory boundary for alignment */ - size_t fbsize; /* File system block size */ - size_t cbsize; /* Maximal buffer size for copying user data */ + size_t mboundary; /* Memory boundary for alignment */ + size_t fbsize; /* File system block size */ + size_t cbsize; /* Maximal buffer size for copying user data */ hbool_t must_align; /* Decides if data alignment is required */ } H5FD_direct_fapl_t; @@ -70,27 +70,27 @@ typedef struct H5FD_direct_fapl_t { * occurs), and `op' will be set to H5F_OP_UNKNOWN. */ typedef struct H5FD_direct_t { - H5FD_t pub; /*public stuff, must be first */ - int fd; /*the unix file */ - haddr_t eoa; /*end of allocated region */ - haddr_t eof; /*end of file; current file size*/ - haddr_t pos; /*current file I/O position */ - int op; /*last operation */ - H5FD_direct_fapl_t fa; /*file access properties */ -#ifndef _WIN32 + H5FD_t pub; /*public stuff, must be first */ + int fd; /*the unix file */ + haddr_t eoa; /*end of allocated region */ + haddr_t eof; /*end of file; current file size*/ + haddr_t pos; /*current file I/O position */ + int op; /*last operation */ + H5FD_direct_fapl_t fa; /*file access properties */ +#ifndef H5_HAVE_WIN32_API /* * On most systems the combination of device and i-node number uniquely * identify a file. */ - dev_t device; /*file device number */ + dev_t device; /*file device number */ #ifdef H5_VMS - ino_t inode[3]; /*file i-node number */ + ino_t inode[3]; /*file i-node number */ #else - ino_t inode; /*file i-node number */ + ino_t inode; /*file i-node number */ #endif /*H5_VMS*/ #else /* - * On _WIN32 the low-order word of a unique identifier associated with the + * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the * file and the volume serial number uniquely identify a file. This number * (which, both? -rpm) may change when the system is restarted or when the * file is opened. After a process opens a file, the identifier is @@ -108,58 +108,58 @@ typedef struct H5FD_direct_t { * 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_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(). + * 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 -# define file_truncate ftruncate64 -#elif defined (_WIN32) +# define file_offset_t off64_t +# define file_seek lseek64 +# define file_truncate ftruncate64 +#elif defined (H5_HAVE_WIN32_API) # /*MSVC*/ # define file_offset_t __int64 # define file_seek _lseeki64 -# define file_truncate _chsize +# define file_truncate _chsize #else -# define file_offset_t off_t -# define file_seek lseek -# define file_truncate HDftruncate +# define file_offset_t off_t +# define file_seek lseek +# define file_truncate HDftruncate #endif /* * These macros check for overflow of various quantities. These macros * assume that file_offset_t is signed and haddr_t and size_t are unsigned. * - * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' - * is too large to be represented by the second argument - * of the file seek function. + * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' + * is too large to be represented by the second argument + * of the file seek function. * - * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too - * large to be represented by the `size_t' type. + * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too + * large to be represented by the `size_t' type. * - * REGION_OVERFLOW: Checks whether an address and size pair describe data - * which can be addressed entirely by the second - * argument of the file seek function. + * REGION_OVERFLOW: Checks whether an address and size pair describe data + * which can be addressed entirely by the second + * argument of the file seek function. */ #define MAXADDR (((haddr_t)1<<(8*sizeof(file_offset_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \ - ((A) & ~(haddr_t)MAXADDR)) -#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) -#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - HADDR_UNDEF==(A)+(Z) || \ - (file_offset_t)((A)+(Z))<(file_offset_t)(A)) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \ + ((A) & ~(haddr_t)MAXADDR)) +#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) +#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ + HADDR_UNDEF==(A)+(Z) || \ + (file_offset_t)((A)+(Z))<(file_offset_t)(A)) /* Prototypes */ static herr_t H5FD_direct_term(void); static void *H5FD_direct_fapl_get(H5FD_t *file); static void *H5FD_direct_fapl_copy(const void *_old_fa); static H5FD_t *H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr); + haddr_t maxaddr); static herr_t H5FD_direct_close(H5FD_t *_file); static int H5FD_direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_direct_query(const H5FD_t *_f1, unsigned long *flags); @@ -168,44 +168,44 @@ static herr_t H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); static haddr_t H5FD_direct_get_eof(const H5FD_t *_file); static herr_t H5FD_direct_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle); static herr_t H5FD_direct_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, - size_t size, void *buf); + size_t size, void *buf); static herr_t H5FD_direct_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, - size_t size, const void *buf); + size_t size, const void *buf); static herr_t H5FD_direct_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static const H5FD_class_t H5FD_direct_g = { - "direct", /*name */ - MAXADDR, /*maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ + "direct", /*name */ + MAXADDR, /*maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ H5FD_direct_term, /*terminate */ - NULL, /*sb_size */ - NULL, /*sb_encode */ - NULL, /*sb_decode */ - sizeof(H5FD_direct_fapl_t), /*fapl_size */ - H5FD_direct_fapl_get, /*fapl_get */ - H5FD_direct_fapl_copy, /*fapl_copy */ - NULL, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_direct_open, /*open */ - H5FD_direct_close, /*close */ - H5FD_direct_cmp, /*cmp */ - H5FD_direct_query, /*query */ - NULL, /*get_type_map */ - NULL, /*alloc */ - NULL, /*free */ - H5FD_direct_get_eoa, /*get_eoa */ - H5FD_direct_set_eoa, /*set_eoa */ - H5FD_direct_get_eof, /*get_eof */ + NULL, /*sb_size */ + NULL, /*sb_encode */ + NULL, /*sb_decode */ + sizeof(H5FD_direct_fapl_t), /*fapl_size */ + H5FD_direct_fapl_get, /*fapl_get */ + H5FD_direct_fapl_copy, /*fapl_copy */ + NULL, /*fapl_free */ + 0, /*dxpl_size */ + NULL, /*dxpl_copy */ + NULL, /*dxpl_free */ + H5FD_direct_open, /*open */ + H5FD_direct_close, /*close */ + H5FD_direct_cmp, /*cmp */ + H5FD_direct_query, /*query */ + NULL, /*get_type_map */ + NULL, /*alloc */ + NULL, /*free */ + H5FD_direct_get_eoa, /*get_eoa */ + H5FD_direct_set_eoa, /*set_eoa */ + H5FD_direct_get_eof, /*get_eof */ H5FD_direct_get_handle, /*get_handle */ - H5FD_direct_read, /*read */ - H5FD_direct_write, /*write */ - NULL, /*flush */ - H5FD_direct_truncate, /*truncate */ + H5FD_direct_read, /*read */ + H5FD_direct_write, /*write */ + NULL, /*flush */ + H5FD_direct_truncate, /*truncate */ NULL, /*lock */ NULL, /*unlock */ - H5FD_FLMAP_SINGLE /*fl_map */ + H5FD_FLMAP_SINGLE /*fl_map */ }; /* Declare a free list to manage the H5FD_direct_t struct */ @@ -235,16 +235,16 @@ H5FD_direct_init_interface(void) /*------------------------------------------------------------------------- - * Function: H5FD_direct_init + * Function: H5FD_direct_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the direct driver. + * Return: Success: The driver ID for the direct driver. * - * Failure: Negative. + * Failure: Negative. * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Modifications: @@ -270,9 +270,9 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_direct_term + * Function: H5FD_direct_term * - * Purpose: Shut down the VFD + * Purpose: Shut down the VFD * * Returns: Non-negative on success or negative on failure * @@ -294,16 +294,16 @@ H5FD_direct_term(void) /*------------------------------------------------------------------------- - * Function: H5Pset_fapl_direct + * Function: H5Pset_fapl_direct * - * Purpose: Modify the file access property list to use the H5FD_DIRECT - * driver defined in this source file. There are no driver - * specific properties. + * Purpose: Modify the file access property list to use the H5FD_DIRECT + * driver defined in this source file. There are no driver + * specific properties. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Wednesday, 20 September 2006 + * Programmer: Raymond Lu + * Wednesday, 20 September 2006 * * Modifications: * @@ -312,9 +312,9 @@ H5FD_direct_term(void) herr_t H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbuf_size) { - H5P_genplist_t *plist; /* Property list pointer */ - H5FD_direct_fapl_t fa; - herr_t ret_value; + H5P_genplist_t *plist; /* Property list pointer */ + H5FD_direct_fapl_t fa; + herr_t ret_value; FUNC_ENTER_API(H5Pset_fapl_direct, FAIL) H5TRACE4("e", "izzz", fapl_id, boundary, block_size, cbuf_size); @@ -323,17 +323,17 @@ H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbu HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") if(boundary != 0) - fa.mboundary = boundary; + fa.mboundary = boundary; else - fa.mboundary = MBOUNDARY_DEF; + fa.mboundary = MBOUNDARY_DEF; if(block_size != 0) - fa.fbsize = block_size; + fa.fbsize = block_size; else - fa.fbsize = FBSIZE_DEF; + fa.fbsize = FBSIZE_DEF; if(cbuf_size != 0) - fa.cbsize = cbuf_size; + fa.cbsize = cbuf_size; else - fa.cbsize = CBSIZE_DEF; + fa.cbsize = CBSIZE_DEF; /* Set the default to be true for data alignment */ fa.must_align = TRUE; @@ -350,16 +350,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_fapl_direct + * Function: H5Pget_fapl_direct * - * Purpose: Returns information about the direct file access property - * list though the function arguments. + * Purpose: Returns information about the direct file access property + * list though the function arguments. * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, October 18, 2006 * * Modifications: @@ -368,9 +368,9 @@ done: */ herr_t H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary/*out*/, size_t *block_size/*out*/, - size_t *cbuf_size/*out*/) + size_t *cbuf_size/*out*/) { - H5FD_direct_fapl_t *fa; + H5FD_direct_fapl_t *fa; H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* Return value */ @@ -386,9 +386,9 @@ H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary/*out*/, size_t *block_size/*o if (boundary) *boundary = fa->mboundary; if (block_size) - *block_size = fa->fbsize; + *block_size = fa->fbsize; if (cbuf_size) - *cbuf_size = fa->cbsize; + *cbuf_size = fa->cbsize; done: FUNC_LEAVE_API(ret_value) @@ -396,18 +396,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_fapl_get + * Function: H5FD_direct_fapl_get * - * Purpose: Returns a file access property list which indicates how the - * specified file is being accessed. The return list could be - * used to access another file the same way. + * Purpose: Returns a file access property list which indicates how the + * specified file is being accessed. The return list could be + * used to access another file the same way. * - * Return: Success: Ptr to new file access property list with all - * members copied from the file struct. + * Return: Success: Ptr to new file access property list with all + * members copied from the file struct. * - * Failure: NULL + * Failure: NULL * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 18 October 2006 * * Modifications: @@ -417,7 +417,7 @@ done: static void * H5FD_direct_fapl_get(H5FD_t *_file) { - H5FD_direct_t *file = (H5FD_direct_t*)_file; + H5FD_direct_t *file = (H5FD_direct_t*)_file; void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_direct_fapl_get, NULL) @@ -431,15 +431,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_fapl_copy + * Function: H5FD_direct_fapl_copy * - * Purpose: Copies the direct-specific file access properties. + * Purpose: Copies the direct-specific file access properties. * - * Return: Success: Ptr to a new property list + * Return: Success: Ptr to a new property list * - * Failure: NULL + * Failure: NULL * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 18 October 2006 * * Modifications: @@ -469,17 +469,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_open + * Function: H5FD_direct_open * - * Purpose: Create and/or opens a Unix file for direct I/O as an HDF5 file. + * Purpose: Create and/or opens a Unix file for direct I/O as an HDF5 file. * - * Return: Success: A pointer to a new file data structure. The - * public fields will be initialized by the - * caller, which is always H5FD_open(). + * Return: Success: A pointer to a new file data structure. The + * public fields will be initialized by the + * caller, which is always H5FD_open(). * - * Failure: NULL + * Failure: NULL * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Modifications: @@ -489,18 +489,18 @@ done: static H5FD_t * H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - int o_flags; - int fd=(-1); - H5FD_direct_t *file=NULL; - H5FD_direct_fapl_t *fa; -#ifdef _WIN32 - HFILE filehandle; + int o_flags; + int fd=(-1); + H5FD_direct_t *file=NULL; + H5FD_direct_fapl_t *fa; +#ifdef H5_HAVE_WIN32_API + HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif - h5_stat_t sb; - H5P_genplist_t *plist; /* Property list */ + h5_stat_t sb; + H5P_genplist_t *plist; /* Property list */ int *buf1, *buf2; - H5FD_t *ret_value; + H5FD_t *ret_value; FUNC_ENTER_NOAPI(H5FD_direct_open, NULL) @@ -544,7 +544,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd H5_ASSIGN_OVERFLOW(file->eof,sb.st_size,h5_stat_size_t,haddr_t); file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API filehandle = _get_osfhandle(fd); (void)GetFileInformationByHandle((HANDLE)filehandle, &fileinfo); file->fileindexhi = fileinfo.nFileIndexHigh; @@ -558,7 +558,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd #else file->inode = sb.st_ino; #endif /*H5_VMS*/ -#endif /*_WIN32*/ +#endif /*H5_HAVE_WIN32_API*/ file->fa.mboundary = fa->mboundary; file->fa.fbsize = fa->fbsize; file->fa.cbsize = fa->cbsize; @@ -569,7 +569,7 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd */ buf1 = (int*)HDmalloc(sizeof(int)); if (HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed") if(o_flags & O_CREAT) { if(write(file->fd, (void*)buf1, sizeof(int))<0) { @@ -619,15 +619,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_close + * Function: H5FD_direct_close * - * Purpose: Closes the file. + * Purpose: Closes the file. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1, file not closed. + * Failure: -1, file not closed. * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Modifications: @@ -637,8 +637,8 @@ done: static herr_t H5FD_direct_close(H5FD_t *_file) { - H5FD_direct_t *file = (H5FD_direct_t*)_file; - herr_t ret_value=SUCCEED; /* Return value */ + H5FD_direct_t *file = (H5FD_direct_t*)_file; + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_direct_close, FAIL) @@ -653,17 +653,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_cmp + * Function: H5FD_direct_cmp * - * Purpose: Compares two files belonging to this driver using an - * arbitrary (but consistent) ordering. + * Purpose: Compares two files belonging to this driver using an + * arbitrary (but consistent) ordering. * - * Return: Success: A value like strcmp() + * Return: Success: A value like strcmp() * - * Failure: never fails (arguments were checked by the - * caller). + * Failure: never fails (arguments were checked by the + * caller). * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Thursday, 21 September 2006 * * Modifications: @@ -673,13 +673,13 @@ done: static int H5FD_direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { - const H5FD_direct_t *f1 = (const H5FD_direct_t*)_f1; - const H5FD_direct_t *f2 = (const H5FD_direct_t*)_f2; + const H5FD_direct_t *f1 = (const H5FD_direct_t*)_f1; + const H5FD_direct_t *f2 = (const H5FD_direct_t*)_f2; int ret_value=0; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_direct_cmp) -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) @@ -715,16 +715,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_query + * Function: H5FD_direct_query * - * Purpose: Set the flags that this VFL driver is capable of supporting. + * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Return: Success: non-negative + * Return: Success: non-negative * - * Failure: negative + * Failure: negative * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Thursday, 21 September 2006 * * Modifications: @@ -753,17 +753,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_get_eoa + * Function: H5FD_direct_get_eoa * - * Purpose: Gets the end-of-address marker for the file. The EOA marker - * is the first address past the last byte allocated in the - * format address space. + * Purpose: Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. * - * Return: Success: The end-of-address marker. + * Return: Success: The end-of-address marker. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Modifications: @@ -776,7 +776,7 @@ done: static haddr_t H5FD_direct_get_eoa(const H5FD_t *_file, H5FD_mem_t UNUSED type) { - const H5FD_direct_t *file = (const H5FD_direct_t*)_file; + const H5FD_direct_t *file = (const H5FD_direct_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_direct_get_eoa, HADDR_UNDEF) @@ -790,17 +790,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_set_eoa + * Function: H5FD_direct_set_eoa * - * Purpose: Set the end-of-address marker for the file. This function is - * called shortly after an existing HDF5 file is opened in order - * to tell the driver where the end of the HDF5 data is located. + * Purpose: Set the end-of-address marker for the file. This function is + * called shortly after an existing HDF5 file is opened in order + * to tell the driver where the end of the HDF5 data is located. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Modifications: @@ -813,7 +813,7 @@ done: static herr_t H5FD_direct_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { - H5FD_direct_t *file = (H5FD_direct_t*)_file; + H5FD_direct_t *file = (H5FD_direct_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_direct_set_eoa, FAIL) @@ -826,19 +826,19 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_get_eof + * Function: H5FD_direct_get_eof * - * Purpose: Returns the end-of-file marker, which is the greater of - * either the Unix end-of-file or the HDF5 end-of-address - * markers. + * Purpose: Returns the end-of-file marker, which is the greater of + * either the Unix end-of-file or the HDF5 end-of-address + * markers. * - * Return: Success: End of file address, the first address past - * the end of the "file", either the Unix file - * or the HDF5 file. + * Return: Success: End of file address, the first address past + * the end of the "file", either the Unix file + * or the HDF5 file. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Wednesday, 20 September 2006 * * Modifications: @@ -848,7 +848,7 @@ done: static haddr_t H5FD_direct_get_eof(const H5FD_t *_file) { - const H5FD_direct_t *file = (const H5FD_direct_t*)_file; + const H5FD_direct_t *file = (const H5FD_direct_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_direct_get_eof, HADDR_UNDEF) @@ -893,18 +893,18 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_read + * Function: H5FD_direct_read * - * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR - * into buffer BUF according to data transfer properties in - * DXPL_ID. + * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR + * into buffer BUF according to data transfer properties in + * DXPL_ID. * - * Return: Success: Zero. Result is stored in caller-supplied - * buffer BUF. + * Return: Success: Zero. Result is stored in caller-supplied + * buffer BUF. * - * Failure: -1, Contents of buffer BUF are undefined. + * Failure: -1, Contents of buffer BUF are undefined. * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Thursday, 21 September 2006 * * Modifications: @@ -913,19 +913,19 @@ done: */ static herr_t H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, - size_t size, void *buf/*out*/) + size_t size, void *buf/*out*/) { - H5FD_direct_t *file = (H5FD_direct_t*)_file; - ssize_t nbytes; - hbool_t _must_align = TRUE; - herr_t ret_value=SUCCEED; /* Return value */ - size_t alloc_size; - void *copy_buf = NULL, *p2; - size_t _boundary; - size_t _fbsize; - size_t _cbsize; - haddr_t read_size; /* Size to read into copy buffer */ - size_t copy_size = size; /* Size remaining to read when using copy buffer */ + H5FD_direct_t *file = (H5FD_direct_t*)_file; + ssize_t nbytes; + hbool_t _must_align = TRUE; + herr_t ret_value=SUCCEED; /* Return value */ + size_t alloc_size; + void *copy_buf = NULL, *p2; + size_t _boundary; + size_t _fbsize; + size_t _cbsize; + haddr_t read_size; /* Size to read into copy buffer */ + size_t copy_size = size; /* Size remaining to read when using copy buffer */ size_t copy_offset; /* Offset into copy buffer of the requested data */ FUNC_ENTER_NOAPI(H5FD_direct_read, FAIL) @@ -958,44 +958,44 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha * and aligned data first, then copy the data into memory buffer. */ if(!_must_align || ((addr%_fbsize==0) && (size%_fbsize==0) && ((size_t)buf%_boundary==0))) { - /* Seek to the correct location */ - if ((addr!=file->pos || OP_READ!=file->op) && - file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) - HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - /* Read the aligned data in file first, being careful of interrupted - * system calls and partial results. */ - while (size>0) { - do { - nbytes = HDread(file->fd, buf, size); - } while (-1==nbytes && EINTR==errno); - if (-1==nbytes) /* error */ - HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") - if (0==nbytes) { - /* end of file but not end of format address space */ - HDmemset(buf, 0, size); - break; - } - assert(nbytes>=0); - assert((size_t)nbytes<=size); - H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t); - size -= (size_t)nbytes; - H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t); - addr += (haddr_t)nbytes; - buf = (char*)buf + nbytes; - } + /* Seek to the correct location */ + if ((addr!=file->pos || OP_READ!=file->op) && + file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) + HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") + /* Read the aligned data in file first, being careful of interrupted + * system calls and partial results. */ + while (size>0) { + do { + nbytes = HDread(file->fd, buf, size); + } while (-1==nbytes && EINTR==errno); + if (-1==nbytes) /* error */ + HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") + if (0==nbytes) { + /* end of file but not end of format address space */ + HDmemset(buf, 0, size); + break; + } + assert(nbytes>=0); + assert((size_t)nbytes<=size); + H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t); + size -= (size_t)nbytes; + H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t); + addr += (haddr_t)nbytes; + buf = (char*)buf + nbytes; + } } else { /* Calculate where we will begin copying from the copy buffer */ copy_offset = (size_t)(addr % _fbsize); - /* allocate memory needed for the Direct IO option up to the maximal - * copy buffer size. Make a bigger buffer for aligned I/O if size is - * smaller than maximal copy buffer. */ - alloc_size = ((copy_offset + size - 1) / _fbsize + 1) * _fbsize; - if(alloc_size > _cbsize) - alloc_size = _cbsize; - HDassert(!(alloc_size % _fbsize)); - if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed") + /* allocate memory needed for the Direct IO option up to the maximal + * copy buffer size. Make a bigger buffer for aligned I/O if size is + * smaller than maximal copy buffer. */ + alloc_size = ((copy_offset + size - 1) / _fbsize + 1) * _fbsize; + if(alloc_size > _cbsize) + alloc_size = _cbsize; + HDassert(!(alloc_size % _fbsize)); + if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed") /* look for the aligned position for reading the data */ HDassert(!(((addr / _fbsize) * _fbsize) % _fbsize)); @@ -1003,18 +1003,18 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - /* - * Read the aligned data in file into aligned buffer first, then copy the data - * into the final buffer. If the data size is bigger than maximal copy buffer - * size, do the reading by segment (the outer while loop). If not, do one step - * reading. - */ - do { - /* Read the aligned data in file first. Not able to handle interrupted - * system calls and partial results like sec2 driver does because the - * data may no longer be aligned. It's expecially true when the data in - * file is smaller than ALLOC_SIZE. */ - HDmemset(copy_buf, 0, alloc_size); + /* + * Read the aligned data in file into aligned buffer first, then copy the data + * into the final buffer. If the data size is bigger than maximal copy buffer + * size, do the reading by segment (the outer while loop). If not, do one step + * reading. + */ + do { + /* Read the aligned data in file first. Not able to handle interrupted + * system calls and partial results like sec2 driver does because the + * data may no longer be aligned. It's expecially true when the data in + * file is smaller than ALLOC_SIZE. */ + HDmemset(copy_buf, 0, alloc_size); /* Calculate how much data we have to read in this iteration * (including unused parts of blocks) */ @@ -1025,23 +1025,23 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha read_size = alloc_size; HDassert(!(read_size % _fbsize)); - do { - nbytes = HDread(file->fd, copy_buf, read_size); - } while(-1==nbytes && EINTR==errno); + do { + nbytes = HDread(file->fd, copy_buf, read_size); + } while(-1==nbytes && EINTR==errno); - if (-1==nbytes) /* error */ - HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") + if (-1==nbytes) /* error */ + HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") - /* Copy the needed data from the copy buffer to the output - * buffer, and update copy_size. If the copy buffer does not + /* Copy the needed data from the copy buffer to the output + * buffer, and update copy_size. If the copy buffer does not * contain the rest of the data, just copy what's in the copy * buffer and also update read_addr and copy_offset to read the * next section of data. */ - p2 = (unsigned char*)copy_buf + copy_offset; - if((copy_size + copy_offset) <= alloc_size) { - HDmemcpy(buf, p2, copy_size); - buf = (unsigned char *)buf + copy_size; - copy_size = 0; + p2 = (unsigned char*)copy_buf + copy_offset; + if((copy_size + copy_offset) <= alloc_size) { + HDmemcpy(buf, p2, copy_size); + buf = (unsigned char *)buf + copy_size; + copy_size = 0; } /* end if */ else { HDmemcpy(buf, p2, alloc_size - copy_offset); @@ -1049,12 +1049,12 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha copy_size -= alloc_size - copy_offset; copy_offset = 0; } /* end else */ - } while (copy_size > 0); + } while (copy_size > 0); - /*Final step: update address*/ - addr = (haddr_t)(((addr + size - 1) / _fbsize + 1) * _fbsize); + /*Final step: update address*/ + addr = (haddr_t)(((addr + size - 1) / _fbsize + 1) * _fbsize); - if(copy_buf) { + if(copy_buf) { HDfree(copy_buf); copy_buf = NULL; } /* end if */ @@ -1079,17 +1079,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_write + * Function: H5FD_direct_write * - * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR - * from buffer BUF according to data transfer properties in - * DXPL_ID. + * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR + * from buffer BUF according to data transfer properties in + * DXPL_ID. * - * Return: Success: Zero + * Return: Success: Zero * - * Failure: -1 + * Failure: -1 * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Thursday, 21 September 2006 * * Modifications: @@ -1098,18 +1098,18 @@ done: */ static herr_t H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, - size_t size, const void *buf) + size_t size, const void *buf) { - H5FD_direct_t *file = (H5FD_direct_t*)_file; - ssize_t nbytes; - hbool_t _must_align = TRUE; - herr_t ret_value=SUCCEED; /* Return value */ - size_t alloc_size; - void *copy_buf = NULL, *p1; - const void *p3; - size_t _boundary; - size_t _fbsize; - size_t _cbsize; + H5FD_direct_t *file = (H5FD_direct_t*)_file; + ssize_t nbytes; + hbool_t _must_align = TRUE; + herr_t ret_value=SUCCEED; /* Return value */ + size_t alloc_size; + void *copy_buf = NULL, *p1; + const void *p3; + size_t _boundary; + size_t _fbsize; + size_t _cbsize; haddr_t write_addr; /* Address to write copy buffer */ haddr_t write_size; /* Size to write from copy buffer */ haddr_t read_size; /* Size to read into copy buffer */ @@ -1146,49 +1146,49 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h * first, update buffer with user data, then write the data out. */ if(!_must_align || ((addr%_fbsize==0) && (size%_fbsize==0) && ((size_t)buf%_boundary==0))) { - /* Seek to the correct location */ - if ((addr!=file->pos || OP_WRITE!=file->op) && - file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) - HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - - while (size>0) { - do { - nbytes = HDwrite(file->fd, buf, size); - } while (-1==nbytes && EINTR==errno); - if (-1==nbytes) /* error */ - HSYS_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") - assert(nbytes>0); - assert((size_t)nbytes<=size); - H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t); - size -= (size_t)nbytes; - H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t); - addr += (haddr_t)nbytes; - buf = (const char*)buf + nbytes; - } + /* Seek to the correct location */ + if ((addr!=file->pos || OP_WRITE!=file->op) && + file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0) + HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") + + while (size>0) { + do { + nbytes = HDwrite(file->fd, buf, size); + } while (-1==nbytes && EINTR==errno); + if (-1==nbytes) /* error */ + HSYS_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + assert(nbytes>0); + assert((size_t)nbytes<=size); + H5_CHECK_OVERFLOW(nbytes,ssize_t,size_t); + size -= (size_t)nbytes; + H5_CHECK_OVERFLOW(nbytes,ssize_t,haddr_t); + addr += (haddr_t)nbytes; + buf = (const char*)buf + nbytes; + } } else { /* Calculate where we will begin reading from (on disk) and where we * will begin copying from the copy buffer */ write_addr = (addr / _fbsize) * _fbsize; copy_offset = (size_t)(addr % _fbsize); - /* allocate memory needed for the Direct IO option up to the maximal - * copy buffer size. Make a bigger buffer for aligned I/O if size is - * smaller than maximal copy buffer. - */ - alloc_size = ((copy_offset + size - 1) / _fbsize + 1) * _fbsize; + /* allocate memory needed for the Direct IO option up to the maximal + * copy buffer size. Make a bigger buffer for aligned I/O if size is + * smaller than maximal copy buffer. + */ + alloc_size = ((copy_offset + size - 1) / _fbsize + 1) * _fbsize; if(alloc_size > _cbsize) alloc_size = _cbsize; HDassert(!(alloc_size % _fbsize)); - if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed") + if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed") /* look for the right position for reading or writing the data */ if(file_seek(file->fd, (file_offset_t)write_addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - p3 = buf; - do { + p3 = buf; + do { /* Calculate how much data we have to write in this iteration * (including unused parts of blocks) */ if((copy_size + copy_offset) < alloc_size) @@ -1197,16 +1197,16 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h else write_size = alloc_size; - /* - * Read the aligned data first if the aligned region doesn't fall - * entirely in the range to be writen. Not able to handle interrupted - * system calls and partial results like sec2 driver does because the - * data may no longer be aligned. It's expecially true when the data in - * file is smaller than ALLOC_SIZE. Only read the entire section if + /* + * Read the aligned data first if the aligned region doesn't fall + * entirely in the range to be writen. Not able to handle interrupted + * system calls and partial results like sec2 driver does because the + * data may no longer be aligned. It's expecially true when the data in + * file is smaller than ALLOC_SIZE. Only read the entire section if * both ends are misaligned, otherwise only read the block on the * misaligned end. - */ - HDmemset(copy_buf, 0, _fbsize); + */ + HDmemset(copy_buf, 0, _fbsize); if(copy_offset > 0) { if((write_addr + write_size) > (addr + size)) { @@ -1244,14 +1244,14 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") } /* end if */ - /* look for the right position and append or copy the data to be written to - * the aligned buffer. - * Consider all possible situations here: file address is not aligned on - * file block size; the end of data address is not aligned; the end of data - * address is aligned; data size is smaller or bigger than maximal copy size. - */ - p1 = (unsigned char *)copy_buf + copy_offset; - if((copy_size + copy_offset) <= alloc_size) { + /* look for the right position and append or copy the data to be written to + * the aligned buffer. + * Consider all possible situations here: file address is not aligned on + * file block size; the end of data address is not aligned; the end of data + * address is aligned; data size is smaller or bigger than maximal copy size. + */ + p1 = (unsigned char *)copy_buf + copy_offset; + if((copy_size + copy_offset) <= alloc_size) { HDmemcpy(p1, p3, copy_size); copy_size = 0; } /* end if */ @@ -1262,34 +1262,34 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h copy_offset = 0; } /* end else */ - /*look for the aligned position for writing the data*/ - HDassert(!(write_addr % _fbsize)); - if(file_seek(file->fd, (file_offset_t)write_addr, SEEK_SET) < 0) - HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - - /* - * Write the data. It doesn't truncate the extra data introduced by - * alignment because that step is done in H5FD_direct_flush. - */ - HDassert(!(write_size % _fbsize)); - do { - nbytes = HDwrite(file->fd, copy_buf, write_size); - } while (-1==nbytes && EINTR==errno); - - if (-1==nbytes) /* error */ - HSYS_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") - - /* update the write address */ - write_addr += write_size; - } while (copy_size > 0); - - /*Update the address and size*/ - addr = write_addr; - buf = (const char*)buf + size; - - if(copy_buf) { - HDfree(copy_buf); - copy_buf = NULL; + /*look for the aligned position for writing the data*/ + HDassert(!(write_addr % _fbsize)); + if(file_seek(file->fd, (file_offset_t)write_addr, SEEK_SET) < 0) + HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") + + /* + * Write the data. It doesn't truncate the extra data introduced by + * alignment because that step is done in H5FD_direct_flush. + */ + HDassert(!(write_size % _fbsize)); + do { + nbytes = HDwrite(file->fd, copy_buf, write_size); + } while (-1==nbytes && EINTR==errno); + + if (-1==nbytes) /* error */ + HSYS_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + + /* update the write address */ + write_addr += write_size; + } while (copy_size > 0); + + /*Update the address and size*/ + addr = write_addr; + buf = (const char*)buf + size; + + if(copy_buf) { + HDfree(copy_buf); + copy_buf = NULL; } /* end if */ } @@ -1314,16 +1314,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_direct_truncate + * Function: H5FD_direct_truncate * - * Purpose: Makes sure that the true file size is the same (or larger) - * than the end-of-address. + * Purpose: Makes sure that the true file size is the same (or larger) + * than the end-of-address. * - * Return: Success: Non-negative + * Return: Success: Non-negative * - * Failure: Negative + * Failure: Negative * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * Thursday, 21 September 2006 * *------------------------------------------------------------------------- @@ -1331,8 +1331,8 @@ done: static herr_t H5FD_direct_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) { - H5FD_direct_t *file = (H5FD_direct_t*)_file; - herr_t ret_value = SUCCEED; /* Return value */ + H5FD_direct_t *file = (H5FD_direct_t*)_file; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_direct_truncate, FAIL) @@ -1340,7 +1340,7 @@ H5FD_direct_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing /* Extend the file to make sure it's large enough */ if (file->eoa!=file->eof) { -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; /* Windows file handle */ LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */ @@ -1353,10 +1353,10 @@ H5FD_direct_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing (void)SetFilePointer((HANDLE)filehandle,li.LowPart,&li.HighPart,FILE_BEGIN); if(SetEndOfFile((HANDLE)filehandle)==0) HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ if (-1==file_truncate(file->fd, (file_offset_t)file->eoa)) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ /* Update the eof value */ file->eof = file->eoa; @@ -1366,9 +1366,9 @@ H5FD_direct_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing file->op = OP_UNKNOWN; } else if (file->fa.must_align){ - /*Even though eof is equal to eoa, file is still truncated because Direct I/O - *write introduces some extra data for alignment. - */ + /*Even though eof is equal to eoa, file is still truncated because Direct I/O + *write introduces some extra data for alignment. + */ if (-1==file_truncate(file->fd, (file_offset_t)file->eof)) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") } diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 8cbf293..cdcf8ba 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -85,7 +85,7 @@ typedef struct H5FD_log_t { haddr_t pos; /*current file I/O position */ H5FD_file_op_t op; /*last operation */ char filename[H5FD_MAX_FILENAME_LEN]; /* Copy of file name from open operation */ -#ifndef _WIN32 +#ifndef H5_HAVE_WIN32_API /* * On most systems the combination of device and i-node number uniquely * identify a file. @@ -98,7 +98,7 @@ typedef struct H5FD_log_t { #endif /*H5_VMS*/ #else /* - * On _WIN32 the low-order word of a unique identifier associated with the + * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the * file and the volume serial number uniquely identify a file. This number * (which, both? -rpm) may change when the system is restarted or when the * file is opened. After a process opens a file, the identifier is @@ -473,7 +473,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5FD_log_fapl_t *fa; /* File access property list information */ int fd = (-1); /* File descriptor */ int o_flags; /* Flags for open() call */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif @@ -570,12 +570,12 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5_ASSIGN_OVERFLOW(file->eof, sb.st_size, h5_stat_size_t, haddr_t); file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API filehandle = _get_osfhandle(fd); (void)GetFileInformationByHandle((HANDLE)filehandle, &fileinfo); file->fileindexhi = fileinfo.nFileIndexHigh; file->fileindexlo = fileinfo.nFileIndexLow; -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ file->device = sb.st_dev; #ifdef H5_VMS file->inode[0] = sb.st_ino[0]; @@ -585,7 +585,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) file->inode = sb.st_ino; #endif /*H5_VMS*/ -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ /* Retain a copy of the name used to open the file, for possible error reporting */ HDstrncpy(file->filename, name, sizeof(file->filename)); @@ -825,7 +825,7 @@ H5FD_log_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_log_cmp) -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API if(f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) if(f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) @@ -1474,7 +1474,7 @@ H5FD_log_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) /* Extend the file to make sure it's large enough */ if(!H5F_addr_eq(file->eoa, file->eof)) { -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; /* Windows file handle */ LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */ @@ -1487,7 +1487,7 @@ H5FD_log_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) (void)SetFilePointer((HANDLE)filehandle, li.LowPart, &li.HighPart, FILE_BEGIN); if(SetEndOfFile((HANDLE)filehandle) == 0) HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ #ifdef H5_VMS /* Reset seek offset to the beginning of the file, so that the file isn't * re-extended later. This may happen on Open VMS. */ @@ -1497,7 +1497,7 @@ H5FD_log_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) if(-1 == HDftruncate(file->fd, (HDoff_t)file->eoa)) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ /* Log information about the truncate */ if(file->fa.flags & H5FD_LOG_NUM_TRUNCATE) diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index bcedaed..496f474 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -17,7 +17,7 @@ * Programmer: Quincey Koziol <koziol@ncsa.uiuc.ed> * Thursday, July 11, 2002 * - * Purpose: This is a "combination" MPI-2 and posix I/O driver. + * Purpose: This is a "combination" MPI-2 and posix I/O driver. * It uses MPI for coordinating the actions of several processes * and posix I/O calls to do the actual I/O to the disk. * @@ -34,17 +34,17 @@ */ /* Interface initialization */ -#define H5_INTERFACE_INIT_FUNC H5FD_mpiposix_init_interface +#define H5_INTERFACE_INIT_FUNC H5FD_mpiposix_init_interface -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDmpi.h" /* MPI-based file drivers */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDmpi.h" /* MPI-based file drivers */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ /* Features: @@ -72,9 +72,9 @@ static hid_t H5FD_MPIPOSIX_g = 0; /* File operations */ -#define OP_UNKNOWN 0 -#define OP_READ 1 -#define OP_WRITE 2 +#define OP_UNKNOWN 0 +#define OP_READ 1 +#define OP_WRITE 2 /* * The description of a file belonging to this driver. @@ -84,31 +84,31 @@ static hid_t H5FD_MPIPOSIX_g = 0; * doesn't bother to keep it updated since it's an expensive operation. */ typedef struct H5FD_mpiposix_t { - H5FD_t pub; /*public stuff, must be first */ - int fd; /*the unix file handle */ - MPI_Comm comm; /*communicator */ + H5FD_t pub; /*public stuff, must be first */ + int fd; /*the unix file handle */ + MPI_Comm comm; /*communicator */ int mpi_rank; /* This process's rank */ int mpi_size; /* Total number of processes */ - haddr_t eof; /*end-of-file marker */ - haddr_t eoa; /*end-of-address marker */ - haddr_t last_eoa; /* Last known end-of-address marker */ - haddr_t pos; /* Current file I/O position */ - int op; /* Last file I/O operation */ - hsize_t naccess; /* Number of (write) accesses to file */ + haddr_t eof; /*end-of-file marker */ + haddr_t eoa; /*end-of-address marker */ + haddr_t last_eoa; /* Last known end-of-address marker */ + haddr_t pos; /* Current file I/O position */ + int op; /* Last file I/O operation */ + hsize_t naccess; /* Number of (write) accesses to file */ #ifdef H5_HAVE_GPFS size_t blksize; /* Block size of file system */ #endif hbool_t use_gpfs; /* Use GPFS to write things */ -#ifndef _WIN32 +#ifndef H5_HAVE_WIN32_API /* * On most systems the combination of device and i-node number uniquely * identify a file. */ - dev_t device; /*file device number */ - ino_t inode; /*file i-node number */ + dev_t device; /*file device number */ + ino_t inode; /*file i-node number */ #else /* - * On _WIN32 the low-order word of a unique identifier associated with the + * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the * file and the volume serial number uniquely identify a file. This number * (which, both? -rpm) may change when the system is restarted or when the * file is opened. After a process opens a file, the identifier is @@ -126,52 +126,52 @@ typedef struct H5FD_mpiposix_t { * 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_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(). + * 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 -# define file_truncate ftruncate64 -#elif defined (_WIN32) +# define file_offset_t off64_t +# define file_seek lseek64 +# define file_truncate ftruncate64 +#elif defined (H5_HAVE_WIN32_API) # /*MSVC*/ # define file_offset_t __int64 # define file_seek _lseeki64 -# define file_truncate _ftruncatei64 +# define file_truncate _ftruncatei64 #else -# define file_offset_t off_t -# define file_seek HDlseek -# define file_truncate HDftruncate +# define file_offset_t off_t +# define file_seek HDlseek +# define file_truncate HDftruncate #endif /* * These macros check for overflow of various quantities. These macros * assume that file_offset_t is signed and haddr_t and size_t are unsigned. * - * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' - * is too large to be represented by the second argument - * of the file seek function. + * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' + * is too large to be represented by the second argument + * of the file seek function. * - * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too - * large to be represented by the `size_t' type. + * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too + * large to be represented by the `size_t' type. * - * REGION_OVERFLOW: Checks whether an address and size pair describe data - * which can be addressed entirely by the second - * argument of the file seek function. + * REGION_OVERFLOW: Checks whether an address and size pair describe data + * which can be addressed entirely by the second + * argument of the file seek function. */ #define MAXADDR (((haddr_t)1<<(8*sizeof(file_offset_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \ - ((A) & ~(haddr_t)MAXADDR)) -#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) -#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ - sizeof(file_offset_t)<sizeof(size_t) || \ - HADDR_UNDEF==(A)+(Z) || \ - (file_offset_t)((A)+(Z))<(file_offset_t)(A)) +#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || \ + ((A) & ~(haddr_t)MAXADDR)) +#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) +#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ + sizeof(file_offset_t)<sizeof(size_t) || \ + HADDR_UNDEF==(A)+(Z) || \ + (file_offset_t)((A)+(Z))<(file_offset_t)(A)) /* Callbacks */ static herr_t H5FD_mpiposix_term(void); @@ -179,7 +179,7 @@ static void *H5FD_mpiposix_fapl_get(H5FD_t *_file); static void *H5FD_mpiposix_fapl_copy(const void *_old_fa); static herr_t H5FD_mpiposix_fapl_free(void *_fa); static H5FD_t *H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr); + haddr_t maxaddr); static herr_t H5FD_mpiposix_close(H5FD_t *_file); static int H5FD_mpiposix_cmp(const H5FD_t *_f1, const H5FD_t *_f2); static herr_t H5FD_mpiposix_query(const H5FD_t *_f1, unsigned long *flags); @@ -199,44 +199,44 @@ static MPI_Comm H5FD_mpiposix_communicator(const H5FD_t *_file); /* MPIPOSIX-specific file access properties */ typedef struct H5FD_mpiposix_fapl_t { hbool_t use_gpfs; /*use GPFS hints */ - MPI_Comm comm; /*communicator */ + MPI_Comm comm; /*communicator */ } H5FD_mpiposix_fapl_t; /* The MPIPOSIX file driver information */ static const H5FD_class_mpi_t H5FD_mpiposix_g = { { /* Start of superclass information */ - "mpiposix", /*name */ - MAXADDR, /*maxaddr */ - H5F_CLOSE_SEMI, /* fc_degree */ + "mpiposix", /*name */ + MAXADDR, /*maxaddr */ + H5F_CLOSE_SEMI, /* fc_degree */ H5FD_mpiposix_term, /*terminate */ - NULL, /*sb_size */ - NULL, /*sb_encode */ - NULL, /*sb_decode */ - sizeof(H5FD_mpiposix_fapl_t), /*fapl_size */ - H5FD_mpiposix_fapl_get, /*fapl_get */ - H5FD_mpiposix_fapl_copy, /*fapl_copy */ - H5FD_mpiposix_fapl_free, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_mpiposix_open, /*open */ - H5FD_mpiposix_close, /*close */ - H5FD_mpiposix_cmp, /*cmp */ - H5FD_mpiposix_query, /*query */ - NULL, /*get_type_map */ - NULL, /*alloc */ - NULL, /*free */ - H5FD_mpiposix_get_eoa, /*get_eoa */ - H5FD_mpiposix_set_eoa, /*set_eoa */ - H5FD_mpiposix_get_eof, /*get_eof */ + NULL, /*sb_size */ + NULL, /*sb_encode */ + NULL, /*sb_decode */ + sizeof(H5FD_mpiposix_fapl_t), /*fapl_size */ + H5FD_mpiposix_fapl_get, /*fapl_get */ + H5FD_mpiposix_fapl_copy, /*fapl_copy */ + H5FD_mpiposix_fapl_free, /*fapl_free */ + 0, /*dxpl_size */ + NULL, /*dxpl_copy */ + NULL, /*dxpl_free */ + H5FD_mpiposix_open, /*open */ + H5FD_mpiposix_close, /*close */ + H5FD_mpiposix_cmp, /*cmp */ + H5FD_mpiposix_query, /*query */ + NULL, /*get_type_map */ + NULL, /*alloc */ + NULL, /*free */ + H5FD_mpiposix_get_eoa, /*get_eoa */ + H5FD_mpiposix_set_eoa, /*set_eoa */ + H5FD_mpiposix_get_eof, /*get_eof */ H5FD_mpiposix_get_handle, /*get_handle */ - H5FD_mpiposix_read, /*read */ - H5FD_mpiposix_write, /*write */ - NULL, /*flush */ - H5FD_mpiposix_truncate, /*truncate */ + H5FD_mpiposix_read, /*read */ + H5FD_mpiposix_write, /*write */ + NULL, /*flush */ + H5FD_mpiposix_truncate, /*truncate */ NULL, /*lock */ NULL, /*unlock */ - H5FD_FLMAP_SINGLE /*fl_map */ + H5FD_FLMAP_SINGLE /*fl_map */ }, /* End of superclass information */ H5FD_mpiposix_mpi_rank, /*get_rank */ H5FD_mpiposix_mpi_size, /*get_size */ @@ -267,16 +267,16 @@ H5FD_mpiposix_init_interface(void) /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_init + * Function: H5FD_mpiposix_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the mpiposix driver. + * Return: Success: The driver ID for the mpiposix driver. * - * Failure: Negative. + * Failure: Negative. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -302,9 +302,9 @@ done: /*--------------------------------------------------------------------------- - * Function: H5FD_mpiposix_term + * Function: H5FD_mpiposix_term * - * Purpose: Shut down the VFD + * Purpose: Shut down the VFD * * Returns: Non-negative on success or negative on failure * @@ -326,43 +326,43 @@ H5FD_mpiposix_term(void) /*------------------------------------------------------------------------- - * Function: H5Pset_fapl_mpiposix + * Function: H5Pset_fapl_mpiposix * - * Purpose: Store the user supplied MPI communicator COMM in - * the file access property list FAPL_ID which can then be used - * to create and/or open the file. This function is available - * only in the parallel HDF5 library and is not collective. + * Purpose: Store the user supplied MPI communicator COMM in + * the file access property list FAPL_ID which can then be used + * to create and/or open the file. This function is available + * only in the parallel HDF5 library and is not collective. * - * comm is the MPI communicator to be used for file open as - * defined in MPI_FILE_OPEN of MPI-2. This function makes a - * duplicate of comm. Any modification to comm after this function - * call returns has no effect on the access property list. + * comm is the MPI communicator to be used for file open as + * defined in MPI_FILE_OPEN of MPI-2. This function makes a + * duplicate of comm. Any modification to comm after this function + * call returns has no effect on the access property list. * * If fapl_id has previously set comm value, it will be replaced * and the old communicator is freed. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, July 11, 2002 + * Programmer: Quincey Koziol + * Thursday, July 11, 2002 * * Modifications: - * Albert Cheng, 2003-04-24 - * Modified the description of the function that it now stores - * a duplicate of the communicator. Free the old duplicate if - * previously set. (Work is actually done by H5P_set_driver.) + * Albert Cheng, 2003-04-24 + * Modified the description of the function that it now stores + * a duplicate of the communicator. Free the old duplicate if + * previously set. (Work is actually done by H5P_set_driver.) * - * Bill Wendling, 2003-05-01 - * Modified to take an extra flag indicating that we should - * use the GPFS hints (if available) for this file. + * Bill Wendling, 2003-05-01 + * Modified to take an extra flag indicating that we should + * use the GPFS hints (if available) for this file. * *------------------------------------------------------------------------- */ herr_t H5Pset_fapl_mpiposix(hid_t fapl_id, MPI_Comm comm, hbool_t use_gpfs) { - H5FD_mpiposix_fapl_t fa; + H5FD_mpiposix_fapl_t fa; H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value; @@ -373,7 +373,7 @@ H5Pset_fapl_mpiposix(hid_t fapl_id, MPI_Comm comm, hbool_t use_gpfs) if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") if (MPI_COMM_NULL == comm) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a valid communicator") /* Initialize driver specific properties */ fa.comm = comm; @@ -388,29 +388,29 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_fapl_mpiposix + * Function: H5Pget_fapl_mpiposix * - * Purpose: If the file access property list is set to the H5FD_MPIPOSIX - * driver then this function returns a duplicate of the MPI - * communicator through the comm pointer. It is the responsibility - * of the application to free the returned communicator. + * Purpose: If the file access property list is set to the H5FD_MPIPOSIX + * driver then this function returns a duplicate of the MPI + * communicator through the comm pointer. It is the responsibility + * of the application to free the returned communicator. * - * Return: Success: Non-negative with the communicator and - * information returned through the COMM - * argument if non-null. Since it is a duplicate - * of the stored object, future modifications to - * the access property list do not affect it and - * it is the responsibility of the application to - * free it. + * Return: Success: Non-negative with the communicator and + * information returned through the COMM + * argument if non-null. Since it is a duplicate + * of the stored object, future modifications to + * the access property list do not affect it and + * it is the responsibility of the application to + * free it. * - * Failure: Negative + * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, July 11, 2002 + * Programmer: Quincey Koziol + * Thursday, July 11, 2002 * * Modifications: - * Albert Cheng, 2003-04-24 - * Return duplicate of the stored communicator. + * Albert Cheng, 2003-04-24 + * Return duplicate of the stored communicator. * * Bill Wendling, 2003-05-01 * Return the USE_GPFS flag. @@ -420,9 +420,9 @@ done: herr_t H5Pget_fapl_mpiposix(hid_t fapl_id, MPI_Comm *comm/*out*/, hbool_t *use_gpfs/*out*/) { - H5FD_mpiposix_fapl_t *fa; + H5FD_mpiposix_fapl_t *fa; H5P_genplist_t *plist; /* Property list pointer */ - int mpi_code; /* mpi return code */ + int mpi_code; /* mpi return code */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5Pget_fapl_mpiposix, FAIL) @@ -437,8 +437,8 @@ H5Pget_fapl_mpiposix(hid_t fapl_id, MPI_Comm *comm/*out*/, hbool_t *use_gpfs/*ou /* Get MPI Communicator */ if (comm){ - if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) + if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, comm))) + HMPI_GOTO_ERROR(FAIL, "MPI_Comm_dup failed", mpi_code) } if (use_gpfs) @@ -450,32 +450,32 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_fapl_get + * Function: H5FD_mpiposix_fapl_get * - * Purpose: Returns a file access property list which could be used to - * create another file the same as this one. + * Purpose: Returns a file access property list which could be used to + * create another file the same as this one. * - * Return: Success: Ptr to new file access property list with all - * fields copied from the file pointer. + * Return: Success: Ptr to new file access property list with all + * fields copied from the file pointer. * - * Failure: NULL + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: - * Albert Cheng, 2003-04-24 - * Duplicate the communicator object so that the new - * property list is insulated from the old one. + * Albert Cheng, 2003-04-24 + * Duplicate the communicator object so that the new + * property list is insulated from the old one. * *------------------------------------------------------------------------- */ static void * H5FD_mpiposix_fapl_get(H5FD_t *_file) { - H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; + H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; H5FD_mpiposix_fapl_t *fa = NULL; - int mpi_code; /* MPI return code */ + int mpi_code; /* MPI return code */ void *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpiposix_fapl_get, NULL) @@ -488,7 +488,7 @@ H5FD_mpiposix_fapl_get(H5FD_t *_file) /* Duplicate the communicator. */ if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(file->comm, &fa->comm))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) + HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) fa->use_gpfs = file->use_gpfs; @@ -501,15 +501,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_fapl_copy + * Function: H5FD_mpiposix_fapl_copy * - * Purpose: Copies the mpiposix-specific file access properties. + * Purpose: Copies the mpiposix-specific file access properties. * - * Return: Success: Ptr to a new property list + * Return: Success: Ptr to a new property list * - * Failure: NULL + * Failure: NULL * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * Apr 24, 2003 * * Modifications: @@ -519,10 +519,10 @@ done: static void * H5FD_mpiposix_fapl_copy(const void *_old_fa) { - void *ret_value = NULL; + void *ret_value = NULL; const H5FD_mpiposix_fapl_t *old_fa = (const H5FD_mpiposix_fapl_t*)_old_fa; - H5FD_mpiposix_fapl_t *new_fa = NULL; - int mpi_code; /* MPI return code */ + H5FD_mpiposix_fapl_t *new_fa = NULL; + int mpi_code; /* MPI return code */ FUNC_ENTER_NOAPI(H5FD_mpiposix_fapl_copy, NULL) @@ -534,16 +534,16 @@ H5FD_mpiposix_fapl_copy(const void *_old_fa) /* Duplicate communicator. */ if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(old_fa->comm, &new_fa->comm))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) + HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) new_fa->use_gpfs = old_fa->use_gpfs; ret_value = new_fa; done: if (NULL == ret_value){ - /* cleanup */ - if (new_fa) - H5MM_xfree(new_fa); + /* cleanup */ + if (new_fa) + H5MM_xfree(new_fa); } FUNC_LEAVE_NOAPI(ret_value) @@ -551,15 +551,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_fapl_free + * Function: H5FD_mpiposix_fapl_free * - * Purpose: Frees the mpiposix-specific file access properties. + * Purpose: Frees the mpiposix-specific file access properties. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Albert Cheng + * Programmer: Albert Cheng * Apr 24, 2003 * * Modifications: @@ -569,8 +569,8 @@ done: static herr_t H5FD_mpiposix_fapl_free(void *_fa) { - herr_t ret_value = SUCCEED; - H5FD_mpiposix_fapl_t *fa = (H5FD_mpiposix_fapl_t*)_fa; + herr_t ret_value = SUCCEED; + H5FD_mpiposix_fapl_t *fa = (H5FD_mpiposix_fapl_t*)_fa; FUNC_ENTER_NOAPI(H5FD_mpiposix_fapl_free, FAIL) assert(fa); @@ -589,11 +589,11 @@ done: * Function: H5FD_mpiposix_open * * Purpose: Opens a file with name NAME. The FLAGS are a bit field with - * purpose similar to the second argument of open(2) and which - * are defined in H5Fpublic.h. The file access property list - * FAPL_ID contains the properties driver properties and MAXADDR - * is the largest address which this file will be expected to - * access. This is collective. + * purpose similar to the second argument of open(2) and which + * are defined in H5Fpublic.h. The file access property list + * FAPL_ID contains the properties driver properties and MAXADDR + * is the largest address which this file will be expected to + * access. This is collective. * * Return: Success: A new file pointer. * Failure: NULL @@ -602,27 +602,27 @@ done: * Thursday, July 11, 2002 * * Modifications: - * Albert Cheng, 2003-04-24 - * Duplicate the communicator so that file is insulated from the - * old one. + * Albert Cheng, 2003-04-24 + * Duplicate the communicator so that file is insulated from the + * old one. * *------------------------------------------------------------------------- */ static H5FD_t * H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, - haddr_t maxaddr) + haddr_t maxaddr) { - H5FD_mpiposix_t *file=NULL; /* New MPIPOSIX file struct */ + H5FD_mpiposix_t *file=NULL; /* New MPIPOSIX file struct */ int o_flags; /* Flags for file open call */ - int fd=(-1); /* File handle for file opened */ - int mpi_rank; /* MPI rank of this process */ - int mpi_size; /* Total number of MPI processes */ - int mpi_code; /* mpi return code */ - const H5FD_mpiposix_fapl_t *fa=NULL; /* MPIPOSIX file access property list information */ - H5FD_mpiposix_fapl_t _fa; /* Private copy of default file access property list information */ + int fd=(-1); /* File handle for file opened */ + int mpi_rank; /* MPI rank of this process */ + int mpi_size; /* Total number of MPI processes */ + int mpi_code; /* mpi return code */ + const H5FD_mpiposix_fapl_t *fa=NULL; /* MPIPOSIX file access property list information */ + H5FD_mpiposix_fapl_t _fa; /* Private copy of default file access property list information */ H5P_genplist_t *plist; /* Property list pointer */ h5_stat_t sb; /* Portable 'stat' struct */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; int results; @@ -644,18 +644,18 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") if (H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_MPIPOSIX!=H5P_get_driver(plist)) { - _fa.comm = MPI_COMM_SELF; /*default*/ + _fa.comm = MPI_COMM_SELF; /*default*/ _fa.use_gpfs = FALSE; - fa = &_fa; + fa = &_fa; } /* end if */ else { - fa = H5P_get_driver_info(plist); - assert(fa); + fa = H5P_get_driver_info(plist); + assert(fa); } /* end else */ /* Duplicate the communicator for use by this file. */ if (MPI_SUCCESS != (mpi_code=MPI_Comm_dup(fa->comm, &comm_dup))) - HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) + HMPI_GOTO_ERROR(NULL, "MPI_Comm_dup failed", mpi_code) /* Get the MPI rank of this process and the total number of processes */ if (MPI_SUCCESS != (mpi_code=MPI_Comm_rank (comm_dup, &mpi_rank))) @@ -756,7 +756,7 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, file->fd = fd; file->eof = sb.st_size; - /* for _WIN32 support. _WIN32 'stat' does not have st_blksize and st_blksize + /* for H5_HAVE_WIN32_API support. H5_HAVE_WIN32_API 'stat' does not have st_blksize and st_blksize is only used for the H5_HAVE_GPFS case */ #ifdef H5_HAVE_GPFS file->blksize = sb.st_blksize; @@ -775,7 +775,7 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, file->op = OP_UNKNOWN; /* Set the information for the file's device and inode */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API filehandle = _get_osfhandle(fd); results = GetFileInformationByHandle((HANDLE)filehandle, &fileinfo); file->fileindexhi = fileinfo.nFileIndexHigh; @@ -794,8 +794,8 @@ done: /* Close the file if it was left open */ if(fd!=(-1)) HDclose(fd); - if (MPI_COMM_NULL != comm_dup) - MPI_Comm_free(&comm_dup); + if (MPI_COMM_NULL != comm_dup) + MPI_Comm_free(&comm_dup); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -807,21 +807,21 @@ done: * * Purpose: Closes a file. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: - * Albert Cheng, 2003-04-24 - * Free the communicator stored. + * Albert Cheng, 2003-04-24 + * Free the communicator stored. *------------------------------------------------------------------------- */ static herr_t H5FD_mpiposix_close(H5FD_t *_file) { - H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; + H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpiposix_close, FAIL) @@ -845,16 +845,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_cmp + * Function: H5FD_mpiposix_cmp * - * Purpose: Compares two files belonging to this driver using an - * arbitrary (but consistent) ordering. + * Purpose: Compares two files belonging to this driver using an + * arbitrary (but consistent) ordering. * - * Return: Success: A value like strcmp() - * Failure: never fails (arguments were checked by the - * caller). + * Return: Success: A value like strcmp() + * Failure: never fails (arguments were checked by the + * caller). * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -864,13 +864,13 @@ done: static int H5FD_mpiposix_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { - const H5FD_mpiposix_t *f1 = (const H5FD_mpiposix_t*)_f1; - const H5FD_mpiposix_t *f2 = (const H5FD_mpiposix_t*)_f2; + const H5FD_mpiposix_t *f1 = (const H5FD_mpiposix_t*)_f1; + const H5FD_mpiposix_t *f2 = (const H5FD_mpiposix_t*)_f2; int ret_value=0; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_mpiposix_cmp) -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) @@ -900,15 +900,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_query + * Function: H5FD_mpiposix_query * - * Purpose: Set the flags that this VFL driver is capable of supporting. + * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -916,8 +916,8 @@ done: * John Mainzer -- 9/21/05 * Modified code to turn off the * H5FD_FEAT_ACCUMULATE_METADATA_WRITE flag. - * With the movement of all cache writes to process 0, - * this flag has become problematic in PHDF5. + * With the movement of all cache writes to process 0, + * this flag has become problematic in PHDF5. * *------------------------------------------------------------------------- */ @@ -943,16 +943,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_get_eoa + * Function: H5FD_mpiposix_get_eoa * - * Purpose: Gets the end-of-address marker for the file. The EOA marker - * is the first address past the last byte allocated in the - * format address space. + * Purpose: Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. * - * Return: Success: The end-of-address marker. - * Failure: HADDR_UNDEF + * Return: Success: The end-of-address marker. + * Failure: HADDR_UNDEF * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -982,16 +982,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_set_eoa + * Function: H5FD_mpiposix_set_eoa * - * Purpose: Set the end-of-address marker for the file. This function is - * called shortly after an existing HDF5 file is opened in order - * to tell the driver where the end of the HDF5 data is located. + * Purpose: Set the end-of-address marker for the file. This function is + * called shortly after an existing HDF5 file is opened in order + * to tell the driver where the end of the HDF5 data is located. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -1004,7 +1004,7 @@ done: static herr_t H5FD_mpiposix_set_eoa(H5FD_t *_file, H5FD_mem_t UNUSED type, haddr_t addr) { - H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; + H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpiposix_set_eoa, FAIL) @@ -1020,21 +1020,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_get_eof + * Function: H5FD_mpiposix_get_eof * - * Purpose: Gets the end-of-file marker for the file. The EOF marker - * is the real size of the file. + * Purpose: Gets the end-of-file marker for the file. The EOF marker + * is the real size of the file. * - * The MPIPOSIX driver doesn't bother keeping this field updated - * since that's a relatively expensive operation. Fortunately - * the library only needs the EOF just after the file is opened - * in order to determine whether the file is empty, truncated, - * or okay. + * The MPIPOSIX driver doesn't bother keeping this field updated + * since that's a relatively expensive operation. Fortunately + * the library only needs the EOF just after the file is opened + * in order to determine whether the file is empty, truncated, + * or okay. * - * Return: Success: The end-of-address marker. - * Failure: HADDR_UNDEF + * Return: Success: The end-of-address marker. + * Failure: HADDR_UNDEF * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -1044,7 +1044,7 @@ done: static haddr_t H5FD_mpiposix_get_eof(const H5FD_t *_file) { - const H5FD_mpiposix_t *file = (const H5FD_mpiposix_t*)_file; + const H5FD_mpiposix_t *file = (const H5FD_mpiposix_t*)_file; haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpiposix_get_eof, HADDR_UNDEF) @@ -1093,21 +1093,21 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_read + * Function: H5FD_mpiposix_read * - * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR - * into buffer BUF according to data transfer properties in - * DXPL_ID using potentially complex file and buffer types to - * effect the transfer. + * Purpose: Reads SIZE bytes of data from FILE beginning at address ADDR + * into buffer BUF according to data transfer properties in + * DXPL_ID using potentially complex file and buffer types to + * effect the transfer. * - * Reading past the end of the file returns zeros instead of - * failing. + * Reading past the end of the file returns zeros instead of + * failing. * - * Return: Success: Non-negative. Result is stored in caller-supplied - * buffer BUF. - * Failure: Negative, Contents of buffer BUF are undefined. + * Return: Success: Non-negative. Result is stored in caller-supplied + * buffer BUF. + * Failure: Negative, Contents of buffer BUF are undefined. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -1116,11 +1116,11 @@ done: */ static herr_t H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr, size_t size, - void *buf/*out*/) + void *buf/*out*/) { - H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; - ssize_t nbytes; /* Number of bytes read each I/O call */ - herr_t ret_value=SUCCEED; + H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; + ssize_t nbytes; /* Number of bytes read each I/O call */ + herr_t ret_value=SUCCEED; FUNC_ENTER_NOAPI(H5FD_mpiposix_read, FAIL) @@ -1189,17 +1189,17 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_write + * Function: H5FD_mpiposix_write * - * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR - * from buffer BUF according to data transfer properties in - * DXPL_ID using potentially complex file and buffer types to - * effect the transfer. + * Purpose: Writes SIZE bytes of data to FILE beginning at address ADDR + * from buffer BUF according to data transfer properties in + * DXPL_ID using potentially complex file and buffer types to + * effect the transfer. * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -1214,15 +1214,15 @@ done: */ static herr_t H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, - size_t size, const void *buf) + size_t size, const void *buf) { - H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; + H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; #if 0 /* JRM */ - int mpi_code; /* MPI return code */ + int mpi_code; /* MPI return code */ #endif /* JRM */ - ssize_t nbytes; /* Number of bytes written each I/O call */ + ssize_t nbytes; /* Number of bytes written each I/O call */ H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5FD_mpiposix_write, FAIL) @@ -1251,10 +1251,10 @@ H5FD_mpiposix_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, * writes between processes, but we should really just flag an error * whenever any process other than process 0 attempts to write * metadata. - * -- JRM 9/1/05 + * -- JRM 9/1/05 */ if(type!=H5FD_MEM_DRAW) { - unsigned block_before_meta_write=0; /* Whether to block before a metadata write */ + unsigned block_before_meta_write=0; /* Whether to block before a metadata write */ /* Check if we need to syncronize all processes before attempting metadata write * (Prevents race condition where the process writing the metadata goes ahead @@ -1352,11 +1352,11 @@ done: } /* end if */ #if 0 /* JRM */ /* Since metadata writes are now done by process 0 only, this broadcast - * is no longer needed. I leave it in and commented out to remind us - * that we need to re-work this function to reflect this reallity. - * - * -- JRM 9/1/05 - */ + * is no longer needed. I leave it in and commented out to remind us + * that we need to re-work this function to reflect this reallity. + * + * -- JRM 9/1/05 + */ /* Guard against getting into metadata broadcast in failure cases */ else { @@ -1375,11 +1375,11 @@ done: /*------------------------------------------------------------------------- * Function: H5FD_mpiposix_truncate * - * Purpose: Makes sure that the true file size is the same (or larger) - * than the end-of-address. + * Purpose: Makes sure that the true file size is the same (or larger) + * than the end-of-address. * - * Return: Success: Non-negative - * Failure: Negative + * Return: Success: Non-negative + * Failure: Negative * * Programmer: Quincey Koziol * Thursday, July 11, 2002 @@ -1389,12 +1389,12 @@ done: static herr_t H5FD_mpiposix_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) { - H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; -#ifdef _WIN32 + H5FD_mpiposix_t *file = (H5FD_mpiposix_t*)_file; +#ifdef H5_HAVE_WIN32_API HFILE filehandle; /* Windows file handle */ LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */ -#endif /* _WIN32 */ - int mpi_code; /* MPI return code */ +#endif /* H5_HAVE_WIN32_API */ + int mpi_code; /* MPI return code */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(H5FD_mpiposix_truncate, FAIL) @@ -1406,7 +1406,7 @@ H5FD_mpiposix_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closi if(file->eoa > file->last_eoa) { /* Use the round-robin process to truncate (extend) the file */ if(file->mpi_rank == H5_PAR_META_WRITE) { -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API /* Map the posix file handle to a Windows file handle */ filehandle = _get_osfhandle(file->fd); @@ -1416,10 +1416,10 @@ H5FD_mpiposix_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closi SetFilePointer((HANDLE)filehandle, li.LowPart, &li.HighPart, FILE_BEGIN); if(SetEndOfFile((HANDLE)filehandle) == 0) HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ if(-1==file_truncate(file->fd, (file_offset_t)file->eoa)) HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ } /* end if */ /* Don't let any proc return until all have extended the file. @@ -1446,14 +1446,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_mpi_rank + * Function: H5FD_mpiposix_mpi_rank * - * Purpose: Returns the MPI rank for a process + * Purpose: Returns the MPI rank for a process * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -1480,14 +1480,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_mpi_size + * Function: H5FD_mpiposix_mpi_size * - * Purpose: Returns the number of MPI processes + * Purpose: Returns the number of MPI processes * - * Return: Success: non-negative - * Failure: negative + * Return: Success: non-negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: @@ -1514,15 +1514,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5FD_mpiposix_communicator + * Function: H5FD_mpiposix_communicator * - * Purpose: Returns the MPI communicator for the file. + * Purpose: Returns the MPI communicator for the file. * - * Return: Success: The communicator + * Return: Success: The communicator * - * Failure: NULL + * Failure: NULL * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Thursday, July 11, 2002 * * Modifications: diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 7908fd9..3618474 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -62,7 +62,7 @@ typedef struct H5FD_sec2_t { haddr_t pos; /*current file I/O position */ H5FD_file_op_t op; /*last operation */ char filename[H5FD_MAX_FILENAME_LEN]; /* Copy of file name from open operation */ -#ifndef _WIN32 +#ifndef H5_HAVE_WIN32_API /* * On most systems the combination of device and i-node number uniquely * identify a file. @@ -75,7 +75,7 @@ typedef struct H5FD_sec2_t { #endif /*H5_VMS*/ #else /* - * On _WIN32 the low-order word of a unique identifier associated with the + * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the * file and the volume serial number uniquely identify a file. This number * (which, both? -rpm) may change when the system is restarted or when the * file is opened. After a process opens a file, the identifier is @@ -314,7 +314,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5FD_sec2_t *file = NULL; /* sec2 VFD info */ int fd = (-1); /* File descriptor */ int o_flags; /* Flags for open() call */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif @@ -360,12 +360,12 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5_ASSIGN_OVERFLOW(file->eof, sb.st_size, h5_stat_size_t, haddr_t); file->pos = HADDR_UNDEF; file->op = OP_UNKNOWN; -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API filehandle = _get_osfhandle(fd); (void)GetFileInformationByHandle((HANDLE)filehandle, &fileinfo); file->fileindexhi = fileinfo.nFileIndexHigh; file->fileindexlo = fileinfo.nFileIndexLow; -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ file->device = sb.st_dev; #ifdef H5_VMS file->inode[0] = sb.st_ino[0]; @@ -375,7 +375,7 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) file->inode = sb.st_ino; #endif /*H5_VMS*/ -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ /* Retain a copy of the name used to open the file, for possible error reporting */ HDstrncpy(file->filename, name, sizeof(file->filename)); @@ -474,7 +474,7 @@ H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_sec2_cmp) -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API if(f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1) if(f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1) @@ -861,7 +861,7 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) /* Extend the file to make sure it's large enough */ if(!H5F_addr_eq(file->eoa, file->eof)) { -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; /* Windows file handle */ LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */ @@ -874,7 +874,7 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) (void)SetFilePointer((HANDLE)filehandle, li.LowPart, &li.HighPart, FILE_BEGIN); if(SetEndOfFile((HANDLE)filehandle) == 0) HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ #ifdef H5_VMS /* Reset seek offset to the beginning of the file, so that the file isn't * re-extended later. This may happen on Open VMS. */ @@ -884,7 +884,7 @@ H5FD_sec2_truncate(H5FD_t *_file, hid_t UNUSED dxpl_id, hbool_t UNUSED closing) if(-1 == HDftruncate(file->fd, (HDoff_t)file->eoa)) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ /* Update the eof value */ file->eof = file->eoa; diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 4c53769..b67e01e 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -14,12 +14,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke <matzke@llnl.gov> - * Wednesday, October 22, 1997 + * Programmer: Robb Matzke <matzke@llnl.gov> + * Wednesday, October 22, 1997 * - * Purpose: This is the Posix stdio.h I/O subclass of H5Flow. - * It also serves as an example of coding a simple file driver, - * therefore, it should not use any non-public definitions. + * Purpose: This is the Posix stdio.h I/O subclass of H5Flow. + * It also serves as an example of coding a simple file driver, + * therefore, it should not use any non-public definitions. * * Notes: Ported to the new H5FD architecture on 10/18/99 - QAK * @@ -43,7 +43,7 @@ #include <unistd.h> #endif -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API #include <windows.h> #include <io.h> @@ -58,7 +58,7 @@ #ifdef MAX #undef MAX #endif /* MAX */ -#define MAX(X,Y) ((X)>(Y)?(X):(Y)) +#define MAX(X,Y) ((X)>(Y)?(X):(Y)) /* The driver identification number, initialized at runtime */ static hid_t H5FD_STDIO_g = 0; @@ -84,23 +84,23 @@ typedef enum { * occurs), and `op' will be set to H5F_OP_UNKNOWN. */ typedef struct H5FD_stdio_t { - H5FD_t pub; /*public stuff, must be first */ - FILE * fp; /*the file handle */ - haddr_t eoa; /*end of allocated region */ - haddr_t eof; /*end of file; current file size*/ - haddr_t pos; /*current file I/O position */ - H5FD_stdio_file_op op; /*last operation */ + H5FD_t pub; /*public stuff, must be first */ + FILE * fp; /*the file handle */ + haddr_t eoa; /*end of allocated region */ + haddr_t eof; /*end of file; current file size*/ + haddr_t pos; /*current file I/O position */ + H5FD_stdio_file_op op; /*last operation */ unsigned write_access; /* Flag to indicate the file was opened with write access */ -#ifndef _WIN32 +#ifndef H5_HAVE_WIN32_API /* * On most systems the combination of device and i-node number uniquely * identify a file. */ - dev_t device; /*file device number */ - ino_t inode; /*file i-node number */ + dev_t device; /*file device number */ + ino_t inode; /*file i-node number */ #else /* - * On _WIN32 the low-order word of a unique identifier associated with the + * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the * file and the volume serial number uniquely identify a file. This number * (which, both? -rpm) may change when the system is restarted or when the * file is opened. After a process opens a file, the identifier is @@ -114,18 +114,11 @@ typedef struct H5FD_stdio_t { } H5FD_stdio_t; /* Use similar structure as in H5private.h by defining Windows stuff first. */ -#ifdef _WIN32 - #if _MSC_VER > 1310 /* Newer than VS.NET 2003 */ - # define file_fseek _fseeki64 - # define file_offset_t __int64 - # define file_ftruncate _chsize_s /* Supported in VS 2005 or newer */ - # define file_ftell _ftelli64 - #else - # define file_fseek fseek - # define file_offset_t long - # define file_ftruncate _chsize - # define file_ftell ftell - #endif +#ifdef H5_HAVE_WIN32_API + # define file_fseek _fseeki64 + # define file_offset_t __int64 + # define file_ftruncate _chsize_s /* Supported in VS 2005 or newer */ + # define file_ftell _ftelli64 #endif /* Use file_xxx to indicate these are local macros, avoiding confusing @@ -135,15 +128,15 @@ typedef struct H5FD_stdio_t { */ #ifndef file_fseek #ifdef H5_HAVE_FSEEKO64 - # define file_fseek fseeko64 - # define file_offset_t off64_t - # define file_ftruncate ftruncate64 - # define file_ftell ftello64 + # define file_fseek fseeko64 + # define file_offset_t off64_t + # define file_ftruncate ftruncate64 + # define file_ftell ftello64 #else - # define file_fseek fseeko - # define file_offset_t off_t - # define file_ftruncate ftruncate - # define file_ftell ftello + # define file_fseek fseeko + # define file_offset_t off_t + # define file_ftruncate ftruncate + # define file_ftell ftello #endif #endif @@ -151,22 +144,22 @@ typedef struct H5FD_stdio_t { * These macros check for overflow of various quantities. These macros * assume that file_offset_t is signed and haddr_t and size_t are unsigned. * - * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' - * is too large to be represented by the second argument - * of the file seek function. + * ADDR_OVERFLOW: Checks whether a file address of type `haddr_t' + * is too large to be represented by the second argument + * of the file seek function. * - * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too - * large to be represented by the `size_t' type. + * SIZE_OVERFLOW: Checks whether a buffer size of type `hsize_t' is too + * large to be represented by the `size_t' type. * - * REGION_OVERFLOW: Checks whether an address and size pair describe data - * which can be addressed entirely by the second - * argument of the file seek function. + * REGION_OVERFLOW: Checks whether an address and size pair describe data + * which can be addressed entirely by the second + * argument of the file seek function. */ /* adding for windows NT filesystem support. */ #define MAXADDR (((haddr_t)1<<(8*sizeof(file_offset_t)-1))-1) -#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) -#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) -#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ +#define ADDR_OVERFLOW(A) (HADDR_UNDEF==(A) || ((A) & ~(haddr_t)MAXADDR)) +#define SIZE_OVERFLOW(Z) ((Z) & ~(hsize_t)MAXADDR) +#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \ HADDR_UNDEF==(A)+(Z) || (file_offset_t)((A)+(Z))<(file_offset_t)(A)) /* Prototypes */ @@ -189,52 +182,52 @@ static herr_t H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing); static herr_t H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); static const H5FD_class_t H5FD_stdio_g = { - "stdio", /*name */ - MAXADDR, /*maxaddr */ - H5F_CLOSE_WEAK, /* fc_degree */ + "stdio", /*name */ + MAXADDR, /*maxaddr */ + H5F_CLOSE_WEAK, /* fc_degree */ H5FD_stdio_term, /*terminate */ - NULL, /*sb_size */ - NULL, /*sb_encode */ - NULL, /*sb_decode */ - 0, /*fapl_size */ - NULL, /*fapl_get */ - NULL, /*fapl_copy */ - NULL, /*fapl_free */ - 0, /*dxpl_size */ - NULL, /*dxpl_copy */ - NULL, /*dxpl_free */ - H5FD_stdio_open, /*open */ - H5FD_stdio_close, /*close */ - H5FD_stdio_cmp, /*cmp */ - H5FD_stdio_query, /*query */ - NULL, /*get_type_map */ - H5FD_stdio_alloc, /*alloc */ - NULL, /*free */ - H5FD_stdio_get_eoa, /*get_eoa */ - H5FD_stdio_set_eoa, /*set_eoa */ - H5FD_stdio_get_eof, /*get_eof */ + NULL, /*sb_size */ + NULL, /*sb_encode */ + NULL, /*sb_decode */ + 0, /*fapl_size */ + NULL, /*fapl_get */ + NULL, /*fapl_copy */ + NULL, /*fapl_free */ + 0, /*dxpl_size */ + NULL, /*dxpl_copy */ + NULL, /*dxpl_free */ + H5FD_stdio_open, /*open */ + H5FD_stdio_close, /*close */ + H5FD_stdio_cmp, /*cmp */ + H5FD_stdio_query, /*query */ + NULL, /*get_type_map */ + H5FD_stdio_alloc, /*alloc */ + NULL, /*free */ + H5FD_stdio_get_eoa, /*get_eoa */ + H5FD_stdio_set_eoa, /*set_eoa */ + H5FD_stdio_get_eof, /*get_eof */ H5FD_stdio_get_handle, /*get_handle */ - H5FD_stdio_read, /*read */ - H5FD_stdio_write, /*write */ - H5FD_stdio_flush, /*flush */ - H5FD_stdio_truncate, /*truncate */ + H5FD_stdio_read, /*read */ + H5FD_stdio_write, /*write */ + H5FD_stdio_flush, /*flush */ + H5FD_stdio_truncate, /*truncate */ NULL, /*lock */ NULL, /*unlock */ - H5FD_FLMAP_SINGLE /*fl_map */ + H5FD_FLMAP_SINGLE /*fl_map */ }; /*------------------------------------------------------------------------- - * Function: H5FD_stdio_init + * Function: H5FD_stdio_init * - * Purpose: Initialize this driver by registering the driver with the - * library. + * Purpose: Initialize this driver by registering the driver with the + * library. * - * Return: Success: The driver ID for the stdio driver. + * Return: Success: The driver ID for the stdio driver. * - * Failure: Negative. + * Failure: Negative. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * * Modifications: @@ -255,9 +248,9 @@ H5FD_stdio_init(void) /*--------------------------------------------------------------------------- - * Function: H5FD_stdio_term + * Function: H5FD_stdio_term * - * Purpose: Shut down the VFD + * Purpose: Shut down the VFD * * Returns: Non-negative on success or negative on failure * @@ -277,16 +270,16 @@ H5FD_stdio_term(void) /*------------------------------------------------------------------------- - * Function: H5Pset_fapl_stdio + * Function: H5Pset_fapl_stdio * - * Purpose: Modify the file access property list to use the H5FD_STDIO - * driver defined in this source file. There are no driver - * specific properties. + * Purpose: Modify the file access property list to use the H5FD_STDIO + * driver defined in this source file. There are no driver + * specific properties. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, February 19, 1998 + * Programmer: Robb Matzke + * Thursday, February 19, 1998 * * Modifications: * Stolen from the sec2 driver - QAK, 10/18/99 @@ -311,27 +304,27 @@ H5Pset_fapl_stdio(hid_t fapl_id) /*------------------------------------------------------------------------- - * Function: H5FD_stdio_open + * Function: H5FD_stdio_open * - * Purpose: Create and/or opens a Standard C file as an HDF5 file. + * Purpose: Create and/or opens a Standard C file as an HDF5 file. * - * Bugs: H5F_ACC_EXCL has a race condition. (? -QAK) + * Bugs: H5F_ACC_EXCL has a race condition. (? -QAK) * * Errors: - * IO CANTOPENFILE File doesn't exist and CREAT wasn't - * specified. - * IO CANTOPENFILE Fopen failed. - * IO FILEEXISTS File exists but CREAT and EXCL were - * specified. + * IO CANTOPENFILE File doesn't exist and CREAT wasn't + * specified. + * IO CANTOPENFILE Fopen failed. + * IO FILEEXISTS File exists but CREAT and EXCL were + * specified. * - * Return: Success: A pointer to a new file data structure. The - * public fields will be initialized by the - * caller, which is always H5FD_open(). + * Return: Success: A pointer to a new file data structure. The + * public fields will be initialized by the + * caller, which is always H5FD_open(). * - * Failure: NULL + * Failure: NULL * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 + * Programmer: Robb Matzke + * Wednesday, October 22, 1997 * * Modifications: * Ported to VFL/H5FD layer - QAK, 10/18/99 @@ -342,17 +335,17 @@ static H5FD_t * H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - FILE *f = NULL; + FILE *f = NULL; unsigned write_access=0; /* File opened with write access? */ - H5FD_stdio_t *file=NULL; + H5FD_stdio_t *file=NULL; static const char *func="H5FD_stdio_open"; /* Function Name for error reporting */ -#ifdef _WIN32 - HFILE filehandle; - struct _BY_HANDLE_FILE_INFORMATION fileinfo; +#ifdef H5_HAVE_WIN32_API + HFILE filehandle; + struct _BY_HANDLE_FILE_INFORMATION fileinfo; int fd; -#else /* _WIN32 */ - struct stat sb; -#endif /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ + struct stat sb; +#endif /* H5_HAVE_WIN32_API */ /* Sanity check on file offsets */ assert(sizeof(file_offset_t)>=sizeof(size_t)); @@ -410,7 +403,7 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, } /* The unique key */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API /*#error "Needs correct fileindexhi & fileindexlo, code below is from sec2 driver"*/ fd = _fileno(f); filehandle = _get_osfhandle(fd); @@ -427,17 +420,17 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, /*------------------------------------------------------------------------- - * Function: H5F_stdio_close + * Function: H5F_stdio_close * - * Purpose: Closes a file. + * Purpose: Closes a file. * * Errors: - * IO CLOSEERROR Fclose failed. + * IO CLOSEERROR Fclose failed. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 + * Programmer: Robb Matzke + * Wednesday, October 22, 1997 * * Modifications: * Ported to VFL/H5FD layer - QAK, 10/18/99 @@ -447,7 +440,7 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, static herr_t H5FD_stdio_close(H5FD_t *_file) { - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func="H5FD_stdio_close"; /* Function Name for error reporting */ /* Clear the error stack */ @@ -463,17 +456,17 @@ H5FD_stdio_close(H5FD_t *_file) /*------------------------------------------------------------------------- - * Function: H5FD_stdio_cmp + * Function: H5FD_stdio_cmp * - * Purpose: Compares two files belonging to this driver using an - * arbitrary (but consistent) ordering. + * Purpose: Compares two files belonging to this driver using an + * arbitrary (but consistent) ordering. * - * Return: Success: A value like strcmp() + * Return: Success: A value like strcmp() * - * Failure: never fails (arguments were checked by the - * caller). + * Failure: never fails (arguments were checked by the + * caller). * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * * Modifications: @@ -484,13 +477,13 @@ H5FD_stdio_close(H5FD_t *_file) static int H5FD_stdio_cmp(const H5FD_t *_f1, const H5FD_t *_f2) { - const H5FD_stdio_t *f1 = (const H5FD_stdio_t*)_f1; - const H5FD_stdio_t *f2 = (const H5FD_stdio_t*)_f2; + const H5FD_stdio_t *f1 = (const H5FD_stdio_t*)_f1; + const H5FD_stdio_t *f2 = (const H5FD_stdio_t*)_f2; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API if (f1->fileindexhi < f2->fileindexhi) return -1; if (f1->fileindexhi > f2->fileindexhi) return 1; @@ -518,16 +511,16 @@ H5FD_stdio_cmp(const H5FD_t *_f1, const H5FD_t *_f2) /*------------------------------------------------------------------------- - * Function: H5FD_stdio_query + * Function: H5FD_stdio_query * - * Purpose: Set the flags that this VFL driver is capable of supporting. + * Purpose: Set the flags that this VFL driver is capable of supporting. * (listed in H5FDpublic.h) * - * Return: Success: non-negative + * Return: Success: non-negative * - * Failure: negative + * Failure: negative * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, August 25, 2000 * * Modifications: @@ -554,18 +547,18 @@ H5FD_stdio_query(const H5FD_t *_f, unsigned long *flags /* out */) /*------------------------------------------------------------------------- - * Function: H5FD_stdio_alloc + * Function: H5FD_stdio_alloc * - * Purpose: Allocates file memory. If fseeko isn't available, makes + * Purpose: Allocates file memory. If fseeko isn't available, makes * sure the file size isn't bigger than 2GB because the * parameter OFFSET of fseek is of the type LONG INT, limiting * the file size to 2GB. * - * Return: Success: Address of new memory + * Return: Success: Address of new memory * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Raymond Lu + * Programmer: Raymond Lu * 30 March 2007 * * Modifications: @@ -575,8 +568,8 @@ H5FD_stdio_query(const H5FD_t *_f, unsigned long *flags /* out */) static haddr_t H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl_id, hsize_t size) { - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; - haddr_t addr; + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + haddr_t addr; haddr_t ret_value; /* Return value */ /* Shut compiler up */ @@ -606,17 +599,17 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp /*------------------------------------------------------------------------- - * Function: H5FD_stdio_get_eoa + * Function: H5FD_stdio_get_eoa * - * Purpose: Gets the end-of-address marker for the file. The EOA marker - * is the first address past the last byte allocated in the - * format address space. + * Purpose: Gets the end-of-address marker for the file. The EOA marker + * is the first address past the last byte allocated in the + * format address space. * - * Return: Success: The end-of-address marker. + * Return: Success: The end-of-address marker. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, August 2, 1999 * * Modifications: @@ -631,7 +624,7 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp static haddr_t H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*unused*/ type) { - const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; + const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -644,17 +637,17 @@ H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*unused*/ type) /*------------------------------------------------------------------------- - * Function: H5FD_stdio_set_eoa + * Function: H5FD_stdio_set_eoa * - * Purpose: Set the end-of-address marker for the file. This function is - * called shortly after an existing HDF5 file is opened in order - * to tell the driver where the end of the HDF5 data is located. + * Purpose: Set the end-of-address marker for the file. This function is + * called shortly after an existing HDF5 file is opened in order + * to tell the driver where the end of the HDF5 data is located. * - * Return: Success: 0 + * Return: Success: 0 * - * Failure: -1 + * Failure: -1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * * Modifications: @@ -668,7 +661,7 @@ H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*unused*/ type) static herr_t H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*unused*/ type, haddr_t addr) { - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -683,19 +676,19 @@ H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*unused*/ type, haddr_t addr) /*------------------------------------------------------------------------- - * Function: H5FD_stdio_get_eof + * Function: H5FD_stdio_get_eof * - * Purpose: Returns the end-of-file marker, which is the greater of - * either the Unix end-of-file or the HDF5 end-of-address - * markers. + * Purpose: Returns the end-of-file marker, which is the greater of + * either the Unix end-of-file or the HDF5 end-of-address + * markers. * - * Return: Success: End of file address, the first address past - * the end of the "file", either the Unix file - * or the HDF5 file. + * Return: Success: End of file address, the first address past + * the end of the "file", either the Unix file + * or the HDF5 file. * - * Failure: HADDR_UNDEF + * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Thursday, July 29, 1999 * * Modifications: @@ -706,7 +699,7 @@ H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*unused*/ type, haddr_t addr) static haddr_t H5FD_stdio_get_eof(const H5FD_t *_file) { - const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; + const H5FD_stdio_t *file = (const H5FD_stdio_t *)_file; /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -749,24 +742,24 @@ H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) /*------------------------------------------------------------------------- - * Function: H5F_stdio_read + * Function: H5F_stdio_read * - * Purpose: Reads SIZE bytes beginning at address ADDR in file LF and - * places them in buffer BUF. Reading past the logical or - * physical end of file returns zeros instead of failing. + * Purpose: Reads SIZE bytes beginning at address ADDR in file LF and + * places them in buffer BUF. Reading past the logical or + * physical end of file returns zeros instead of failing. * * Errors: - * IO READERROR Fread failed. - * IO SEEKERROR Fseek failed. + * IO READERROR Fread failed. + * IO SEEKERROR Fseek failed. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 + * Programmer: Robb Matzke + * Wednesday, October 22, 1997 * * Modifications: - * June 2, 1998 Albert Cheng - * Added xfer_mode argument + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * * Ported to VFL/H5FD layer - QAK, 10/18/99 * @@ -776,8 +769,8 @@ static herr_t H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/) { - size_t n; - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + size_t n; + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func="H5FD_stdio_read"; /* Function Name for error reporting */ /* Shut compiler up */ @@ -849,23 +842,23 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz /*------------------------------------------------------------------------- - * Function: H5F_stdio_write + * Function: H5F_stdio_write * - * Purpose: Writes SIZE bytes from the beginning of BUF into file LF at - * file address ADDR. + * Purpose: Writes SIZE bytes from the beginning of BUF into file LF at + * file address ADDR. * * Errors: - * IO SEEKERROR Fseek failed. - * IO WRITEERROR Fwrite failed. + * IO SEEKERROR Fseek failed. + * IO WRITEERROR Fwrite failed. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 + * Programmer: Robb Matzke + * Wednesday, October 22, 1997 * * Modifications: - * June 2, 1998 Albert Cheng - * Added xfer_mode argument + * June 2, 1998 Albert Cheng + * Added xfer_mode argument * * Ported to VFL/H5FD layer - QAK, 10/18/99 * @@ -873,9 +866,9 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz */ static herr_t H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, - size_t size, const void *buf) + size_t size, const void *buf) { - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func="H5FD_stdio_write"; /* Function Name for error reporting */ /* Shut compiler up */ @@ -932,25 +925,25 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, /*------------------------------------------------------------------------- - * Function: H5F_stdio_flush + * Function: H5F_stdio_flush * - * Purpose: Makes sure that all data is on disk. + * Purpose: Makes sure that all data is on disk. * * Errors: - * IO SEEKERROR fseek failed. - * IO WRITEERROR fflush or fwrite failed. + * IO SEEKERROR fseek failed. + * IO WRITEERROR fflush or fwrite failed. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 + * Programmer: Robb Matzke + * Wednesday, October 22, 1997 * *------------------------------------------------------------------------- */ static herr_t H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) { - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func = "H5FD_stdio_flush"; /* Function Name for error reporting */ /* Shut compiler up */ @@ -977,29 +970,29 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing) /*------------------------------------------------------------------------- - * Function: H5F_stdio_truncate + * Function: H5F_stdio_truncate * - * Purpose: Makes sure that the true file size is the same (or larger) - * than the end-of-address. + * Purpose: Makes sure that the true file size is the same (or larger) + * than the end-of-address. * * Errors: - * IO SEEKERROR fseek failed. - * IO WRITEERROR fflush or fwrite failed. + * IO SEEKERROR fseek failed. + * IO WRITEERROR fflush or fwrite failed. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 31, 2008 + * Programmer: Quincey Koziol + * Thursday, January 31, 2008 * * Modifications: - * Vailin Choi; June 2010 - * Fix for window failures manifested from tests in mf.c. + * Vailin Choi; June 2010 + * Fix for window failures manifested from tests in mf.c. *------------------------------------------------------------------------- */ static herr_t H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) { - H5FD_stdio_t *file = (H5FD_stdio_t*)_file; + H5FD_stdio_t *file = (H5FD_stdio_t*)_file; static const char *func = "H5FD_stdio_truncate"; /* Function Name for error reporting */ /* Shut compiler up */ @@ -1015,11 +1008,11 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) if(file->eoa != file->eof) { int fd = fileno(file->fp); /* File descriptor for HDF5 file */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API HFILE filehandle; /* Windows file handle */ LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */ - /* Reset seek offset to beginning of file, so that file isn't re-extended later */ + /* Reset seek offset to beginning of file, so that file isn't re-extended later */ rewind(file->fp); /* Map the posix file handle to a Windows file handle */ @@ -1031,14 +1024,14 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) (void)SetFilePointer((HANDLE)filehandle, li.LowPart, &li.HighPart, FILE_BEGIN); if(SetEndOfFile((HANDLE)filehandle) == 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "unable to truncate/extend file properly", -1) -#else /* _WIN32 */ +#else /* H5_HAVE_WIN32_API */ /* Reset seek offset to beginning of file, so that file isn't re-extended later */ rewind(file->fp); /* Truncate file to proper length */ if(-1 == file_ftruncate(fd, (file_offset_t)file->eoa)) H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "unable to truncate/extend file properly", -1) -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ /* Update the eof value */ file->eof = file->eoa; diff --git a/src/H5FDwindows.c b/src/H5FDwindows.c index de3fe33..fbd13ea 100644 --- a/src/H5FDwindows.c +++ b/src/H5FDwindows.c @@ -81,7 +81,7 @@ typedef struct H5FD_windows_t { int op; /*last operation */ unsigned write_access; /*flag to indicate the file was opened with write access */ /* - * On _WIN32 the low-order word of a unique identifier associated with the + * On H5_HAVE_WIN32_API the low-order word of a unique identifier associated with the * file and the volume serial number uniquely identify a file. This number * may change when the system is restarted or when the * file is opened. After a process opens a file, the identifier is @@ -14,9 +14,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* private headers */ -#include "H5private.h" /*library */ -#include "H5Eprivate.h" /*error handling */ -#include "H5MMprivate.h" /*memory management functions */ +#include "H5private.h" /*library */ +#include "H5Eprivate.h" /*error handling */ +#include "H5MMprivate.h" /*memory management functions */ #ifdef H5_HAVE_THREADSAFE @@ -127,7 +127,7 @@ H5TS_pthread_first_thread_init(void) { H5_g.H5_libinit_g = FALSE; -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API # ifdef PTW32_STATIC_LIB pthread_win32_process_attach_np(); # endif @@ -177,7 +177,7 @@ H5TS_pthread_first_thread_init(void) herr_t H5TS_mutex_lock(H5TS_mutex_t *mutex) { -#ifdef H5_HAVE_WIN_THREADS +#ifdef H5_HAVE_WIN_THREADS EnterCriticalSection( &mutex->CriticalSection); return 0; #else /* H5_HAVE_WIN_THREADS */ @@ -232,7 +232,7 @@ H5TS_mutex_lock(H5TS_mutex_t *mutex) herr_t H5TS_mutex_unlock(H5TS_mutex_t *mutex) { -#ifdef H5_HAVE_WIN_THREADS +#ifdef H5_HAVE_WIN_THREADS /* Releases ownership of the specified critical section object. */ LeaveCriticalSection(&mutex->CriticalSection); return 0; @@ -291,7 +291,7 @@ H5TS_mutex_unlock(H5TS_mutex_t *mutex) herr_t H5TS_cancel_count_inc(void) { -#ifdef H5_HAVE_WIN_THREADS +#ifdef H5_HAVE_WIN_THREADS /* unsupported; just return 0 */ return SUCCEED; #else /* H5_HAVE_WIN_THREADS */ @@ -302,25 +302,25 @@ H5TS_cancel_count_inc(void) if (!cancel_counter) { /* - * First time thread calls library - create new counter and associate + * First time thread calls library - create new counter and associate * with key */ - cancel_counter = (H5TS_cancel_t *)H5MM_calloc(sizeof(H5TS_cancel_t)); + cancel_counter = (H5TS_cancel_t *)H5MM_calloc(sizeof(H5TS_cancel_t)); - if (!cancel_counter) { - H5E_push_stack(NULL, "H5TS_cancel_count_inc", - __FILE__, __LINE__, H5E_ERR_CLS_g, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed"); - return FAIL; - } + if (!cancel_counter) { + H5E_push_stack(NULL, "H5TS_cancel_count_inc", + __FILE__, __LINE__, H5E_ERR_CLS_g, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed"); + return FAIL; + } ret_value = pthread_setspecific(H5TS_cancel_key_g, - (void *)cancel_counter); + (void *)cancel_counter); } if (cancel_counter->cancel_count == 0) /* thread entering library */ ret_value = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, - &cancel_counter->previous_state); + &cancel_counter->previous_state); ++cancel_counter->cancel_count; @@ -358,7 +358,7 @@ H5TS_cancel_count_inc(void) herr_t H5TS_cancel_count_dec(void) { -#ifdef H5_HAVE_WIN_THREADS +#ifdef H5_HAVE_WIN_THREADS /* unsupported; will just return 0 */ return SUCCEED; #else /* H5_HAVE_WIN_THREADS */ @@ -397,7 +397,7 @@ H5TS_create_thread(void * func, H5TS_attr_t * attr, void*udata) { H5TS_thread_t ret_value; -#ifdef H5_HAVE_WIN_THREADS +#ifdef H5_HAVE_WIN_THREADS ret_value = CreateThread(NULL, 0, func, udata, 0, NULL); @@ -411,4 +411,4 @@ H5TS_create_thread(void * func, H5TS_attr_t * attr, void*udata) } /* H5TS_create_thread */ -#endif /* H5_HAVE_THREADSAFE */ +#endif /* H5_HAVE_THREADSAFE */ diff --git a/src/H5api_adpt.h b/src/H5api_adpt.h index fc0b467..845a9a0 100644 --- a/src/H5api_adpt.h +++ b/src/H5api_adpt.h @@ -303,10 +303,10 @@ * The Visual Studio project files will not be supported in the next major release of 1.10. */ -#if defined(_WIN32) +#if defined(H5_HAVE_WIN32_API) #if defined(_HDF5DLL_) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define H5_DLL __declspec(dllexport) #define H5_DLLVAR extern __declspec(dllexport) #elif defined(_HDF5USEDLL_) @@ -318,7 +318,7 @@ #endif /* _HDF5DLL_ */ #if defined(_HDF5TESTDLL_) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define H5TEST_DLL __declspec(dllexport) #define H5TEST_DLLVAR extern __declspec(dllexport) #elif defined(_HDF5TESTUSEDLL_) @@ -330,7 +330,7 @@ #endif /* _HDF5TESTDLL_ */ #if defined(_HDF5TOOLSDLL_) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define H5TOOLS_DLL __declspec(dllexport) #define H5TOOLS_DLLVAR extern __declspec(dllexport) #elif defined(_HDF5TOOLSUSEDLL_) @@ -342,7 +342,7 @@ #endif /* _HDF5TOOLSDLL_ */ #if defined(_HDF5_HLDLL_EXPORTS_) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define H5_HLDLL __declspec(dllexport) #elif defined(_HDF5USEHLDLL_) #define H5_HLDLL __declspec(dllimport) @@ -351,7 +351,7 @@ #endif /* _HDF5_HLDLL_EXPORTS */ #if defined(HDF5_HL_CPPDLL_EXPORTS) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define H5_HLCPPDLL __declspec(dllexport) #elif defined(HDF5USE_HLCPPDLL) #define H5_HLCPPDLL __declspec(dllimport) @@ -360,7 +360,7 @@ #endif /*HDF5_HL_CPPDLL_EXPORTS*/ #if defined(HDF5_HL_F90CSTUBDLL_EXPORTS) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define HDF5_HL_F90CSTUBDLL __declspec(dllexport) #elif defined(HDF5USE_HLF90CSTUBDLL) #define HDF5_HL_F90CSTUBDLL __declspec(dllimport) @@ -370,7 +370,7 @@ #if defined(HDF5FORT_CSTUB_DLL_EXPORTS) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define H5_FCDLL __declspec(dllexport) #define H5_FCDLLVAR extern __declspec(dllexport) #elif defined(HDF5FORT_CSTUB_USEDLL) @@ -382,7 +382,7 @@ #endif /* _HDF5_FORTRANDLL_EXPORTS_ */ #if defined(HDF5FORTTEST_CSTUB_DLL_EXPORTS) -#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ +#pragma warning(disable: 4273) /* Disable the dll linkage warnings */ #define H5_FCTESTDLL __declspec(dllexport) #define H5_FCTESTDLLVAR extern __declspec(dllexport) #elif defined(HDF5FORTTEST_CSTUB_USEDLL) @@ -402,7 +402,7 @@ #define H5_DLLCPP #endif /* HDF5_CPPDLL_EXPORTS */ -#else /*_WIN32*/ +#else /*H5_HAVE_WIN32_API*/ #define H5_DLL #define H5_HLDLL #define H5_HLCPPDLL @@ -417,7 +417,7 @@ #define H5_FCDLLVAR extern #define H5_FCTESTDLL #define H5_FCTESTDLLVAR extern -#endif +#endif /*H5_HAVE_WIN32_API*/ #endif /* H5API_ADPT_H */ diff --git a/src/H5private.h b/src/H5private.h index d87ad90..e6ad056 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -13,34 +13,34 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke <matzke@llnl.gov> - * Friday, October 30, 1998 +/* Programmer: Robb Matzke <matzke@llnl.gov> + * Friday, October 30, 1998 * - * Purpose: This file is included by all HDF5 library source files to - * define common things which are not defined in the HDF5 API. - * The configuration constants like H5_HAVE_UNISTD_H etc. are - * defined in H5config.h which is included by H5public.h. + * Purpose: This file is included by all HDF5 library source files to + * define common things which are not defined in the HDF5 API. + * The configuration constants like H5_HAVE_UNISTD_H etc. are + * defined in H5config.h which is included by H5public.h. * */ #ifndef _H5private_H #define _H5private_H -#include "H5public.h" /* Include Public Definitions */ +#include "H5public.h" /* Include Public Definitions */ /* include the pthread header */ #ifdef H5_HAVE_THREADSAFE - #ifdef _WIN32 + #ifdef H5_HAVE_WIN32_API #ifndef H5_HAVE_WIN_THREADS -#ifdef H5_HAVE_PTHREAD_H -#include <pthread.h> -#endif /* H5_HAVE_PTHREAD_H */ + #ifdef H5_HAVE_PTHREAD_H + #include <pthread.h> + #endif /* H5_HAVE_PTHREAD_H */ #endif /* H5_HAVE_WIN_THREADS */ - #else /* _WIN32 */ + #else /* H5_HAVE_WIN32_API */ #ifdef H5_HAVE_PTHREAD_H #include <pthread.h> #endif /* H5_HAVE_PTHREAD_H */ - #endif /* _WIN32 */ + #endif /* H5_HAVE_WIN32_API */ #endif /* H5_HAVE_THREADSAFE */ /* @@ -85,7 +85,7 @@ /* * The `struct stat' data type for stat() and fstat(). This is a Posix file - * but often apears on non-Posix systems also. The `struct stat' is required + * but often apears on non-Posix systems also. The `struct stat' is required * for hdf5 to compile, although only a few fields are actually used. */ #ifdef H5_HAVE_SYS_STAT_H @@ -127,7 +127,7 @@ #endif /* - * Unix ioctls. These are used by h5ls (and perhaps others) to determine a + * Unix ioctls. These are used by h5ls (and perhaps others) to determine a * resonable output width. */ #ifdef H5_HAVE_SYS_IOCTL_H @@ -150,8 +150,8 @@ #endif -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN /*Exclude rarely-used stuff from Windows headers */ +#ifdef H5_HAVE_WIN32_API +#define WIN32_LEAN_AND_MEAN /*Exclude rarely-used stuff from Windows headers */ #ifdef H5_HAVE_WINSOCK_H #include <winsock2.h> @@ -160,7 +160,7 @@ #include <windows.h> #include <direct.h> /* For _getcwd() */ -#endif /*_WIN32*/ +#endif /*H5_HAVE_WIN32_API*/ /* H5_inline */ #ifndef H5_inline @@ -169,7 +169,7 @@ #ifndef F_OK -# define F_OK 00 +# define F_OK 00 # define W_OK 02 # define R_OK 04 #endif @@ -207,14 +207,14 @@ * BEGIN_MPE_LOG_COLOR variant). -QAK */ #define BEGIN_MPE_LOG(func_name) \ - if (H5_MPEinit_g){ \ - if (eventa(func_name) == -1 && eventb(func_name) == -1) { \ - const char* p_color = "red"; \ + if (H5_MPEinit_g){ \ + if (eventa(func_name) == -1 && eventb(func_name) == -1) { \ + const char* p_color = "red"; \ eventa(func_name)=MPE_Log_get_event_number(); \ eventb(func_name)=MPE_Log_get_event_number(); \ MPE_Describe_state(eventa(func_name), eventb(func_name), (char *)p_end_funcname, (char *)p_color); \ } \ - MPE_Log_event(eventa(func_name), 0, (char *)p_event_start); \ + MPE_Log_event(eventa(func_name), 0, (char *)p_event_start); \ } @@ -250,23 +250,23 @@ * never be raised by the hdf5 library). */ #ifndef SIGBUS -# define SIGBUS SIGILL +# define SIGBUS SIGILL #endif /* * Does the compiler support the __attribute__(()) syntax? This is how gcc - * suppresses warnings about unused function arguments. It's no big deal if + * suppresses warnings about unused function arguments. It's no big deal if * we don't. */ #ifdef __cplusplus -# define __attribute__(X) /*void*/ -# define UNUSED /*void*/ +# define __attribute__(X) /*void*/ +# define UNUSED /*void*/ #else /* __cplusplus */ #ifdef H5_HAVE_ATTRIBUTE -# define UNUSED __attribute__((unused)) +# define UNUSED __attribute__((unused)) #else -# define __attribute__(X) /*void*/ -# define UNUSED /*void*/ +# define __attribute__(X) /*void*/ +# define UNUSED /*void*/ #endif #endif /* __cplusplus */ @@ -276,7 +276,7 @@ * string. */ #ifndef H5_HAVE_FUNCTION -# define __FUNCTION__ "NoFunctionName" +# define __FUNCTION__ "NoFunctionName" #endif /* @@ -288,48 +288,48 @@ * function, remember to compare against zero and not one of these two * values. */ -#define SUCCEED 0 -#define FAIL (-1) -#define UFAIL (unsigned)(-1) +#define SUCCEED 0 +#define FAIL (-1) +#define UFAIL (unsigned)(-1) /* number of members in an array */ #ifndef NELMTS -# define NELMTS(X) (sizeof(X)/sizeof(X[0])) +# define NELMTS(X) (sizeof(X)/sizeof(X[0])) #endif /* minimum of two, three, or four values */ #undef MIN -#define MIN(a,b) (((a)<(b)) ? (a) : (b)) -#define MIN2(a,b) MIN(a,b) -#define MIN3(a,b,c) MIN(a,MIN(b,c)) -#define MIN4(a,b,c,d) MIN(MIN(a,b),MIN(c,d)) +#define MIN(a,b) (((a)<(b)) ? (a) : (b)) +#define MIN2(a,b) MIN(a,b) +#define MIN3(a,b,c) MIN(a,MIN(b,c)) +#define MIN4(a,b,c,d) MIN(MIN(a,b),MIN(c,d)) /* maximum of two, three, or four values */ #undef MAX -#define MAX(a,b) (((a)>(b)) ? (a) : (b)) -#define MAX2(a,b) MAX(a,b) -#define MAX3(a,b,c) MAX(a,MAX(b,c)) -#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d)) +#define MAX(a,b) (((a)>(b)) ? (a) : (b)) +#define MAX2(a,b) MAX(a,b) +#define MAX3(a,b,c) MAX(a,MAX(b,c)) +#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d)) /* limit the middle value to be within a range (inclusive) */ -#define RANGE(LO,X,HI) MAX(LO,MIN(X,HI)) +#define RANGE(LO,X,HI) MAX(LO,MIN(X,HI)) /* absolute value */ #ifndef ABS -# define ABS(a) (((a)>=0) ? (a) : -(a)) +# define ABS(a) (((a)>=0) ? (a) : -(a)) #endif /* sign of argument */ #ifndef SIGN -# define SIGN(a) ((a)>0 ? 1 : (a)<0 ? -1 : 0) +# define SIGN(a) ((a)>0 ? 1 : (a)<0 ? -1 : 0) #endif /* test for number that is a power of 2 */ /* (from: http://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2) */ -# define POWER_OF_TWO(n) (!(n & (n - 1)) && n) +# define POWER_OF_TWO(n) (!(n & (n - 1)) && n) /* Raise an integer to a power of 2 */ -# define H5_EXP2(n) (1 << (n)) +# define H5_EXP2(n) (1 << (n)) /* * HDF Boolean type. @@ -342,7 +342,7 @@ #endif /* - * Numeric data types. Some of these might be defined in Posix.1g, otherwise + * Numeric data types. Some of these might be defined in Posix.1g, otherwise * we define them with the closest available type which is at least as large * as the number of bits indicated in the type name. The `int8' types *must* * be exactly one byte wide because we use it for pointer calculations to @@ -410,28 +410,28 @@ #endif /* - * Maximum and minimum values. These should be defined in <limits.h> for the + * Maximum and minimum values. These should be defined in <limits.h> for the * most part. */ #ifndef LLONG_MAX -# define LLONG_MAX ((long long)(((unsigned long long)1 \ - <<(8*sizeof(long long)-1))-1)) +# define LLONG_MAX ((long long)(((unsigned long long)1 \ + <<(8*sizeof(long long)-1))-1)) # define LLONG_MIN ((long long)(-LLONG_MAX)-1) #endif #ifndef ULLONG_MAX -# define ULLONG_MAX ((unsigned long long)((long long)(-1))) +# define ULLONG_MAX ((unsigned long long)((long long)(-1))) #endif #ifndef SIZET_MAX -# define SIZET_MAX ((size_t)(ssize_t)(-1)) -# define SSIZET_MAX ((ssize_t)(((size_t)1<<(8*sizeof(ssize_t)-1))-1)) +# define SIZET_MAX ((size_t)(ssize_t)(-1)) +# define SSIZET_MAX ((ssize_t)(((size_t)1<<(8*sizeof(ssize_t)-1))-1)) #endif /* * Maximum & minimum values for our typedefs. */ -#define HSIZET_MAX ((hsize_t)ULLONG_MAX) -#define HSSIZET_MAX ((hssize_t)LLONG_MAX) -#define HSSIZET_MIN (~(HSSIZET_MAX)) +#define HSIZET_MAX ((hsize_t)ULLONG_MAX) +#define HSSIZET_MAX ((hssize_t)LLONG_MAX) +#define HSSIZET_MIN (~(HSSIZET_MAX)) /* * A macro to portably increment enumerated types. @@ -451,15 +451,15 @@ * Data types and functions for timing certain parts of the library. */ typedef struct { - double utime; /*user time */ - double stime; /*system time */ - double etime; /*elapsed wall-clock time */ + double utime; /*user time */ + double stime; /*system time */ + double etime; /*elapsed wall-clock time */ } H5_timer_t; H5_DLL void H5_timer_reset (H5_timer_t *timer); H5_DLL void H5_timer_begin (H5_timer_t *timer); H5_DLL void H5_timer_end (H5_timer_t *sum/*in,out*/, - H5_timer_t *timer/*in,out*/); + H5_timer_t *timer/*in,out*/); H5_DLL void H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds); H5_DLL time_t H5_now(void); @@ -487,19 +487,19 @@ typedef struct { /* Put all platform-specific definitions in the following file */ /* so that the following definitions are platform free. */ -#include "H5win32defs.h" /* For Windows-specific definitions */ +#include "H5win32defs.h" /* For Windows-specific definitions */ #ifndef HDabort - #define HDabort() abort() + #define HDabort() abort() #endif /* HDabort */ #ifndef HDabs - #define HDabs(X) abs(X) + #define HDabs(X) abs(X) #endif /* HDabs */ #ifndef HDaccess - #define HDaccess(F,M) access(F, M) + #define HDaccess(F,M) access(F, M) #endif /* HDaccess */ #ifndef HDacos - #define HDacos(X) acos(X) + #define HDacos(X) acos(X) #endif /* HDacos */ #ifndef HDalarm #ifdef H5_HAVE_ALARM @@ -509,232 +509,232 @@ typedef struct { #endif /* H5_HAVE_ALARM */ #endif /* HDalarm */ #ifndef HDasctime - #define HDasctime(T) asctime(T) + #define HDasctime(T) asctime(T) #endif /* HDasctime */ #ifndef HDasin - #define HDasin(X) asin(X) + #define HDasin(X) asin(X) #endif /* HDasin */ #ifndef HDassert - #define HDassert(X) assert(X) + #define HDassert(X) assert(X) #endif /* HDassert */ #ifndef HDatan - #define HDatan(X) atan(X) + #define HDatan(X) atan(X) #endif /* HDatan */ #ifndef HDatan2 - #define HDatan2(X,Y) atan2(X,Y) + #define HDatan2(X,Y) atan2(X,Y) #endif /* HDatan2 */ #ifndef HDatexit - #define HDatexit(F) atexit(F) + #define HDatexit(F) atexit(F) #endif /* HDatexit */ #ifndef HDatof - #define HDatof(S) atof(S) + #define HDatof(S) atof(S) #endif /* HDatof */ #ifndef HDatoi - #define HDatoi(S) atoi(S) + #define HDatoi(S) atoi(S) #endif /* HDatoi */ #ifndef HDatol - #define HDatol(S) atol(S) + #define HDatol(S) atol(S) #endif /* HDatol */ #ifndef HDBSDgettimeofday - #define HDBSDgettimeofday(S,P) BSDgettimeofday(S,P) + #define HDBSDgettimeofday(S,P) BSDgettimeofday(S,P) #endif /* HDBSDgettimeofday */ #ifndef HDbsearch - #define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F) + #define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F) #endif /* HDbsearch */ #ifndef HDcalloc - #define HDcalloc(N,Z) calloc(N,Z) + #define HDcalloc(N,Z) calloc(N,Z) #endif /* HDcalloc */ #ifndef HDceil - #define HDceil(X) ceil(X) + #define HDceil(X) ceil(X) #endif /* HDceil */ #ifndef HDcfgetispeed - #define HDcfgetispeed(T) cfgetispeed(T) + #define HDcfgetispeed(T) cfgetispeed(T) #endif /* HDcfgetispeed */ #ifndef HDcfgetospeed - #define HDcfgetospeed(T) cfgetospeed(T) + #define HDcfgetospeed(T) cfgetospeed(T) #endif /* HDcfgetospeed */ #ifndef HDcfsetispeed - #define HDcfsetispeed(T,S) cfsetispeed(T,S) + #define HDcfsetispeed(T,S) cfsetispeed(T,S) #endif /* HDcfsetispeed */ #ifndef HDcfsetospeed - #define HDcfsetospeed(T,S) cfsetospeed(T,S) + #define HDcfsetospeed(T,S) cfsetospeed(T,S) #endif /* HDcfsetospeed */ #ifndef HDchdir - #define HDchdir(S) chdir(S) + #define HDchdir(S) chdir(S) #endif /* HDchdir */ #ifndef HDchmod - #define HDchmod(S,M) chmod(S,M) + #define HDchmod(S,M) chmod(S,M) #endif /* HDchmod */ #ifndef HDchown - #define HDchown(S,O,G) chown(S,O,G) + #define HDchown(S,O,G) chown(S,O,G) #endif /* HDchown */ #ifndef HDclearerr - #define HDclearerr(F) clearerr(F) + #define HDclearerr(F) clearerr(F) #endif /* HDclearerr */ #ifndef HDclock - #define HDclock() clock() + #define HDclock() clock() #endif /* HDclock */ #ifndef HDclose - #define HDclose(F) close(F) + #define HDclose(F) close(F) #endif /* HDclose */ #ifndef HDclosedir - #define HDclosedir(D) closedir(D) + #define HDclosedir(D) closedir(D) #endif /* HDclosedir */ #ifndef HDcos - #define HDcos(X) cos(X) + #define HDcos(X) cos(X) #endif /* HDcos */ #ifndef HDcosh - #define HDcosh(X) cosh(X) + #define HDcosh(X) cosh(X) #endif /* HDcosh */ #ifndef HDcreat - #define HDcreat(S,M) creat(S,M) + #define HDcreat(S,M) creat(S,M) #endif /* HDcreat */ #ifndef HDctermid - #define HDctermid(S) ctermid(S) + #define HDctermid(S) ctermid(S) #endif /* HDctermid */ #ifndef HDctime - #define HDctime(T) ctime(T) + #define HDctime(T) ctime(T) #endif /* HDctime */ #ifndef HDcuserid - #define HDcuserid(S) cuserid(S) + #define HDcuserid(S) cuserid(S) #endif /* HDcuserid */ #ifndef HDdifftime #ifdef H5_HAVE_DIFFTIME - #define HDdifftime(X,Y) difftime(X,Y) + #define HDdifftime(X,Y) difftime(X,Y) #else /* H5_HAVE_DIFFTIME */ - #define HDdifftime(X,Y) ((double)(X)-(double)(Y)) + #define HDdifftime(X,Y) ((double)(X)-(double)(Y)) #endif /* H5_HAVE_DIFFTIME */ #endif /* HDdifftime */ #ifndef HDdiv - #define HDdiv(X,Y) div(X,Y) + #define HDdiv(X,Y) div(X,Y) #endif /* HDdiv */ #ifndef HDdup - #define HDdup(F) dup(F) + #define HDdup(F) dup(F) #endif /* HDdup */ #ifndef HDdup2 - #define HDdup2(F,I) dup2(F,I) + #define HDdup2(F,I) dup2(F,I) #endif /* HDdup2 */ /* execl() variable arguments */ /* execle() variable arguments */ /* execlp() variable arguments */ #ifndef HDexecv - #define HDexecv(S,AV) execv(S,AV) + #define HDexecv(S,AV) execv(S,AV) #endif /* HDexecv */ #ifndef HDexecve - #define HDexecve(S,AV,E) execve(S,AV,E) + #define HDexecve(S,AV,E) execve(S,AV,E) #endif /* HDexecve */ #ifndef HDexecvp - #define HDexecvp(S,AV) execvp(S,AV) + #define HDexecvp(S,AV) execvp(S,AV) #endif /* HDexecvp */ #ifndef HDexit - #define HDexit(N) exit(N) + #define HDexit(N) exit(N) #endif /* HDexit */ #ifndef HD_exit - #define HD_exit(N) _exit(N) + #define HD_exit(N) _exit(N) #endif /* HD_exit */ #ifndef HDexp - #define HDexp(X) exp(X) + #define HDexp(X) exp(X) #endif /* HDexp */ #ifndef HDexp2 - #define HDexp2(X) exp2(X) + #define HDexp2(X) exp2(X) #endif /* HDexp2 */ #ifndef HDfabs - #define HDfabs(X) fabs(X) + #define HDfabs(X) fabs(X) #endif /* HDfabs */ /* use ABS() because fabsf() fabsl() are not common yet. */ #ifndef HDfabsf - #define HDfabsf(X) ABS(X) + #define HDfabsf(X) ABS(X) #endif /* HDfabsf */ #ifndef HDfabsl - #define HDfabsl(X) ABS(X) + #define HDfabsl(X) ABS(X) #endif /* HDfabsl */ #ifndef HDfclose - #define HDfclose(F) fclose(F) + #define HDfclose(F) fclose(F) #endif /* HDfclose */ /* fcntl() variable arguments */ #ifndef HDfdopen - #define HDfdopen(N,S) fdopen(N,S) + #define HDfdopen(N,S) fdopen(N,S) #endif /* HDfdopen */ #ifndef HDfeof - #define HDfeof(F) feof(F) + #define HDfeof(F) feof(F) #endif /* HDfeof */ #ifndef HDferror - #define HDferror(F) ferror(F) + #define HDferror(F) ferror(F) #endif /* HDferror */ #ifndef HDfflush - #define HDfflush(F) fflush(F) + #define HDfflush(F) fflush(F) #endif /* HDfflush */ #ifndef HDfgetc - #define HDfgetc(F) fgetc(F) + #define HDfgetc(F) fgetc(F) #endif /* HDfgetc */ #ifndef HDfgetpos - #define HDfgetpos(F,P) fgetpos(F,P) + #define HDfgetpos(F,P) fgetpos(F,P) #endif /* HDfgetpos */ #ifndef HDfgets - #define HDfgets(S,N,F) fgets(S,N,F) + #define HDfgets(S,N,F) fgets(S,N,F) #endif /* HDfgets */ #ifndef HDfileno - #define HDfileno(F) fileno(F) + #define HDfileno(F) fileno(F) #endif /* HDfileno */ #ifndef HDfloor - #define HDfloor(X) floor(X) + #define HDfloor(X) floor(X) #endif /* HDfloor */ #ifndef HDfmod - #define HDfmod(X,Y) fmod(X,Y) + #define HDfmod(X,Y) fmod(X,Y) #endif /* HDfmod */ #ifndef HDfopen - #define HDfopen(S,M) fopen(S,M) + #define HDfopen(S,M) fopen(S,M) #endif /* HDfopen */ #ifndef HDfork - #define HDfork() fork() + #define HDfork() fork() #endif /* HDfork */ #ifndef HDfpathconf - #define HDfpathconf(F,N) fpathconf(F,N) + #define HDfpathconf(F,N) fpathconf(F,N) #endif /* HDfpathconf */ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #ifndef HDfputc - #define HDfputc(C,F) fputc(C,F) + #define HDfputc(C,F) fputc(C,F) #endif /* HDfputc */ #ifndef HDfputs - #define HDfputs(S,F) fputs(S,F) + #define HDfputs(S,F) fputs(S,F) #endif /* HDfputs */ #ifndef HDfread - #define HDfread(M,Z,N,F) fread(M,Z,N,F) + #define HDfread(M,Z,N,F) fread(M,Z,N,F) #endif /* HDfread */ #ifndef HDfree - #define HDfree(M) free(M) + #define HDfree(M) free(M) #endif /* HDfree */ #ifndef HDfreopen - #define HDfreopen(S,M,F) freopen(S,M,F) + #define HDfreopen(S,M,F) freopen(S,M,F) #endif /* HDfreopen */ #ifndef HDfrexp - #define HDfrexp(X,N) frexp(X,N) + #define HDfrexp(X,N) frexp(X,N) #endif /* HDfrexp */ /* Check for Cray-specific 'frexpf()' and 'frexpl()' routines */ #ifndef HDfrexpf #ifdef H5_HAVE_FREXPF - #define HDfrexpf(X,N) frexpf(X,N) + #define HDfrexpf(X,N) frexpf(X,N) #else /* H5_HAVE_FREXPF */ - #define HDfrexpf(X,N) frexp(X,N) + #define HDfrexpf(X,N) frexp(X,N) #endif /* H5_HAVE_FREXPF */ #endif /* HDfrexpf */ #ifndef HDfrexpl #ifdef H5_HAVE_FREXPL - #define HDfrexpl(X,N) frexpl(X,N) + #define HDfrexpl(X,N) frexpl(X,N) #else /* H5_HAVE_FREXPL */ - #define HDfrexpl(X,N) frexp(X,N) + #define HDfrexpl(X,N) frexp(X,N) #endif /* H5_HAVE_FREXPL */ #endif /* HDfrexpl */ /* fscanf() variable arguments */ #ifndef HDfseek #ifdef H5_HAVE_FSEEKO - #define HDfseek(F,O,W) fseeko(F,O,W) + #define HDfseek(F,O,W) fseeko(F,O,W) #else /* H5_HAVE_FSEEKO */ - #define HDfseek(F,O,W) fseek(F,O,W) + #define HDfseek(F,O,W) fseek(F,O,W) #endif /* H5_HAVE_FSEEKO */ #endif /* HDfseek */ #ifndef HDfsetpos - #define HDfsetpos(F,P) fsetpos(F,P) + #define HDfsetpos(F,P) fsetpos(F,P) #endif /* HDfsetpos */ /* definitions related to the file stat utilities. * For Unix, if off_t is not 64bit big, try use the pseudo-standard @@ -746,10 +746,10 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDfstat(F,B) fstat64(F,B) #endif /* HDfstat */ #ifndef HDlstat - #define HDlstat(S,B) lstat64(S,B) + #define HDlstat(S,B) lstat64(S,B) #endif /* HDlstat */ #ifndef HDstat - #define HDstat(S,B) stat64(S,B) + #define HDstat(S,B) stat64(S,B) #endif /* HDstat */ typedef struct stat64 h5_stat_t; typedef off64_t h5_stat_size_t; @@ -759,10 +759,10 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDfstat(F,B) fstat(F,B) #endif /* HDfstat */ #ifndef HDlstat - #define HDlstat(S,B) lstat(S,B) + #define HDlstat(S,B) lstat(S,B) #endif /* HDlstat */ #ifndef HDstat - #define HDstat(S,B) stat(S,B) + #define HDstat(S,B) stat(S,B) #endif /* HDstat */ typedef struct stat h5_stat_t; typedef off_t h5_stat_size_t; @@ -771,7 +771,7 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #endif /* !defined(HDfstat) || !defined(HDstat) */ #ifndef HDftell - #define HDftell(F) ftell(F) + #define HDftell(F) ftell(F) #endif /* HDftell */ #ifndef HDftruncate #ifdef H5_HAVE_FTRUNCATE64 @@ -781,273 +781,273 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #endif #endif /* HDftruncate */ #ifndef HDfwrite - #define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F) + #define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F) #endif /* HDfwrite */ #ifndef HDgetc - #define HDgetc(F) getc(F) + #define HDgetc(F) getc(F) #endif /* HDgetc */ #ifndef HDgetchar - #define HDgetchar() getchar() + #define HDgetchar() getchar() #endif /* HDgetchar */ #ifndef HDgetcwd - #define HDgetcwd(S,Z) getcwd(S,Z) + #define HDgetcwd(S,Z) getcwd(S,Z) #endif /* HDgetcwd */ #ifndef HDgetdcwd - #define HDgetdcwd(D,S,Z) getcwd(S,Z) + #define HDgetdcwd(D,S,Z) getcwd(S,Z) #endif /* HDgetdcwd */ #ifndef HDgetdrive - #define HDgetdrive() 0 + #define HDgetdrive() 0 #endif /* HDgetdrive */ #ifndef HDgetegid - #define HDgetegid() getegid() + #define HDgetegid() getegid() #endif /* HDgetegid() */ #ifndef HDgetenv - #define HDgetenv(S) getenv(S) + #define HDgetenv(S) getenv(S) #endif /* HDgetenv */ #ifndef HDgeteuid - #define HDgeteuid() geteuid() + #define HDgeteuid() geteuid() #endif /* HDgeteuid */ #ifndef HDgetgid - #define HDgetgid() getgid() + #define HDgetgid() getgid() #endif /* HDgetgid */ #ifndef HDgetgrgid - #define HDgetgrgid(G) getgrgid(G) + #define HDgetgrgid(G) getgrgid(G) #endif /* HDgetgrgid */ #ifndef HDgetgrnam - #define HDgetgrnam(S) getgrnam(S) + #define HDgetgrnam(S) getgrnam(S) #endif /* HDgetgrnam */ #ifndef HDgetgroups - #define HDgetgroups(Z,G) getgroups(Z,G) + #define HDgetgroups(Z,G) getgroups(Z,G) #endif /* HDgetgroups */ #ifndef HDgetlogin - #define HDgetlogin() getlogin() + #define HDgetlogin() getlogin() #endif /* HDgetlogin */ #ifndef HDgetpgrp - #define HDgetpgrp() getpgrp() + #define HDgetpgrp() getpgrp() #endif /* HDgetpgrp */ #ifndef HDgetpid - #define HDgetpid() getpid() + #define HDgetpid() getpid() #endif /* HDgetpid */ #ifndef HDgetppid - #define HDgetppid() getppid() + #define HDgetppid() getppid() #endif /* HDgetppid */ #ifndef HDgetpwnam - #define HDgetpwnam(S) getpwnam(S) + #define HDgetpwnam(S) getpwnam(S) #endif /* HDgetpwnam */ #ifndef HDgetpwuid - #define HDgetpwuid(U) getpwuid(U) + #define HDgetpwuid(U) getpwuid(U) #endif /* HDgetpwuid */ #ifndef HDgetrusage - #define HDgetrusage(X,S) getrusage(X,S) + #define HDgetrusage(X,S) getrusage(X,S) #endif /* HDgetrusage */ #ifndef HDgets - #define HDgets(S) gets(S) + #define HDgets(S) gets(S) #endif /* HDgets */ #ifndef HDgettimeofday - #define HDgettimeofday(S,P) gettimeofday(S,P) + #define HDgettimeofday(S,P) gettimeofday(S,P) #endif /* HDgettimeofday */ #ifndef HDgetuid - #define HDgetuid() getuid() + #define HDgetuid() getuid() #endif /* HDgetuid */ #ifndef HDgmtime - #define HDgmtime(T) gmtime(T) + #define HDgmtime(T) gmtime(T) #endif /* HDgmtime */ #ifndef HDisalnum - #define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/ + #define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/ #endif /* HDisalnum */ #ifndef HDisalpha - #define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/ + #define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/ #endif /* HDisalpha */ #ifndef HDisatty - #define HDisatty(F) isatty(F) + #define HDisatty(F) isatty(F) #endif /* HDisatty */ #ifndef HDiscntrl - #define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/ + #define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/ #endif /* HDiscntrl */ #ifndef HDisdigit - #define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/ + #define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/ #endif /* HDisdigit */ #ifndef HDisgraph - #define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/ + #define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/ #endif /* HDisgraph */ #ifndef HDislower - #define HDislower(C) islower((int)(C)) /*cast for solaris warning*/ + #define HDislower(C) islower((int)(C)) /*cast for solaris warning*/ #endif /* HDislower */ #ifndef HDisprint - #define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/ + #define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/ #endif /* HDisprint */ #ifndef HDispunct - #define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/ + #define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/ #endif /* HDispunct */ #ifndef HDisspace - #define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/ + #define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/ #endif /* HDisspace */ #ifndef HDisupper - #define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/ + #define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/ #endif /* HDisupper */ #ifndef HDisxdigit - #define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/ + #define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/ #endif /* HDisxdigit */ #ifndef HDkill - #define HDkill(P,S) kill(P,S) + #define HDkill(P,S) kill(P,S) #endif /* HDkill */ #ifndef HDlabs - #define HDlabs(X) labs(X) + #define HDlabs(X) labs(X) #endif /* HDlabs */ #ifndef HDldexp - #define HDldexp(X,N) ldexp(X,N) + #define HDldexp(X,N) ldexp(X,N) #endif /* HDldexp */ #ifndef HDldiv - #define HDldiv(X,Y) ldiv(X,Y) + #define HDldiv(X,Y) ldiv(X,Y) #endif /* HDldiv */ #ifndef HDlink - #define HDlink(OLD,NEW) link(OLD,NEW) + #define HDlink(OLD,NEW) link(OLD,NEW) #endif /* HDlink */ #ifndef HDlocaleconv - #define HDlocaleconv() localeconv() + #define HDlocaleconv() localeconv() #endif /* HDlocaleconv */ #ifndef HDlocaltime - #define HDlocaltime(T) localtime(T) + #define HDlocaltime(T) localtime(T) #endif /* HDlocaltime */ #ifndef HDlog - #define HDlog(X) log(X) + #define HDlog(X) log(X) #endif /* HDlog */ #ifndef HDlog10 - #define HDlog10(X) log10(X) + #define HDlog10(X) log10(X) #endif /* HDlog10 */ #ifndef HDlongjmp - #define HDlongjmp(J,N) longjmp(J,N) + #define HDlongjmp(J,N) longjmp(J,N) #endif /* HDlongjmp */ /* HDlseek and HDoff_t must be defined together for consistency. */ #ifndef HDlseek #ifdef H5_HAVE_LSEEK64 - #define HDlseek(F,O,W) lseek64(F,O,W) - #define HDoff_t off64_t + #define HDlseek(F,O,W) lseek64(F,O,W) + #define HDoff_t off64_t #else - #define HDlseek(F,O,W) lseek(F,O,W) - #define HDoff_t off_t + #define HDlseek(F,O,W) lseek(F,O,W) + #define HDoff_t off_t #endif #endif /* HDlseek */ #ifndef HDmalloc - #define HDmalloc(Z) malloc(Z) + #define HDmalloc(Z) malloc(Z) #endif /* HDmalloc */ #ifndef HDposix_memalign #define HDposix_memalign(P,A,Z) posix_memalign(P,A,Z) #endif /* HDposix_memalign */ #ifndef HDmblen - #define HDmblen(S,N) mblen(S,N) + #define HDmblen(S,N) mblen(S,N) #endif /* HDmblen */ #ifndef HDmbstowcs - #define HDmbstowcs(P,S,Z) mbstowcs(P,S,Z) + #define HDmbstowcs(P,S,Z) mbstowcs(P,S,Z) #endif /* HDmbstowcs */ #ifndef HDmbtowc - #define HDmbtowc(P,S,Z) mbtowc(P,S,Z) + #define HDmbtowc(P,S,Z) mbtowc(P,S,Z) #endif /* HDmbtowc */ #ifndef HDmemchr - #define HDmemchr(S,C,Z) memchr(S,C,Z) + #define HDmemchr(S,C,Z) memchr(S,C,Z) #endif /* HDmemchr */ #ifndef HDmemcmp - #define HDmemcmp(X,Y,Z) memcmp(X,Y,Z) + #define HDmemcmp(X,Y,Z) memcmp(X,Y,Z) #endif /* HDmemcmp */ /* * The (char*) casts are required for the DEC when optimizations are turned * on and the source and/or destination are not aligned. */ #ifndef HDmemcpy - #define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z) + #define HDmemcpy(X,Y,Z) memcpy((char*)(X),(const char*)(Y),Z) #endif /* HDmemcpy */ #ifndef HDmemmove - #define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z) + #define HDmemmove(X,Y,Z) memmove((char*)(X),(const char*)(Y),Z) #endif /* HDmemmove */ #ifndef HDmemset - #define HDmemset(X,C,Z) memset(X,C,Z) + #define HDmemset(X,C,Z) memset(X,C,Z) #endif /* HDmemset */ #ifndef HDmkdir - #define HDmkdir(S,M) mkdir(S,M) + #define HDmkdir(S,M) mkdir(S,M) #endif /* HDmkdir */ #ifndef HDmkfifo - #define HDmkfifo(S,M) mkfifo(S,M) + #define HDmkfifo(S,M) mkfifo(S,M) #endif /* HDmkfifo */ #ifndef HDmktime - #define HDmktime(T) mktime(T) + #define HDmktime(T) mktime(T) #endif /* HDmktime */ #ifndef HDmodf - #define HDmodf(X,Y) modf(X,Y) + #define HDmodf(X,Y) modf(X,Y) #endif /* HDmodf */ #ifndef HDopen #ifdef _O_BINARY - #define HDopen(S,F,M) open(S,F|_O_BINARY,M) + #define HDopen(S,F,M) open(S,F|_O_BINARY,M) #else - #define HDopen(S,F,M) open(S,F,M) + #define HDopen(S,F,M) open(S,F,M) #endif #endif /* HDopen */ #ifndef HDopendir - #define HDopendir(S) opendir(S) + #define HDopendir(S) opendir(S) #endif /* HDopendir */ #ifndef HDpathconf - #define HDpathconf(S,N) pathconf(S,N) + #define HDpathconf(S,N) pathconf(S,N) #endif /* HDpathconf */ #ifndef HDpause - #define HDpause() pause() + #define HDpause() pause() #endif /* HDpause */ #ifndef HDperror - #define HDperror(S) perror(S) + #define HDperror(S) perror(S) #endif /* HDperror */ #ifndef HDpipe - #define HDpipe(F) pipe(F) + #define HDpipe(F) pipe(F) #endif /* HDpipe */ #ifndef HDpow - #define HDpow(X,Y) pow(X,Y) + #define HDpow(X,Y) pow(X,Y) #endif /* HDpow */ /* printf() variable arguments */ #ifndef HDputc - #define HDputc(C,F) putc(C,F) + #define HDputc(C,F) putc(C,F) #endif /* HDputc*/ #ifndef HDputchar - #define HDputchar(C) putchar(C) + #define HDputchar(C) putchar(C) #endif /* HDputchar */ #ifndef HDputs - #define HDputs(S) puts(S) + #define HDputs(S) puts(S) #endif /* HDputs */ #ifndef HDqsort - #define HDqsort(M,N,Z,F) qsort(M,N,Z,F) + #define HDqsort(M,N,Z,F) qsort(M,N,Z,F) #endif /* HDqsort*/ #ifndef HDraise - #define HDraise(N) raise(N) + #define HDraise(N) raise(N) #endif /* HDraise */ #ifdef H5_HAVE_RAND_R #ifndef HDrandom - #define HDrandom() HDrand() + #define HDrandom() HDrand() #endif /* HDrandom */ H5_DLL int HDrand(void); #elif H5_HAVE_RANDOM #ifndef HDrand - #define HDrand() random() + #define HDrand() random() #endif /* HDrand */ #ifndef HDrandom - #define HDrandom() random() + #define HDrandom() random() #endif /* HDrandom */ #else /* H5_HAVE_RANDOM */ #ifndef HDrand - #define HDrand() rand() + #define HDrand() rand() #endif /* HDrand */ #ifndef HDrandom - #define HDrandom() rand() + #define HDrandom() rand() #endif /* HDrandom */ #endif /* H5_HAVE_RANDOM */ #ifndef HDread - #define HDread(F,M,Z) read(F,M,Z) + #define HDread(F,M,Z) read(F,M,Z) #endif /* HDread */ #ifndef HDreaddir - #define HDreaddir(D) readdir(D) + #define HDreaddir(D) readdir(D) #endif /* HDreaddir */ #ifndef HDrealloc - #define HDrealloc(M,Z) realloc(M,Z) + #define HDrealloc(M,Z) realloc(M,Z) #endif /* HDrealloc */ #ifndef HDrealpath - #define HDrealpath(F1,F2) realpath(F1,F2) + #define HDrealpath(F1,F2) realpath(F1,F2) #endif /* HDrealloc */ #ifdef H5_VMS #ifdef __cplusplus @@ -1058,126 +1058,126 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); } #endif /* __cplusplus */ #ifndef HDremove - #define HDremove(S) HDremove_all(S) + #define HDremove(S) HDremove_all(S) #endif /* HDremove */ #else /* H5_VMS */ #ifndef HDremove - #define HDremove(S) remove(S) + #define HDremove(S) remove(S) #endif /* HDremove */ #endif /*H5_VMS*/ #ifndef HDrename - #define HDrename(OLD,NEW) rename(OLD,NEW) + #define HDrename(OLD,NEW) rename(OLD,NEW) #endif /* HDrename */ #ifndef HDrewind - #define HDrewind(F) rewind(F) + #define HDrewind(F) rewind(F) #endif /* HDrewind */ #ifndef HDrewinddir - #define HDrewinddir(D) rewinddir(D) + #define HDrewinddir(D) rewinddir(D) #endif /* HDrewinddir */ #ifndef HDrmdir - #define HDrmdir(S) rmdir(S) + #define HDrmdir(S) rmdir(S) #endif /* HDrmdir */ /* scanf() variable arguments */ #ifndef HDsetbuf - #define HDsetbuf(F,S) setbuf(F,S) + #define HDsetbuf(F,S) setbuf(F,S) #endif /* HDsetbuf */ #ifndef HDsetgid - #define HDsetgid(G) setgid(G) + #define HDsetgid(G) setgid(G) #endif /* HDsetgid */ #ifndef HDsetjmp - #define HDsetjmp(J) setjmp(J) + #define HDsetjmp(J) setjmp(J) #endif /* HDsetjmp */ #ifndef HDsetlocale - #define HDsetlocale(N,S) setlocale(N,S) + #define HDsetlocale(N,S) setlocale(N,S) #endif /* HDsetlocale */ #ifndef HDsetpgid - #define HDsetpgid(P,PG) setpgid(P,PG) + #define HDsetpgid(P,PG) setpgid(P,PG) #endif /* HDsetpgid */ #ifndef HDsetsid - #define HDsetsid() setsid() + #define HDsetsid() setsid() #endif /* HDsetsid */ #ifndef HDsetuid - #define HDsetuid(U) setuid(U) + #define HDsetuid(U) setuid(U) #endif /* HDsetuid */ #ifndef HDsetvbuf - #define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z) + #define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z) #endif /* HDsetvbuf */ #ifndef HDsigaddset - #define HDsigaddset(S,N) sigaddset(S,N) + #define HDsigaddset(S,N) sigaddset(S,N) #endif /* HDsigaddset */ #ifndef HDsigdelset - #define HDsigdelset(S,N) sigdelset(S,N) + #define HDsigdelset(S,N) sigdelset(S,N) #endif /* HDsigdelset */ #ifndef HDsigemptyset - #define HDsigemptyset(S) sigemptyset(S) + #define HDsigemptyset(S) sigemptyset(S) #endif /* HDsigemptyset */ #ifndef HDsigfillset - #define HDsigfillset(S) sigfillset(S) + #define HDsigfillset(S) sigfillset(S) #endif /* HDsigfillset */ #ifndef HDsigismember - #define HDsigismember(S,N) sigismember(S,N) + #define HDsigismember(S,N) sigismember(S,N) #endif /* HDsigismember */ #ifndef HDsiglongjmp - #define HDsiglongjmp(J,N) siglongjmp(J,N) + #define HDsiglongjmp(J,N) siglongjmp(J,N) #endif /* HDsiglongjmp */ #ifndef HDsignal - #define HDsignal(N,F) signal(N,F) + #define HDsignal(N,F) signal(N,F) #endif /* HDsignal */ #ifndef HDsigpending - #define HDsigpending(S) sigpending(S) + #define HDsigpending(S) sigpending(S) #endif /* HDsigpending */ #ifndef HDsigprocmask - #define HDsigprocmask(H,S,O) sigprocmask(H,S,O) + #define HDsigprocmask(H,S,O) sigprocmask(H,S,O) #endif /* HDsigprocmask */ #ifndef HDsigsetjmp - #define HDsigsetjmp(J,N) sigsetjmp(J,N) + #define HDsigsetjmp(J,N) sigsetjmp(J,N) #endif /* HDsigsetjmp */ #ifndef HDsigsuspend - #define HDsigsuspend(S) sigsuspend(S) + #define HDsigsuspend(S) sigsuspend(S) #endif /* HDsigsuspend */ #ifndef HDsin - #define HDsin(X) sin(X) + #define HDsin(X) sin(X) #endif /* HDsin */ #ifndef HDsinh - #define HDsinh(X) sinh(X) + #define HDsinh(X) sinh(X) #endif /* HDsinh */ #ifndef HDsleep - #define HDsleep(N) sleep(N) + #define HDsleep(N) sleep(N) #endif /* HDsleep */ #ifndef HDsnprintf - #define HDsnprintf snprintf /*varargs*/ + #define HDsnprintf snprintf /*varargs*/ #endif /* HDsnprintf */ /* sprintf() variable arguments */ #ifndef HDsqrt - #define HDsqrt(X) sqrt(X) + #define HDsqrt(X) sqrt(X) #endif /* HDsqrt */ #ifdef H5_HAVE_RAND_R H5_DLL void HDsrand(unsigned int seed); #ifndef HDsrandom - #define HDsrandom(S) HDsrand(S) + #define HDsrandom(S) HDsrand(S) #endif /* HDsrandom */ #elif H5_HAVE_RANDOM #ifndef HDsrand - #define HDsrand(S) srandom(S) + #define HDsrand(S) srandom(S) #endif /* HDsrand */ #ifndef HDsrandom - #define HDsrandom(S) srandom(S) + #define HDsrandom(S) srandom(S) #endif /* HDsrandom */ #else /* H5_HAVE_RAND_R */ #ifndef HDsrand - #define HDsrand(S) srand(S) + #define HDsrand(S) srand(S) #endif /* HDsrand */ #ifndef HDsrandom - #define HDsrandom(S) srand(S) + #define HDsrandom(S) srand(S) #endif /* HDsrandom */ #endif /* H5_HAVE_RAND_R */ /* sscanf() variable arguments */ #ifndef HDstrcat - #define HDstrcat(X,Y) strcat(X,Y) + #define HDstrcat(X,Y) strcat(X,Y) #endif /* HDstrcat */ #ifndef HDstrchr - #define HDstrchr(S,C) strchr(S,C) + #define HDstrchr(S,C) strchr(S,C) #endif /* HDstrchr */ #ifndef HDstrcmp #define HDstrcmp(X,Y) strcmp(X,Y) @@ -1186,181 +1186,181 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDstrcasecmp(X,Y) strcasecmp(X,Y) #endif /* HDstrcasecmp */ #ifndef HDstrcoll - #define HDstrcoll(X,Y) strcoll(X,Y) + #define HDstrcoll(X,Y) strcoll(X,Y) #endif /* HDstrcoll */ #ifndef HDstrcpy - #define HDstrcpy(X,Y) strcpy(X,Y) + #define HDstrcpy(X,Y) strcpy(X,Y) #endif /* HDstrcpy */ #ifndef HDstrcspn - #define HDstrcspn(X,Y) strcspn(X,Y) + #define HDstrcspn(X,Y) strcspn(X,Y) #endif /* HDstrcspn */ #ifndef HDstrerror - #define HDstrerror(N) strerror(N) + #define HDstrerror(N) strerror(N) #endif /* HDstrerror */ #ifndef HDstrftime - #define HDstrftime(S,Z,F,T) strftime(S,Z,F,T) + #define HDstrftime(S,Z,F,T) strftime(S,Z,F,T) #endif /* HDstrftime */ #ifndef HDstrlen - #define HDstrlen(S) strlen(S) + #define HDstrlen(S) strlen(S) #endif /* HDstrlen */ #ifndef HDstrncat - #define HDstrncat(X,Y,Z) strncat(X,Y,Z) + #define HDstrncat(X,Y,Z) strncat(X,Y,Z) #endif /* HDstrncat */ #ifndef HDstrncmp - #define HDstrncmp(X,Y,Z) strncmp(X,Y,Z) + #define HDstrncmp(X,Y,Z) strncmp(X,Y,Z) #endif /* HDstrncmp */ #ifndef HDstrncpy - #define HDstrncpy(X,Y,Z) strncpy(X,Y,Z) + #define HDstrncpy(X,Y,Z) strncpy(X,Y,Z) #endif /* HDstrncpy */ #ifndef HDstrpbrk - #define HDstrpbrk(X,Y) strpbrk(X,Y) + #define HDstrpbrk(X,Y) strpbrk(X,Y) #endif /* HDstrpbrk */ #ifndef HDstrrchr - #define HDstrrchr(S,C) strrchr(S,C) + #define HDstrrchr(S,C) strrchr(S,C) #endif /* HDstrrchr */ #ifndef HDstrspn - #define HDstrspn(X,Y) strspn(X,Y) + #define HDstrspn(X,Y) strspn(X,Y) #endif /* HDstrspn */ #ifndef HDstrstr - #define HDstrstr(X,Y) strstr(X,Y) + #define HDstrstr(X,Y) strstr(X,Y) #endif /* HDstrstr */ #ifndef HDstrtod - #define HDstrtod(S,R) strtod(S,R) + #define HDstrtod(S,R) strtod(S,R) #endif /* HDstrtod */ #ifndef HDstrtok - #define HDstrtok(X,Y) strtok(X,Y) + #define HDstrtok(X,Y) strtok(X,Y) #endif /* HDstrtok */ #ifndef HDstrtol - #define HDstrtol(S,R,N) strtol(S,R,N) + #define HDstrtol(S,R,N) strtol(S,R,N) #endif /* HDstrtol */ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base); #ifndef HDstrtoul - #define HDstrtoul(S,R,N) strtoul(S,R,N) + #define HDstrtoul(S,R,N) strtoul(S,R,N) #endif /* HDstrtoul */ #ifndef HDstrtoull - #define HDstrtoull(S,R,N) strtoull(S,R,N) + #define HDstrtoull(S,R,N) strtoull(S,R,N) #endif /* HDstrtoul */ #ifndef HDstrxfrm - #define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z) + #define HDstrxfrm(X,Y,Z) strxfrm(X,Y,Z) #endif /* HDstrxfrm */ #ifdef H5_HAVE_SYMLINK #ifndef HDsymlink - #define HDsymlink(F1,F2) symlink(F1,F2) + #define HDsymlink(F1,F2) symlink(F1,F2) #endif /* HDsymlink */ #endif /* H5_HAVE_SYMLINK */ #ifndef HDsysconf - #define HDsysconf(N) sysconf(N) + #define HDsysconf(N) sysconf(N) #endif /* HDsysconf */ #ifndef HDsystem - #define HDsystem(S) system(S) + #define HDsystem(S) system(S) #endif /* HDsystem */ #ifndef HDtan - #define HDtan(X) tan(X) + #define HDtan(X) tan(X) #endif /* HDtan */ #ifndef HDtanh - #define HDtanh(X) tanh(X) + #define HDtanh(X) tanh(X) #endif /* HDtanh */ #ifndef HDtcdrain - #define HDtcdrain(F) tcdrain(F) + #define HDtcdrain(F) tcdrain(F) #endif /* HDtcdrain */ #ifndef HDtcflow - #define HDtcflow(F,A) tcflow(F,A) + #define HDtcflow(F,A) tcflow(F,A) #endif /* HDtcflow */ #ifndef HDtcflush - #define HDtcflush(F,N) tcflush(F,N) + #define HDtcflush(F,N) tcflush(F,N) #endif /* HDtcflush */ #ifndef HDtcgetattr - #define HDtcgetattr(F,T) tcgetattr(F,T) + #define HDtcgetattr(F,T) tcgetattr(F,T) #endif /* HDtcgetattr */ #ifndef HDtcgetpgrp - #define HDtcgetpgrp(F) tcgetpgrp(F) + #define HDtcgetpgrp(F) tcgetpgrp(F) #endif /* HDtcgetpgrp */ #ifndef HDtcsendbreak - #define HDtcsendbreak(F,N) tcsendbreak(F,N) + #define HDtcsendbreak(F,N) tcsendbreak(F,N) #endif /* HDtcsendbreak */ #ifndef HDtcsetattr - #define HDtcsetattr(F,O,T) tcsetattr(F,O,T) + #define HDtcsetattr(F,O,T) tcsetattr(F,O,T) #endif /* HDtcsetattr */ #ifndef HDtcsetpgrp - #define HDtcsetpgrp(F,N) tcsetpgrp(F,N) + #define HDtcsetpgrp(F,N) tcsetpgrp(F,N) #endif /* HDtcsetpgrp */ #ifndef HDtime - #define HDtime(T) time(T) + #define HDtime(T) time(T) #endif /* HDtime */ #ifndef HDtimes - #define HDtimes(T) times(T) + #define HDtimes(T) times(T) #endif /* HDtimes*/ #ifndef HDtmpfile - #define HDtmpfile() tmpfile() + #define HDtmpfile() tmpfile() #endif /* HDtmpfile */ #ifndef HDtmpnam - #define HDtmpnam(S) tmpnam(S) + #define HDtmpnam(S) tmpnam(S) #endif /* HDtmpnam */ #ifndef HDtolower - #define HDtolower(C) tolower(C) + #define HDtolower(C) tolower(C) #endif /* HDtolower */ #ifndef HDtoupper - #define HDtoupper(C) toupper(C) + #define HDtoupper(C) toupper(C) #endif /* HDtoupper */ #ifndef HDttyname - #define HDttyname(F) ttyname(F) + #define HDttyname(F) ttyname(F) #endif /* HDttyname */ #ifndef HDtzset - #define HDtzset() tzset() + #define HDtzset() tzset() #endif /* HDtzset */ #ifndef HDumask - #define HDumask(N) umask(N) + #define HDumask(N) umask(N) #endif /* HDumask */ #ifndef HDuname - #define HDuname(S) uname(S) + #define HDuname(S) uname(S) #endif /* HDuname */ #ifndef HDungetc - #define HDungetc(C,F) ungetc(C,F) + #define HDungetc(C,F) ungetc(C,F) #endif /* HDungetc */ #ifndef HDunlink - #define HDunlink(S) unlink(S) + #define HDunlink(S) unlink(S) #endif /* HDunlink */ #ifndef HDutime - #define HDutime(S,T) utime(S,T) + #define HDutime(S,T) utime(S,T) #endif /* HDutime */ #ifndef HDva_arg - #define HDva_arg(A,T) va_arg(A,T) + #define HDva_arg(A,T) va_arg(A,T) #endif /* HDva_arg */ #ifndef HDva_end - #define HDva_end(A) va_end(A) + #define HDva_end(A) va_end(A) #endif /* HDva_end */ #ifndef HDva_start - #define HDva_start(A,P) va_start(A,P) + #define HDva_start(A,P) va_start(A,P) #endif /* HDva_start */ #ifndef HDvasprintf #define HDvasprintf(RET,FMT,A) vasprintf(RET,FMT,A) #endif /* HDvasprintf */ #ifndef HDvfprintf - #define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A) + #define HDvfprintf(F,FMT,A) vfprintf(F,FMT,A) #endif /* HDvfprintf */ #ifndef HDvprintf - #define HDvprintf(FMT,A) vprintf(FMT,A) + #define HDvprintf(FMT,A) vprintf(FMT,A) #endif /* HDvprintf */ #ifndef HDvsprintf - #define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A) + #define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A) #endif /* HDvsprintf */ #ifndef HDvsnprintf #define HDvsnprintf(S,N,FMT,A) vsnprintf(S,N,FMT,A) #endif /* HDvsnprintf */ #ifndef HDwait - #define HDwait(W) wait(W) + #define HDwait(W) wait(W) #endif /* HDwait */ #ifndef HDwaitpid - #define HDwaitpid(P,W,O) waitpid(P,W,O) + #define HDwaitpid(P,W,O) waitpid(P,W,O) #endif /* HDwaitpid */ #ifndef HDwcstombs - #define HDwcstombs(S,P,Z) wcstombs(S,P,Z) + #define HDwcstombs(S,P,Z) wcstombs(S,P,Z) #endif /* HDwcstombs */ #ifndef HDwctomb - #define HDwctomb(S,C) wctomb(S,C) + #define HDwctomb(S,C) wctomb(S,C) #endif /* HDwctomb */ #ifndef HDwrite - #define HDwrite(F,M,Z) write(F,M,Z) + #define HDwrite(F,M,Z) write(F,M,Z) #endif /* HDwrite */ /* @@ -1459,9 +1459,9 @@ extern char *strdup(const char *s); #if defined(H5_HAVE_WINDOW_PATH) /* directory delimiter for Windows: slash and backslash are acceptable on Windows */ -#define DIR_SLASH_SEPC '/' -#define DIR_SEPC '\\' -#define DIR_SEPS "\\" +#define DIR_SLASH_SEPC '/' +#define DIR_SEPC '\\' +#define DIR_SEPS "\\" #define CHECK_DELIMITER(SS) ((SS == DIR_SEPC)||(SS == DIR_SLASH_SEPC)) #define CHECK_ABSOLUTE(NAME) ((isalpha(NAME[0])) && (NAME[1] == ':') && (CHECK_DELIMITER(NAME[2]))) #define CHECK_ABS_DRIVE(NAME) ((isalpha(NAME[0])) && (NAME[1] == ':')) @@ -1491,49 +1491,49 @@ extern char *strdup(const char *s); #else -#define DIR_SEPC '/' -#define DIR_SEPS "/" +#define DIR_SEPC '/' +#define DIR_SEPS "/" #define CHECK_DELIMITER(SS) (SS == DIR_SEPC) #define CHECK_ABSOLUTE(NAME) (CHECK_DELIMITER(*NAME)) -#define CHECK_ABS_DRIVE(NAME) (0) -#define CHECK_ABS_PATH(NAME) (0) +#define CHECK_ABS_DRIVE(NAME) (0) +#define CHECK_ABS_PATH(NAME) (0) #define GET_LAST_DELIMITER(NAME, ptr) ptr = strrchr(NAME, DIR_SEPC); #endif -#define COLON_SEPC ':' +#define COLON_SEPC ':' /* * These macros check whether debugging has been requested for a certain - * package at run-time. Code for debugging is conditionally compiled by - * defining constants like `H5X_DEBUG'. In order to see the output though + * package at run-time. Code for debugging is conditionally compiled by + * defining constants like `H5X_DEBUG'. In order to see the output though * the code must be enabled at run-time with an environment variable * HDF5_DEBUG which is a list of packages to debug. * * Note: If you add/remove items from this enum then be sure to update the - * information about the package in H5_init_library(). + * information about the package in H5_init_library(). */ typedef enum { - H5_PKG_A, /*Attributes */ - H5_PKG_AC, /*Meta data cache */ - H5_PKG_B, /*B-trees */ - H5_PKG_D, /*Datasets */ - H5_PKG_E, /*Error handling */ - H5_PKG_F, /*Files */ - H5_PKG_G, /*Groups */ - H5_PKG_HG, /*Global heap */ - H5_PKG_HL, /*Local heap */ - H5_PKG_I, /*Interface */ - H5_PKG_MF, /*File memory management */ - H5_PKG_MM, /*Core memory management */ - H5_PKG_O, /*Object headers */ - H5_PKG_P, /*Property lists */ - H5_PKG_S, /*Data spaces */ - H5_PKG_T, /*Data types */ - H5_PKG_V, /*Vector functions */ - H5_PKG_Z, /*Raw data filters */ - H5_NPKGS /*Must be last */ + H5_PKG_A, /*Attributes */ + H5_PKG_AC, /*Meta data cache */ + H5_PKG_B, /*B-trees */ + H5_PKG_D, /*Datasets */ + H5_PKG_E, /*Error handling */ + H5_PKG_F, /*Files */ + H5_PKG_G, /*Groups */ + H5_PKG_HG, /*Global heap */ + H5_PKG_HL, /*Local heap */ + H5_PKG_I, /*Interface */ + H5_PKG_MF, /*File memory management */ + H5_PKG_MM, /*Core memory management */ + H5_PKG_O, /*Object headers */ + H5_PKG_P, /*Property lists */ + H5_PKG_S, /*Data spaces */ + H5_PKG_T, /*Data types */ + H5_PKG_V, /*Vector functions */ + H5_PKG_Z, /*Raw data filters */ + H5_NPKGS /*Must be last */ } H5_pkg_t; typedef struct H5_debug_open_stream_t { @@ -1542,58 +1542,58 @@ typedef struct H5_debug_open_stream_t { } H5_debug_open_stream_t; typedef struct H5_debug_t { - FILE *trace; /*API trace output stream */ + FILE *trace; /*API trace output stream */ hbool_t ttop; /*Show only top-level calls? */ hbool_t ttimes; /*Show trace event times? */ struct { - const char *name; /*package name */ - FILE *stream; /*output stream or NULL */ + const char *name; /*package name */ + FILE *stream; /*output stream or NULL */ } pkg[H5_NPKGS]; H5_debug_open_stream_t *open_stream; /* Stack of open output streams */ } H5_debug_t; -extern H5_debug_t H5_debug_g; -#define H5DEBUG(X) (H5_debug_g.pkg[H5_PKG_##X].stream) +extern H5_debug_t H5_debug_g; +#define H5DEBUG(X) (H5_debug_g.pkg[H5_PKG_##X].stream) /* Do not use const else AIX strings does not show it. */ extern char H5libhdf5_settings[]; /* embedded library information */ /*------------------------------------------------------------------------- - * Purpose: These macros are inserted automatically just after the - * FUNC_ENTER() macro of API functions and are used to trace - * application program execution. Unless H5_DEBUG_API has been - * defined they are no-ops. + * Purpose: These macros are inserted automatically just after the + * FUNC_ENTER() macro of API functions and are used to trace + * application program execution. Unless H5_DEBUG_API has been + * defined they are no-ops. * - * Arguments: R - Return type encoded as a string - * T - Argument types encoded as a string - * A0-An - Arguments. The number at the end of the macro name - * indicates the number of arguments. + * Arguments: R - Return type encoded as a string + * T - Argument types encoded as a string + * A0-An - Arguments. The number at the end of the macro name + * indicates the number of arguments. * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * * Modifications: *------------------------------------------------------------------------- */ #ifdef H5_DEBUG_API -#define H5TRACE_DECL const char *RTYPE=NULL; \ +#define H5TRACE_DECL const char *RTYPE=NULL; \ double CALLTIME; -#define H5TRACE0(R,T) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T) -#define H5TRACE1(R,T,A0) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0) -#define H5TRACE2(R,T,A0,A1) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1) -#define H5TRACE3(R,T,A0,A1,A2) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2) -#define H5TRACE4(R,T,A0,A1,A2,A3) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3) -#define H5TRACE5(R,T,A0,A1,A2,A3,A4) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ +#define H5TRACE0(R,T) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T) +#define H5TRACE1(R,T,A0) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0) +#define H5TRACE2(R,T,A0,A1) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1) +#define H5TRACE3(R,T,A0,A1,A2) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2) +#define H5TRACE4(R,T,A0,A1,A2,A3) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3) +#define H5TRACE5(R,T,A0,A1,A2,A3,A4) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ #A4,A4) -#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ +#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) RTYPE=R; \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ #A4,A4,#A5,A5) #define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) RTYPE=R; \ - CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ + CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ #A4,A4,#A5,A5,#A6,A6) #define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) RTYPE=R; \ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ @@ -1608,46 +1608,46 @@ extern char H5libhdf5_settings[]; /* embedded library information */ CALLTIME=H5_trace(NULL,FUNC,T,#A0,A0,#A1,A1,#A2,A2,#A3,A3, \ #A4,A4,#A5,A5,#A6,A6,#A7,A7,#A8,A8,#A9,A9, \ #A10,A10) -#define H5TRACE_RETURN(V) if (RTYPE) { \ - H5_trace(&CALLTIME,FUNC,RTYPE,NULL,V); \ - RTYPE=NULL; \ - } +#define H5TRACE_RETURN(V) if (RTYPE) { \ + H5_trace(&CALLTIME,FUNC,RTYPE,NULL,V); \ + RTYPE=NULL; \ + } #else -#define H5TRACE_DECL /*void*/ -#define H5TRACE0(R,T) /*void*/ -#define H5TRACE1(R,T,A0) /*void*/ -#define H5TRACE2(R,T,A0,A1) /*void*/ -#define H5TRACE3(R,T,A0,A1,A2) /*void*/ -#define H5TRACE4(R,T,A0,A1,A2,A3) /*void*/ -#define H5TRACE5(R,T,A0,A1,A2,A3,A4) /*void*/ -#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) /*void*/ +#define H5TRACE_DECL /*void*/ +#define H5TRACE0(R,T) /*void*/ +#define H5TRACE1(R,T,A0) /*void*/ +#define H5TRACE2(R,T,A0,A1) /*void*/ +#define H5TRACE3(R,T,A0,A1,A2) /*void*/ +#define H5TRACE4(R,T,A0,A1,A2,A3) /*void*/ +#define H5TRACE5(R,T,A0,A1,A2,A3,A4) /*void*/ +#define H5TRACE6(R,T,A0,A1,A2,A3,A4,A5) /*void*/ #define H5TRACE7(R,T,A0,A1,A2,A3,A4,A5,A6) /*void*/ #define H5TRACE8(R,T,A0,A1,A2,A3,A4,A5,A6,A7) /*void*/ #define H5TRACE9(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8) /*void*/ #define H5TRACE10(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9) /*void*/ #define H5TRACE11(R,T,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10) /*void*/ -#define H5TRACE_RETURN(V) /*void*/ +#define H5TRACE_RETURN(V) /*void*/ #endif H5_DLL double H5_trace(const double *calltime, const char *func, const char *type, ...); /*------------------------------------------------------------------------- - * Purpose: Register function entry for library initialization and code - * profiling. + * Purpose: Register function entry for library initialization and code + * profiling. * - * Notes: Every file must have a file-scope variable called - * `initialize_interface_g' of type hbool_t which is initialized - * to FALSE. + * Notes: Every file must have a file-scope variable called + * `initialize_interface_g' of type hbool_t which is initialized + * to FALSE. * - * Don't use local variable initializers which contain - * calls to other library functions since the initializer - * would happen before the FUNC_ENTER() gets called. Don't - * use initializers that require special cleanup code to - * execute if FUNC_ENTER() fails since a failing FUNC_ENTER() - * returns immediately without branching to the `done' label. + * Don't use local variable initializers which contain + * calls to other library functions since the initializer + * would happen before the FUNC_ENTER() gets called. Don't + * use initializers that require special cleanup code to + * execute if FUNC_ENTER() fails since a failing FUNC_ENTER() + * returns immediately without branching to the `done' label. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * * Modifications: * @@ -1659,7 +1659,7 @@ H5_DLL double H5_trace(const double *calltime, const char *func, const char *typ #define H5_IS_API(S) ('_'!=((const char *)S)[2] && '_'!=((const char *)S)[3] && (!((const char *)S)[4] || '_'!=((const char *)S)[4])) /* global library version information string */ -extern char H5_lib_vers_info_g[]; +extern char H5_lib_vers_info_g[]; /* Lock headers */ #ifdef H5_HAVE_THREADSAFE @@ -1746,17 +1746,17 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ /* Macros for defining interface initialization routines */ #ifdef H5_INTERFACE_INIT_FUNC -static int H5_interface_initialize_g = 0; -static herr_t H5_INTERFACE_INIT_FUNC(void); -#define H5_INTERFACE_INIT(err) \ - /* Initialize this interface or bust */ \ - if (!H5_interface_initialize_g) { \ - H5_interface_initialize_g = 1; \ - if (H5_INTERFACE_INIT_FUNC()<0) { \ - H5_interface_initialize_g = 0; \ - HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ - "interface initialization failed") \ - } \ +static int H5_interface_initialize_g = 0; +static herr_t H5_INTERFACE_INIT_FUNC(void); +#define H5_INTERFACE_INIT(err) \ + /* Initialize this interface or bust */ \ + if (!H5_interface_initialize_g) { \ + H5_interface_initialize_g = 1; \ + if (H5_INTERFACE_INIT_FUNC()<0) { \ + H5_interface_initialize_g = 0; \ + HGOTO_ERROR (H5E_FUNC, H5E_CANTINIT, err, \ + "interface initialization failed") \ + } \ } #else /* H5_INTERFACE_INIT_FUNC */ #define H5_INTERFACE_INIT(err) @@ -1765,17 +1765,17 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #ifndef NDEBUG #define FUNC_ENTER_COMMON_NOFUNC(func_name,asrt) \ - static hbool_t func_check = FALSE; \ - \ - if(!func_check) { \ - /* Check API status */ \ - HDassert(asrt); \ - \ - /* Check function name */ \ - H5_CHECK_FUNCNAME(func_name); \ - \ - /* Don't check again */ \ - func_check = TRUE; \ + static hbool_t func_check = FALSE; \ + \ + if(!func_check) { \ + /* Check API status */ \ + HDassert(asrt); \ + \ + /* Check function name */ \ + H5_CHECK_FUNCNAME(func_name); \ + \ + /* Don't check again */ \ + func_check = TRUE; \ } /* end if */ #else /* NDEBUG */ #define FUNC_ENTER_COMMON_NOFUNC(func_name,asrt) @@ -1783,7 +1783,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define FUNC_ENTER_COMMON(func_name, asrt) \ static const char FUNC[] = #func_name; \ - hbool_t err_occurred = FALSE; \ + hbool_t err_occurred = FALSE; \ FUNC_ENTER_COMMON_NOFUNC(func_name, asrt); #define FUNC_ENTER_COMMON_NOERR(func_name, asrt) \ @@ -1792,10 +1792,10 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); /* Threadsafety initialization code for API routines */ #define FUNC_ENTER_API_THREADSAFE \ - /* Initialize the thread-safe code */ \ + /* Initialize the thread-safe code */ \ H5_FIRST_THREAD_INIT \ - \ - /* Grab the mutex for the library */ \ + \ + /* Grab the mutex for the library */ \ H5_API_UNSET_CANCEL \ H5_API_LOCK @@ -1804,22 +1804,22 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); MPE_LOG_VARS(func_name) \ H5TRACE_DECL -#define FUNC_ENTER_API_COMMON(func_name) \ +#define FUNC_ENTER_API_COMMON(func_name) \ FUNC_ENTER_API_VARS(func_name) \ FUNC_ENTER_COMMON(func_name, H5_IS_API(#func_name)); \ FUNC_ENTER_API_THREADSAFE; -#define FUNC_ENTER_API_INIT(func_name,err) \ - /* Initialize the library */ \ +#define FUNC_ENTER_API_INIT(func_name,err) \ + /* Initialize the library */ \ if(!(H5_INIT_GLOBAL)) { \ H5_INIT_GLOBAL = TRUE; \ - if(H5_init_library() < 0) \ - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, \ - "library initialization failed") \ - } \ + if(H5_init_library() < 0) \ + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, \ + "library initialization failed") \ + } \ \ - /* Initialize the interface, if appropriate */ \ - H5_INTERFACE_INIT(err) \ + /* Initialize the interface, if appropriate */ \ + H5_INTERFACE_INIT(err) \ \ /* Push the name of this function on the function stack */ \ H5_PUSH_FUNC(#func_name) \ @@ -1829,9 +1829,9 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); /* Use this macro for all "normal" API functions */ #define FUNC_ENTER_API(func_name,err) {{ \ FUNC_ENTER_API_COMMON(func_name) \ - FUNC_ENTER_API_INIT(func_name,err); \ - /* Clear thread error stack entering public functions */ \ - H5E_clear_stack(NULL); \ + FUNC_ENTER_API_INIT(func_name,err); \ + /* Clear thread error stack entering public functions */ \ + H5E_clear_stack(NULL); \ { /* @@ -1840,7 +1840,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); */ #define FUNC_ENTER_API_NOCLEAR(func_name,err) {{ \ FUNC_ENTER_API_COMMON(func_name) \ - FUNC_ENTER_API_INIT(func_name,err); \ + FUNC_ENTER_API_INIT(func_name,err); \ { /* @@ -1865,14 +1865,14 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define FUNC_ENTER_API_NOINIT_NOERR_NOFS(func_name) {{ \ FUNC_ENTER_API_VARS(func_name) \ FUNC_ENTER_COMMON_NOERR(func_name, H5_IS_API(#func_name)); \ - FUNC_ENTER_API_THREADSAFE; \ + FUNC_ENTER_API_THREADSAFE; \ BEGIN_MPE_LOG(func_name); \ { /* Note: this macro only works when there's _no_ interface initialization routine for the module */ -#define FUNC_ENTER_NOAPI_INIT(func_name,err) \ - /* Initialize the interface, if appropriate */ \ - H5_INTERFACE_INIT(err) \ +#define FUNC_ENTER_NOAPI_INIT(func_name,err) \ + /* Initialize the interface, if appropriate */ \ + H5_INTERFACE_INIT(err) \ \ /* Push the name of this function on the function stack */ \ H5_PUSH_FUNC(#func_name) @@ -1880,19 +1880,19 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); /* Use this macro for all "normal" non-API functions */ #define FUNC_ENTER_NOAPI(func_name,err) { \ FUNC_ENTER_COMMON(func_name, !H5_IS_API(#func_name)); \ - FUNC_ENTER_NOAPI_INIT(func_name,err) \ + FUNC_ENTER_NOAPI_INIT(func_name,err) \ { /* Use this macro for all non-API functions, which propagate errors, but don't issue them */ #define FUNC_ENTER_NOAPI_NOERR(func_name,err) { \ FUNC_ENTER_COMMON_NOERR(func_name, !H5_IS_API(#func_name)); \ - FUNC_ENTER_NOAPI_INIT(func_name,err) \ + FUNC_ENTER_NOAPI_INIT(func_name,err) \ { /* Use this macro for all non-API functions which don't issue errors */ #define FUNC_ENTER_NOAPI_NOFUNC(func_name) { \ FUNC_ENTER_COMMON_NOFUNC(func_name,!H5_IS_API(#func_name)); \ - FUNC_ENTER_NOAPI_INIT(func_name,err) \ + FUNC_ENTER_NOAPI_INIT(func_name,err) \ { /* @@ -1961,7 +1961,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); FUNC_ENTER_COMMON(func_name, !H5_IS_API(#func_name)); \ if(H5AC_tag(tag_dxpl_id, tag, &prev_tag)<0) \ HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ - FUNC_ENTER_NOAPI_INIT(func_name,err) \ + FUNC_ENTER_NOAPI_INIT(func_name,err) \ { #define FUNC_ENTER_NOAPI_NOINIT_TAG(func_name, dxpl_id, tag, err) { \ @@ -1975,10 +1975,10 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); /*------------------------------------------------------------------------- - * Purpose: Register function exit for code profiling. This should be - * the last statement executed by a function. + * Purpose: Register function exit for code profiling. This should be + * the last statement executed by a function. * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * *------------------------------------------------------------------------- */ @@ -1989,33 +1989,33 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define FUNC_LEAVE_API(ret_value) \ FINISH_MPE_LOG; \ - H5TRACE_RETURN(ret_value); \ + H5TRACE_RETURN(ret_value); \ H5_POP_FUNC \ - if(err_occurred) \ - (void)H5E_dump_api_stack(TRUE); \ + if(err_occurred) \ + (void)H5E_dump_api_stack(TRUE); \ FUNC_LEAVE_API_THREADSAFE \ - return(ret_value); \ + return(ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ }} /*end scope from beginning of FUNC_ENTER*/ /* Use this macro to match the FUNC_ENTER_API_NOFS macro */ #define FUNC_LEAVE_API_NOFS(ret_value) \ FINISH_MPE_LOG; \ - H5TRACE_RETURN(ret_value); \ + H5TRACE_RETURN(ret_value); \ FUNC_LEAVE_API_THREADSAFE \ - return(ret_value); \ + return(ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ }} /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI(ret_value) \ H5_POP_FUNC \ - return(ret_value); \ + return(ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ #define FUNC_LEAVE_NOAPI_VOID \ H5_POP_FUNC \ - return; \ + return; \ } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ @@ -2025,7 +2025,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * (so far, just the H5CS routines themselves) */ #define FUNC_LEAVE_NOAPI_NOFS(ret_value) \ - return(ret_value); \ + return(ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ @@ -2034,7 +2034,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); if(H5AC_tag(tag_dxpl_id, prev_tag, NULL)<0) \ HDONE_ERROR(H5E_CACHE, H5E_CANTTAG, err, "unable to apply metadata tag") \ H5_POP_FUNC \ - return(ret_value); \ + return(ret_value); \ } /*end scope from end of FUNC_ENTER*/ \ } /*end scope from beginning of FUNC_ENTER*/ @@ -2061,17 +2061,17 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); ((HDisdigit(S[3]) || HDisupper(S[3])) && '_' == S[4] && '_' == S[5] && HDislower(S[6]))) #ifndef NDEBUG -#define FUNC_ENTER_NAME_CHECK(asrt) \ - { \ - static hbool_t func_check = FALSE; \ +#define FUNC_ENTER_NAME_CHECK(asrt) \ + { \ + static hbool_t func_check = FALSE; \ \ - if(!func_check) { \ - /* Check function naming status */ \ - HDassert(asrt); \ + if(!func_check) { \ + /* Check function naming status */ \ + HDassert(asrt); \ \ - /* Don't check again */ \ - func_check = TRUE; \ - } /* end if */ \ + /* Don't check again */ \ + func_check = TRUE; \ + } /* end if */ \ } /* end scope */ #else /* NDEBUG */ #define FUNC_ENTER_NAME_CHECK(asrt) @@ -2088,14 +2088,14 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); #define H5_CHECK_PACKAGE_INIT_INIT_NO(asrt) /* Macros to initialize package, if a package initialization routine is defined */ -#define H5_PKG_YES_INIT(pkg) \ - if(!H5_PACKAGE_INIT_VAR(pkg)) { \ - if(H5_GLUE(pkg, _pkg_init)() < 0) { \ - /* (Can't use H5E_THROW here) */ \ +#define H5_PKG_YES_INIT(pkg) \ + if(!H5_PACKAGE_INIT_VAR(pkg)) { \ + if(H5_GLUE(pkg, _pkg_init)() < 0) { \ + /* (Can't use H5E_THROW here) */ \ H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \ - ret_value = fail_value; \ - goto func_init_failed; \ - } /* end if */ \ + ret_value = fail_value; \ + goto func_init_failed; \ + } /* end if */ \ } /* end if */ #define H5_PKG_NO_INIT(pkg) @@ -2126,103 +2126,103 @@ extern hbool_t H5_api_entered_g; /* Has library already been entered through #endif /* Macros for entering different scopes of routines */ -#define H5_PACKAGE_ENTER(pkg, pkg_init, init) \ - FUNC_ENTER_NAME_CHECK(H5_IS_PKG(FUNCNAME)) \ +#define H5_PACKAGE_ENTER(pkg, pkg_init, init) \ + FUNC_ENTER_NAME_CHECK(H5_IS_PKG(FUNCNAME)) \ \ - /* The library should be initialized already */ \ - HDassert(H5_INIT_GLOBAL); \ + /* The library should be initialized already */ \ + HDassert(H5_INIT_GLOBAL); \ \ - /* This interface should be initialized already */ \ - /* (except for package initialization routines :-) */ \ - H5_GLUE4(H5_CHECK_PACKAGE_INIT_, init, _, pkg_init)(pkg) \ + /* This interface should be initialized already */ \ + /* (except for package initialization routines :-) */ \ + H5_GLUE4(H5_CHECK_PACKAGE_INIT_, init, _, pkg_init)(pkg) \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC(FUNCNAME) \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC(FUNCNAME) \ \ - /* Enter scope for this type of function */ \ + /* Enter scope for this type of function */ \ { -#define H5_PRIVATE_ENTER(pkg, pkg_init) \ - FUNC_ENTER_NAME_CHECK(H5_IS_PRIV(FUNCNAME)) \ +#define H5_PRIVATE_ENTER(pkg, pkg_init) \ + FUNC_ENTER_NAME_CHECK(H5_IS_PRIV(FUNCNAME)) \ \ - /* The library should be initialized already */ \ - HDassert(H5_INIT_GLOBAL); \ + /* The library should be initialized already */ \ + HDassert(H5_INIT_GLOBAL); \ \ - /* Initialize this interface if desired */ \ - H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ + /* Initialize this interface if desired */ \ + H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC(FUNCNAME) \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC(FUNCNAME) \ \ - /* Enter scope for this type of function */ \ + /* Enter scope for this type of function */ \ {{ -#define H5_PUBLIC_ENTER(pkg, pkg_init) \ - FUNC_ENTER_API_VARS(FUNCNAME) \ +#define H5_PUBLIC_ENTER(pkg, pkg_init) \ + FUNC_ENTER_API_VARS(FUNCNAME) \ FUNC_ENTER_API_THREADSAFE; \ - FUNC_ENTER_NAME_CHECK(H5_IS_PUB(FUNCNAME)) \ + FUNC_ENTER_NAME_CHECK(H5_IS_PUB(FUNCNAME)) \ \ - /* Clear thread error stack when entering public functions */ \ - H5E_clear_stack(NULL); \ + /* Clear thread error stack when entering public functions */ \ + H5E_clear_stack(NULL); \ \ - /* Initialize the library or bust */ \ - if(!(H5_INIT_GLOBAL)) { \ + /* Initialize the library or bust */ \ + if(!(H5_INIT_GLOBAL)) { \ H5_INIT_GLOBAL = TRUE; \ - if(H5_init_library() < 0) { \ - /* (Can't use H5E_THROW here) */ \ + if(H5_init_library() < 0) { \ + /* (Can't use H5E_THROW here) */ \ H5E_PRINTF(H5E_CANTINIT, "interface initialization failed"); \ - ret_value = fail_value; \ - goto func_init_failed; \ - } /* end if */ \ - } /* end if */ \ + ret_value = fail_value; \ + goto func_init_failed; \ + } /* end if */ \ + } /* end if */ \ \ - /* Initialize this interface if desired */ \ - H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ + /* Initialize this interface if desired */ \ + H5_GLUE3(H5_PKG_, pkg_init, _INIT)(pkg) \ \ - /* Check for re-entering API routine */ \ - HDassert(!H5_api_entered_g); \ - H5_api_entered_g = TRUE; \ + /* Check for re-entering API routine */ \ + HDassert(!H5_api_entered_g); \ + H5_api_entered_g = TRUE; \ \ - /* Start logging MPI's MPE information */ \ - BEGIN_MPE_LOG(FUNCNAME) \ + /* Start logging MPI's MPE information */ \ + BEGIN_MPE_LOG(FUNCNAME) \ \ - /* Push the name of this function on the function stack */ \ - H5_PUSH_FUNC(FUNCNAME) \ + /* Push the name of this function on the function stack */ \ + H5_PUSH_FUNC(FUNCNAME) \ \ - /* Enter scope for this type of function */ \ + /* Enter scope for this type of function */ \ {{{ /* Macros for substituting the package name */ -#define FUNC_ENTER_STATIC H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, REG) -#define FUNC_ENTER_PKGINIT H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, INIT) -#define FUNC_ENTER_PKG H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, REG) -#define FUNC_ENTER_PRIV H5_PRIVATE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT) -#define FUNC_ENTER_PUB H5_PUBLIC_ENTER(H5_MY_PKG, H5_MY_PKG_INIT) +#define FUNC_ENTER_STATIC H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, REG) +#define FUNC_ENTER_PKGINIT H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, INIT) +#define FUNC_ENTER_PKG H5_PACKAGE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT, REG) +#define FUNC_ENTER_PRIV H5_PRIVATE_ENTER(H5_MY_PKG, H5_MY_PKG_INIT) +#define FUNC_ENTER_PUB H5_PUBLIC_ENTER(H5_MY_PKG, H5_MY_PKG_INIT) /* Macros for substituting a function prefix */ -#define FUNC_PREFIX_STATIC static +#define FUNC_PREFIX_STATIC static #define FUNC_PREFIX_PKGINIT #define FUNC_PREFIX_PKG #define FUNC_PREFIX_PRIV #define FUNC_PREFIX_PUB /* Macros for declaring error variables */ -#define FUNC_ERR_VAR_ERR(ret_typ, err) \ - hbool_t past_catch = FALSE; \ +#define FUNC_ERR_VAR_ERR(ret_typ, err) \ + hbool_t past_catch = FALSE; \ ret_typ fail_value = err; -#define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) \ +#define FUNC_ERR_VAR_ERRCATCH(ret_typ, err) \ hbool_t past_catch = FALSE; #define FUNC_ERR_VAR_NOERR(ret_typ, err) /* Use this macro when entering all functions */ -#define BEGIN_FUNC(scope, use_err, ret_typ, ret_init, err, func) \ -H5_GLUE(FUNC_PREFIX_, scope) \ -ret_typ \ -func \ -/* Open function */ \ -{ \ - ret_typ ret_value = ret_init; \ - H5_GLUE(FUNC_ERR_VAR_, use_err)(ret_typ, err) \ +#define BEGIN_FUNC(scope, use_err, ret_typ, ret_init, err, func) \ +H5_GLUE(FUNC_PREFIX_, scope) \ +ret_typ \ +func \ +/* Open function */ \ +{ \ + ret_typ ret_value = ret_init; \ + H5_GLUE(FUNC_ERR_VAR_, use_err)(ret_typ, err) \ H5_GLUE(FUNC_ENTER_, scope) /* Macros for label when a function initialization can fail */ @@ -2231,73 +2231,73 @@ func \ #define H5_PRIV_FUNC_INIT_FAILED(pkg_init) H5_GLUE3(H5_PRIV_, pkg_init, _FUNC_INIT_FAILED) /* Macros for leaving different scopes of routines */ -#define FUNC_LEAVE_PKGINIT \ - /* Leave scope for this type of function */ \ - } \ +#define FUNC_LEAVE_PKGINIT \ + /* Leave scope for this type of function */ \ + } \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_STATIC \ - /* Leave scope for this type of function */ \ - } \ +#define FUNC_LEAVE_STATIC \ + /* Leave scope for this type of function */ \ + } \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_PKG \ - /* Leave scope for this type of function */ \ - } \ +#define FUNC_LEAVE_PKG \ + /* Leave scope for this type of function */ \ + } \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_PRIV \ - /* Leave scope for this type of function */ \ - }} \ +#define FUNC_LEAVE_PRIV \ + /* Leave scope for this type of function */ \ + }} \ \ - /* Label for errors during FUNC_ENTER */ \ - H5_PRIV_FUNC_INIT_FAILED(H5_MY_PKG_INIT) \ + /* Label for errors during FUNC_ENTER */ \ + H5_PRIV_FUNC_INIT_FAILED(H5_MY_PKG_INIT) \ \ - /* Pop the name of this function off the function stack */ \ + /* Pop the name of this function off the function stack */ \ H5_POP_FUNC -#define FUNC_LEAVE_PUB \ - /* Leave scope for this type of function */ \ - }}} \ +#define FUNC_LEAVE_PUB \ + /* Leave scope for this type of function */ \ + }}} \ \ - /* Label for errors during FUNC_ENTER */ \ -func_init_failed: \ + /* Label for errors during FUNC_ENTER */ \ +func_init_failed: \ \ - /* Dump error stack if an error occurred during API routine */ \ - if(ret_value == fail_value) \ - (void)H5E_dump_api_stack(TRUE); \ + /* Dump error stack if an error occurred during API routine */ \ + if(ret_value == fail_value) \ + (void)H5E_dump_api_stack(TRUE); \ \ - /* Finish the API tracing info */ \ - H5TRACE_RETURN(ret_value); \ + /* Finish the API tracing info */ \ + H5TRACE_RETURN(ret_value); \ \ - /* Pop the name of this function off the function stack */ \ - H5_POP_FUNC \ + /* Pop the name of this function off the function stack */ \ + H5_POP_FUNC \ \ - /* Finish the MPE tracing info */ \ - FINISH_MPE_LOG; \ + /* Finish the MPE tracing info */ \ + FINISH_MPE_LOG; \ \ - /* Check for leaving API routine */ \ - HDassert(H5_api_entered_g); \ - H5_api_entered_g = FALSE; \ + /* Check for leaving API routine */ \ + HDassert(H5_api_entered_g); \ + H5_api_entered_g = FALSE; \ \ - /* Release thread-safety semaphore */ \ + /* Release thread-safety semaphore */ \ FUNC_LEAVE_API_THREADSAFE /* Use this macro when leaving all functions */ -#define END_FUNC(scope) \ - /* Scope-specific function conclusion */ \ - H5_GLUE(FUNC_LEAVE_, scope) \ +#define END_FUNC(scope) \ + /* Scope-specific function conclusion */ \ + H5_GLUE(FUNC_LEAVE_, scope) \ \ - /* Leave routine */ \ - return(ret_value); \ + /* Leave routine */ \ + return(ret_value); \ \ - /* Close Function */ \ + /* Close Function */ \ } /* Macro to begin/end tagging (when FUNC_ENTER_*TAG macros are insufficient) */ diff --git a/src/H5system.c b/src/H5system.c index e46b7c3..1f0ad29 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -604,7 +604,7 @@ HDremove_all(const char *fname) * *------------------------------------------------------------------------- */ -#ifdef _WIN32 /* H5_HAVE_VISUAL_STUDIO */ +#ifdef H5_HAVE_VISUAL_STUDIO /* Offset between 1/1/1601 and 1/1/1970 in 100 nanosecond units */ #define _W32_FT_OFFSET (116444736000000000ULL) diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 743ceaa..5daef23 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -23,7 +23,7 @@ * */ -#ifdef _WIN32 +#ifdef H5_HAVE_WIN32_API typedef struct _stati64 h5_stat_t; typedef __int64 h5_stat_size_t; @@ -33,17 +33,35 @@ typedef __int64 h5_stat_size_t; #define HDdup(F) _dup(F) #define HDfdopen(N,S) _fdopen(N,S) #define HDfileno(F) _fileno(F) -#if _MSC_VER > 1310 /* Newer than VS.NET 2003 */ #define HDftruncate(F,L) _chsize_s(F,L) -#else -#define HDftruncate(F,L) chsize(F,L) -#endif #define HDfstat(F,B) _fstati64(F,B) #define HDisatty(F) _isatty(F) -#define HDlstat(S,B) _lstati64(S,B) -#define HDstat(S,B) _stati64(S,B) #define HDgetcwd(S,Z) _getcwd(S,Z) #define HDgetdcwd(D,S,Z) _getdcwd(D,S,Z) +#define HDgetdrive() _getdrive() +#define HDlseek(F,O,W) _lseeki64(F,O,W) +#define HDlstat(S,B) _lstati64(S,B) +#define HDmkdir(S,M) _mkdir(S) +#define HDoff_t __int64 +#define HDopen(S,F,M) _open(S,F|_O_BINARY,M) +#define HDread(F,M,Z) _read(F,M,Z) +#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2)) +#define HDsleep(S) Sleep(S*1000) +#define HDstat(S,B) _stati64(S,B) +#define HDstrcasecmp(A,B) _stricmp(A,B) +#define HDstrtoull(S,R,N) _strtoui64(S,R,N) +#define HDstrdup(S) _strdup(S) +#define HDsnprintf _snprintf /*varargs*/ +#define HDtzset() _tzset() +#define HDunlink(S) _unlink(S) +#define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A) +#define HDwrite(F,M,Z) _write(F,M,Z) + +#ifdef H5_HAVE_VISUAL_STUDIO +/* + * The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO + */ +#define HDmemset(X,C,Z) memset((void*)(X),C,Z) struct timezone { int tz_minuteswest; @@ -60,24 +78,8 @@ struct timezone { #endif /* __cplusplus */ #define HDgettimeofday(V,Z) Wgettimeofday(V,Z) #define HDgetlogin() Wgetlogin() - -#define HDgetdrive() _getdrive() -#define HDlseek(F,O,W) _lseeki64(F,O,W) -#define HDoff_t __int64 -#define HDmemset(X,C,Z) memset((void*)(X),C,Z) -#define HDmkdir(S,M) _mkdir(S) -#define HDopen(S,F,M) _open(S,F|_O_BINARY,M) -#define HDread(F,M,Z) _read(F,M,Z) -#define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2)) -#define HDsleep(S) Sleep(S*1000) -#define HDstrcasecmp(A,B) _stricmp(A,B) -#define HDstrtoull(S,R,N) _strtoui64(S,R,N) -#define HDstrdup(S) _strdup(S) -#define HDsnprintf _snprintf /*varargs*/ -#define HDtzset() _tzset() -#define HDunlink(S) _unlink(S) -#define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A) -#define HDwrite(F,M,Z) _write(F,M,Z) + +#endif /* H5_HAVE_VISUAL_STUDIO */ /* Non-POSIX functions */ @@ -85,5 +87,4 @@ struct timezone { * type cannot be cast as a ulong like other systems. */ #define HDpthread_self_ulong() ((unsigned long)GetCurrentThreadId()) - -#endif /* _WIN32 */ +#endif /* H5_HAVE_WIN32_API */ |