summaryrefslogtreecommitdiffstats
path: root/tools/misc/h5debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/misc/h5debug.c')
-rw-r--r--tools/misc/h5debug.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c
index c532e5d..145c553 100644
--- a/tools/misc/h5debug.c
+++ b/tools/misc/h5debug.c
@@ -54,7 +54,7 @@
int
main(int argc, char *argv[])
{
- hid_t fid, plist=H5P_DEFAULT;
+ hid_t fid, fapl, dxpl;
H5F_t *f;
haddr_t addr=0, extra=0;
uint8_t sig[16];
@@ -67,14 +67,27 @@ main(int argc, char *argv[])
HDexit(1);
}
+ /* Initialize the library */
+ if(H5open ()<0) {
+ fprintf(stderr, "cannot initialize the library\n");
+ HDexit(1);
+ }
+
/*
* Open the file and get the file descriptor.
*/
+ if((dxpl = H5Pcreate (H5P_DATASET_XFER))<0) {
+ fprintf(stderr, "cannot create dataset transfer property list\n");
+ HDexit(1);
+ }
+ if((fapl = H5Pcreate (H5P_FILE_ACCESS))<0) {
+ fprintf(stderr, "cannot create file access property list\n");
+ HDexit(1);
+ }
if (strchr (argv[1], '%')) {
- plist = H5Pcreate (H5P_FILE_ACCESS);
- H5Pset_fapl_family (plist, (hsize_t)0, H5P_DEFAULT);
+ H5Pset_fapl_family (fapl, (hsize_t)0, H5P_DEFAULT);
}
- if ((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, plist)) < 0) {
+ if ((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0) {
fprintf(stderr, "cannot open file\n");
HDexit(1);
}
@@ -97,7 +110,7 @@ main(int argc, char *argv[])
* Read the signature at the specified file position.
*/
HDfprintf(stdout, "Reading signature at address %a (rel)\n", addr);
- if (H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), H5P_DEFAULT, sig)<0) {
+ if (H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), dxpl, sig)<0) {
fprintf(stderr, "cannot read signature\n");
HDexit(3);
}
@@ -180,6 +193,8 @@ main(int argc, char *argv[])
fprintf(stderr, "An error occurred\n");
HDexit(5);
}
+ H5Pclose(dxpl);
+ H5Pclose(fapl);
H5Fclose(fid);
return 0;
}