diff options
Diffstat (limited to 'src/H5Zscaleoffset.c')
-rw-r--r-- | src/H5Zscaleoffset.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 4865cc6..61b3fe4 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -130,7 +130,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ { \ unsigned _i = H5Z_SCALEOFFSET_PARM_FILVAL; /* index into cd_values */ \ uint32_t _cd_value; /* Current cd_value */ \ - char * _fv_p; /* Pointer to current byte in fill_val */ \ + char *_fv_p; /* Pointer to current byte in fill_val */ \ size_t _copy_size = 4; /* # of bytes to copy this iteration */ \ size_t _size_rem = sizeof(type); /* # of bytes left to copy to cd_values */ \ \ @@ -259,7 +259,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ { \ unsigned _i = H5Z_SCALEOFFSET_PARM_FILVAL; /* index into cd_values */ \ uint32_t _cd_value; /* Current cd_value */ \ - char * _fv_p; /* Pointer to current byte in fill_val */ \ + char *_fv_p; /* Pointer to current byte in fill_val */ \ size_t _copy_size = 4; /* # of bytes to copy this iteration */ \ size_t _size_rem = sizeof(type); /* # of bytes left to copy to filval */ \ \ @@ -452,7 +452,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Precompress for unsigned integer type */ #define H5Z_scaleoffset_precompress_1(type, data, d_nelmts, filavail, cd_values, minbits, minval) \ do { \ - type * buf = (type *)data, min = 0, max = 0, span, filval = 0; \ + type *buf = (type *)data, min = 0, max = 0, span, filval = 0; \ unsigned i; \ \ if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ @@ -489,7 +489,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Precompress for signed integer type */ #define H5Z_scaleoffset_precompress_2(type, data, d_nelmts, filavail, cd_values, minbits, minval) \ do { \ - type * buf = (type *)data, min = 0, max = 0, filval = 0; \ + type *buf = (type *)data, min = 0, max = 0, filval = 0; \ unsigned type span; \ unsigned i; \ \ @@ -505,8 +505,9 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ 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)); \ + 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 == \ @@ -597,7 +598,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ #define H5Z_scaleoffset_precompress_3(type, pow_fun, abs_fun, round_fun, lround_fun, llround_fun, data, \ d_nelmts, filavail, cd_values, minbits, minval, D_val) \ do { \ - type * buf = (type *)data, min = 0, max = 0, filval = 0; \ + type *buf = (type *)data, min = 0, max = 0, filval = 0; \ unsigned long long span; \ unsigned i; \ \ @@ -631,7 +632,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Postdecompress for unsigned integer type */ #define H5Z_scaleoffset_postdecompress_1(type, data, d_nelmts, filavail, cd_values, minbits, minval) \ do { \ - type * buf = (type *)data, filval = 0; \ + type *buf = (type *)data, filval = 0; \ unsigned i; \ \ if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ @@ -646,7 +647,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Postdecompress for signed integer type */ #define H5Z_scaleoffset_postdecompress_2(type, data, d_nelmts, filavail, cd_values, minbits, minval) \ do { \ - type * buf = (type *)data, filval = 0; \ + type *buf = (type *)data, filval = 0; \ unsigned i; \ \ if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ @@ -694,10 +695,12 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ : (type)(*(long *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \ else if (sizeof(type) == sizeof(long long)) \ for (i = 0; i < d_nelmts; i++) \ - buf[i] = (type)( \ - (*(long long *)((void *)&buf[i]) == (long long)(((unsigned long long)1 << minbits) - 1)) \ - ? filval \ - : (type)(*(long long *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \ + buf[i] = \ + (type)((*(long long *)((void *)&buf[i]) == \ + (long long)(((unsigned long long)1 << minbits) - 1)) \ + ? filval \ + : (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") \ } @@ -722,7 +725,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ #define H5Z_scaleoffset_postdecompress_3(type, pow_fun, data, d_nelmts, filavail, cd_values, minbits, \ minval, D_val) \ do { \ - type * buf = (type *)data, filval = 0, min = 0; \ + type *buf = (type *)data, filval = 0, min = 0; \ unsigned i; \ \ H5Z_scaleoffset_get_min(type, minval, min) \ @@ -929,9 +932,9 @@ done: static herr_t H5Z__set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) { - H5P_genplist_t * dcpl_plist; /* Property list pointer */ - H5T_t * type; /* Datatype */ - const H5S_t * ds; /* Dataspace */ + H5P_genplist_t *dcpl_plist; /* Property list pointer */ + H5T_t *type; /* Datatype */ + const H5S_t *ds; /* Dataspace */ unsigned flags; /* Filter flags */ size_t cd_nelmts = H5Z_SCALEOFFSET_USER_NPARMS; /* Number of filter parameters */ unsigned cd_values[H5Z_SCALEOFFSET_TOTAL_NPARMS]; /* Filter parameters */ @@ -1121,7 +1124,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu unsigned long long minval = 0; /* minimum value of input buffer */ enum H5Z_scaleoffset_t type; /* memory type corresponding to dataset datatype */ int need_convert = FALSE; /* flag indicating conversion of byte order */ - unsigned char * outbuf = NULL; /* pointer to new output buffer */ + unsigned char *outbuf = NULL; /* pointer to new output buffer */ unsigned buf_offset = 21; /* buffer offset because of parameters stored in file */ unsigned i; /* index */ parms_atomic p; /* parameters needed for compress/decompress functions */ @@ -1229,7 +1232,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu */ minval_size = sizeof(unsigned long long) <= ((unsigned char *)*buf)[4] ? sizeof(unsigned long long) : ((unsigned char *)*buf)[4]; - minval = 0; + minval = 0; for (i = 0; i < minval_size; i++) { minval_mask = ((unsigned char *)*buf)[5 + i]; minval_mask <<= i * 8; @@ -1451,7 +1454,7 @@ H5Z__scaleoffset_precompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleoffs H5Z_scaleoffset_precompress_1(unsigned long long, data, d_nelmts, filavail, cd_values, minbits, minval); else if (type == t_schar) { - signed char * buf = (signed char *)data, min = 0, max = 0, filval = 0; + signed char *buf = (signed char *)data, min = 0, max = 0, filval = 0; unsigned char span; unsigned i; |