From 0324181acc550459d21238759e4bbdf8c1cf37e5 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Wed, 24 Sep 2014 16:56:47 -0500 Subject: [svn-r25614] Fixed HDFFV-8670 *H5DSis_scale and other HL APIs do not null terminate string (and other issues) --- hl/src/H5DS.c | 65 +++++++++++++++++++++++++---- hl/src/H5IM.c | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++-------- hl/src/H5LT.c | 84 +++++++++++++++++++++++++++++++++++++- hl/src/H5PT.c | 15 +++++++ hl/src/H5TB.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 370 insertions(+), 28 deletions(-) diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 15d2f21..66684d6 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -1444,6 +1444,9 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label) if (H5I_DATASET != it) return FAIL; + if (label == NULL) + return FAIL; + /* get dataset space */ if ((sid = H5Dget_space(did)) < 0) return FAIL; @@ -1912,11 +1915,12 @@ out: htri_t H5DSis_scale(hid_t did) { hid_t tid = -1; /* attribute type ID */ - hid_t aid; /* attribute ID */ + hid_t aid = -1; /* attribute ID */ herr_t has_class; /* has the "CLASS" attribute */ htri_t is_ds; /* boolean return value */ H5I_type_t it; /* ID type */ - char buf[20]; + char *buf; /* Name of attribute */ + hsize_t storage_size; /* Size of storage for attribute */ /*------------------------------------------------------------------------- * parameter checking @@ -1944,19 +1948,41 @@ htri_t H5DSis_scale(hid_t did) if((tid = H5Aget_type(aid)) < 0) goto out; + /* check to make sure attribute is a string */ + if(H5T_STRING != H5Tget_class(tid)) + goto out; + + /* check to make sure string is null-terminated */ + if(H5T_STR_NULLTERM != H5Tget_strpad(tid)) + goto out; + + /* allocate buffer large enough to hold string */ + if((storage_size = H5Aget_storage_size(aid)) == 0) + goto out; + + buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); + if(buf == NULL) + goto out; + + /* Read the attribute */ if(H5Aread(aid, tid, buf) < 0) - goto out; + goto out; - if(strcmp(buf, DIMENSION_SCALE_CLASS)==0) + /* compare strings */ + if(HDstrncmp(buf, DIMENSION_SCALE_CLASS, MIN(HDstrlen(DIMENSION_SCALE_CLASS),HDstrlen(buf)))==0) is_ds = 1; else is_ds = 0; + HDfree(buf); + if(H5Tclose(tid) < 0) goto out; if (H5Aclose(aid) < 0) goto out; + + } return is_ds; @@ -2118,7 +2144,8 @@ herr_t H5DS_is_reserved(hid_t did) int has_class; hid_t tid = -1; hid_t aid = -1; - char buf[40]; + char *buf; /* Name of attribute */ + hsize_t storage_size; /* Size of storage for attribute */ herr_t ret; /* try to find the attribute "CLASS" on the dataset */ @@ -2135,16 +2162,36 @@ herr_t H5DS_is_reserved(hid_t did) if((tid = H5Aget_type(aid)) < 0) goto out; + /* check to make sure attribute is a string */ + if(H5T_STRING != H5Tget_class(tid)) + goto out; + + /* check to make sure string is null-terminated */ + if(H5T_STR_NULLTERM != H5Tget_strpad(tid)) + goto out; + + /* allocate buffer large enough to hold string */ + if((storage_size = H5Aget_storage_size(aid)) == 0) + goto out; + + buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); + if(buf == NULL) + goto out; + + /* Read the attribute */ if(H5Aread(aid, tid, buf) < 0) - goto out; + goto out; + - if(strcmp(buf, IMAGE_CLASS) == 0 || - strcmp(buf, PALETTE_CLASS) == 0 || - strcmp(buf, TABLE_CLASS) == 0 ) + if(HDstrncmp(buf, IMAGE_CLASS, MIN(HDstrlen(IMAGE_CLASS),HDstrlen(buf))) == 0 || + HDstrncmp(buf, PALETTE_CLASS, MIN(HDstrlen(PALETTE_CLASS),HDstrlen(buf))) == 0 || + HDstrncmp(buf, TABLE_CLASS, MIN(HDstrlen(TABLE_CLASS),HDstrlen(buf))) == 0 ) ret = 1; else ret = 0; + HDfree(buf); + if (H5Tclose(tid) < 0) goto out; diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index 9239e4e..aeda6ab 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -46,6 +46,10 @@ herr_t H5IMmake_image_8bit( hid_t loc_id, { hsize_t dims[IMAGE8_RANK]; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Initialize the image dimensions */ dims[0] = height; dims[1] = width; @@ -103,9 +107,16 @@ herr_t H5IMmake_image_24bit( hid_t loc_id, { hsize_t dims[IMAGE24_RANK]; + /* check the arguments */ + if (interlace == NULL) + return -1; + if (dset_name == NULL) + return -1; + + /* Initialize the image dimensions */ - if ( strcmp( interlace, "INTERLACE_PIXEL" ) == 0 ) + if ( HDstrncmp( interlace, "INTERLACE_PIXEL",15 ) == 0 ) { /* Number of color planes is defined as the third dimension */ dims[0] = height; @@ -113,7 +124,7 @@ herr_t H5IMmake_image_24bit( hid_t loc_id, dims[2] = IMAGE24_RANK; } else - if ( strcmp( interlace, "INTERLACE_PLANE" ) == 0 ) + if ( HDstrncmp( interlace, "INTERLACE_PLANE",15 ) == 0 ) { /* Number of color planes is defined as the first dimension */ dims[0] = IMAGE24_RANK; @@ -172,6 +183,10 @@ static herr_t find_palette(hid_t loc_id, { int ret = H5_ITER_CONT; + /* check the arguments */ + if (name == NULL) + return -1; + /* Shut compiler up */ loc_id = loc_id; ainfo = ainfo; op_data = op_data; @@ -179,7 +194,7 @@ static herr_t find_palette(hid_t loc_id, * cause the iterator to immediately return that positive value, * indicating short-circuit success */ - if(strcmp(name, "PALETTE") == 0) + if(HDstrncmp(name, "PALETTE",7) == 0) ret = H5_ITER_STOP; return ret; @@ -250,6 +265,12 @@ herr_t H5IMget_image_info( hid_t loc_id, int has_pal; int has_attr; + /* check the arguments */ + if (dset_name == NULL) + return -1; + if (interlace == NULL) + return -1; + /*assume initially we have no palettes attached*/ *npals = 0; @@ -294,7 +315,7 @@ herr_t H5IMget_image_info( hid_t loc_id, /* This is a 24 bit image */ { - if ( strcmp( interlace, "INTERLACE_PIXEL" ) == 0 ) + if ( HDstrncmp( interlace, "INTERLACE_PIXEL", 15 ) == 0 ) { /* Number of color planes is defined as the third dimension */ *height = dims[0]; @@ -302,14 +323,14 @@ herr_t H5IMget_image_info( hid_t loc_id, *planes = dims[2]; } else - if ( strcmp( interlace, "INTERLACE_PLANE" ) == 0 ) + if ( HDstrncmp( interlace, "INTERLACE_PLANE", 15 ) == 0 ) { /* Number of color planes is defined as the first dimension */ *planes = dims[0]; *height = dims[1]; *width = dims[2]; } - else return -1; + else return -1; } else /* This is a 8 bit image */ @@ -410,6 +431,10 @@ herr_t H5IMread_image( hid_t loc_id, { hid_t did; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; @@ -460,6 +485,10 @@ herr_t H5IMmake_palette( hid_t loc_id, int has_pal; + /* check the arguments */ + if (pal_name == NULL) + return -1; + /* Check if the dataset already exists */ has_pal = H5LTfind_dataset( loc_id, pal_name ); @@ -523,6 +552,13 @@ herr_t H5IMlink_palette( hid_t loc_id, hsize_t dim_ref; int ok_pal; + + /* check the arguments */ + if (image_name == NULL) + return -1; + if (pal_name == NULL) + return -1; + /* The image dataset may or may not have the attribute "PALETTE" * First we try to open to see if it is already there; if not, it is created. * If it exists, the array of references is extended to hold the reference @@ -685,6 +721,12 @@ herr_t H5IMunlink_palette( hid_t loc_id, H5T_class_t aclass; int ok_pal, has_pal; + /* check the arguments */ + if(image_name == NULL) + return -1; + if(pal_name == NULL) + return -1; + /* Try to find the palette dataset */ has_pal = H5LTfind_dataset( loc_id, pal_name ); @@ -780,6 +822,10 @@ herr_t H5IMget_npalettes( hid_t loc_id, H5T_class_t aclass; int has_pal; + /* check the arguments */ + if(image_name == NULL) + return -1; + /*assume initially we have no palettes attached*/ *npals = 0; @@ -875,6 +921,10 @@ herr_t H5IMget_palette_info( hid_t loc_id, hid_t pal_space_id; hsize_t pal_maxdims[2]; + /* check the arguments */ + if (image_name == NULL) + return -1; + /* Open the dataset. */ if((did = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0) return -1; @@ -986,6 +1036,13 @@ herr_t H5IMget_palette( hid_t loc_id, hobj_ref_t *refbuf; /* buffer to read references */ hid_t pal_id; + /* check the arguments */ + if (image_name == NULL) + return -1; + if (pal_data == NULL) + return -1; + + /* Open the dataset. */ if((did = H5Dopen2(loc_id, image_name, H5P_DEFAULT)) < 0) return -1; @@ -1078,10 +1135,15 @@ herr_t H5IMis_image( hid_t loc_id, hid_t did; int has_class; hid_t atid; - hid_t aid; - char attr_data[20]; + hid_t aid = -1; + char* attr_data; /* Name of attribute */ + hsize_t storage_size; /* Size of storage for attribute */ herr_t ret; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Assume initially fail condition */ ret = -1; @@ -1106,17 +1168,32 @@ herr_t H5IMis_image( hid_t loc_id, if((atid = H5Aget_type(aid)) < 0) goto out; - if(H5Tget_class(atid) < 0) - goto out; + /* check to make sure attribute is a string */ + if(H5T_STRING != H5Tget_class(atid)) + goto out; + + /* check to make sure string is null-terminated */ + if(H5T_STR_NULLTERM != H5Tget_strpad(atid)) + goto out; + + /* allocate buffer large enough to hold string */ + if((storage_size = H5Aget_storage_size(aid)) == 0) + goto out; + + attr_data = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); + if(attr_data == NULL) + goto out; if(H5Aread(aid, atid, attr_data) < 0) goto out; - if(strcmp(attr_data, IMAGE_CLASS) == 0) + if(HDstrncmp(attr_data, IMAGE_CLASS, MIN(HDstrlen(IMAGE_CLASS),HDstrlen(attr_data))) == 0) ret = 1; else ret = 0; + HDfree(attr_data); + if ( H5Tclose( atid ) < 0) goto out; @@ -1163,10 +1240,15 @@ herr_t H5IMis_palette( hid_t loc_id, hid_t did; int has_class; hid_t atid; - hid_t aid; - char attr_data[20]; + hid_t aid = -1; + char* attr_data; /* Name of attribute */ + hsize_t storage_size; /* Size of storage for attribute */ herr_t ret; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Assume initially fail condition */ ret = -1; @@ -1191,17 +1273,32 @@ herr_t H5IMis_palette( hid_t loc_id, if((atid = H5Aget_type(aid)) < 0) goto out; - if(H5Tget_class(atid) < 0) - goto out; + /* check to make sure attribute is a string */ + if(H5T_STRING != H5Tget_class(atid)) + goto out; + + /* check to make sure string is null-terminated */ + if(H5T_STR_NULLTERM != H5Tget_strpad(atid)) + goto out; + + /* allocate buffer large enough to hold string */ + if((storage_size = H5Aget_storage_size(aid)) == 0) + goto out; + + attr_data = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1); + if(attr_data == NULL) + goto out; if(H5Aread(aid, atid, attr_data) < 0) goto out; - if(strcmp(attr_data, PALETTE_CLASS) == 0) + if(HDstrncmp(attr_data, PALETTE_CLASS, MIN(HDstrlen(PALETTE_CLASS),HDstrlen(attr_data))) == 0) ret = 1; else ret = 0; + HDfree(attr_data); + if ( H5Tclose( atid ) < 0) goto out; diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 6003c60..1eba40c 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -523,6 +523,10 @@ H5LT_make_dataset_numerical( hid_t loc_id, { hid_t did = -1, sid = -1; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Create the data space for the dataset. */ if((sid = H5Screate_simple(rank, dims, NULL)) < 0) return -1; @@ -798,6 +802,10 @@ herr_t H5LTmake_dataset_string(hid_t loc_id, hid_t tid = -1; size_t size; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* create a string data type */ if((tid = H5Tcopy(H5T_C_S1)) < 0 ) goto out; @@ -976,6 +984,10 @@ H5LT_read_dataset_numerical(hid_t loc_id, const char *dset_name, hid_t tid, void { hid_t did; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; @@ -1167,6 +1179,10 @@ herr_t H5LTread_dataset_string( hid_t loc_id, hid_t did = -1; hid_t tid = -1; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; @@ -1216,6 +1232,10 @@ herr_t H5LTget_dataset_ndims( hid_t loc_id, hid_t did = -1; hid_t sid = -1; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* Open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; @@ -1272,6 +1292,10 @@ herr_t H5LTget_dataset_info( hid_t loc_id, hid_t tid = -1; hid_t sid = -1; + /* check the arguments */ + if (dset_name == NULL) + return -1; + /* open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) return -1; @@ -1345,6 +1369,10 @@ find_dataset(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *op_d */ int ret = 0; + /* check the arguments */ + if (name == NULL) + return ret; + /* Shut the compiler up */ loc_id = loc_id; linfo = linfo; @@ -1353,7 +1381,7 @@ find_dataset(hid_t loc_id, const char *name, const H5L_info_t *linfo, void *op_d * cause the iterator to immediately return that positive value, * indicating short-circuit success */ - if(HDstrcmp(name, (char *)op_data) == 0) + if(HDstrncmp(name, (char *)op_data, HDstrlen((char *)op_data)) == 0) ret = 1; return ret; @@ -1428,6 +1456,14 @@ herr_t H5LTset_attribute_string( hid_t loc_id, int has_attr; size_t attr_size; + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + if (attr_data == NULL) + return -1; + /* Open the object */ if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) return -1; @@ -1517,6 +1553,12 @@ herr_t H5LT_set_attribute_numerical( hid_t loc_id, hsize_t dim_size=size; int has_attr; + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + /* Open the object */ if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) return -1; @@ -1928,6 +1970,10 @@ find_attr(hid_t loc_id, const char *name, const H5A_info_t *ainfo, { int ret = H5_ITER_CONT; + /* check the arguments */ + if (name == NULL) + return H5_ITER_CONT; + /* Shut compiler up */ loc_id = loc_id; ainfo = ainfo; @@ -1935,7 +1981,7 @@ find_attr(hid_t loc_id, const char *name, const H5A_info_t *ainfo, * cause the iterator to immediately return that positive value, * indicating short-circuit success */ - if(HDstrcmp(name, (char *)op_data) == 0) + if(HDstrncmp(name, (char *)op_data, HDstrlen((char *)op_data)) == 0) ret = H5_ITER_STOP; return ret; @@ -2020,6 +2066,12 @@ herr_t H5LTget_attribute_ndims( hid_t loc_id, hid_t sid; hid_t obj_id; + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + /* Open the object */ if((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) return -1; @@ -2087,6 +2139,12 @@ herr_t H5LTget_attribute_info( hid_t loc_id, hid_t sid; hid_t obj_id; + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + /* Open the object */ if((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) return -1; @@ -2162,6 +2220,10 @@ hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type) { hid_t type_id; + /* check the arguments */ + if (text == NULL) + return -1; + if(lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG) goto out; @@ -3019,6 +3081,12 @@ herr_t H5LTget_attribute_string( hid_t loc_id, /* identifiers */ hid_t obj_id; + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + /* Open the object */ if ((obj_id = H5Oopen( loc_id, obj_name, H5P_DEFAULT)) < 0) return -1; @@ -3439,6 +3507,12 @@ static herr_t H5LT_get_attribute_mem(hid_t loc_id, hid_t obj_id = -1; hid_t attr_id = -1; + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + /* Open the object */ if((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) goto out; @@ -3618,6 +3692,12 @@ H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid) /* Initialize */ ret_value = FALSE; + /* check the arguments */ + if (path == NULL) { + ret_value = FAIL; + goto done; + } + /* Find the type of loc_id */ if((obj_type = H5Iget_type(loc_id)) == H5I_BADID) { ret_value = FAIL; diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index d3a03cd..7a0bc20 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -84,6 +84,11 @@ hid_t H5PTcreate_fl ( hid_t loc_id, hsize_t maxdims[1]; hid_t ret_value; + /* check the arguments */ + if (dset_name == NULL) { + goto out; + } + /* Register the packet table ID type if this is the first table created */ if(H5PT_ptable_id_type < 0) if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) @@ -178,6 +183,11 @@ hid_t H5PTcreate_vl ( hid_t loc_id, hid_t ret_value=H5I_BADID; hid_t vltype; + /* check the arguments */ + if (dset_name == NULL) { + goto out; + } + /* Create a variable length type that uses single bytes as its base type */ vltype = H5Tvlen_create(H5T_NATIVE_UCHAR); if(vltype < 0) @@ -232,6 +242,11 @@ hid_t H5PTopen( hid_t loc_id, hid_t ret_value; hsize_t dims[1]; + /* check the arguments */ + if (dset_name == NULL) { + goto out; + } + /* Register the packet table ID type if this is the first table created */ if( H5PT_ptable_id_type < 0) if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index a1456ea..7856d5f 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -94,6 +94,17 @@ herr_t H5TBmake_table(const char *table_title, hsize_t i; herr_t ret_val = -1; + /* check the arguments */ + if (table_title == NULL) { + goto out; + } + if (dset_name == NULL) { + goto out; + } + if (field_names == NULL) { + goto out; + } + dims[0] = nrecords; dims_chunk[0] = chunk_size; @@ -290,6 +301,10 @@ herr_t H5TBappend_records(hid_t loc_id, hsize_t nfields; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* get the original number of records and fields */ if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords_orig) < 0) goto out; @@ -360,6 +375,10 @@ herr_t H5TBwrite_records(hid_t loc_id, hsize_t dims[1]; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; @@ -459,6 +478,12 @@ herr_t H5TBwrite_fields_name(hid_t loc_id, size_t size_native; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + if (field_names == NULL) + goto out; + /* create xfer properties to preserve initialized data */ if((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0) goto out; @@ -616,6 +641,10 @@ herr_t H5TBwrite_fields_index(hid_t loc_id, char *member_name = NULL; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* create xfer properties to preserve initialized data */ if((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0) goto out; @@ -773,6 +802,10 @@ herr_t H5TBread_table(hid_t loc_id, hsize_t dims[1]; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; @@ -846,6 +879,10 @@ herr_t H5TBread_records(hid_t loc_id, hsize_t nfields; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* get the number of records and fields */ if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords_orig) < 0) goto out; @@ -922,6 +959,13 @@ herr_t H5TBread_fields_name(hid_t loc_id, hssize_t i, j; herr_t ret_val = -1; + + /* check the arguments */ + if (dset_name == NULL) + goto out; + if (field_names == NULL) + goto out; + /* open the dataset */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; @@ -1074,6 +1118,10 @@ herr_t H5TBread_fields_index(hid_t loc_id, char *member_name = NULL; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; @@ -1231,6 +1279,11 @@ herr_t H5TBdelete_record(hid_t loc_id, unsigned char *tmp_buf = NULL; herr_t ret_val = -1; + + /* check the arguments */ + if (dset_name == NULL) + goto out; + /*------------------------------------------------------------------------- * first we get information about type size and offsets on disk *------------------------------------------------------------------------- @@ -1390,6 +1443,10 @@ herr_t H5TBinsert_record(hid_t loc_id, unsigned char *tmp_buf = NULL; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /*------------------------------------------------------------------------- * read the records after the inserted one(s) *------------------------------------------------------------------------- @@ -1541,6 +1598,12 @@ herr_t H5TBadd_records_from(hid_t loc_id, unsigned char *tmp_buf = NULL; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name1 == NULL) + goto out; + if (dset_name2 == NULL) + goto out; + /*------------------------------------------------------------------------- * first we get information about type size and offsets on disk *------------------------------------------------------------------------- @@ -1688,6 +1751,14 @@ herr_t H5TBcombine_tables(hid_t loc_id1, htri_t has_fill; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name1 == NULL) + goto out; + if (dset_name2 == NULL) + goto out; + if (dset_name3 == NULL) + goto out; + /*------------------------------------------------------------------------- * first we get information about type size and offsets on disk *------------------------------------------------------------------------- @@ -2043,6 +2114,12 @@ herr_t H5TBinsert_field(hid_t loc_id, hbool_t inserted; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + if (field_name == NULL) + goto out; + /* get the number of records and fields */ if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0) goto out; @@ -2451,6 +2528,13 @@ herr_t H5TBdelete_field(hid_t loc_id, htri_t has_fill = FALSE; herr_t ret_val = -1; + + /* check the arguments */ + if (dset_name == NULL) + goto out; + if (field_name == NULL) + goto out; + /* get the number of records and fields */ if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0) goto out; @@ -2859,6 +2943,7 @@ out: herr_t H5TBAget_title(hid_t loc_id, char *table_title) { + /* Get the TITLE attribute */ if(H5LT_get_attribute_disk(loc_id, "TITLE", table_title) < 0) return -1; @@ -2894,6 +2979,10 @@ htri_t H5TBAget_fill(hid_t loc_id, htri_t has_fill = FALSE; htri_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* get the number of records and fields */ if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0) goto out; @@ -2962,6 +3051,10 @@ herr_t H5TBget_table_info(hid_t loc_id, int num_members; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; @@ -3049,6 +3142,10 @@ herr_t H5TBget_field_info(hid_t loc_id, hssize_t i; herr_t ret_val = -1; + /* check the arguments */ + if (dset_name == NULL) + goto out; + /* open the dataset. */ if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; @@ -3153,6 +3250,12 @@ hbool_t H5TB_find_field(const char *field, const char *field_list) const char *start = field_list; const char *end; + /* check the arguments */ + if (field == NULL) + return FALSE; + if (field_list == NULL) + return FALSE; + while((end = HDstrstr(start, ",")) != 0) { ptrdiff_t count = end - start; @@ -3161,7 +3264,7 @@ hbool_t H5TB_find_field(const char *field, const char *field_list) start = end + 1; } /* end while */ - if(HDstrcmp(start, field) == 0) + if(HDstrncmp(start, field, HDstrlen(field)) == 0) return TRUE; return FALSE; -- cgit v0.12 From 510e79af7c180eae97ba5874a2659937e9101b4c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 25 Sep 2014 08:51:40 -0500 Subject: [svn-r25615] Include plugin header change. H5PLextern.h and H5PLprivate.h have two opposing use cases, only the enum is common. Tested: local linux and windows --- src/H5PLextern.h | 40 ++++++---------------------------------- src/H5PLprivate.h | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 36 deletions(-) diff --git a/src/H5PLextern.h b/src/H5PLextern.h index 943e3aa..a204cb7 100644 --- a/src/H5PLextern.h +++ b/src/H5PLextern.h @@ -34,40 +34,12 @@ typedef enum H5PL_type_t { } H5PL_type_t; -#ifdef H5_BUILT_AS_DYNAMIC_LIB - - #if defined (hdf5_EXPORTS) - /* hdf5 library imports from plugin */ - #if defined (_MSC_VER) /* MSVC Compiler Case */ - #define H5PLUGIN_DLL __declspec(dllimport) - #elif (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */ - #define H5PLUGIN_DLL __attribute__ ((visibility("default"))) - #endif - #else - /* plugins always export */ - #if defined (_MSC_VER) /* MSVC Compiler Case */ - #define H5PLUGIN_DLL __declspec(dllexport) - #elif (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */ - #define H5PLUGIN_DLL __attribute__ ((visibility("default"))) - #endif - #endif - -#elif defined(H5_BUILT_AS_STATIC_LIB) - #define H5PLUGIN_DLL -#else - - #if defined(H5_HAVE_WIN32_API) - #if defined(_HDF5DLL_) - #pragma warning(disable: 4273) /* Disable the dll linkage warnings */ - #define H5PLUGIN_DLL __declspec(dllimport) - #elif defined(_HDF5USEDLL_) - #define H5PLUGIN_DLL __declspec(dllexport) - #endif /* _HDF5DLL_ */ - #else /*H5_HAVE_WIN32_API*/ - #define H5PLUGIN_DLL - #endif /*H5_HAVE_WIN32_API*/ - -#endif /* H5_BUILT_AS_xxx_LIB */ +/* plugins always export */ +#if defined (_MSC_VER) /* MSVC Compiler Case */ + #define H5PLUGIN_DLL __declspec(dllexport) +#elif (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */ + #define H5PLUGIN_DLL __attribute__ ((visibility("default"))) +#endif #ifdef __cplusplus extern "C" { diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h index b117613..587a51b 100644 --- a/src/H5PLprivate.h +++ b/src/H5PLprivate.h @@ -19,8 +19,18 @@ #ifndef _H5PLprivate_H #define _H5PLprivate_H -/* Include package's "external" header */ -#include "H5PLextern.h" +/* Keep the following in sync with the package's "external" header */ + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/* Plugin type */ +typedef enum H5PL_type_t { + H5PL_TYPE_ERROR = -1, /*error */ + H5PL_TYPE_FILTER = 0, /*filter */ + H5PL_TYPE_NONE = 1 /*this must be last! */ +} H5PL_type_t; /* Private headers needed by this file */ #include "H5private.h" /* Generic Functions */ -- cgit v0.12 From 51e9f7091c2e8c68c2e1065b0949c4565110bfab Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 25 Sep 2014 09:37:09 -0500 Subject: [svn-r25617] Upgrade packaging process with cmake helper functions. Tested: local linux --- CMakeInstallation.cmake | 36 ++- MANIFEST | 4 +- config/cmake/CMakePackageConfigHelpers.cmake | 321 +++++++++++++++++++++++++++ config/cmake/hdf5-config.cmake.build.in | 73 ------ config/cmake/hdf5-config.cmake.in | 86 +++++++ config/cmake/hdf5-config.cmake.install.in | 81 ------- 6 files changed, 437 insertions(+), 164 deletions(-) create mode 100644 config/cmake/CMakePackageConfigHelpers.cmake delete mode 100644 config/cmake/hdf5-config.cmake.build.in create mode 100644 config/cmake/hdf5-config.cmake.in delete mode 100644 config/cmake/hdf5-config.cmake.install.in diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 4b132ca..a04b06a 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -1,3 +1,4 @@ +include (${HDF_RESOURCES_DIR}/CMakePackageConfigHelpers.cmake) #----------------------------------------------------------------------------- # Add file(s) to CMake Install @@ -33,19 +34,32 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) endif (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- -# Configure the hdf5-config.cmake file for the build directory +# Set includess needed for build #----------------------------------------------------------------------------- set (HDF5_INCLUDES_BUILD_TIME ${HDF5_SRC_DIR} ${HDF5_CPP_SRC_DIR} ${HDF5_HL_SRC_DIR} ${HDF5_TOOLS_SRC_DIR} ${HDF5_BINARY_DIR} ) + +#----------------------------------------------------------------------------- +# Set variables needed for installation +#----------------------------------------------------------------------------- set (HDF5_VERSION_STRING ${HDF5_PACKAGE_VERSION}) set (HDF5_VERSION_MAJOR ${HDF5_PACKAGE_VERSION_MAJOR}) set (HDF5_VERSION_MINOR ${HDF5_PACKAGE_VERSION_MINOR}) -configure_file ( - ${HDF_RESOURCES_DIR}/hdf5-config.cmake.build.in - ${HDF5_BINARY_DIR}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake @ONLY +#----------------------------------------------------------------------------- +# Configure the hdf5-config.cmake file for the build directory +#----------------------------------------------------------------------------- +set(INCLUDE_INSTALL_DIR HDF5_INSTALL_INCLUDE_DIR ) +set(SHARE_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/share" ) +set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" ) +configure_package_config_file ( + ${HDF_RESOURCES_DIR}/hdf5-config.cmake.in + "${HDF5_BINARY_DIR}/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake" + INSTALL_DESTINATION "${CMAKE_CURRENT_BINARY_DIR}" + PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR + INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}" ) #----------------------------------------------------------------------------- @@ -66,11 +80,17 @@ endif (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- # Configure the hdf5-config.cmake file for the install directory #----------------------------------------------------------------------------- +set(INCLUDE_INSTALL_DIR HDF5_INSTALL_INCLUDE_DIR ) +set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/" ) +set(CURRENT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}" ) +configure_package_config_file ( + ${HDF_RESOURCES_DIR}/hdf5-config.cmake.in + "${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake" + INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}" + PATH_VARS HDF5_INSTALL_INCLUDE_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR +) + if (NOT HDF5_EXTERNALLY_CONFIGURED) - configure_file ( - ${HDF_RESOURCES_DIR}/hdf5-config.cmake.install.in - ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake @ONLY - ) install ( FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_PACKAGE}${HDF_PACKAGE_EXT}-config.cmake DESTINATION ${HDF5_INSTALL_CMAKE_DIR}/${HDF5_PACKAGE} diff --git a/MANIFEST b/MANIFEST index 685022f..daeb909 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2435,14 +2435,14 @@ # CMake-specific Files ./config/cmake/cacheinit.cmake +./config/cmake/CMakePackageConfigHelpers.cmake ./config/cmake/ConversionTests.c ./config/cmake/ConfigureChecks.cmake ./config/cmake/CTestCustom.cmake ./config/cmake/FindHDF5.cmake.in ./config/cmake/H5cxx_config.h.in ./config/cmake/H5pubconf.h.in -./config/cmake/hdf5-config.cmake.build.in -./config/cmake/hdf5-config.cmake.install.in +./config/cmake/hdf5-config.cmake.in ./config/cmake/hdf5-config-version.cmake.in ./config/cmake/HDF5Macros.cmake ./config/cmake/libhdf5.settings.cmake.in diff --git a/config/cmake/CMakePackageConfigHelpers.cmake b/config/cmake/CMakePackageConfigHelpers.cmake new file mode 100644 index 0000000..c6dc141 --- /dev/null +++ b/config/cmake/CMakePackageConfigHelpers.cmake @@ -0,0 +1,321 @@ +#.rst: +# CMakePackageConfigHelpers +# ------------------------- +# +# Helpers functions for creating config files that can be included by other +# projects to find and use a package. +# +# Adds the :command:`configure_package_config_file()` and +# :command:`write_basic_package_version_file()` commands. +# +# Generating a Package Configuration File +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# .. command:: configure_package_config_file +# +# Create a config file for a project:: +# +# configure_package_config_file( INSTALL_DESTINATION +# [PATH_VARS ... ] +# [NO_SET_AND_CHECK_MACRO] +# [NO_CHECK_REQUIRED_COMPONENTS_MACRO] +# [INSTALL_PREFIX ]) +# +# +# ``configure_package_config_file()`` should be used instead of the plain +# :command:`configure_file()` command when creating the ``Config.cmake`` +# or ``-config.cmake`` file for installing a project or library. It helps +# making the resulting package relocatable by avoiding hardcoded paths in the +# installed ``Config.cmake`` file. +# +# In a ``FooConfig.cmake`` file there may be code like this to make the install +# destinations know to the using project: +# +# .. code-block:: cmake +# +# set(FOO_INCLUDE_DIR "@CMAKE_INSTALL_FULL_INCLUDEDIR@" ) +# set(FOO_DATA_DIR "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" ) +# set(FOO_ICONS_DIR "@CMAKE_INSTALL_PREFIX@/share/icons" ) +# ...logic to determine installedPrefix from the own location... +# set(FOO_CONFIG_DIR "${installedPrefix}/@CONFIG_INSTALL_DIR@" ) +# +# All 4 options shown above are not sufficient, since the first 3 hardcode the +# absolute directory locations, and the 4th case works only if the logic to +# determine the ``installedPrefix`` is correct, and if ``CONFIG_INSTALL_DIR`` +# contains a relative path, which in general cannot be guaranteed. This has the +# effect that the resulting ``FooConfig.cmake`` file would work poorly under +# Windows and OSX, where users are used to choose the install location of a +# binary package at install time, independent from how +# :variable:`CMAKE_INSTALL_PREFIX` was set at build/cmake time. +# +# Using ``configure_package_config_file`` helps. If used correctly, it makes +# the resulting ``FooConfig.cmake`` file relocatable. Usage: +# +# 1. write a ``FooConfig.cmake.in`` file as you are used to +# 2. insert a line containing only the string ``@PACKAGE_INIT@`` +# 3. instead of ``set(FOO_DIR "@SOME_INSTALL_DIR@")``, use +# ``set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")`` (this must be after the +# ``@PACKAGE_INIT@`` line) +# 4. instead of using the normal :command:`configure_file()`, use +# ``configure_package_config_file()`` +# +# +# +# The ```` and ```` arguments are the input and output file, the +# same way as in :command:`configure_file()`. +# +# The ```` given to ``INSTALL_DESTINATION`` must be the destination where +# the ``FooConfig.cmake`` file will be installed to. This path can either be +# absolute, or relative to the ``INSTALL_PREFIX`` path. +# +# The variables ```` to ```` given as ``PATH_VARS`` are the +# variables which contain install destinations. For each of them the macro will +# create a helper variable ``PACKAGE_``. These helper variables must be +# used in the ``FooConfig.cmake.in`` file for setting the installed location. +# They are calculated by ``configure_package_config_file`` so that they are +# always relative to the installed location of the package. This works both for +# relative and also for absolute locations. For absolute locations it works +# only if the absolute location is a subdirectory of ``INSTALL_PREFIX``. +# +# If the ``INSTALL_PREFIX`` argument is passed, this is used as base path to +# calculate all the relative paths. The ```` argument must be an absolute +# path. If this argument is not passed, the :variable:`CMAKE_INSTALL_PREFIX` +# variable will be used instead. The default value is good when generating a +# FooConfig.cmake file to use your package from the install tree. When +# generating a FooConfig.cmake file to use your package from the build tree this +# option should be used. +# +# By default ``configure_package_config_file`` also generates two helper macros, +# ``set_and_check()`` and ``check_required_components()`` into the +# ``FooConfig.cmake`` file. +# +# ``set_and_check()`` should be used instead of the normal ``set()`` command for +# setting directories and file locations. Additionally to setting the variable +# it also checks that the referenced file or directory actually exists and fails +# with a ``FATAL_ERROR`` otherwise. This makes sure that the created +# ``FooConfig.cmake`` file does not contain wrong references. +# When using the ``NO_SET_AND_CHECK_MACRO``, this macro is not generated +# into the ``FooConfig.cmake`` file. +# +# ``check_required_components()`` should be called at the end of +# the ``FooConfig.cmake`` file if the package supports components. This macro +# checks whether all requested, non-optional components have been found, and if +# this is not the case, sets the ``Foo_FOUND`` variable to ``FALSE``, so that +# the package is considered to be not found. It does that by testing the +# ``Foo__FOUND`` variables for all requested required components. +# When using the ``NO_CHECK_REQUIRED_COMPONENTS_MACRO`` option, this macro is +# not generated into the ``FooConfig.cmake`` file. +# +# For an example see below the documentation for +# :command:`write_basic_package_version_file()`. +# +# Generating a Package Version File +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# .. command:: write_basic_package_version_file +# +# Create a version file for a project:: +# +# write_basic_package_version_file( +# [VERSION ] +# COMPATIBILITY ) +# +# +# Writes a file for use as ``ConfigVersion.cmake`` file to +# ````. See the documentation of :command:`find_package()` for +# details on this. +# +# ```` is the output filename, it should be in the build tree. +# ```` is the version number of the project to be installed. +# +# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable is used. +# If this hasn't been set, it errors out. +# +# The ``COMPATIBILITY`` mode ``AnyNewerVersion`` means that the installed +# package version will be considered compatible if it is newer or exactly the +# same as the requested version. This mode should be used for packages which +# are fully backward compatible, also across major versions. +# If ``SameMajorVersion`` is used instead, then the behaviour differs from +# ``AnyNewerVersion`` in that the major version number must be the same as +# requested, e.g. version 2.0 will not be considered compatible if 1.0 is +# requested. This mode should be used for packages which guarantee backward +# compatibility within the same major version. +# If ``ExactVersion`` is used, then the package is only considered compatible if +# the requested version matches exactly its own version number (not considering +# the tweak version). For example, version 1.2.3 of a package is only +# considered compatible to requested version 1.2.3. This mode is for packages +# without compatibility guarantees. +# If your project has more elaborated version matching rules, you will need to +# write your own custom ``ConfigVersion.cmake`` file instead of using this +# macro. +# +# Internally, this macro executes :command:`configure_file()` to create the +# resulting version file. Depending on the ``COMPATIBLITY``, either the file +# ``BasicConfigVersion-SameMajorVersion.cmake.in`` or +# ``BasicConfigVersion-AnyNewerVersion.cmake.in`` is used. Please note that +# these two files are internal to CMake and you should not call +# :command:`configure_file()` on them yourself, but they can be used as starting +# point to create more sophisticted custom ``ConfigVersion.cmake`` files. +# +# Example Generating Package Files +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# +# Example using both :command:`configure_package_config_file` and +# ``write_basic_package_version_file()``: +# +# ``CMakeLists.txt``: +# +# .. code-block:: cmake +# +# set(INCLUDE_INSTALL_DIR include/ ... CACHE ) +# set(LIB_INSTALL_DIR lib/ ... CACHE ) +# set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE ) +# ... +# include(CMakePackageConfigHelpers) +# configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake +# INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake +# PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR) +# write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake +# VERSION 1.2.3 +# COMPATIBILITY SameMajorVersion ) +# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake +# DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake ) +# +# ``FooConfig.cmake.in``: +# +# .. code-block:: cmake +# +# set(FOO_VERSION x.y.z) +# ... +# @PACKAGE_INIT@ +# ... +# set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") +# set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@") +# +# check_required_components(Foo) + + +#============================================================================= +# Copyright 2012 Alexander Neundorf +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(CMakeParseArguments) + +include(WriteBasicConfigVersionFile) + +macro(WRITE_BASIC_PACKAGE_VERSION_FILE) + write_basic_config_version_file(${ARGN}) +endmacro() + +function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) + set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO) + set(oneValueArgs INSTALL_DESTINATION INSTALL_PREFIX) + set(multiValueArgs PATH_VARS ) + + cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + if(CCF_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "Unknown keywords given to CONFIGURE_PACKAGE_CONFIG_FILE(): \"${CCF_UNPARSED_ARGUMENTS}\"") + endif() + + if(NOT CCF_INSTALL_DESTINATION) + message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()") + endif() + + if(DEFINED CCF_INSTALL_PREFIX) + if(IS_ABSOLUTE "${CCF_INSTALL_PREFIX}") + set(installPrefix "${CCF_INSTALL_PREFIX}") + else() + message(FATAL_ERROR "INSTALL_PREFIX must be an absolute path") + endif() + else() + set(installPrefix "${CMAKE_INSTALL_PREFIX}") + endif() + + if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}") + set(absInstallDir "${CCF_INSTALL_DESTINATION}") + else() + set(absInstallDir "${installPrefix}/${CCF_INSTALL_DESTINATION}") + endif() + + file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${installPrefix}" ) + + foreach(var ${CCF_PATH_VARS}) + if(NOT DEFINED ${var}) + message(FATAL_ERROR "Variable ${var} does not exist") + else() + if(IS_ABSOLUTE "${${var}}") + string(REPLACE "${installPrefix}" "\${PACKAGE_PREFIX_DIR}" + PACKAGE_${var} "${${var}}") + else() + set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}") + endif() + endif() + endforeach() + + get_filename_component(inputFileName "${_inputFile}" NAME) + + set(PACKAGE_INIT " +####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### +####### Any changes to this file will be overwritten by the next CMake run #### +####### The input file was ${inputFileName} ######## + +get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE) +") + + if("${absInstallDir}" MATCHES "^(/usr)?/lib(64)?/.+") + # Handle "/usr move" symlinks created by some Linux distros. + set(PACKAGE_INIT "${PACKAGE_INIT} +# Use original install prefix when loaded through a \"/usr move\" +# cross-prefix symbolic link such as /lib -> /usr/lib. +get_filename_component(_realCurr \"\${CMAKE_CURRENT_LIST_DIR}\" REALPATH) +get_filename_component(_realOrig \"${absInstallDir}\" REALPATH) +if(_realCurr STREQUAL _realOrig) + set(PACKAGE_PREFIX_DIR \"${installPrefix}\") +endif() +unset(_realOrig) +unset(_realCurr) +") + endif() + + if(NOT CCF_NO_SET_AND_CHECK_MACRO) + set(PACKAGE_INIT "${PACKAGE_INIT} +macro(set_and_check _var _file) + set(\${_var} \"\${_file}\") + if(NOT EXISTS \"\${_file}\") + message(FATAL_ERROR \"File or directory \${_file} referenced by variable \${_var} does not exist !\") + endif() +endmacro() +") + endif() + + + if(NOT CCF_NO_CHECK_REQUIRED_COMPONENTS_MACRO) + set(PACKAGE_INIT "${PACKAGE_INIT} +macro(check_required_components _NAME) + foreach(comp \${\${_NAME}_FIND_COMPONENTS}) + if(NOT \${_NAME}_\${comp}_FOUND) + if(\${_NAME}_FIND_REQUIRED_\${comp}) + set(\${_NAME}_FOUND FALSE) + endif() + endif() + endforeach() +endmacro() +") + endif() + + set(PACKAGE_INIT "${PACKAGE_INIT} +####################################################################################") + + configure_file("${_inputFile}" "${_outputFile}" @ONLY) + +endfunction() diff --git a/config/cmake/hdf5-config.cmake.build.in b/config/cmake/hdf5-config.cmake.build.in deleted file mode 100644 index 0276ea7..0000000 --- a/config/cmake/hdf5-config.cmake.build.in +++ /dev/null @@ -1,73 +0,0 @@ -#----------------------------------------------------------------------------- -# HDF5 Config file for compiling against hdf5 build directory -#----------------------------------------------------------------------------- -GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) - -#----------------------------------------------------------------------------- -# User Options -#----------------------------------------------------------------------------- -set (HDF5_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@) -set (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) -set (HDF5_ENABLE_F2003 @HDF5_ENABLE_F2003@) -set (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) -set (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@) -set (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) -set (HDF5_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@) -set (HDF5_ENABLE_SZIP_SUPPORT @HDF5_ENABLE_SZIP_SUPPORT@) -set (HDF5_ENABLE_SZIP_ENCODING @HDF5_ENABLE_SZIP_ENCODING@) -set (HDF5_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) - -#----------------------------------------------------------------------------- -# Dependencies -#----------------------------------------------------------------------------- -IF(HDF5_ENABLE_PARALLEL) - SET(HDF5_MPI_C_INCLUDE_PATH "@MPI_C_INCLUDE_PATH@") - SET(HDF5_MPI_C_LIBRARIES "@MPI_C_LIBRARIES@") -ENDIF(HDF5_ENABLE_PARALLEL) - -#----------------------------------------------------------------------------- -# Directories -#----------------------------------------------------------------------------- -set (HDF5_INCLUDE_DIR "@HDF5_INCLUDES_BUILD_TIME@" "${HDF5_MPI_C_INCLUDE_PATH}" ) - -if (HDF5_BUILD_FORTRAN) - set (HDF5_INCLUDE_DIR_FORTRAN "@CMAKE_Fortran_MODULE_DIRECTORY@" ) -endif (HDF5_BUILD_FORTRAN) - -if (HDF5_BUILD_CPP_LIB) - set (HDF5_INCLUDE_DIR_CPP ${HDF5_INCLUDE_DIR} ) -endif (HDF5_BUILD_CPP_LIB) - -if (HDF5_BUILD_HL_LIB) - set (HDF5_INCLUDE_DIR_HL ${HDF5_INCLUDE_DIR} ) -endif (HDF5_BUILD_HL_LIB) - -if (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB) - set (HDF5_INCLUDE_DIR_HL_CPP ${HDF5_INCLUDE_DIR} ) -endif (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB) - -if (HDF5_BUILD_TOOLS) - set (HDF5_INCLUDE_DIR_TOOLS ${HDF5_INCLUDE_DIR} ) -endif (HDF5_BUILD_TOOLS) - -if (HDF5_BUILD_SHARED_LIBS) - set (H5_BUILT_AS_DYNAMIC_LIB 1 ) -else (HDF5_BUILD_SHARED_LIBS) - set (H5_BUILT_AS_STATIC_LIB 1 ) -endif (HDF5_BUILD_SHARED_LIBS) - -#----------------------------------------------------------------------------- -# Version Strings -#----------------------------------------------------------------------------- -set (HDF5_VERSION_STRING @HDF5_VERSION_STRING@) -set (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@) -set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@) - -#----------------------------------------------------------------------------- -# Don't include targets if this file is being picked up by another -# project which has already build hdf5 as a subproject -#----------------------------------------------------------------------------- -if (NOT TARGET "@HDF5_PACKAGE@") - include (${SELF_DIR}/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) - set (HDF5_LIBRARIES "@HDF5_LIBRARIES_TO_EXPORT@") -endif (NOT TARGET "@HDF5_PACKAGE@") diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in new file mode 100644 index 0000000..79223d1 --- /dev/null +++ b/config/cmake/hdf5-config.cmake.in @@ -0,0 +1,86 @@ +#----------------------------------------------------------------------------- +# HDF5 Config file for compiling against hdf5 build/install directory +#----------------------------------------------------------------------------- +@PACKAGE_INIT@ + +#----------------------------------------------------------------------------- +# User Options +#----------------------------------------------------------------------------- +set (HDF5_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@) +set (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) +set (HDF5_ENABLE_F2003 @HDF5_ENABLE_F2003@) +set (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) +set (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@) +set (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) +set (HDF5_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@) +set (HDF5_ENABLE_SZIP_SUPPORT @HDF5_ENABLE_SZIP_SUPPORT@) +set (HDF5_ENABLE_SZIP_ENCODING @HDF5_ENABLE_SZIP_ENCODING@) +set (HDF5_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) +set (HDF5_PACKAGE_EXTLIBS @HDF5_PACKAGE_EXTLIBS@) + +#----------------------------------------------------------------------------- +# Dependencies +#----------------------------------------------------------------------------- +IF(HDF5_ENABLE_PARALLEL) + SET(HDF5_MPI_C_INCLUDE_PATH "@MPI_C_INCLUDE_PATH@") + SET(HDF5_MPI_C_LIBRARIES "@MPI_C_LIBRARIES@") +ENDIF(HDF5_ENABLE_PARALLEL) + +#----------------------------------------------------------------------------- +# Directories +#----------------------------------------------------------------------------- +set (HDF5_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" "${HDF5_MPI_C_INCLUDE_PATH}" ) + +set (HDF5_SHARE_DIR "@PACKAGE_SHARE_INSTALL_DIR@") +set_and_check (HDF5_BUILD_DIR "@PACKAGE_CURRENT_BUILD_DIR@") + +if (HDF5_BUILD_FORTRAN) + set (HDF5_INCLUDE_DIR_FORTRAN "@PACKAGE_INCLUDE_INSTALL_DIR@" ) +endif (HDF5_BUILD_FORTRAN) + +if (HDF5_BUILD_CPP_LIB) + set (HDF5_INCLUDE_DIR_CPP "@PACKAGE_INCLUDE_INSTALL_DIR@" ) +endif (HDF5_BUILD_CPP_LIB) + +if (HDF5_BUILD_HL_LIB) + set (HDF5_INCLUDE_DIR_HL "@PACKAGE_INCLUDE_INSTALL_DIR@" ) +endif (HDF5_BUILD_HL_LIB) + +if (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB) + set (HDF5_INCLUDE_DIR_HL_CPP "@PACKAGE_INCLUDE_INSTALL_DIR@" ) +endif (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB) + +if (HDF5_BUILD_TOOLS) + set (HDF5_INCLUDE_DIR_TOOLS "@PACKAGE_INCLUDE_INSTALL_DIR@" ) + set_and_check (HDF5_TOOLS_DIR "@PACKAGE_CURRENT_BUILD_DIR@/bin" ) +endif (HDF5_BUILD_TOOLS) + +if (HDF5_BUILD_SHARED_LIBS) + set (H5_BUILT_AS_DYNAMIC_LIB 1 ) +else (HDF5_BUILD_SHARED_LIBS) + set (H5_BUILT_AS_STATIC_LIB 1 ) +endif (HDF5_BUILD_SHARED_LIBS) + +#----------------------------------------------------------------------------- +# Version Strings +#----------------------------------------------------------------------------- +set (HDF5_VERSION_STRING @HDF5_VERSION_STRING@) +set (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@) +set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@) + +#----------------------------------------------------------------------------- +# Don't include targets if this file is being picked up by another +# project which has already built hdf5 as a subproject +#----------------------------------------------------------------------------- +if (NOT TARGET "@HDF5_PACKAGE@") + if (HDF5_ENABLE_Z_LIB_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "zlib") + include (@PACKAGE_SHARE_INSTALL_DIR@/ZLIB/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) + endif (HDF5_ENABLE_Z_LIB_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "zlib") + if (HDF5_ENABLE_SZIP_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "szip") + include (@PACKAGE_SHARE_INSTALL_DIR@/SZIP/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) + endif (HDF5_ENABLE_SZIP_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "szip") + include (@PACKAGE_SHARE_INSTALL_DIR@/hdf5/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) + set (HDF5_LIBRARIES "@HDF5_LIBRARIES_TO_EXPORT@") +endif (NOT TARGET "@HDF5_PACKAGE@") + +check_required_components(hdf5) diff --git a/config/cmake/hdf5-config.cmake.install.in b/config/cmake/hdf5-config.cmake.install.in deleted file mode 100644 index c1c4498..0000000 --- a/config/cmake/hdf5-config.cmake.install.in +++ /dev/null @@ -1,81 +0,0 @@ -#----------------------------------------------------------------------------- -# HDF5 Config file for compiling against hdf5 install directory -#----------------------------------------------------------------------------- -GET_FILENAME_COMPONENT (SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${SELF_DIR}" PATH) -GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) -if (NOT WIN32) - GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) -endif (NOT WIN32) - -#----------------------------------------------------------------------------- -# User Options -#----------------------------------------------------------------------------- -set (HDF5_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@) -set (HDF5_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) -set (HDF5_ENABLE_F2003 @HDF5_ENABLE_F2003@) -set (HDF5_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) -set (HDF5_BUILD_TOOLS @HDF5_BUILD_TOOLS@) -set (HDF5_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) -set (HDF5_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@) -set (HDF5_ENABLE_SZIP_SUPPORT @HDF5_ENABLE_SZIP_SUPPORT@) -set (HDF5_ENABLE_SZIP_ENCODING @HDF5_ENABLE_SZIP_ENCODING@) -set (HDF5_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@) -set (HDF5_PACKAGE_EXTLIBS @HDF5_PACKAGE_EXTLIBS@) - -#----------------------------------------------------------------------------- -# Dependencies -#----------------------------------------------------------------------------- -IF(HDF5_ENABLE_PARALLEL) - SET(HDF5_MPI_C_INCLUDE_PATH "@MPI_C_INCLUDE_PATH@") - SET(HDF5_MPI_C_LIBRARIES "@MPI_C_LIBRARIES@") -ENDIF(HDF5_ENABLE_PARALLEL) - -#----------------------------------------------------------------------------- -# Directories -#----------------------------------------------------------------------------- -set (HDF5_INCLUDE_DIR "${_IMPORT_PREFIX}/include" "${HDF5_MPI_C_INCLUDE_PATH}" ) - -if (HDF5_BUILD_FORTRAN) - set (HDF5_INCLUDE_DIR_FORTRAN "${_IMPORT_PREFIX}/include" ) -endif (HDF5_BUILD_FORTRAN) - -if (HDF5_BUILD_CPP_LIB) - set (HDF5_INCLUDE_DIR_CPP "${_IMPORT_PREFIX}/include" ) -endif (HDF5_BUILD_CPP_LIB) - -if (HDF5_BUILD_HL_LIB) - set (HDF5_INCLUDE_DIR_HL "${_IMPORT_PREFIX}/include" ) -endif (HDF5_BUILD_HL_LIB) - -if (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB) - set (HDF5_INCLUDE_DIR_HL_CPP "${_IMPORT_PREFIX}/include" ) -endif (HDF5_BUILD_HL_LIB AND HDF5_BUILD_CPP_LIB) - -if (HDF5_BUILD_TOOLS) - set (HDF5_INCLUDE_DIR_TOOLS "${_IMPORT_PREFIX}/include" ) - set (HDF5_TOOLS_DIR "${_IMPORT_PREFIX}/bin" ) -endif (HDF5_BUILD_TOOLS) - -#----------------------------------------------------------------------------- -# Version Strings -#----------------------------------------------------------------------------- -set (HDF5_VERSION_STRING @HDF5_VERSION_STRING@) -set (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@) -set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@) - -#----------------------------------------------------------------------------- -# Don't include targets if this file is being picked up by another -# project which has already built hdf5 as a subproject -#----------------------------------------------------------------------------- -if (NOT TARGET "@HDF5_PACKAGE@") - if (HDF5_ENABLE_Z_LIB_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "zlib") - include (${SELF_DIR}/../ZLIB/@ZLIB_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) - endif (HDF5_ENABLE_Z_LIB_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "zlib") - if (HDF5_ENABLE_SZIP_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "szip") - include (${SELF_DIR}/../SZIP/@SZIP_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) - endif (HDF5_ENABLE_SZIP_SUPPORT AND HDF5_PACKAGE_EXTLIBS AND NOT TARGET "szip") - include (${SELF_DIR}/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) - set (HDF5_LIBRARIES "@HDF5_LIBRARIES_TO_EXPORT@") -endif (NOT TARGET "@HDF5_PACKAGE@") - -- cgit v0.12 From 52d5e22956c37374aea7c444dd930278c0c51f32 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Thu, 25 Sep 2014 09:48:33 -0500 Subject: [svn-r25618] Added tests for HDFFV-8879 --- fortran/test/tH5P_F03.f90 | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/fortran/test/tH5P_F03.f90 b/fortran/test/tH5P_F03.f90 index ae48114..945d0a5 100644 --- a/fortran/test/tH5P_F03.f90 +++ b/fortran/test/tH5P_F03.f90 @@ -111,6 +111,10 @@ SUBROUTINE test_create(total_error) INTEGER(SIZE_T) :: h5off TYPE(C_PTR) :: f_ptr LOGICAL :: differ1, differ2 + CHARACTER(LEN=1) :: cfill + INTEGER :: ifill + REAL :: rfill + REAL(KIND=dp) :: dpfill !/* ! * Create a file. @@ -162,6 +166,41 @@ SUBROUTINE test_create(total_error) f_ptr = C_LOC(fill_ctype) + ! Test various fill values + CALL H5Pset_fill_value_f(dcpl, H5T_NATIVE_CHARACTER, 'X', error) + CALL check("H5Pset_fill_value_f",error, total_error) + CALL h5pget_fill_value_f(dcpl, H5T_NATIVE_CHARACTER, cfill, error) + CALL check("H5Pget_fill_value_f",error, total_error) + IF(cfill.NE.'X')THEN + PRINT*,"***ERROR: Returned wrong fill value (character)" + total_error = total_error + 1 + ENDIF + CALL H5Pset_fill_value_f(dcpl, H5T_NATIVE_INTEGER, 9, error) + CALL check("H5Pset_fill_value_f",error, total_error) + CALL h5pget_fill_value_f(dcpl, H5T_NATIVE_INTEGER, ifill, error) + CALL check("H5Pget_fill_value_f",error, total_error) + IF(ifill.NE.9)THEN + PRINT*,"***ERROR: Returned wrong fill value (integer)" + total_error = total_error + 1 + ENDIF + CALL H5Pset_fill_value_f(dcpl, H5T_NATIVE_DOUBLE, 1.0_dp, error) + CALL check("H5Pset_fill_value_f",error, total_error) + CALL h5pget_fill_value_f(dcpl, H5T_NATIVE_DOUBLE, dpfill, error) + CALL check("H5Pget_fill_value_f",error, total_error) + IF(.NOT.dreal_eq( REAL(dpfill,dp), 1.0_dp))THEN + PRINT*,"***ERROR: Returned wrong fill value (double)" + total_error = total_error + 1 + ENDIF + CALL H5Pset_fill_value_f(dcpl, H5T_NATIVE_REAL, 2.0, error) + CALL check("H5Pset_fill_value_f",error, total_error) + CALL h5pget_fill_value_f(dcpl, H5T_NATIVE_REAL, rfill, error) + CALL check("H5Pget_fill_value_f",error, total_error) + IF(.NOT.dreal_eq( REAL(rfill,dp), REAL(2.0,dp)))THEN + PRINT*,"***ERROR: Returned wrong fill value (real)" + total_error = total_error + 1 + ENDIF + + ! For the actual compound type CALL H5Pset_fill_value_f(dcpl, comp_type_id, f_ptr, error) CALL check("H5Pget_fill_value_f",error, total_error) -- cgit v0.12 From a88186280275c51d91c644e0b66a0b30dc0452d8 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Thu, 25 Sep 2014 14:30:36 -0500 Subject: [svn-r25620] Fix a bug in multi VFD when the memb_addr in H5Pset_fapl_multi is passed as NULL. The library is supposed in that case to equally divide the address space among all members, but there was a bug causing an overflow in the assignment. tested with h5commitest --- src/H5FDmulti.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 0a899a9..4a62bd8 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -491,7 +491,7 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, } if (!memb_addr) { for (mt=H5FD_MEM_DEFAULT; mt Date: Thu, 25 Sep 2014 16:11:54 -0500 Subject: [svn-r25623] Update from 1.8 docs - docs team changes from last release --- release_docs/INSTALL_CMake.txt | 2 +- release_docs/USING_HDF5_CMake.txt | 4 ++-- release_docs/USING_HDF5_VS.txt | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 31e3917..40f8023 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -641,7 +641,7 @@ cmake_minimum_required(VERSION 2.8.10 FATAL_ERROR) set(CTEST_SOURCE_NAME hdf5-1.8.13) # this is the location of the source with ctest parameter hdf5src # "ctest -S HDF518LinuxCmake.cmake,hdf5src -C Release -O hdf518static.log" -set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG}) +#set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG}) # this is the location of the build directory set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt index 8d09b22..7f99028 100644 --- a/release_docs/USING_HDF5_CMake.txt +++ b/release_docs/USING_HDF5_CMake.txt @@ -27,7 +27,7 @@ Notes: This short instruction is written for users who want to quickly 3. See the appendix at the bottom of this file for an example of using a ctest script for building and testing. See - CMake.txt for more information. + INSTALL_CMake.txt for more information. @@ -69,7 +69,7 @@ Go through these steps to build HDF5 applications with CMake. 1. Run CMake 2. Configure the cache settings 3. Build HDF5 Applications - 4. Test HDF5 Applications. + 4. Test HDF5 Applications These steps are described in more detail below. diff --git a/release_docs/USING_HDF5_VS.txt b/release_docs/USING_HDF5_VS.txt index 9bf301e..9063ea6 100644 --- a/release_docs/USING_HDF5_VS.txt +++ b/release_docs/USING_HDF5_VS.txt @@ -18,12 +18,12 @@ Using Visual Studio 2010 with HDF5 Libraries built with Visual Studio 2010 1. Set up path for external libraries and headers - The path settings will need to be in project property sheets per project. + The path settings will need to be in the project property sheets per project. Go to "Project" and select "Properties", find "Configuration Properties", and then "VC++ Directories". 1.1 If you are building on 64-bit Windows, find the "Platform" dropdown - and select "x64". + and select "x64". 1.2 Add the header path to the "Include Directories" setting. @@ -42,7 +42,7 @@ Using Visual Studio 2010 with HDF5 Libraries built with Visual Studio 2010 Using Visual Studio 2008 with HDF5 Libraries built with Visual Studio 2008 ========================================================================== - 2. Set up path for external libraries and headers + 2. Set up the path for external libraries and headers Invoke Microsoft Visual Studio and go to "Tools" and select "Options", find "Projects", and then "VC++ Directories". -- cgit v0.12 From 8bd91611f45490c06b08cdc5a712127f5541033c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 26 Sep 2014 09:12:55 -0500 Subject: [svn-r25624] Define symbol for other compilers as nothing. Tested: platypus --- src/H5PLextern.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/H5PLextern.h b/src/H5PLextern.h index a204cb7..8ad19e7 100644 --- a/src/H5PLextern.h +++ b/src/H5PLextern.h @@ -39,6 +39,8 @@ typedef enum H5PL_type_t { #define H5PLUGIN_DLL __declspec(dllexport) #elif (__GNUC__ >= 4) /* GCC 4.x has support for visibility options */ #define H5PLUGIN_DLL __attribute__ ((visibility("default"))) +#else + #define H5PLUGIN_DLL #endif #ifdef __cplusplus -- cgit v0.12 From 6f2f584c42f582485443d696c0d52f585b3c1cc1 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 26 Sep 2014 09:25:04 -0500 Subject: [svn-r25626] Changed the callback function integer type from INTEGER to INTEGER(C_INT) for portability, HDFFV-8909. --- fortran/test/tH5L_F03.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortran/test/tH5L_F03.f90 b/fortran/test/tH5L_F03.f90 index 8cc17fb..795f1e2 100644 --- a/fortran/test/tH5L_F03.f90 +++ b/fortran/test/tH5L_F03.f90 @@ -58,7 +58,7 @@ CONTAINS !** !*************************************************************** - INTEGER FUNCTION liter_cb(group, name, link_info, op_data) bind(C) + INTEGER(KIND=C_INT) FUNCTION liter_cb(group, name, link_info, op_data) bind(C) USE HDF5 USE ISO_C_BINDING -- cgit v0.12 From c617cbdfb05564890f5d76e0d5c9ea525ec27a09 Mon Sep 17 00:00:00 2001 From: HDF Tester Date: Sun, 28 Sep 2014 05:34:35 -0500 Subject: [svn-r25627] Snapshot version 1.9 release 197 --- README.txt | 2 +- c++/src/Makefile.in | 2 +- config/lt_vers.am | 2 +- configure | 22 +++++++++++----------- configure.ac | 2 +- fortran/src/Makefile.in | 2 +- hl/c++/src/Makefile.in | 2 +- hl/fortran/src/Makefile.in | 2 +- hl/src/Makefile.in | 2 +- release_docs/RELEASE.txt | 2 +- src/H5public.h | 4 ++-- src/Makefile.in | 2 +- vms/src/h5pubconf.h | 6 +++--- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/README.txt b/README.txt index db2e07a..13786d1 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.197 currently under development +HDF5 version 1.9.198 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 66c3e0b..9c932f1 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -681,7 +681,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 187 +LT_VERS_REVISION = 188 LT_VERS_AGE = 0 # This is our main target diff --git a/config/lt_vers.am b/config/lt_vers.am index 7250585..217f126 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -17,7 +17,7 @@ # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 187 +LT_VERS_REVISION = 188 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/configure b/configure index 68054de..a0af921 100755 --- a/configure +++ b/configure @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for HDF5 1.9.197. +# Generated by GNU Autoconf 2.69 for HDF5 1.9.198. # # Report bugs to . # @@ -591,8 +591,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='HDF5' PACKAGE_TARNAME='hdf5' -PACKAGE_VERSION='1.9.197' -PACKAGE_STRING='HDF5 1.9.197' +PACKAGE_VERSION='1.9.198' +PACKAGE_STRING='HDF5 1.9.198' PACKAGE_BUGREPORT='help@hdfgroup.org' PACKAGE_URL='' @@ -1489,7 +1489,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures HDF5 1.9.197 to adapt to many kinds of systems. +\`configure' configures HDF5 1.9.198 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1559,7 +1559,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of HDF5 1.9.197:";; + short | recursive ) echo "Configuration of HDF5 1.9.198:";; esac cat <<\_ACEOF @@ -1752,7 +1752,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -HDF5 configure 1.9.197 +HDF5 configure 1.9.198 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2846,7 +2846,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by HDF5 $as_me 1.9.197, which was +It was created by HDF5 $as_me 1.9.198, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3717,7 +3717,7 @@ fi # Define the identity of the package. PACKAGE='hdf5' - VERSION='1.9.197' + VERSION='1.9.198' cat >>confdefs.h <<_ACEOF @@ -31732,7 +31732,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -HDF5 config.lt 1.9.197 +HDF5 config.lt 1.9.198 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -33874,7 +33874,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by HDF5 $as_me 1.9.197, which was +This file was extended by HDF5 $as_me 1.9.198, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -33940,7 +33940,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -HDF5 config.status 1.9.197 +HDF5 config.status 1.9.198 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 88c61d6..183328a 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.197], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.198], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADER([src/H5config.h]) diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 5609ce7..a38b5ac 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -732,7 +732,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 187 +LT_VERS_REVISION = 188 LT_VERS_AGE = 0 AM_FCLIBS = $(LIBHDF5) diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in index 7486f0e..e20610b 100644 --- a/hl/c++/src/Makefile.in +++ b/hl/c++/src/Makefile.in @@ -673,7 +673,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 187 +LT_VERS_REVISION = 188 LT_VERS_AGE = 0 # This is our main target diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in index 7484c51..499c5bd 100644 --- a/hl/fortran/src/Makefile.in +++ b/hl/fortran/src/Makefile.in @@ -688,7 +688,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 187 +LT_VERS_REVISION = 188 LT_VERS_AGE = 0 # Our main target, the high-level fortran library diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in index af02028..d7c1d8d 100644 --- a/hl/src/Makefile.in +++ b/hl/src/Makefile.in @@ -669,7 +669,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 187 +LT_VERS_REVISION = 188 LT_VERS_AGE = 0 # This library is our main target. diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index d57579e..16f37f2 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.197 currently under development +HDF5 version 1.9.198 currently under development ================================================================================ diff --git a/src/H5public.h b/src/H5public.h index 9adee12..b479fe5 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -94,10 +94,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 197 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 198 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.197" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.198" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) diff --git a/src/Makefile.in b/src/Makefile.in index 721295b..fa6aa9d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -731,7 +731,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog # Add libtool shared library version numbers to the HDF5 library # See libtool versioning documentation online. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 187 +LT_VERS_REVISION = 188 LT_VERS_AGE = 0 # Our main target, the HDF5 library diff --git a/vms/src/h5pubconf.h b/vms/src/h5pubconf.h index 0291588..4506a2e 100644 --- a/vms/src/h5pubconf.h +++ b/vms/src/h5pubconf.h @@ -501,7 +501,7 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.9.197" +#define H5_PACKAGE_STRING "HDF5 1.9.198" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -510,7 +510,7 @@ #define H5_PACKAGE_URL "" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.9.197" +#define H5_PACKAGE_VERSION "1.9.198" /* Width for printf() for type `long long' or `__int64', use `ll' */ #define H5_PRINTF_LL_WIDTH "ll" @@ -673,7 +673,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.9.197" +#define H5_VERSION "1.9.198" /* Define if vsnprintf() returns the correct value for formatted strings that don't fit into size allowed */ -- cgit v0.12 From 17893b24ea87ae013d88ab280e262cbde00e2815 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Mon, 29 Sep 2014 10:31:40 -0500 Subject: [svn-r25629] Fix for hdffv-8855. --- hl/src/H5LT.c | 23 +++++++++++++++++++++-- hl/test/test_lite.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 1eba40c..ed725a3 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2267,6 +2267,8 @@ out: static char* realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, char *str_to_add) { + size_t size_str_to_add, size_str; + if(_no_user_buf) { /* If the buffer isn't big enough, reallocate it. Otherwise, go to do strcat. */ if(str_to_add && ((ssize_t)(*len - (HDstrlen(buf) + HDstrlen(str_to_add) + 1)) < LIMIT)) { @@ -2281,8 +2283,25 @@ realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, char *str_to_ad if(!buf) goto out; - if(str_to_add) - HDstrcat(buf, str_to_add); + if(str_to_add) { + /* find the size of the buffer to add */ + size_str_to_add = HDstrlen(str_to_add); + /* find the size of the current buffer */ + size_str = HDstrlen(buf); + + /* Check to make sure the appended string does not + * extend past the allocated buffer; if it does then truncate the string + */ + if(size_str < *len - 1) { + if( size_str + size_str_to_add < *len - 1) { + HDstrncat(buf, str_to_add, size_str_to_add); + } else { + HDstrncat(buf, str_to_add, (*len - 1) - size_str); + } + } else { + buf[*len-1] = '\0'; /* buffer is full, null terminate */ + } + } return buf; diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index cb13061..d61d6cf 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1238,6 +1238,41 @@ static int test_strings(void) } HDfree(dt_str); + /* Length of the character buffer is larger then needed */ + str_len = str_len + 10; + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) + goto out; + + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + goto out; + } + if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len-1)) { + printf("dt=\n%s\n", dt_str); + HDfree(dt_str); + goto out; + } + + /* Length of the character buffer is smaller then needed */ + str_len = 21; + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) + goto out; + + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + goto out; + } + /* check the truncated string */ + if(strlen(dt_str) != str_len-1) goto out; + str_len = strlen(dt_str); + if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len)) { + printf("dt=\n%s\n", dt_str); + HDfree(dt_str); + goto out; + } + + HDfree(dt_str); + if(H5Tclose(dtype)<0) goto out; @@ -1245,6 +1280,9 @@ static int test_strings(void) return 0; out: + if(dt_str) + HDfree(dt_str); + H5_FAILED(); return -1; } -- cgit v0.12 From 9140500b86f1143e9d0684db553d796271bffc14 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Mon, 29 Sep 2014 11:23:57 -0500 Subject: [svn-r25631] Fix fo HDFFV-8912 --- hl/fortran/test/tsttable.f90 | 21 ++++++++++++++++++--- hl/src/H5TB.c | 6 +++++- hl/test/test_table.c | 9 +++++++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/hl/fortran/test/tsttable.f90 b/hl/fortran/test/tsttable.f90 index 66ec5c6..bb88abf 100644 --- a/hl/fortran/test/tsttable.f90 +++ b/hl/fortran/test/tsttable.f90 @@ -175,13 +175,30 @@ SUBROUTINE test_table1() CALL h5tbwrite_field_name_f(file_id,dsetname1,field_names(4),start,nrecords,type_sizer,& bufr,errcode) - !------------------------------------------------------------------------- ! read field !------------------------------------------------------------------------- + ! Read an invalid field, should fail + CALL h5tbread_field_name_f(file_id,dsetname1,'DoesNotExist',start,nrecords,type_sizec,& + bufsr,errcode) + + IF(errcode.GE.0)THEN + PRINT *, 'error in h5tbread_field_name_f' + CALL h5fclose_f(file_id, errcode) + CALL h5close_f(errcode) + STOP + ENDIF + + ! Read a valid field, should pass CALL h5tbread_field_name_f(file_id,dsetname1,field_names(1),start,nrecords,type_sizec,& bufsr,errcode) + IF(errcode.LT.0)THEN + PRINT *, 'error in h5tbread_field_name_f' + CALL h5fclose_f(file_id, errcode) + CALL h5close_f(errcode) + STOP + ENDIF ! ! compare read and write buffers. @@ -329,8 +346,6 @@ SUBROUTINE test_table1() ! we insert a field callsed "field5" with the same type and buffer as field 4 (Real) !------------------------------------------------------------------------- - - CALL test_begin(' Insert field ') CALL h5tbinsert_field_f(file_id,dsetname1,"field5",field_types(4),4,bufr,errcode) diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 7856d5f..1ca41a8 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -982,7 +982,7 @@ herr_t H5TBread_fields_name(hid_t loc_id, if((mem_type_id = H5Tcreate(H5T_COMPOUND, type_size)) < 0) goto out; - /* iterate tru the members */ + /* iterate through the members */ for(i = 0, j = 0; i < nfields; i++) { /* get the member name */ if(NULL == (member_name = H5Tget_member_name(ftype_id, (unsigned)i))) @@ -1028,6 +1028,10 @@ herr_t H5TBread_fields_name(hid_t loc_id, member_name = NULL; } /* end for */ + /* check to make sure field was found, no reason to continue if it does not exist */ + if(j == 0) + goto out; + /* get the dataspace handle */ if((sid = H5Dget_space(did)) < 0) goto out; diff --git a/hl/test/test_table.c b/hl/test/test_table.c index 488cbe2..c312296 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -1186,14 +1186,19 @@ static int test_table(hid_t fid, int do_write) goto out; } - /* read the "Pressure" field */ start = 0; nrecords = NRECORDS; + + /* read an invalid field, should fail */ + if ( H5TBread_fields_name(fid,"table10","DoesNotExist",start,nrecords, + sizeof(float),0,field_sizes_pre,pressure_out) >=0) + goto out; + + /* read the "Pressure" field */ if ( H5TBread_fields_name(fid,"table10","Pressure",start,nrecords, sizeof(float),0,field_sizes_pre,pressure_out)<0) goto out; - /* Compare the extracted table with the initial values */ for( i = 0; i < NRECORDS; i++ ) { -- cgit v0.12 From 0befe65753b60e85891453dcbca373763a070419 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 29 Sep 2014 15:52:08 -0500 Subject: [svn-r25632] Purpose: Fixed HDFFV-8852 Description: H5F_ACC_CREAT was included in the C++ API while the C library doesn't allow it yet. Possibly, in the future, but not now. In addition, the two flags H5F_ACC_RDONLY and H5F_ACC_RDWR were missing from the documentation, causing confusion that appending is not supported. Solution: - Removed H5F_ACC_CREAT from the function until the C library support it - Added H5F_ACC_RDONLY and H5F_ACC_RDWR to the comments to update the documentation Platforms tested: Linux/ppc64 (ostrich) Linux/32 2.6 (jam) SunOS 5.11 (emu) --- c++/src/H5File.cpp | 10 +++++++++- c++/test/dsets.cpp | 1 + c++/test/tfile.cpp | 2 +- c++/test/th5s.cpp | 4 ++-- c++/test/tlinks.cpp | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index e4ac4a1..ff00e3b 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -69,6 +69,10 @@ H5File::H5File() : H5Location(), id(0) {} /// the file. /// \li \c H5F_ACC_EXCL - Fail if file already exists. /// \c H5F_ACC_TRUNC and \c H5F_ACC_EXCL are mutually exclusive +/// \li \c H5F_ACC_RDONLY - Open file as read-only, if it already +/// exists, and fail, otherwise +/// \li \c H5F_ACC_RDWR - Open file for read/write, if it already +/// exists, and fail, otherwise /// \li \c H5F_ACC_DEBUG - print debug information. This flag is /// used only by HDF5 library developers; it is neither /// tested nor supported for use in applications. @@ -121,12 +125,15 @@ H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPro // This function is private and contains common code between the // constructors taking a string or a char* // Programmer Binh-Minh Ribler - 2000 +// Modification +// - removed H5F_ACC_CREAT because H5Fcreate will fail with +// H5F_ACC_CREAT. - BMR, Sep 17, 2014 //-------------------------------------------------------------------------- void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist) { // These bits only set for creation, so if any of them are set, // create the file. - if( flags & (H5F_ACC_CREAT|H5F_ACC_EXCL|H5F_ACC_TRUNC|H5F_ACC_DEBUG)) + if( flags & (H5F_ACC_EXCL|H5F_ACC_TRUNC|H5F_ACC_DEBUG)) { hid_t create_plist_id = create_plist.getId(); hid_t access_plist_id = access_plist.getId(); @@ -147,6 +154,7 @@ void H5File::p_get_file(const char* name, unsigned int flags, const FileCreatPro } } } + #endif // DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index d1ced1d..fc0ea3a 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -1083,6 +1083,7 @@ void test_dset() // Close the file before testing data size. file.close(); + nerrors += test_datasize(fapl) <0 ? 1:0; } catch (Exception E) diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 1f53e61..ecfa8d0 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -622,7 +622,7 @@ extern "C" void test_file() { // Output message about test being performed - MESSAGE(5, ("Testing File I/O operations\n")); + MESSAGE(5, ("Testing File I/O Operations\n")); test_file_create(); // Test file creation (also creation templates) test_file_open(); // Test file opening diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index cfdeb1f..b7a39b4 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -317,7 +317,7 @@ static void test_h5s_scalar_read() SUBTEST("Scalar Dataspace Reading"); try { - // Create file + // Open file H5File fid1(DATAFILE, H5F_ACC_RDWR); // Create a dataset @@ -506,7 +506,7 @@ static void test_h5s_compound_scalar_read() // Output message about test being performed SUBTEST("Compound Dataspace Reading"); try { - // Create file + // Open file H5File fid1(DATAFILE, H5F_ACC_RDWR); // Create a dataset diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index fca5918..291b649 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -15,7 +15,7 @@ /***************************************************************************** FILE tlinks.cpp - HDF5 C++ testing functionalities associated with the - C attribute interface (H5L) + C link interface (H5L) ***************************************************************************/ -- cgit v0.12