summaryrefslogtreecommitdiffstats
path: root/hl/fortran/src/H5IMfc.c
diff options
context:
space:
mode:
Diffstat (limited to 'hl/fortran/src/H5IMfc.c')
-rwxr-xr-xhl/fortran/src/H5IMfc.c39
1 files changed, 10 insertions, 29 deletions
diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c
index bbf98cf..7a54437 100755
--- a/hl/fortran/src/H5IMfc.c
+++ b/hl/fortran/src/H5IMfc.c
@@ -17,7 +17,7 @@
#include "H5IMcc.h"
#include "H5LTf90proto.h"
-
+#include "H5Eprivate.h"
/*-------------------------------------------------------------------------
* Function: h5immake_image_8bit_c
@@ -377,49 +377,30 @@ nh5immake_palette_c (hid_t_f *loc_id,
hsize_t_f *dims,
void *buf)
{
- int ret_value = -1;
- herr_t ret;
- hid_t c_loc_id;
char *c_name = NULL;
- int c_namelen;
- hsize_t *c_dims;
+ hsize_t c_dims[H5S_MAX_RANK];
int i;
int rank=2;
+ int_f ret_value = 0;
/*
* convert FORTRAN name to C name
*/
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if (c_name == NULL)
- goto done;
-
- c_dims = malloc(sizeof(hsize_t) * (rank ));
- if (c_dims == NULL)
- goto done;
+ if(NULL == (c_name = (char *)HD5f2cstring(name, (int)*namelen)))
+ HGOTO_DONE(FAIL)
- for (i = 0; i < rank ; i++)
- {
+ for(i = 0; i < rank ; i++)
c_dims[i] = dims[i];
- }
/*
* call H5IMmake_palette function.
*/
- c_loc_id = (hid_t)*loc_id;
-
- ret = H5IMmake_palettef(c_loc_id,c_name,c_dims,buf);
-
- if (ret < 0)
- goto done;
-
- ret_value = 0;
+ if(H5IMmake_palettef((hid_t)*loc_id, c_name, c_dims, buf) < 0)
+ HGOTO_DONE(FAIL)
done:
- if(c_name!=NULL)
- free(c_name);
- if(c_dims!=NULL)
- free(c_dims);
+ if(c_name)
+ HDfree(c_name);
return ret_value;
}