diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-07-01 20:02:47 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-07-01 20:02:47 (GMT) |
commit | e5e786f589896da6f6414da51b56ccc119df8adb (patch) | |
tree | 69c21934ad23b0b71326a8fb8b40c384aca92f24 /src | |
parent | eab58732d86e9219fa9f41f9ab2e30fae94e4a7d (diff) | |
download | hdf5-e5e786f589896da6f6414da51b56ccc119df8adb.zip hdf5-e5e786f589896da6f6414da51b56ccc119df8adb.tar.gz hdf5-e5e786f589896da6f6414da51b56ccc119df8adb.tar.bz2 |
[svn-r8782] Purpose:
Code cleanup
Description:
Clean up almost all warnings from Windows builds.
Platforms tested:
FreeBSD 4.10 (sleipnir) w/parallel
Too minor to require h5committest
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Dio.c | 16 | ||||
-rw-r--r-- | src/H5Pdcpl.c | 2 | ||||
-rw-r--r-- | src/H5Shyper.c | 8 | ||||
-rw-r--r-- | src/H5Spoint.c | 2 | ||||
-rw-r--r-- | src/H5Sprivate.h | 2 | ||||
-rw-r--r-- | src/H5Sselect.c | 2 | ||||
-rw-r--r-- | src/H5TB.c | 11 | ||||
-rw-r--r-- | src/H5Tconv.c | 2 | ||||
-rw-r--r-- | src/H5Ztrans.c | 545 |
9 files changed, 255 insertions, 335 deletions
diff --git a/src/H5Dio.c b/src/H5Dio.c index 9585cd8..8996431 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -1152,7 +1152,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, target_size = max_type_size; /* If the buffer is too large to hold all the elements, make it smaller */ else if(target_size>(nelmts*max_type_size)) - target_size=(nelmts*max_type_size); + target_size=(size_t)(nelmts*max_type_size); } /* end if */ request_nelmts = target_size / max_type_size; @@ -1203,7 +1203,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, for (smine_start=0; smine_start<nelmts; smine_start+=smine_nelmts) { /* Go figure out how many elements to read from the file */ assert(H5S_SELECT_ITER_NELMTS(&file_iter)==(nelmts-smine_start)); - smine_nelmts = MIN(request_nelmts, (nelmts-smine_start)); + smine_nelmts = (size_t)MIN(request_nelmts, (nelmts-smine_start)); /* * Gather the data from disk into the data type conversion @@ -1397,7 +1397,7 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, target_size = max_type_size; /* If the buffer is too large to hold all the elements, make it smaller */ else if(target_size>(nelmts*max_type_size)) - target_size=(nelmts*max_type_size); + target_size=(size_t)(nelmts*max_type_size); } /* end if */ request_nelmts = target_size / max_type_size; @@ -1452,7 +1452,7 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, for (smine_start=0; smine_start<nelmts; smine_start+=smine_nelmts) { /* Go figure out how many elements to read from the file */ assert(H5S_SELECT_ITER_NELMTS(&file_iter)==(nelmts-smine_start)); - smine_nelmts = MIN(request_nelmts, (nelmts-smine_start)); + smine_nelmts = (size_t)MIN(request_nelmts, (nelmts-smine_start)); /* * Gather data from application buffer into the data type conversion @@ -1673,7 +1673,7 @@ H5D_chunk_read(hsize_t nelmts, H5D_t *dataset, target_size = max_type_size; /* If the buffer is too large to hold all the elements, make it smaller */ else if(target_size>(nelmts*max_type_size)) - target_size=(nelmts*max_type_size); + target_size=(size_t)(nelmts*max_type_size); } /* end if */ request_nelmts = target_size / max_type_size; @@ -1739,7 +1739,7 @@ H5D_chunk_read(hsize_t nelmts, H5D_t *dataset, for (smine_start=0; smine_start<chunk_info->chunk_points; smine_start+=smine_nelmts) { /* Go figure out how many elements to read from the file */ assert(H5S_SELECT_ITER_NELMTS(&file_iter)==(chunk_info->chunk_points-smine_start)); - smine_nelmts = MIN(request_nelmts, (chunk_info->chunk_points-smine_start)); + smine_nelmts = (size_t)MIN(request_nelmts, (chunk_info->chunk_points-smine_start)); /* * Gather the data from disk into the data type conversion @@ -2026,7 +2026,7 @@ H5D_chunk_write(hsize_t nelmts, H5D_t *dataset, target_size = max_type_size; /* If the buffer is too large to hold all the elements, make it smaller */ else if(target_size>(nelmts*max_type_size)) - target_size=(nelmts*max_type_size); + target_size=(size_t)(nelmts*max_type_size); } /* end if */ request_nelmts = target_size / max_type_size; @@ -2096,7 +2096,7 @@ H5D_chunk_write(hsize_t nelmts, H5D_t *dataset, for (smine_start=0; smine_start<chunk_info->chunk_points; smine_start+=smine_nelmts) { /* Go figure out how many elements to read from the file */ assert(H5S_SELECT_ITER_NELMTS(&file_iter)==(chunk_info->chunk_points-smine_start)); - smine_nelmts = MIN(request_nelmts, (chunk_info->chunk_points-smine_start)); + smine_nelmts = (size_t)MIN(request_nelmts, (chunk_info->chunk_points-smine_start)); /* * Gather the data from disk into the data type conversion diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 48abd21..99f3e30 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -175,7 +175,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be positive"); if (dim[i] != (dim[i]&0xffffffff)) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be less than 2^32"); - real_dims[i]=dim[i]; /* Store user's chunk dimensions */ + real_dims[i]=(size_t)dim[i]; /* Store user's chunk dimensions */ } /* end for */ layout = H5D_CHUNKED; diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 0425d76..2ee7356 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -658,13 +658,13 @@ H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) while(temp_dim>=0) { if(temp_dim==fast_dim) { size_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ - size_t block_elem; /* Number of elements left in a block */ + hsize_t block_elem; /* Number of elements left in a block */ /* Compute the number of elements left in block */ block_elem=tdiminfo[temp_dim].block-iter_offset[temp_dim]; /* Compute the number of actual elements to advance */ - actual_elem=MIN(nelem,block_elem); + actual_elem=(size_t)MIN(nelem,block_elem); /* Move the iterator over as many elements as possible */ iter_offset[temp_dim]+=actual_elem; @@ -729,13 +729,13 @@ H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) /* Increment absolute position */ if(curr_dim==fast_dim) { size_t actual_elem; /* Actual # of elements advanced on each iteration through loop */ - size_t span_elem; /* Number of elements left in a span */ + hsize_t span_elem; /* Number of elements left in a span */ /* Compute the number of elements left in block */ span_elem=(curr_span->high-abs_arr[curr_dim])+1; /* Compute the number of actual elements to advance */ - actual_elem=MIN(nelem,span_elem); + actual_elem=(size_t)MIN(nelem,span_elem); /* Move the iterator over as many elements as possible */ abs_arr[curr_dim]+=actual_elem; diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 11802e5..4970321 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -1312,7 +1312,7 @@ H5S_point_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, /* Choose the minimum number of bytes to sequence through */ H5_CHECK_OVERFLOW(iter->elmt_left,hsize_t,size_t); - start_io_left=io_left=MIN(iter->elmt_left,maxelem); + start_io_left=io_left=(size_t)MIN(iter->elmt_left,maxelem); /* Get the dataspace dimensions */ if ((ndims=H5S_get_simple_extent_dims (space, dims, NULL))<0) diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 89215cd..1c0c4d0 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -267,7 +267,7 @@ H5_DLL herr_t H5S_select_release(H5S_t *ds); H5_DLL herr_t H5S_select_get_seq_list(const H5S_t *space, unsigned flags, H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes, size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len); -H5_DLL herr_t H5S_select_serial_size(const H5S_t *space); +H5_DLL hssize_t H5S_select_serial_size(const H5S_t *space); H5_DLL herr_t H5S_select_serialize(const H5S_t *space, uint8_t *buf); H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space); H5_DLL htri_t H5S_select_is_single(const H5S_t *space); diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 61a1f5d..e9fc5a3 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -225,7 +225,7 @@ H5S_select_get_seq_list(const H5S_t *space, unsigned flags, * *------------------------------------------------------------------------- */ -herr_t +hssize_t H5S_select_serial_size(const H5S_t *space) { hssize_t ret_value; /* Return value */ @@ -215,12 +215,21 @@ H5TB_int_cmp(const void *k1, const void *k2, int UNUSED cmparg) static int H5TB_hsize_cmp(const void *k1, const void *k2, int UNUSED cmparg) { + int ret_value; + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5TB_hsize_cmp); assert(k1); assert(k2); - FUNC_LEAVE_NOAPI(*(const hsize_t *)k1 - *(const hsize_t *)k2); + if(*(const hsize_t *)k1 < *(const hsize_t *)k2) + ret_value=-1; + else if(*(const hsize_t *)k1 > *(const hsize_t *)k2) + ret_value=1; + else + ret_value=0; + + FUNC_LEAVE_NOAPI(ret_value); } /* end H5TB_hsize_cmp() */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 389de12..82c7084 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -9293,7 +9293,7 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * Find the sign bit value of the source. */ if (H5T_SGN_2 == src.u.i.sign) - sign = H5T_bit_get_d(int_buf, src.prec-1, 1); + sign = (size_t)H5T_bit_get_d(int_buf, src.prec-1, 1); /* * What is the bit position(starting from 0 as first one) for the most significant diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 3a0931a..c53a758 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -724,7 +724,8 @@ H5Z_new_node(H5Z_token_type type) *------------------------------------------------------------------------- */ -herr_t H5Z_xform_eval(const H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size, const H5T_t *buf_type) +herr_t +H5Z_xform_eval(const H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size, const H5T_t *buf_type) { H5Z_node *tree; hid_t array_type; @@ -736,7 +737,7 @@ herr_t H5Z_xform_eval(const H5Z_data_xform_t *data_xform_prop, void* array, size FUNC_ENTER_NOAPI(H5Z_xform_eval, FAIL) - assert(data_xform_prop); + assert(data_xform_prop); tree=data_xform_prop->parse_root; @@ -776,7 +777,7 @@ herr_t H5Z_xform_eval(const H5Z_data_xform_t *data_xform_prop, void* array, size } else if(array_type == H5T_NATIVE_FLOAT) { - f = tree->value.float_val; + f = (float)tree->value.float_val; for(i=0; i<array_size; i++) *((float*)array + i) = f; } @@ -820,7 +821,7 @@ H5Z_eval_full(H5Z_node *tree, void* array, size_t array_size, hid_t array_type) error.type = H5Z_XFORM_ERROR; - FUNC_ENTER_NOAPI(H5Z_eval_full, ret_value); + FUNC_ENTER_NOAPI(H5Z_eval_full, error); /* check args */ assert(tree); @@ -828,359 +829,269 @@ H5Z_eval_full(H5Z_node *tree, void* array, size_t array_size, hid_t array_type) if (tree->type == H5Z_XFORM_INTEGER) { res.type = H5Z_XFORM_INTEGER; - res.value = tree->value; - HGOTO_DONE(res) + res.value.int_val = tree->value.int_val; } else if (tree->type == H5Z_XFORM_FLOAT) { res.type = H5Z_XFORM_FLOAT; - res.value = tree->value; - HGOTO_DONE(res) + res.value.float_val = tree->value.float_val; } else if (tree->type == H5Z_XFORM_SYMBOL) { res.type = H5Z_XFORM_SYMBOL; - res.value = tree->value; + res.value.sym_val = tree->value.sym_val; res.ar_type = array_type; - HGOTO_DONE(res) } else { resl = H5Z_eval_full(tree->lchild, array, array_size, array_type); resr = H5Z_eval_full(tree->rchild, array, array_size, array_type); - switch (tree->type) - { - case H5Z_XFORM_PLUS: - if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_INTEGER)) - { - res.type = H5Z_XFORM_SYMBOL; + res.type = H5Z_XFORM_SYMBOL; + + /* Check for un-handled datatype */ + if(array_type!= H5T_NATIVE_INT && array_type!= H5T_NATIVE_FLOAT) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") + + switch (tree->type) { + case H5Z_XFORM_PLUS: + if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_INTEGER)) + { if(array_type == H5T_NATIVE_INT) { - for(i=0; i<array_size; i++) - *((int*)array + i) = resr.value.int_val + *((int*)array + i); + for(i=0; i<array_size; i++) + *((int*)array + i) += resr.value.int_val; } - else if(array_type == H5T_NATIVE_FLOAT) + else { - for(i=0; i<array_size; i++) - *((float*)array + i) = resr.value.int_val + *((float*)array + i); + for(i=0; i<array_size; i++) + *((float*)array + i) += resr.value.int_val; } - else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - HGOTO_DONE(res) - } - else if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_FLOAT)) - { - res.type = H5Z_XFORM_SYMBOL; + } + else if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_FLOAT)) + { if(array_type == H5T_NATIVE_INT) { - for(i=0; i<array_size; i++) - *((int*)array + i) += resr.value.float_val; - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) += resr.value.float_val; + for(i=0; i<array_size; i++) + *((int*)array + i) += resr.value.float_val; } - else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - - HGOTO_DONE(res) - } - else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_INTEGER)) - { - res.type = H5Z_XFORM_SYMBOL; + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) += (float)resr.value.float_val; + } + } + else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_INTEGER)) + { if(array_type == H5T_NATIVE_INT) { - for(i=0; i<array_size; i++) - *((int*)array + i) += resl.value.int_val; - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) += resl.value.int_val ; - } - else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - HGOTO_DONE(res) - - } - else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_FLOAT)) - { - - res.type = H5Z_XFORM_SYMBOL; - if(array_type == H5T_NATIVE_INT) - { - for(i=0; i<array_size; i++) - *((int*)array + i) += resl.value.float_val; - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) += resl.value.float_val ; - }else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - - HGOTO_DONE(res) - } - else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Unexpected type conversion operation") - - HGOTO_DONE(res) - break; - case H5Z_XFORM_MINUS: + for(i=0; i<array_size; i++) + *((int*)array + i) += resl.value.int_val; + } + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) += resl.value.int_val ; + } + } + else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_FLOAT)) + { + if(array_type == H5T_NATIVE_INT) + { + for(i=0; i<array_size; i++) + *((int*)array + i) += resl.value.float_val; + } + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) += (float)resl.value.float_val ; + } + } + else + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Unexpected type conversion operation") + break; - if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_INTEGER)) - { - res.type = H5Z_XFORM_SYMBOL; - if(array_type == H5T_NATIVE_INT) - { - for(i=0; i<array_size; i++) - *((int*)array + i) -= resr.value.int_val; - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) -= resr.value.int_val; - }else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - - HGOTO_DONE(res) - } - else if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_FLOAT)) /*we can't upgrade an array w/o allocating more memory, so we downgrade the float_val to an int.*/ - { - res.type = H5Z_XFORM_SYMBOL; + case H5Z_XFORM_MINUS: + if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_INTEGER)) + { if(array_type == H5T_NATIVE_INT) { - for(i=0; i<array_size; i++) - *((int*)array + i) -= resr.value.float_val; - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) -= resr.value.float_val; - } - else - { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - } - HGOTO_DONE(res) - } - else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_INTEGER)) - { - res.type = H5Z_XFORM_SYMBOL; - if(array_type == H5T_NATIVE_INT) - { - for(i=0; i<array_size; i++) - *((int*)array + i) = resl.value.int_val - *((int*)array + i); - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) = resl.value.int_val - *((float*)array + i); - }else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - - HGOTO_DONE(res) - - } - else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_FLOAT)) - { - - res.type = H5Z_XFORM_SYMBOL; - if(array_type == H5T_NATIVE_INT) - { - for(i=0; i<array_size; i++) - *((int*)array + i) = resl.value.float_val - *((int*)array + i); - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) = resl.value.float_val - *((float*)array + i); - }else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - - HGOTO_DONE(res) - } - else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Unexpected type conversion operation") - - - HGOTO_DONE(res) - break; - - - case H5Z_XFORM_MULT: - - if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_INTEGER)) - { - res.type = H5Z_XFORM_SYMBOL; - if(array_type == H5T_NATIVE_INT) - { - for(i=0; i<array_size; i++) - *((int*)array + i) *= resr.value.int_val; - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) *= resr.value.int_val; - }else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - - HGOTO_DONE(res) - } - else if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_FLOAT)) - { - res.type = H5Z_XFORM_SYMBOL; - if(array_type == H5T_NATIVE_INT) - { - for(i=0; i<array_size; i++) - *((int*)array + i) *= resr.value.float_val; - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) *= resr.value.float_val; - }else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - - HGOTO_DONE(res) - } - else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_INTEGER)) - { - res.type = H5Z_XFORM_SYMBOL; - if(array_type == H5T_NATIVE_INT) - { - for(i=0; i<array_size; i++) - *((int*)array + i) *= resl.value.int_val; - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) *= resl.value.int_val; - }else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - - HGOTO_DONE(res) - - } - else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_FLOAT)) - { - - res.type = H5Z_XFORM_SYMBOL; - if(array_type == H5T_NATIVE_INT) - { - for(i=0; i<array_size; i++) - *((int*)array + i) *= resl.value.float_val; - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) *= resl.value.float_val; - }else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - - HGOTO_DONE(res) - } - else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Unexpected type operation") - - HGOTO_DONE(res) - break; + for(i=0; i<array_size; i++) + *((int*)array + i) -= resr.value.int_val; + } + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) -= resr.value.int_val; + } + } + else if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_FLOAT)) /*we can't upgrade an array w/o allocating more memory, so we downgrade the float_val to an int.*/ + { + if(array_type == H5T_NATIVE_INT) + { + for(i=0; i<array_size; i++) + *((int*)array + i) -= resr.value.float_val; + } + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) -= (float)resr.value.float_val; + } + } + else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_INTEGER)) + { + if(array_type == H5T_NATIVE_INT) + { + for(i=0; i<array_size; i++) + *((int*)array + i) = resl.value.int_val - *((int*)array + i); + } + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) = resl.value.int_val - *((float*)array + i); + } + } + else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_FLOAT)) + { + if(array_type == H5T_NATIVE_INT) + { + for(i=0; i<array_size; i++) + *((int*)array + i) = resl.value.float_val - *((int*)array + i); + } + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) = (float)resl.value.float_val - *((float*)array + i); + } + } + else + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Unexpected type conversion operation") + break; - case H5Z_XFORM_DIVIDE: + case H5Z_XFORM_MULT: - if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_INTEGER)) - { - res.type = H5Z_XFORM_SYMBOL; - if(array_type == H5T_NATIVE_INT) - { - for(i=0; i<array_size; i++) - *((int*)array + i) /= resr.value.int_val; - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) /= resr.value.int_val; - }else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - - HGOTO_DONE(res) - } - else if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_FLOAT)) - { - res.type = H5Z_XFORM_SYMBOL; - if(array_type == H5T_NATIVE_INT) - { - for(i=0; i<array_size; i++) - *((int*)array + i) /= resr.value.float_val; - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) /= resr.value.float_val; - }else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - - HGOTO_DONE(res) - } - else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_INTEGER)) - { - res.type = H5Z_XFORM_SYMBOL; + if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_INTEGER)) { if(array_type == H5T_NATIVE_INT) - { - for(i=0; i<array_size; i++) - *((int*)array + i) = resl.value.int_val / *((int*)array + i); - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) = resl.value.int_val / *((float*)array + i); - }else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - - } - HGOTO_DONE(res) - - } - else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_FLOAT)) - { - - res.type = H5Z_XFORM_SYMBOL; - { - if(array_type == H5T_NATIVE_INT) - { - for(i=0; i<array_size; i++) - *((int*)array + i) = resl.value.float_val / *((int*)array + i); - } - else if(array_type == H5T_NATIVE_FLOAT) - { - for(i=0; i<array_size; i++) - *((float*)array + i) = resl.value.float_val / *((float*)array + i); - }else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Cannot perform a data transform on this type") - + { + for(i=0; i<array_size; i++) + *((int*)array + i) *= resr.value.int_val; + } + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) *= resr.value.int_val; + } } - HGOTO_DONE(res) - } - else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Unexpected type operation") - - HGOTO_DONE(res) - break; - + else if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_FLOAT)) + { + if(array_type == H5T_NATIVE_INT) + { + for(i=0; i<array_size; i++) + *((int*)array + i) *= resr.value.float_val; + } + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) *= (float)resr.value.float_val; + } + } + else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_INTEGER)) + { + if(array_type == H5T_NATIVE_INT) + { + for(i=0; i<array_size; i++) + *((int*)array + i) *= resl.value.int_val; + } + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) *= resl.value.int_val; + } + } + else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_FLOAT)) + { + if(array_type == H5T_NATIVE_INT) + { + for(i=0; i<array_size; i++) + *((int*)array + i) *= resl.value.float_val; + } + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) *= (float)resl.value.float_val; + } + } + else + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Unexpected type operation") + break; + case H5Z_XFORM_DIVIDE: + if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_INTEGER)) + { + if(array_type == H5T_NATIVE_INT) + { + for(i=0; i<array_size; i++) + *((int*)array + i) /= resr.value.int_val; + } + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) /= resr.value.int_val; + } + } + else if( (resl.type == H5Z_XFORM_SYMBOL) && (resr.type==H5Z_XFORM_FLOAT)) + { + if(array_type == H5T_NATIVE_INT) + { + for(i=0; i<array_size; i++) + *((int*)array + i) /= resr.value.float_val; + } + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) /= (float)resr.value.float_val; + } + } + else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_INTEGER)) + { + if(array_type == H5T_NATIVE_INT) + { + for(i=0; i<array_size; i++) + *((int*)array + i) = resl.value.int_val / *((int*)array + i); + } + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) = resl.value.int_val / *((float*)array + i); + } + } + else if( (resr.type == H5Z_XFORM_SYMBOL) && (resl.type==H5Z_XFORM_FLOAT)) + { + if(array_type == H5T_NATIVE_INT) + { + for(i=0; i<array_size; i++) + *((int*)array + i) = resl.value.float_val / *((int*)array + i); + } + else + { + for(i=0; i<array_size; i++) + *((float*)array + i) = (float)resl.value.float_val / *((float*)array + i); + } + } + else + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Unexpected type operation") + break; - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Invalid expression tree") + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, error, "Invalid expression tree") } } + ret_value=res; + done: - FUNC_LEAVE_NOAPI(ret_value) - } |