summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-08-25 19:15:41 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-08-25 19:15:41 (GMT)
commitf841a942427dd5d5fc139e30e07125de634e1863 (patch)
treefb353785e7a5b68b5ddbaa3cdb015fa7622ee6b7
parenta532b1814e0a6f784b0cad17b6fd2a9457d98899 (diff)
downloadhdf5-f841a942427dd5d5fc139e30e07125de634e1863.zip
hdf5-f841a942427dd5d5fc139e30e07125de634e1863.tar.gz
hdf5-f841a942427dd5d5fc139e30e07125de634e1863.tar.bz2
[svn-r7398] Purpose:
Code cleanup Description: De-linted more code Platforms tested: FreeBSD 4.8 (sleipnir) too minor to require h5committest
-rw-r--r--src/H5FDlog.c4
-rw-r--r--src/H5FDsec2.c165
-rw-r--r--src/H5FDsrb.c126
-rwxr-xr-xsrc/hdf5.lnt2
4 files changed, 160 insertions, 137 deletions
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 50876e7..8e7f3f9 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -1061,7 +1061,9 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr
}
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;
}
@@ -1196,7 +1198,9 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add
}
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;
}
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 94eabfb..ceacaab 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -23,15 +23,20 @@
* I/O from this driver with I/O from other parts of the
* application to the same file).
*/
-#include "H5private.h" /*library functions */
-#include "H5Eprivate.h" /*error handling */
-#include "H5Fprivate.h" /*files */
-#include "H5FDprivate.h" /*file driver */
-#include "H5FDsec2.h" /* Sec2 file driver */
-#include "H5FLprivate.h" /*Free Lists */
-#include "H5Iprivate.h" /*object IDs */
-#include "H5MMprivate.h" /* Memory allocation */
-#include "H5Pprivate.h" /*property lists */
+
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5FD_sec2_mask
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FDsec2.h" /* Sec2 file driver */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
#ifdef MAX
#undef MAX
@@ -82,8 +87,8 @@ typedef struct H5FD_sec2_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_sec2_t;
@@ -189,7 +194,6 @@ static const H5FD_class_t H5FD_sec2_g = {
};
/* Interface initialization */
-#define PABLO_MASK H5FD_sec2_mask
#define INTERFACE_INIT H5FD_sec2_init
static int interface_initialize_g = 0;
@@ -219,7 +223,7 @@ H5FD_sec2_init(void)
{
hid_t ret_value=H5FD_SEC2_g; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_sec2_init, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_sec2_init, FAIL)
if (H5I_VFL!=H5I_get_type(H5FD_SEC2_g))
H5FD_SEC2_g = H5FDregister(&H5FD_sec2_g);
@@ -228,7 +232,7 @@ H5FD_sec2_init(void)
ret_value=H5FD_SEC2_g;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -254,16 +258,16 @@ H5Pset_fapl_sec2(hid_t fapl_id)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value;
- FUNC_ENTER_API(H5Pset_fapl_sec2, FAIL);
+ FUNC_ENTER_API(H5Pset_fapl_sec2, FAIL)
H5TRACE1("e","i",fapl_id);
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
ret_value= H5P_set_driver(plist, H5FD_SEC2, NULL);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -285,6 +289,7 @@ done:
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static H5FD_t *
H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
haddr_t maxaddr)
@@ -295,20 +300,19 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
#ifdef WIN32
HFILE filehandle;
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
- int results;
#endif
h5_stat_t sb;
H5FD_t *ret_value;
- FUNC_ENTER_NOAPI(H5FD_sec2_open, NULL);
+ FUNC_ENTER_NOAPI(H5FD_sec2_open, NULL)
/* Check arguments */
if (!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name")
if (0==maxaddr || 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, "bogus maxaddr");
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr")
/* Build the open flags */
o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY;
@@ -318,21 +322,21 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t UNUSED fapl_id,
/* Open the file */
if ((fd=HDopen(name, o_flags, 0666))<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file");
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
if (HDfstat(fd, &sb)<0)
- HGOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file");
+ HGOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file")
/* Create the new file struct */
if (NULL==(file=H5FL_CALLOC(H5FD_sec2_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct")
file->fd = fd;
- file->eof = sb.st_size;
+ H5_ASSIGN_OVERFLOW(file->eof,sb.st_size,off_t,haddr_t);
file->pos = HADDR_UNDEF;
file->op = OP_UNKNOWN;
#ifdef WIN32
filehandle = _get_osfhandle(fd);
- results = GetFileInformationByHandle((HANDLE)filehandle, &fileinfo);
+ (void)GetFileInformationByHandle((HANDLE)filehandle, &fileinfo);
file->fileindexhi = fileinfo.nFileIndexHigh;
file->fileindexlo = fileinfo.nFileIndexLow;
#else
@@ -349,7 +353,7 @@ done:
HDclose(fd);
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -375,15 +379,15 @@ H5FD_sec2_close(H5FD_t *_file)
H5FD_sec2_t *file = (H5FD_sec2_t*)_file;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_sec2_close, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_sec2_close, FAIL)
if (HDclose(file->fd)<0)
- HGOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file");
+ HGOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
H5FL_FREE(H5FD_sec2_t,file);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -412,34 +416,34 @@ H5FD_sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
const H5FD_sec2_t *f2 = (const H5FD_sec2_t*)_f2;
int ret_value=0;
- FUNC_ENTER_NOAPI(H5FD_sec2_cmp, H5FD_VFD_DEFAULT);
+ FUNC_ENTER_NOAPI(H5FD_sec2_cmp, H5FD_VFD_DEFAULT)
#ifdef WIN32
- if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1);
- if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1);
+ if (f1->fileindexhi < f2->fileindexhi) HGOTO_DONE(-1)
+ if (f1->fileindexhi > f2->fileindexhi) HGOTO_DONE(1)
- if (f1->fileindexlo < f2->fileindexlo) HGOTO_DONE(-1);
- if (f1->fileindexlo > f2->fileindexlo) HGOTO_DONE(1);
+ if (f1->fileindexlo < f2->fileindexlo) HGOTO_DONE(-1)
+ if (f1->fileindexlo > f2->fileindexlo) HGOTO_DONE(1)
#else
#ifdef H5_DEV_T_IS_SCALAR
- if (f1->device < f2->device) HGOTO_DONE(-1);
- if (f1->device > f2->device) HGOTO_DONE(1);
+ if (f1->device < f2->device) HGOTO_DONE(-1)
+ if (f1->device > f2->device) HGOTO_DONE(1)
#else /* H5_DEV_T_IS_SCALAR */
/* If dev_t isn't a scalar value on this system, just use memcmp to
* determine if the values are the same or not. The actual return value
* shouldn't really matter...
*/
- if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))<0) HGOTO_DONE(-1);
- if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))>0) HGOTO_DONE(1);
+ if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))<0) HGOTO_DONE(-1)
+ if(HDmemcmp(&(f1->device),&(f2->device),sizeof(dev_t))>0) HGOTO_DONE(1)
#endif /* H5_DEV_T_IS_SCALAR */
- if (f1->inode < f2->inode) HGOTO_DONE(-1);
- if (f1->inode > f2->inode) HGOTO_DONE(1);
+ if (f1->inode < f2->inode) HGOTO_DONE(-1)
+ if (f1->inode > f2->inode) HGOTO_DONE(1)
#endif
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -460,12 +464,13 @@ done:
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static herr_t
H5FD_sec2_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */)
{
herr_t ret_value=SUCCEED;
- FUNC_ENTER_NOAPI(H5FD_sec2_query, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_sec2_query, FAIL)
/* Set the VFL feature flags that this driver supports */
if(flags) {
@@ -477,7 +482,7 @@ H5FD_sec2_query(const H5FD_t UNUSED * _f, unsigned long *flags /* out */)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -505,13 +510,13 @@ H5FD_sec2_get_eoa(H5FD_t *_file)
H5FD_sec2_t *file = (H5FD_sec2_t*)_file;
haddr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_sec2_get_eoa, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_sec2_get_eoa, HADDR_UNDEF)
/* Set return value */
ret_value=file->eoa;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -539,12 +544,12 @@ H5FD_sec2_set_eoa(H5FD_t *_file, haddr_t addr)
H5FD_sec2_t *file = (H5FD_sec2_t*)_file;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_sec2_set_eoa, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_sec2_set_eoa, FAIL)
file->eoa = addr;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -574,13 +579,13 @@ H5FD_sec2_get_eof(H5FD_t *_file)
H5FD_sec2_t *file = (H5FD_sec2_t*)_file;
haddr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_get_get_eof, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_get_get_eof, HADDR_UNDEF)
/* Set return value */
ret_value=MAX(file->eof, file->eoa);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -598,20 +603,21 @@ done:
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static herr_t
H5FD_sec2_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle)
{
H5FD_sec2_t *file = (H5FD_sec2_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5FD_sec2_get_handle, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_sec2_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->fd);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -634,6 +640,7 @@ done:
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static herr_t
H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr,
size_t size, void *buf/*out*/)
@@ -642,23 +649,23 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
ssize_t nbytes;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_sec2_read, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_sec2_read, FAIL)
assert(file && file->pub.cls);
assert(buf);
/* Check for overflow conditions */
if (HADDR_UNDEF==addr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined")
if (REGION_OVERFLOW(addr, size))
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow");
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
if (addr+size>file->eoa)
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow");
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
/* Seek to the correct location */
if ((addr!=file->pos || OP_READ!=file->op) &&
file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0)
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position");
+ HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
/*
* Read data, being careful of interrupted system calls, partial results,
@@ -669,7 +676,7 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
nbytes = HDread(file->fd, buf, size);
} while (-1==nbytes && EINTR==errno);
if (-1==nbytes) /* error */
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed");
+ HGOTO_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);
@@ -677,7 +684,9 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
}
assert(nbytes>=0);
assert((size_t)nbytes<=size);
- size -= nbytes;
+ 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;
}
@@ -693,7 +702,7 @@ done:
file->op = OP_UNKNOWN;
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -715,6 +724,7 @@ done:
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static herr_t
H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr_t addr,
size_t size, const void *buf)
@@ -723,23 +733,23 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
ssize_t nbytes;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_sec2_write, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_sec2_write, FAIL)
assert(file && file->pub.cls);
assert(buf);
/* Check for overflow conditions */
if (HADDR_UNDEF==addr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined")
if (REGION_OVERFLOW(addr, size))
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow");
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
if (addr+size>file->eoa)
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow");
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow")
/* Seek to the correct location */
if ((addr!=file->pos || OP_WRITE!=file->op) &&
file_seek(file->fd, (file_offset_t)addr, SEEK_SET)<0)
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position");
+ HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
/*
* Write the data, being careful of interrupted system calls and partial
@@ -750,10 +760,12 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
nbytes = HDwrite(file->fd, buf, size);
} while (-1==nbytes && EINTR==errno);
if (-1==nbytes) /* error */
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed")
assert(nbytes>0);
assert((size_t)nbytes<=size);
- size -= nbytes;
+ 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;
}
@@ -771,7 +783,7 @@ done:
file->op = OP_UNKNOWN;
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -792,13 +804,14 @@ done:
*
*-------------------------------------------------------------------------
*/
+/* ARGSUSED */
static herr_t
H5FD_sec2_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned UNUSED closing)
{
H5FD_sec2_t *file = (H5FD_sec2_t*)_file;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_sec2_flush, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_sec2_flush, FAIL)
assert(file);
@@ -813,13 +826,13 @@ H5FD_sec2_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned UNUSED closing)
/* 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)
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly");
+ HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#else /* WIN32 */
if (-1==file_truncate(file->fd, (file_offset_t)file->eoa))
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly");
+ HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly")
#endif /* WIN32 */
/* Update the eof value */
@@ -831,5 +844,5 @@ H5FD_sec2_flush(H5FD_t *_file, hid_t UNUSED dxpl_id, unsigned UNUSED closing)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
diff --git a/src/H5FDsrb.c b/src/H5FDsrb.c
index 3f315c9..3b653f6 100644
--- a/src/H5FDsrb.c
+++ b/src/H5FDsrb.c
@@ -18,14 +18,19 @@
*
* Purpose: SRB I/O driver.
*/
-#include "H5private.h" /*library functions */
-#include "H5Eprivate.h" /*error handling */
-#include "H5Fprivate.h" /*files */
-#include "H5FDprivate.h" /*file driver */
-#include "H5FDsrb.h" /* Core file driver */
-#include "H5Iprivate.h" /*object IDs */
-#include "H5MMprivate.h" /* Memory allocation */
-#include "H5Pprivate.h" /*property lists */
+
+/* Pablo information */
+/* (Put before include files to avoid problems with inline functions) */
+#define PABLO_MASK H5FD_srb_mask
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* File access */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5FDsrb.h" /* SRB file driver */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h" /* Property lists */
#ifdef H5_HAVE_SRB
@@ -153,7 +158,6 @@ static const H5FD_class_t H5FD_srb_g = {
};
/* Interface initialization */
-#define PABLO_MASK H5FD_srb_mask
#define INTERFACE_INIT H5FD_srb_init
static int interface_initialize_g = 0;
@@ -179,7 +183,7 @@ H5FD_srb_init(void)
{
hid_t ret_value=H5FD_SRB_g; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_srb_init, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_srb_init, FAIL)
if(H5I_VFL != H5Iget_type(H5FD_SRB_g))
H5FD_SRB_g = H5FDregister(&H5FD_srb_g);
@@ -188,7 +192,7 @@ H5FD_srb_init(void)
ret_value=H5FD_SRB_g;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -222,11 +226,11 @@ H5Pset_fapl_srb(hid_t fapl_id, SRB_Info info)
H5P_genplist_t *plist; /* Property list pointer */
herr_t ret_value;
- FUNC_ENTER_API(H5Pset_fapl_srb, FAIL);
+ FUNC_ENTER_API(H5Pset_fapl_srb, FAIL)
/*NO TRACE*/
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
/*connect to SRB server */
fa.srb_conn = clConnect(info.srbHost, info.srbPort, info.srbAuth);
@@ -235,14 +239,14 @@ H5Pset_fapl_srb(hid_t fapl_id, SRB_Info info)
clFinish(fa.srb_conn);
/*not sure about first 2 parameters. */
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "Connection to srbMaster failed.");
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "Connection to srbMaster failed.")
}
fa.info = info;
ret_value = H5P_set_driver(plist, H5FD_SRB, &fa);
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -273,21 +277,21 @@ H5Pget_fapl_srb(hid_t fapl_id, SRB_Info *info/*out*/)
H5FD_srb_fapl_t *fa;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_API(H5Pget_fapl_srb, FAIL);
+ FUNC_ENTER_API(H5Pget_fapl_srb, FAIL)
H5TRACE2("e","ix",fapl_id,info);
if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
if(H5FD_SRB != 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==(fa=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(info)
*info = fa->info;
done:
- FUNC_LEAVE_API(ret_value);
+ FUNC_LEAVE_API(ret_value)
}
@@ -321,18 +325,18 @@ H5FD_srb_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
H5P_genplist_t *plist; /* Property list pointer */
H5FD_t *ret_value;
- FUNC_ENTER_NOAPI(H5FD_srb_open, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_srb_open, FAIL)
/* Check arguments */
if (!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name")
if (0==maxaddr || 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_BADRANGE, NULL, "bogus maxaddr");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr")
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")
if(H5P_FILE_ACCESS_DEFAULT==fapl_id || H5FD_SRB!=H5P_get_driver(plist)) {
HDmemset((void*)&_fa, 0, sizeof(H5FD_srb_fapl_t));
fa = &_fa;
@@ -386,9 +390,9 @@ H5FD_srb_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
fprintf(stderr, "cannot open file %s\n", name);
fprintf(stderr,"%s",clErrorMessage(fa->srb_conn));
clFinish(fa->srb_conn);
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "cannot open file");
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "cannot open file")
#else /* OLD_WAY */
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, clErrorMessage(fa->srb_conn));
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, clErrorMessage(fa->srb_conn))
#endif /* OLD_WAY */
}
@@ -397,14 +401,14 @@ H5FD_srb_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
#ifdef OLD_WAY
srbFileClose(fa->srb_conn, srb_fid);
clFinish(fa->srb_conn);
- HGOTO_ERROR(H5E_IO, H5E_BADFILE, NULL, "SRB file stat failed");
+ HGOTO_ERROR(H5E_IO, H5E_BADFILE, NULL, "SRB file stat failed")
#else /* OLD_WAY */
- HGOTO_ERROR(H5E_IO, H5E_BADFILE, NULL, "SRB file stat failed");
+ HGOTO_ERROR(H5E_IO, H5E_BADFILE, NULL, "SRB file stat failed")
#endif /* OLD_WAY */
}
if (NULL==(file=H5MM_calloc(sizeof(H5FD_srb_t))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate file struct");
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate file struct")
file->fd = srb_fid;
file->eof = srb_stat.st_size;
@@ -422,7 +426,7 @@ done:
if(srb_fid>=0)
srbFileClose(fa->srb_conn, srb_fid);
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -445,7 +449,7 @@ H5FD_srb_close(H5FD_t *_file)
H5FD_srb_t *file = (H5FD_srb_t *)_file;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_srb_close, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_srb_close, FAIL)
srbFileClose(file->srb_conn, file->fd);
clFinish(file->srb_conn);
@@ -453,7 +457,7 @@ H5FD_srb_close(H5FD_t *_file)
H5MM_xfree(file);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -479,7 +483,7 @@ H5FD_srb_query(const UNUSED H5FD_t *_f, unsigned long *flags /* out */)
{
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_srb_query, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_srb_query, FAIL)
/* Set the VFL feature flags that this driver supports */
if(flags) {
@@ -489,7 +493,7 @@ H5FD_srb_query(const UNUSED H5FD_t *_f, unsigned long *flags /* out */)
}
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -516,13 +520,13 @@ H5FD_srb_get_eoa(H5FD_t *_file)
H5FD_srb_t *file = (H5FD_srb_t *)_file;
haddr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_srb_get_eoa, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_srb_get_eoa, HADDR_UNDEF)
/* Set return value */
ret_value=file->eoa;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -550,12 +554,12 @@ H5FD_srb_set_eoa(H5FD_t *_file, haddr_t addr)
H5FD_srb_t *file = (H5FD_srb_t *)_file;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_srb_set_eoa, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_srb_set_eoa, FAIL)
file->eoa = addr;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -581,13 +585,13 @@ H5FD_srb_get_eof(H5FD_t *_file)
H5FD_srb_t *file = (H5FD_srb_t *)_file;
haddr_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_srb_get_eof, HADDR_UNDEF);
+ FUNC_ENTER_NOAPI(H5FD_srb_get_eof, HADDR_UNDEF)
/* Set return value */
ret_value=file->eof;
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -611,15 +615,15 @@ H5FD_srb_get_handle(H5FD_t *_file, hid_t UNUSED fapl, void** file_handle)
H5FD_srb_t *file = (H5FD_srb_t *)_file;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(H5FD_srb_get_eof, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_srb_get_eof, 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->fd);
done:
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -645,19 +649,19 @@ H5FD_srb_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr
ssize_t nbytes;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_srb_read, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_srb_read, FAIL)
/* Check for overflow conditions */
if (HADDR_UNDEF==addr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "addr undefined");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "addr undefined")
if (REGION_OVERFLOW(addr, size))
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large");
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large")
if (addr+size>file->eoa)
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large");
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large")
if( addr!=file->pos &&
srbFileSeek(file->srb_conn, (int)file->fd, (int)addr, SEEK_SET)<0 )
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "srb file seek failed");
+ HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "srb file seek failed")
/*
* Read data, being careful of interrupted system calls, partial results,
@@ -665,7 +669,7 @@ H5FD_srb_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, haddr
*/
while(size>0) {
if((nbytes=srbFileRead(file->srb_conn, (int)file->fd, (char*)buf, size))<0)
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "srb file write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "srb file write failed")
if (0==nbytes) {
/*end of file but not end of format address space*/
@@ -690,7 +694,7 @@ done:
clFinish(file->srb_conn);
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -717,23 +721,23 @@ H5FD_srb_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
ssize_t nbytes;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_srb_write, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_srb_write, FAIL)
/* Check for overflow conditions */
if (HADDR_UNDEF==addr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "addr undefined");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "addr undefined")
if (REGION_OVERFLOW(addr, size))
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large");
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large")
if (addr+size>file->eoa)
- HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large");
+ HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr too large")
if( addr!=file->pos &&
srbFileSeek(file->srb_conn, (int)file->fd, (int)addr, SEEK_SET)<0 )
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "srb file seek failed");
+ HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "srb file seek failed")
while(size>0) {
if( (nbytes=srbFileWrite(file->srb_conn, (int)file->fd, (char*)buf, size)) < 0 )
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "srb file write failed");
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "srb file write failed")
size -= nbytes;
addr += (haddr_t)nbytes;
@@ -755,7 +759,7 @@ done:
clFinish(file->srb_conn);
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
@@ -778,10 +782,10 @@ H5FD_srb_flush(H5FD_t *_file, hid_t dxpl_id, unsigned UNUSED closing)
H5FD_srb_t *file = (H5FD_srb_t*)_file;
herr_t ret_value=SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5FD_srb_flush, FAIL);
+ FUNC_ENTER_NOAPI(H5FD_srb_flush, FAIL)
if(srbFileSync(file->srb_conn, file->fd) != 0)
- HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "srb file sync failed");
+ HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "srb file sync failed")
done:
if(ret_value<0) {
@@ -789,7 +793,7 @@ done:
clFinish(file->srb_conn);
} /* end if */
- FUNC_LEAVE_NOAPI(ret_value);
+ FUNC_LEAVE_NOAPI(ret_value)
}
#endif /* H5_HAVE_SRB */
diff --git a/src/hdf5.lnt b/src/hdf5.lnt
index ad2a447..d49f483 100755
--- a/src/hdf5.lnt
+++ b/src/hdf5.lnt
@@ -86,6 +86,7 @@
H5FDfamily.c
H5FDlog.c
H5FDmulti.c
+ H5FDsec2.c
H5V.c
H5Z.c
@@ -100,4 +101,5 @@
H5FDgass.c
H5FDmpio.c
H5FDmpiposix.c
+ H5FDsrb.c
*/