summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-08-26 15:03:03 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-08-26 15:03:03 (GMT)
commit7e9c4449d4a78e756f6935ef828bc440224a86ab (patch)
treeef5c939922e2c1e227b32498d92f0eb3ff962ac5
parentc1b11ba3c438403b996998671bc1119a62be6995 (diff)
downloadhdf5-7e9c4449d4a78e756f6935ef828bc440224a86ab.zip
hdf5-7e9c4449d4a78e756f6935ef828bc440224a86ab.tar.gz
hdf5-7e9c4449d4a78e756f6935ef828bc440224a86ab.tar.bz2
[svn-r7411] Purpose:
Code cleanup Description: De-linted more modules Platforms tested: FreeBSD 4.8 (sleipnir) w/ & w/o stream enabled too minor to require h5committest
-rw-r--r--src/H5FDmulti.c3
-rw-r--r--src/H5FDsec2.c6
-rw-r--r--src/H5FDstdio.c149
-rw-r--r--src/H5FDstream.c157
-rw-r--r--src/H5private.h4
-rwxr-xr-xsrc/hdf5.lnt5
6 files changed, 147 insertions, 177 deletions
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index e5f5f2e..d4ada22 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -28,8 +28,7 @@
/* Disable certain warnings in PC-Lint: */
/*lint --emacro( {534, 830}, H5P_DEFAULT, H5P_FILE_ACCESS, H5P_DATASET_XFER) */
-/*lint --emacro( {534, 830}, H5F_ACC_DEBUG) */
-/*lint --emacro( {534, 830}, H5F_ACC_RDWR) */
+/*lint --emacro( {534, 830}, H5F_ACC_DEBUG, H5F_ACC_RDWR) */
/*lint --emacro( {534, 830}, H5FD_MULTI) */
/*lint -esym( 534, H5Eclear, H5Epush) */
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index ceacaab..5b73475 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -114,7 +114,7 @@ typedef struct H5FD_sec2_t {
# /*MSVC*/
# define file_offset_t __int64
# define file_seek _lseeki64
-# define file_truncate _ftruncatei64
+# define file_truncate _chsize
#else
# define file_offset_t off_t
# define file_seek lseek
@@ -141,7 +141,6 @@ typedef struct H5FD_sec2_t {
((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))
@@ -306,6 +305,9 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
FUNC_ENTER_NOAPI(H5FD_sec2_open, NULL)
+ /* Sanity check on file offsets */
+ assert(sizeof(file_offset_t)>=sizeof(size_t));
+
/* Check arguments */
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name")
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 77a8720..20350f1 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -27,6 +27,11 @@
#include <stdlib.h>
#include <sys/stat.h>
+/* Disable certain warnings in PC-Lint: */
+/*lint --emacro( {534, 830}, H5P_FILE_ACCESS) */
+/*lint --emacro( {534, 830}, H5F_ACC_RDWR, H5F_ACC_EXCL) */
+/*lint -esym( 534, H5Eclear, H5Epush) */
+
#include "hdf5.h"
#ifdef H5_HAVE_STDIO_H
@@ -39,6 +44,12 @@
#ifdef WIN32
#include <windows.h>
#include <io.h>
+
+/* This is not defined in the Windows header files */
+#ifndef F_OK
+#define F_OK 00
+#endif
+
#endif
@@ -47,12 +58,6 @@
#endif /* MAX */
#define MAX(X,Y) ((X)>(Y)?(X):(Y))
-#ifndef F_OK
-#define F_OK 00
-#define W_OK 02
-#define R_OK 04
-#endif
-
/* The driver identification number, initialized at runtime */
static hid_t H5FD_STDIO_g = 0;
@@ -101,8 +106,8 @@ typedef struct H5FD_stdio_t {
* identifier and the volume serial number to determine whether two
* handles refer to the same file.
*/
- int fileindexlo;
- int fileindexhi;
+ DWORD fileindexlo;
+ DWORD fileindexhi;
#endif
} H5FD_stdio_t;
@@ -122,22 +127,11 @@ typedef struct H5FD_stdio_t {
* argument of the file seek function.
*/
/* adding for windows NT filesystem support. */
-#ifdef WIN32
-#define MAXADDR (((haddr_t)1<<(8*sizeof(LONGLONG)-1))-1)
-#else
-#define MAXADDR (((haddr_t)1<<(8*sizeof(long)-1))-1)
-#endif
-
+#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)
-
-#ifdef WIN32
-#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \
- sizeof(LONGLONG)<sizeof(size_t) || HADDR_UNDEF==(A)+(Z) || (LONGLONG)((A)+(Z))<(LONGLONG)(A))
-#else
#define REGION_OVERFLOW(A,Z) (ADDR_OVERFLOW(A) || SIZE_OVERFLOW(Z) || \
- sizeof(long)<sizeof(size_t) || HADDR_UNDEF==(A)+(Z) || (long)((A)+(Z))<(long)(A))
-#endif
+ HADDR_UNDEF==(A)+(Z) || (file_offset_t)((A)+(Z))<(file_offset_t)(A))
#ifdef H5_HAVE_LSEEK64
# define file_offset_t off64_t
@@ -145,7 +139,7 @@ typedef struct H5FD_stdio_t {
#elif defined (WIN32) && !defined(__MWERKS__)
# /*MSVC*/
# define file_offset_t __int64
-# define file_truncate _ftruncatei64
+# define file_truncate _chsize
#else
# define file_offset_t off_t
# define file_truncate ftruncate
@@ -258,7 +252,7 @@ H5Pset_fapl_stdio(hid_t fapl_id)
H5Eclear(H5E_DEFAULT);
if(0 == H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_PLIST, H5E_BADTYPE, "not a file access property list", -1)
return H5Pset_driver(fapl_id, H5FD_STDIO, NULL);
}
@@ -304,11 +298,13 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id,
HFILE filehandle;
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
int fd;
- int results;
#else /* WIN32 */
struct stat sb;
#endif /* WIN32 */
+ /* Sanity check on file offsets */
+ assert(sizeof(file_offset_t)>=sizeof(size_t));
+
/* Shut compiler up */
fapl_id=fapl_id;
@@ -317,21 +313,21 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id,
/* Check arguments */
if (!name || !*name)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADVALUE, "invalid file name", NULL)
if (0==maxaddr || HADDR_UNDEF==maxaddr)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_BADRANGE, "bogus maxaddr", NULL)
if (ADDR_OVERFLOW(maxaddr))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_OVERFLOW, "maxaddr too large", NULL);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_OVERFLOW, "maxaddr too large", NULL)
if (access(name, F_OK) < 0) {
if ((flags & H5F_ACC_CREAT) && (flags & H5F_ACC_RDWR)) {
f = fopen(name, "wb+");
write_access=1; /* Note the write access */
- } else {
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "file doesn't exist and CREAT wasn't specified", NULL);
}
+ else
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "file doesn't exist and CREAT wasn't specified", NULL)
} else if ((flags & H5F_ACC_CREAT) && (flags & H5F_ACC_EXCL)) {
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_FILEEXISTS, "file exists but CREAT and EXCL were specified", NULL);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_FILEEXISTS, "file exists but CREAT and EXCL were specified", NULL)
} else if (flags & H5F_ACC_RDWR) {
if (flags & H5F_ACC_TRUNC)
f = fopen(name, "wb+");
@@ -342,11 +338,11 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id,
f = fopen(name, "rb");
}
if (!f)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "fopen failed", NULL);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "fopen failed", NULL)
/* Build the return value */
if (NULL==(file = calloc(1,sizeof(H5FD_stdio_t))))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL)
file->fp = f;
file->op = H5FD_STDIO_OP_SEEK;
file->pos = HADDR_UNDEF;
@@ -356,7 +352,7 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id,
} else {
long x = ftell (file->fp);
assert (x>=0);
- file->eof = x;
+ file->eof = (haddr_t)x;
}
/* The unique key */
@@ -364,7 +360,7 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id,
/*#error "Needs correct fileindexhi & fileindexlo, code below is from sec2 driver"*/
fd = _fileno(f);
filehandle = _get_osfhandle(fd);
- results = GetFileInformationByHandle((HANDLE)filehandle, &fileinfo);
+ (void)GetFileInformationByHandle((HANDLE)filehandle, &fileinfo);
file->fileindexhi = fileinfo.nFileIndexHigh;
file->fileindexlo = fileinfo.nFileIndexLow;
#else
@@ -404,7 +400,7 @@ H5FD_stdio_close(H5FD_t *_file)
H5Eclear(H5E_DEFAULT);
if (fclose(file->fp) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CLOSEERROR, "fclose failed", -1);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CLOSEERROR, "fclose failed", -1)
free(file);
@@ -628,7 +624,7 @@ H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle)
*file_handle = &(file->fp);
if(*file_handle==NULL)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "get handle failed", -1);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "get handle failed", -1)
return(0);
}
@@ -674,16 +670,16 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
/* Check for overflow */
if (HADDR_UNDEF==addr)
- H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+ H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1)
if (REGION_OVERFLOW(addr, size))
- H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+ H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1)
if (addr+size>file->eoa)
- H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+ H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1)
/* Check easy cases */
if (0 == size)
return(0);
- if ((haddr_t)addr >= file->eof) {
+ if ((haddr_t)addr >= file->eof) {
memset(buf, 0, size);
return(0);
}
@@ -693,28 +689,18 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
*/
if (!(file->op == H5FD_STDIO_OP_READ || file->op==H5FD_STDIO_OP_SEEK) ||
file->pos != addr) {
-#ifdef WIN32
- fpos_t tempos =(fpos_t)(addr+SEEK_SET);
- if (fsetpos(file->fp,&tempos)!=0) {
- file->op = H5FD_STDIO_OP_UNKNOWN;
- file->pos = HADDR_UNDEF;
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fsetpos failed", -1);
- }
-#else
-
if (fseek(file->fp, (long)addr, SEEK_SET) < 0) {
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1)
}
-#endif
file->pos = addr;
}
/*
* Read zeros past the logical end of file (physical is handled below)
*/
- if ((size_t) addr + size > file->eof) {
+ if (addr + size > file->eof) {
size_t nbytes = (size_t) (addr + size - file->eof);
memset((unsigned char *)buf + size - nbytes, 0, nbytes);
size -= nbytes;
@@ -722,14 +708,14 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
/*
* Read the data. Since we're reading single-byte values, a partial read
- * will advance the file position by N. If N is negative or an error
+ * will advance the file position by N. If N is zero or an error
* occurs then the file position is undefined.
*/
n = fread(buf, 1, size, file->fp);
- if (n <= 0 && ferror(file->fp)) {
+ if (n == 0 && ferror(file->fp)) {
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_READERROR, "fread failed", -1);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_READERROR, "fread failed", -1)
} else if (n < size) {
memset((unsigned char *)buf + n, 0, (size - n));
}
@@ -770,10 +756,6 @@ 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)
{
-#ifdef WIN32
- fpos_t tempos;
-#endif
-
H5FD_stdio_t *file = (H5FD_stdio_t*)_file;
static const char *func="H5FD_stdio_write"; /* Function Name for error reporting */
@@ -786,32 +768,22 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
/* Check for overflow conditions */
if (HADDR_UNDEF==addr)
- H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+ H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1)
if (REGION_OVERFLOW(addr, size))
- H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+ H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1)
if (addr+size>file->eoa)
- H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1);
+ H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1)
/*
* Seek to the correct file position.
*/
if ((file->op != H5FD_STDIO_OP_WRITE && file->op != H5FD_STDIO_OP_SEEK) ||
file->pos != addr) {
-#ifdef WIN32
- tempos =(fpos_t)(addr+SEEK_SET);
-
- if (fsetpos(file->fp,&tempos) != 0) {
- file->op = H5FD_STDIO_OP_UNKNOWN;
- file->pos = HADDR_UNDEF;
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fsetpos failed", -1);
- }
-#else
if (fseek(file->fp, (long)addr, SEEK_SET) < 0) {
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1)
}
-#endif /* WIN32 */
file->pos = addr;
}
@@ -823,7 +795,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
if (size != fwrite(buf, 1, size, file->fp)) {
file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fwrite failed", -1);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fwrite failed", -1)
}
/*
@@ -831,18 +803,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
*/
file->op = H5FD_STDIO_OP_WRITE;
file->pos = addr + size;
-/* The following code needs to be added for windows VC 6.0. This should be a VC++
- compiler bug. When not using ftell and fseek, although you reset the position to
- the starting of the file, fwrite will somehow to go to the end of the file and
- add contents. It seems they used a circular seeking algorithm, the starting point
- overlaps with the ending point and windows doesn't handle correctly for the case when
- file was written to the disk close to the end of the file and rewrite from the beginning
- of the file. This is how HDF5 signature was written for some failing cases. */
-#ifdef WIN32
- tempos = ftell(file->fp);
- fseek(file->fp,tempos,SEEK_SET);
-#endif
/* Update EOF if necessary */
if (file->pos>file->eof)
file->eof = file->pos;
@@ -886,25 +847,27 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing)
if(file->write_access) {
/* Makes sure that the true file size is the same as the end-of-address. */
if (file->eoa!=file->eof) {
- int fd=fileno(file->fp); /* File descriptor for HDF5 file */
#ifdef WIN32
+ int fd=_fileno(file->fp); /* File descriptor for HDF5 file */
HFILE filehandle; /* Windows file handle */
LARGE_INTEGER li; /* 64-bit integer for SetFilePointer() call */
- fd = _fileno(file->fp);
/* Map the posix file handle to a Windows file handle */
filehandle = _get_osfhandle(fd);
/* Translate 64-bit integers into form Windows wants */
/* [This algorithm is from the Windows documentation for SetFilePointer()] */
- li.QuadPart = file->eoa;
- SetFilePointer((HANDLE)filehandle,li.LowPart,&li.HighPart,FILE_BEGIN);
+ li.QuadPart = (LONGLONG)file->eoa;
+ (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 extend file properly", -1);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "unable to extend file properly", -1)
#else /* WIN32 */
+ int fd=fileno(file->fp); /* File descriptor for HDF5 file */
+
if (-1==file_truncate(fd, (file_offset_t)file->eoa))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "unable to extend file properly", -1);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "unable to extend file properly", -1)
#endif /* WIN32 */
+
/* Update the eof value */
file->eof = file->eoa;
@@ -918,13 +881,13 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing)
*/
if(!closing) {
if (fflush(file->fp) < 0)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1)
} /* end if */
} /* end if */
else {
/* Double-check for problems */
if (file->eoa>file->eof)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_TRUNCATED, "eoa>eof!", -1);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_TRUNCATED, "eoa>eof!", -1)
} /* end else */
return(0);
diff --git a/src/H5FDstream.c b/src/H5FDstream.c
index e2d4736..0ca16ac 100644
--- a/src/H5FDstream.c
+++ b/src/H5FDstream.c
@@ -25,18 +25,17 @@
/* (Put before include files to avoid problems with inline functions) */
#define PABLO_MASK H5FD_stream_mask
-#include "H5private.h" /* library function */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FDpublic.h" /* Public file drivers */
+#include "H5FDstream.h" /* Stream file driver */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
/* Only build this driver if it was configured with --with-Stream-VFD */
#ifdef H5_HAVE_STREAM
-#include "H5Eprivate.h" /* error handling */
-#include "H5FDpublic.h" /* Public VFD header */
-#include "H5FDstream.h" /* Stream VFD header */
-#include "H5Iprivate.h" /* IDs */
-#include "H5MMprivate.h" /* memory allocation */
-#include "H5Pprivate.h" /* property prototypes */
-
#ifdef H5FD_STREAM_HAVE_UNIX_SOCKETS
#ifdef H5_HAVE_SYS_TYPES_H
#include <sys/types.h> /* socket stuff */
@@ -228,7 +227,7 @@ hid_t H5FD_stream_init (void)
{
hid_t ret_value=H5FD_STREAM_g; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_stream_init, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_stream_init, FAIL)
if (H5I_VFL != H5Iget_type (H5FD_STREAM_g)) {
H5FD_STREAM_g = H5FDregister (&H5FD_stream_g);
@@ -246,7 +245,7 @@ hid_t H5FD_stream_init (void)
ret_value=H5FD_STREAM_g;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -276,15 +275,15 @@ herr_t H5Pset_fapl_stream (hid_t fapl_id, H5FD_stream_fapl_t *fapl)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pset_fapl_stream, FAIL);
+ FUNC_ENTER_API(H5Pset_fapl_stream, FAIL)
H5TRACE2 ("e", "ix", fapl_id, fapl);
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR (H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl");
+ HGOTO_ERROR (H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl")
if (fapl) {
if (! fapl->do_socket_io && fapl->broadcast_fn == NULL)
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "read broadcast function pointer is NULL");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "read broadcast function pointer is NULL")
user_fapl = *fapl;
if (fapl->increment == 0)
@@ -296,7 +295,7 @@ herr_t H5Pset_fapl_stream (hid_t fapl_id, H5FD_stream_fapl_t *fapl)
ret_value = H5P_set_driver (plist, H5FD_STREAM, &default_fapl);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -321,21 +320,21 @@ herr_t H5Pget_fapl_stream(hid_t fapl_id, H5FD_stream_fapl_t *fapl /* out */)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pget_fapl_stream, FAIL);
+ FUNC_ENTER_API(H5Pget_fapl_stream, FAIL)
H5TRACE2("e","ix",fapl_id,fapl);
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR (H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl");
+ HGOTO_ERROR (H5E_PLIST, H5E_BADTYPE, FAIL, "not a fapl")
if (H5FD_STREAM != H5P_get_driver (plist))
- HGOTO_ERROR (H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver");
+ HGOTO_ERROR (H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver")
if (NULL == (this_fapl = H5P_get_driver_info (plist)))
- HGOTO_ERROR (H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info");
+ HGOTO_ERROR (H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info")
if (fapl)
*fapl = *this_fapl;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -361,10 +360,10 @@ H5FD_stream_fapl_get (H5FD_t *_stream)
H5FD_stream_fapl_t *fapl;
void *ret_value;
- FUNC_ENTER_NOAPI(H5FD_stream_fapl_get, NULL);
+ FUNC_ENTER_NOAPI(H5FD_stream_fapl_get, NULL)
if ((fapl = H5MM_calloc (sizeof (H5FD_stream_fapl_t))) == NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
*fapl = stream->fapl;
@@ -372,7 +371,7 @@ H5FD_stream_fapl_get (H5FD_t *_stream)
ret_value=fapl;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -389,20 +388,20 @@ H5FD_stream_open_socket (const char *filename, int o_flags,
int on = 1;
H5FD_STREAM_SOCKET_TYPE ret_value=H5FD_STREAM_INVALID_SOCKET;
- FUNC_ENTER_NOINIT(H5FD_stream_open_socket);
+ FUNC_ENTER_NOINIT(H5FD_stream_open_socket)
/* Parse "hostname:port" from filename argument */
for (separator = filename; *separator != ':' && *separator; separator++)
;
if (separator == filename || !*separator) {
- HGOTO_ERROR(H5E_ARGS,H5E_BADVALUE,H5FD_STREAM_INVALID_SOCKET,"invalid host address");
+ HGOTO_ERROR(H5E_ARGS,H5E_BADVALUE,H5FD_STREAM_INVALID_SOCKET,"invalid host address")
} else {
tmp = separator;
if (! tmp[1])
- HGOTO_ERROR(H5E_ARGS,H5E_BADVALUE,H5FD_STREAM_INVALID_SOCKET,"no port number");
+ HGOTO_ERROR(H5E_ARGS,H5E_BADVALUE,H5FD_STREAM_INVALID_SOCKET,"no port number")
while (*++tmp) {
if (! isdigit (*tmp))
- HGOTO_ERROR(H5E_ARGS,H5E_BADVALUE,H5FD_STREAM_INVALID_SOCKET,"invalid port number");
+ HGOTO_ERROR(H5E_ARGS,H5E_BADVALUE,H5FD_STREAM_INVALID_SOCKET,"invalid port number")
}
}
@@ -410,7 +409,7 @@ H5FD_stream_open_socket (const char *filename, int o_flags,
/* Return if out of memory */
if (hostname == NULL)
- HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"memory allocation failed");
+ HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"memory allocation failed")
HDstrncpy (hostname, filename, (size_t)(separator - filename));
hostname[separator - filename] = 0;
@@ -421,9 +420,9 @@ H5FD_stream_open_socket (const char *filename, int o_flags,
server.sin_port = htons (fapl->port);
if (! (he = gethostbyname (hostname))) {
- HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to get host address");
+ HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to get host address")
} else if (H5FD_STREAM_ERROR_CHECK (sock = socket (AF_INET, SOCK_STREAM, 0)))
- HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to open socket");
+ HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to open socket")
if (O_RDONLY == o_flags) {
HDmemcpy (&server.sin_addr, he->h_addr, (size_t)he->h_length);
@@ -432,18 +431,18 @@ H5FD_stream_open_socket (const char *filename, int o_flags,
hostname, fapl->port);
#endif
if (connect (sock, (struct sockaddr *) &server, sizeof (server)) < 0)
- HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to connect");
+ HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to connect")
}
else {
server.sin_addr.s_addr = INADDR_ANY;
if (H5FD_STREAM_IOCTL_SOCKET (sock, FIONBIO, &on) < 0) {
- HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to set non-blocking mode for socket");
+ HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to set non-blocking mode for socket")
} else if (setsockopt (sock, IPPROTO_TCP, TCP_NODELAY, (const char *) &on,
sizeof(on)) < 0) {
- HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to set socket option TCP_NODELAY");
+ HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to set socket option TCP_NODELAY")
} else if (setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, (const char *) &on,
sizeof(on)) < 0) {
- HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to set socket option SO_REUSEADDR");
+ HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to set socket option SO_REUSEADDR")
} else {
/* Try to bind the socket to the given port.
If maxhunt is given try some successive ports also. */
@@ -460,10 +459,10 @@ H5FD_stream_open_socket (const char *filename, int o_flags,
}
if (fapl->port > first_port + fapl->maxhunt) {
fapl->port = 0;
- HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to bind socket");
+ HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to bind socket")
}
else if (listen (sock, fapl->backlog) < 0)
- HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to listen on socket");
+ HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,H5FD_STREAM_INVALID_SOCKET,"unable to listen on socket")
}
}
@@ -481,7 +480,7 @@ done:
H5FD_STREAM_CLOSE_SOCKET(sock);
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -493,7 +492,7 @@ H5FD_stream_read_from_socket (H5FD_stream_t *stream)
unsigned char *ptr=NULL;
herr_t ret_value=SUCCEED;
- FUNC_ENTER_NOINIT(H5FD_stream_read_from_socket);
+ FUNC_ENTER_NOINIT(H5FD_stream_read_from_socket)
stream->eof = 0;
stream->mem = NULL;
@@ -510,7 +509,7 @@ H5FD_stream_read_from_socket (H5FD_stream_t *stream)
max_size++;
ptr = H5MM_realloc (stream->mem, (size_t) (stream->eof + max_size));
if (! ptr)
- HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"unable to allocate file space buffer");
+ HGOTO_ERROR(H5E_RESOURCE,H5E_NOSPACE,FAIL,"unable to allocate file space buffer")
stream->mem = ptr;
ptr += stream->eof;
}
@@ -521,7 +520,7 @@ H5FD_stream_read_from_socket (H5FD_stream_t *stream)
if (size < 0 && (EINTR == errno || EAGAIN == errno || EWOULDBLOCK))
continue;
if (size < 0)
- HGOTO_ERROR(H5E_IO,H5E_READERROR,FAIL,"error reading from file from socket");
+ HGOTO_ERROR(H5E_IO,H5E_READERROR,FAIL,"error reading from file from socket")
if (! size)
break;
max_size -= (size_t) size;
@@ -538,7 +537,7 @@ H5FD_stream_read_from_socket (H5FD_stream_t *stream)
(int) stream->eof);
#endif
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -574,15 +573,15 @@ H5FD_stream_open (const char *filename,
H5P_genplist_t *plist=NULL; /* Property list pointer */
H5FD_t *ret_value; /* Function return value */
- FUNC_ENTER_NOAPI(H5FD_stream_open, NULL);
+ FUNC_ENTER_NOAPI(H5FD_stream_open, NULL)
/* Check arguments */
if (filename == NULL|| *filename == '\0')
- HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, NULL,"invalid file name");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, NULL,"invalid file name")
if (maxaddr == 0 || HADDR_UNDEF == maxaddr)
- HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr");
+ HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr")
if (ADDR_OVERFLOW (maxaddr))
- HGOTO_ERROR (H5E_ARGS, H5E_OVERFLOW, NULL, "maxaddr overflow");
+ HGOTO_ERROR (H5E_ARGS, H5E_OVERFLOW, NULL, "maxaddr overflow")
/* Build the open flags */
o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY;
@@ -591,17 +590,17 @@ H5FD_stream_open (const char *filename,
if (H5F_ACC_EXCL & flags) o_flags |= O_EXCL;
if ((O_RDWR & o_flags) && ! (O_CREAT & o_flags))
- HGOTO_ERROR (H5E_ARGS, H5E_UNSUPPORTED, NULL, "open stream for read/write not supported");
+ HGOTO_ERROR (H5E_ARGS, H5E_UNSUPPORTED, NULL, "open stream for read/write not supported")
#ifdef WIN32
if (WSAStartup (MAKEWORD (2, 0), &wsadata))
- HGOTO_ERROR (H5E_IO, H5E_CANTINIT, NULL, "Couldn't start Win32 socket layer");
+ HGOTO_ERROR (H5E_IO, H5E_CANTINIT, NULL, "Couldn't start Win32 socket layer")
#endif
fapl = NULL;
if (H5P_FILE_ACCESS_DEFAULT != 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");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
fapl = H5P_get_driver_info (plist);
}
if (fapl == NULL)
@@ -610,7 +609,7 @@ H5FD_stream_open (const char *filename,
/* Create the new file struct */
stream = (H5FD_stream_t *) H5MM_calloc (sizeof (H5FD_stream_t));
if (stream == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct")
stream->fapl = *fapl;
stream->socket = H5FD_STREAM_INVALID_SOCKET;
@@ -631,7 +630,7 @@ H5FD_stream_open (const char *filename,
H5P_set_driver (plist, H5FD_STREAM, &stream->fapl);
}
else
- HGOTO_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "can't open internal socket");
+ HGOTO_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL, "can't open internal socket")
}
}
@@ -642,18 +641,18 @@ H5FD_stream_open (const char *filename,
fprintf (stderr, "Stream VFD: reading file from socket\n");
#endif
if(H5FD_stream_read_from_socket (stream)<0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "can't read file from socket");
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "can't read file from socket")
}
/* Now call the user's broadcast routine if given */
if (fapl->broadcast_fn) {
if ((fapl->broadcast_fn) (&stream->mem, &stream->eof,
fapl->broadcast_arg) < 0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "broadcast error");
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "broadcast error")
/* check for filesize of zero bytes */
if (stream->eof == 0)
- HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "zero filesize");
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "zero filesize")
}
/* For files which are read from a socket:
@@ -677,7 +676,7 @@ done:
} /* end if */
}
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -710,7 +709,7 @@ H5FD_stream_flush (H5FD_t *_stream, hid_t UNUSED dxpl_id, unsigned UNUSED closin
H5FD_STREAM_SOCKET_TYPE sock;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_stream_flush, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_stream_flush, FAIL)
/* Write to backing store */
if (stream->dirty && ! H5FD_STREAM_ERROR_CHECK (stream->socket)) {
@@ -750,7 +749,7 @@ H5FD_stream_flush (H5FD_t *_stream, hid_t UNUSED dxpl_id, unsigned UNUSED closin
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -775,7 +774,7 @@ H5FD_stream_close (H5FD_t *_stream)
H5FD_stream_t *stream = (H5FD_stream_t *) _stream;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_stream_close, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_stream_close, FAIL)
/* Release resources */
if (! H5FD_STREAM_ERROR_CHECK (stream->socket) && stream->internal_socket)
@@ -786,7 +785,7 @@ H5FD_stream_close (H5FD_t *_stream)
H5MM_xfree (stream);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -813,7 +812,7 @@ H5FD_stream_query(const H5FD_t UNUSED * _f,
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_stream_query, SUCCEED);
+ FUNC_ENTER_NOAPI(H5FD_stream_query, SUCCEED)
/* Set the VFL feature flags that this driver supports */
if (flags) {
@@ -824,7 +823,7 @@ H5FD_stream_query(const H5FD_t UNUSED * _f,
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -851,13 +850,13 @@ H5FD_stream_get_eoa (H5FD_t *_stream)
H5FD_stream_t *stream = (H5FD_stream_t *) _stream;
haddr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_stream_get_eoa, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_stream_get_eoa, HADDR_UNDEF)
/* Set return value */
ret_value=stream->eoa;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -884,15 +883,15 @@ H5FD_stream_set_eoa (H5FD_t *_stream, haddr_t addr)
H5FD_stream_t *stream = (H5FD_stream_t *) _stream;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_stream_set_eoa, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_stream_set_eoa, FAIL)
if (ADDR_OVERFLOW (addr))
- HGOTO_ERROR (H5E_ARGS, H5E_OVERFLOW, FAIL, "address overflow");
+ HGOTO_ERROR (H5E_ARGS, H5E_OVERFLOW, FAIL, "address overflow")
stream->eoa = addr;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -921,13 +920,13 @@ H5FD_stream_get_eof (H5FD_t *_stream)
H5FD_stream_t *stream = (H5FD_stream_t *) _stream;
haddr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_stream_get_eof, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_stream_get_eof, HADDR_UNDEF)
/* Set return value */
ret_value= MAX (stream->eof, stream->eoa);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -951,15 +950,15 @@ H5FD_stream_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle)
H5FD_stream_t *file = (H5FD_stream_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5FD_stream_get_handle, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_stream_get_handle, FAIL)
if(!file_handle)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid")
*file_handle = &(file->socket);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -994,18 +993,18 @@ H5FD_stream_read (H5FD_t *_stream,
size_t nbytes;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_stream_read, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_stream_read, FAIL)
assert (stream && stream->pub.cls);
assert (buf);
/* Check for overflow conditions */
if (HADDR_UNDEF == addr)
- HGOTO_ERROR (H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed");
+ HGOTO_ERROR (H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed")
if (REGION_OVERFLOW (addr, size))
- HGOTO_ERROR (H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed");
+ HGOTO_ERROR (H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed")
if (addr + size > stream->eoa)
- HGOTO_ERROR (H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed");
+ HGOTO_ERROR (H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed")
/* Read the part which is before the EOF marker */
if (addr < stream->eof) {
@@ -1021,7 +1020,7 @@ H5FD_stream_read (H5FD_t *_stream,
HDmemset (buf, 0, size);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -1053,16 +1052,16 @@ H5FD_stream_write (H5FD_t *_stream,
H5FD_stream_t *stream = (H5FD_stream_t *) _stream;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_stream_write, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_stream_write, FAIL)
assert (stream && stream->pub.cls);
assert (buf);
/* Check for overflow conditions */
if (REGION_OVERFLOW (addr, size))
- HGOTO_ERROR (H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed");
+ HGOTO_ERROR (H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed")
if (addr + size > stream->eoa)
- HGOTO_ERROR (H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed");
+ HGOTO_ERROR (H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed")
/*
* Allocate more memory if necessary, careful of overflow. Also, if the
@@ -1082,7 +1081,7 @@ H5FD_stream_write (H5FD_t *_stream,
else
x = H5MM_realloc (stream->mem, (size_t) new_eof);
if (x == NULL)
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block");
+ HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block")
stream->mem = x;
stream->eof = new_eof;
}
@@ -1092,7 +1091,7 @@ H5FD_stream_write (H5FD_t *_stream,
stream->dirty = TRUE;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
#endif /* H5_HAVE_STREAM */
diff --git a/src/H5private.h b/src/H5private.h
index bc1c856..a9d8a98 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -587,7 +587,11 @@ H5_DLL void H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds);
#define HDfgetc(F) fgetc(F)
#define HDfgetpos(F,P) fgetpos(F,P)
#define HDfgets(S,N,F) fgets(S,N,F)
+#ifdef WIN32
+#define HDfileno(F) _fileno(F)
+#else /* WIN32 */
#define HDfileno(F) fileno(F)
+#endif /* WIN32 */
#define HDfloor(X) floor(X)
#define HDfmod(X,Y) fmod(X,Y)
#define HDfopen(S,M) fopen(S,M)
diff --git a/src/hdf5.lnt b/src/hdf5.lnt
index d49f483..dbf31f8 100755
--- a/src/hdf5.lnt
+++ b/src/hdf5.lnt
@@ -87,6 +87,7 @@
H5FDlog.c
H5FDmulti.c
H5FDsec2.c
+ H5FDstdio.c
H5V.c
H5Z.c
@@ -96,10 +97,12 @@
H5Zszip.c
The following files have had their FUNC_ENTER, FUNC_LEAVE & HGOTO*
- macros cleaned up and the PABLO_MASK adjusted, but have not been linted:
+ macros cleaned up and the PABLO_MASK adjusted, but have not been linted
+ due to their dependencies on features that we don't support on Windows:
H5FDfphdf5.c
H5FDgass.c
H5FDmpio.c
H5FDmpiposix.c
H5FDsrb.c
+ H5FDstream.c
*/