summaryrefslogtreecommitdiffstats
path: root/hl/src
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-09-25 21:11:52 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-09-25 21:11:52 (GMT)
commitaa08db839e6aea89487be985704d57a0e424b21b (patch)
tree51dbbee3efa3bc1a3f1bb2314202a5934d6f021c /hl/src
parentcdc4b8a0fb55af4cf1a7bb4da5d8c4d454a0b8b6 (diff)
parent571a5e9250ca69adb54ef956361a5cf77059f67c (diff)
downloadhdf5-aa08db839e6aea89487be985704d57a0e424b21b.zip
hdf5-aa08db839e6aea89487be985704d57a0e424b21b.tar.gz
hdf5-aa08db839e6aea89487be985704d57a0e424b21b.tar.bz2
Merge pull request #2882 in HDFFV/hdf5 from ~BYRN/hdf5_adb:feature/cmakeV2-clang-format to develop
* commit '571a5e9250ca69adb54ef956361a5cf77059f67c': Add h5ls test plugin format target Fix manifest Add code owners file Update actions - split push/pull-request commits Change to executable Change to based on LLVM format Fix comment formatting due to tabs conversion Disable formatting for file File changes to affect formatting CMake and script changes for clang-format
Diffstat (limited to 'hl/src')
-rw-r--r--hl/src/CMakeLists.txt19
-rw-r--r--hl/src/H5LT.c150
2 files changed, 94 insertions, 75 deletions
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index c4ddf19..e73c470 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -30,6 +30,14 @@ set (HL_HEADERS
set (HL_PRIVATE_HEADERS
${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5DSprivate.h
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5IMprivate.h
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5PTprivate.h
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5HLprivate2.h
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5LTprivate.h
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5PTprivate.h
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5TBprivate.h
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5LDprivate.h
)
if (NOT ONLY_SHARED_LIBS)
@@ -64,6 +72,17 @@ if (BUILD_SHARED_LIBS)
endif ()
#-----------------------------------------------------------------------------
+# Add Target to clang-format
+#-----------------------------------------------------------------------------
+if (HDF5_ENABLE_FORMATTERS)
+ if (NOT ONLY_SHARED_LIBS)
+ clang_format (HDF5_HL_SRC_FORMAT ${HDF5_HL_LIB_TARGET})
+ else ()
+ clang_format (HDF5_HL_SRC_FORMAT ${HDF5_HL_LIBSH_TARGET})
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
# Add file(s) to CMake Install
#-----------------------------------------------------------------------------
install (
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index 939f6aa..0003018 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -58,17 +58,17 @@ size_t indent = 0;
/* Data structure to pass application data to callbacks. */
typedef struct {
- void *app_image_ptr; /* Pointer to application buffer */
- size_t app_image_size; /* Size of application buffer */
- void *fapl_image_ptr; /* Pointer to FAPL buffer */
- size_t fapl_image_size; /* Size of FAPL buffer */
- int fapl_ref_count; /* Reference counter for FAPL buffer */
- void *vfd_image_ptr; /* Pointer to VFD buffer */
- size_t vfd_image_size; /* Size of VFD buffer */
- int vfd_ref_count; /* Reference counter for VFD buffer */
- unsigned flags; /* Flags indicate how the file image will */
+ void *app_image_ptr; /* Pointer to application buffer */
+ size_t app_image_size; /* Size of application buffer */
+ void *fapl_image_ptr; /* Pointer to FAPL buffer */
+ size_t fapl_image_size; /* Size of FAPL buffer */
+ int fapl_ref_count; /* Reference counter for FAPL buffer */
+ void *vfd_image_ptr; /* Pointer to VFD buffer */
+ size_t vfd_image_size; /* Size of VFD buffer */
+ int vfd_ref_count; /* Reference counter for VFD buffer */
+ unsigned flags; /* Flags indicate how the file image will */
/* be open */
- int ref_count; /* Reference counter on udata struct */
+ int ref_count; /* Reference counter on udata struct */
} H5LT_file_image_ud_t;
/* callbacks prototypes for file image ops */
@@ -81,7 +81,7 @@ static herr_t udata_free(void *udata);
/* Definition of callbacks for file image operations. */
-
+
/*-------------------------------------------------------------------------
* Function: image_malloc
*
@@ -127,9 +127,9 @@ image_malloc(size_t size, H5FD_file_image_op_t file_image_op, void *_udata)
udata->fapl_image_size = udata->app_image_size;
return_value = udata->fapl_image_ptr;
udata->fapl_ref_count++;
- break;
+ break;
- case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY:
+ case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY:
if (udata->fapl_image_ptr == NULL)
goto out;
if (udata->fapl_image_size != size)
@@ -139,7 +139,7 @@ image_malloc(size_t size, H5FD_file_image_op_t file_image_op, void *_udata)
return_value = udata->fapl_image_ptr;
udata->fapl_ref_count++;
- break;
+ break;
case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET:
goto out;
@@ -160,16 +160,16 @@ image_malloc(size_t size, H5FD_file_image_op_t file_image_op, void *_udata)
goto out;
udata->vfd_image_ptr = udata->fapl_image_ptr;
- udata->vfd_image_size = size;
+ udata->vfd_image_size = size;
udata->vfd_ref_count++;
return_value = udata->vfd_image_ptr;
break;
- /* added unused labels to shut the compiler up */
- case H5FD_FILE_IMAGE_OP_NO_OP:
- case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE:
- case H5FD_FILE_IMAGE_OP_FILE_RESIZE:
- case H5FD_FILE_IMAGE_OP_FILE_CLOSE:
+ /* added unused labels to shut the compiler up */
+ case H5FD_FILE_IMAGE_OP_NO_OP:
+ case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE:
+ case H5FD_FILE_IMAGE_OP_FILE_RESIZE:
+ case H5FD_FILE_IMAGE_OP_FILE_CLOSE:
default:
goto out;
} /* end switch */
@@ -180,7 +180,7 @@ out:
return NULL;
} /* end image_malloc() */
-
+
/*-------------------------------------------------------------------------
* Function: image_memcpy
*
@@ -251,11 +251,11 @@ image_memcpy(void *dest, const void *src, size_t size, H5FD_file_image_op_t file
goto out;
break;
- /* added unused labels to shut the compiler up */
- case H5FD_FILE_IMAGE_OP_NO_OP:
- case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE:
- case H5FD_FILE_IMAGE_OP_FILE_RESIZE:
- case H5FD_FILE_IMAGE_OP_FILE_CLOSE:
+ /* added unused labels to shut the compiler up */
+ case H5FD_FILE_IMAGE_OP_NO_OP:
+ case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE:
+ case H5FD_FILE_IMAGE_OP_FILE_RESIZE:
+ case H5FD_FILE_IMAGE_OP_FILE_CLOSE:
default:
goto out;
} /* end switch */
@@ -266,7 +266,7 @@ out:
return NULL;
} /* end image_memcpy() */
-
+
/*-------------------------------------------------------------------------
* Function: image_realloc
*
@@ -351,7 +351,7 @@ image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *_udata)
switch(file_image_op) {
case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE:
- if (udata->fapl_image_ptr != ptr)
+ if (udata->fapl_image_ptr != ptr)
goto out;
if (udata->fapl_ref_count == 0)
goto out;
@@ -386,14 +386,14 @@ image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *_udata)
} /* end if */
break;
- /* added unused labels to keep the compiler quite */
- case H5FD_FILE_IMAGE_OP_NO_OP:
- case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET:
- case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY:
- case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET:
- case H5FD_FILE_IMAGE_OP_FILE_OPEN:
- case H5FD_FILE_IMAGE_OP_FILE_RESIZE:
- default:
+ /* added unused labels to keep the compiler quite */
+ case H5FD_FILE_IMAGE_OP_NO_OP:
+ case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET:
+ case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY:
+ case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET:
+ case H5FD_FILE_IMAGE_OP_FILE_OPEN:
+ case H5FD_FILE_IMAGE_OP_FILE_RESIZE:
+ default:
goto out;
} /* end switch */
@@ -403,7 +403,7 @@ out:
return(FAIL);
} /* end image_free() */
-
+
/*-------------------------------------------------------------------------
* Function: udata_copy
*
@@ -843,7 +843,7 @@ out:
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: H5LTopen_file_image
*
@@ -859,9 +859,9 @@ out:
*/
hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags)
{
- hid_t fapl=-1, file_id=-1; /* HDF5 identifiers */
+ hid_t fapl=-1, file_id=-1; /* HDF5 identifiers */
unsigned file_open_flags; /* Flags for image open */
- char file_name[64]; /* Filename buffer */
+ char file_name[64]; /* Filename buffer */
size_t alloc_incr; /* Buffer allocation increment */
size_t min_incr = 65536; /* Minimum buffer increment */
double buf_prcnt = 0.1f; /* Percentage of buffer size to set
@@ -898,7 +898,7 @@ hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags)
/* Set callbacks for file image ops ONLY if the file image is NOT copied */
if (flags & H5LT_FILE_IMAGE_DONT_COPY) {
- H5LT_file_image_ud_t *udata; /* Pointer to udata structure */
+ H5LT_file_image_ud_t *udata; /* Pointer to udata structure */
/* Allocate buffer to communicate user data to callbacks */
if (NULL == (udata = (H5LT_file_image_ud_t *)HDmalloc(sizeof(H5LT_file_image_ud_t))))
@@ -1407,13 +1407,13 @@ find_dataset(hid_t loc_id, const char *name, const H5L_info2_t *linfo, void *op_
* modify the op_data buffer (i.e.: dset_name) during the traversal, and the
* library never modifies that buffer.
*/
-H5_GCC_DIAG_OFF(cast-qual)
+H5_GCC_DIAG_OFF("cast-qual")
herr_t
H5LTfind_dataset( hid_t loc_id, const char *dset_name )
{
return H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, 0, find_dataset, (void *)dset_name);
}
-H5_GCC_DIAG_ON(cast-qual)
+H5_GCC_DIAG_ON("cast-qual")
/*-------------------------------------------------------------------------
*
@@ -2038,13 +2038,13 @@ herr_t H5LTfind_attribute( hid_t loc_id, const char* attr_name )
* modify the op_data buffer (i.e.: attr_name) during the traversal, and the
* library never modifies that buffer.
*/
-H5_GCC_DIAG_OFF(cast-qual)
+H5_GCC_DIAG_OFF("cast-qual")
herr_t
H5LT_find_attribute( hid_t loc_id, const char* attr_name )
{
return H5Aiterate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, find_attr, (void *)attr_name);
}
-H5_GCC_DIAG_ON(cast-qual)
+H5_GCC_DIAG_ON("cast-qual")
/*-------------------------------------------------------------------------
@@ -2297,13 +2297,13 @@ realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, const char *str
* extend past the allocated buffer; if it does then truncate the string
*/
if(size_str < *len - 1) {
- if( size_str + size_str_to_add < *len - 1) {
- HDstrncat(buf, str_to_add, size_str_to_add);
- } else {
- HDstrncat(buf, str_to_add, (*len - 1) - size_str);
- }
+ if( size_str + size_str_to_add < *len - 1) {
+ HDstrncat(buf, str_to_add, size_str_to_add);
+ } else {
+ HDstrncat(buf, str_to_add, (*len - 1) - size_str);
+ }
} else {
- buf[*len-1] = '\0'; /* buffer is full, null terminate */
+ buf[*len-1] = '\0'; /* buffer is full, null terminate */
}
}
@@ -3062,15 +3062,15 @@ next:
HDsnprintf(dt_str, *slen, "H5T_NO_CLASS");
break;
case H5T_REFERENCE:
- if (H5Tequal(dtype, H5T_STD_REF_DSETREG) == TRUE) {
- HDsnprintf(dt_str, *slen, " H5T_REFERENCE { H5T_STD_REF_DSETREG }");
- }
- else {
- HDsnprintf(dt_str, *slen, " H5T_REFERENCE { H5T_STD_REF_OBJECT }");
- }
- break;
+ if (H5Tequal(dtype, H5T_STD_REF_DSETREG) == TRUE) {
+ HDsnprintf(dt_str, *slen, " H5T_REFERENCE { H5T_STD_REF_DSETREG }");
+ }
+ else {
+ HDsnprintf(dt_str, *slen, " H5T_REFERENCE { H5T_STD_REF_OBJECT }");
+ }
+ break;
case H5T_NCLASSES:
- break;
+ break;
default:
HDsnprintf(dt_str, *slen, "unknown data type");
}
@@ -3626,7 +3626,7 @@ out:
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: H5LT_set_attribute_string
*
@@ -3746,12 +3746,12 @@ H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid)
if(HDstrncmp(path, ".", path_length) == 0) {
if(check_object_valid) {
obj_exists = H5Oexists_by_name(loc_id, path, H5P_DEFAULT);
- ret_value = obj_exists;
- goto done;
+ ret_value = obj_exists;
+ goto done;
} else {
- ret_value = TRUE; /* Since the object is the identifier itself,
- * we can only check if loc_id is a valid type */
- goto done;
+ ret_value = TRUE; /* Since the object is the identifier itself,
+ * we can only check if loc_id is a valid type */
+ goto done;
}
}
@@ -3775,20 +3775,20 @@ H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid)
obj_exists = FALSE;
if((link_exists = H5Lexists(loc_id, tmp_path, H5P_DEFAULT)) < 0) {
- ret_value = FAIL;
- goto done;
+ ret_value = FAIL;
+ goto done;
}
/* If target link does not exist then no reason to
* continue checking the path */
if(link_exists != TRUE) {
- ret_value = FALSE;
- goto done;
+ ret_value = FALSE;
+ goto done;
}
/* Determine if link resolves to an actual object */
if((obj_exists = H5Oexists_by_name(loc_id, tmp_path, H5P_DEFAULT)) < 0) {
- ret_value = FAIL;
+ ret_value = FAIL;
goto done;
}
@@ -3812,11 +3812,11 @@ H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid)
ret_value = link_exists;
/* Determine if link resolves to an actual object for check_object_valid TRUE */
if(check_object_valid == TRUE && link_exists == TRUE) {
- if((obj_exists = H5Oexists_by_name(loc_id, tmp_path, H5P_DEFAULT)) < 0) {
- ret_value = FAIL;
- } else {
- ret_value = obj_exists;
- }
+ if((obj_exists = H5Oexists_by_name(loc_id, tmp_path, H5P_DEFAULT)) < 0) {
+ ret_value = FAIL;
+ } else {
+ ret_value = obj_exists;
+ }
}
}