From b6c10b6bbfcf0634354e89fd88691aa54f7bdf26 Mon Sep 17 00:00:00 2001 From: Elena Pourmal Date: Fri, 16 Sep 2005 21:49:21 -0500 Subject: [svn-r11422] Purpose: Bug fix/ SX6 port Description: Fortran array was passed directly to a C function. Since size of fortran INTEGER is bigger than size of C int on SX-6 with -ew switch, the passed data was wrong. Solution: Copy Fortran array to the appropriate C array. Platforms tested: SX-6 ; trivial change Misc. update: --- fortran/src/H5Ff.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fortran/src/H5Ff.c b/fortran/src/H5Ff.c index 4b21b45..50b9839 100644 --- a/fortran/src/H5Ff.c +++ b/fortran/src/H5Ff.c @@ -396,7 +396,7 @@ nh5fclose_c ( hid_t_f *file_id ) int ret_value = 0; hid_t c_file_id; - c_file_id = *file_id; + c_file_id = (hid_t)*file_id; if ( H5Fclose(c_file_id) < 0 ) ret_value = -1; return ret_value; } @@ -445,12 +445,16 @@ nh5fget_obj_ids_c ( hid_t_f *file_id , int_f *obj_type, int_f *max_objs, hid_t_f int ret_value = 0; hid_t c_file_id; unsigned c_obj_type; - int c_max_objs; + int c_max_objs, i; + hid_t *c_obj_ids; c_file_id = (hid_t)*file_id; c_obj_type = (unsigned) *obj_type; c_max_objs = (int)*max_objs; - if ( H5Fget_obj_ids(c_file_id, c_obj_type, c_max_objs, (hid_t *)obj_ids) < 0 ) ret_value = -1; + c_obj_ids = (hid_t *)HDmalloc(sizeof(hid_t)*c_max_objs); + if ( H5Fget_obj_ids(c_file_id, c_obj_type, c_max_objs, c_obj_ids) < 0 ) ret_value = -1; + for (i=0; i< c_max_objs; i++) obj_ids[i] = (hid_t_f)c_obj_ids[i]; + HDfree(c_obj_ids); return ret_value; } /*---------------------------------------------------------------------------- -- cgit v0.12