summaryrefslogtreecommitdiffstats
path: root/test/ttsafe_attr_vlen.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2021-03-25 00:39:37 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2021-03-25 00:39:37 (GMT)
commitfeb20aac304b39e18c70f88cae2f7cf7d5c82db2 (patch)
treee15d7e751af4e3c42e77ea955d91db4cf27a71cf /test/ttsafe_attr_vlen.c
parentbdac2ecdbff2c389a222b3d93ff1eb1d23ec6b23 (diff)
downloadhdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.zip
hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.gz
hdf5-feb20aac304b39e18c70f88cae2f7cf7d5c82db2.tar.bz2
Formats the source and updates the gcc warning pragmas
Diffstat (limited to 'test/ttsafe_attr_vlen.c')
-rw-r--r--test/ttsafe_attr_vlen.c55
1 files changed, 27 insertions, 28 deletions
diff --git a/test/ttsafe_attr_vlen.c b/test/ttsafe_attr_vlen.c
index b07e362..e2aa5a0 100644
--- a/test/ttsafe_attr_vlen.c
+++ b/test/ttsafe_attr_vlen.c
@@ -16,7 +16,7 @@
* Testing for thread safety in H5A library operations.
* ------------------------------------------------------------------
*
- * Purpose: Verify that the segmentation fault described in HDFFV-11080
+ * Purpose: Verify that the segmentation fault described in HDFFV-11080
* is fixed.
*
* This test simulates what the user did to trigger the error:
@@ -30,13 +30,13 @@
* --Open the test file
* --Open and read the attribute for each opened file
*
- * The cause of the problem in this jira issue is due to the file pointer
- * that is set in the variable length string datatype for the attribute.
- * That file pointer is already closed and therefore needs to be set to
+ * The cause of the problem in this jira issue is due to the file pointer
+ * that is set in the variable length string datatype for the attribute.
+ * That file pointer is already closed and therefore needs to be set to
* the current opened file pointer when the attribute is accessed.
* Similar patch up was done before when reading dataset in H5D__read()
* in src/H5Aint.c.
- * Hopefully this kind of patch can go away when we resolve the
+ * Hopefully this kind of patch can go away when we resolve the
* shared file pointer issue.
*
********************************************************************/
@@ -45,24 +45,24 @@
#ifdef H5_HAVE_THREADSAFE
-#define FILENAME "ttsafe_attr_vlen.h5"
+#define FILENAME "ttsafe_attr_vlen.h5"
#define ATTR_NAME "root_attr"
-#define NUM_THREADS 32
+#define NUM_THREADS 32
void *tts_attr_vlen_thread(void *);
void
tts_attr_vlen(void)
{
- pthread_t threads[NUM_THREADS] = {0}; /* Thread declaration */
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t gid = H5I_INVALID_HID; /* Group ID */
- hid_t atid = H5I_INVALID_HID; /* Datatype ID for attribute */
- hid_t asid = H5I_INVALID_HID; /* Dataspace ID for attribute */
- hid_t aid = H5I_INVALID_HID; /* The attribute ID */
- char *string_attr = "2.0"; /* The attribute data */
- int ret; /* Return value */
- int i; /* Local index variable */
+ pthread_t threads[NUM_THREADS] = {0}; /* Thread declaration */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
+ hid_t atid = H5I_INVALID_HID; /* Datatype ID for attribute */
+ hid_t asid = H5I_INVALID_HID; /* Dataspace ID for attribute */
+ hid_t aid = H5I_INVALID_HID; /* The attribute ID */
+ char * string_attr = "2.0"; /* The attribute data */
+ int ret; /* Return value */
+ int i; /* Local index variable */
/* Create the HDF5 test file */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -106,11 +106,11 @@ tts_attr_vlen(void)
CHECK(ret, H5I_INVALID_HID, "H5Tclose");
/* Start multiple threads and execute tts_attr_vlen_thread() for each thread */
- for(i = 0; i < NUM_THREADS; i++)
+ for (i = 0; i < NUM_THREADS; i++)
pthread_create(&threads[i], NULL, tts_attr_vlen_thread, NULL);
/* Wait for the threads to end */
- for(i = 0; i < NUM_THREADS; i++)
+ for (i = 0; i < NUM_THREADS; i++)
pthread_join(threads[i], NULL);
} /* end tts_attr_vlen() */
@@ -119,13 +119,13 @@ tts_attr_vlen(void)
void *
tts_attr_vlen_thread(void *client_data)
{
- hid_t fid = H5I_INVALID_HID; /* File ID */
- hid_t gid = H5I_INVALID_HID; /* Group ID */
- hid_t aid = H5I_INVALID_HID; /* Attribute ID */
- hid_t atid = H5I_INVALID_HID; /* Datatype ID for the attribute */
- char *string_attr_check; /* The attribute data being read */
- char *string_attr = "2.0"; /* The expected attribute data */
- herr_t ret; /* Return value */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
+ hid_t aid = H5I_INVALID_HID; /* Attribute ID */
+ hid_t atid = H5I_INVALID_HID; /* Datatype ID for the attribute */
+ char * string_attr_check; /* The attribute data being read */
+ char * string_attr = "2.0"; /* The expected attribute data */
+ herr_t ret; /* Return value */
/* Open the test file */
fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
@@ -146,10 +146,10 @@ tts_attr_vlen_thread(void *client_data)
/* Read the attribute */
ret = H5Aread(aid, atid, &string_attr_check);
CHECK(ret, FAIL, "H5Aclose");
-
+
/* Verify the attribute data is as expected */
VERIFY_STR(string_attr_check, string_attr, "H5Aread");
-
+
/* Close IDs */
ret = H5Aclose(aid);
CHECK(ret, FAIL, "H5Aclose");
@@ -173,4 +173,3 @@ cleanup_attr_vlen(void)
}
#endif /*H5_HAVE_THREADSAFE*/
-