summaryrefslogtreecommitdiffstats
path: root/src/H5FDstdio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FDstdio.c')
-rw-r--r--src/H5FDstdio.c557
1 files changed, 277 insertions, 280 deletions
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 1cabddf..73218f0 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -35,8 +35,8 @@
#ifdef H5_HAVE_WIN32_API
/* The following two defines must be before any windows headers are included */
-#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
-#define NOGDI /* Exclude Graphic Display Interface macros */
+#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
+#define NOGDI /* Exclude Graphic Display Interface macros */
#include <windows.h>
#include <io.h>
@@ -51,7 +51,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;
@@ -61,10 +61,10 @@ static size_t H5_STDIO_MAX_IO_BYTES_g = (size_t)-1;
/* File operations */
typedef enum {
- H5FD_STDIO_OP_UNKNOWN=0,
- H5FD_STDIO_OP_READ=1,
- H5FD_STDIO_OP_WRITE=2,
- H5FD_STDIO_OP_SEEK=3
+ H5FD_STDIO_OP_UNKNOWN = 0,
+ H5FD_STDIO_OP_READ = 1,
+ H5FD_STDIO_OP_WRITE = 2,
+ H5FD_STDIO_OP_SEEK = 3
} H5FD_stdio_file_op;
/* The description of a file belonging to this driver. The 'eoa' and 'eof'
@@ -79,14 +79,14 @@ 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 */
- int fd; /* file descriptor (for truncate) */
- haddr_t eoa; /* end of allocated region */
- haddr_t eof; /* end of file; current file size */
- haddr_t pos; /* current file I/O position */
- unsigned write_access; /* Flag to indicate the file was opened with write access */
- H5FD_stdio_file_op op; /* last operation */
+ H5FD_t pub; /* public stuff, must be first */
+ FILE * fp; /* the file handle */
+ int fd; /* file descriptor (for truncate) */
+ haddr_t eoa; /* end of allocated region */
+ haddr_t eof; /* end of file; current file size */
+ haddr_t pos; /* current file I/O position */
+ unsigned write_access; /* Flag to indicate the file was opened with write access */
+ H5FD_stdio_file_op op; /* last operation */
#ifndef H5_HAVE_WIN32_API
/* On most systems the combination of device and i-node number uniquely
* identify a file. Note that Cygwin, MinGW and other Windows POSIX
@@ -94,8 +94,8 @@ typedef struct H5FD_stdio_t {
* and will use the 'device + inodes' scheme as opposed to the
* Windows code further below.
*/
- 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
/* Files in windows are uniquely identified by the volume serial
* number and the file index (both low and high parts).
@@ -111,21 +111,21 @@ typedef struct H5FD_stdio_t {
*
* http://msdn.microsoft.com/en-us/library/aa363788(v=VS.85).aspx
*/
- DWORD nFileIndexLow;
- DWORD nFileIndexHigh;
- DWORD dwVolumeSerialNumber;
-
- HANDLE hFile; /* Native windows file handle */
-#endif /* H5_HAVE_WIN32_API */
+ DWORD nFileIndexLow;
+ DWORD nFileIndexHigh;
+ DWORD dwVolumeSerialNumber;
+
+ HANDLE hFile; /* Native windows file handle */
+#endif /* H5_HAVE_WIN32_API */
} H5FD_stdio_t;
/* Use similar structure as in H5private.h by defining Windows stuff first. */
#ifdef H5_HAVE_WIN32_API
#ifndef H5_HAVE_MINGW
- #define file_fseek _fseeki64
- #define file_offset_t __int64
- #define file_ftruncate _chsize_s /* Supported in VS 2005 or newer */
- #define file_ftell _ftelli64
+#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 /* H5_HAVE_MINGW */
#endif /* H5_HAVE_WIN32_API */
@@ -133,10 +133,10 @@ typedef struct H5FD_stdio_t {
* more platform-independent names.
*/
#ifndef file_fseek
- #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 /* file_fseek */
/* These macros check for overflow of various quantities. These macros
@@ -154,65 +154,64 @@ typedef struct H5FD_stdio_t {
* 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) || \
- HADDR_UNDEF==(A)+(Z) || (file_offset_t)((A)+(Z))<(file_offset_t)(A))
+#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))
/* Prototypes */
-static H5FD_t *H5FD_stdio_open(const char *name, unsigned flags,
- hid_t fapl_id, haddr_t maxaddr);
-static herr_t H5FD_stdio_close(H5FD_t *lf);
-static int H5FD_stdio_cmp(const H5FD_t *_f1, const H5FD_t *_f2);
-static herr_t H5FD_stdio_query(const H5FD_t *_f1, unsigned long *flags);
+static H5FD_t *H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
+static herr_t H5FD_stdio_close(H5FD_t *lf);
+static int H5FD_stdio_cmp(const H5FD_t *_f1, const H5FD_t *_f2);
+static herr_t H5FD_stdio_query(const H5FD_t *_f1, unsigned long *flags);
static haddr_t H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
static haddr_t H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t type);
-static herr_t H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
+static herr_t H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr);
static haddr_t H5FD_stdio_get_eof(const H5FD_t *_file);
-static herr_t H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle);
-static herr_t H5FD_stdio_read(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
- size_t size, void *buf);
-static herr_t H5FD_stdio_write(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
- size_t size, const void *buf);
-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 herr_t H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle);
+static herr_t H5FD_stdio_read(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size,
+ void *buf);
+static herr_t H5FD_stdio_write(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size,
+ const void *buf);
+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 */
- 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 */
- NULL, /* lock */
- NULL, /* unlock */
- H5FD_FLMAP_DICHOTOMY /* fl_map */
+ "stdio", /* name */
+ MAXADDR, /* maxaddr */
+ H5F_CLOSE_WEAK, /* fc_degree */
+ 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 */
+ NULL, /* lock */
+ NULL, /* unlock */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
};
-
/*-------------------------------------------------------------------------
* Function: H5FD_stdio_init
*
@@ -234,12 +233,11 @@ H5FD_stdio_init(void)
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- if (H5I_VFL!=H5Iget_type(H5FD_STDIO_g))
+ if (H5I_VFL != H5Iget_type(H5FD_STDIO_g))
H5FD_STDIO_g = H5FDregister(&H5FD_stdio_g);
return H5FD_STDIO_g;
} /* end H5FD_stdio_init() */
-
/*---------------------------------------------------------------------------
* Function: H5FD_stdio_term
*
@@ -261,7 +259,6 @@ H5FD_stdio_term(void)
return;
} /* end H5FD_stdio_term() */
-
/*-------------------------------------------------------------------------
* Function: H5Pset_fapl_stdio
*
@@ -279,20 +276,19 @@ H5FD_stdio_term(void)
herr_t
H5Pset_fapl_stdio(hid_t fapl_id)
{
- static const char *func = "H5FDset_fapl_stdio"; /*for error reporting*/
+ static const char *func = "H5FDset_fapl_stdio"; /*for error reporting*/
/*NO TRACE*/
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
- if(0 == H5Pisa_class(fapl_id, H5P_FILE_ACCESS))
+ 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)
- return H5Pset_driver(fapl_id, H5FD_STDIO, NULL);
+ return H5Pset_driver(fapl_id, H5FD_STDIO, NULL);
} /* end H5Pset_fapl_stdio() */
-
/*-------------------------------------------------------------------------
* Function: H5FD_stdio_open
*
@@ -318,18 +314,17 @@ H5Pset_fapl_stdio(hid_t fapl_id)
*-------------------------------------------------------------------------
*/
static H5FD_t *
-H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id,
- haddr_t maxaddr)
+H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
- FILE *f = NULL;
- unsigned write_access = 0; /* File opened with write access? */
- H5FD_stdio_t *file = NULL;
- static const char *func = "H5FD_stdio_open"; /* Function Name for error reporting */
+ FILE * f = NULL;
+ unsigned write_access = 0; /* File opened with write access? */
+ H5FD_stdio_t * file = NULL;
+ static const char *func = "H5FD_stdio_open"; /* Function Name for error reporting */
#ifdef H5_HAVE_WIN32_API
struct _BY_HANDLE_FILE_INFORMATION fileinfo;
-#else /* H5_HAVE_WIN32_API */
- struct stat sb;
-#endif /* H5_HAVE_WIN32_API */
+#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));
@@ -342,104 +337,108 @@ 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)
- if (0 == maxaddr || HADDR_UNDEF == maxaddr)
- 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)
-
- /* Tentatively open file in read-only mode, to check for existence */
- if(flags & H5F_ACC_RDWR)
- f = fopen(name, "rb+");
+ 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) if (ADDR_OVERFLOW(maxaddr))
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_ARGS, H5E_OVERFLOW, "maxaddr too large", NULL)
+
+ /* Tentatively open file in read-only mode, to check for existence */
+ if (flags & H5F_ACC_RDWR) f = fopen(name, "rb+");
else
f = fopen(name, "rb");
- if(!f) {
+ if (!f) {
/* File doesn't exist */
- if(flags & H5F_ACC_CREAT) {
+ if (flags & H5F_ACC_CREAT) {
assert(flags & H5F_ACC_RDWR);
- f = fopen(name, "wb+");
- write_access = 1; /* Note the write access */
+ 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 if(flags & H5F_ACC_EXCL) {
+ 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_EXCL) {
/* File exists, but EXCL is passed. Fail. */
assert(flags & H5F_ACC_CREAT);
fclose(f);
- 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)
+ 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 = freopen(name, "wb+", f);
- write_access = 1; /* Note the write access */
- } /* end if */
+ write_access = 1; /* Note the write access */
+ } /* end if */
/* Note there is no need to reopen if neither TRUNC nor EXCL are specified,
* as the tentative open will work */
- if(!f)
+ if (!f)
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CANTOPENFILE, "fopen failed", NULL)
- /* Build the return value */
- if(NULL == (file = (H5FD_stdio_t *)calloc((size_t)1, sizeof(H5FD_stdio_t)))) {
- fclose(f);
- H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL)
- } /* end if */
- file->fp = f;
- file->op = H5FD_STDIO_OP_SEEK;
- file->pos = HADDR_UNDEF;
- file->write_access = write_access; /* Note the write_access for later */
- if(file_fseek(file->fp, (file_offset_t)0, SEEK_END) < 0) {
+ /* Build the return value */
+ if (NULL == (file = (H5FD_stdio_t *)calloc((size_t)1, sizeof(H5FD_stdio_t))))
+ {
+ fclose(f);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed", NULL)
+ } /* end if */
+ file->fp = f;
+ file->op = H5FD_STDIO_OP_SEEK;
+ file->pos = HADDR_UNDEF;
+ file->write_access = write_access; /* Note the write_access for later */
+ if (file_fseek(file->fp, (file_offset_t)0, SEEK_END) < 0) {
file->op = H5FD_STDIO_OP_UNKNOWN;
- } else {
+ }
+ else {
file_offset_t x = file_ftell(file->fp);
- assert (x >= 0);
+ assert(x >= 0);
file->eof = (haddr_t)x;
}
/* Get the file descriptor (needed for truncate and some Windows information) */
#ifdef H5_HAVE_WIN32_API
file->fd = _fileno(file->fp);
-#else /* H5_HAVE_WIN32_API */
+#else /* H5_HAVE_WIN32_API */
file->fd = fileno(file->fp);
#endif /* H5_HAVE_WIN32_API */
- if(file->fd < 0) {
+ if (file->fd < 0) {
free(file);
fclose(f);
H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTOPENFILE, "unable to get file descriptor", NULL);
} /* end if */
-
#ifdef H5_HAVE_WIN32_API
file->hFile = (HANDLE)_get_osfhandle(file->fd);
- if(INVALID_HANDLE_VALUE == file->hFile) {
+ if (INVALID_HANDLE_VALUE == file->hFile) {
free(file);
fclose(f);
H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTOPENFILE, "unable to get Windows file handle", NULL);
} /* end if */
- if(!GetFileInformationByHandle((HANDLE)file->hFile, &fileinfo)) {
+ if (!GetFileInformationByHandle((HANDLE)file->hFile, &fileinfo)) {
free(file);
fclose(f);
- H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTOPENFILE, "unable to get Windows file descriptor information", NULL);
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTOPENFILE,
+ "unable to get Windows file descriptor information", NULL);
} /* end if */
- file->nFileIndexHigh = fileinfo.nFileIndexHigh;
- file->nFileIndexLow = fileinfo.nFileIndexLow;
+ file->nFileIndexHigh = fileinfo.nFileIndexHigh;
+ file->nFileIndexLow = fileinfo.nFileIndexLow;
file->dwVolumeSerialNumber = fileinfo.dwVolumeSerialNumber;
-#else /* H5_HAVE_WIN32_API */
- if(fstat(file->fd, &sb) < 0) {
+#else /* H5_HAVE_WIN32_API */
+ if (fstat(file->fd, &sb) < 0) {
free(file);
fclose(f);
H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADFILE, "unable to fstat file", NULL)
} /* end if */
file->device = sb.st_dev;
- file->inode = sb.st_ino;
+ file->inode = sb.st_ino;
#endif /* H5_HAVE_WIN32_API */
- return (H5FD_t*)file;
+ return (H5FD_t *)file;
} /* end H5FD_stdio_open() */
-
/*-------------------------------------------------------------------------
* Function: H5F_stdio_close
*
@@ -458,8 +457,8 @@ 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;
- static const char *func = "H5FD_stdio_close"; /* Function Name for error reporting */
+ H5FD_stdio_t * file = (H5FD_stdio_t *)_file;
+ static const char *func = "H5FD_stdio_close"; /* Function Name for error reporting */
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
@@ -467,12 +466,11 @@ H5FD_stdio_close(H5FD_t *_file)
if (fclose(file->fp) < 0)
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_CLOSEERROR, "fclose failed", -1)
- free(file);
+ free(file);
return 0;
} /* end H5FD_stdio_close() */
-
/*-------------------------------------------------------------------------
* Function: H5FD_stdio_cmp
*
@@ -492,41 +490,52 @@ 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 H5_HAVE_WIN32_API
- if(f1->dwVolumeSerialNumber < f2->dwVolumeSerialNumber) return -1;
- if(f1->dwVolumeSerialNumber > f2->dwVolumeSerialNumber) return 1;
-
- if(f1->nFileIndexHigh < f2->nFileIndexHigh) return -1;
- if(f1->nFileIndexHigh > f2->nFileIndexHigh) return 1;
-
- if(f1->nFileIndexLow < f2->nFileIndexLow) return -1;
- if(f1->nFileIndexLow > f2->nFileIndexLow) return 1;
+ if (f1->dwVolumeSerialNumber < f2->dwVolumeSerialNumber)
+ return -1;
+ if (f1->dwVolumeSerialNumber > f2->dwVolumeSerialNumber)
+ return 1;
+
+ if (f1->nFileIndexHigh < f2->nFileIndexHigh)
+ return -1;
+ if (f1->nFileIndexHigh > f2->nFileIndexHigh)
+ return 1;
+
+ if (f1->nFileIndexLow < f2->nFileIndexLow)
+ return -1;
+ if (f1->nFileIndexLow > f2->nFileIndexLow)
+ return 1;
#else /* H5_HAVE_WIN32_API */
#ifdef H5_DEV_T_IS_SCALAR
- if(f1->device < f2->device) return -1;
- if(f1->device > f2->device) return 1;
-#else /* H5_DEV_T_IS_SCALAR */
+ if (f1->device < f2->device)
+ return -1;
+ if (f1->device > f2->device)
+ return 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(memcmp(&(f1->device),&(f2->device),sizeof(dev_t)) < 0) return -1;
- if(memcmp(&(f1->device),&(f2->device),sizeof(dev_t)) > 0) return 1;
+ if (memcmp(&(f1->device), &(f2->device), sizeof(dev_t)) < 0)
+ return -1;
+ if (memcmp(&(f1->device), &(f2->device), sizeof(dev_t)) > 0)
+ return 1;
#endif /* H5_DEV_T_IS_SCALAR */
- if(f1->inode < f2->inode) return -1;
- if(f1->inode > f2->inode) return 1;
+ if (f1->inode < f2->inode)
+ return -1;
+ if (f1->inode > f2->inode)
+ return 1;
#endif /* H5_HAVE_WIN32_API */
return 0;
} /* H5FD_stdio_cmp() */
-
/*-------------------------------------------------------------------------
* Function: H5FD_stdio_query
*
@@ -546,21 +555,20 @@ static herr_t
H5FD_stdio_query(const H5FD_t *_f, unsigned long *flags /* out */)
{
/* Quiet the compiler */
- _f=_f;
+ _f = _f;
/* Set the VFL feature flags that this driver supports */
- if(flags) {
+ if (flags) {
*flags = 0;
- *flags|=H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
- *flags|=H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */
- *flags|=H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */
- *flags|=H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
+ *flags |= H5FD_FEAT_AGGREGATE_METADATA; /* OK to aggregate metadata allocations */
+ *flags |= H5FD_FEAT_ACCUMULATE_METADATA; /* OK to accumulate metadata for faster writes */
+ *flags |= H5FD_FEAT_DATA_SIEVE; /* OK to perform data sieving for faster raw data reads & writes */
+ *flags |= H5FD_FEAT_AGGREGATE_SMALLDATA; /* OK to aggregate "small" raw data allocations */
}
return 0;
} /* end H5FD_stdio_query() */
-
/*-------------------------------------------------------------------------
* Function: H5FD_stdio_alloc
*
@@ -580,13 +588,14 @@ H5FD_stdio_query(const H5FD_t *_f, unsigned long *flags /* out */)
*-------------------------------------------------------------------------
*/
static haddr_t
-H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type, hid_t /*H5_ATTR_UNUSED*/ dxpl_id, hsize_t size)
+H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type, hid_t /*H5_ATTR_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;
/* Quiet compiler */
- type = type;
+ type = type;
dxpl_id = dxpl_id;
/* Clear the error stack */
@@ -596,9 +605,9 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type, hid_t /*H5_A
addr = file->eoa;
/* Check if we need to align this block */
- if(size >= file->pub.threshold) {
+ if (size >= file->pub.threshold) {
/* Check for an already aligned block */
- if((addr % file->pub.alignment) != 0)
+ if ((addr % file->pub.alignment) != 0)
addr = ((addr / file->pub.alignment) + 1) * file->pub.alignment;
} /* end if */
@@ -607,7 +616,6 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type, hid_t /*H5_A
return addr;
} /* end H5FD_stdio_alloc() */
-
/*-------------------------------------------------------------------------
* Function: H5FD_stdio_get_eoa
*
@@ -638,7 +646,6 @@ H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type)
return file->eoa;
} /* end H5FD_stdio_get_eoa() */
-
/*-------------------------------------------------------------------------
* Function: H5FD_stdio_set_eoa
*
@@ -658,7 +665,7 @@ H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type)
static herr_t
H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_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);
@@ -671,7 +678,6 @@ H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type, haddr_t ad
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: H5FD_stdio_get_eof
*
@@ -693,7 +699,7 @@ H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*H5_ATTR_UNUSED*/ type, haddr_t ad
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);
@@ -701,7 +707,6 @@ H5FD_stdio_get_eof(const H5FD_t *_file)
return MAX(file->eof, file->eoa);
} /* end H5FD_stdio_get_eof() */
-
/*-------------------------------------------------------------------------
* Function: H5FD_stdio_get_handle
*
@@ -715,10 +720,10 @@ H5FD_stdio_get_eof(const H5FD_t *_file)
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle)
+H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle)
{
- H5FD_stdio_t *file = (H5FD_stdio_t *)_file;
- static const char *func = "H5FD_stdio_get_handle"; /* Function Name for error reporting */
+ H5FD_stdio_t * file = (H5FD_stdio_t *)_file;
+ static const char *func = "H5FD_stdio_get_handle"; /* Function Name for error reporting */
/* Quiet the compiler */
fapl = fapl;
@@ -727,13 +732,12 @@ H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle)
H5Eclear2(H5E_DEFAULT);
*file_handle = &(file->fp);
- if(*file_handle == NULL)
+ if (*file_handle == NULL)
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "get handle failed", -1)
- return 0;
+ return 0;
} /* end H5FD_stdio_get_handle() */
-
/*-------------------------------------------------------------------------
* Function: H5FD_stdio_read
*
@@ -753,38 +757,35 @@ H5FD_stdio_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle)
*-------------------------------------------------------------------------
*/
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*/)
+H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf /*out*/)
{
- H5FD_stdio_t *file = (H5FD_stdio_t*)_file;
- static const char *func = "H5FD_stdio_read"; /* Function Name for error reporting */
+ H5FD_stdio_t * file = (H5FD_stdio_t *)_file;
+ static const char *func = "H5FD_stdio_read"; /* Function Name for error reporting */
/* Quiet the compiler */
- type = type;
+ type = type;
dxpl_id = dxpl_id;
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
/* Check for overflow */
- if (HADDR_UNDEF==addr)
- 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)
+ if (HADDR_UNDEF == addr)
+ 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)
- /* Check easy cases */
- if (0 == size)
- return 0;
+ /* Check easy cases */
+ if (0 == size) return 0;
if ((haddr_t)addr >= file->eof) {
memset(buf, 0, size);
return 0;
}
/* Seek to the correct file position. */
- if (!(file->op == H5FD_STDIO_OP_READ || file->op == H5FD_STDIO_OP_SEEK) ||
- file->pos != addr) {
+ if (!(file->op == H5FD_STDIO_OP_READ || file->op == H5FD_STDIO_OP_SEEK) || file->pos != addr) {
if (file_fseek(file->fp, (file_offset_t)addr, SEEK_SET) < 0) {
- file->op = H5FD_STDIO_OP_UNKNOWN;
+ file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "fseek failed", -1)
}
@@ -793,7 +794,7 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
/* Read zeros past the logical end of file (physical is handled below) */
if (addr + size > file->eof) {
- size_t nbytes = (size_t) (addr + size - file->eof);
+ size_t nbytes = (size_t)(addr + size - file->eof);
memset((unsigned char *)buf + size - nbytes, 0, nbytes);
size -= nbytes;
}
@@ -802,44 +803,43 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz
* will advance the file position by N. If N is zero or an error
* occurs then the file position is undefined.
*/
- while(size > 0) {
+ while (size > 0) {
- size_t bytes_in = 0; /* # of bytes to read */
- size_t bytes_read = 0; /* # of bytes actually read */
- size_t item_size = 1; /* size of items in bytes */
+ size_t bytes_in = 0; /* # of bytes to read */
+ size_t bytes_read = 0; /* # of bytes actually read */
+ size_t item_size = 1; /* size of items in bytes */
- if(size > H5_STDIO_MAX_IO_BYTES_g)
+ if (size > H5_STDIO_MAX_IO_BYTES_g)
bytes_in = H5_STDIO_MAX_IO_BYTES_g;
else
bytes_in = size;
bytes_read = fread(buf, item_size, bytes_in, file->fp);
- if(0 == bytes_read && ferror(file->fp)) { /* error */
- file->op = H5FD_STDIO_OP_UNKNOWN;
+ if (0 == bytes_read && ferror(file->fp)) { /* error */
+ file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_READERROR, "fread failed", -1)
} /* end if */
-
- if(0 == bytes_read && feof(file->fp)) {
+
+ if (0 == bytes_read && feof(file->fp)) {
/* end of file but not end of format address space */
memset((unsigned char *)buf, 0, size);
break;
} /* end if */
-
+
size -= bytes_read;
addr += (haddr_t)bytes_read;
buf = (char *)buf + bytes_read;
} /* end while */
/* Update the file position data. */
- file->op = H5FD_STDIO_OP_READ;
+ file->op = H5FD_STDIO_OP_READ;
file->pos = addr;
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: H5FD_stdio_write
*
@@ -858,59 +858,58 @@ 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)
+H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf)
{
- H5FD_stdio_t *file = (H5FD_stdio_t*)_file;
- static const char *func = "H5FD_stdio_write"; /* Function Name for error reporting */
+ H5FD_stdio_t * file = (H5FD_stdio_t *)_file;
+ static const char *func = "H5FD_stdio_write"; /* Function Name for error reporting */
/* Quiet the compiler */
dxpl_id = dxpl_id;
- type = type;
+ type = type;
/* Clear the error stack */
H5Eclear2(H5E_DEFAULT);
/* Check for overflow conditions */
if (HADDR_UNDEF == addr)
- 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)
-
- /* Seek to the correct file position. */
- if ((file->op != H5FD_STDIO_OP_WRITE && file->op != H5FD_STDIO_OP_SEEK) ||
- file->pos != addr) {
- if (file_fseek(file->fp, (file_offset_t)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_OVERFLOW, "file address overflowed",
+ -1) if (REGION_OVERFLOW(addr, size))
+ 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)
+ {
+ if (file_fseek(file->fp, (file_offset_t)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)
+ }
+ file->pos = addr;
}
- file->pos = addr;
- }
/* Write the buffer. On successful return, the file position will be
* advanced by the number of bytes read. On failure, the file position is
* undefined.
*/
- while(size > 0) {
+ while (size > 0) {
- size_t bytes_in = 0; /* # of bytes to write */
- size_t bytes_wrote = 0; /* # of bytes written */
- size_t item_size = 1; /* size of items in bytes */
+ size_t bytes_in = 0; /* # of bytes to write */
+ size_t bytes_wrote = 0; /* # of bytes written */
+ size_t item_size = 1; /* size of items in bytes */
- if(size > H5_STDIO_MAX_IO_BYTES_g)
+ if (size > H5_STDIO_MAX_IO_BYTES_g)
bytes_in = H5_STDIO_MAX_IO_BYTES_g;
else
bytes_in = size;
bytes_wrote = fwrite(buf, item_size, bytes_in, file->fp);
- if(bytes_wrote != bytes_in || (0 == bytes_wrote && ferror(file->fp))) { /* error */
- file->op = H5FD_STDIO_OP_UNKNOWN;
+ if (bytes_wrote != bytes_in || (0 == bytes_wrote && ferror(file->fp))) { /* error */
+ file->op = H5FD_STDIO_OP_UNKNOWN;
file->pos = HADDR_UNDEF;
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fwrite failed", -1)
} /* end if */
-
+
assert(bytes_wrote > 0);
assert((size_t)bytes_wrote <= size);
@@ -920,7 +919,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
}
/* Update seek optimizing data. */
- file->op = H5FD_STDIO_OP_WRITE;
+ file->op = H5FD_STDIO_OP_WRITE;
file->pos = addr;
/* Update EOF if necessary */
@@ -930,7 +929,6 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
return 0;
}
-
/*-------------------------------------------------------------------------
* Function: H5FD_stdio_flush
*
@@ -950,8 +948,8 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
static herr_t
H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing)
{
- H5FD_stdio_t *file = (H5FD_stdio_t*)_file;
- static const char *func = "H5FD_stdio_flush"; /* Function Name for error reporting */
+ H5FD_stdio_t * file = (H5FD_stdio_t *)_file;
+ static const char *func = "H5FD_stdio_flush"; /* Function Name for error reporting */
/* Quiet the compiler */
dxpl_id = dxpl_id;
@@ -960,21 +958,20 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t dxpl_id, unsigned closing)
H5Eclear2(H5E_DEFAULT);
/* Only try to flush the file if we have write access */
- if(file->write_access) {
- if(!closing) {
- if(fflush(file->fp) < 0)
+ if (file->write_access) {
+ if (!closing) {
+ if (fflush(file->fp) < 0)
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_WRITEERROR, "fflush failed", -1)
- /* Reset last file I/O information */
- file->pos = HADDR_UNDEF;
+ /* Reset last file I/O information */
+ file->pos = HADDR_UNDEF;
file->op = H5FD_STDIO_OP_UNKNOWN;
} /* end if */
- } /* end if */
+ } /* end if */
return 0;
} /* end H5FD_stdio_flush() */
-
/*-------------------------------------------------------------------------
* Function: H5FD_stdio_truncate
*
@@ -995,8 +992,8 @@ 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)
{
- H5FD_stdio_t *file = (H5FD_stdio_t*)_file;
- static const char *func = "H5FD_stdio_truncate"; /* Function Name for error reporting */
+ H5FD_stdio_t * file = (H5FD_stdio_t *)_file;
+ static const char *func = "H5FD_stdio_truncate"; /* Function Name for error reporting */
/* Quiet the compiler */
dxpl_id = dxpl_id;
@@ -1006,17 +1003,17 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing)
H5Eclear2(H5E_DEFAULT);
/* Only try to flush the file if we have write access */
- if(file->write_access) {
+ if (file->write_access) {
/* Makes sure that the true file size is the same as the end-of-address. */
- if(file->eoa != file->eof) {
+ if (file->eoa != file->eof) {
#ifdef H5_HAVE_WIN32_API
- LARGE_INTEGER li; /* 64-bit (union) integer for SetFilePointer() call */
- DWORD dwPtrLow; /* Low-order pointer bits from SetFilePointer()
- * Only used as an error code here.
- */
- DWORD dwError; /* DWORD error code from GetLastError() */
- BOOL bError; /* Boolean error flag */
+ LARGE_INTEGER li; /* 64-bit (union) integer for SetFilePointer() call */
+ DWORD dwPtrLow; /* Low-order pointer bits from SetFilePointer()
+ * Only used as an error code here.
+ */
+ DWORD dwError; /* DWORD error code from GetLastError() */
+ BOOL bError; /* Boolean error flag */
/* Reset seek offset to beginning of file, so that file isn't re-extended later */
rewind(file->fp);
@@ -1030,42 +1027,43 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing)
* from SetFilePointer(), we also need to check GetLastError().
*/
dwPtrLow = SetFilePointer(file->hFile, li.LowPart, &li.HighPart, FILE_BEGIN);
- if(INVALID_SET_FILE_POINTER == dwPtrLow) {
+ if (INVALID_SET_FILE_POINTER == dwPtrLow) {
dwError = GetLastError();
- if(dwError != NO_ERROR )
+ if (dwError != NO_ERROR)
H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_FILEOPEN, "unable to set file pointer", -1)
}
-
+
bError = SetEndOfFile(file->hFile);
- if(0 == bError)
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "unable to truncate/extend file properly", -1)
-#else /* H5_HAVE_WIN32_API */
+ if (0 == bError)
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR,
+ "unable to truncate/extend file properly", -1)
+#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(file->fd, (file_offset_t)file->eoa))
- H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR, "unable to truncate/extend file properly", -1)
+ if (-1 == file_ftruncate(file->fd, (file_offset_t)file->eoa))
+ H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_SEEKERROR,
+ "unable to truncate/extend file properly", -1)
#endif /* H5_HAVE_WIN32_API */
- /* Update the eof value */
- file->eof = file->eoa;
+ /* Update the eof value */
+ file->eof = file->eoa;
/* Reset last file I/O information */
file->pos = HADDR_UNDEF;
- file->op = H5FD_STDIO_OP_UNKNOWN;
+ file->op = H5FD_STDIO_OP_UNKNOWN;
} /* end if */
- } /* end if */
+ } /* end if */
else {
/* Double-check for problems */
- if(file->eoa > file->eof)
+ if (file->eoa > file->eof)
H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_TRUNCATED, "eoa > eof!", -1)
} /* end else */
return 0;
} /* end H5FD_stdio_truncate() */
-
#ifdef _H5private_H
/*
* This is not related to the functionality of the driver code.
@@ -1074,4 +1072,3 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing)
*/
#error "Do not use HDF5 private definitions"
#endif
-