summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2019-04-02 22:53:51 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2019-04-02 22:53:51 (GMT)
commitf3469bbf4a5a670d42937809f8340032179e567d (patch)
treeb415b0d1b8cdf2e54226e4358914d09fdc671b39
parent6e0d81dc8b65dc078fa31dae50acf96f3ce372e7 (diff)
parent9b2bc5956784f311ff23512e1a359c29c1bd69a9 (diff)
downloadhdf5-inactive/json_vol.zip
hdf5-inactive/json_vol.tar.gz
hdf5-inactive/json_vol.tar.bz2
Merge pull request #1633 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:feature/json_vol to feature/json_volinactive/json_vol
* commit '9b2bc5956784f311ff23512e1a359c29c1bd69a9': Yanked H5private.h and added hdf5.h.
-rw-r--r--test/json_vol_connector.c44
-rw-r--r--test/json_vol_connector.h2
2 files changed, 23 insertions, 23 deletions
diff --git a/test/json_vol_connector.c b/test/json_vol_connector.c
index 1cdad9c..0a262a2 100644
--- a/test/json_vol_connector.c
+++ b/test/json_vol_connector.c
@@ -18,10 +18,7 @@
* (https://github.com/HDFGroup/hdf5-json)
*/
-/* Until we get a platform-independence library working, we'll cheat and
- * use H5private.h functionality as needed.
- */
-#include "H5private.h"
+#include "hdf5.h"
#include "H5PLextern.h"
@@ -37,6 +34,9 @@
/* libuuid for generating UUIDs */
#include <uuid/uuid.h>
+#define SUCCEED 0
+#define FAIL (-1)
+
/* Callbacks */
/* File */
static void *jvc_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
@@ -162,17 +162,16 @@ jvc_helper_create_group(json_vol_file_t *jfile, char *group_name)
/* File callback implementation */
static void *
-jvc_file_create(const char *name, unsigned H5_ATTR_UNUSED flags, hid_t H5_ATTR_UNUSED fcpl_id,
- hid_t H5_ATTR_UNUSED fapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+jvc_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req)
{
json_vol_file_t *jfile = NULL;
/* Set up */
- if(NULL == (jfile = (json_vol_file_t *)HDcalloc((size_t)1, sizeof(json_vol_file_t))))
+ if(NULL == (jfile = (json_vol_file_t *)calloc((size_t)1, sizeof(json_vol_file_t))))
goto error;
/* Create the file */
- if(NULL == (jfile->fp = HDfopen(name, "w")))
+ if(NULL == (jfile->fp = fopen(name, "w")))
goto error;
/* Create the JSON root */
@@ -186,15 +185,14 @@ jvc_file_create(const char *name, unsigned H5_ATTR_UNUSED flags, hid_t H5_ATTR_U
error:
if(jfile->fp)
- HDfclose(jfile->fp);
+ fclose(jfile->fp);
if(jfile)
- HDfree(jfile);
+ free(jfile);
return NULL;
} /* end jvc_file_create() */
static void *
-jvc_file_open(const char *name, unsigned H5_ATTR_UNUSED flags, hid_t H5_ATTR_UNUSED fapl_id,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+jvc_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req)
{
json_vol_file_t *jfile = NULL;
char *json_in = NULL;
@@ -202,55 +200,55 @@ jvc_file_open(const char *name, unsigned H5_ATTR_UNUSED flags, hid_t H5_ATTR_UNU
json_error_t jerror;
/* Set up */
- if(NULL == (jfile = (json_vol_file_t *)HDcalloc((size_t)1, sizeof(json_vol_file_t))))
+ if(NULL == (jfile = (json_vol_file_t *)calloc((size_t)1, sizeof(json_vol_file_t))))
goto error;
/* Open the file and get the size */
- if(NULL == (jfile->fp = HDfopen(name, "r")))
+ if(NULL == (jfile->fp = fopen(name, "r")))
goto error;
fseek(jfile->fp, 0, SEEK_END);
file_size = ftell(jfile->fp);
fseek(jfile->fp, 0, SEEK_SET);
/* Create the JSON root */
- if(NULL == (json_in = (char *)HDmalloc((size_t)(file_size + 1) * sizeof(char))))
+ if(NULL == (json_in = (char *)malloc((size_t)(file_size + 1) * sizeof(char))))
goto error;
fread(json_in, (size_t)file_size, 1, jfile->fp);
jfile->root = json_loads(json_in, 0, &jerror);
/* Will still need to parse out the groups array */
- HDfree(json_in);
+ free(json_in);
return (void *)jfile;
error:
if(json_in)
- HDfree(json_in);
+ free(json_in);
if(jfile->fp)
- HDfclose(jfile->fp);
+ fclose(jfile->fp);
if(jfile)
- HDfree(jfile);
+ free(jfile);
return NULL;
} /* end jvc_file_open() */
static herr_t
-jvc_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
+jvc_file_close(void *file, hid_t dxpl_id, void **req)
{
json_vol_file_t *jfile = (json_vol_file_t *)file;
/* Dump the JSON string to the file */
- HDfprintf(jfile->fp, "%s", json_dumps(jfile->root, 0));
+ fprintf(jfile->fp, "%s", json_dumps(jfile->root, 0));
/* Close the file */
- if(EOF == HDfclose(jfile->fp))
+ if(EOF == fclose(jfile->fp))
goto error;
/* Decrement the reference count on the JSON root, closing it */
json_decref(jfile->root);
/* Tear down */
- HDfree(jfile);
+ free(jfile);
return SUCCEED;
diff --git a/test/json_vol_connector.h b/test/json_vol_connector.h
index d3fb896..f4d654a 100644
--- a/test/json_vol_connector.h
+++ b/test/json_vol_connector.h
@@ -17,6 +17,8 @@
#ifndef _json_vol_connector_H
#define _json_vol_connector_H
+#include "hdf5.h"
+
#define JSON_VOL_CONNECTOR_VERSION 1
#define JSON_VOL_CONNECTOR_VALUE ((H5VL_class_value_t)104)
#define JSON_VOL_CONNECTOR_NAME "json_vol_connector"