diff options
-rw-r--r-- | src/displaywindow.c | 12 | ||||
-rw-r--r-- | src/hdf5-file.c | 14 |
2 files changed, 15 insertions, 11 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c index 0fc71254..1697003f 100644 --- a/src/displaywindow.c +++ b/src/displaywindow.c @@ -776,13 +776,12 @@ static gint displaywindow_newhdf(GtkMenuItem *item, struct newhdf *nh) static GtkWidget *displaywindow_addhdfgroup(struct hdfile *hdfile, const char *group, - DisplayWindow *dw) + DisplayWindow *dw, GSList *rg) { char **names; int *is_group; int *is_image; GtkWidget *ms; - GSList *rg = NULL; int n, i; if ( hdfile == NULL ) return NULL; @@ -803,7 +802,8 @@ static GtkWidget *displaywindow_addhdfgroup(struct hdfile *hdfile, item = gtk_menu_item_new_with_label(names[i]); - sub = displaywindow_addhdfgroup(hdfile, names[i], dw); + sub = displaywindow_addhdfgroup(hdfile, names[i], + dw, rg); gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), sub); } else if ( is_image[i] ) { @@ -811,8 +811,10 @@ static GtkWidget *displaywindow_addhdfgroup(struct hdfile *hdfile, struct newhdf *nh; item = gtk_radio_menu_item_new_with_label(rg, names[i]); - rg = gtk_radio_menu_item_get_group( + if ( rg == NULL ) { + rg = gtk_radio_menu_item_get_group( GTK_RADIO_MENU_ITEM(item)); + } nh = malloc(sizeof(struct newhdf)); if ( nh != NULL ) { @@ -865,7 +867,7 @@ static void displaywindow_update_menus(DisplayWindow *dw) GtkWidget *ms; GtkWidget *w; - ms = displaywindow_addhdfgroup(dw->hdfile, "/", dw); + ms = displaywindow_addhdfgroup(dw->hdfile, "/", dw, NULL); if ( ms == NULL ) { diff --git a/src/hdf5-file.c b/src/hdf5-file.c index cb24fa48..85c68b85 100644 --- a/src/hdf5-file.c +++ b/src/hdf5-file.c @@ -273,18 +273,20 @@ char *hdfile_get_string_value(struct hdfile *f, const char *name) herr_t r; char *tmp; - hid_t th; - - size = H5Dget_storage_size(dh); + hid_t sh; + size = H5Tget_size(type); tmp = malloc(size+1); - th = H5Tcopy(H5T_C_S1); - H5Tset_size(th, size+1); + sh = H5Screate(H5S_SCALAR); - r = H5Dread(dh, th, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp); + r = H5Dread(dh, type, sh, sh, H5P_DEFAULT, tmp); if ( r < 0 ) goto fail; + /* Two possibilities: + * String is already zero-terminated + * String is not terminated. + * Make sure things are done properly... */ tmp[size] = '\0'; chomp(tmp); |