diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-09-30 14:27:10 (GMT) |
commit | b2d661b508a7fc7a2592c13bc6bdc175551f075d (patch) | |
tree | 13baeb0d83a7c2a4c6299993c182b1227c2f6114 /test/external_common.c | |
parent | 29ab58b58dce556639ea3154e262895773a8a8df (diff) | |
download | hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.zip hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.gz hdf5-b2d661b508a7fc7a2592c13bc6bdc175551f075d.tar.bz2 |
Clang-format of source files
Diffstat (limited to 'test/external_common.c')
-rw-r--r-- | test/external_common.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/test/external_common.c b/test/external_common.c index 85fdfa0..d0383b1 100644 --- a/test/external_common.c +++ b/test/external_common.c @@ -20,7 +20,6 @@ #include "external_common.h" - /*------------------------------------------------------------------------- * Function: reset_raw_data_files * @@ -37,51 +36,51 @@ herr_t reset_raw_data_files(hbool_t is_env) { - int fd = 0; /* external file descriptor */ - size_t i, j; /* iterators */ - hssize_t n; /* bytes of I/O */ - char filename[1024]; /* file name */ - int data[PART_SIZE]; /* raw data buffer */ - uint8_t *garbage = NULL; /* buffer of garbage data */ - size_t garbage_count; /* size of garbage buffer */ - size_t garbage_bytes; /* # of garbage bytes written to file */ + int fd = 0; /* external file descriptor */ + size_t i, j; /* iterators */ + hssize_t n; /* bytes of I/O */ + char filename[1024]; /* file name */ + int data[PART_SIZE]; /* raw data buffer */ + uint8_t *garbage = NULL; /* buffer of garbage data */ + size_t garbage_count; /* size of garbage buffer */ + size_t garbage_bytes; /* # of garbage bytes written to file */ /* Set up garbage buffer */ garbage_count = N_EXT_FILES * GARBAGE_PER_FILE; - if(NULL == (garbage = (uint8_t *)HDcalloc(garbage_count, sizeof(uint8_t)))) + if (NULL == (garbage = (uint8_t *)HDcalloc(garbage_count, sizeof(uint8_t)))) goto error; - for(i = 0; i < garbage_count; i++) + for (i = 0; i < garbage_count; i++) garbage[i] = 0xFF; /* The *r files are pre-filled with data and are used to * verify that read operations work correctly. */ - for(i = 0; i < N_EXT_FILES; i++) { + for (i = 0; i < N_EXT_FILES; i++) { /* Open file */ - if(is_env) + if (is_env) HDsprintf(filename, "extern_env_%lur.raw", (unsigned long)i + 1); else HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1); - if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) + if ((fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) goto error; /* Write garbage data to the file. This allows us to test the * the ability to set an offset in the raw data file. */ garbage_bytes = i * 10; - n = HDwrite(fd, garbage, garbage_bytes); - if(n < 0 || (size_t)n != garbage_bytes) + n = HDwrite(fd, garbage, garbage_bytes); + if (n < 0 || (size_t)n != garbage_bytes) goto error; /* Fill array with data */ - for(j = 0; j < PART_SIZE; j++) { + for (j = 0; j < PART_SIZE; j++) { data[j] = (int)(i * 25 + j); } /* end for */ /* Write raw data to the file. */ n = HDwrite(fd, data, sizeof(data)); - if(n != sizeof(data)) + if (n != sizeof(data)) goto error; /* Close this file */ @@ -93,22 +92,22 @@ reset_raw_data_files(hbool_t is_env) * used to verify that write operations work correctly. The individual * tests fill in the actual data. */ - for(i = 0; i < N_EXT_FILES; i++) { + for (i = 0; i < N_EXT_FILES; i++) { /* Open file */ - if(is_env) + if (is_env) HDsprintf(filename, "extern_env_%luw.raw", (unsigned long)i + 1); else HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1); - if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) + if ((fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0) goto error; /* Write garbage data to the file. This allows us to test the * the ability to set an offset in the raw data file. */ garbage_bytes = i * 10; - n = HDwrite(fd, garbage, garbage_bytes); - if(n < 0 || (size_t)n != garbage_bytes) + n = HDwrite(fd, garbage, garbage_bytes); + if (n < 0 || (size_t)n != garbage_bytes) goto error; /* Close this file */ @@ -119,9 +118,9 @@ reset_raw_data_files(hbool_t is_env) return SUCCEED; error: - if(fd) + if (fd) HDclose(fd); - if(garbage) + if (garbage) HDfree(garbage); return FAIL; } |