diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index cacf452695c..392382deafe 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -31,12 +31,12 @@ using std::endl; do { \ if (HDGetTestVerbosity() > (V)) \ print_func A; \ - } while(0) + } while (0) #define SUBTEST(TEST) \ do { \ printf(" Subtest: %-52s", TEST); \ fflush(stdout); \ - } while(0) + } while (0) int check_values(hsize_t i, hsize_t j, int apoint, int acheck); void check_values(const char *value, const char *msg, int line, const char *file_name); diff --git a/hl/src/H5LD.c b/hl/src/H5LD.c index 570e6e16152..65a15e3219b 100644 --- a/hl/src/H5LD.c +++ b/hl/src/H5LD.c @@ -194,7 +194,7 @@ H5LD_construct_vector(char *fields, H5LD_memb_t *listv[] /*OUT*/, hid_t par_tid) switch (*fields_ptr) { case '\0': /* end of list */ if (gotmember) { /* getting something and end of "fields" */ - *cur++ = '\0'; + *cur++ = '\0'; memb->names[++j] = NULL; } /* end if */ else /* getting nothing but end of list */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 108db48a031..a4fae8d4631 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -89,7 +89,7 @@ (H5D_CHUNK_IDX_BTREE == (storage)->idx_type && H5D_COPS_BTREE == (storage)->ops) || \ (H5D_CHUNK_IDX_SINGLE == (storage)->idx_type && H5D_COPS_SINGLE == (storage)->ops) || \ (H5D_CHUNK_IDX_NONE == (storage)->idx_type && H5D_COPS_NONE == (storage)->ops)); \ - } while(0) + } while (0) /* * Feature: If this constant is defined then every cache preemption and load * causes a character to be printed on the standard error stream: @@ -3779,7 +3779,7 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udat udata->idx_hint = idx; udata->chunk_block.offset = ent->chunk_block.offset; udata->chunk_block.length = ent->chunk_block.length; - udata->chunk_idx = ent->chunk_idx; + udata->chunk_idx = ent->chunk_idx; } /* end if */ else { /* Invalidate idx_hint, to signal that the chunk is not in cache */ diff --git a/src/H5FD.c b/src/H5FD.c index 9e912b9fd1f..9a12bcf0fc8 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -931,8 +931,7 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2) FUNC_ENTER_NOAPI_NOERR /* return value is arbitrary */ - if ((!f1 || !f1->cls) && (!f2 || !f2->cls)) - HGOTO_DONE(0) + if ((!f1 || !f1->cls) && (!f2 || !f2->cls)) HGOTO_DONE(0) if (!f1 || !f1->cls) HGOTO_DONE(-1) if (!f2 || !f2->cls) diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 3f91fb1621d..434ea43f252 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -47,7 +47,7 @@ typedef struct H5F_t H5F_t; (p)++; \ *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); \ (p)++; \ - } while(0) + } while (0) #define UINT16ENCODE(p, i) \ do { \ @@ -55,7 +55,7 @@ typedef struct H5F_t H5F_t; (p)++; \ *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); \ (p)++; \ - } while(0) + } while (0) #define INT32ENCODE(p, i) \ do { \ @@ -67,7 +67,7 @@ typedef struct H5F_t H5F_t; (p)++; \ *(p) = (uint8_t)(((uint32_t)(i) >> 24) & 0xff); \ (p)++; \ - } while(0) + } while (0) #define UINT32ENCODE(p, i) \ do { \ @@ -79,7 +79,7 @@ typedef struct H5F_t H5F_t; (p)++; \ *(p) = (uint8_t)(((i) >> 24) & 0xff); \ (p)++; \ - } while(0) + } while (0) /* Encode an unsigned integer into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ @@ -92,7 +92,7 @@ typedef struct H5F_t H5F_t; for (_i = 0; _i < l; _i++, _n >>= 8) \ *_p++ = (uint8_t)(_n & 0xff); \ (p) = (uint8_t *)(p) + l; \ - } while(0) + } while (0) /* Encode a 32-bit unsigned integer into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ @@ -109,7 +109,7 @@ typedef struct H5F_t H5F_t; for (/*void*/; _i < 8; _i++) \ *_p++ = (uint8_t)((n) < 0 ? 0xff : 0); \ (p) = (uint8_t *)(p) + 8; \ - } while(0) + } while (0) #define UINT64ENCODE(p, n) \ do { \ @@ -122,7 +122,7 @@ typedef struct H5F_t H5F_t; for (/*void*/; _i < 8; _i++) \ *_p++ = 0; \ (p) = (uint8_t *)(p) + 8; \ - } while(0) + } while (0) /* Encode a 64-bit unsigned integer into a variable-sized buffer */ /* (Assumes that the high bits of the integer are zero) */ @@ -137,13 +137,13 @@ typedef struct H5F_t H5F_t; \ *(p)++ = (uint8_t)_s; \ UINT64ENCODE_VAR(p, __n, _s); \ - } while(0) + } while (0) #define H5_ENCODE_UNSIGNED(p, n) \ do { \ HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ UINT32ENCODE(p, n); \ - } while(0) + } while (0) /* Assumes the endianness of uint64_t is the same as double */ #define H5_ENCODE_DOUBLE(p, n) \ @@ -158,7 +158,7 @@ typedef struct H5F_t H5F_t; for (_u = 0; _u < sizeof(uint64_t); _u++, _n >>= 8) \ *_p++ = (uint8_t)(_n & 0xff); \ (p) = (uint8_t *)(p) + 8; \ - } while(0) + } while (0) /* DECODE converts little endian bytes pointed by p to integer values and store * it in i. For signed values, need to do sign-extension when converting @@ -174,7 +174,7 @@ typedef struct H5F_t H5F_t; (p)++; \ (i) |= (int16_t)(((*(p)&0xff) << 8) | ((*(p)&0x80) ? ~0xffff : 0x0)); \ (p)++; \ - } while(0) + } while (0) #define UINT16DECODE(p, i) \ do { \ @@ -182,7 +182,7 @@ typedef struct H5F_t H5F_t; (p)++; \ (i) |= (uint16_t)((*(p)&0xff) << 8); \ (p)++; \ - } while(0) + } while (0) #define INT32DECODE(p, i) \ do { \ @@ -194,7 +194,7 @@ typedef struct H5F_t H5F_t; (p)++; \ (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | ((*(p)&0x80) ? ~0xffffffffULL : 0x0ULL))); \ (p)++; \ - } while(0) + } while (0) #define UINT32DECODE(p, i) \ do { \ @@ -206,7 +206,7 @@ typedef struct H5F_t H5F_t; (p)++; \ (i) |= ((uint32_t)(*(p)&0xff) << 24); \ (p)++; \ - } while(0) + } while (0) /* Decode a variable-sized buffer */ /* (Assumes that the high bits of the integer will be zero) */ @@ -219,7 +219,7 @@ typedef struct H5F_t H5F_t; for (_i = 0; _i < l; _i++) \ n = (n << 8) | *(--p); \ (p) += l; \ - } while(0) + } while (0) /* Decode a variable-sized buffer into a 32-bit unsigned integer */ /* (Assumes that the high bits of the integer will be zero) */ @@ -235,7 +235,7 @@ typedef struct H5F_t H5F_t; for (_i = 0; _i < sizeof(int64_t); _i++) \ n = (n << 8) | *(--p); \ (p) += 8; \ - } while(0) + } while (0) #define UINT64DECODE(p, n) \ do { \ @@ -247,7 +247,7 @@ typedef struct H5F_t H5F_t; for (_i = 0; _i < sizeof(uint64_t); _i++) \ n = (n << 8) | *(--p); \ (p) += 8; \ - } while(0) + } while (0) /* Decode a variable-sized buffer into a 64-bit unsigned integer */ /* (Assumes that the high bits of the integer will be zero) */ @@ -266,7 +266,7 @@ typedef struct H5F_t H5F_t; do { \ HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ UINT32DECODE(p, n); \ - } while(0) + } while (0) /* Assumes the endianness of uint64_t is the same as double */ #define H5_DECODE_DOUBLE(p, n) \ @@ -282,7 +282,7 @@ typedef struct H5F_t H5F_t; _n = (_n << 8) | *(--p); \ H5MM_memcpy(&(n), &_n, sizeof(double)); \ (p) += 8; \ - } while(0) + } while (0) /* clang-format off */ /* Address-related macros */ @@ -447,69 +447,69 @@ typedef struct H5F_t H5F_t; /* Macros to encode/decode offset/length's for storing in the file */ #define H5F_ENCODE_OFFSET(f, p, o) \ do { \ - switch (H5F_SIZEOF_ADDR(f)) { \ - case 4: \ - UINT32ENCODE(p, o); \ - break; \ - case 8: \ - UINT64ENCODE(p, o); \ - break; \ - case 2: \ - UINT16ENCODE(p, o); \ - break; \ + switch (H5F_SIZEOF_ADDR(f)) { \ + case 4: \ + UINT32ENCODE(p, o); \ + break; \ + case 8: \ + UINT64ENCODE(p, o); \ + break; \ + case 2: \ + UINT16ENCODE(p, o); \ + break; \ } \ - } while(0) + } while (0) #define H5F_DECODE_OFFSET(f, p, o) \ do { \ - switch (H5F_SIZEOF_ADDR(f)) { \ - case 4: \ - UINT32DECODE(p, o); \ - break; \ - case 8: \ - UINT64DECODE(p, o); \ - break; \ - case 2: \ - UINT16DECODE(p, o); \ - break; \ + switch (H5F_SIZEOF_ADDR(f)) { \ + case 4: \ + UINT32DECODE(p, o); \ + break; \ + case 8: \ + UINT64DECODE(p, o); \ + break; \ + case 2: \ + UINT16DECODE(p, o); \ + break; \ } \ - } while(0) + } while (0) #define H5F_ENCODE_LENGTH_LEN(p, l, s) \ do { \ - switch (s) { \ - case 4: \ - UINT32ENCODE(p, l); \ - break; \ - case 8: \ - UINT64ENCODE(p, l); \ - break; \ - case 2: \ - UINT16ENCODE(p, l); \ - break; \ - default: \ - HDassert("bad sizeof size" && 0); \ - } \ - } while(0) + switch (s) { \ + case 4: \ + UINT32ENCODE(p, l); \ + break; \ + case 8: \ + UINT64ENCODE(p, l); \ + break; \ + case 2: \ + UINT16ENCODE(p, l); \ + break; \ + default: \ + HDassert("bad sizeof size" && 0); \ + } \ + } while (0) #define H5F_ENCODE_LENGTH(f, p, l) H5F_ENCODE_LENGTH_LEN(p, l, H5F_SIZEOF_SIZE(f)) #define H5F_DECODE_LENGTH_LEN(p, l, s) \ do { \ - switch (s) { \ - case 4: \ - UINT32DECODE(p, l); \ - break; \ - case 8: \ - UINT64DECODE(p, l); \ - break; \ - case 2: \ - UINT16DECODE(p, l); \ - break; \ - default: \ - HDassert("bad sizeof size" && 0); \ - } \ - } while(0) + switch (s) { \ + case 4: \ + UINT32DECODE(p, l); \ + break; \ + case 8: \ + UINT64DECODE(p, l); \ + break; \ + case 2: \ + UINT16DECODE(p, l); \ + break; \ + default: \ + HDassert("bad sizeof size" && 0); \ + } \ + } while (0) #define H5F_DECODE_LENGTH(f, p, l) DECODE_VAR(p, l, H5F_SIZEOF_SIZE(f)) diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 3992a86ebea..5fdc5d3a3d2 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -158,10 +158,10 @@ /* Decode a "managed" heap ID */ #define H5HF_MAN_ID_DECODE(i, h, f, o, l) \ do { \ - f = *(uint8_t *)i++; \ - UINT64DECODE_VAR((i), (o), (h)->heap_off_size); \ - UINT64DECODE_VAR((i), (l), (h)->heap_len_size); \ - } while(0) + f = *(uint8_t *)i++; \ + UINT64DECODE_VAR((i), (o), (h)->heap_off_size); \ + UINT64DECODE_VAR((i), (l), (h)->heap_len_size); \ + } while (0) /* Free space section types for fractal heap */ /* (values stored in free space data structures in file) */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 910200e90b1..33deb509ec2 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -1026,7 +1026,7 @@ done: _tmp = ARRAY[I]; \ ARRAY[I] = ARRAY[J]; \ ARRAY[J] = _tmp; \ - } while(0) + } while (0) /* Minimum size of variable-length conversion buffer */ #define H5T_VLEN_MIN_CONF_BUF_SIZE 4096 diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h index 377eae6ed5b..722ed62f17b 100644 --- a/src/H5VMprivate.h +++ b/src/H5VMprivate.h @@ -45,7 +45,7 @@ typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off, size_t len, H5MM_memcpy(DST, SRC, (N) * sizeof(*(DST))); \ else \ HDmemset(DST, 0, (N) * sizeof(*(DST))); \ - } while(0) + } while (0) #define H5VM_vector_zero(N, DST) HDmemset(DST, 0, (N) * sizeof(*(DST))) @@ -64,7 +64,7 @@ typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off, size_t len, HDmemmove(&(COORDS)[1], &(COORDS)[0], sizeof(TYPE) * (UNLIM_DIM)); \ (COORDS)[0] = _tmp; \ } /* end if */ \ - } while(0) + } while (0) /* Given a coordinate offset array (COORDS) of type TYPE, move the value at * offset 0 to offset of the unlimied dimension (UNLIM_DIM), sliding any diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 90ef2853fb3..9f59c716f99 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -319,16 +319,16 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5MM_memcpy(_fv_p, (char *)&_cd_value + 4 - _size_rem, _size_rem); \ } /* end if */ \ } /* end else */ \ - } while(0) + } while (0) /* Get the fill value for floating-point type */ #define H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \ do { \ if (sizeof(type) <= sizeof(long long)) \ H5Z_scaleoffset_get_filval_1(type, cd_values, filval); \ - else HGOTO_ERROR( \ - H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ - } while(0) + else \ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ + } while (0) /* Find maximum and minimum values of a buffer with fill value defined for integer type */ #define H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ @@ -457,32 +457,31 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ \ if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ H5Z_scaleoffset_get_filval_1(type, cd_values, filval); \ - if (*minbits == H5Z_SO_INT_MINBITS_DEFAULT) \ - { /* minbits not set yet, calculate max, min, and minbits */ \ - H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ - H5Z_scaleoffset_check_1(type, max, min, minbits) \ - span = (type)(max - min + 1); \ - *minbits = H5Z__scaleoffset_log2((unsigned long long)(span + 1)); \ - } \ - else /* minbits already set, only calculate min */ \ - H5Z_scaleoffset_min_1(i, d_nelmts, buf, filval, min); \ - if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ - for (i = 0; i < d_nelmts; i++) buf[i] = \ - (type)((buf[i] == filval) ? (((type)1 << *minbits) - 1) : (buf[i] - min)); \ + if (*minbits == \ + H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ \ + H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ + H5Z_scaleoffset_check_1(type, max, min, minbits) span = (type)(max - min + 1); \ + *minbits = H5Z__scaleoffset_log2((unsigned long long)(span + 1)); \ + } \ + else /* minbits already set, only calculate min */ \ + H5Z_scaleoffset_min_1(i, d_nelmts, buf, filval, min); \ + if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ + for (i = 0; i < d_nelmts; i++) \ + buf[i] = (type)((buf[i] == filval) ? (((type)1 << *minbits) - 1) : (buf[i] - min)); \ } \ else { /* fill value undefined */ \ if (*minbits == \ H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ \ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min); \ H5Z_scaleoffset_check_1(type, max, min, minbits); \ - span = (type)(max - min + 1); \ + span = (type)(max - min + 1); \ *minbits = H5Z__scaleoffset_log2((unsigned long long)span); \ } \ else /* minbits already set, only calculate min */ \ H5Z_scaleoffset_min_2(i, d_nelmts, buf, min); \ - if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ - for (i = 0; i < d_nelmts; i++) \ - buf[i] = (type)(buf[i] - min); \ + if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ + for (i = 0; i < d_nelmts; i++) \ + buf[i] = (type)(buf[i] - min); \ } \ *minval = min; \ } while (0) @@ -496,18 +495,18 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ \ if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ H5Z_scaleoffset_get_filval_1(type, cd_values, filval); \ - if (*minbits == H5Z_SO_INT_MINBITS_DEFAULT) \ - { /* minbits not set yet, calculate max, min, and minbits */ \ + if (*minbits == \ + H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ \ H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ H5Z_scaleoffset_check_2(type, max, min, minbits) span = (unsigned type)(max - min + 1); \ *minbits = H5Z__scaleoffset_log2((unsigned long long)(span + 1)); \ } \ else /* minbits already set, only calculate min */ \ H5Z_scaleoffset_min_1(i, d_nelmts, buf, filval, min); \ - if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ - for (i = 0; i < d_nelmts; i++) buf[i] = \ - (type)((buf[i] == filval) ? (type)(((unsigned type)1 << *minbits) - 1) \ - : (buf[i] - min)); \ + if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ + for (i = 0; i < d_nelmts; i++) \ + buf[i] = (type)((buf[i] == filval) ? (type)(((unsigned type)1 << *minbits) - 1) \ + : (buf[i] - min)); \ } \ else { /* fill value undefined */ \ if (*minbits == \ @@ -607,8 +606,9 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5Z_scaleoffset_get_filval_2(type, cd_values, filval); \ H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val); \ H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val); \ - span = (unsigned long long)(llround_fun(max * pow_fun((type)10, (type)D_val) - \ - min * pow_fun((type)10, (type)D_val)) + 1); \ + span = (unsigned long long)(llround_fun(max * pow_fun((type)10, (type)D_val) - \ + min * pow_fun((type)10, (type)D_val)) + \ + 1); \ *minbits = H5Z__scaleoffset_log2(span + 1); \ if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ H5Z_scaleoffset_modify_1(i, type, pow_fun, abs_fun, lround_fun, llround_fun, buf, d_nelmts, \ @@ -617,8 +617,9 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ else { /* fill value undefined */ \ H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min); \ H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val); \ - span = (unsigned long long)(llround_fun(max * pow_fun((type)10, (type)D_val) - \ - min * pow_fun((type)10, (type)D_val)) + 1); \ + span = (unsigned long long)(llround_fun(max * pow_fun((type)10, (type)D_val) - \ + min * pow_fun((type)10, (type)D_val)) + \ + 1); \ *minbits = H5Z__scaleoffset_log2(span); \ if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ H5Z_scaleoffset_modify_2(i, type, pow_fun, lround_fun, llround_fun, buf, d_nelmts, min, \ @@ -635,8 +636,8 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ \ if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ H5Z_scaleoffset_get_filval_1(type, cd_values, filval); \ - for (i = 0; i < d_nelmts; i++) buf[i] = \ - (type)((buf[i] == (((type)1 << minbits) - 1)) ? filval : (buf[i] + minval)); \ + for (i = 0; i < d_nelmts; i++) \ + buf[i] = (type)((buf[i] == (((type)1 << minbits) - 1)) ? filval : (buf[i] + minval)); \ } \ else /* fill value undefined */ \ for (i = 0; i < d_nelmts; i++) \ @@ -651,9 +652,10 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ \ if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ H5Z_scaleoffset_get_filval_1(type, cd_values, filval); \ - for (i = 0; i < d_nelmts; i++) buf[i] = \ - (type)(((unsigned type)buf[i] == (((unsigned type)1 << minbits) - 1)) ? filval \ - : (buf[i] + minval)); \ + for (i = 0; i < d_nelmts; i++) \ + buf[i] = (type)(((unsigned type)buf[i] == (((unsigned type)1 << minbits) - 1)) \ + ? filval \ + : (buf[i] + minval)); \ } \ else /* fill value undefined */ \ for (i = 0; i < d_nelmts; i++) \ @@ -676,7 +678,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } /* end else */ \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ - } while(0) + } while (0) /* Modify values of data in postdecompression if fill value defined for floating-point type */ #define H5Z_scaleoffset_modify_3(i, type, pow_fun, buf, d_nelmts, filval, minbits, min, D_val) \ @@ -703,7 +705,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ - } while(0) + } while (0) /* Modify values of data in postdecompression if fill value undefined for floating-point type */ #define H5Z_scaleoffset_modify_4(i, type, pow_fun, buf, d_nelmts, min, D_val) \ @@ -719,7 +721,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ buf[i] = ((type)(*(long long *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \ else \ HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ - } while(0) + } while (0) /* Postdecompress for floating-point type using variable-minimum-bits method */ #define H5Z_scaleoffset_postdecompress_3(type, pow_fun, data, d_nelmts, filavail, cd_values, minbits, \ @@ -730,8 +732,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ \ H5Z_scaleoffset_get_min(type, minval, min); \ \ - if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) \ - { /* fill value defined */ \ + if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ H5Z_scaleoffset_get_filval_2(type, cd_values, filval); \ H5Z_scaleoffset_modify_3(i, type, pow_fun, buf, d_nelmts, filval, minbits, min, D_val); \ } \ @@ -1541,7 +1542,8 @@ H5Z__scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleo if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ H5Z_scaleoffset_get_filval_1(signed char, cd_values, filval); for (i = 0; i < d_nelmts; i++) - buf[i] = (signed char)((buf[i] == (((unsigned char)1 << minbits) - 1)) ? filval : (buf[i] + sminval)); + buf[i] = (signed char)((buf[i] == (((unsigned char)1 << minbits) - 1)) ? filval + : (buf[i] + sminval)); } else /* fill value undefined */ for (i = 0; i < d_nelmts; i++) diff --git a/src/H5checksum.c b/src/H5checksum.c index 253c3da9a66..cd3fb4c8b5e 100644 --- a/src/H5checksum.c +++ b/src/H5checksum.c @@ -303,7 +303,7 @@ rotates. c -= b; \ c ^= H5_lookup3_rot(b, 4); \ b += a; \ - } while(0) + } while (0) /* ------------------------------------------------------------------------------- @@ -346,7 +346,7 @@ and these came close: b -= H5_lookup3_rot(a, 14); \ c ^= b; \ c -= H5_lookup3_rot(b, 24); \ - } while(0) + } while (0) /* ------------------------------------------------------------------------------- diff --git a/src/H5private.h b/src/H5private.h index 748bb33ba61..c1c6fd7cf79 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1623,10 +1623,15 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); * that will always generate the expected name. */ #define H5_CHECKED_ASSIGN(dst, dsttype, src, srctype) \ - do { ASSIGN_##srctype##_TO_##dsttype(dst, dsttype, src, srctype) } while (0) + do { \ + ASSIGN_##srctype##_TO_##dsttype(dst, dsttype, src, srctype) \ + } while (0) #else /* NDEBUG */ -#define H5_CHECKED_ASSIGN(dst, dsttype, src, srctype) do { (dst) = (dsttype)(src); } while (0) +#define H5_CHECKED_ASSIGN(dst, dsttype, src, srctype) \ + do { \ + (dst) = (dsttype)(src); \ + } while (0) #endif /* NDEBUG */ #if defined(H5_HAVE_WINDOW_PATH) diff --git a/test/dt_arith.c b/test/dt_arith.c index 1bd41f4a929..fcf09bfad22 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -160,7 +160,7 @@ static int without_hardware_g = 0; if (n < SRC_PREC - 1) \ value2 = (TYPE)(value2 << 1); \ } \ - } while(0) + } while (0) /* Change a buffer's byte order from big endian to little endian. It's mainly for library's * bit operations which handle only little endian order. @@ -190,7 +190,7 @@ static int without_hardware_g = 0; EBUF[(ESIZE - 1) - m] = mediator2; \ } \ } \ - } while(0) + } while (0) /* Allocate buffer and initialize it with floating-point normalized values. * It's for conversion test of floating-point as the source. @@ -270,7 +270,7 @@ static int without_hardware_g = 0; HDmemcpy(saved_p, &value2, SRC_SIZE); \ buf_p += SRC_SIZE; \ saved_p += SRC_SIZE; \ - } while(0) + } while (0) /* Allocate buffer and initialize it with floating-point denormalized values. * It's for conversion test of floating-point as the source. @@ -322,7 +322,7 @@ static int without_hardware_g = 0; } \ HDfree(tmp1); \ HDfree(tmp2); \ - } while(0) + } while (0) /* Allocate buffer and initialize it with floating-point special values, +/-0, +/-infinity, * +/-QNaN, +/-SNaN. It's for conversion test of floating-point as the source. @@ -386,7 +386,7 @@ static int without_hardware_g = 0; \ HDmemcpy(SAVED, BUF, NELMTS *MAX(SRC_SIZE, DST_SIZE)); \ HDfree(value); \ - } while(0) + } while (0) static hbool_t overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits); static int my_isnan(dtype_t type, void *val); diff --git a/test/gheap.c b/test/gheap.c index 36d8c5aa3d4..095cf8efb8f 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -44,8 +44,8 @@ HDputs(MSG); \ if (nerrors == GHEAP_REPEATED_ERR_LIM) \ HDputs(" Suppressing further errors..."); \ - } /* end if */ \ - } while(0) /* end GHEAP_REPEATED_ERR */ + } /* end if */ \ + } while (0) /* end GHEAP_REPEATED_ERR */ const char *FILENAME[] = {"gheap1", "gheap2", "gheap3", "gheap4", "gheapooo", NULL}; diff --git a/test/hdfs.c b/test/hdfs.c index eb0a7759859..92fc1be7373 100644 --- a/test/hdfs.c +++ b/test/hdfs.c @@ -1116,19 +1116,17 @@ test_H5FDread_without_eoa_set_fails(void) * TEST * ********/ - H5E_BEGIN_TRY{/* mute stack trace on expected failure */ - JSVERIFY(FAIL, H5FDread(file_shakespeare, H5FD_MEM_DRAW, H5P_DEFAULT, 1200699, 102, buffer), - "cannot read before eoa is set")} H5E_END_TRY - for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++) { - JSVERIFY(0, (unsigned)buffer[i], "buffer was modified by write!") - } + H5E_BEGIN_TRY{ + /* mute stack trace on expected failure */ + JSVERIFY(FAIL, H5FDread(file_shakespeare, H5FD_MEM_DRAW, H5P_DEFAULT, 1200699, 102, buffer), + "cannot read before eoa is set")} H5E_END_TRY for (i = 0; i < HDFS_TEST_MAX_BUF_SIZE; i++){ + JSVERIFY(0, (unsigned)buffer[i], "buffer was modified by write!")} /************ * TEARDOWN * ************/ - FAIL_IF(FAIL == H5FDclose(file_shakespeare)) - file_shakespeare = NULL; + FAIL_IF(FAIL == H5FDclose(file_shakespeare)) file_shakespeare = NULL; FAIL_IF(FAIL == H5Pclose(fapl_id)) fapl_id = -1; @@ -1443,17 +1441,17 @@ test_noops_and_autofails(void) H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data), "write must fail")} H5E_END_TRY - H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, FALSE), "truncate must fail")} H5E_END_TRY + H5E_BEGIN_TRY{ + JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, FALSE), "truncate must fail")} H5E_END_TRY - H5E_BEGIN_TRY{ - JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, TRUE), "truncate must fail (closing)")} H5E_END_TRY + H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, TRUE), + "truncate must fail (closing)")} H5E_END_TRY - /************ - * TEARDOWN * - ************/ + /************ + * TEARDOWN * + ************/ - FAIL_IF(FAIL == H5FDclose(file)) - file = NULL; + FAIL_IF(FAIL == H5FDclose(file)) file = NULL; FAIL_IF(FAIL == H5Pclose(fapl_id)) fapl_id = -1; @@ -1580,14 +1578,14 @@ test_H5F_integration(void) */ H5E_BEGIN_TRY{FAIL_IF(0 <= H5Fopen(filename_example_h5, H5F_ACC_RDWR, fapl_id))} H5E_END_TRY - /* H5Fcreate() is not allowed with this file driver. - */ - H5E_BEGIN_TRY{ - FAIL_IF(0 <= H5Fcreate(filename_missing, H5F_ACC_RDONLY, H5P_DEFAULT, fapl_id))} H5E_END_TRY + /* H5Fcreate() is not allowed with this file driver. + */ + H5E_BEGIN_TRY{ + FAIL_IF(0 <= H5Fcreate(filename_missing, H5F_ACC_RDONLY, H5P_DEFAULT, fapl_id))} H5E_END_TRY - /* Successful open. - */ - file = H5Fopen(filename_example_h5, H5F_ACC_RDONLY, fapl_id); + /* Successful open. + */ + file = H5Fopen(filename_example_h5, H5F_ACC_RDONLY, fapl_id); FAIL_IF(file < 0) /************ diff --git a/test/ros3.c b/test/ros3.c index 7eb42308ca4..85fc46bae3a 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -1129,17 +1129,17 @@ test_H5FDread_without_eoa_set_fails(void) * TEST * ********/ - H5E_BEGIN_TRY{/* mute stack trace on expected failure */ - JSVERIFY(FAIL, H5FDread(file_shakespeare, H5FD_MEM_DRAW, H5P_DEFAULT, 1200699, 102, buffer), - "cannot read before eoa is set")} H5E_END_TRY - JSVERIFY_STR("", buffer, "buffer should remain untouched") + H5E_BEGIN_TRY{ + /* mute stack trace on expected failure */ + JSVERIFY(FAIL, H5FDread(file_shakespeare, H5FD_MEM_DRAW, H5P_DEFAULT, 1200699, 102, buffer), + "cannot read before eoa is set")} H5E_END_TRY JSVERIFY_STR("", buffer, + "buffer should remain untouched") - /************ - * TEARDOWN * - ************/ + /************ + * TEARDOWN * + ************/ - FAIL_IF(FAIL == H5FDclose(file_shakespeare)) - file_shakespeare = NULL; + FAIL_IF(FAIL == H5FDclose(file_shakespeare)) file_shakespeare = NULL; FAIL_IF(FAIL == H5Pclose(fapl_id)) fapl_id = -1; @@ -1445,17 +1445,17 @@ test_noops_and_autofails(void) H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDwrite(file, H5FD_MEM_DRAW, H5P_DEFAULT, 1000, 35, data), "write must fail")} H5E_END_TRY - H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, FALSE), "truncate must fail")} H5E_END_TRY + H5E_BEGIN_TRY{ + JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, FALSE), "truncate must fail")} H5E_END_TRY - H5E_BEGIN_TRY{ - JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, TRUE), "truncate must fail (closing)")} H5E_END_TRY + H5E_BEGIN_TRY{JSVERIFY(FAIL, H5FDtruncate(file, H5P_DEFAULT, TRUE), + "truncate must fail (closing)")} H5E_END_TRY - /************ - * TEARDOWN * - ************/ + /************ + * TEARDOWN * + ************/ - FAIL_IF(FAIL == H5FDclose(file)) - file = NULL; + FAIL_IF(FAIL == H5FDclose(file)) file = NULL; FAIL_IF(FAIL == H5Pclose(fapl_id)) fapl_id = -1; @@ -1685,13 +1685,13 @@ test_H5F_integration(void) */ H5E_BEGIN_TRY{FAIL_IF(0 <= H5Fopen(url_h5_public, H5F_ACC_RDWR, fapl_id))} H5E_END_TRY - /* H5Fcreate() is not allowed with this file driver. - */ - H5E_BEGIN_TRY{FAIL_IF(0 <= H5Fcreate(url_missing, H5F_ACC_RDONLY, H5P_DEFAULT, fapl_id))} H5E_END_TRY + /* H5Fcreate() is not allowed with this file driver. + */ + H5E_BEGIN_TRY{FAIL_IF(0 <= H5Fcreate(url_missing, H5F_ACC_RDONLY, H5P_DEFAULT, fapl_id))} H5E_END_TRY - /* Successful open. - */ - file = H5Fopen(url_h5_public, H5F_ACC_RDONLY, fapl_id); + /* Successful open. + */ + file = H5Fopen(url_h5_public, H5F_ACC_RDONLY, fapl_id); FAIL_IF(file < 0) /************ diff --git a/test/testhdf5.h b/test/testhdf5.h index 4416a7bee2a..1ebd619e0e8 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -48,7 +48,7 @@ (int)__LINE__, __FILE__); \ H5Eprint2(H5E_DEFAULT, stdout); \ } \ - } while(0) + } while (0) /* Check that a pointer is valid (i.e.: not NULL) */ #define CHECK_PTR(ret, where) \ @@ -62,7 +62,7 @@ __FILE__); \ H5Eprint2(H5E_DEFAULT, stdout); \ } \ - } while(0) + } while (0) /* Check that a pointer is NULL */ #define CHECK_PTR_NULL(ret, where) \ @@ -76,7 +76,7 @@ (int)__LINE__, __FILE__); \ H5Eprint2(H5E_DEFAULT, stdout); \ } \ - } while(0) + } while (0) /* Check that two pointers are equal */ #define CHECK_PTR_EQ(ret, val, where) \ @@ -91,7 +91,7 @@ (where), (const void *)(ret), (const void *)(val), (int)__LINE__, __FILE__); \ H5Eprint2(H5E_DEFAULT, stdout); \ } \ - } while(0) + } while (0) /* Used to make certain a return value _is_ a value */ #define VERIFY(_x, _val, where) \ @@ -170,13 +170,13 @@ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); \ if (mpi_rank == 0 && HDGetTestVerbosity() > (V)) \ print_func A; \ - } while(0) + } while (0) #else /* H5_HAVE_PARALLEL */ #define MESSAGE(V, A) \ do { \ if (HDGetTestVerbosity() > (V)) \ print_func A; \ - } while(0) + } while (0) #endif /* H5_HAVE_PARALLEL */ /* Used to indicate an error that is complex to check for */ diff --git a/test/vfd.c b/test/vfd.c index 9b9ada44814..dbf6ba45120 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -85,7 +85,7 @@ static int __k; } \ HDprintf((__k % 4 == 0) ? " %02X" : " %02X", (unsigned char)(buf)[__k]); \ } \ - } while(0) /* end #define HEXPRINT() */ + } while (0) /* end #define HEXPRINT() */ /* Macro SET_SIZE() * @@ -2391,7 +2391,7 @@ test_ros3(void) HDfflush(stderr); \ ret_value = -1; \ goto done; \ - } while(0) + } while (0) /*------------------------------------------------------------------------- * Function: compare_splitter_config_info diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 19cda987890..825ca06f738 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -106,7 +106,7 @@ static hbool_t not_comparable; per = ABS((double)((TYPE)((B) - (A))) / (double)(A)); \ else \ not_comparable = TRUE; \ - } while(0) + } while (0) #define PDIFF(a, b) (((b) > (a)) ? ((b) - (a)) : ((a) - (b))) diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index c6d87d91bfb..bd9aada3a8a 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -3510,7 +3510,7 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t * (hsize_t)0, (hsize_t)0); break; case H5Z_FILTER_SZIP: - szip_options_mask = cd_values[0]; + szip_options_mask = cd_values[0]; szip_pixels_per_block = cd_values[1]; h5tools_str_append(&buffer, "%s %s", SZIP, BEGIN); diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c index 71dcb17c7fa..97ae9604dd9 100644 --- a/tools/lib/h5trav.c +++ b/tools/lib/h5trav.c @@ -321,7 +321,7 @@ trav_info_add(trav_info_t *info, const char *path, h5trav_type_t obj_type) /* Allocate space if necessary */ if (info->nused == info->nalloc) { info->nalloc = MAX(1, info->nalloc * 2); - info->paths = (trav_path_t *)HDrealloc(info->paths, info->nalloc * sizeof(trav_path_t)); + info->paths = (trav_path_t *)HDrealloc(info->paths, info->nalloc * sizeof(trav_path_t)); } /* end if */ /* Append it */