diff options
Diffstat (limited to 'hl')
35 files changed, 2417 insertions, 2417 deletions
diff --git a/hl/c++/src/H5PacketTable.cpp b/hl/c++/src/H5PacketTable.cpp index 3f77d8f..010d1a1 100644 --- a/hl/c++/src/H5PacketTable.cpp +++ b/hl/c++/src/H5PacketTable.cpp @@ -30,7 +30,7 @@ } /* IsValid - * Returns true if this packet table is valid, false otherwise. + * Returns true if this packet table is valid, false otherwise. * Use this after the constructor to ensure HDF did not have * any trouble making or opening the packet table. */ @@ -89,7 +89,7 @@ /* Constructor * Creates a packet table in which to store fixed length records. * Takes the ID of the file the packet table will be created in, the name of - * the packet table, the ID of the datatype of the set, and the size + * the packet table, the ID of the datatype of the set, and the size * of a memory chunk used in chunking. */ FL_PacketTable::FL_PacketTable(hid_t fileID, char* name, hid_t dtypeID, int chunkSize) @@ -177,7 +177,7 @@ { return H5PTget_next(table_id, numRecords, data); } - + /********************************/ /* Variable-Length Packet Table */ diff --git a/hl/c++/src/H5PacketTable.h b/hl/c++/src/H5PacketTable.h index 1d6ba31..1e0e4c6 100644 --- a/hl/c++/src/H5PacketTable.h +++ b/hl/c++/src/H5PacketTable.h @@ -31,7 +31,7 @@ public: ~PacketTable(); /* IsValid - * Returns true if this packet table is valid, false otherwise. + * Returns true if this packet table is valid, false otherwise. * Use this after the constructor to ensure HDF did not have * any trouble making or opening the packet table. */ @@ -78,7 +78,7 @@ public: /* Constructor * Creates a packet table in which to store fixed length records. * Takes the ID of the file the packet table will be created in, the name of - * the packet table, the ID of the datatype of the set, and the size + * the packet table, the ID of the datatype of the set, and the size * of a memory chunk used in chunking. */ FL_PacketTable(hid_t fileID, char* name, hid_t dtypeID, int chunkSize); diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index 9dc2bffe..f2db380 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -84,7 +84,7 @@ int BasicTest() wrapper.AppendPacket(&myRecord); /* get number of records test */ - count = wrapper.GetPacketCount(); + count = wrapper.GetPacketCount(); if(count != 2) goto out; @@ -374,7 +374,7 @@ int SystemTest() hid_t dtypeID1, dtypeID2; unsigned int count; - /* Creating two inter-related datatypes. Create two datasets and put + /* Creating two inter-related datatypes. Create two datasets and put * one datatype in each. */ typedef struct compoundType { diff --git a/hl/fortran/src/H5IMcc.c b/hl/fortran/src/H5IMcc.c index 192d58a..0ff802d 100644 --- a/hl/fortran/src/H5IMcc.c +++ b/hl/fortran/src/H5IMcc.c @@ -22,7 +22,7 @@ * private functions *------------------------------------------------------------------------- */ -herr_t H5IM_get_palette( hid_t loc_id, +herr_t H5IM_get_palette( hid_t loc_id, const char *image_name, int pal_number, hid_t tid, @@ -49,8 +49,8 @@ herr_t H5IM_get_palette( hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5IMmake_image_8bitf( hid_t loc_id, - const char *dset_name, +herr_t H5IMmake_image_8bitf( hid_t loc_id, + const char *dset_name, hsize_t width, hsize_t height, int_f *buf ) @@ -58,17 +58,17 @@ herr_t H5IMmake_image_8bitf( hid_t loc_id, hid_t did; /* dataset ID */ hid_t sid; /* space ID */ hsize_t dims[IMAGE8_RANK]; /* dimensions */ - + /* initialize the image dimensions */ - dims[0] = height; - dims[1] = width; - dims[2] = 1; + dims[0] = height; + dims[1] = width; + dims[2] = 1; /*------------------------------------------------------------------------- * create and write the dataset *------------------------------------------------------------------------- */ - + /* create the data space for the dataset. */ if ((sid=H5Screate_simple(IMAGE8_RANK,dims,NULL))<0) return -1; @@ -80,7 +80,7 @@ herr_t H5IMmake_image_8bitf( hid_t loc_id, /* write with memory type H5T_NATIVE_INT */ /* Use long type if Fortran integer is 8 bytes and C long long is also 8 bytes*/ /* Fail if otherwise */ - if (buf) + if (buf) { if (sizeof(int_f) == sizeof(int)) { if (H5Dwrite(did,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) @@ -105,7 +105,7 @@ herr_t H5IMmake_image_8bitf( hid_t loc_id, * attach the specification attributes *------------------------------------------------------------------------- */ - + /* attach the CLASS attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, "CLASS", IMAGE_CLASS ) < 0 ) return -1; @@ -139,9 +139,9 @@ herr_t H5IMmake_image_8bitf( hid_t loc_id, * The memory datatype is H5T_NATIVE_INT. It is supposed to be called from * the FORTRAN interface where the image buffer is defined as type "integer" * - * Interlace Mode Dimensions in the Dataspace - * INTERLACE_PIXEL [height][width][pixel components] - * INTERLACE_PLANE [pixel components][height][width] + * Interlace Mode Dimensions in the Dataspace + * INTERLACE_PIXEL [height][width][pixel components] + * INTERLACE_PLANE [pixel components][height][width] * * * Modifications: @@ -149,8 +149,8 @@ herr_t H5IMmake_image_8bitf( hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5IMmake_image_24bitf( hid_t loc_id, - const char *dset_name, +herr_t H5IMmake_image_24bitf( hid_t loc_id, + const char *dset_name, hsize_t width, hsize_t height, const char *interlace, @@ -164,28 +164,28 @@ herr_t H5IMmake_image_24bitf( hid_t loc_id, * attach the image dimensions according to the interlace mode *------------------------------------------------------------------------- */ - if ( strcmp( interlace, "INTERLACE_PIXEL" ) == 0 ) + if ( strcmp( interlace, "INTERLACE_PIXEL" ) == 0 ) { /* Number of color planes is defined as the third dimension */ - dims[0] = height; - dims[1] = width; - dims[2] = IMAGE24_RANK; + dims[0] = height; + dims[1] = width; + dims[2] = IMAGE24_RANK; } else - if ( strcmp( interlace, "INTERLACE_PLANE" ) == 0 ) + if ( strcmp( interlace, "INTERLACE_PLANE" ) == 0 ) { /* Number of color planes is defined as the first dimension */ - dims[0] = IMAGE24_RANK; - dims[1] = height; - dims[2] = width; + dims[0] = IMAGE24_RANK; + dims[1] = height; + dims[2] = width; } else return -1; - + /*------------------------------------------------------------------------- * create and write the dataset *------------------------------------------------------------------------- */ - + /* create the data space for the dataset. */ if ((sid=H5Screate_simple(IMAGE24_RANK,dims,NULL))<0) return -1; @@ -195,7 +195,7 @@ herr_t H5IMmake_image_24bitf( hid_t loc_id, return -1; /* write with memory type H5T_NATIVE_INT */ - if (buf) + if (buf) { if (sizeof(int_f) == sizeof(int)) { if (H5Dwrite(did,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) @@ -263,11 +263,11 @@ herr_t H5IMmake_image_24bitf( hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5IMread_imagef( hid_t loc_id, - const char *dset_name, +herr_t H5IMread_imagef( hid_t loc_id, + const char *dset_name, int_f *buf ) { - hid_t did; + hid_t did; /* open the dataset */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) @@ -314,7 +314,7 @@ out: * The memory datatype is H5T_NATIVE_INT. It is supposed to be called from * the FORTRAN interface where the image buffer is defined as type "integer" * - * based on HDF5 Image and Palette Specification + * based on HDF5 Image and Palette Specification * http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageSpec.html * * Modifications: @@ -322,20 +322,20 @@ out: *------------------------------------------------------------------------- */ -herr_t H5IMmake_palettef( hid_t loc_id, +herr_t H5IMmake_palettef( hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, - int_f *pal_data ) + int_f *pal_data ) + +{ -{ - hid_t did; /* dataset ID */ hid_t sid; /* space ID */ int has_pal; - + /* Check if the dataset already exists */ has_pal = H5LTfind_dataset( loc_id, pal_name ); - + /* It exists. Return */ if ( has_pal == 1 ) return 0; @@ -344,7 +344,7 @@ herr_t H5IMmake_palettef( hid_t loc_id, * create and write the dataset *------------------------------------------------------------------------- */ - + /* create the data space for the dataset. */ if ((sid=H5Screate_simple(2,pal_dims,NULL))<0) return -1; @@ -354,7 +354,7 @@ herr_t H5IMmake_palettef( hid_t loc_id, return -1; /* write with memory type H5T_NATIVE_INT */ - if (pal_data) + if (pal_data) { if (sizeof(int_f) == sizeof(int)) { if (H5Dwrite(did,H5T_NATIVE_INT,H5S_ALL,H5S_ALL,H5P_DEFAULT,pal_data)<0) @@ -387,7 +387,7 @@ herr_t H5IMmake_palettef( hid_t loc_id, /* Attach the attribute "PAL_VERSION" to the >>palette<< dataset*/ if ( H5LTset_attribute_string( loc_id, pal_name, "PAL_VERSION", "1.2" ) < 0 ) return -1; - + return 0; } @@ -409,7 +409,7 @@ herr_t H5IMmake_palettef( hid_t loc_id, * The memory datatype is H5T_NATIVE_INT. It is supposed to be called from * the FORTRAN interface where the image buffer is defined as type "integer" * - * based on HDF5 Image and Palette Specification + * based on HDF5 Image and Palette Specification * http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageSpec.html * * Modifications: @@ -417,7 +417,7 @@ herr_t H5IMmake_palettef( hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5IMget_palettef( hid_t loc_id, +herr_t H5IMget_palettef( hid_t loc_id, const char *image_name, int pal_number, int_f *pal_data ) @@ -447,19 +447,19 @@ herr_t H5IMget_palettef( hid_t loc_id, * Comments: * This function allows reading of an 8bit palette from disk disk * to memory type TID - * The memory datatype can be H5T_NATIVE_INT or H5T_NATIVE_UCHAR currently. + * The memory datatype can be H5T_NATIVE_INT or H5T_NATIVE_UCHAR currently. * the H5T_NATIVE_INT is supposed to be called from * the FORTRAN interface where the image buffer is defined as type "integer" * * Comments: - * based on HDF5 Image and Palette Specification + * based on HDF5 Image and Palette Specification * http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageSpec.html * * Modifications: * *------------------------------------------------------------------------- */ -herr_t H5IM_get_palette( hid_t loc_id, +herr_t H5IM_get_palette( hid_t loc_id, const char *image_name, int pal_number, hid_t tid, @@ -488,7 +488,7 @@ herr_t H5IM_get_palette( hid_t loc_id, if ( (attr_id = H5Aopen_name( image_id, "PALETTE" )) < 0 ) goto out; - + if ( (attr_type = H5Aget_type( attr_id )) < 0 ) goto out; @@ -528,13 +528,13 @@ herr_t H5IM_get_palette( hid_t loc_id, goto out; free( refbuf ); - - } /* H5T_REFERENCE */ - - if ( H5Tclose( attr_type ) < 0 ) + + } /* H5T_REFERENCE */ + + if ( H5Tclose( attr_type ) < 0 ) goto out; - /* Close the attribute. */ + /* Close the attribute. */ if ( H5Aclose( attr_id ) < 0 ) goto out; diff --git a/hl/fortran/src/H5IMcc.h b/hl/fortran/src/H5IMcc.h index 32c79ff..d568d73 100644 --- a/hl/fortran/src/H5IMcc.h +++ b/hl/fortran/src/H5IMcc.h @@ -31,29 +31,29 @@ extern "C" { -herr_t H5IMmake_image_8bitf( hid_t loc_id, - const char *dset_name, +herr_t H5IMmake_image_8bitf( hid_t loc_id, + const char *dset_name, hsize_t width, hsize_t height, int_f *buf ); -herr_t H5IMmake_image_24bitf( hid_t loc_id, - const char *dset_name, +herr_t H5IMmake_image_24bitf( hid_t loc_id, + const char *dset_name, hsize_t width, hsize_t height, const char *interlace, int_f *buf); -herr_t H5IMread_imagef( hid_t loc_id, - const char *dset_name, +herr_t H5IMread_imagef( hid_t loc_id, + const char *dset_name, int_f *buf ); -herr_t H5IMmake_palettef( hid_t loc_id, +herr_t H5IMmake_palettef( hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, int_f *pal_data ); -herr_t H5IMget_palettef( hid_t loc_id, +herr_t H5IMget_palettef( hid_t loc_id, const char *image_name, int pal_number, int_f *pal_data ); diff --git a/hl/fortran/src/H5IMfc.c b/hl/fortran/src/H5IMfc.c index 7d09f10..822dbe6 100755 --- a/hl/fortran/src/H5IMfc.c +++ b/hl/fortran/src/H5IMfc.c @@ -22,7 +22,7 @@ /*------------------------------------------------------------------------- * Function: h5immake_image_8bit_c * - * Purpose: Call H5IMmake_image_8bit + * Purpose: Call H5IMmake_image_8bit * * Return: Success: 0, Failure: -1 * @@ -39,11 +39,11 @@ */ int_f -nh5immake_image_8bit_c (hid_t_f *loc_id, +nh5immake_image_8bit_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, hsize_t_f *width, - hsize_t_f *height, + hsize_t_f *height, int_f *buf) { int ret_value = -1; @@ -56,7 +56,7 @@ nh5immake_image_8bit_c (hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; /* @@ -68,12 +68,12 @@ nh5immake_image_8bit_c (hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5imread_image_c * - * Purpose: Call H5IMread_image + * Purpose: Call H5IMread_image * * Return: Success: 0, Failure: -1 * @@ -90,9 +90,9 @@ nh5immake_image_8bit_c (hid_t_f *loc_id, */ int_f -nh5imread_image_c (hid_t_f *loc_id, +nh5imread_image_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *buf) { int ret_value = -1; @@ -106,7 +106,7 @@ nh5imread_image_c (hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; /* @@ -119,12 +119,12 @@ nh5imread_image_c (hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5immake_image_24bit_c * - * Purpose: Call H5IMmake_image_24bit + * Purpose: Call H5IMmake_image_24bit * * Return: Success: 0, Failure: -1 * @@ -141,11 +141,11 @@ nh5imread_image_c (hid_t_f *loc_id, */ int_f -nh5immake_image_24bit_c (hid_t_f *loc_id, +nh5immake_image_24bit_c (hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *ilen, - _fcd il, + _fcd il, hsize_t_f *width, hsize_t_f *height, void *buf) @@ -162,11 +162,11 @@ nh5immake_image_24bit_c (hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; c_ilen = *ilen; - c_il = (char *)HD5f2cstring(il, c_ilen); + c_il = (char *)HD5f2cstring(il, c_ilen); if (c_il == NULL) return ret_value; /* @@ -179,12 +179,12 @@ nh5immake_image_24bit_c (hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5imget_image_info_c * - * Purpose: Call H5IMget_image_info + * Purpose: Call H5IMget_image_info * * Return: Success: 0, Failure: -1 * @@ -201,7 +201,7 @@ nh5immake_image_24bit_c (hid_t_f *loc_id, */ int_f -nh5imget_image_info_c(hid_t_f *loc_id, +nh5imget_image_info_c(hid_t_f *loc_id, int_f *namelen, _fcd name, hsize_t_f *width, @@ -226,7 +226,7 @@ nh5imget_image_info_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; /* @@ -239,14 +239,14 @@ nh5imget_image_info_c(hid_t_f *loc_id, * Call H5IMget_image_info function. */ c_loc_id = (hid_t)*loc_id; - + ret = H5IMget_image_info(c_loc_id,c_name,&c_width,&c_height,&c_planes,c_buf,&c_npals); *width = (hsize_t_f) c_width; *height = (hsize_t_f) c_height; *planes = (hsize_t_f) c_planes; *npals = (hsize_t_f) c_npals; - + /* * Convert C name to FORTRAN and place it in the given buffer @@ -254,11 +254,11 @@ nh5imget_image_info_c(hid_t_f *loc_id, HD5packFstring(c_buf, _fcdtocp(interlace), (size_t)*ilen); if(c_buf) free(c_buf); - + if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- @@ -281,7 +281,7 @@ nh5imget_image_info_c(hid_t_f *loc_id, */ int_f -nh5imis_image_c(hid_t_f *loc_id, +nh5imis_image_c(hid_t_f *loc_id, int_f *namelen, _fcd name) { @@ -293,7 +293,7 @@ nh5imis_image_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return -1; /* @@ -302,14 +302,14 @@ nh5imis_image_c(hid_t_f *loc_id, c_loc_id = (hid_t)*loc_id; return( H5IMis_image(c_loc_id, c_name)); - -} + +} /*------------------------------------------------------------------------- * Function: h5immake_palette_c * - * Purpose: Call H5IMmake_palette + * Purpose: Call H5IMmake_palette * * Return: Success: 0, Failure: -1 * @@ -326,9 +326,9 @@ nh5imis_image_c(hid_t_f *loc_id, */ int_f -nh5immake_palette_c (hid_t_f *loc_id, +nh5immake_palette_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, hsize_t_f *dims, void *buf) { @@ -345,7 +345,7 @@ nh5immake_palette_c (hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; c_dims = malloc(sizeof(hsize_t) * (rank )); @@ -367,13 +367,13 @@ nh5immake_palette_c (hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5imlink_palette_c * - * Purpose: Call H5IMlink_palette + * Purpose: Call H5IMlink_palette * * Return: Success: 0, Failure: -1 * @@ -390,9 +390,9 @@ nh5immake_palette_c (hid_t_f *loc_id, */ int_f -nh5imlink_palette_c (hid_t_f *loc_id, +nh5imlink_palette_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *ilen, _fcd pal_name) { @@ -409,11 +409,11 @@ nh5imlink_palette_c (hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; c_namelenpal = *ilen; - c_namepal = (char *)HD5f2cstring(pal_name, c_namelenpal); + c_namepal = (char *)HD5f2cstring(pal_name, c_namelenpal); if (c_namepal == NULL) return ret_value; /* @@ -427,13 +427,13 @@ nh5imlink_palette_c (hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5imunlink_palette_c * - * Purpose: Call H5IMunlink_palette + * Purpose: Call H5IMunlink_palette * * Return: Success: 0, Failure: -1 * @@ -450,9 +450,9 @@ nh5imlink_palette_c (hid_t_f *loc_id, */ int_f -nh5imunlink_palette_c (hid_t_f *loc_id, +nh5imunlink_palette_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *ilen, _fcd pal_name) { @@ -469,11 +469,11 @@ nh5imunlink_palette_c (hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; c_namelenpal = *ilen; - c_namepal = (char *)HD5f2cstring(pal_name, c_namelenpal); + c_namepal = (char *)HD5f2cstring(pal_name, c_namelenpal); if (c_namepal == NULL) return ret_value; /* @@ -487,14 +487,14 @@ nh5imunlink_palette_c (hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} - +} + /*------------------------------------------------------------------------- * Function: h5imget_npalettes_c * - * Purpose: Call H5IMget_npalettes + * Purpose: Call H5IMget_npalettes * * Return: Success: 0, Failure: -1 * @@ -511,7 +511,7 @@ nh5imunlink_palette_c (hid_t_f *loc_id, */ int_f -nh5imget_npalettes_c(hid_t_f *loc_id, +nh5imget_npalettes_c(hid_t_f *loc_id, int_f *namelen, _fcd name, hsize_t_f *npals) @@ -527,7 +527,7 @@ nh5imget_npalettes_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; /* @@ -538,18 +538,18 @@ nh5imget_npalettes_c(hid_t_f *loc_id, ret = H5IMget_npalettes(c_loc_id,c_name,&c_npals); *npals = (hsize_t_f) c_npals; - + if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5imget_palette_info_c * - * Purpose: Call H5IMget_palette_info + * Purpose: Call H5IMget_palette_info * * Return: Success: 0, Failure: -1 * @@ -567,7 +567,7 @@ nh5imget_npalettes_c(hid_t_f *loc_id, int_f -nh5imget_palette_info_c(hid_t_f *loc_id, +nh5imget_palette_info_c(hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *pal_number, @@ -585,7 +585,7 @@ nh5imget_palette_info_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; /* @@ -599,17 +599,17 @@ nh5imget_palette_info_c(hid_t_f *loc_id, dims[i] = (hsize_t_f) c_dims[i]; } - + if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5imget_palette_c * - * Purpose: Call H5IMget_palette + * Purpose: Call H5IMget_palette * * Return: Success: 0, Failure: -1 * @@ -627,7 +627,7 @@ nh5imget_palette_info_c(hid_t_f *loc_id, int_f -nh5imget_palette_c(hid_t_f *loc_id, +nh5imget_palette_c(hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *pal_number, @@ -643,7 +643,7 @@ nh5imget_palette_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; /* @@ -652,13 +652,13 @@ nh5imget_palette_c(hid_t_f *loc_id, c_loc_id = (hid_t)*loc_id; ret = H5IMget_palettef(c_loc_id,c_name,*pal_number,buf); - + if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} + - /*------------------------------------------------------------------------- * Function: h5imis_palette_c * @@ -679,7 +679,7 @@ nh5imget_palette_c(hid_t_f *loc_id, */ int_f -nh5imis_palette_c(hid_t_f *loc_id, +nh5imis_palette_c(hid_t_f *loc_id, int_f *namelen, _fcd name) { @@ -691,7 +691,7 @@ nh5imis_palette_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return -1; /* @@ -700,5 +700,5 @@ nh5imis_palette_c(hid_t_f *loc_id, c_loc_id = (hid_t)*loc_id; return( H5IMis_palette(c_loc_id, c_name)); - -} + +} diff --git a/hl/fortran/src/H5LTf90proto.h b/hl/fortran/src/H5LTf90proto.h index cae95cf..81c30a4 100755 --- a/hl/fortran/src/H5LTf90proto.h +++ b/hl/fortran/src/H5LTf90proto.h @@ -18,7 +18,7 @@ #include "H5public.h" #include "H5f90i.h" -#include <stdlib.h> +#include <stdlib.h> #include <string.h> @@ -82,118 +82,118 @@ H5_DLL void HD5packFstring (char *src, char *dest, size_t len); # define nh5tbget_table_info_c H5_FC_FUNC_(h5tbget_table_info_c, H5TBGET_TABLE_INFO_C) # define nh5tbget_field_info_c H5_FC_FUNC_(h5tbget_field_info_c, H5TBGET_FIELD_INFO_C) -H5_DLL +H5_DLL int_f -nh5ltmake_dataset_c (hid_t_f *loc_id, +nh5ltmake_dataset_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, - int_f *rank, + _fcd name, + int_f *rank, hsize_t_f *dims, - hid_t_f *type_id, + hid_t_f *type_id, void *buf); -H5_DLL +H5_DLL int_f -nh5ltread_dataset_c (hid_t_f *loc_id, +nh5ltread_dataset_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, - hid_t_f *type_id, + _fcd name, + hid_t_f *type_id, void *buf, hsize_t_f *dims); H5_DLL int_f -nh5ltset_attribute_int_c(hid_t_f *loc_id, +nh5ltset_attribute_int_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, size_t_f *size, void *buf); H5_DLL int_f -nh5ltset_attribute_float_c(hid_t_f *loc_id, +nh5ltset_attribute_float_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, size_t_f *size, void *buf); H5_DLL int_f -nh5ltset_attribute_double_c(hid_t_f *loc_id, +nh5ltset_attribute_double_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, size_t_f *size, void *buf); H5_DLL int_f -nh5ltset_attribute_string_c(hid_t_f *loc_id, +nh5ltset_attribute_string_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, void *buf); H5_DLL int_f -nh5ltget_attribute_int_c(hid_t_f *loc_id, +nh5ltget_attribute_int_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, void *buf); H5_DLL int_f -nh5ltget_attribute_float_c(hid_t_f *loc_id, +nh5ltget_attribute_float_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, void *buf); H5_DLL int_f -nh5ltget_attribute_double_c(hid_t_f *loc_id, +nh5ltget_attribute_double_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, void *buf); H5_DLL int_f -nh5ltget_attribute_string_c(hid_t_f *loc_id, +nh5ltget_attribute_string_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, void *buf); H5_DLL int_f -nh5ltget_dataset_ndims_c(hid_t_f *loc_id, +nh5ltget_dataset_ndims_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *rank); H5_DLL int_f -nh5ltfind_dataset_c(hid_t_f *loc_id, +nh5ltfind_dataset_c(hid_t_f *loc_id, int_f *namelen, _fcd name); H5_DLL int_f -nh5ltget_dataset_info_c(hid_t_f *loc_id, +nh5ltget_dataset_info_c(hid_t_f *loc_id, int_f *namelen, _fcd name, hsize_t_f *dims, @@ -202,35 +202,35 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id, H5_DLL int_f -nh5ltget_attribute_ndims_c(hid_t_f *loc_id, +nh5ltget_attribute_ndims_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, int_f *rank); H5_DLL int_f -nh5ltget_attribute_info_c(hid_t_f *loc_id, +nh5ltget_attribute_info_c(hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, hsize_t_f *dims, int_f *type_class, size_t_f *type_size); H5_DLL int_f -nh5ltmake_dataset_string_c (hid_t_f *loc_id, +nh5ltmake_dataset_string_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, char *buf); H5_DLL int_f -nh5ltread_dataset_string_c (hid_t_f *loc_id, +nh5ltread_dataset_string_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, char *buf); /*------------------------------------------------------------------------- @@ -240,32 +240,32 @@ nh5ltread_dataset_string_c (hid_t_f *loc_id, H5_DLL int_f -nh5immake_image_8bit_c (hid_t_f *loc_id, +nh5immake_image_8bit_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, hsize_t_f *width, - hsize_t_f *height, + hsize_t_f *height, int_f *buf); H5_DLL int_f -nh5imread_image_c (hid_t_f *loc_id, +nh5imread_image_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *buf); H5_DLL int_f -nh5immake_image_24bit_c (hid_t_f *loc_id, +nh5immake_image_24bit_c (hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *ilen, - _fcd il, + _fcd il, hsize_t_f *width, hsize_t_f *height, void *buf); H5_DLL int_f -nh5imget_image_info_c(hid_t_f *loc_id, +nh5imget_image_info_c(hid_t_f *loc_id, int_f *namelen, _fcd name, hsize_t_f *width, @@ -278,38 +278,38 @@ nh5imget_image_info_c(hid_t_f *loc_id, H5_DLL int_f -nh5imis_image_c(hid_t_f *loc_id, +nh5imis_image_c(hid_t_f *loc_id, int_f *namelen, _fcd name); H5_DLL int_f -nh5immake_palette_c (hid_t_f *loc_id, +nh5immake_palette_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, hsize_t_f *dims, void *buf); H5_DLL int_f -nh5imlink_palette_c (hid_t_f *loc_id, +nh5imlink_palette_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *ilen, _fcd pal_name); H5_DLL int_f -nh5imunlink_palette_c (hid_t_f *loc_id, +nh5imunlink_palette_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *ilen, _fcd pal_name); H5_DLL int_f -nh5imget_npalettes_c(hid_t_f *loc_id, +nh5imget_npalettes_c(hid_t_f *loc_id, int_f *namelen, _fcd name, hsize_t_f *npals); @@ -317,7 +317,7 @@ nh5imget_npalettes_c(hid_t_f *loc_id, H5_DLL int_f -nh5imget_palette_info_c(hid_t_f *loc_id, +nh5imget_palette_info_c(hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *pal_number, @@ -325,7 +325,7 @@ nh5imget_palette_info_c(hid_t_f *loc_id, H5_DLL int_f -nh5imget_palette_c(hid_t_f *loc_id, +nh5imget_palette_c(hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *pal_number, @@ -333,7 +333,7 @@ nh5imget_palette_c(hid_t_f *loc_id, H5_DLL int_f -nh5imis_palette_c(hid_t_f *loc_id, +nh5imis_palette_c(hid_t_f *loc_id, int_f *namelen, _fcd name); @@ -348,9 +348,9 @@ H5_DLL int_f nh5tbmake_table_c(int_f *namelen1, _fcd name1, - hid_t_f *loc_id, + hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, @@ -363,9 +363,9 @@ nh5tbmake_table_c(int_f *namelen1, H5_DLL int_f -nh5tbwrite_field_name_c(hid_t_f *loc_id, +nh5tbwrite_field_name_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *namelen1, _fcd field_name, hsize_t_f *start, @@ -375,9 +375,9 @@ nh5tbwrite_field_name_c(hid_t_f *loc_id, H5_DLL int_f -nh5tbread_field_name_c(hid_t_f *loc_id, +nh5tbread_field_name_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *namelen1, _fcd field_name, hsize_t_f *start, @@ -387,9 +387,9 @@ nh5tbread_field_name_c(hid_t_f *loc_id, H5_DLL int_f -nh5tbwrite_field_index_c(hid_t_f *loc_id, +nh5tbwrite_field_index_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *field_index, hsize_t_f *start, hsize_t_f *nrecords, @@ -398,9 +398,9 @@ nh5tbwrite_field_index_c(hid_t_f *loc_id, H5_DLL int_f -nh5tbread_field_index_c(hid_t_f *loc_id, +nh5tbread_field_index_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *field_index, hsize_t_f *start, hsize_t_f *nrecords, @@ -409,7 +409,7 @@ nh5tbread_field_index_c(hid_t_f *loc_id, H5_DLL int_f -nh5tbinsert_field_c(hid_t_f *loc_id, +nh5tbinsert_field_c(hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *namelen1, @@ -420,7 +420,7 @@ nh5tbinsert_field_c(hid_t_f *loc_id, H5_DLL int_f -nh5tbdelete_field_c(hid_t_f *loc_id, +nh5tbdelete_field_c(hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *namelen1, @@ -429,17 +429,17 @@ nh5tbdelete_field_c(hid_t_f *loc_id, H5_DLL int_f -nh5tbget_table_info_c(hid_t_f *loc_id, +nh5tbget_table_info_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords); H5_DLL int_f -nh5tbget_field_info_c(hid_t_f *loc_id, +nh5tbget_field_info_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, hsize_t_f *nfields, size_t_f *field_sizes, size_t_f *field_offsets, diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c index 6078b23..693eca9 100755 --- a/hl/fortran/src/H5LTfc.c +++ b/hl/fortran/src/H5LTfc.c @@ -22,7 +22,7 @@ /*------------------------------------------------------------------------- * Function: H5LTmake_dataset_c * - * Purpose: Call H5LTmake_dataset + * Purpose: Call H5LTmake_dataset * * Return: Success: 0, Failure: -1 * @@ -39,12 +39,12 @@ */ int_f -nh5ltmake_dataset_c (hid_t_f *loc_id, +nh5ltmake_dataset_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, - int_f *rank, + _fcd name, + int_f *rank, hsize_t_f *dims, - hid_t_f *type_id, + hid_t_f *type_id, void *buf) { int ret_value = -1; @@ -60,7 +60,7 @@ nh5ltmake_dataset_c (hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; c_dims = malloc(sizeof(hsize_t) * (*rank )); @@ -82,17 +82,17 @@ nh5ltmake_dataset_c (hid_t_f *loc_id, ret = H5LTmake_dataset(c_loc_id, c_name, *rank, c_dims, c_type_id, buf ); free (c_dims); - + if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: H5LTread_dataset_c * - * Purpose: Call H5LTmake_dataset + * Purpose: Call H5LTmake_dataset * * Return: Success: 0, Failure: -1 * @@ -109,10 +109,10 @@ nh5ltmake_dataset_c (hid_t_f *loc_id, */ int_f -nh5ltread_dataset_c (hid_t_f *loc_id, +nh5ltread_dataset_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, - hid_t_f *type_id, + _fcd name, + hid_t_f *type_id, void *buf, hsize_t_f *dims) { @@ -127,7 +127,7 @@ nh5ltread_dataset_c (hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; /* @@ -141,13 +141,13 @@ nh5ltread_dataset_c (hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: H5LTmake_dataset_string_c * - * Purpose: Call H5LTmake_dataset + * Purpose: Call H5LTmake_dataset * * Return: Success: 0, Failure: -1 * @@ -164,9 +164,9 @@ nh5ltread_dataset_c (hid_t_f *loc_id, */ int_f -nh5ltmake_dataset_string_c (hid_t_f *loc_id, +nh5ltmake_dataset_string_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, char *buf) { int ret_value = -1; @@ -179,7 +179,7 @@ nh5ltmake_dataset_string_c (hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; /* @@ -192,13 +192,13 @@ nh5ltmake_dataset_string_c (hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: H5LTread_dataset_string_c * - * Purpose: Call H5LTread_dataset_string + * Purpose: Call H5LTread_dataset_string * * Return: Success: 0, Failure: -1 * @@ -215,9 +215,9 @@ nh5ltmake_dataset_string_c (hid_t_f *loc_id, */ int_f -nh5ltread_dataset_string_c (hid_t_f *loc_id, +nh5ltread_dataset_string_c (hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, char *buf) { int ret_value = -1; @@ -230,7 +230,7 @@ nh5ltread_dataset_string_c (hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; /* @@ -243,14 +243,14 @@ nh5ltread_dataset_string_c (hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} - +} + /*------------------------------------------------------------------------- * Function: H5LTset_attribute_int_c * - * Purpose: Call H5LTset_attribute_int + * Purpose: Call H5LTset_attribute_int * * Return: Success: 0, Failure: -1 * @@ -267,11 +267,11 @@ nh5ltread_dataset_string_c (hid_t_f *loc_id, */ int_f -nh5ltset_attribute_int_c(hid_t_f *loc_id, +nh5ltset_attribute_int_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, size_t_f *size, void *buf) { @@ -288,11 +288,11 @@ nh5ltset_attribute_int_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); + c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; c_attrnamelen = (int)*attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; /* @@ -301,7 +301,7 @@ nh5ltset_attribute_int_c(hid_t_f *loc_id, c_loc_id = (hid_t)*loc_id; c_size = (size_t)*size; - if (sizeof(int_f) == sizeof(int)) + if (sizeof(int_f) == sizeof(int)) ret = H5LTset_attribute_int(c_loc_id,c_name,c_attrname,buf,c_size); else if (sizeof(int_f) == sizeof(long)) ret = H5LTset_attribute_long(c_loc_id,c_name,c_attrname,buf,c_size); @@ -313,7 +313,7 @@ nh5ltset_attribute_int_c(hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: H5LTset_attribute_float_c @@ -335,11 +335,11 @@ nh5ltset_attribute_int_c(hid_t_f *loc_id, */ int_f -nh5ltset_attribute_float_c(hid_t_f *loc_id, +nh5ltset_attribute_float_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, size_t_f *size, void *buf) { @@ -356,11 +356,11 @@ nh5ltset_attribute_float_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); + c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; c_attrnamelen = *attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; /* @@ -370,11 +370,11 @@ nh5ltset_attribute_float_c(hid_t_f *loc_id, c_size = (size_t)*size; ret = H5LTset_attribute_float(c_loc_id,c_name,c_attrname,buf,c_size); - + if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- @@ -397,11 +397,11 @@ nh5ltset_attribute_float_c(hid_t_f *loc_id, */ int_f -nh5ltset_attribute_double_c(hid_t_f *loc_id, +nh5ltset_attribute_double_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, size_t_f *size, void *buf) { @@ -418,11 +418,11 @@ nh5ltset_attribute_double_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); + c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; c_attrnamelen = *attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; /* @@ -432,11 +432,11 @@ nh5ltset_attribute_double_c(hid_t_f *loc_id, c_size = (size_t)*size; ret = H5LTset_attribute_double(c_loc_id,c_name,c_attrname,buf,c_size); - + if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: H5LTset_attribute_string_c @@ -458,11 +458,11 @@ nh5ltset_attribute_double_c(hid_t_f *loc_id, */ int_f -nh5ltset_attribute_string_c(hid_t_f *loc_id, +nh5ltset_attribute_string_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, void *buf) { int ret_value = -1; @@ -477,11 +477,11 @@ nh5ltset_attribute_string_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); + c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; c_attrnamelen = *attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; /* @@ -490,16 +490,16 @@ nh5ltset_attribute_string_c(hid_t_f *loc_id, c_loc_id = (hid_t)*loc_id; ret = H5LTset_attribute_string(c_loc_id,c_name,c_attrname,buf); - + if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: H5LTget_attribute_int_c * - * Purpose: Call H5LTget_attribute_int + * Purpose: Call H5LTget_attribute_int * * Return: Success: 0, Failure: -1 * @@ -516,11 +516,11 @@ nh5ltset_attribute_string_c(hid_t_f *loc_id, */ int_f -nh5ltget_attribute_int_c(hid_t_f *loc_id, +nh5ltget_attribute_int_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, void *buf) { int ret_value = -1; @@ -535,18 +535,18 @@ nh5ltget_attribute_int_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); + c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; c_attrnamelen = (int)*attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; /* * Call H5LTget_attribute_int function. */ c_loc_id = (hid_t)*loc_id; - + if(sizeof(int_f) == sizeof(int)) ret = H5LTget_attribute_int(c_loc_id,c_name,c_attrname,buf); else if (sizeof(int_f) == sizeof(long)) @@ -555,17 +555,17 @@ nh5ltget_attribute_int_c(hid_t_f *loc_id, ret = H5LTget_attribute_long_long(c_loc_id,c_name,c_attrname,buf); else return ret_value; - + if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: H5LTget_attribute_float_c * - * Purpose: Call H5LTget_attribute_float + * Purpose: Call H5LTget_attribute_float * * Return: Success: 0, Failure: -1 * @@ -582,11 +582,11 @@ nh5ltget_attribute_int_c(hid_t_f *loc_id, */ int_f -nh5ltget_attribute_float_c(hid_t_f *loc_id, +nh5ltget_attribute_float_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, void *buf) { int ret_value = -1; @@ -601,11 +601,11 @@ nh5ltget_attribute_float_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); + c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; c_attrnamelen = (int)*attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; /* @@ -614,16 +614,16 @@ nh5ltget_attribute_float_c(hid_t_f *loc_id, c_loc_id = (hid_t)*loc_id; ret = H5LTget_attribute_float(c_loc_id,c_name,c_attrname,buf); - + if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: H5LTget_attribute_double_c * - * Purpose: Call H5LTget_attribute_double + * Purpose: Call H5LTget_attribute_double * * Return: Success: 0, Failure: -1 * @@ -640,11 +640,11 @@ nh5ltget_attribute_float_c(hid_t_f *loc_id, */ int_f -nh5ltget_attribute_double_c(hid_t_f *loc_id, +nh5ltget_attribute_double_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, void *buf) { int ret_value = -1; @@ -659,11 +659,11 @@ nh5ltget_attribute_double_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); + c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; c_attrnamelen = (int)*attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; /* @@ -672,16 +672,16 @@ nh5ltget_attribute_double_c(hid_t_f *loc_id, c_loc_id = (hid_t)*loc_id; ret = H5LTget_attribute_double(c_loc_id,c_name,c_attrname,buf); - + if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: H5LTget_attribute_string_c * - * Purpose: Call H5LTget_attribute_string + * Purpose: Call H5LTget_attribute_string * * Return: Success: 0, Failure: -1 * @@ -698,11 +698,11 @@ nh5ltget_attribute_double_c(hid_t_f *loc_id, */ int_f -nh5ltget_attribute_string_c(hid_t_f *loc_id, +nh5ltget_attribute_string_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, void *buf) { int ret_value = -1; @@ -717,11 +717,11 @@ nh5ltget_attribute_string_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); + c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; c_attrnamelen = (int)*attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; /* @@ -730,17 +730,17 @@ nh5ltget_attribute_string_c(hid_t_f *loc_id, c_loc_id = (hid_t)*loc_id; ret = H5LTget_attribute_string(c_loc_id,c_name,c_attrname,buf); - + if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: H5LTget_dataset_ndims_c * - * Purpose: Call H5LTget_dataset_ndims + * Purpose: Call H5LTget_dataset_ndims * * Return: Success: 0, Failure: -1 * @@ -757,9 +757,9 @@ nh5ltget_attribute_string_c(hid_t_f *loc_id, */ int_f -nh5ltget_dataset_ndims_c(hid_t_f *loc_id, +nh5ltget_dataset_ndims_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *rank) { int ret_value = -1; @@ -773,7 +773,7 @@ nh5ltget_dataset_ndims_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; /* @@ -782,12 +782,12 @@ nh5ltget_dataset_ndims_c(hid_t_f *loc_id, c_loc_id = (hid_t)*loc_id; ret = H5LTget_dataset_ndims(c_loc_id, c_name, &c_rank); - + if (ret < 0) return ret_value; *rank = (int_f)c_rank; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- @@ -810,7 +810,7 @@ nh5ltget_dataset_ndims_c(hid_t_f *loc_id, */ int_f -nh5ltfind_dataset_c(hid_t_f *loc_id, +nh5ltfind_dataset_c(hid_t_f *loc_id, int_f *namelen, _fcd name) { @@ -822,7 +822,7 @@ nh5ltfind_dataset_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return -1; /* @@ -831,13 +831,13 @@ nh5ltfind_dataset_c(hid_t_f *loc_id, c_loc_id = (hid_t)*loc_id; return( H5LTfind_dataset(c_loc_id, c_name)); - -} + +} /*------------------------------------------------------------------------- * Function: h5ltget_dataset_info_c * - * Purpose: Call H5LTget_dataset_info + * Purpose: Call H5LTget_dataset_info * * Return: Success: 0, Failure: -1 * @@ -854,7 +854,7 @@ nh5ltfind_dataset_c(hid_t_f *loc_id, */ int_f -nh5ltget_dataset_info_c(hid_t_f *loc_id, +nh5ltget_dataset_info_c(hid_t_f *loc_id, int_f *namelen, _fcd name, hsize_t_f *dims, @@ -875,7 +875,7 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; /* @@ -891,16 +891,16 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id, dims[i] = (hsize_t_f) c_dims[i]; } - + if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5ltget_attribute_ndims_c * - * Purpose: Call H5LTget_attribute_ndims + * Purpose: Call H5LTget_attribute_ndims * * Return: Success: 0, Failure: -1 * @@ -917,11 +917,11 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id, */ int_f -nh5ltget_attribute_ndims_c(hid_t_f *loc_id, +nh5ltget_attribute_ndims_c(hid_t_f *loc_id, int_f *namelen, - _fcd dsetname, + _fcd dsetname, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, int_f *rank) { int ret_value = -1; @@ -937,11 +937,11 @@ nh5ltget_attribute_ndims_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen =(int) *namelen; - c_name = (char *)HD5f2cstring(dsetname, c_namelen); + c_name = (char *)HD5f2cstring(dsetname, c_namelen); if (c_name == NULL) return ret_value; c_attrnamelen = (int)*attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; /* @@ -950,18 +950,18 @@ nh5ltget_attribute_ndims_c(hid_t_f *loc_id, c_loc_id = (hid_t)*loc_id; ret = H5LTget_attribute_ndims(c_loc_id,c_name,c_attrname,&c_rank); - + if (ret < 0) return ret_value; *rank = (int_f)c_rank; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5ltget_attribute_info_c * - * Purpose: Call H5LTget_attribute_info + * Purpose: Call H5LTget_attribute_info * * Return: Success: 0, Failure: -1 * @@ -978,11 +978,11 @@ nh5ltget_attribute_ndims_c(hid_t_f *loc_id, */ int_f -nh5ltget_attribute_info_c(hid_t_f *loc_id, +nh5ltget_attribute_info_c(hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *attrnamelen, - _fcd attrname, + _fcd attrname, hsize_t_f *dims, int_f *type_class, size_t_f *type_size) @@ -1003,11 +1003,11 @@ nh5ltget_attribute_info_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = (int)*namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; c_attrnamelen = (int)*attrnamelen; - c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); + c_attrname = (char *)HD5f2cstring(attrname, c_attrnamelen); if (c_attrname == NULL) return ret_value; /* @@ -1023,8 +1023,8 @@ nh5ltget_attribute_info_c(hid_t_f *loc_id, dims[i] = (hsize_t_f) c_dims[i]; } - + if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c index 6af79db..56515b1 100755 --- a/hl/fortran/src/H5TBfc.c +++ b/hl/fortran/src/H5TBfc.c @@ -20,7 +20,7 @@ /*------------------------------------------------------------------------- * Function: h5tbmake_table_c * - * Purpose: Call H5TBmake_table + * Purpose: Call H5TBmake_table * * Return: Success: 0, Failure: -1 * @@ -38,9 +38,9 @@ int_f nh5tbmake_table_c(int_f *namelen1, _fcd name1, - hid_t_f *loc_id, + hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, @@ -66,7 +66,7 @@ nh5tbmake_table_c(int_f *namelen1, hsize_t c_chunk_size = *chunk_size; size_t c_type_size = *type_size; size_t *c_field_offset; - hid_t *c_field_types; + hid_t *c_field_types; char **c_field_names; char *tmp, *tmp_p; @@ -80,11 +80,11 @@ nh5tbmake_table_c(int_f *namelen1, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(name1, c_namelen1); + c_name1 = (char *)HD5f2cstring(name1, c_namelen1); if (c_name1 == NULL) return ret_value; c_field_offset = (size_t*)malloc(sizeof(size_t) * (size_t)c_nfields); @@ -101,12 +101,12 @@ nh5tbmake_table_c(int_f *namelen1, /* * Allocate array of character pointers */ - c_field_names = (char **)malloc((size_t)num_elem * sizeof(char *)); + c_field_names = (char **)malloc((size_t)num_elem * sizeof(char *)); if (c_field_names == NULL) return ret_value; /* Copy data to long C string */ tmp = (char *)HD5f2cstring(field_names, (int)(max_len*num_elem)); - if (tmp == NULL) { + if (tmp == NULL) { free(c_field_names); return ret_value; } @@ -118,7 +118,7 @@ nh5tbmake_table_c(int_f *namelen1, for (i=0; i < num_elem; i++) { c_field_names[i] = (char *) malloc((size_t)namelen2[i]+1); memcpy(c_field_names[i], tmp_p, (size_t)namelen2[i]); - c_field_names[i][namelen2[i]] = '\0'; + c_field_names[i][namelen2[i]] = '\0'; tmp_p = tmp_p + max_len; } @@ -140,7 +140,7 @@ nh5tbmake_table_c(int_f *namelen1, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} @@ -148,7 +148,7 @@ nh5tbmake_table_c(int_f *namelen1, /*------------------------------------------------------------------------- * Function: h5tbwrite_field_name_c * - * Purpose: Call H5TBwrite_fields_name + * Purpose: Call H5TBwrite_fields_name * * Return: Success: 0, Failure: -1 * @@ -165,15 +165,15 @@ nh5tbmake_table_c(int_f *namelen1, */ int_f -nh5tbwrite_field_name_c(hid_t_f *loc_id, +nh5tbwrite_field_name_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *namelen1, _fcd field_name, hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, - void *buf) + void *buf) { int ret_value = -1; herr_t ret; @@ -194,11 +194,11 @@ nh5tbwrite_field_name_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); + c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); if (c_name1 == NULL) return ret_value; /* @@ -211,13 +211,13 @@ nh5tbwrite_field_name_c(hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5tbread_field_name_c * - * Purpose: Call H5TBread_fields_name + * Purpose: Call H5TBread_fields_name * * Return: Success: 0, Failure: -1 * @@ -234,15 +234,15 @@ nh5tbwrite_field_name_c(hid_t_f *loc_id, */ int_f -nh5tbread_field_name_c(hid_t_f *loc_id, +nh5tbread_field_name_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *namelen1, _fcd field_name, hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, - void *buf) + void *buf) { int ret_value = -1; herr_t ret; @@ -263,11 +263,11 @@ nh5tbread_field_name_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); + c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); if (c_name1 == NULL) return ret_value; /* @@ -280,14 +280,14 @@ nh5tbread_field_name_c(hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5tbwrite_field_index_c * - * Purpose: Call H5TBwrite_fields_index + * Purpose: Call H5TBwrite_fields_index * * Return: Success: 0, Failure: -1 * @@ -304,14 +304,14 @@ nh5tbread_field_name_c(hid_t_f *loc_id, */ int_f -nh5tbwrite_field_index_c(hid_t_f *loc_id, +nh5tbwrite_field_index_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *field_index, hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, - void *buf) + void *buf) { int ret_value = -1; herr_t ret; @@ -332,7 +332,7 @@ nh5tbwrite_field_index_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; @@ -346,13 +346,13 @@ nh5tbwrite_field_index_c(hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5tbread_field_index_c * - * Purpose: Call H5TBread_fields_index + * Purpose: Call H5TBread_fields_index * * Return: Success: 0, Failure: -1 * @@ -369,14 +369,14 @@ nh5tbwrite_field_index_c(hid_t_f *loc_id, */ int_f -nh5tbread_field_index_c(hid_t_f *loc_id, +nh5tbread_field_index_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, int_f *field_index, hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, - void *buf) + void *buf) { int ret_value = -1; herr_t ret; @@ -397,7 +397,7 @@ nh5tbread_field_index_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; /* @@ -410,13 +410,13 @@ nh5tbread_field_index_c(hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5tbinsert_field_c * - * Purpose: Call H5TBinsert_field + * Purpose: Call H5TBinsert_field * * Return: Success: 0, Failure: -1 * @@ -431,16 +431,16 @@ nh5tbread_field_index_c(hid_t_f *loc_id, * *------------------------------------------------------------------------- */ - + int_f -nh5tbinsert_field_c(hid_t_f *loc_id, +nh5tbinsert_field_c(hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *namelen1, _fcd field_name, hid_t_f *field_type, int_f *position, - void *buf) + void *buf) { int ret_value = -1; herr_t ret; @@ -456,11 +456,11 @@ nh5tbinsert_field_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); + c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); if (c_name1 == NULL) return ret_value; /* @@ -472,13 +472,13 @@ nh5tbinsert_field_c(hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5tbdelete_field_c * - * Purpose: Call H5TBdelete_field + * Purpose: Call H5TBdelete_field * * Return: Success: 0, Failure: -1 * @@ -493,13 +493,13 @@ nh5tbinsert_field_c(hid_t_f *loc_id, * *------------------------------------------------------------------------- */ - + int_f -nh5tbdelete_field_c(hid_t_f *loc_id, +nh5tbdelete_field_c(hid_t_f *loc_id, int_f *namelen, _fcd name, int_f *namelen1, - _fcd field_name) + _fcd field_name) { int ret_value = -1; herr_t ret; @@ -513,11 +513,11 @@ nh5tbdelete_field_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; c_namelen1 = *namelen1; - c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); + c_name1 = (char *)HD5f2cstring(field_name, c_namelen1); if (c_name1 == NULL) return ret_value; /* @@ -529,14 +529,14 @@ nh5tbdelete_field_c(hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} - +} + /*------------------------------------------------------------------------- * Function: h5tbget_table_info_c * - * Purpose: Call H5TBread_fields_index + * Purpose: Call H5TBread_fields_index * * Return: Success: 0, Failure: -1 * @@ -553,11 +553,11 @@ nh5tbdelete_field_c(hid_t_f *loc_id, */ int_f -nh5tbget_table_info_c(hid_t_f *loc_id, +nh5tbget_table_info_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, hsize_t_f *nfields, - hsize_t_f *nrecords) + hsize_t_f *nrecords) { int ret_value = -1; herr_t ret; @@ -571,7 +571,7 @@ nh5tbget_table_info_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; /* @@ -586,14 +586,14 @@ nh5tbget_table_info_c(hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} /*------------------------------------------------------------------------- * Function: h5tbget_field_info_c * - * Purpose: Call H5TBget_field_info + * Purpose: Call H5TBget_field_info * * Return: Success: 0, Failure: -1 * @@ -609,16 +609,16 @@ nh5tbget_table_info_c(hid_t_f *loc_id, *------------------------------------------------------------------------- */ int_f -nh5tbget_field_info_c(hid_t_f *loc_id, +nh5tbget_field_info_c(hid_t_f *loc_id, int_f *namelen, - _fcd name, + _fcd name, hsize_t_f *nfields, size_t_f *field_sizes, size_t_f *field_offsets, size_t_f *type_size, int_f *namelen2, /* field_names lenghts */ _fcd field_names) /* field_names */ - + { int ret_value = -1; herr_t ret; @@ -647,7 +647,7 @@ nh5tbget_field_info_c(hid_t_f *loc_id, * Convert FORTRAN name to C name */ c_namelen = *namelen; - c_name = (char *)HD5f2cstring(name, c_namelen); + c_name = (char *)HD5f2cstring(name, c_namelen); if (c_name == NULL) return ret_value; @@ -659,7 +659,7 @@ nh5tbget_field_info_c(hid_t_f *loc_id, c_field_names = malloc( sizeof(char*) * (size_t)c_nfields ); if (!c_field_names) return ret_value; - for ( i = 0; i < c_nfields; i++) + for ( i = 0; i < c_nfields; i++) { c_field_names[i] = malloc( sizeof(char) * HLTB_MAX_FIELD_LEN ); } @@ -683,12 +683,12 @@ nh5tbget_field_info_c(hid_t_f *loc_id, namelen2[i] = (int_f)strlen(c_field_names[i]); length = MAX(length, strlen(c_field_names[i])); tmp_p = tmp_p + c_lenmax; - } + } HD5packFstring(tmp, _fcdtocp(field_names), (int)(c_lenmax*c_nfields)); *type_size = (size_t_f)c_type_size; - for (i=0; i < num_elem; i++) + for (i=0; i < num_elem; i++) { field_sizes[i] = (size_t_f)c_field_sizes[i]; field_offsets[i] = (size_t_f)c_field_offsets[i]; @@ -709,5 +709,5 @@ nh5tbget_field_info_c(hid_t_f *loc_id, if (ret < 0) return ret_value; ret_value = 0; return ret_value; -} +} diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index fbf7f19..b77b97f 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -22,7 +22,7 @@ /*------------------------------------------------------------------------- * Function: H5DSset_scale * - * Purpose: Convert dataset DSID to a dimension scale, by writing the standard + * Purpose: Convert dataset DSID to a dimension scale, by writing the standard * attributes for a Dimension Scale dataset; optionally set its name * * Return: Success: SUCCESS, Failure: FAIL @@ -38,9 +38,9 @@ *------------------------------------------------------------------------- */ -herr_t H5DSset_scale(hid_t dsid, - char *dimname) -{ +herr_t H5DSset_scale(hid_t dsid, + char *dimname) +{ int has_dimlist; H5I_type_t it; @@ -66,12 +66,12 @@ herr_t H5DSset_scale(hid_t dsid, if (has_dimlist == 1) return FAIL; - + /*------------------------------------------------------------------------- * write the standard attributes for a Dimension Scale dataset *------------------------------------------------------------------------- */ - + if (H5LT_set_attribute_string(dsid,"CLASS",DIMENSION_SCALE_CLASS)<0) return FAIL; @@ -89,10 +89,10 @@ herr_t H5DSset_scale(hid_t dsid, /*------------------------------------------------------------------------- * Function: H5DSattach_scale * - * Purpose: attach a DS with DSID to the IDX dimension of the existing + * Purpose: attach a DS with DSID to the IDX dimension of the existing * dataset DID * - * Return: + * Return: * Success: SUCCESS * Failure: FAIL * @@ -109,8 +109,8 @@ herr_t H5DSset_scale(hid_t dsid, herr_t H5DSattach_scale(hid_t did, hid_t dsid, - unsigned int idx) -{ + unsigned int idx) +{ int has_dimlist; int has_reflist; int is_ds; @@ -130,15 +130,15 @@ herr_t H5DSattach_scale(hid_t did, H5I_type_t it1, it2; int i, len; int found_ds=0; - + /*------------------------------------------------------------------------- * parameter checking *------------------------------------------------------------------------- */ /* the dataset cannot be a DS dataset */ - if ((H5DSis_scale(did))==1) + if ((H5DSis_scale(did))==1) return FAIL; - + /* get info for the dataset in the parameter list */ if (H5Gget_objinfo(did,".",TRUE,&sb1)<0) return FAIL; @@ -148,7 +148,7 @@ herr_t H5DSattach_scale(hid_t did, return FAIL; /* same object, not valid */ - if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno) + if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno) return FAIL; /* get ID type */ @@ -172,7 +172,7 @@ herr_t H5DSattach_scale(hid_t did, /*------------------------------------------------------------------------- * The dataset may or may not have the associated DS attribute * 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 + * If it exists, the array of references is extended to hold the reference * to the new DS *------------------------------------------------------------------------- */ @@ -180,7 +180,7 @@ herr_t H5DSattach_scale(hid_t did, /* get dataset space */ if ((sid = H5Dget_space(did))<0) return FAIL; - + /* get rank */ if ((rank=H5Sget_simple_extent_ndims(sid))<0) goto out; @@ -205,15 +205,15 @@ herr_t H5DSattach_scale(hid_t did, /* create a reference for the >>DS<< dataset */ if (H5Rcreate(&ref_to_ds,dsid,".",H5R_OBJECT,-1)<0) return FAIL; - + /* create a reference for the >>data<< dataset */ if (H5Rcreate(&dsl.ref,did,".",H5R_OBJECT,-1)<0) return FAIL; - + /* try to find the attribute "DIMENSION_LIST" on the >>data<< dataset */ if ((has_dimlist = H5LT_find_attribute(did,DIMENSION_LIST))<0) return FAIL; - + /*------------------------------------------------------------------------- * it does not exist. we create the attribute and its reference data *------------------------------------------------------------------------- @@ -231,7 +231,7 @@ herr_t H5DSattach_scale(hid_t did, /* space for the attribute */ if ((sid = H5Screate_simple(1,dims,NULL))<0) return FAIL; - + /* create the type for the attribute "DIMENSION_LIST" */ if ((tid = H5Tvlen_create(H5T_STD_REF_OBJ))<0) goto out; @@ -239,7 +239,7 @@ herr_t H5DSattach_scale(hid_t did, /* create the attribute */ if ((aid = H5Acreate(did,DIMENSION_LIST,tid,sid,H5P_DEFAULT))<0) goto out; - + /* allocate and initialize the VL */ buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); @@ -251,7 +251,7 @@ herr_t H5DSattach_scale(hid_t did, buf[i].len = 0; buf[i].p = NULL; } - + /* store the REF information in the index of the dataset that has the DS */ buf[idx].len = 1; buf[idx].p = malloc( 1 * sizeof(hobj_ref_t)); @@ -260,7 +260,7 @@ herr_t H5DSattach_scale(hid_t did, /* write the attribute with the reference */ if (H5Awrite(aid,tid,buf)<0) goto out; - + /* close */ if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf)<0) goto out; @@ -275,32 +275,32 @@ herr_t H5DSattach_scale(hid_t did, free(dims); if (buf) free(buf); - + } - + /*------------------------------------------------------------------------- * the attribute already exists, open it, extend the buffer, * and insert the new reference *------------------------------------------------------------------------- */ - + else if ( has_dimlist == 1 ) { if ((aid = H5Aopen_name(did,DIMENSION_LIST))<0) goto out; - + if ((tid = H5Aget_type(aid))<0) goto out; if ((sid = H5Aget_space(aid))<0) goto out; - + /* allocate and initialize the VL */ buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); if (buf == NULL) goto out; - + /* read */ if (H5Aread(aid,tid,buf)<0) goto out; @@ -315,21 +315,21 @@ herr_t H5DSattach_scale(hid_t did, /* get the scale id for this REF */ if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref_j))<0) goto out; - + /* get info for DS in the parameter list */ if (H5Gget_objinfo(dsid,".",TRUE,&sb1)<0) goto out; - + /* get info for this DS */ if (H5Gget_objinfo(dsid_j,".",TRUE,&sb2)<0) goto out; - + /* same object, so this DS scale is already in this DIM IDX */ - if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno) + if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno) { found_ds = 1; } - + /* close the dereferenced dataset */ if (H5Dclose(dsid_j)<0) goto out; @@ -353,30 +353,30 @@ herr_t H5DSattach_scale(hid_t did, ((hobj_ref_t *)buf[idx].p)[0] = ref_to_ds; } } - + /* write the attribute with the new references */ if (H5Awrite(aid,tid,buf)<0) goto out; - + /* close */ if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf)<0) goto out; if (H5Sclose(sid)<0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid)<0) goto out; if (H5Aclose(aid)<0) goto out; if (buf) free(buf); - - } /* has_dimlist */ - + + } /* has_dimlist */ + /*------------------------------------------------------------------------- * save DS info on the >>DS<< dataset *------------------------------------------------------------------------- */ - + /* try to find the attribute "REFERENCE_LIST" on the >>DS<< dataset */ if ((has_reflist = H5LT_find_attribute(dsid,REFERENCE_LIST))<0) goto out; @@ -398,30 +398,30 @@ herr_t H5DSattach_scale(hid_t did, /* space for the attribute */ if ((sid = H5Screate_simple(1,dims,NULL))<0) goto out; - + /* create the compound datatype for the attribute "REFERENCE_LIST" */ if ((tid = H5Tcreate(H5T_COMPOUND,sizeof(ds_list_t)))<0) goto out; - + /* insert reference field */ if (H5Tinsert(tid,"dataset",HOFFSET(ds_list_t,ref),H5T_STD_REF_OBJ)<0) goto out; - + /* insert dimension idx of the dataset field */ if (H5Tinsert(tid,"dimension",HOFFSET(ds_list_t,dim_idx),H5T_NATIVE_INT)<0) goto out; - + /* create the attribute */ if ((aid = H5Acreate(dsid,REFERENCE_LIST,tid,sid,H5P_DEFAULT))<0) goto out; - + /* store the IDX information */ dsl.dim_idx = idx; - + /* write the attribute with the reference */ if (H5Awrite(aid,tid,&dsl)<0) goto out; - + /* close */ if (H5Sclose(sid)<0) goto out; @@ -438,32 +438,32 @@ herr_t H5DSattach_scale(hid_t did, * the "REFERENCE_LIST" array already exists, open it and extend it *------------------------------------------------------------------------- */ - + else if ( has_reflist == 1 ) { if ((aid = H5Aopen_name(dsid,REFERENCE_LIST))<0) goto out; - + if ((tid = H5Aget_type(aid))<0) goto out; - + /* get and save the old reference(s) */ if ((sid = H5Aget_space(aid))<0) goto out; - + if ((nelmts = H5Sget_simple_extent_npoints(sid))<0) goto out; - + nelmts++; - + dsbuf = malloc((size_t)nelmts * sizeof(ds_list_t)); if (dsbuf == NULL) goto out; - + if (H5Aread(aid,tid,dsbuf)<0) goto out; - + /* close */ if (H5Sclose(sid)<0) goto out; @@ -474,7 +474,7 @@ herr_t H5DSattach_scale(hid_t did, * create a new attribute *------------------------------------------------------------------------- */ - + /* the attribute must be deleted, in order to the new one can reflect the changes*/ if (H5Adelete(dsid,REFERENCE_LIST)<0) goto out; @@ -488,34 +488,34 @@ herr_t H5DSattach_scale(hid_t did, if (dims == NULL) goto out; dims[0] = nelmts; - + if ((sid = H5Screate_simple(1,dims,NULL))<0) goto out; if (dims) free(dims); - + /* create the attribute again with the changes of space */ if ((aid = H5Acreate(dsid,REFERENCE_LIST,tid,sid,H5P_DEFAULT))<0) goto out; - + /* write the attribute with the new references */ if (H5Awrite(aid,tid,dsbuf)<0) goto out; - + /* close */ if (H5Sclose(sid)<0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid)<0) goto out; if (H5Aclose(aid)<0) goto out; - + if (dsbuf) free(dsbuf); - - } /* has_reflist */ - + + } /* has_reflist */ + /*------------------------------------------------------------------------- * write the standard attributes for a Dimension Scale dataset *------------------------------------------------------------------------- @@ -523,7 +523,7 @@ herr_t H5DSattach_scale(hid_t did, if ((is_ds=H5DSis_scale(dsid))<0) return FAIL; - + if (is_ds == 0 ) { if (H5LT_set_attribute_string(dsid,"CLASS",DIMENSION_SCALE_CLASS)<0) @@ -531,7 +531,7 @@ herr_t H5DSattach_scale(hid_t did, } return SUCCESS; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { @@ -545,10 +545,10 @@ out: /*------------------------------------------------------------------------- * Function: H5DSdetach_scale * - * Purpose: detach a DS with DSID to the IDX dimension of the existing + * Purpose: detach a DS with DSID to the IDX dimension of the existing * dataset DID * - * Return: + * Return: * Success: SUCCESS * Failure: FAIL * @@ -565,8 +565,8 @@ out: herr_t H5DSdetach_scale(hid_t did, hid_t dsid, - unsigned int idx) -{ + unsigned int idx) +{ int has_dimlist; int has_reflist; hssize_t nelmts; @@ -584,15 +584,15 @@ herr_t H5DSdetach_scale(hid_t did, H5G_stat_t sb1, sb2, sb3, sb4; int found_dset=0, found_ds=0; H5I_type_t it1, it2; - + /*------------------------------------------------------------------------- * parameter checking *------------------------------------------------------------------------- */ /* the dataset cannot be a DS dataset */ - if ((H5DSis_scale(did))==1) + if ((H5DSis_scale(did))==1) return FAIL; - + /* get info for the dataset in the parameter list */ if (H5Gget_objinfo(did,".",TRUE,&sb1)<0) return FAIL; @@ -602,7 +602,7 @@ herr_t H5DSdetach_scale(hid_t did, return FAIL; /* same object, not valid */ - if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno) + if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno) return FAIL; /* get ID type */ @@ -629,7 +629,7 @@ herr_t H5DSdetach_scale(hid_t did, /* get dataset space */ if ((sid = H5Dget_space(did))<0) return FAIL; - + /* get rank */ if ((rank=H5Sget_simple_extent_ndims(sid))<0) goto out; @@ -650,31 +650,31 @@ herr_t H5DSdetach_scale(hid_t did, if (has_reflist == 0) return FAIL; - + /*------------------------------------------------------------------------- * open "DIMENSION_LIST", and delete the reference *------------------------------------------------------------------------- */ - + if ((aid = H5Aopen_name(did,DIMENSION_LIST))<0) return FAIL; - + if ((tid = H5Aget_type(aid))<0) goto out; - + if ((sid = H5Aget_space(aid))<0) goto out; - + /* allocate and initialize the VL */ buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); - + if (buf == NULL) goto out; - + /* read */ if (H5Aread(aid,tid,buf)<0) goto out; - + /* reset */ if ( buf[idx].len > 0 ) { @@ -682,28 +682,28 @@ herr_t H5DSdetach_scale(hid_t did, { /* get the reference */ ref = ((hobj_ref_t *)buf[idx].p)[j]; - + /* get the DS id */ if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref))<0) goto out; - + /* get info for DS in the parameter list */ if (H5Gget_objinfo(dsid,".",TRUE,&sb1)<0) goto out; - + /* get info for this DS */ if (H5Gget_objinfo(dsid_j,".",TRUE,&sb2)<0) goto out; - + /* same object, reset */ - if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno) + if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno) { for(jj=j; jj<buf[idx].len-1; jj++) { ((hobj_ref_t *)buf[idx].p)[jj] = ((hobj_ref_t *)buf[idx].p)[jj+1]; } buf[idx].len--; - + found_ds = 1; /* close the dereferenced dataset and break */ @@ -711,23 +711,23 @@ herr_t H5DSdetach_scale(hid_t did, goto out; break; } - + /* close the dereferenced dataset */ if (H5Dclose(dsid_j)<0) goto out; } /* j */ } /* if */ - + /* write the attribute */ if (H5Awrite(aid,tid,buf)<0) goto out; - + /* close */ if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf)<0) goto out; if (H5Sclose(sid)<0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid)<0) goto out; if (H5Aclose(aid)<0) goto out; @@ -742,46 +742,46 @@ herr_t H5DSdetach_scale(hid_t did, * the "REFERENCE_LIST" array exists, update *------------------------------------------------------------------------- */ - + if ((aid = H5Aopen_name(dsid,REFERENCE_LIST))<0) goto out; - + if ((tid = H5Aget_type(aid))<0) goto out; - + /* get and save the old reference(s) */ if ((sid = H5Aget_space(aid))<0) goto out; - + if ((nelmts = H5Sget_simple_extent_npoints(sid))<0) goto out; - + dsbuf = malloc((size_t)nelmts * sizeof(ds_list_t)); if (dsbuf == NULL) goto out; - + if (H5Aread(aid,tid,dsbuf)<0) goto out; - + for(i=0; i<nelmts; i++) { /* get the reference */ ref = dsbuf[i].ref; - + /* get the DS id */ if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref))<0) goto out; - + /* get info for dataset in the parameter list */ if (H5Gget_objinfo(did,".",TRUE,&sb3)<0) goto out; - + /* get info for this DS */ if (H5Gget_objinfo(dsid_j,".",TRUE,&sb4)<0) goto out; - + /* same object, reset. we want to detach only for this DIM */ - if (sb3.fileno==sb4.fileno && sb3.objno==sb4.objno && (int)idx==dsbuf[i].dim_idx) + if (sb3.fileno==sb4.fileno && sb3.objno==sb4.objno && (int)idx==dsbuf[i].dim_idx) { for(jj=i; jj<nelmts-1; jj++) { @@ -789,17 +789,17 @@ herr_t H5DSdetach_scale(hid_t did, } nelmts--; found_dset=1; - + /* close the dereferenced dataset and break */ if (H5Dclose(dsid_j)<0) goto out; break; } /* if */ - + /* close the dereferenced dataset */ if (H5Dclose(dsid_j)<0) goto out; - + } /* i */ /* close space and attribute */ @@ -807,12 +807,12 @@ herr_t H5DSdetach_scale(hid_t did, goto out; if (H5Aclose(aid)<0) goto out; - + /*------------------------------------------------------------------------- * check if we found the pointed dataset *------------------------------------------------------------------------- */ - + /* the pointed dataset must exist */ if (found_dset == 0) goto out; @@ -821,7 +821,7 @@ herr_t H5DSdetach_scale(hid_t did, * create a new attribute *------------------------------------------------------------------------- */ - + /* the attribute must be deleted, in order to the new one can reflect the changes*/ if (H5Adelete(dsid,REFERENCE_LIST)<0) goto out; @@ -834,28 +834,28 @@ herr_t H5DSdetach_scale(hid_t did, if (dims == NULL) goto out; dims[0] = nelmts; - + dsbufn = malloc((size_t)nelmts * sizeof(ds_list_t)); if (dsbufn == NULL) goto out; - + /* store the new information */ for(i=0; i<nelmts; i++) { dsbufn[i] = dsbuf[i]; } - + if ((sid = H5Screate_simple(1,dims,NULL))<0) goto out; - + /* create the attribute again with the changes of space */ if ((aid = H5Acreate(dsid,REFERENCE_LIST,tid,sid,H5P_DEFAULT))<0) goto out; - + /* write the new attribute with the new references */ if (H5Awrite(aid,tid,dsbufn)<0) goto out; - + /* close space and attribute */ if (H5Sclose(sid)<0) goto out; @@ -863,9 +863,9 @@ herr_t H5DSdetach_scale(hid_t did, goto out; } /* nelmts */ - + /* close type */ - if (H5Tclose(tid)<0) + if (H5Tclose(tid)<0) goto out; if (dsbuf) { @@ -881,33 +881,33 @@ herr_t H5DSdetach_scale(hid_t did, dims=NULL; } - + return SUCCESS; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { H5Sclose(sid); H5Aclose(aid); H5Tclose(tid); - if (dsbuf) + if (dsbuf) free(dsbuf); - if (dsbufn) + if (dsbufn) free(dsbufn); - if (dims) + if (dims) free(dims); } H5E_END_TRY; return FAIL; - + } /*------------------------------------------------------------------------- * Function: H5DSget_num_scales * - * Purpose: get the number of scales linked to the IDX dimension of dataset DID + * Purpose: get the number of scales linked to the IDX dimension of dataset DID * - * Return: - * Success: number of scales + * Return: + * Success: number of scales * Failure: FAIL * * Programmer: pvn@ncsa.uiuc.edu @@ -923,7 +923,7 @@ out: int H5DSget_num_scales(hid_t did, unsigned int idx) -{ +{ int has_dimlist; hid_t sid; /* space ID */ hid_t tid; /* attribute type ID */ @@ -943,15 +943,15 @@ int H5DSget_num_scales(hid_t did, if (H5I_DATASET!=it) return FAIL; - + /*------------------------------------------------------------------------- - * the attribute "DIMENSION_LIST" on the >>data<< dataset must exist + * the attribute "DIMENSION_LIST" on the >>data<< dataset must exist *------------------------------------------------------------------------- */ /* get dataset space */ if ((sid = H5Dget_space(did))<0) return FAIL; - + /* get rank */ if ((rank=H5Sget_simple_extent_ndims(sid))<0) goto out; @@ -973,10 +973,10 @@ int H5DSget_num_scales(hid_t did, return 0; /*------------------------------------------------------------------------- - * the attribute exists, open it + * the attribute exists, open it *------------------------------------------------------------------------- */ - + else if ( has_dimlist == 1 ) { if ((aid = H5Aopen_name(did,DIMENSION_LIST))<0) @@ -985,13 +985,13 @@ int H5DSget_num_scales(hid_t did, goto out; if ((sid = H5Aget_space(aid))<0) goto out; - + /* allocate and initialize the VL */ buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); if (buf == NULL) goto out; - + /* read */ if (H5Aread(aid,tid,buf)<0) goto out; @@ -1003,17 +1003,17 @@ int H5DSget_num_scales(hid_t did, goto out; if (H5Sclose(sid)<0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid)<0) goto out; if (H5Aclose(aid)<0) goto out; if (buf) free(buf); - - } /* has_dimlist */ + + } /* has_dimlist */ return nscales; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { @@ -1043,10 +1043,10 @@ out: *------------------------------------------------------------------------- */ -herr_t H5DSset_label(hid_t did, +herr_t H5DSset_label(hid_t did, unsigned int idx, char *label) -{ +{ int has_labels; hid_t sid; /* space ID */ hid_t tid; /* attribute type ID */ @@ -1080,7 +1080,7 @@ herr_t H5DSset_label(hid_t did, /* get dataset space */ if ((sid = H5Dget_space(did))<0) return FAIL; - + /* get rank */ if ((rank=H5Sget_simple_extent_ndims(sid))<0) goto out; @@ -1101,17 +1101,17 @@ herr_t H5DSset_label(hid_t did, /* space for the attribute */ if ((sid = H5Screate_simple(1,dims,NULL))<0) goto out; - + /* create the datatype */ if ((tid = H5Tcopy(H5T_C_S1))<0) goto out; if (H5Tset_size(tid,H5T_VARIABLE)<0) goto out; - + /* create the attribute */ if ((aid = H5Acreate(did,DIMENSION_LABELS,tid,sid,H5P_DEFAULT))<0) goto out; - + /* allocate and initialize */ buf = (char **)malloc((size_t)rank * sizeof(char *)); @@ -1120,14 +1120,14 @@ herr_t H5DSset_label(hid_t did, for(i=0; i<(unsigned int)rank; i++) buf[i] = NULL; - + /* store the label information in the required index */ buf[idx] = label; - + /* write the attribute with the label */ if (H5Awrite(aid,tid,buf)<0) goto out; - + /* close */ if (H5Sclose(sid)<0) goto out; @@ -1138,7 +1138,7 @@ herr_t H5DSset_label(hid_t did, if (buf) free(buf); } - + /*------------------------------------------------------------------------- * just insert label *------------------------------------------------------------------------- @@ -1148,29 +1148,29 @@ herr_t H5DSset_label(hid_t did, { if ((aid = H5Aopen_name(did,DIMENSION_LABELS))<0) goto out; - + if ((tid = H5Aget_type(aid))<0) goto out; - + /* allocate and initialize */ buf = (char **)malloc((size_t)rank * sizeof(char *)); if (buf == NULL) goto out; - + /* read */ if (H5Aread(aid,tid,buf)<0) goto out; /* store the label information in the required index */ buf[idx] = label; - + /* write the attribute with the new references */ if (H5Awrite(aid,tid,buf)<0) goto out; - + /* close */ - if (H5Tclose(tid)<0) + if (H5Tclose(tid)<0) goto out; if (H5Aclose(aid)<0) goto out; @@ -1193,7 +1193,7 @@ out: /*------------------------------------------------------------------------- * Function: H5DSget_label * - * Purpose: Read the label LABEL for dimension IDX of datsset DID + * Purpose: Read the label LABEL for dimension IDX of datsset DID * Up to 'size' characters are stored in 'label' followed by a '\0' string * terminator. If the label is longer than 'size'-1, * the string terminator is stored in the last position of the buffer to @@ -1211,11 +1211,11 @@ out: * *------------------------------------------------------------------------- */ -ssize_t H5DSget_label(hid_t did, +ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size) -{ +{ int has_labels; hid_t sid; /* space ID */ hid_t tid; /* attribute type ID */ @@ -1257,7 +1257,7 @@ ssize_t H5DSget_label(hid_t did, /* get dataset space */ if ((sid = H5Dget_space(did))<0) return FAIL; - + /* get rank */ if ((rank=H5Sget_simple_extent_ndims(sid))<0) goto out; @@ -1275,36 +1275,36 @@ ssize_t H5DSget_label(hid_t did, { if ((aid = H5Aopen_name(did,DIMENSION_LABELS))<0) goto out; - + if ((tid = H5Aget_type(aid))<0) goto out; - + /* allocate and initialize */ buf = (char **)malloc((size_t)rank * sizeof(char *)); if (buf == NULL) goto out; - + /* read */ if (H5Aread(aid,tid,buf)<0) goto out; - + /* get the real string length */ nbytes = HDstrlen(buf[idx]); - + /* compute the string length which will fit into the user's buffer */ copy_len = MIN(size-1, nbytes); - + /* copy all/some of the name */ if( label ) { HDmemcpy(label, buf[idx], copy_len); - + /* terminate the string */ label[copy_len]='\0'; } - + /* close */ - if (H5Tclose(tid)<0) + if (H5Tclose(tid)<0) goto out; if (H5Aclose(aid)<0) goto out; @@ -1348,10 +1348,10 @@ out: *------------------------------------------------------------------------- */ -ssize_t H5DSget_scale_name(hid_t did, +ssize_t H5DSget_scale_name(hid_t did, char *name, - size_t size) -{ + size_t size) +{ hid_t aid; /* attribute ID */ hid_t tid; /* attribute type ID */ hid_t sid; /* space ID */ @@ -1372,9 +1372,9 @@ ssize_t H5DSget_scale_name(hid_t did, if (H5I_DATASET!=it) return FAIL; - if ((H5DSis_scale(did))<=0) + if ((H5DSis_scale(did))<=0) return FAIL; - + /*------------------------------------------------------------------------- * check if the DS has a name *------------------------------------------------------------------------- @@ -1391,7 +1391,7 @@ ssize_t H5DSget_scale_name(hid_t did, * open the attribute *------------------------------------------------------------------------- */ - + if ((aid = H5Aopen_name(did,"NAME"))<0) return FAIL; @@ -1411,22 +1411,22 @@ ssize_t H5DSget_scale_name(hid_t did, buf = (char*)malloc(nbytes * sizeof(char)); if (buf == NULL) goto out; - + /* read */ if (H5Aread(aid,tid,buf)<0) goto out; /* compute the string length which will fit into the user's buffer */ copy_len = MIN(size-1, nbytes); - + /* copy all/some of the name */ if (name) { HDmemcpy(name, buf, copy_len); - + /* terminate the string */ name[copy_len]='\0'; } - + /* close */ if (H5Tclose(tid)<0) goto out; @@ -1475,8 +1475,8 @@ out: *------------------------------------------------------------------------- */ -htri_t H5DSis_scale(hid_t did) -{ +htri_t H5DSis_scale(hid_t did) +{ hid_t tid; /* attribute type ID */ hid_t aid; /* attribute ID */ herr_t has_class; /* has the "CLASS" attribute */ @@ -1506,19 +1506,19 @@ htri_t H5DSis_scale(hid_t did) { if ((aid = H5Aopen_name(did,"CLASS"))<0) goto out; - + if ((tid = H5Aget_type(aid))<0) goto out; if (H5Aread(aid,tid,buf)<0) goto out; - if( strcmp(buf,DIMENSION_SCALE_CLASS)==0) + if( strcmp(buf,DIMENSION_SCALE_CLASS)==0) is_ds = 1; else is_ds = 0; - - if (H5Tclose(tid)<0) + + if (H5Tclose(tid)<0) goto out; if (H5Aclose(aid)<0) @@ -1526,7 +1526,7 @@ htri_t H5DSis_scale(hid_t did) } return is_ds; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { @@ -1541,16 +1541,16 @@ out: /*------------------------------------------------------------------------- * Function: H5DSiterate_scales * - * Purpose: H5DSiterate_scales iterates over the scales attached to dimension dim - * of dataset dset. For each scale in the list, the visitor_data and some - * additional information, specified below, are passed to the visitor function. - * The iteration begins with the idx object in the group and the next element - * to be processed by the operator is returned in idx. If idx is NULL, then the + * Purpose: H5DSiterate_scales iterates over the scales attached to dimension dim + * of dataset dset. For each scale in the list, the visitor_data and some + * additional information, specified below, are passed to the visitor function. + * The iteration begins with the idx object in the group and the next element + * to be processed by the operator is returned in idx. If idx is NULL, then the * iterator starts at zero. * * Parameters: * - * hid_t DID; IN: the dataset + * hid_t DID; IN: the dataset * unsigned int dim; IN: the dimension of the dataset * int *idx; IN/OUT: input the index to start iterating, output the next index * to visit. If NULL, start at the first position. @@ -1560,10 +1560,10 @@ out: * Iterate over all scales of DIM, calling an application callback * with the item, key and any operator data. * - * The operator callback receives a pointer to the item , + * The operator callback receives a pointer to the item , * and the pointer to the operator data passed * in to H5SL_iterate ('op_data'). The return values from an operator are: - * A. Zero causes the iterator to continue, returning zero when all + * A. Zero causes the iterator to continue, returning zero when all * nodes of that type have been processed. * B. Positive causes the iterator to immediately return that positive * value, indicating short-circuit success. @@ -1581,10 +1581,10 @@ out: *------------------------------------------------------------------------- */ -herr_t H5DSiterate_scales(hid_t did, - unsigned int dim, - int *idx, - H5DS_iterate_t visitor, +herr_t H5DSiterate_scales(hid_t did, + unsigned int dim, + int *idx, + H5DS_iterate_t visitor, void *visitor_data ) { hid_t scale_id; @@ -1619,7 +1619,7 @@ herr_t H5DSiterate_scales(hid_t did, /* get dataset space */ if ((sid = H5Dget_space(did))<0) return FAIL; - + /* get rank */ if ((rank=H5Sget_simple_extent_ndims(sid))<0) goto out; @@ -1643,22 +1643,22 @@ herr_t H5DSiterate_scales(hid_t did, goto out; if ((sid = H5Aget_space(aid))<0) goto out; - + /* allocate and initialize the VL */ buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); if (buf == NULL) goto out; - + /* read */ if (H5Aread(aid,tid,buf)<0) goto out; - + if ( buf[dim].len > 0 ) { if (idx!=NULL) j_idx = *idx; - else + else j_idx=0; /* iterate */ @@ -1673,15 +1673,15 @@ herr_t H5DSiterate_scales(hid_t did, if ((scale_id = H5Rdereference(did,H5R_OBJECT,&ref))<0) goto out; } H5E_END_TRY; - + if((ret_value=(visitor)(did,dim,scale_id,visitor_data))!=0) { /* set the return IDX OUT value at current scale index and break */ - if (idx!=NULL) + if (idx!=NULL) { *idx = i; } - + /* close the DS id */ if (H5Dclose(scale_id)<0) goto out; @@ -1695,23 +1695,23 @@ herr_t H5DSiterate_scales(hid_t did, } /* i */ } /* if */ - + /* close */ if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf)<0) goto out; if (H5Sclose(sid)<0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid)<0) goto out; if (H5Aclose(aid)<0) goto out; if (buf) free(buf); - + } /* if has_dimlist */ return ret_value; - + out: H5E_BEGIN_TRY { if (buf) @@ -1724,17 +1724,17 @@ out: H5Tclose(tid); } H5E_END_TRY; return FAIL; -} +} /*------------------------------------------------------------------------- * Function: H5DSis_attached * - * Purpose: Report if dimension scale DSID is currently attached to + * Purpose: Report if dimension scale DSID is currently attached to * dimension IDX of dataset DID by checking if DID has a pointer in the REFERENCE_LIST - * attribute and DSID (scale ) has a pointer in the DIMENSION_LIST attribute + * attribute and DSID (scale ) has a pointer in the DIMENSION_LIST attribute * - * Return: + * Return: * 1: both the DS and the dataset pointers match * 0: one of them or both do not match * FAIL (-1): error @@ -1752,8 +1752,8 @@ out: htri_t H5DSis_attached(hid_t did, hid_t dsid, - unsigned int idx) -{ + unsigned int idx) +{ int has_dimlist; int has_reflist; hssize_t nelmts; @@ -1775,9 +1775,9 @@ htri_t H5DSis_attached(hid_t did, *------------------------------------------------------------------------- */ /* the dataset cannot be a DS dataset */ - if ((H5DSis_scale(did))==1) + if ((H5DSis_scale(did))==1) return FAIL; - + /* get info for the dataset in the parameter list */ if (H5Gget_objinfo(did,".",TRUE,&sb1)<0) return FAIL; @@ -1787,7 +1787,7 @@ htri_t H5DSis_attached(hid_t did, return FAIL; /* same object, not valid */ - if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno) + if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno) return FAIL; /* get ID type */ @@ -1807,7 +1807,7 @@ htri_t H5DSis_attached(hid_t did, /* get dataset space */ if ((sid = H5Dget_space(did))<0) return FAIL; - + /* get rank */ if ((rank=H5Sget_simple_extent_ndims(sid))<0) goto out; @@ -1828,24 +1828,24 @@ htri_t H5DSis_attached(hid_t did, * open "DIMENSION_LIST" *------------------------------------------------------------------------- */ - + if ( has_dimlist == 1 ) { if ((aid = H5Aopen_name(did,DIMENSION_LIST))<0) goto out; - + if ((tid = H5Aget_type(aid))<0) goto out; if ((sid = H5Aget_space(aid))<0) goto out; - + /* allocate and initialize the VL */ buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t)); if (buf == NULL) goto out; - + /* read */ if (H5Aread(aid,tid,buf)<0) goto out; @@ -1859,83 +1859,83 @@ htri_t H5DSis_attached(hid_t did, /* get the scale id for this REF */ if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref))<0) goto out; - + /* get info for DS in the parameter list */ if (H5Gget_objinfo(dsid,".",TRUE,&sb1)<0) goto out; - + /* get info for this DS */ if (H5Gget_objinfo(dsid_j,".",TRUE,&sb2)<0) goto out; - + /* same object */ - if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno) + if (sb1.fileno==sb2.fileno && sb1.objno==sb2.objno) { found_ds = 1; } - + /* close the dereferenced dataset */ if (H5Dclose(dsid_j)<0) goto out; } - + /* close */ if (H5Dvlen_reclaim(tid,sid,H5P_DEFAULT,buf)<0) goto out; if (H5Sclose(sid)<0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid)<0) goto out; if (H5Aclose(aid)<0) goto out; if (buf) free(buf); - } /* has_dimlist */ - + } /* has_dimlist */ + /*------------------------------------------------------------------------- * info on the >>DS<< dataset *------------------------------------------------------------------------- */ - + /* try to find the attribute "REFERENCE_LIST" on the >>DS<< dataset */ if ((has_reflist = H5LT_find_attribute(dsid,REFERENCE_LIST))<0) goto out; /*------------------------------------------------------------------------- - * open "REFERENCE_LIST" + * open "REFERENCE_LIST" *------------------------------------------------------------------------- */ - + if ( has_reflist == 1 ) { if ((aid = H5Aopen_name(dsid,REFERENCE_LIST))<0) goto out; - + if ((tid = H5Aget_type(aid))<0) goto out; - + /* get and save the old reference(s) */ if ((sid = H5Aget_space(aid))<0) goto out; - + if ((nelmts = H5Sget_simple_extent_npoints(sid))<0) goto out; - + dsbuf = malloc((size_t)nelmts * sizeof(ds_list_t)); if (dsbuf == NULL) goto out; - + if (H5Aread(aid,tid,dsbuf)<0) goto out; - + /*------------------------------------------------------------------------- * iterate *------------------------------------------------------------------------- */ - + for(i=0; i<nelmts; i++) { /* get the reference */ @@ -1947,43 +1947,43 @@ htri_t H5DSis_attached(hid_t did, /* get the DS id */ if ((dsid_j = H5Rdereference(did,H5R_OBJECT,&ref))<0) goto out; - + /* get info for dataset in the parameter list */ if (H5Gget_objinfo(did,".",TRUE,&sb3)<0) goto out; - + /* get info for this DS */ if (H5Gget_objinfo(dsid_j,".",TRUE,&sb4)<0) goto out; - + /* same object */ if (sb3.fileno==sb4.fileno && sb3.objno==sb4.objno && (int)idx==dsbuf[i].dim_idx) { found_dset=1; } /* if */ - + /* close the dereferenced dataset */ if (H5Dclose(dsid_j)<0) goto out; } /* if */ } /* i */ - - + + /* close */ if (H5Sclose(sid)<0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid)<0) goto out; if (H5Aclose(aid)<0) goto out; if (dsbuf) free(dsbuf); - } /* has_reflist */ + } /* has_reflist */ if (found_ds && found_dset) return 1; else return 0; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { @@ -2033,7 +2033,7 @@ herr_t H5DS_is_reserved(hid_t did) { if ((aid = H5Aopen_name(did,"CLASS"))<0) goto out; - + if ((tid = H5Aget_type(aid))<0) goto out; @@ -2046,8 +2046,8 @@ herr_t H5DS_is_reserved(hid_t did) ret = 1; else ret = 0; - - if (H5Tclose(tid)<0) + + if (H5Tclose(tid)<0) goto out; if (H5Aclose(aid)<0) diff --git a/hl/src/H5DS.h b/hl/src/H5DS.h index 8733997..6ad7b09 100644 --- a/hl/src/H5DS.h +++ b/hl/src/H5DS.h @@ -26,7 +26,7 @@ #define REFERENCE_LIST "REFERENCE_LIST" #define DIMENSION_LABELS "DIMENSION_LABELS" -typedef herr_t (*H5DS_iterate_t)(hid_t dset, unsigned dim, hid_t scale, void *visitor_data); +typedef herr_t (*H5DS_iterate_t)(hid_t dset, unsigned dim, hid_t scale, void *visitor_data); /* attribute type of a DS dataset */ @@ -48,31 +48,31 @@ H5_HLDLL herr_t H5DSdetach_scale( hid_t did, hid_t dsid, unsigned int idx); -H5_HLDLL herr_t H5DSset_scale( hid_t dsid, +H5_HLDLL herr_t H5DSset_scale( hid_t dsid, char *dimname); H5_HLDLL int H5DSget_num_scales( hid_t did, unsigned int dim); -H5_HLDLL herr_t H5DSset_label( hid_t did, +H5_HLDLL herr_t H5DSset_label( hid_t did, unsigned int idx, char *label); -H5_HLDLL ssize_t H5DSget_label( hid_t did, +H5_HLDLL ssize_t H5DSget_label( hid_t did, unsigned int idx, char *label, size_t size); -H5_HLDLL ssize_t H5DSget_scale_name( hid_t did, +H5_HLDLL ssize_t H5DSget_scale_name( hid_t did, char *name, size_t size); H5_HLDLL htri_t H5DSis_scale( hid_t did); -H5_HLDLL herr_t H5DSiterate_scales( hid_t did, - unsigned int dim, - int *idx, - H5DS_iterate_t visitor, +H5_HLDLL herr_t H5DSiterate_scales( hid_t did, + unsigned int dim, + int *idx, + H5DS_iterate_t visitor, void *visitor_data); H5_HLDLL htri_t H5DSis_attached( hid_t did, @@ -84,7 +84,7 @@ H5_HLDLL htri_t H5DSis_attached( hid_t did, /*------------------------------------------------------------------------- * private functions *------------------------------------------------------------------------- - */ + */ H5_HLDLL herr_t H5DS_is_reserved( hid_t did); diff --git a/hl/src/H5HL_private.c b/hl/src/H5HL_private.c index 723e9ea..0d7e3b4 100644 --- a/hl/src/H5HL_private.c +++ b/hl/src/H5HL_private.c @@ -37,9 +37,9 @@ * *------------------------------------------------------------------------- */ -herr_t H5TBcommon_append_records( hid_t dataset_id, - hid_t mem_type_id, - hsize_t nrecords, +herr_t H5TBcommon_append_records( hid_t dataset_id, + hid_t mem_type_id, + hsize_t nrecords, hsize_t orig_table_size, const void * data) { @@ -71,7 +71,7 @@ herr_t H5TBcommon_append_records( hid_t dataset_id, goto out; /* Write the records */ - if ( H5Dwrite( dataset_id, mem_type_id, mem_space_id, space_id, H5P_DEFAULT, data ) < + if ( H5Dwrite( dataset_id, mem_type_id, mem_space_id, space_id, H5P_DEFAULT, data ) < 0 ) goto out; @@ -94,7 +94,7 @@ out: /*------------------------------------------------------------------------- - * Function: H5TBcommon_read_records + * Function: H5TBcommon_read_records * * Purpose: Common code for reading records shared between H5PT and H5TB * @@ -107,7 +107,7 @@ out: * * Comments: Called by H5TBread_records and H5PTread_records * - * Modifications: + * Modifications: * * *------------------------------------------------------------------------- @@ -118,8 +118,8 @@ herr_t H5TBcommon_read_records( hid_t dataset_id, hsize_t nrecords, hsize_t table_size, void *data) -{ - hsize_t count[1]; +{ + hsize_t count[1]; hsize_t offset[1]; hid_t space_id = H5I_BADID; hid_t mem_space_id = H5I_BADID; @@ -129,7 +129,7 @@ herr_t H5TBcommon_read_records( hid_t dataset_id, if ( start + nrecords > table_size ) goto out; - /* Get the dataspace handle */ + /* Get the dataspace handle */ if ( (space_id = H5Dget_space( dataset_id )) < 0 ) goto out; diff --git a/hl/src/H5HL_private.h b/hl/src/H5HL_private.h index d6f2157..c431e7d 100644 --- a/hl/src/H5HL_private.h +++ b/hl/src/H5HL_private.h @@ -28,7 +28,7 @@ extern "C" { */ herr_t H5TBcommon_append_records( hid_t dataset_id, - hid_t mem_type_id, + hid_t mem_type_id, hsize_t nrecords, hsize_t orig_table_size, const void * data); diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index 9e8982d..0db602c 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -27,7 +27,7 @@ * Date: June 13, 2001 * * Comments: - * based on HDF5 Image and Palette Specification + * based on HDF5 Image and Palette Specification * http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageSpec.html * * Modifications: @@ -35,17 +35,17 @@ *------------------------------------------------------------------------- */ -herr_t H5IMmake_image_8bit( hid_t loc_id, - const char *dset_name, +herr_t H5IMmake_image_8bit( hid_t loc_id, + const char *dset_name, hsize_t width, hsize_t height, const unsigned char *buffer ) { hsize_t dims[IMAGE8_RANK]; - + /* Initialize the image dimensions */ - dims[0] = height; - dims[1] = width; + dims[0] = height; + dims[1] = width; dims[2] = 1; /* Make the dataset */ @@ -79,12 +79,12 @@ herr_t H5IMmake_image_8bit( hid_t loc_id, * Date: June 13, 2001 * * Comments: - * based on HDF5 Image and Palette Specification + * based on HDF5 Image and Palette Specification * http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageSpec.html * - * Interlace Mode Dimensions in the Dataspace - * INTERLACE_PIXEL [height][width][pixel components] - * INTERLACE_PLANE [pixel components][height][width] + * Interlace Mode Dimensions in the Dataspace + * INTERLACE_PIXEL [height][width][pixel components] + * INTERLACE_PLANE [pixel components][height][width] * * * Modifications: @@ -92,34 +92,34 @@ herr_t H5IMmake_image_8bit( hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5IMmake_image_24bit( hid_t loc_id, - const char *dset_name, +herr_t H5IMmake_image_24bit( hid_t loc_id, + const char *dset_name, hsize_t width, hsize_t height, const char *interlace, const unsigned char *buffer ) { hsize_t dims[IMAGE24_RANK]; - + /* Initialize the image dimensions */ - if ( strcmp( interlace, "INTERLACE_PIXEL" ) == 0 ) + if ( strcmp( interlace, "INTERLACE_PIXEL" ) == 0 ) { /* Number of color planes is defined as the third dimension */ - dims[0] = height; - dims[1] = width; - dims[2] = IMAGE24_RANK; + dims[0] = height; + dims[1] = width; + dims[2] = IMAGE24_RANK; } else - if ( strcmp( interlace, "INTERLACE_PLANE" ) == 0 ) + if ( strcmp( interlace, "INTERLACE_PLANE" ) == 0 ) { /* Number of color planes is defined as the first dimension */ - dims[0] = IMAGE24_RANK; - dims[1] = height; - dims[2] = width; + dims[0] = IMAGE24_RANK; + dims[1] = height; + dims[2] = width; } else return -1; - + /* Make the dataset */ if ( H5LTmake_dataset( loc_id, dset_name, IMAGE24_RANK, dims, H5T_NATIVE_UCHAR, buffer ) < 0 ) return -1; @@ -151,7 +151,7 @@ herr_t H5IMmake_image_24bit( hid_t loc_id, * * Purpose: operator function used by H5LT_find_palette * - * Return: + * Return: * * Programmer: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu * @@ -167,33 +167,33 @@ herr_t H5IMmake_image_24bit( hid_t loc_id, static herr_t find_palette( hid_t loc_id, const char *name, void *op_data ) { - /* Define a default zero value for return. This will cause the iterator to continue if + /* Define a default zero value for return. This will cause the iterator to continue if * the palette attribute is not found yet. */ - int ret = 0; + int ret = 0; /* Shut compiler */ loc_id=loc_id; op_data=op_data; - - /* Define a positive value for return value if the attribute was found. This will - * cause the iterator to immediately return that positive value, - * indicating short-circuit success + + /* Define a positive value for return value if the attribute was found. This will + * cause the iterator to immediately return that positive value, + * indicating short-circuit success */ - - if( strcmp( name, "PALETTE" ) == 0 ) + + if( strcmp( name, "PALETTE" ) == 0 ) ret = 1; return ret; -} +} /*------------------------------------------------------------------------- * Function: H5IM_find_palette * - * Purpose: Private function. Find the attribute "PALETTE" in the image dataset + * Purpose: Private function. Find the attribute "PALETTE" in the image dataset * * Return: Success: 1, Failure: 0 * @@ -209,7 +209,7 @@ static herr_t find_palette( hid_t loc_id, const char *name, void *op_data ) *------------------------------------------------------------------------- */ -herr_t H5IM_find_palette( hid_t loc_id ) +herr_t H5IM_find_palette( hid_t loc_id ) { unsigned int attr_num; /* Starting attribute to look up */ @@ -225,7 +225,7 @@ herr_t H5IM_find_palette( hid_t loc_id ) /*------------------------------------------------------------------------- * Function: H5IMget_image_info * - * Purpose: Gets information about an image dataset (dimensions, interlace mode + * Purpose: Gets information about an image dataset (dimensions, interlace mode * and number of associated palettes). * * Return: Success: 0, Failure: -1 @@ -235,7 +235,7 @@ herr_t H5IM_find_palette( hid_t loc_id ) * Date: July 25, 2001 * * Comments: - * based on HDF5 Image and Palette Specification + * based on HDF5 Image and Palette Specification * http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageSpec.html * * Modifications: @@ -243,18 +243,18 @@ herr_t H5IM_find_palette( hid_t loc_id ) *------------------------------------------------------------------------- */ -herr_t H5IMget_image_info( hid_t loc_id, - const char *dset_name, +herr_t H5IMget_image_info( hid_t loc_id, + const char *dset_name, hsize_t *width, hsize_t *height, hsize_t *planes, char *interlace, hssize_t *npals ) { - hid_t did, sid; + hid_t did, sid; hsize_t dims[IMAGE24_RANK]; hid_t attr_id; - hid_t attr_type; + hid_t attr_type; int has_attr; hid_t attr_space_id; hid_t attr_class; @@ -289,7 +289,7 @@ herr_t H5IMget_image_info( hid_t loc_id, if ( H5Aclose( attr_id ) < 0 ) goto out; } - + /* Get the dataspace handle */ if ( (sid = H5Dget_space( did )) < 0 ) goto out; @@ -304,18 +304,18 @@ herr_t H5IMget_image_info( hid_t loc_id, /* This is a 24 bit image */ { - if ( strcmp( interlace, "INTERLACE_PIXEL" ) == 0 ) + if ( strcmp( interlace, "INTERLACE_PIXEL" ) == 0 ) { /* Number of color planes is defined as the third dimension */ - *height = dims[0]; + *height = dims[0]; *width = dims[1]; *planes = dims[2]; } else - if ( strcmp( interlace, "INTERLACE_PLANE" ) == 0 ) + if ( strcmp( interlace, "INTERLACE_PLANE" ) == 0 ) { /* Number of color planes is defined as the first dimension */ - *planes = dims[0]; + *planes = dims[0]; *height = dims[1]; *width = dims[2]; } @@ -324,7 +324,7 @@ herr_t H5IMget_image_info( hid_t loc_id, else /* This is a 8 bit image */ { - *height = dims[0]; + *height = dims[0]; *width = dims[1]; *planes = 1; } @@ -345,7 +345,7 @@ herr_t H5IMget_image_info( hid_t loc_id, if ( (attr_id = H5Aopen_name( did, "PALETTE" )) < 0 ) goto out; - + if ( (attr_type = H5Aget_type( attr_id )) < 0 ) goto out; @@ -366,13 +366,13 @@ herr_t H5IMget_image_info( hid_t loc_id, if ( H5Sclose( attr_space_id ) < 0 ) goto out; - - } /* H5T_REFERENCE */ - - if ( H5Tclose( attr_type ) < 0 ) + + } /* H5T_REFERENCE */ + + if ( H5Tclose( attr_type ) < 0 ) goto out; - /* Close the attribute. */ + /* Close the attribute. */ if ( H5Aclose( attr_id ) < 0 ) goto out; @@ -403,7 +403,7 @@ out: * Date: June 13, 2001 * * Comments: - * based on HDF5 Image and Palette Specification + * based on HDF5 Image and Palette Specification * http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageSpec.html * * Modifications: @@ -411,11 +411,11 @@ out: *------------------------------------------------------------------------- */ -herr_t H5IMread_image( hid_t loc_id, - const char *dset_name, +herr_t H5IMread_image( hid_t loc_id, + const char *dset_name, unsigned char *buffer ) { - hid_t did; + hid_t did; /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) @@ -450,7 +450,7 @@ out: * Date: May 01, 2001 * * Comments: - * based on HDF5 Image and Palette Specification + * based on HDF5 Image and Palette Specification * http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageSpec.html * * Modifications: @@ -458,18 +458,18 @@ out: *------------------------------------------------------------------------- */ -herr_t H5IMmake_palette( hid_t loc_id, +herr_t H5IMmake_palette( hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, - const unsigned char *pal_data ) + const unsigned char *pal_data ) + +{ -{ - int has_pal; - + /* Check if the dataset already exists */ has_pal = H5LTfind_dataset( loc_id, pal_name ); - + /* It exists. Return */ if ( has_pal == 1 ) return 0; @@ -485,7 +485,7 @@ herr_t H5IMmake_palette( hid_t loc_id, /* Attach the attribute "PAL_VERSION" to the >>palette<< dataset*/ if ( H5LTset_attribute_string( loc_id, pal_name, "PAL_VERSION", "1.2" ) < 0 ) return -1; - + return 0; } @@ -503,23 +503,23 @@ herr_t H5IMmake_palette( hid_t loc_id, * Date: May 01, 2001 * * Comments: - * based on HDF5 Image and Palette Specification + * based on HDF5 Image and Palette Specification * http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageSpec.html - * - * An image (dataset) within an HDF5 file may optionally specify an array of - * palettes to be viewed with. The dataset will have an attribute - * which contains an array of object reference pointers which refer to palettes in the file. + * + * An image (dataset) within an HDF5 file may optionally specify an array of + * palettes to be viewed with. The dataset will have an attribute + * which contains an array of object reference pointers which refer to palettes in the file. * * Modifications: * *------------------------------------------------------------------------- */ -herr_t H5IMlink_palette( hid_t loc_id, - const char *image_name, - const char *pal_name ) +herr_t H5IMlink_palette( hid_t loc_id, + const char *image_name, + const char *pal_name ) -{ +{ hid_t image_id; hid_t attr_type; @@ -532,12 +532,12 @@ herr_t H5IMlink_palette( hid_t loc_id, hsize_t dim_ref; int ok_pal; - /* The image dataset may or may not have the attribute "PALETTE" + /* 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 + * If it exists, the array of references is extended to hold the reference * to the new palette */ - + /* First we get the image id */ if ( (image_id = H5Dopen( loc_id, image_name )) < 0 ) return -1; @@ -551,11 +551,11 @@ herr_t H5IMlink_palette( hid_t loc_id, if ( (attr_space_id = H5Screate( H5S_SCALAR )) < 0 ) goto out; - + /* Create the attribute type for the reference */ if ( (attr_type = H5Tcopy( H5T_STD_REF_OBJ )) < 0 ) goto out; - + /* Create the attribute "PALETTE" to be attached to the image*/ if ( (attr_id = H5Acreate( image_id, "PALETTE", attr_type, attr_space_id, H5P_DEFAULT )) < 0 ) goto out; @@ -581,7 +581,7 @@ herr_t H5IMlink_palette( hid_t loc_id, if ( (attr_id = H5Aopen_name( image_id, "PALETTE" )) < 0 ) goto out; - + if ( (attr_type = H5Aget_type( attr_id )) < 0 ) goto out; @@ -615,7 +615,7 @@ herr_t H5IMlink_palette( hid_t loc_id, goto out; /* Create a new reference for this palette. */ - if ( H5Rcreate( &ref, loc_id, pal_name, H5R_OBJECT, -1 ) < 0 ) + if ( H5Rcreate( &ref, loc_id, pal_name, H5R_OBJECT, -1 ) < 0 ) goto out; refbuf[n_refs] = ref; @@ -636,22 +636,22 @@ herr_t H5IMlink_palette( hid_t loc_id, goto out; free( refbuf ); - - } /* H5T_REFERENCE */ - - if ( H5Tclose( attr_type ) < 0 ) + + } /* H5T_REFERENCE */ + + if ( H5Tclose( attr_type ) < 0 ) goto out; - /* Close the attribute. */ + /* Close the attribute. */ if ( H5Aclose( attr_id ) < 0 ) goto out; } - + /* Close the image dataset. */ if ( H5Dclose( image_id ) < 0 ) return -1; - + return 0; out: @@ -673,7 +673,7 @@ out: * Date: September 10, 2001 * * Comments: - * based on HDF5 Image and Palette Specification + * based on HDF5 Image and Palette Specification * http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageSpec.html * * Modifications: @@ -681,10 +681,10 @@ out: *------------------------------------------------------------------------- */ -herr_t H5IMunlink_palette( hid_t loc_id, - const char *image_name, - const char *pal_name ) -{ +herr_t H5IMunlink_palette( hid_t loc_id, + const char *image_name, + const char *pal_name ) +{ hid_t image_id; hid_t attr_type; hid_t attr_id; @@ -693,17 +693,17 @@ herr_t H5IMunlink_palette( hid_t loc_id, /* Try to find the palette dataset */ has_pal = H5LTfind_dataset( loc_id, pal_name ); - + /* It does not exist. Return */ if ( has_pal == 0 ) return -1; - /* The image dataset may or not have the attribute "PALETTE" + /* The image dataset may or 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 + * If it exists, the array of references is extended to hold the reference * to the new palette */ - + /* First we get the image id */ if ( (image_id = H5Dopen( loc_id, image_name )) < 0 ) return -1; @@ -720,7 +720,7 @@ herr_t H5IMunlink_palette( hid_t loc_id, { if ( (attr_id = H5Aopen_name( image_id, "PALETTE" )) < 0 ) goto out; - + if ( (attr_type = H5Aget_type( attr_id )) < 0 ) goto out; @@ -735,21 +735,21 @@ herr_t H5IMunlink_palette( hid_t loc_id, if ( H5Adelete( image_id, "PALETTE" ) < 0 ) goto out; - } /* H5T_REFERENCE */ + } /* H5T_REFERENCE */ - if ( H5Tclose( attr_type ) < 0 ) + if ( H5Tclose( attr_type ) < 0 ) goto out; - /* Close the attribute. */ + /* Close the attribute. */ if ( H5Aclose( attr_id ) < 0 ) goto out; } /* ok_pal */ - + /* Close the image dataset. */ if ( H5Dclose( image_id ) < 0 ) return -1; - + return 0; out: @@ -776,8 +776,8 @@ out: *------------------------------------------------------------------------- */ -herr_t H5IMget_npalettes( hid_t loc_id, - const char *image_name, +herr_t H5IMget_npalettes( hid_t loc_id, + const char *image_name, hssize_t *npals ) { hid_t image_id; @@ -802,7 +802,7 @@ herr_t H5IMget_npalettes( hid_t loc_id, if ( (attr_id = H5Aopen_name( image_id, "PALETTE" )) < 0 ) goto out; - + if ( (attr_type = H5Aget_type( attr_id )) < 0 ) goto out; @@ -820,13 +820,13 @@ herr_t H5IMget_npalettes( hid_t loc_id, if ( H5Sclose( attr_space_id ) < 0 ) goto out; - - } /* H5T_REFERENCE */ - - if ( H5Tclose( attr_type ) < 0 ) + + } /* H5T_REFERENCE */ + + if ( H5Tclose( attr_type ) < 0 ) goto out; - /* Close the attribute. */ + /* Close the attribute. */ if ( H5Aclose( attr_id ) < 0 ) goto out; @@ -843,7 +843,7 @@ out: return -1; } - + /*------------------------------------------------------------------------- * Function: H5IMget_palette_info @@ -857,7 +857,7 @@ out: * Date: July 22, 2001 * * Comments: - * based on HDF5 Image and Palette Specification + * based on HDF5 Image and Palette Specification * http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageSpec.html * * Modifications: @@ -865,7 +865,7 @@ out: *------------------------------------------------------------------------- */ -herr_t H5IMget_palette_info( hid_t loc_id, +herr_t H5IMget_palette_info( hid_t loc_id, const char *image_name, int pal_number, hsize_t *pal_dims ) @@ -895,7 +895,7 @@ herr_t H5IMget_palette_info( hid_t loc_id, if ( (attr_id = H5Aopen_name( image_id, "PALETTE" )) < 0 ) goto out; - + if ( (attr_type = H5Aget_type( attr_id )) < 0 ) goto out; @@ -931,7 +931,7 @@ herr_t H5IMget_palette_info( hid_t loc_id, if ( H5Sget_simple_extent_ndims( pal_space_id ) < 0 ) goto out; - + if ( H5Sget_simple_extent_dims( pal_space_id, pal_dims, pal_maxdims ) < 0 ) goto out; @@ -946,18 +946,18 @@ herr_t H5IMget_palette_info( hid_t loc_id, goto out; free( refbuf ); - - } /* H5T_REFERENCE */ - - if ( H5Tclose( attr_type ) < 0 ) + + } /* H5T_REFERENCE */ + + if ( H5Tclose( attr_type ) < 0 ) goto out; - /* Close the attribute. */ + /* Close the attribute. */ if ( H5Aclose( attr_id ) < 0 ) goto out; } - + /* Close the image dataset. */ if ( H5Dclose( image_id ) < 0 ) return -1; @@ -969,7 +969,7 @@ out: return -1; } - + /*------------------------------------------------------------------------- * Function: H5IMget_palette @@ -983,7 +983,7 @@ out: * Date: August 30, 2001 * * Comments: - * based on HDF5 Image and Palette Specification + * based on HDF5 Image and Palette Specification * http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageSpec.html * * Modifications: @@ -991,7 +991,7 @@ out: *------------------------------------------------------------------------- */ -herr_t H5IMget_palette( hid_t loc_id, +herr_t H5IMget_palette( hid_t loc_id, const char *image_name, int pal_number, unsigned char *pal_data ) @@ -1019,7 +1019,7 @@ herr_t H5IMget_palette( hid_t loc_id, if ( (attr_id = H5Aopen_name( image_id, "PALETTE" )) < 0 ) goto out; - + if ( (attr_type = H5Aget_type( attr_id )) < 0 ) goto out; @@ -1059,13 +1059,13 @@ herr_t H5IMget_palette( hid_t loc_id, goto out; free( refbuf ); - - } /* H5T_REFERENCE */ - - if ( H5Tclose( attr_type ) < 0 ) + + } /* H5T_REFERENCE */ + + if ( H5Tclose( attr_type ) < 0 ) goto out; - /* Close the attribute. */ + /* Close the attribute. */ if ( H5Aclose( attr_id ) < 0 ) goto out; } @@ -1081,7 +1081,7 @@ out: return -1; } - + /*------------------------------------------------------------------------- * Function: H5IMis_image * @@ -1094,7 +1094,7 @@ out: * Date: August 30, 2001 * * Comments: - * based on HDF5 Image and Palette Specification + * based on HDF5 Image and Palette Specification * http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageSpec.html * * Modifications: @@ -1102,7 +1102,7 @@ out: *------------------------------------------------------------------------- */ -herr_t H5IMis_image( hid_t loc_id, +herr_t H5IMis_image( hid_t loc_id, const char *dset_name ) { hid_t did; @@ -1133,7 +1133,7 @@ herr_t H5IMis_image( hid_t loc_id, if ( (attr_id = H5Aopen_name( did, "CLASS" )) < 0 ) goto out; - + if ( (attr_type = H5Aget_type( attr_id )) < 0 ) goto out; @@ -1143,12 +1143,12 @@ herr_t H5IMis_image( hid_t loc_id, if ( H5Aread( attr_id, attr_type, attr_data ) < 0 ) goto out; - if( strcmp( attr_data, IMAGE_CLASS ) == 0 ) + if( strcmp( attr_data, IMAGE_CLASS ) == 0 ) ret = 1; else ret = 0; - - if ( H5Tclose( attr_type ) < 0 ) + + if ( H5Tclose( attr_type ) < 0 ) goto out; if ( H5Aclose( attr_id ) < 0 ) @@ -1180,7 +1180,7 @@ out: * Date: August 30, 2001 * * Comments: - * based on HDF5 Image and Palette Specification + * based on HDF5 Image and Palette Specification * http://hdf.ncsa.uiuc.edu/HDF5/H5Image/ImageSpec.html * * Modifications: @@ -1188,7 +1188,7 @@ out: *------------------------------------------------------------------------- */ -herr_t H5IMis_palette( hid_t loc_id, +herr_t H5IMis_palette( hid_t loc_id, const char *dset_name ) { hid_t did; @@ -1219,7 +1219,7 @@ herr_t H5IMis_palette( hid_t loc_id, if ( (attr_id = H5Aopen_name( did, "CLASS" )) < 0 ) goto out; - + if ( (attr_type = H5Aget_type( attr_id )) < 0 ) goto out; @@ -1229,12 +1229,12 @@ herr_t H5IMis_palette( hid_t loc_id, if ( H5Aread( attr_id, attr_type, attr_data ) < 0 ) goto out; - if( strcmp( attr_data, PALETTE_CLASS ) == 0 ) + if( strcmp( attr_data, PALETTE_CLASS ) == 0 ) ret = 1; else ret = 0; - - if ( H5Tclose( attr_type ) < 0 ) + + if ( H5Tclose( attr_type ) < 0 ) goto out; if ( H5Aclose( attr_id ) < 0 ) diff --git a/hl/src/H5IM.h b/hl/src/H5IM.h index b2d96ad..a18434f 100644 --- a/hl/src/H5IM.h +++ b/hl/src/H5IM.h @@ -28,69 +28,69 @@ extern "C" { #define IMAGE24_RANK 3 -H5_HLDLL herr_t H5IMmake_image_8bit( hid_t loc_id, - const char *dset_name, +H5_HLDLL herr_t H5IMmake_image_8bit( hid_t loc_id, + const char *dset_name, hsize_t width, hsize_t height, const unsigned char *buffer ); -H5_HLDLL herr_t H5IMmake_image_24bit( hid_t loc_id, - const char *dset_name, +H5_HLDLL herr_t H5IMmake_image_24bit( hid_t loc_id, + const char *dset_name, hsize_t width, hsize_t height, const char *interlace, const unsigned char *buffer ); -H5_HLDLL herr_t H5IMget_image_info( hid_t loc_id, - const char *dset_name, +H5_HLDLL herr_t H5IMget_image_info( hid_t loc_id, + const char *dset_name, hsize_t *width, hsize_t *height, hsize_t *planes, char *interlace, hssize_t *npals ); -H5_HLDLL herr_t H5IMread_image( hid_t loc_id, - const char *dset_name, +H5_HLDLL herr_t H5IMread_image( hid_t loc_id, + const char *dset_name, unsigned char *buffer ); -H5_HLDLL herr_t H5IMmake_palette( hid_t loc_id, +H5_HLDLL herr_t H5IMmake_palette( hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, const unsigned char *pal_data ); -H5_HLDLL herr_t H5IMlink_palette( hid_t loc_id, - const char *image_name, +H5_HLDLL herr_t H5IMlink_palette( hid_t loc_id, + const char *image_name, const char *pal_name ); -H5_HLDLL herr_t H5IMunlink_palette( hid_t loc_id, - const char *image_name, +H5_HLDLL herr_t H5IMunlink_palette( hid_t loc_id, + const char *image_name, const char *pal_name ); -H5_HLDLL herr_t H5IMget_npalettes( hid_t loc_id, - const char *image_name, +H5_HLDLL herr_t H5IMget_npalettes( hid_t loc_id, + const char *image_name, hssize_t *npals ); -H5_HLDLL herr_t H5IMget_palette_info( hid_t loc_id, - const char *image_name, +H5_HLDLL herr_t H5IMget_palette_info( hid_t loc_id, + const char *image_name, int pal_number, hsize_t *pal_dims ); -H5_HLDLL herr_t H5IMget_palette( hid_t loc_id, +H5_HLDLL herr_t H5IMget_palette( hid_t loc_id, const char *image_name, int pal_number, unsigned char *pal_data ); -H5_HLDLL herr_t H5IMis_image( hid_t loc_id, +H5_HLDLL herr_t H5IMis_image( hid_t loc_id, const char *dset_name ); -H5_HLDLL herr_t H5IMis_palette( hid_t loc_id, +H5_HLDLL herr_t H5IMis_palette( hid_t loc_id, const char *dset_name ); H5_HLDLL herr_t H5IM_find_palette(hid_t loc_id ); - + #ifdef __cplusplus diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index bdd76ef..aab6a37 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -15,23 +15,23 @@ #include <stdlib.h> /*------------------------------------------------------------------------- - * + * * internal functions - * + * *------------------------------------------------------------------------- */ -herr_t H5LT_open_id( hid_t loc_id, - const char *obj_name, +herr_t H5LT_open_id( hid_t loc_id, + const char *obj_name, int obj_type ); herr_t H5LT_close_id( hid_t obj_id, int obj_type ); /*------------------------------------------------------------------------- - * + * * Public functions - * + * *------------------------------------------------------------------------- */ @@ -54,16 +54,16 @@ herr_t H5LT_close_id( hid_t obj_id, *------------------------------------------------------------------------- */ -herr_t H5LTmake_dataset( hid_t loc_id, - const char *dset_name, - int rank, +herr_t H5LTmake_dataset( hid_t loc_id, + const char *dset_name, + int rank, const hsize_t *dims, hid_t tid, - const void *data ) + const void *data ) { - hid_t did, sid; - + hid_t did, sid; + /* Create the data space for the dataset. */ if ( (sid = H5Screate_simple( rank, dims, NULL )) < 0 ) return -1; @@ -74,7 +74,7 @@ herr_t H5LTmake_dataset( hid_t loc_id, /* Write the dataset only if there is data to write */ - if ( data ) + if ( data ) { if ( H5Dwrite( did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) goto out; @@ -84,7 +84,7 @@ herr_t H5LTmake_dataset( hid_t loc_id, if ( H5Dclose( did ) < 0 ) return -1; - /* Terminate access to the data space. */ + /* Terminate access to the data space. */ if ( H5Sclose( sid ) < 0 ) return -1; @@ -115,15 +115,15 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LTmake_dataset_char( hid_t loc_id, - const char *dset_name, - int rank, +herr_t H5LTmake_dataset_char( hid_t loc_id, + const char *dset_name, + int rank, const hsize_t *dims, - const char *data ) + const char *data ) { - hid_t did, sid; - + hid_t did, sid; + /* Create the data space for the dataset. */ if ( (sid = H5Screate_simple( rank, dims, NULL )) < 0 ) return -1; @@ -134,7 +134,7 @@ herr_t H5LTmake_dataset_char( hid_t loc_id, /* Write the dataset only if there is data to write */ - if ( data ) + if ( data ) { if ( H5Dwrite( did, H5T_NATIVE_CHAR, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) goto out; @@ -144,7 +144,7 @@ herr_t H5LTmake_dataset_char( hid_t loc_id, if ( H5Dclose( did ) < 0 ) return -1; - /* Terminate access to the data space. */ + /* Terminate access to the data space. */ if ( H5Sclose( sid ) < 0 ) return -1; @@ -177,15 +177,15 @@ out: */ -herr_t H5LTmake_dataset_short( hid_t loc_id, - const char *dset_name, - int rank, +herr_t H5LTmake_dataset_short( hid_t loc_id, + const char *dset_name, + int rank, const hsize_t *dims, - const short *data ) + const short *data ) { - hid_t did, sid; - + hid_t did, sid; + /* Create the data space for the dataset. */ if ( (sid = H5Screate_simple( rank, dims, NULL )) < 0 ) return -1; @@ -196,7 +196,7 @@ herr_t H5LTmake_dataset_short( hid_t loc_id, /* Write the dataset only if there is data to write */ - if ( data ) + if ( data ) { if ( H5Dwrite( did, H5T_NATIVE_SHORT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) goto out; @@ -206,7 +206,7 @@ herr_t H5LTmake_dataset_short( hid_t loc_id, if ( H5Dclose( did ) < 0 ) return -1; - /* Terminate access to the data space. */ + /* Terminate access to the data space. */ if ( H5Sclose( sid ) < 0 ) return -1; @@ -238,15 +238,15 @@ out: */ -herr_t H5LTmake_dataset_int( hid_t loc_id, - const char *dset_name, - int rank, +herr_t H5LTmake_dataset_int( hid_t loc_id, + const char *dset_name, + int rank, const hsize_t *dims, - const int *data ) + const int *data ) { - hid_t did, sid; - + hid_t did, sid; + /* Create the data space for the dataset. */ if ( (sid = H5Screate_simple( rank, dims, NULL )) < 0 ) return -1; @@ -257,7 +257,7 @@ herr_t H5LTmake_dataset_int( hid_t loc_id, /* Write the dataset only if there is data to write */ - if ( data ) + if ( data ) { if ( H5Dwrite( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) goto out; @@ -267,7 +267,7 @@ herr_t H5LTmake_dataset_int( hid_t loc_id, if ( H5Dclose( did ) < 0 ) return -1; - /* Terminate access to the data space. */ + /* Terminate access to the data space. */ if ( H5Sclose( sid ) < 0 ) return -1; @@ -301,15 +301,15 @@ out: */ -herr_t H5LTmake_dataset_long( hid_t loc_id, - const char *dset_name, - int rank, +herr_t H5LTmake_dataset_long( hid_t loc_id, + const char *dset_name, + int rank, const hsize_t *dims, - const long *data ) + const long *data ) { - hid_t did, sid; - + hid_t did, sid; + /* Create the data space for the dataset. */ if ( (sid = H5Screate_simple( rank, dims, NULL )) < 0 ) return -1; @@ -320,7 +320,7 @@ herr_t H5LTmake_dataset_long( hid_t loc_id, /* Write the dataset only if there is data to write */ - if ( data ) + if ( data ) { if ( H5Dwrite( did, H5T_NATIVE_LONG, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) goto out; @@ -330,7 +330,7 @@ herr_t H5LTmake_dataset_long( hid_t loc_id, if ( H5Dclose( did ) < 0 ) return -1; - /* Terminate access to the data space. */ + /* Terminate access to the data space. */ if ( H5Sclose( sid ) < 0 ) return -1; @@ -362,15 +362,15 @@ out: */ -herr_t H5LTmake_dataset_float( hid_t loc_id, - const char *dset_name, - int rank, +herr_t H5LTmake_dataset_float( hid_t loc_id, + const char *dset_name, + int rank, const hsize_t *dims, - const float *data ) + const float *data ) { - hid_t did, sid; - + hid_t did, sid; + /* Create the data space for the dataset. */ if ( (sid = H5Screate_simple( rank, dims, NULL )) < 0 ) return -1; @@ -381,7 +381,7 @@ herr_t H5LTmake_dataset_float( hid_t loc_id, /* Write the dataset only if there is data to write */ - if ( data ) + if ( data ) { if ( H5Dwrite( did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) goto out; @@ -391,7 +391,7 @@ herr_t H5LTmake_dataset_float( hid_t loc_id, if ( H5Dclose( did ) < 0 ) return -1; - /* Terminate access to the data space. */ + /* Terminate access to the data space. */ if ( H5Sclose( sid ) < 0 ) return -1; @@ -425,15 +425,15 @@ out: */ -herr_t H5LTmake_dataset_double( hid_t loc_id, - const char *dset_name, - int rank, +herr_t H5LTmake_dataset_double( hid_t loc_id, + const char *dset_name, + int rank, const hsize_t *dims, - const double *data ) + const double *data ) { - hid_t did, sid; - + hid_t did, sid; + /* Create the data space for the dataset. */ if ( (sid = H5Screate_simple( rank, dims, NULL )) < 0 ) return -1; @@ -444,7 +444,7 @@ herr_t H5LTmake_dataset_double( hid_t loc_id, /* Write the dataset only if there is data to write */ - if ( data ) + if ( data ) { if ( H5Dwrite( did, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) goto out; @@ -454,7 +454,7 @@ herr_t H5LTmake_dataset_double( hid_t loc_id, if ( H5Dclose( did ) < 0 ) return -1; - /* Terminate access to the data space. */ + /* Terminate access to the data space. */ if ( H5Sclose( sid ) < 0 ) return -1; @@ -487,12 +487,12 @@ out: */ -herr_t H5LTmake_dataset_string(hid_t loc_id, - const char *dset_name, - const char *buf ) +herr_t H5LTmake_dataset_string(hid_t loc_id, + const char *dset_name, + const char *buf ) { - hid_t did=-1; + hid_t did=-1; hid_t sid=-1; hid_t tid; size_t size; @@ -508,7 +508,7 @@ herr_t H5LTmake_dataset_string(hid_t loc_id, if ( H5Tset_strpad(tid,H5T_STR_NULLTERM ) < 0 ) goto out; - + /* Create the data space for the dataset. */ if ( (sid = H5Screate( H5S_SCALAR )) < 0 ) goto out; @@ -519,7 +519,7 @@ herr_t H5LTmake_dataset_string(hid_t loc_id, /* Write the dataset only if there is data to write */ - if (buf) + if (buf) { if ( H5Dwrite(did,tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0 ) goto out; @@ -557,12 +557,12 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LTread_dataset( hid_t loc_id, +herr_t H5LTread_dataset( hid_t loc_id, const char *dset_name, hid_t tid, void *data ) { - hid_t did; + hid_t did; /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) @@ -583,7 +583,7 @@ out: return -1; } - + /*------------------------------------------------------------------------- * Function: H5LTread_dataset_char @@ -599,11 +599,11 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LTread_dataset_char( hid_t loc_id, +herr_t H5LTread_dataset_char( hid_t loc_id, const char *dset_name, char *data ) { - hid_t did; + hid_t did; /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) @@ -639,11 +639,11 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LTread_dataset_short( hid_t loc_id, +herr_t H5LTread_dataset_short( hid_t loc_id, const char *dset_name, short *data ) { - hid_t did; + hid_t did; /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) @@ -679,11 +679,11 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LTread_dataset_int( hid_t loc_id, +herr_t H5LTread_dataset_int( hid_t loc_id, const char *dset_name, int *data ) { - hid_t did; + hid_t did; /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) @@ -719,11 +719,11 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LTread_dataset_long( hid_t loc_id, +herr_t H5LTread_dataset_long( hid_t loc_id, const char *dset_name, long *data ) { - hid_t did; + hid_t did; /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) @@ -759,11 +759,11 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LTread_dataset_float( hid_t loc_id, +herr_t H5LTread_dataset_float( hid_t loc_id, const char *dset_name, float *data ) { - hid_t did; + hid_t did; /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) @@ -800,11 +800,11 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LTread_dataset_double( hid_t loc_id, +herr_t H5LTread_dataset_double( hid_t loc_id, const char *dset_name, double *data ) { - hid_t did; + hid_t did; /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) @@ -841,11 +841,11 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LTread_dataset_string( hid_t loc_id, +herr_t H5LTread_dataset_string( hid_t loc_id, const char *dset_name, char *buf ) { - hid_t did; + hid_t did; hid_t tid; /* Open the dataset. */ @@ -889,12 +889,12 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LTget_dataset_ndims( hid_t loc_id, +herr_t H5LTget_dataset_ndims( hid_t loc_id, const char *dset_name, int *rank ) { - hid_t did; - hid_t sid; + hid_t did; + hid_t sid; /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) @@ -940,15 +940,15 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LTget_dataset_info( hid_t loc_id, +herr_t H5LTget_dataset_info( hid_t loc_id, const char *dset_name, hsize_t *dims, H5T_class_t *type_class, size_t *type_size ) { - hid_t did; + hid_t did; hid_t tid; - hid_t sid; + hid_t sid; /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) @@ -1011,42 +1011,42 @@ out: static herr_t find_dataset( hid_t loc_id, const char *name, void *op_data) { - /* Define a default zero value for return. This will cause the iterator to continue if + /* Define a default zero value for return. This will cause the iterator to continue if * the dataset is not found yet. */ - int ret = 0; + int ret = 0; char *dset_name = (char*)op_data; - + /* Shut the compiler up */ loc_id=loc_id; - /* Define a positive value for return value if the dataset was found. This will - * cause the iterator to immediately return that positive value, - * indicating short-circuit success + /* Define a positive value for return value if the dataset was found. This will + * cause the iterator to immediately return that positive value, + * indicating short-circuit success */ - if( strcmp( name, dset_name ) == 0 ) + if( strcmp( name, dset_name ) == 0 ) ret = 1; return ret; -} +} /*------------------------------------------------------------------------- * Function: H5LTfind_dataset * - * Purpose: Inquires if a dataset named dset_name exists attached + * Purpose: Inquires if a dataset named dset_name exists attached * to the object loc_id. * * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu * * Date: July 15, 2001 * - * Return: + * Return: * Success: The return value of the first operator that * returns non-zero, or zero if all members were * processed with no operator returning non-zero. @@ -1058,7 +1058,7 @@ static herr_t find_dataset( hid_t loc_id, const char *name, void *op_data) *------------------------------------------------------------------------- */ -herr_t H5LTfind_dataset( hid_t loc_id, const char *dset_name ) +herr_t H5LTfind_dataset( hid_t loc_id, const char *dset_name ) { herr_t ret; @@ -1070,17 +1070,17 @@ herr_t H5LTfind_dataset( hid_t loc_id, const char *dset_name ) /*------------------------------------------------------------------------- - * + * * Set attribute functions - * + * *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * Function: H5LTset_attribute_string * - * Purpose: Creates and writes a string attribute named attr_name and attaches + * Purpose: Creates and writes a string attribute named attr_name and attaches * it to the object specified by the name obj_name. * * Return: Success: 0, Failure: -1 @@ -1096,20 +1096,20 @@ herr_t H5LTfind_dataset( hid_t loc_id, const char *dset_name ) *------------------------------------------------------------------------- */ -herr_t H5LTset_attribute_string( hid_t loc_id, - const char *obj_name, +herr_t H5LTset_attribute_string( hid_t loc_id, + const char *obj_name, const char *attr_name, - const char *attr_data ) + const char *attr_data ) { hid_t attr_type; hid_t attr_space_id; hid_t attr_id; - hid_t obj_id; + hid_t obj_id; int has_attr; H5G_stat_t statbuf; size_t attr_size; - + /* Get the type of object */ if (H5Gget_objinfo( loc_id, obj_name, 1, &statbuf )<0) return -1; @@ -1150,10 +1150,10 @@ herr_t H5LTset_attribute_string( hid_t loc_id, if ( H5Awrite( attr_id, attr_type, attr_data ) < 0 ) goto out; - + if ( H5Aclose( attr_id ) < 0 ) goto out; - + if ( H5Sclose( attr_space_id ) < 0 ) goto out; @@ -1193,23 +1193,23 @@ out: */ -herr_t H5LT_set_attribute_numerical( hid_t loc_id, - const char *obj_name, +herr_t H5LT_set_attribute_numerical( hid_t loc_id, + const char *obj_name, const char *attr_name, size_t size, hid_t tid, - const void *data ) + const void *data ) { - hid_t obj_id, sid, attr_id; + hid_t obj_id, sid, attr_id; hsize_t dim_size=size; int has_attr; H5G_stat_t statbuf; - + /* Get the type of object */ if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) return -1; - + /* Open the object */ if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) return -1; @@ -1271,17 +1271,17 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LT_open_id( hid_t loc_id, - const char *obj_name, - int obj_type /*basic object type*/ ) +herr_t H5LT_open_id( hid_t loc_id, + const char *obj_name, + int obj_type /*basic object type*/ ) { - hid_t obj_id = -1; - + hid_t obj_id = -1; + switch ( obj_type ) { case H5G_DATASET: - + /* Open the dataset. */ if ( (obj_id = H5Dopen( loc_id, obj_name )) < 0 ) return -1; @@ -1295,10 +1295,10 @@ herr_t H5LT_open_id( hid_t loc_id, break; default: - return -1; + return -1; } - return obj_id; + return obj_id; } @@ -1320,27 +1320,27 @@ herr_t H5LT_open_id( hid_t loc_id, */ herr_t H5LT_close_id( hid_t obj_id, - int obj_type /*basic object type*/ ) + int obj_type /*basic object type*/ ) { switch ( obj_type ) { case H5G_DATASET: /* Close the dataset. */ if ( H5Dclose( obj_id ) < 0 ) - return -1; + return -1; break; case H5G_GROUP: /* Close the group. */ if ( H5Gclose( obj_id ) < 0 ) - return -1; + return -1; break; default: - return -1; + return -1; } - return 0; + return 0; } @@ -1360,14 +1360,14 @@ herr_t H5LT_close_id( hid_t obj_id, *------------------------------------------------------------------------- */ -herr_t H5LTset_attribute_char( hid_t loc_id, - const char *obj_name, +herr_t H5LTset_attribute_char( hid_t loc_id, + const char *obj_name, const char *attr_name, const char *data, - size_t size ) + size_t size ) { - - if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, + + if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, H5T_NATIVE_CHAR, data ) < 0 ) return -1; @@ -1390,14 +1390,14 @@ herr_t H5LTset_attribute_char( hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5LTset_attribute_uchar( hid_t loc_id, - const char *obj_name, +herr_t H5LTset_attribute_uchar( hid_t loc_id, + const char *obj_name, const char *attr_name, const unsigned char *data, - size_t size ) + size_t size ) { - - if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, + + if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, H5T_NATIVE_UCHAR, data ) < 0 ) return -1; @@ -1421,14 +1421,14 @@ herr_t H5LTset_attribute_uchar( hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5LTset_attribute_short( hid_t loc_id, - const char *obj_name, +herr_t H5LTset_attribute_short( hid_t loc_id, + const char *obj_name, const char *attr_name, const short *data, - size_t size ) + size_t size ) { - - if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, + + if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, H5T_NATIVE_SHORT, data ) < 0 ) return -1; @@ -1452,14 +1452,14 @@ herr_t H5LTset_attribute_short( hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5LTset_attribute_ushort( hid_t loc_id, - const char *obj_name, +herr_t H5LTset_attribute_ushort( hid_t loc_id, + const char *obj_name, const char *attr_name, const unsigned short *data, - size_t size ) + size_t size ) { - - if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, + + if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, H5T_NATIVE_USHORT, data ) < 0 ) return -1; @@ -1483,14 +1483,14 @@ herr_t H5LTset_attribute_ushort( hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5LTset_attribute_int( hid_t loc_id, - const char *obj_name, +herr_t H5LTset_attribute_int( hid_t loc_id, + const char *obj_name, const char *attr_name, const int *data, - size_t size ) + size_t size ) { - - if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, + + if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, H5T_NATIVE_INT, data ) < 0 ) return -1; @@ -1514,14 +1514,14 @@ herr_t H5LTset_attribute_int( hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5LTset_attribute_uint( hid_t loc_id, - const char *obj_name, +herr_t H5LTset_attribute_uint( hid_t loc_id, + const char *obj_name, const char *attr_name, const unsigned int *data, - size_t size ) + size_t size ) { - - if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, + + if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, H5T_NATIVE_UINT, data ) < 0 ) return -1; @@ -1546,14 +1546,14 @@ herr_t H5LTset_attribute_uint( hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5LTset_attribute_long( hid_t loc_id, - const char *obj_name, +herr_t H5LTset_attribute_long( hid_t loc_id, + const char *obj_name, const char *attr_name, const long *data, - size_t size ) + size_t size ) { - - if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, + + if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, H5T_NATIVE_LONG, data ) < 0 ) return -1; @@ -1576,14 +1576,14 @@ herr_t H5LTset_attribute_long( hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5LTset_attribute_long_long( hid_t loc_id, - const char *obj_name, +herr_t H5LTset_attribute_long_long( hid_t loc_id, + const char *obj_name, const char *attr_name, const long_long *data, - size_t size ) + size_t size ) { - - if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, + + if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, H5T_NATIVE_LLONG, data ) < 0 ) return -1; @@ -1608,14 +1608,14 @@ herr_t H5LTset_attribute_long_long( hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5LTset_attribute_ulong( hid_t loc_id, - const char *obj_name, +herr_t H5LTset_attribute_ulong( hid_t loc_id, + const char *obj_name, const char *attr_name, const unsigned long *data, - size_t size ) + size_t size ) { - - if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, + + if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, H5T_NATIVE_ULONG, data ) < 0 ) return -1; @@ -1641,14 +1641,14 @@ herr_t H5LTset_attribute_ulong( hid_t loc_id, */ -herr_t H5LTset_attribute_float( hid_t loc_id, - const char *obj_name, +herr_t H5LTset_attribute_float( hid_t loc_id, + const char *obj_name, const char *attr_name, const float *data, size_t size ) { - if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, + if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, H5T_NATIVE_FLOAT, data ) < 0 ) return -1; @@ -1673,14 +1673,14 @@ herr_t H5LTset_attribute_float( hid_t loc_id, *------------------------------------------------------------------------- */ -herr_t H5LTset_attribute_double( hid_t loc_id, - const char *obj_name, +herr_t H5LTset_attribute_double( hid_t loc_id, + const char *obj_name, const char *attr_name, const double *data, - size_t size ) + size_t size ) { - - if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, + + if ( H5LT_set_attribute_numerical( loc_id, obj_name, attr_name, size, H5T_NATIVE_DOUBLE, data ) < 0 ) return -1; @@ -1709,28 +1709,28 @@ herr_t H5LTset_attribute_double( hid_t loc_id, static herr_t find_attr( hid_t loc_id, const char *name, void *op_data) { - /* Define a default zero value for return. This will cause the iterator to continue if + /* Define a default zero value for return. This will cause the iterator to continue if * the palette attribute is not found yet. */ - int ret = 0; + int ret = 0; char *attr_name = (char*)op_data; - + /* Shut the compiler up */ loc_id=loc_id; - /* Define a positive value for return value if the attribute was found. This will - * cause the iterator to immediately return that positive value, - * indicating short-circuit success + /* Define a positive value for return value if the attribute was found. This will + * cause the iterator to immediately return that positive value, + * indicating short-circuit success */ - if( strcmp( name, attr_name ) == 0 ) + if( strcmp( name, attr_name ) == 0 ) ret = 1; return ret; -} +} /*------------------------------------------------------------------------- @@ -1745,7 +1745,7 @@ static herr_t find_attr( hid_t loc_id, const char *name, void *op_data) * Comments: * The function uses H5Aiterate with the operator function find_attr * - * Return: + * Return: * Success: The return value of the first operator that * returns non-zero, or zero if all members were * processed with no operator returning non-zero. @@ -1757,10 +1757,10 @@ static herr_t find_attr( hid_t loc_id, const char *name, void *op_data) *------------------------------------------------------------------------- */ -herr_t H5LT_find_attribute( hid_t loc_id, const char* attr_name ) +herr_t H5LT_find_attribute( hid_t loc_id, const char* attr_name ) { - unsigned int attr_num; + unsigned int attr_num; herr_t ret; attr_num = 0; @@ -1785,16 +1785,16 @@ herr_t H5LT_find_attribute( hid_t loc_id, const char* attr_name ) *------------------------------------------------------------------------- */ -herr_t H5LTget_attribute_ndims( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute_ndims( hid_t loc_id, + const char *obj_name, const char *attr_name, int *rank ) { - hid_t attr_id; - hid_t sid; + hid_t attr_id; + hid_t sid; H5G_stat_t statbuf; - hid_t obj_id; - + hid_t obj_id; + /* Get the type of object */ if (H5Gget_objinfo( loc_id, obj_name, 1, &statbuf )<0) return -1; @@ -1854,19 +1854,19 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LTget_attribute_info( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute_info( hid_t loc_id, + const char *obj_name, const char *attr_name, hsize_t *dims, H5T_class_t *type_class, size_t *type_size ) { - hid_t attr_id; + hid_t attr_id; hid_t tid; - hid_t sid; + hid_t sid; H5G_stat_t statbuf; - hid_t obj_id; - + hid_t obj_id; + /* Get the type of object */ if (H5Gget_objinfo( loc_id, obj_name, 1, &statbuf )<0) return -1; @@ -1936,7 +1936,7 @@ out: /*------------------------------------------------------------------------- * Function: H5LTcreate_compound_type * - * Purpose: + * Purpose: * * Return: Success: 0, Failure: -1 * @@ -1952,19 +1952,19 @@ out: *------------------------------------------------------------------------- */ -hid_t H5LTcreate_compound_type( hsize_t nfields, size_t size, const char *field_names[], - const size_t *field_offset, const hid_t *field_types ) +hid_t H5LTcreate_compound_type( hsize_t nfields, size_t size, const char *field_names[], + const size_t *field_offset, const hid_t *field_types ) { - hid_t tid; + hid_t tid; hsize_t i; - + /* Create the memory data type. */ if ((tid = H5Tcreate (H5T_COMPOUND, size )) < 0 ) goto out; /* Insert fields. */ - for ( i = 0; i < nfields; i++) + for ( i = 0; i < nfields; i++) { if ( H5Tinsert(tid, field_names[i], field_offset[i], field_types[i] ) < 0 ) goto out; @@ -1984,7 +1984,7 @@ out: * Function: H5LTrepack * * Purpose: Packs/Unpacks data from buffers. This function transfers data from a packed - * data, src_buf, to a "natural byte aligned" (an n-byte item at an n-byte boundary) + * data, src_buf, to a "natural byte aligned" (an n-byte item at an n-byte boundary) * data, dst_buf, and vice-versa. * * Return: Success: 0, Failure: -1 @@ -1993,7 +1993,7 @@ out: * * Date: January 17, 2002 * - * Comments: + * Comments: * * Modifications: * @@ -2001,16 +2001,16 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LTrepack( hsize_t nfields, - hsize_t nrecords, - size_t src_size, - const size_t *src_offset, - const size_t *src_sizes, - size_t dst_size, - const size_t *dst_offset, +herr_t H5LTrepack( hsize_t nfields, + hsize_t nrecords, + size_t src_size, + const size_t *src_offset, + const size_t *src_sizes, + size_t dst_size, + const size_t *dst_offset, const size_t *dst_sizes, - unsigned char *src_buf, - unsigned char *dst_buf ) + unsigned char *src_buf, + unsigned char *dst_buf ) { hsize_t i, j; /* size of each field of destination data counting with padding */ @@ -2042,12 +2042,12 @@ herr_t H5LTrepack( hsize_t nfields, src_buf += src_sizes[j]; } - + } - + if ( size_pad != NULL ) free( size_pad ); - + return 0; out: @@ -2057,9 +2057,9 @@ out: /*------------------------------------------------------------------------- - * + * * Get attribute functions - * + * *------------------------------------------------------------------------- */ @@ -2083,10 +2083,10 @@ out: */ -herr_t H5LTget_attribute_string( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute_string( hid_t loc_id, + const char *obj_name, const char *attr_name, - char *data ) + char *data ) { /* identifiers */ @@ -2096,7 +2096,7 @@ herr_t H5LTget_attribute_string( hid_t loc_id, /* Get the type of object */ if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) return -1; - + /* Open the object */ if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) return -1; @@ -2130,10 +2130,10 @@ herr_t H5LTget_attribute_string( hid_t loc_id, * *------------------------------------------------------------------------- */ -herr_t H5LTget_attribute_char( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute_char( hid_t loc_id, + const char *obj_name, const char *attr_name, - char *data ) + char *data ) { /* identifiers */ @@ -2143,7 +2143,7 @@ herr_t H5LTget_attribute_char( hid_t loc_id, /* Get the type of object */ if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) return -1; - + /* Open the object */ if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) return -1; @@ -2177,10 +2177,10 @@ herr_t H5LTget_attribute_char( hid_t loc_id, * *------------------------------------------------------------------------- */ -herr_t H5LTget_attribute_uchar( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute_uchar( hid_t loc_id, + const char *obj_name, const char *attr_name, - unsigned char *data ) + unsigned char *data ) { /* identifiers */ @@ -2190,7 +2190,7 @@ herr_t H5LTget_attribute_uchar( hid_t loc_id, /* Get the type of object */ if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) return -1; - + /* Open the object */ if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) return -1; @@ -2226,10 +2226,10 @@ herr_t H5LTget_attribute_uchar( hid_t loc_id, * *------------------------------------------------------------------------- */ -herr_t H5LTget_attribute_short( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute_short( hid_t loc_id, + const char *obj_name, const char *attr_name, - short *data ) + short *data ) { /* identifiers */ @@ -2239,7 +2239,7 @@ herr_t H5LTget_attribute_short( hid_t loc_id, /* Get the type of object */ if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) return -1; - + /* Open the object */ if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) return -1; @@ -2273,10 +2273,10 @@ herr_t H5LTget_attribute_short( hid_t loc_id, * *------------------------------------------------------------------------- */ -herr_t H5LTget_attribute_ushort( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute_ushort( hid_t loc_id, + const char *obj_name, const char *attr_name, - unsigned short *data ) + unsigned short *data ) { /* identifiers */ @@ -2286,7 +2286,7 @@ herr_t H5LTget_attribute_ushort( hid_t loc_id, /* Get the type of object */ if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) return -1; - + /* Open the object */ if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) return -1; @@ -2322,10 +2322,10 @@ herr_t H5LTget_attribute_ushort( hid_t loc_id, * *------------------------------------------------------------------------- */ -herr_t H5LTget_attribute_int( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute_int( hid_t loc_id, + const char *obj_name, const char *attr_name, - int *data ) + int *data ) { /* identifiers */ @@ -2335,7 +2335,7 @@ herr_t H5LTget_attribute_int( hid_t loc_id, /* Get the type of object */ if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) return -1; - + /* Open the object */ if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) return -1; @@ -2369,10 +2369,10 @@ herr_t H5LTget_attribute_int( hid_t loc_id, * *------------------------------------------------------------------------- */ -herr_t H5LTget_attribute_uint( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute_uint( hid_t loc_id, + const char *obj_name, const char *attr_name, - unsigned int *data ) + unsigned int *data ) { /* identifiers */ @@ -2382,7 +2382,7 @@ herr_t H5LTget_attribute_uint( hid_t loc_id, /* Get the type of object */ if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) return -1; - + /* Open the object */ if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) return -1; @@ -2418,10 +2418,10 @@ herr_t H5LTget_attribute_uint( hid_t loc_id, * *------------------------------------------------------------------------- */ -herr_t H5LTget_attribute_long( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute_long( hid_t loc_id, + const char *obj_name, const char *attr_name, - long *data ) + long *data ) { /* identifiers */ @@ -2431,7 +2431,7 @@ herr_t H5LTget_attribute_long( hid_t loc_id, /* Get the type of object */ if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) return -1; - + /* Open the object */ if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) return -1; @@ -2464,10 +2464,10 @@ herr_t H5LTget_attribute_long( hid_t loc_id, * *------------------------------------------------------------------------- */ -herr_t H5LTget_attribute_long_long( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute_long_long( hid_t loc_id, + const char *obj_name, const char *attr_name, - long_long *data ) + long_long *data ) { /* identifiers */ @@ -2477,7 +2477,7 @@ herr_t H5LTget_attribute_long_long( hid_t loc_id, /* Get the type of object */ if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) return -1; - + /* Open the object */ if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) return -1; @@ -2512,10 +2512,10 @@ herr_t H5LTget_attribute_long_long( hid_t loc_id, * *------------------------------------------------------------------------- */ -herr_t H5LTget_attribute_ulong( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute_ulong( hid_t loc_id, + const char *obj_name, const char *attr_name, - unsigned long *data ) + unsigned long *data ) { /* identifiers */ @@ -2525,7 +2525,7 @@ herr_t H5LTget_attribute_ulong( hid_t loc_id, /* Get the type of object */ if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) return -1; - + /* Open the object */ if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) return -1; @@ -2562,10 +2562,10 @@ herr_t H5LTget_attribute_ulong( hid_t loc_id, */ -herr_t H5LTget_attribute_float( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute_float( hid_t loc_id, + const char *obj_name, const char *attr_name, - float *data ) + float *data ) { /* identifiers */ @@ -2575,7 +2575,7 @@ herr_t H5LTget_attribute_float( hid_t loc_id, /* Get the type of object */ if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) return -1; - + /* Open the object */ if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) return -1; @@ -2612,10 +2612,10 @@ herr_t H5LTget_attribute_float( hid_t loc_id, */ -herr_t H5LTget_attribute_double( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute_double( hid_t loc_id, + const char *obj_name, const char *attr_name, - double *data ) + double *data ) { /* identifiers */ @@ -2625,7 +2625,7 @@ herr_t H5LTget_attribute_double( hid_t loc_id, /* Get the type of object */ if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) return -1; - + /* Open the object */ if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) return -1; @@ -2662,11 +2662,11 @@ herr_t H5LTget_attribute_double( hid_t loc_id, */ -herr_t H5LTget_attribute( hid_t loc_id, - const char *obj_name, +herr_t H5LTget_attribute( hid_t loc_id, + const char *obj_name, const char *attr_name, hid_t mem_type_id, - void *data ) + void *data ) { /* identifiers */ @@ -2676,7 +2676,7 @@ herr_t H5LTget_attribute( hid_t loc_id, /* Get the type of object */ if (H5Gget_objinfo(loc_id, obj_name, 1, &statbuf)<0) return -1; - + /* Open the object */ if ((obj_id = H5LT_open_id( loc_id, obj_name, statbuf.type )) < 0) return -1; @@ -2695,7 +2695,7 @@ herr_t H5LTget_attribute( hid_t loc_id, return 0; } - + /*------------------------------------------------------------------------- * private functions *------------------------------------------------------------------------- @@ -2721,10 +2721,10 @@ herr_t H5LTget_attribute( hid_t loc_id, */ -herr_t H5LT_get_attribute_mem( hid_t obj_id, +herr_t H5LT_get_attribute_mem( hid_t obj_id, const char *attr_name, hid_t mem_type_id, - void *data ) + void *data ) { /* identifiers */ @@ -2764,9 +2764,9 @@ out: *------------------------------------------------------------------------- */ -herr_t H5LT_get_attribute_disk( hid_t loc_id, +herr_t H5LT_get_attribute_disk( hid_t loc_id, const char *attr_name, - void *attr_out ) + void *attr_out ) { /* identifiers */ hid_t attr_id; @@ -2780,7 +2780,7 @@ herr_t H5LT_get_attribute_disk( hid_t loc_id, if ( H5Aread( attr_id, attr_type, attr_out ) < 0 ) goto out; - + if ( H5Tclose( attr_type ) < 0 ) goto out; @@ -2818,26 +2818,26 @@ out: */ -herr_t H5LT_set_attribute_string(hid_t dset_id, +herr_t H5LT_set_attribute_string(hid_t dset_id, char *name, - char *buf ) + char *buf ) { hid_t tid; hid_t sid; hid_t aid; int has_attr; size_t size; - + /* verify if the attribute already exists */ has_attr = H5LT_find_attribute(dset_id,name); - + /* the attribute already exists, delete it */ if ( has_attr == 1 ) { if ( H5Adelete(dset_id,name)<0) return FAIL; } - + /*------------------------------------------------------------------------- * create the attribute type *------------------------------------------------------------------------- @@ -2856,7 +2856,7 @@ herr_t H5LT_set_attribute_string(hid_t dset_id, if ((sid = H5Screate(H5S_SCALAR))<0) goto out; - + /*------------------------------------------------------------------------- * create and write the attribute *------------------------------------------------------------------------- @@ -2866,10 +2866,10 @@ herr_t H5LT_set_attribute_string(hid_t dset_id, if (H5Awrite(aid,tid,buf)<0) goto out; - + if (H5Aclose(aid)<0) goto out; - + if (H5Sclose(sid)<0) goto out; @@ -2877,7 +2877,7 @@ herr_t H5LT_set_attribute_string(hid_t dset_id, goto out; return SUCCESS; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { @@ -2886,6 +2886,6 @@ out: H5Sclose(sid); } H5E_END_TRY; return FAIL; - + } diff --git a/hl/src/H5LT.h b/hl/src/H5LT.h index 53b97ba..c9d6269 100644 --- a/hl/src/H5LT.h +++ b/hl/src/H5LT.h @@ -46,51 +46,51 @@ extern "C" { *------------------------------------------------------------------------- */ -H5_HLDLL herr_t H5LTmake_dataset( hid_t loc_id, - const char *dset_name, - int rank, +H5_HLDLL herr_t H5LTmake_dataset( hid_t loc_id, + const char *dset_name, + int rank, const hsize_t *dims, hid_t type_id, const void *buffer ); -H5_HLDLL herr_t H5LTmake_dataset_char( hid_t loc_id, - const char *dset_name, - int rank, +H5_HLDLL herr_t H5LTmake_dataset_char( hid_t loc_id, + const char *dset_name, + int rank, const hsize_t *dims, const char *buffer ); -H5_HLDLL herr_t H5LTmake_dataset_short( hid_t loc_id, - const char *dset_name, - int rank, +H5_HLDLL herr_t H5LTmake_dataset_short( hid_t loc_id, + const char *dset_name, + int rank, const hsize_t *dims, const short *buffer ); -H5_HLDLL herr_t H5LTmake_dataset_int( hid_t loc_id, - const char *dset_name, - int rank, +H5_HLDLL herr_t H5LTmake_dataset_int( hid_t loc_id, + const char *dset_name, + int rank, const hsize_t *dims, const int *buffer ); -H5_HLDLL herr_t H5LTmake_dataset_long( hid_t loc_id, - const char *dset_name, - int rank, +H5_HLDLL herr_t H5LTmake_dataset_long( hid_t loc_id, + const char *dset_name, + int rank, const hsize_t *dims, const long *buffer ); -H5_HLDLL herr_t H5LTmake_dataset_float( hid_t loc_id, - const char *dset_name, - int rank, +H5_HLDLL herr_t H5LTmake_dataset_float( hid_t loc_id, + const char *dset_name, + int rank, const hsize_t *dims, const float *buffer ); -H5_HLDLL herr_t H5LTmake_dataset_double( hid_t loc_id, - const char *dset_name, - int rank, +H5_HLDLL herr_t H5LTmake_dataset_double( hid_t loc_id, + const char *dset_name, + int rank, const hsize_t *dims, const double *buffer ); -H5_HLDLL herr_t H5LTmake_dataset_string( hid_t loc_id, - const char *dset_name, +H5_HLDLL herr_t H5LTmake_dataset_string( hid_t loc_id, + const char *dset_name, const char *buf ); @@ -101,36 +101,36 @@ H5_HLDLL herr_t H5LTmake_dataset_string( hid_t loc_id, *------------------------------------------------------------------------- */ -H5_HLDLL herr_t H5LTread_dataset( hid_t loc_id, +H5_HLDLL herr_t H5LTread_dataset( hid_t loc_id, const char *dset_name, hid_t type_id, void *buffer ); -H5_HLDLL herr_t H5LTread_dataset_char( hid_t loc_id, +H5_HLDLL herr_t H5LTread_dataset_char( hid_t loc_id, const char *dset_name, char *buffer ); -H5_HLDLL herr_t H5LTread_dataset_short( hid_t loc_id, +H5_HLDLL herr_t H5LTread_dataset_short( hid_t loc_id, const char *dset_name, short *buffer ); -H5_HLDLL herr_t H5LTread_dataset_int( hid_t loc_id, +H5_HLDLL herr_t H5LTread_dataset_int( hid_t loc_id, const char *dset_name, int *buffer ); -H5_HLDLL herr_t H5LTread_dataset_long( hid_t loc_id, +H5_HLDLL herr_t H5LTread_dataset_long( hid_t loc_id, const char *dset_name, long *buffer ); -H5_HLDLL herr_t H5LTread_dataset_float( hid_t loc_id, +H5_HLDLL herr_t H5LTread_dataset_float( hid_t loc_id, const char *dset_name, float *buffer ); -H5_HLDLL herr_t H5LTread_dataset_double( hid_t loc_id, +H5_HLDLL herr_t H5LTread_dataset_double( hid_t loc_id, const char *dset_name, double *buffer ); -H5_HLDLL herr_t H5LTread_dataset_string( hid_t loc_id, +H5_HLDLL herr_t H5LTread_dataset_string( hid_t loc_id, const char *dset_name, char *buf ); @@ -142,17 +142,17 @@ H5_HLDLL herr_t H5LTread_dataset_string( hid_t loc_id, */ -H5_HLDLL herr_t H5LTget_dataset_ndims( hid_t loc_id, +H5_HLDLL herr_t H5LTget_dataset_ndims( hid_t loc_id, const char *dset_name, int *rank ); -H5_HLDLL herr_t H5LTget_dataset_info( hid_t loc_id, +H5_HLDLL herr_t H5LTget_dataset_info( hid_t loc_id, const char *dset_name, hsize_t *dims, H5T_class_t *type_class, size_t *type_size ); -H5_HLDLL herr_t H5LTfind_dataset( hid_t loc_id, const char *name ); +H5_HLDLL herr_t H5LTfind_dataset( hid_t loc_id, const char *name ); @@ -164,73 +164,73 @@ H5_HLDLL herr_t H5LTfind_dataset( hid_t loc_id, const char *name ); */ -H5_HLDLL herr_t H5LTset_attribute_string( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTset_attribute_string( hid_t loc_id, + const char *obj_name, const char *attr_name, const char *attr_data ); -H5_HLDLL herr_t H5LTset_attribute_char( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTset_attribute_char( hid_t loc_id, + const char *obj_name, const char *attr_name, const char *buffer, size_t size ); -H5_HLDLL herr_t H5LTset_attribute_uchar( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTset_attribute_uchar( hid_t loc_id, + const char *obj_name, const char *attr_name, const unsigned char *buffer, size_t size ); -H5_HLDLL herr_t H5LTset_attribute_short( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTset_attribute_short( hid_t loc_id, + const char *obj_name, const char *attr_name, const short *buffer, size_t size ); -H5_HLDLL herr_t H5LTset_attribute_ushort( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTset_attribute_ushort( hid_t loc_id, + const char *obj_name, const char *attr_name, const unsigned short *buffer, size_t size ); -H5_HLDLL herr_t H5LTset_attribute_int( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTset_attribute_int( hid_t loc_id, + const char *obj_name, const char *attr_name, const int *buffer, size_t size ); -H5_HLDLL herr_t H5LTset_attribute_uint( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTset_attribute_uint( hid_t loc_id, + const char *obj_name, const char *attr_name, const unsigned int *buffer, size_t size ); -H5_HLDLL herr_t H5LTset_attribute_long( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTset_attribute_long( hid_t loc_id, + const char *obj_name, const char *attr_name, const long *buffer, size_t size ); -H5_HLDLL herr_t H5LTset_attribute_long_long( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTset_attribute_long_long( hid_t loc_id, + const char *obj_name, const char *attr_name, const long_long *buffer, size_t size ); -H5_HLDLL herr_t H5LTset_attribute_ulong( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTset_attribute_ulong( hid_t loc_id, + const char *obj_name, const char *attr_name, const unsigned long *buffer, size_t size ); -H5_HLDLL herr_t H5LTset_attribute_float( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTset_attribute_float( hid_t loc_id, + const char *obj_name, const char *attr_name, const float *buffer, size_t size ); -H5_HLDLL herr_t H5LTset_attribute_double( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTset_attribute_double( hid_t loc_id, + const char *obj_name, const char *attr_name, const double *buffer, size_t size ); @@ -242,69 +242,69 @@ H5_HLDLL herr_t H5LTset_attribute_double( hid_t loc_id, *------------------------------------------------------------------------- */ -H5_HLDLL herr_t H5LTget_attribute( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute( hid_t loc_id, + const char *obj_name, const char *attr_name, hid_t mem_type_id, void *data ); -H5_HLDLL herr_t H5LTget_attribute_string( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute_string( hid_t loc_id, + const char *obj_name, const char *attr_name, char *data ); -H5_HLDLL herr_t H5LTget_attribute_char( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute_char( hid_t loc_id, + const char *obj_name, const char *attr_name, char *data ); -H5_HLDLL herr_t H5LTget_attribute_uchar( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute_uchar( hid_t loc_id, + const char *obj_name, const char *attr_name, unsigned char *data ); -H5_HLDLL herr_t H5LTget_attribute_short( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute_short( hid_t loc_id, + const char *obj_name, const char *attr_name, short *data ); -H5_HLDLL herr_t H5LTget_attribute_ushort( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute_ushort( hid_t loc_id, + const char *obj_name, const char *attr_name, unsigned short *data ); -H5_HLDLL herr_t H5LTget_attribute_int( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute_int( hid_t loc_id, + const char *obj_name, const char *attr_name, int *data ); -H5_HLDLL herr_t H5LTget_attribute_uint( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute_uint( hid_t loc_id, + const char *obj_name, const char *attr_name, unsigned int *data ); -H5_HLDLL herr_t H5LTget_attribute_long( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute_long( hid_t loc_id, + const char *obj_name, const char *attr_name, long *data ); -H5_HLDLL herr_t H5LTget_attribute_long_long( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute_long_long( hid_t loc_id, + const char *obj_name, const char *attr_name, long_long *data ); -H5_HLDLL herr_t H5LTget_attribute_ulong( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute_ulong( hid_t loc_id, + const char *obj_name, const char *attr_name, unsigned long *data ); -H5_HLDLL herr_t H5LTget_attribute_float( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute_float( hid_t loc_id, + const char *obj_name, const char *attr_name, float *data ); -H5_HLDLL herr_t H5LTget_attribute_double( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute_double( hid_t loc_id, + const char *obj_name, const char *attr_name, double *data ); @@ -317,13 +317,13 @@ H5_HLDLL herr_t H5LTget_attribute_double( hid_t loc_id, */ -H5_HLDLL herr_t H5LTget_attribute_ndims( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute_ndims( hid_t loc_id, + const char *obj_name, const char *attr_name, int *rank ); -H5_HLDLL herr_t H5LTget_attribute_info( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LTget_attribute_info( hid_t loc_id, + const char *obj_name, const char *attr_name, hsize_t *dims, H5T_class_t *type_class, @@ -341,51 +341,51 @@ H5_HLDLL herr_t H5LTget_attribute_info( hid_t loc_id, */ -H5_HLDLL hid_t H5LTcreate_compound_type( hsize_t nfields, size_t size, const char *field_names[], +H5_HLDLL hid_t H5LTcreate_compound_type( hsize_t nfields, size_t size, const char *field_names[], const size_t *field_offset, const hid_t *field_types ); -H5_HLDLL herr_t H5LTrepack( hsize_t nfields, - hsize_t nrecords, - size_t src_size, - const size_t *src_offset, - const size_t *src_sizes, - size_t dst_size, - const size_t *dst_offset, +H5_HLDLL herr_t H5LTrepack( hsize_t nfields, + hsize_t nrecords, + size_t src_size, + const size_t *src_offset, + const size_t *src_sizes, + size_t dst_size, + const size_t *dst_offset, const size_t *dst_sizes, - unsigned char *src_buf, + unsigned char *src_buf, unsigned char *dst_buf ); /*------------------------------------------------------------------------- - * + * * Private functions - * + * *------------------------------------------------------------------------- */ -H5_HLDLL herr_t H5LT_get_attribute_mem( hid_t obj_id, +H5_HLDLL herr_t H5LT_get_attribute_mem( hid_t obj_id, const char *attr_name, hid_t mem_type_id, void *data ); -H5_HLDLL herr_t H5LT_get_attribute_disk( hid_t obj_id, +H5_HLDLL herr_t H5LT_get_attribute_disk( hid_t obj_id, const char *attr_name, void *data ); -H5_HLDLL herr_t H5LT_find_attribute( hid_t loc_id, const char *name ); +H5_HLDLL herr_t H5LT_find_attribute( hid_t loc_id, const char *name ); -H5_HLDLL herr_t H5LT_set_attribute_numerical( hid_t loc_id, - const char *obj_name, +H5_HLDLL herr_t H5LT_set_attribute_numerical( hid_t loc_id, + const char *obj_name, const char *attr_name, size_t size, hid_t type_id, const void *data ); -H5_HLDLL herr_t H5LT_set_attribute_string( hid_t dset_id, +H5_HLDLL herr_t H5LT_set_attribute_string( hid_t dset_id, char *name, char *buf ); diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index d59e9ed..083e0e7 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -54,8 +54,8 @@ herr_t H5PT_set_index(htbl_t *table_id, hsize_t pt_index); * * Date: March 12, 2004 * - * Comments: This function does not handle compression or fill data - * currently. Fill data is not necessary because the + * Comments: This function does not handle compression or fill data + * currently. Fill data is not necessary because the * table is initially of size 0. * * Modifications: @@ -112,7 +112,7 @@ hid_t H5PTcreate_fl ( hid_t loc_id, /* Create the table identifier */ table->dset_id = dset_id; - if((table->type_id = H5Tcopy(dtype_id)) <0) + if((table->type_id = H5Tcopy(dtype_id)) <0) goto out; H5PT_create_index(table); @@ -152,8 +152,8 @@ hid_t H5PTcreate_fl ( hid_t loc_id, * * Date: April 12, 2004 * - * Comments: This function does not handle compression or fill data - * currently. Fill data is not necessary because the + * Comments: This function does not handle compression or fill data + * currently. Fill data is not necessary because the * table is initially of size 0. * * Modifications: @@ -200,7 +200,7 @@ out: * * Date: March 10, 2004 * - * Comments: + * Comments: * * Modifications: * @@ -273,7 +273,7 @@ out: /*------------------------------------------------------------------------- * Function: H5PT_close * - * Purpose: Closes a table (i.e. cleans up all open resources used by a + * Purpose: Closes a table (i.e. cleans up all open resources used by a * table). * * Return: Success: 0, Failure: -1 @@ -283,7 +283,7 @@ out: * * Date: March 10, 2004 * - * Comments: + * Comments: * * Modifications: * @@ -321,7 +321,7 @@ out: /*------------------------------------------------------------------------- * Function: H5PTclose * - * Purpose: Closes a table (i.e. cleans up all open resources used by a + * Purpose: Closes a table (i.e. cleans up all open resources used by a * table). * * Return: Success: 0, Failure: -1 @@ -331,7 +331,7 @@ out: * * Date: April 21, 2004 * - * Comments: + * Comments: * * Modifications: * @@ -386,7 +386,7 @@ out: * * Date: March 12, 2004 * - * Comments: + * Comments: * * Modifications: * @@ -406,7 +406,7 @@ herr_t H5PTappend( hid_t table_id, if (nrecords == 0) return 0; - if((H5TBcommon_append_records(table->dset_id, table->type_id, + if((H5TBcommon_append_records(table->dset_id, table->type_id, nrecords, table->size, data)) <0) goto out; @@ -427,9 +427,9 @@ out: /*------------------------------------------------------------------------- - * Function: H5PTget_next + * Function: H5PTget_next * - * Purpose: Reads packets starting at the current index and updates + * Purpose: Reads packets starting at the current index and updates * that index * * Return: Success: 0, Failure: -1 @@ -441,7 +441,7 @@ out: * * Comments: * - * Modifications: + * Modifications: * * *------------------------------------------------------------------------- @@ -460,7 +460,7 @@ herr_t H5PTget_next( hid_t table_id, if (nrecords == 0) return 0; - if((H5TBcommon_read_records(table->dset_id, table->type_id, + if((H5TBcommon_read_records(table->dset_id, table->type_id, table->current_index, nrecords, table->size, data)) < 0) goto out; @@ -473,7 +473,7 @@ out: } /*------------------------------------------------------------------------- - * Function: H5PTread_packets + * Function: H5PTread_packets * * Purpose: Reads packets from anywhere in a packet table * @@ -484,9 +484,9 @@ out: * * Date: March 12, 2004 * - * Comments: + * Comments: * - * Modifications: + * Modifications: * * *------------------------------------------------------------------------- @@ -507,7 +507,7 @@ herr_t H5PTread_packets( hid_t table_id, if (nrecords == 0) return 0; - if( H5TBcommon_read_records(table->dset_id, table->type_id, + if( H5TBcommon_read_records(table->dset_id, table->type_id, start, nrecords, table->size, data) < 0) goto out; @@ -518,9 +518,9 @@ out: } /*------------------------------------------------------------------------- - * + * * Table attribute functions - * + * *------------------------------------------------------------------------- */ @@ -536,9 +536,9 @@ out: * * Date: March 12, 2004 * - * Comments: + * Comments: * - * Modifications: + * Modifications: * *------------------------------------------------------------------------- */ @@ -578,9 +578,9 @@ herr_t H5PT_set_index(htbl_t *table, hsize_t index) * * Date: April 23, 2004 * - * Comments: + * Comments: * - * Modifications: + * Modifications: * *------------------------------------------------------------------------- */ @@ -613,7 +613,7 @@ herr_t H5PTset_index(hid_t table_id, hsize_t pt_index) */ /*------------------------------------------------------------------------- - * Function: H5PTget_num_packets + * Function: H5PTget_num_packets * * Purpose: Returns by reference the number of packets in the dataset * @@ -626,7 +626,7 @@ herr_t H5PTset_index(hid_t table_id, hsize_t pt_index) * * Comments: * - * Modifications: + * Modifications: * * *------------------------------------------------------------------------- @@ -648,7 +648,7 @@ out: /*------------------------------------------------------------------------- - * Function: H5PTis_valid + * Function: H5PTis_valid * * Purpose: Validates a table identifier * @@ -661,7 +661,7 @@ out: * * Comments: * - * Modifications: + * Modifications: * * *------------------------------------------------------------------------- @@ -676,7 +676,7 @@ herr_t H5PTis_valid(hid_t table_id) } /*------------------------------------------------------------------------- - * Function: H5PTis_varlen + * Function: H5PTis_varlen * * Purpose: Returns 1 if a table_id corresponds to a packet table of variable- * length records or 0 for fixed-length records. @@ -690,7 +690,7 @@ herr_t H5PTis_valid(hid_t table_id) * * Comments: * - * Modifications: + * Modifications: * * *------------------------------------------------------------------------- @@ -716,16 +716,16 @@ out: } /*------------------------------------------------------------------------- - * + * * Memory Management functions - * + * *------------------------------------------------------------------------- */ /*------------------------------------------------------------------------- * Function: H5PTfree_vlen_readbuff * - * Purpose: Frees memory used when reading from a variable length packet + * Purpose: Frees memory used when reading from a variable length packet * table. * * Return: Success: 0, Failure: -1 @@ -738,7 +738,7 @@ out: * * Comments: * - * Modifications: + * Modifications: * * *------------------------------------------------------------------------- diff --git a/hl/src/H5PT.h b/hl/src/H5PT.h index 699419e..9d07131 100644 --- a/hl/src/H5PT.h +++ b/hl/src/H5PT.h @@ -90,9 +90,9 @@ H5_HLDLL herr_t H5PTis_valid( hid_t table_id ); H5_HLDLL herr_t H5PTis_varlen( hid_t table_id ); /*------------------------------------------------------------------------- - * + * * Packet Table "current index" functions - * + * *------------------------------------------------------------------------- */ @@ -102,9 +102,9 @@ H5_HLDLL herr_t H5PTset_index( hid_t table_id, hsize_t pt_index ); /*------------------------------------------------------------------------- - * + * * Memory Management functions - * + * *------------------------------------------------------------------------- */ diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 59642da..c67747f 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -21,25 +21,25 @@ /*------------------------------------------------------------------------- - * + * * Private functions - * + * *------------------------------------------------------------------------- */ -int H5TB_find_field(const char *field, +int H5TB_find_field(const char *field, const char *field_list); -herr_t H5TB_attach_attributes(const char *table_title, - hid_t loc_id, +herr_t H5TB_attach_attributes(const char *table_title, + hid_t loc_id, const char *dset_name, - hsize_t nfields, + hsize_t nfields, hid_t tid ); -hid_t H5TB_create_type(hid_t loc_id, +hid_t H5TB_create_type(hid_t loc_id, const char *dset_name, - size_t dst_size, - const size_t *dst_offset, + size_t dst_size, + const size_t *dst_offset, const size_t *dst_sizes, hid_t ftype_id); @@ -64,14 +64,14 @@ hid_t H5TB_create_type(hid_t loc_id, * * Comments: The data is packed * - * Modifications: + * Modifications: * *------------------------------------------------------------------------- */ herr_t H5TBmake_table( const char *table_title, - hid_t loc_id, + hid_t loc_id, const char *dset_name, hsize_t nfields, hsize_t nrecords, @@ -82,12 +82,12 @@ herr_t H5TBmake_table( const char *table_title, hsize_t chunk_size, void *fill_data, int compress, - const void *data ) + const void *data ) { hid_t did; - hid_t sid; - hid_t mem_type_id; + hid_t sid; + hid_t mem_type_id; hid_t plist_id; hsize_t dims[1]; hsize_t dims_chunk[1]; @@ -107,7 +107,7 @@ herr_t H5TBmake_table( const char *table_title, return -1; /* Insert fields. */ - for ( i = 0; i < nfields; i++) + for ( i = 0; i < nfields; i++) { if ( H5Tinsert(mem_type_id, field_names[i], field_offset[i], field_types[i] ) < 0 ) return -1; @@ -125,25 +125,25 @@ herr_t H5TBmake_table( const char *table_title, /* Set the fill value using a struct as the data type. */ if ( fill_data ) { - if ( H5Pset_fill_value( plist_id, mem_type_id, fill_data ) < 0 ) + if ( H5Pset_fill_value( plist_id, mem_type_id, fill_data ) < 0 ) return -1; } - /* - Dataset creation property list is modified to use - GZIP compression with the compression effort set to 6. - Note that compression can be used only when dataset is chunked. + /* + Dataset creation property list is modified to use + GZIP compression with the compression effort set to 6. + Note that compression can be used only when dataset is chunked. */ if ( compress ) { - if ( H5Pset_deflate( plist_id, 6) < 0 ) + if ( H5Pset_deflate( plist_id, 6) < 0 ) return -1; } - + /* Create the dataset. */ if ( (did = H5Dcreate( loc_id, dset_name, mem_type_id, sid, plist_id )) < 0 ) goto out; - + /* Only write if there is something to write */ if ( data ) { @@ -151,8 +151,8 @@ herr_t H5TBmake_table( const char *table_title, if ( H5Dwrite( did, mem_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, data ) < 0 ) goto out; } - - /* Terminate access to the data space. */ + + /* Terminate access to the data space. */ if ( H5Sclose( sid ) < 0 ) goto out; @@ -168,7 +168,7 @@ herr_t H5TBmake_table( const char *table_title, * Set the conforming table attributes *------------------------------------------------------------------------- */ - + /* Attach the CLASS attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, "CLASS", TABLE_CLASS ) < 0 ) goto out; @@ -176,7 +176,7 @@ herr_t H5TBmake_table( const char *table_title, /* Attach the VERSION attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, "VERSION", "2.0" ) < 0 ) goto out; - + /* Attach the TITLE attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, "TITLE", table_title ) < 0 ) goto out; @@ -193,7 +193,7 @@ herr_t H5TBmake_table( const char *table_title, strcat( attr_name, aux ); sprintf( aux, "%s", "_NAME" ); strcat( attr_name, aux ); - + /* Attach the attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, attr_name, member_name ) < 0 ) goto out; @@ -211,7 +211,7 @@ herr_t H5TBmake_table( const char *table_title, /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) return -1; - + if (( sid = H5Screate(H5S_SCALAR)) < 0 ) goto out; @@ -229,28 +229,28 @@ herr_t H5TBmake_table( const char *table_title, if ( (attr_id = H5Acreate( did, attr_name, field_types[i], sid, H5P_DEFAULT )) < 0 ) goto out; - + if ( H5Awrite( attr_id, field_types[i], tmp_buf+field_offset[i] ) < 0 ) goto out; - + if ( H5Aclose( attr_id ) < 0 ) goto out; free( member_name ); } - + /* Close the dataset. */ H5Dclose( did ); - /* Close data space. */ + /* Close data space. */ H5Sclose( sid ); } - + /* Release the datatype. */ if ( H5Tclose( mem_type_id ) < 0 ) return -1; - - + + return 0; /* error zone, gracefully close */ @@ -279,7 +279,7 @@ out: * * Return: Success: 0, Failure: -1 * - * Programmers: + * Programmers: * Pedro Vicente, pvn@ncsa.uiuc.edu * Quincey Koziol * @@ -287,23 +287,23 @@ out: * * Comments: Uses memory offsets * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBappend_records( hid_t loc_id, +herr_t H5TBappend_records( hid_t loc_id, const char *dset_name, hsize_t nrecords, size_t dst_size, const size_t *dst_offset, const size_t *dst_sizes, - const void *data ) + const void *data ) { hid_t did; - hid_t tid=-1; + hid_t tid=-1; hid_t mem_type_id=-1; hid_t sid=-1; hid_t mem_space_id=-1; @@ -327,7 +327,7 @@ herr_t H5TBappend_records( hid_t loc_id, /* Append the records */ if ((H5TBcommon_append_records(did, mem_type_id, nrecords, nrecords_orig, data))<0) - goto out; + goto out; /* Release the datatype. */ if ( H5Tclose( tid ) < 0 ) @@ -341,7 +341,7 @@ herr_t H5TBappend_records( hid_t loc_id, if ( H5Dclose( did ) < 0 ) goto out; - + return 0; /* error zone, gracefully close */ @@ -369,27 +369,27 @@ out: * * Comments: Uses memory offsets * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBwrite_records( hid_t loc_id, +herr_t H5TBwrite_records( hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t dst_size, const size_t *dst_offset, const size_t *dst_sizes, - const void *data ) + const void *data ) { hid_t did; - hid_t tid; - hsize_t count[1]; + hid_t tid; + hsize_t count[1]; hsize_t offset[1]; hid_t sid=-1; hid_t mem_space_id=-1; @@ -418,7 +418,7 @@ herr_t H5TBwrite_records( hid_t loc_id, if ( start + nrecords > dims[0] ) goto out; - + /* Define a hyperslab in the dataset of the size of the records */ offset[0] = start; count[0] = nrecords; @@ -440,7 +440,7 @@ herr_t H5TBwrite_records( hid_t loc_id, /* Terminate access to the dataspace */ if ( H5Sclose( sid ) < 0 ) goto out; - + /* Release the datatype. */ if ( H5Tclose( tid ) < 0 ) goto out; @@ -453,7 +453,7 @@ herr_t H5TBwrite_records( hid_t loc_id, if ( H5Dclose( did ) < 0 ) return -1; - + return 0; /* error zone, gracefully close */ @@ -481,13 +481,13 @@ out: * * Comments: * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBwrite_fields_name( hid_t loc_id, +herr_t H5TBwrite_fields_name( hid_t loc_id, const char *dset_name, const char *field_names, hsize_t start, @@ -495,15 +495,15 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, - const void *data ) + const void *data ) { hid_t did; - hid_t tid=-1; + hid_t tid=-1; hid_t write_type_id=-1; hid_t member_type_id; hid_t nmtype_id; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hid_t sid=-1; char *member_name; @@ -513,9 +513,9 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, size_t size_native; /* Create xfer properties to preserve initialized data */ - if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) + if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) return -1; - if (H5Pset_preserve (PRESERVE, 1)<0) + if (H5Pset_preserve (PRESERVE, 1)<0) return -1; /* Open the dataset. */ @@ -525,7 +525,7 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, /* Get the datatype */ if ( (tid = H5Dget_type( did )) < 0 ) goto out; - + /* Get the number of fields */ if ( ( nfields = H5Tget_nmembers( tid )) < 0 ) goto out; @@ -552,9 +552,9 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, /* Convert to native type */ if ((nmtype_id=H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT))<0) goto out; - + size_native=H5Tget_size(nmtype_id); - + /* Adjust, if necessary */ if (dst_sizes[j]!=size_native) { @@ -601,7 +601,7 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, /* Write */ if ( H5Dwrite( did, write_type_id, H5S_ALL, sid, PRESERVE, data ) < 0 ) goto out; - + /* End access to the write id */ if ( H5Tclose( write_type_id ) ) goto out; @@ -617,7 +617,7 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, /* End access to the property list */ if ( H5Pclose( PRESERVE ) < 0 ) return -1; - + return 0; /* error zone, gracefully close */ @@ -648,15 +648,15 @@ out: * * Comments: Uses memory offsets * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBwrite_fields_index( hid_t loc_id, +herr_t H5TBwrite_fields_index( hid_t loc_id, const char *dset_name, hsize_t nfields, const int *field_index, @@ -665,15 +665,15 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, - const void *data ) + const void *data ) { hid_t did; - hid_t tid=-1; + hid_t tid=-1; hid_t write_type_id=-1; hid_t member_type_id; hid_t nmtype_id; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hid_t sid=-1; char *member_name; @@ -682,9 +682,9 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, size_t size_native; /* Create xfer properties to preserve initialized data */ - if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) + if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) return -1; - if (H5Pset_preserve (PRESERVE, 1)<0) + if (H5Pset_preserve (PRESERVE, 1)<0) return -1; /* Open the dataset. */ @@ -694,11 +694,11 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, /* Get the datatype */ if ( (tid = H5Dget_type( did )) < 0 ) goto out; - + /* Get the number of fields */ if ( H5Tget_nmembers( tid ) < 0 ) goto out; - + /* Create a write id */ if ( ( write_type_id = H5Tcreate( H5T_COMPOUND, type_size )) < 0 ) goto out; @@ -709,7 +709,7 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, { j = field_index[i]; - + /* Get the member name */ member_name = H5Tget_member_name( tid, (unsigned) j ); @@ -720,9 +720,9 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, /* Convert to native type */ if ((nmtype_id=H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT))<0) goto out; - + size_native=H5Tget_size(nmtype_id); - + if (dst_sizes[i]!=size_native) { if (H5Tset_size(nmtype_id, dst_sizes[i])<0) @@ -748,7 +748,7 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, goto out; free( member_name ); - + } /* Get the dataspace handle */ @@ -764,7 +764,7 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, /* Write */ if ( H5Dwrite( did, write_type_id, H5S_ALL, sid, PRESERVE, data ) < 0 ) goto out; - + /* End access to the write id */ if ( H5Tclose( write_type_id ) ) goto out; @@ -780,7 +780,7 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, /* End access to the property list */ if ( H5Pclose( PRESERVE ) < 0 ) return -1; - + return 0; /* error zone, gracefully close */ @@ -817,25 +817,25 @@ out: * * Comments: * - * Modifications: April 1, 2004 + * Modifications: April 1, 2004 * used a memory type ID returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBread_table( hid_t loc_id, +herr_t H5TBread_table( hid_t loc_id, const char *dset_name, - size_t dst_size, - const size_t *dst_offset, + size_t dst_size, + const size_t *dst_offset, const size_t *dst_sizes, - void *dst_buf ) + void *dst_buf ) { hid_t did; - hid_t ftype_id=-1; + hid_t ftype_id=-1; hid_t mem_type_id=-1; hid_t sid; hsize_t dims[1]; - + /* open the dataset. */ if ((did=H5Dopen(loc_id,dset_name))<0) return -1; @@ -843,13 +843,13 @@ herr_t H5TBread_table( hid_t loc_id, /* get the dataspace handle */ if ( (sid = H5Dget_space( did )) < 0 ) goto out; - + /* get dimensions */ if ( H5Sget_simple_extent_dims( sid, dims, NULL) < 0 ) goto out; /* get the datatypes */ - if ((ftype_id=H5Dget_type (did))<0) + if ((ftype_id=H5Dget_type (did))<0) goto out; if ((mem_type_id=H5TB_create_type(loc_id,dset_name,dst_size,dst_offset,dst_sizes,ftype_id))<0) @@ -893,30 +893,30 @@ out: * * Date: November 19, 2001 * - * Comments: + * Comments: * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBread_records( hid_t loc_id, +herr_t H5TBread_records( hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, size_t dst_size, const size_t *dst_offset, const size_t *dst_sizes, - void *data ) + void *data ) { hid_t did; - hid_t ftype_id; + hid_t ftype_id; hid_t mem_type_id=-1; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hid_t sid=-1; hsize_t dims[1]; @@ -936,7 +936,7 @@ herr_t H5TBread_records( hid_t loc_id, /* get the datatypes */ if ( (ftype_id = H5Dget_type( did )) < 0 ) goto out; - + if ((mem_type_id=H5TB_create_type(loc_id,dset_name,dst_size,dst_offset,dst_sizes,ftype_id))<0) goto out; @@ -1011,15 +1011,15 @@ out: * * Comments: * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBread_fields_name( hid_t loc_id, +herr_t H5TBread_fields_name( hid_t loc_id, const char *dset_name, const char *field_names, hsize_t start, @@ -1027,24 +1027,24 @@ herr_t H5TBread_fields_name( hid_t loc_id, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, - void *data ) + void *data ) { hid_t did; - hid_t ftype_id=-1; + hid_t ftype_id=-1; hid_t mem_type_id=-1; hid_t mtype_id; hid_t nmtype_id; char *member_name; hssize_t nfields; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hid_t sid=-1; hid_t mem_space_id=-1; hsize_t mem_size[1]; size_t size_native; hssize_t i, j; - + /* open the dataset */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) goto out; @@ -1076,9 +1076,9 @@ herr_t H5TBread_fields_name( hid_t loc_id, /* convert to native type */ if ((nmtype_id=H5Tget_native_type(mtype_id,H5T_DIR_DEFAULT))<0) goto out; - + size_native=H5Tget_size(nmtype_id); - + if (dst_sizes[j]!=size_native) { if (H5Tset_size(nmtype_id, dst_sizes[j])<0) @@ -1136,7 +1136,7 @@ herr_t H5TBread_fields_name( hid_t loc_id, goto out; if ( H5Dclose( did ) < 0 ) return -1; - + return 0; /* error zone, gracefully close */ @@ -1166,15 +1166,15 @@ out: * * Comments: * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBread_fields_index( hid_t loc_id, +herr_t H5TBread_fields_index( hid_t loc_id, const char *dset_name, hsize_t nfields, const int *field_index, @@ -1183,16 +1183,16 @@ herr_t H5TBread_fields_index( hid_t loc_id, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, - void *data ) + void *data ) { hid_t did; - hid_t tid=-1; + hid_t tid=-1; hid_t read_type_id=-1; hid_t member_type_id; hid_t nmtype_id; char *member_name; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hid_t sid=-1; hid_t mem_space_id=-1; @@ -1216,7 +1216,7 @@ herr_t H5TBread_fields_index( hid_t loc_id, for ( i = 0; i < nfields; i++) { j = field_index[i]; - + /* Get the member name */ member_name = H5Tget_member_name( tid, (unsigned) j ); @@ -1227,13 +1227,13 @@ herr_t H5TBread_fields_index( hid_t loc_id, /* Get the member size */ if ( H5Tget_size( member_type_id ) == 0 ) goto out; - + /* Convert to native type */ if ((nmtype_id=H5Tget_native_type(member_type_id,H5T_DIR_DEFAULT))<0) goto out; - + size_native=H5Tget_size(nmtype_id); - + if (dst_sizes[i]!=size_native) { if (H5Tset_size(nmtype_id, dst_sizes[i])<0) @@ -1251,7 +1251,7 @@ herr_t H5TBread_fields_index( hid_t loc_id, if ( H5Tinsert( read_type_id, member_name, 0, nmtype_id ) < 0 ) goto out; } - + /* Close the member type */ if ( H5Tclose( member_type_id ) < 0 ) goto out; @@ -1270,7 +1270,7 @@ herr_t H5TBread_fields_index( hid_t loc_id, count[0] = nrecords; if ( H5Sselect_hyperslab( sid, H5S_SELECT_SET, offset, NULL, count, NULL) < 0 ) goto out; - + /* Create a memory dataspace handle */ mem_size[0] = count[0]; if ( (mem_space_id = H5Screate_simple( 1, mem_size, NULL )) < 0 ) @@ -1287,7 +1287,7 @@ herr_t H5TBread_fields_index( hid_t loc_id, /* Terminate access to the memory dataspace */ if ( H5Sclose( mem_space_id ) < 0 ) goto out; - + /* End access to the read id */ if ( H5Tclose( read_type_id ) ) goto out; @@ -1299,7 +1299,7 @@ herr_t H5TBread_fields_index( hid_t loc_id, /* End access to the dataset */ if ( H5Dclose( did ) < 0 ) return -1; - + return 0; /* error zone, gracefully close */ @@ -1340,7 +1340,7 @@ out: *------------------------------------------------------------------------- */ -herr_t H5TBdelete_record( hid_t loc_id, +herr_t H5TBdelete_record( hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords ) @@ -1351,8 +1351,8 @@ herr_t H5TBdelete_record( hid_t loc_id, hsize_t read_start; hsize_t read_nrecords; hid_t did; - hid_t tid; - hsize_t count[1]; + hid_t tid; + hsize_t count[1]; hsize_t offset[1]; hid_t sid; hid_t mem_space_id; @@ -1366,7 +1366,7 @@ herr_t H5TBdelete_record( hid_t loc_id, hsize_t dims[1]; #endif - + /*------------------------------------------------------------------------- * First we get information about type size and offsets on disk *------------------------------------------------------------------------- @@ -1381,11 +1381,11 @@ herr_t H5TBdelete_record( hid_t loc_id, if ( src_offset == NULL ) return -1; - + /* Get field info */ if ( H5TBget_field_info( loc_id, dset_name, NULL, src_sizes, src_offset, &src_size ) < 0 ) return -1; - + /*------------------------------------------------------------------------- * Read the records after the deleted one(s) *------------------------------------------------------------------------- @@ -1399,7 +1399,7 @@ herr_t H5TBdelete_record( hid_t loc_id, return -1; /* Read the records after the deleted one(s) */ - if ( H5TBread_records( loc_id, dset_name, read_start, read_nrecords, src_size, + if ( H5TBread_records( loc_id, dset_name, read_start, read_nrecords, src_size, src_offset, src_sizes, tmp_buf ) < 0 ) return -1; @@ -1412,7 +1412,7 @@ herr_t H5TBdelete_record( hid_t loc_id, /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) return -1; - + /* Get the datatype */ if ( (tid = H5Dget_type( did )) < 0 ) goto out; @@ -1461,11 +1461,11 @@ herr_t H5TBdelete_record( hid_t loc_id, /* End access to the dataset */ if ( H5Dclose( did ) < 0 ) return -1; - + free( tmp_buf ); free( src_offset ); free( src_sizes ); - + /*------------------------------------------------------------------------- * Store the new dimension as an attribute @@ -1474,11 +1474,11 @@ herr_t H5TBdelete_record( hid_t loc_id, nrows = ntotal_records - nrecords; /* Set the attribute */ - if (H5LT_set_attribute_numerical(loc_id,dset_name,"NROWS",1, + if (H5LT_set_attribute_numerical(loc_id,dset_name,"NROWS",1, H5T_NATIVE_LLONG,&nrows)<0) return -1; - + return 0; out: @@ -1499,15 +1499,15 @@ out: * * Comments: Uses memory offsets * - * Modifications: April 1, 2004 - * the DST_SIZES parameter is used to define the memory type ID - * returned by H5TB_create_type + * Modifications: April 1, 2004 + * the DST_SIZES parameter is used to define the memory type ID + * returned by H5TB_create_type * *------------------------------------------------------------------------- */ -herr_t H5TBinsert_record( hid_t loc_id, +herr_t H5TBinsert_record( hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, @@ -1521,18 +1521,18 @@ herr_t H5TBinsert_record( hid_t loc_id, hsize_t ntotal_records; hsize_t read_nrecords; hid_t did; - hid_t tid=-1; + hid_t tid=-1; hid_t mem_type_id=-1; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hid_t sid=-1; hid_t mem_space_id=-1; hsize_t dims[1]; hsize_t mem_dims[1]; unsigned char *tmp_buf; - + /*------------------------------------------------------------------------- - * Read the records after the inserted one(s) + * Read the records after the inserted one(s) *------------------------------------------------------------------------- */ @@ -1556,7 +1556,7 @@ herr_t H5TBinsert_record( hid_t loc_id, tmp_buf = (unsigned char *)calloc((size_t) read_nrecords, dst_size ); /* Read the records after the inserted one(s) */ - if ( H5TBread_records( loc_id, dset_name, start, read_nrecords, dst_size, dst_offset, + if ( H5TBread_records( loc_id, dset_name, start, read_nrecords, dst_size, dst_offset, dst_sizes, tmp_buf ) < 0 ) return -1; @@ -1565,7 +1565,7 @@ herr_t H5TBinsert_record( hid_t loc_id, if ( H5Dextend ( did, dims ) < 0 ) goto out; - + /*------------------------------------------------------------------------- * Write the inserted records *------------------------------------------------------------------------- @@ -1588,13 +1588,13 @@ herr_t H5TBinsert_record( hid_t loc_id, if ( H5Dwrite( did, mem_type_id, mem_space_id, sid, H5P_DEFAULT, data ) < 0 ) goto out; - + /* Terminate access to the dataspace */ if ( H5Sclose( mem_space_id ) < 0 ) goto out; if ( H5Sclose( sid ) < 0 ) goto out; - + /*------------------------------------------------------------------------- * Write the "pushed down" records *------------------------------------------------------------------------- @@ -1617,7 +1617,7 @@ herr_t H5TBinsert_record( hid_t loc_id, if ( H5Dwrite( did, mem_type_id, mem_space_id, sid, H5P_DEFAULT, tmp_buf ) < 0 ) goto out; - + /* Terminate access to the dataspace */ if ( H5Sclose( mem_space_id ) < 0 ) goto out; @@ -1664,7 +1664,7 @@ out: * * Date: December 5, 2001 * - * Comments: + * Comments: * * Modifications: * @@ -1672,22 +1672,22 @@ out: *------------------------------------------------------------------------- */ -herr_t H5TBadd_records_from( hid_t loc_id, +herr_t H5TBadd_records_from( hid_t loc_id, const char *dset_name1, hsize_t start1, hsize_t nrecords, const char *dset_name2, - hsize_t start2 ) + hsize_t start2 ) { /* Identifiers for the 1st dataset. */ hid_t dataset_id1; - hid_t type_id1; + hid_t type_id1; hid_t space_id1=-1; hid_t mem_space_id1=-1; size_t type_size1; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hsize_t mem_size[1]; hsize_t nfields; @@ -1711,13 +1711,13 @@ herr_t H5TBadd_records_from( hid_t loc_id, if ( src_offset == NULL ) return -1; - + /* Get field info */ if ( H5TBget_field_info( loc_id, dset_name1, NULL, src_sizes, src_offset, &src_size ) < 0 ) return -1; - + /*------------------------------------------------------------------------- - * Get information about the first table and read it + * Get information about the first table and read it *------------------------------------------------------------------------- */ @@ -1754,12 +1754,12 @@ herr_t H5TBadd_records_from( hid_t loc_id, goto out; /*------------------------------------------------------------------------- - * Add to the second table + * Add to the second table *------------------------------------------------------------------------- */ if ( H5TBinsert_record(loc_id,dset_name2,start2,nrecords,src_size,src_offset,src_sizes,tmp_buf ) < 0 ) goto out; - + /*------------------------------------------------------------------------- * Close resources for table 1 *------------------------------------------------------------------------- @@ -1772,7 +1772,7 @@ herr_t H5TBadd_records_from( hid_t loc_id, /* Terminate access to the dataspace */ if ( H5Sclose( space_id1 ) < 0 ) goto out; - + /* Release the datatype. */ if ( H5Tclose( type_id1 ) < 0 ) return -1; @@ -1784,7 +1784,7 @@ herr_t H5TBadd_records_from( hid_t loc_id, free( tmp_buf ); free( src_offset ); free( src_sizes ); - + return 0; /* error zone, gracefully close */ @@ -1810,14 +1810,14 @@ out: * * Date: December 10, 2001 * - * Comments: + * Comments: * * Modifications: * * *------------------------------------------------------------------------- */ -herr_t H5TBcombine_tables( hid_t loc_id1, +herr_t H5TBcombine_tables( hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const char *dset_name2, @@ -1826,23 +1826,23 @@ herr_t H5TBcombine_tables( hid_t loc_id1, /* Identifiers for the 1st dataset. */ hid_t dataset_id1; - hid_t type_id1; + hid_t type_id1; hid_t space_id1; hid_t plist_id1; /* Identifiers for the 2nd dataset. */ hid_t dataset_id2; - hid_t type_id2; + hid_t type_id2; hid_t space_id2; hid_t plist_id2; /* Identifiers for the 3rd dataset. */ hid_t dataset_id3; - hid_t type_id3; + hid_t type_id3; hid_t space_id3; hid_t plist_id3; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hid_t mem_space_id; hsize_t mem_size[1]; @@ -1850,7 +1850,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, hsize_t nrecords; hsize_t dims[1]; hsize_t maxdims[1] = { H5S_UNLIMITED }; - + size_t type_size; hid_t sid; @@ -1882,13 +1882,13 @@ herr_t H5TBcombine_tables( hid_t loc_id1, if ( src_offset == NULL ) return -1; - + /* Get field info */ if ( H5TBget_field_info( loc_id1, dset_name1, NULL, src_sizes, src_offset, &src_size ) < 0 ) return -1; /*------------------------------------------------------------------------- - * Get information about the first table + * Get information about the first table *------------------------------------------------------------------------- */ @@ -1911,7 +1911,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, /* Get the dimensions */ if ( H5TBget_table_info ( loc_id1, dset_name1, &nfields, &nrecords ) < 0 ) return -1; - + /*------------------------------------------------------------------------- * Make the merged table with no data originally *------------------------------------------------------------------------- @@ -1966,44 +1966,44 @@ herr_t H5TBcombine_tables( hid_t loc_id1, */ if ( has_fill == 1 ) { - + if (( sid = H5Screate(H5S_SCALAR)) < 0 ) goto out; - + for ( i = 0; i < nfields; i++) { - + /* Get the member type */ if ( ( member_type_id = H5Tget_member_type( type_id3, (unsigned) i )) < 0 ) goto out; - + /* Get the member offset */ member_offset = H5Tget_member_offset( type_id3, (unsigned) i ); - + strcpy( attr_name, "FIELD_" ); sprintf( aux, "%d", (int) i ); strcat( attr_name, aux ); sprintf( aux, "%s", "_FILL" ); strcat( attr_name, aux ); - + if ( (attr_id = H5Acreate( dataset_id3, attr_name, member_type_id, sid, H5P_DEFAULT )) < 0 ) goto out; - + if ( H5Awrite( attr_id, member_type_id, tmp_fill_buf+member_offset ) < 0 ) goto out; - + if ( H5Aclose( attr_id ) < 0 ) goto out; if ( H5Tclose( member_type_id ) < 0 ) goto out; } - - /* Close data space. */ + + /* Close data space. */ if ( H5Sclose( sid ) < 0 ) goto out; } - + /*------------------------------------------------------------------------- * Read data from 1st table *------------------------------------------------------------------------- @@ -2024,7 +2024,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, if ( H5Dread( dataset_id1, type_id1, mem_space_id, space_id1, H5P_DEFAULT, tmp_buf ) < 0 ) goto out; - + /*------------------------------------------------------------------------- * Save data from 1st table into new table *------------------------------------------------------------------------- @@ -2046,7 +2046,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, /* Terminate access to the dataspace */ if ( H5Sclose( space_id1 ) < 0 ) goto out; - + /* Release the datatype. */ if ( H5Tclose( type_id1 ) < 0 ) goto out; @@ -2063,7 +2063,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, free( tmp_buf ); /*------------------------------------------------------------------------- - * Get information about the 2nd table + * Get information about the 2nd table *------------------------------------------------------------------------- */ @@ -2108,7 +2108,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, if ( H5Dread( dataset_id2, type_id2, mem_space_id, space_id2, H5P_DEFAULT, tmp_buf ) < 0 ) goto out; - + /*------------------------------------------------------------------------- * Save data from 2nd table into new table *------------------------------------------------------------------------- @@ -2130,7 +2130,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, /* Terminate access to the dataspace */ if ( H5Sclose( space_id2 ) < 0 ) goto out; - + /* Release the datatype. */ if ( H5Tclose( type_id2 ) < 0 ) return -1; @@ -2151,7 +2151,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, /* Terminate access to the dataspace */ if ( H5Sclose( space_id3 ) < 0 ) return -1; - + /* Release the datatype. */ if ( H5Tclose( type_id3 ) < 0 ) return -1; @@ -2191,32 +2191,32 @@ out: * * Date: January 30, 2002 * - * Comments: + * Comments: * - * Modifications: + * Modifications: * *------------------------------------------------------------------------- */ -herr_t H5TBinsert_field( hid_t loc_id, +herr_t H5TBinsert_field( hid_t loc_id, const char *dset_name, const char *field_name, hid_t field_type, hsize_t position, const void *fill_data, - const void *data ) + const void *data ) { /* Identifiers for the 1st, original dataset */ hid_t dataset_id1; - hid_t type_id1; + hid_t type_id1; hid_t space_id1; hid_t plist_id1; hid_t mem_space_id1; /* Identifiers for the 2nd, new dataset */ hid_t dataset_id2; - hid_t type_id2; + hid_t type_id2; hid_t space_id2; hid_t plist_id2; hid_t mem_space_id2; @@ -2231,7 +2231,7 @@ herr_t H5TBinsert_field( hid_t loc_id, hsize_t dims_chunk[1]; hsize_t dims[1]; hsize_t maxdims[1] = { H5S_UNLIMITED }; - hsize_t count[1]; + hsize_t count[1]; hsize_t offset[1]; hsize_t mem_size[1]; hid_t write_type_id; @@ -2251,16 +2251,16 @@ herr_t H5TBinsert_field( hid_t loc_id, /* Get the number of records and fields */ if ( H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords ) < 0 ) return -1; - + /*------------------------------------------------------------------------- * Get information about the old data type *------------------------------------------------------------------------- */ - + /* Open the dataset. */ if ( (dataset_id1 = H5Dopen( loc_id, dset_name )) < 0 ) return -1; - + /* Get creation properties list */ if ( (plist_id1 = H5Dget_create_plist( dataset_id1 )) < 0 ) goto out; @@ -2272,7 +2272,7 @@ herr_t H5TBinsert_field( hid_t loc_id, /* Get the size of the datatype */ if ( ( total_size = H5Tget_size( type_id1 )) == 0 ) goto out; - + /* Get the dataspace handle */ if ( (space_id1 = H5Dget_space( dataset_id1 )) < 0 ) goto out; @@ -2313,7 +2313,7 @@ herr_t H5TBinsert_field( hid_t loc_id, inserted = 0; /* Insert the old fields, counting with the new one */ - for ( i = 0; i < nfields + 1; i++) + for ( i = 0; i < nfields + 1; i++) { idx = i; @@ -2337,7 +2337,7 @@ herr_t H5TBinsert_field( hid_t loc_id, continue; } - + /* Get the member name */ member_name = H5Tget_member_name( type_id1, (unsigned)idx ); @@ -2347,7 +2347,7 @@ herr_t H5TBinsert_field( hid_t loc_id, /* Get the member size */ member_size = H5Tget_size( member_type_id ); - + /* Insert it into the new type */ if ( H5Tinsert( type_id2, member_name, curr_offset, member_type_id ) < 0 ) goto out; @@ -2360,9 +2360,9 @@ herr_t H5TBinsert_field( hid_t loc_id, if ( H5Tclose( member_type_id ) < 0 ) goto out; - + } /* i */ - + /*------------------------------------------------------------------------- * Create a new temporary dataset *------------------------------------------------------------------------- @@ -2407,7 +2407,7 @@ herr_t H5TBinsert_field( hid_t loc_id, if ( H5Dread( dataset_id1, type_id1, mem_space_id1, H5S_ALL, H5P_DEFAULT, tmp_buf ) < 0 ) goto out; - + /*------------------------------------------------------------------------- * Save data from 1st table into new table, using the 1st type id *------------------------------------------------------------------------- @@ -2427,15 +2427,15 @@ herr_t H5TBinsert_field( hid_t loc_id, /* Create a write id */ if ( ( write_type_id = H5Tcreate( H5T_COMPOUND, (size_t)new_member_size )) < 0 ) goto out; - + /* The field in the file is found by its name */ if ( H5Tinsert( write_type_id, field_name, 0, field_type ) < 0 ) goto out; /* Create xfer properties to preserve initialized data */ - if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) + if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) goto out; - if (H5Pset_preserve (PRESERVE, 1)<0) + if (H5Pset_preserve (PRESERVE, 1)<0) goto out; /* Only write if there is something to write */ @@ -2468,8 +2468,8 @@ herr_t H5TBinsert_field( hid_t loc_id, /* Terminate access to the memory dataspace */ if ( H5Sclose( mem_space_id1 ) < 0 ) - goto out; - + goto out; + /* Release the datatype. */ if ( H5Tclose( type_id1 ) < 0 ) goto out; @@ -2495,7 +2495,7 @@ herr_t H5TBinsert_field( hid_t loc_id, /* Terminate access to the dataspace */ if ( H5Sclose( space_id2 ) < 0 ) goto out; - + /* Release the datatype. */ if ( H5Tclose( type_id2 ) < 0 ) return -1; @@ -2511,7 +2511,7 @@ herr_t H5TBinsert_field( hid_t loc_id, * Delete 1st table *------------------------------------------------------------------------- */ - if ( H5Gunlink( loc_id, dset_name ) < 0 ) + if ( H5Gunlink( loc_id, dset_name ) < 0 ) return -1; /*------------------------------------------------------------------------- @@ -2519,7 +2519,7 @@ herr_t H5TBinsert_field( hid_t loc_id, *------------------------------------------------------------------------- */ - if ( H5Gmove( loc_id, "new", dset_name ) < 0 ) + if ( H5Gmove( loc_id, "new", dset_name ) < 0 ) return -1; /*------------------------------------------------------------------------- @@ -2567,10 +2567,10 @@ herr_t H5TBinsert_field( hid_t loc_id, if ( (attr_id = H5Acreate( dataset_id1, attr_name, member_type_id, space_id1, H5P_DEFAULT )) < 0 ) goto out; - + if ( H5Awrite( attr_id, member_type_id, tmp_fill_buf+member_offset ) < 0 ) goto out; - + if ( H5Aclose( attr_id ) < 0 ) goto out; @@ -2598,19 +2598,19 @@ herr_t H5TBinsert_field( hid_t loc_id, if ( (attr_id = H5Acreate( dataset_id1, attr_name, member_type_id, space_id1, H5P_DEFAULT )) < 0 ) goto out; - + if ( H5Awrite( attr_id, member_type_id, fill_data ) < 0 ) goto out; - + if ( H5Aclose( attr_id ) < 0 ) goto out; if ( H5Tclose( member_type_id ) < 0 ) goto out; - + } - - /* Close data space. */ + + /* Close data space. */ if ( H5Sclose( space_id1 ) < 0 ) goto out; @@ -2621,12 +2621,12 @@ herr_t H5TBinsert_field( hid_t loc_id, /* End access to the dataset */ if ( H5Dclose( dataset_id1 ) < 0 ) goto out; - + /* Release resources. */ free ( tmp_buf ); free ( tmp_fill_buf ); - + return 0; out: @@ -2645,7 +2645,7 @@ out: * * Date: January 30, 2002 * - * Comments: + * Comments: * * Modifications: * @@ -2653,20 +2653,20 @@ out: *------------------------------------------------------------------------- */ -herr_t H5TBdelete_field( hid_t loc_id, +herr_t H5TBdelete_field( hid_t loc_id, const char *dset_name, - const char *field_name ) + const char *field_name ) { /* Identifiers for the 1st original dataset */ hid_t dataset_id1; - hid_t type_id1; + hid_t type_id1; hid_t space_id1; hid_t plist_id1; /* Identifiers for the 2nd new dataset */ hid_t dataset_id2; - hid_t type_id2; + hid_t type_id2; hid_t space_id2; hid_t plist_id2; @@ -2694,11 +2694,11 @@ herr_t H5TBdelete_field( hid_t loc_id, hid_t attr_id; hsize_t i; int has_fill=0; - + /* Get the number of records and fields */ if ( H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords ) < 0 ) return -1; - + /*------------------------------------------------------------------------- * Get information about the old data type *------------------------------------------------------------------------- @@ -2718,7 +2718,7 @@ herr_t H5TBdelete_field( hid_t loc_id, /* Get the size of the datatype */ type_size1 = H5Tget_size( type_id1 ); - + /* Get the dataspace handle */ if ( (space_id1 = H5Dget_space( dataset_id1 )) < 0 ) goto out; @@ -2733,9 +2733,9 @@ herr_t H5TBdelete_field( hid_t loc_id, */ /* Check out the field */ - for ( i = 0; i < nfields; i++) + for ( i = 0; i < nfields; i++) { - + /* Get the member name */ member_name = H5Tget_member_name( type_id1,(unsigned) i ); @@ -2748,7 +2748,7 @@ herr_t H5TBdelete_field( hid_t loc_id, /* Get the member size */ delete_member_size = H5Tget_size( member_type_id ); - + /* Close the member type */ if ( H5Tclose( member_type_id ) < 0 ) goto out; @@ -2760,7 +2760,7 @@ herr_t H5TBdelete_field( hid_t loc_id, } free( member_name ); - + } /* i */ /* No field to delete was found */ @@ -2787,15 +2787,15 @@ herr_t H5TBdelete_field( hid_t loc_id, * Get attributes from previous table in the process *------------------------------------------------------------------------- */ - + /* Get the table title */ if ( (H5TBAget_title( dataset_id1, table_title )) < 0 ) goto out; /* Insert the old fields except the one to delete */ - for ( i = 0; i < nfields; i++) + for ( i = 0; i < nfields; i++) { - + /* Get the member name */ member_name = H5Tget_member_name( type_id1, (unsigned) i ); @@ -2812,11 +2812,11 @@ herr_t H5TBdelete_field( hid_t loc_id, /* Get the member size */ member_size = H5Tget_size( member_type_id ); - + /* Insert it into the new type */ if ( H5Tinsert( type_id2, member_name, curr_offset, member_type_id ) < 0 ) goto out; - + /*------------------------------------------------------------------------- * Get the fill value information *------------------------------------------------------------------------- @@ -2845,9 +2845,9 @@ herr_t H5TBdelete_field( hid_t loc_id, /* Close the member type */ if ( H5Tclose( member_type_id ) < 0 ) goto out; - + } /* i */ - + /*------------------------------------------------------------------------- * Create a new temporary dataset *------------------------------------------------------------------------- @@ -2874,9 +2874,9 @@ herr_t H5TBdelete_field( hid_t loc_id, * We have to read field by field of the old dataset and save it into the new one *------------------------------------------------------------------------- */ - for ( i = 0; i < nfields; i++) + for ( i = 0; i < nfields; i++) { - + /* Get the member name */ member_name = H5Tget_member_name( type_id1,(unsigned) i ); @@ -2903,23 +2903,23 @@ herr_t H5TBdelete_field( hid_t loc_id, goto out; tmp_buf = (unsigned char *)calloc((size_t) nrecords, member_size ); - + /* Read */ if ( H5Dread( dataset_id1, read_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp_buf ) < 0 ) goto out; - + /* Create a write id */ if ( ( write_type_id = H5Tcreate( H5T_COMPOUND, member_size )) < 0 ) goto out; - + /* The field in the file is found by its name */ if ( H5Tinsert( write_type_id, member_name, 0, member_type_id ) < 0 ) goto out; /* Create xfer properties to preserve initialized data */ - if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) + if ((PRESERVE = H5Pcreate (H5P_DATASET_XFER))<0) goto out; - if (H5Pset_preserve (PRESERVE, 1)<0) + if (H5Pset_preserve (PRESERVE, 1)<0) goto out; /* Write */ @@ -2932,7 +2932,7 @@ herr_t H5TBdelete_field( hid_t loc_id, /* Close the member type */ if ( H5Tclose( member_type_id ) < 0 ) - goto out; + goto out; /* Close the read type */ if ( H5Tclose( read_type_id ) < 0 ) @@ -2941,10 +2941,10 @@ herr_t H5TBdelete_field( hid_t loc_id, /* Close the write type */ if ( H5Tclose( write_type_id ) < 0 ) goto out; - + /* Release resources. */ free( member_name ); - free ( tmp_buf ); + free ( tmp_buf ); } /* i */ @@ -2952,7 +2952,7 @@ herr_t H5TBdelete_field( hid_t loc_id, * Release resources from 1st table *------------------------------------------------------------------------- */ - + /* Release the datatype. */ if ( H5Tclose( type_id1 ) < 0 ) goto out; @@ -2978,7 +2978,7 @@ herr_t H5TBdelete_field( hid_t loc_id, /* Terminate access to the dataspace */ if ( H5Sclose( space_id2 ) < 0 ) goto out; - + /* Release the datatype. */ if ( H5Tclose( type_id2 ) < 0 ) return -1; @@ -2996,7 +2996,7 @@ herr_t H5TBdelete_field( hid_t loc_id, *------------------------------------------------------------------------- */ - if ( H5Gunlink( loc_id, dset_name ) < 0 ) + if ( H5Gunlink( loc_id, dset_name ) < 0 ) return -1; /*------------------------------------------------------------------------- @@ -3004,9 +3004,9 @@ herr_t H5TBdelete_field( hid_t loc_id, *------------------------------------------------------------------------- */ - if ( H5Gmove( loc_id, "new", dset_name ) < 0 ) + if ( H5Gmove( loc_id, "new", dset_name ) < 0 ) return -1; - + /*------------------------------------------------------------------------- * Attach the conforming table attributes *------------------------------------------------------------------------- @@ -3035,45 +3035,45 @@ herr_t H5TBdelete_field( hid_t loc_id, if ( has_fill == 1 ) { - + if (( space_id1 = H5Screate(H5S_SCALAR)) < 0 ) goto out; - + for ( i = 0; i < nfields; i++) { - + /* Get the member type */ if ( ( member_type_id = H5Tget_member_type( type_id1, (unsigned)i )) < 0 ) goto out; - + /* Get the member offset */ member_offset = H5Tget_member_offset( type_id1, (unsigned)i ); - + strcpy( attr_name, "FIELD_" ); sprintf( aux, "%d", (int)i ); strcat( attr_name, aux ); sprintf( aux, "%s", "_FILL" ); strcat( attr_name, aux ); - + if ( (attr_id = H5Acreate( dataset_id1, attr_name, member_type_id, space_id1, H5P_DEFAULT )) < 0 ) goto out; - + if ( H5Awrite( attr_id, member_type_id, tmp_fill_buf+member_offset ) < 0 ) goto out; - + if ( H5Aclose( attr_id ) < 0 ) goto out; - + /* Close the member type */ if ( H5Tclose( member_type_id ) < 0 ) goto out; - + } - - /* Close data space. */ + + /* Close data space. */ if ( H5Sclose( space_id1 ) < 0 ) goto out; - + } /*has_fill*/ /* Release the datatype. */ @@ -3083,7 +3083,7 @@ herr_t H5TBdelete_field( hid_t loc_id, /* End access to the dataset */ if ( H5Dclose( dataset_id1 ) < 0 ) goto out; - + /* Release resources. */ free ( tmp_fill_buf ); @@ -3095,9 +3095,9 @@ out: } /*------------------------------------------------------------------------- - * + * * Table attribute functions - * + * *------------------------------------------------------------------------- */ @@ -3112,22 +3112,22 @@ out: * * Date: January 30, 2001 * - * Comments: + * Comments: * - * Modifications: + * Modifications: * *------------------------------------------------------------------------- */ -herr_t H5TBAget_title( hid_t loc_id, - char *table_title ) +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; - + return 0; } @@ -3143,18 +3143,18 @@ herr_t H5TBAget_title( hid_t loc_id, * * Date: January 30, 2002 * - * Comments: + * Comments: * - * Modifications: + * Modifications: * *------------------------------------------------------------------------- */ -herr_t H5TBAget_fill( hid_t loc_id, +herr_t H5TBAget_fill( hid_t loc_id, const char *dset_name, hid_t dset_id, - unsigned char *dst_buf ) + unsigned char *dst_buf ) { hsize_t nfields; @@ -3168,7 +3168,7 @@ herr_t H5TBAget_fill( hid_t loc_id, /* Get the number of records and fields */ if ( H5TBget_table_info ( loc_id, dset_name, &nfields, &nrecords ) < 0 ) return -1; - + src_offset = (size_t *)malloc((size_t)nfields * sizeof(size_t)); if (src_offset == NULL ) @@ -3217,7 +3217,7 @@ out: */ /*------------------------------------------------------------------------- - * Function: H5TBget_table_info + * Function: H5TBget_table_info * * Purpose: Gets the number of records and fields of a table * @@ -3230,26 +3230,26 @@ out: * Comments: * * Modifications: May 08, 2003 - * In version 2.0 of Table, the number of records is stored as an + * In version 2.0 of Table, the number of records is stored as an * attribute "NROWS" * * *------------------------------------------------------------------------- */ -herr_t H5TBget_table_info ( hid_t loc_id, +herr_t H5TBget_table_info ( hid_t loc_id, const char *dset_name, hsize_t *nfields, hsize_t *nrecords ) { - hid_t tid; + hid_t tid; hid_t sid=-1; hid_t did; int num_members; hsize_t dims[1]; int has_attr; hsize_t n[1]; - + /* Open the dataset. */ if ( (did = H5Dopen( loc_id, dset_name )) < 0 ) return -1; @@ -3270,19 +3270,19 @@ herr_t H5TBget_table_info ( hid_t loc_id, * Get number of records *------------------------------------------------------------------------- */ - + if (nrecords) { /* Try to find the attribute "NROWS" */ has_attr = H5LT_find_attribute( did, "NROWS" ); - + /* It exists, get it */ if ( has_attr == 1 ) { /* Get the attribute */ if ( H5LTget_attribute(loc_id,dset_name,"NROWS",H5T_NATIVE_LLONG,n)<0) return -1; - + *nrecords = *n; } else @@ -3290,15 +3290,15 @@ herr_t H5TBget_table_info ( hid_t loc_id, /* Get the dataspace handle */ if ( (sid = H5Dget_space( did )) < 0 ) goto out; - + /* Get records */ if ( H5Sget_simple_extent_dims( sid, dims, NULL) < 0 ) goto out; - + /* Terminate access to the dataspace */ if ( H5Sclose( sid ) < 0 ) goto out; - + *nrecords = dims[0]; } }/*nrecords*/ @@ -3340,7 +3340,7 @@ out: * *------------------------------------------------------------------------- */ -herr_t H5TBget_field_info( hid_t loc_id, +herr_t H5TBget_field_info( hid_t loc_id, const char *dset_name, char *field_names[], size_t *field_sizes, @@ -3348,7 +3348,7 @@ herr_t H5TBget_field_info( hid_t loc_id, size_t *type_size ) { hid_t did; - hid_t ftype_id; + hid_t ftype_id; hid_t native_type_id; hssize_t nfields; char *member_name; @@ -3414,7 +3414,7 @@ herr_t H5TBget_field_info( hid_t loc_id, goto out; free( member_name ); - + } /* i */ /* Release the datatype. */ @@ -3459,19 +3459,19 @@ out: int H5TB_find_field( const char *field, const char *field_list ) { - const char *start = field_list; - const char *end; + const char *start = field_list; + const char *end; - while ( (end = strstr( start, "," )) != 0 ) { - if ( strncmp(start,field,(size_t)(end-start)) == 0 ) return 1; - start = end + 1; - } + while ( (end = strstr( start, "," )) != 0 ) { + if ( strncmp(start,field,(size_t)(end-start)) == 0 ) return 1; + start = end + 1; + } - if ( strcmp( start, field ) == 0 ) return 1; + if ( strcmp( start, field ) == 0 ) return 1; - return -1; + return -1; -} +} /*------------------------------------------------------------------------- @@ -3496,17 +3496,17 @@ int H5TB_find_field( const char *field, const char *field_list ) herr_t H5TB_attach_attributes( const char *table_title, - hid_t loc_id, + hid_t loc_id, const char *dset_name, hsize_t nfields, - hid_t tid ) + hid_t tid ) { char attr_name[255]; char *member_name; char aux[255]; hsize_t i; - + /* Attach the CLASS attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, "CLASS", TABLE_CLASS ) < 0 ) goto out; @@ -3514,7 +3514,7 @@ herr_t H5TB_attach_attributes( const char *table_title, /* Attach the VERSION attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, "VERSION", "2.0" ) < 0 ) goto out; - + /* Attach the TITLE attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, "TITLE", table_title ) < 0 ) goto out; @@ -3531,7 +3531,7 @@ herr_t H5TB_attach_attributes( const char *table_title, strcat( attr_name, aux ); sprintf( aux, "%s", "_NAME" ); strcat( attr_name, aux ); - + /* Attach the attribute */ if ( H5LTset_attribute_string( loc_id, dset_name, attr_name, member_name ) < 0 ) goto out; @@ -3565,10 +3565,10 @@ out: *------------------------------------------------------------------------- */ -hid_t H5TB_create_type(hid_t loc_id, +hid_t H5TB_create_type(hid_t loc_id, const char *dset_name, - size_t dst_size, - const size_t *dst_offset, + size_t dst_size, + const size_t *dst_offset, const size_t *dst_sizes, hid_t ftype_id) { @@ -3587,7 +3587,7 @@ hid_t H5TB_create_type(hid_t loc_id, if ((fnames=malloc(sizeof(char*)*(size_t)nfields))==NULL) return -1; - for ( i=0; i<nfields; i++) + for ( i=0; i<nfields; i++) { if ((fnames[i]=malloc(sizeof(char)*HLTB_MAX_FIELD_LEN))==NULL) { free(fnames); @@ -3598,13 +3598,13 @@ hid_t H5TB_create_type(hid_t loc_id, /* get field info */ if ( H5TBget_field_info(loc_id,dset_name,fnames,NULL,NULL,NULL)<0) goto out; - + /* create the memory data type */ if ((mem_type_id=H5Tcreate(H5T_COMPOUND,dst_size))<0) goto out; /* get each field ID and adjust its size, if necessary */ - for ( i=0; i<nfields; i++) + for ( i=0; i<nfields; i++) { if ((mtype_id=H5Tget_member_type(ftype_id,i))<0) goto out; @@ -3624,7 +3624,7 @@ hid_t H5TB_create_type(hid_t loc_id, goto out; } - for ( i=0; i<nfields; i++) + for ( i=0; i<nfields; i++) { free (fnames[i]); } @@ -3638,7 +3638,7 @@ out: H5Tclose(mtype_id); H5Tclose(nmtype_id); } H5E_END_TRY; - for ( i=0; i<nfields; i++) + for ( i=0; i<nfields; i++) { if (fnames[i]) free (fnames[i]); diff --git a/hl/src/H5TB.h b/hl/src/H5TB.h index 015c158..ac0d619 100644 --- a/hl/src/H5TB.h +++ b/hl/src/H5TB.h @@ -47,7 +47,7 @@ extern "C" { */ H5_HLDLL herr_t H5TBmake_table( const char *table_title, - hid_t loc_id, + hid_t loc_id, const char *dset_name, hsize_t nfields, hsize_t nrecords, @@ -68,7 +68,7 @@ H5_HLDLL herr_t H5TBmake_table( const char *table_title, *------------------------------------------------------------------------- */ -H5_HLDLL herr_t H5TBappend_records( hid_t loc_id, +H5_HLDLL herr_t H5TBappend_records( hid_t loc_id, const char *dset_name, hsize_t nrecords, size_t type_size, @@ -76,7 +76,7 @@ H5_HLDLL herr_t H5TBappend_records( hid_t loc_id, const size_t *dst_sizes, const void *data ); -H5_HLDLL herr_t H5TBwrite_records( hid_t loc_id, +H5_HLDLL herr_t H5TBwrite_records( hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, @@ -86,7 +86,7 @@ H5_HLDLL herr_t H5TBwrite_records( hid_t loc_id, const void *data ); -H5_HLDLL herr_t H5TBwrite_fields_name( hid_t loc_id, +H5_HLDLL herr_t H5TBwrite_fields_name( hid_t loc_id, const char *dset_name, const char *field_names, hsize_t start, @@ -96,7 +96,7 @@ H5_HLDLL herr_t H5TBwrite_fields_name( hid_t loc_id, const size_t *dst_sizes, const void *data ); -H5_HLDLL herr_t H5TBwrite_fields_index( hid_t loc_id, +H5_HLDLL herr_t H5TBwrite_fields_index( hid_t loc_id, const char *dset_name, hsize_t nfields, const int *field_index, @@ -117,15 +117,15 @@ H5_HLDLL herr_t H5TBwrite_fields_index( hid_t loc_id, -H5_HLDLL herr_t H5TBread_table( hid_t loc_id, +H5_HLDLL herr_t H5TBread_table( hid_t loc_id, const char *dset_name, - size_t dst_size, - const size_t *dst_offset, + size_t dst_size, + const size_t *dst_offset, const size_t *dst_sizes, - void *dst_buf ); + void *dst_buf ); -H5_HLDLL herr_t H5TBread_fields_name( hid_t loc_id, +H5_HLDLL herr_t H5TBread_fields_name( hid_t loc_id, const char *dset_name, const char *field_names, hsize_t start, @@ -135,7 +135,7 @@ H5_HLDLL herr_t H5TBread_fields_name( hid_t loc_id, const size_t *dst_sizes, void *data ); -H5_HLDLL herr_t H5TBread_fields_index( hid_t loc_id, +H5_HLDLL herr_t H5TBread_fields_index( hid_t loc_id, const char *dset_name, hsize_t nfields, const int *field_index, @@ -147,7 +147,7 @@ H5_HLDLL herr_t H5TBread_fields_index( hid_t loc_id, void *data ); -H5_HLDLL herr_t H5TBread_records( hid_t loc_id, +H5_HLDLL herr_t H5TBread_records( hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, @@ -164,12 +164,12 @@ H5_HLDLL herr_t H5TBread_records( hid_t loc_id, */ -H5_HLDLL herr_t H5TBget_table_info ( hid_t loc_id, +H5_HLDLL herr_t H5TBget_table_info ( hid_t loc_id, const char *dset_name, hsize_t *nfields, hsize_t *nrecords ); -H5_HLDLL herr_t H5TBget_field_info( hid_t loc_id, +H5_HLDLL herr_t H5TBget_field_info( hid_t loc_id, const char *dset_name, char *field_names[], size_t *field_sizes, @@ -185,13 +185,13 @@ H5_HLDLL herr_t H5TBget_field_info( hid_t loc_id, */ -H5_HLDLL herr_t H5TBdelete_record( hid_t loc_id, +H5_HLDLL herr_t H5TBdelete_record( hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords ); -H5_HLDLL herr_t H5TBinsert_record( hid_t loc_id, +H5_HLDLL herr_t H5TBinsert_record( hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, @@ -200,20 +200,20 @@ H5_HLDLL herr_t H5TBinsert_record( hid_t loc_id, const size_t *dst_sizes, void *data ); -H5_HLDLL herr_t H5TBadd_records_from( hid_t loc_id, +H5_HLDLL herr_t H5TBadd_records_from( hid_t loc_id, const char *dset_name1, hsize_t start1, hsize_t nrecords, const char *dset_name2, hsize_t start2 ); -H5_HLDLL herr_t H5TBcombine_tables( hid_t loc_id1, +H5_HLDLL herr_t H5TBcombine_tables( hid_t loc_id1, const char *dset_name1, hid_t loc_id2, const char *dset_name2, const char *dset_name3 ); -H5_HLDLL herr_t H5TBinsert_field( hid_t loc_id, +H5_HLDLL herr_t H5TBinsert_field( hid_t loc_id, const char *dset_name, const char *field_name, hid_t field_type, @@ -221,22 +221,22 @@ H5_HLDLL herr_t H5TBinsert_field( hid_t loc_id, const void *fill_data, const void *data ); -H5_HLDLL herr_t H5TBdelete_field( hid_t loc_id, +H5_HLDLL herr_t H5TBdelete_field( hid_t loc_id, const char *dset_name, const char *field_name ); /*------------------------------------------------------------------------- - * + * * Table attribute functions - * + * *------------------------------------------------------------------------- */ -H5_HLDLL herr_t H5TBAget_title( hid_t loc_id, +H5_HLDLL herr_t H5TBAget_title( hid_t loc_id, char *table_title ); -H5_HLDLL herr_t H5TBAget_fill( hid_t loc_id, +H5_HLDLL herr_t H5TBAget_fill( hid_t loc_id, const char *dset_name, hid_t dset_id, unsigned char *dst_buf ); diff --git a/hl/test/pal_rgb.h b/hl/test/pal_rgb.h index 4b66220..08b5b61 100644 --- a/hl/test/pal_rgb.h +++ b/hl/test/pal_rgb.h @@ -258,7 +258,7 @@ const unsigned char pal_rgb[256*3] = {255,255,255, 131,0,0, 127,0,0 }; - + diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 8269805..41016d4 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -85,7 +85,7 @@ int main(void) if (nerrors) goto error; printf("All dimension scales tests passed.\n"); return 0; - + error: printf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S"); return 1; @@ -146,23 +146,23 @@ static int test_simple(void) char *name_out=NULL; /* scale name buffer */ char snames[3]; /* scale name buffer */ int i, j; - - + + printf("Testing API functions\n"); - + /*------------------------------------------------------------------------- * create a file for the test *------------------------------------------------------------------------- - */ + */ /* create a file using default properties */ if ((fid=H5Fcreate(FILE1,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) goto out; - + /*------------------------------------------------------------------------- * create datasets: 1 "data" dataset and 4 dimension scales *------------------------------------------------------------------------- - */ + */ /* make a dataset */ if (H5LTmake_dataset_int(fid,"dset_a",rank,dims,buf)<0) @@ -188,11 +188,11 @@ static int test_simple(void) if (H5LTmake_dataset_int(fid,DS_22_NAME,rankds,s2_dim,s22_wbuf)<0) goto out; - + /*------------------------------------------------------------------------- * test 1: attach scale *------------------------------------------------------------------------- - */ + */ TESTING2("attach scales"); @@ -203,7 +203,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * attach the DS_1_NAME dimension scale to "dset_a" *------------------------------------------------------------------------- - */ + */ /* get the DS dataset id */ if ((dsid = H5Dopen(fid,DS_1_NAME))<0) @@ -220,7 +220,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * attach the DS_11_NAME dimension scale to "dset_a" *------------------------------------------------------------------------- - */ + */ /* get the DS dataset id */ if ((dsid = H5Dopen(fid,DS_11_NAME))<0) @@ -237,7 +237,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * attach the DS_2_NAME dimension scale to "dset_a" *------------------------------------------------------------------------- - */ + */ /* get the DS dataset id */ if ((dsid = H5Dopen(fid,DS_2_NAME))<0) @@ -250,11 +250,11 @@ static int test_simple(void) /* close DS id */ if (H5Dclose(dsid)<0) goto out; - + /*------------------------------------------------------------------------- * attach the DS_21_NAME dimension scale to "dset_a" *------------------------------------------------------------------------- - */ + */ /* get the DS dataset id */ if ((dsid = H5Dopen(fid,DS_21_NAME))<0) @@ -271,7 +271,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * attach the DS_22_NAME dimension scale to "dset_a" *------------------------------------------------------------------------- - */ + */ /* get the DS dataset id */ if ((dsid = H5Dopen(fid,DS_22_NAME))<0) @@ -286,11 +286,11 @@ static int test_simple(void) goto out; - + /*------------------------------------------------------------------------- * verify attachment *------------------------------------------------------------------------- - */ + */ if ((dsid = H5Dopen(fid,DS_1_NAME))<0) goto out; @@ -320,11 +320,11 @@ static int test_simple(void) if (H5Dclose(dsid)) goto out; - + /* close dataset ID of "dset_a" */ if (H5Dclose(did)<0) goto out; - + PASSED(); @@ -332,15 +332,15 @@ static int test_simple(void) /*------------------------------------------------------------------------- * test 2: get number of scales *------------------------------------------------------------------------- - */ + */ TESTING2("get number of scales"); /*------------------------------------------------------------------------- * verify that "dset_a" has dimension scales *------------------------------------------------------------------------- - */ - + */ + /* get the dataset id for "dset_a" */ if ((did = H5Dopen(fid,"dset_a"))<0) goto out; @@ -361,11 +361,11 @@ static int test_simple(void) if (H5Dclose(did)<0) goto out; - + /*------------------------------------------------------------------------- * create datasets: 1 "data" dataset and 1 dimension scale *------------------------------------------------------------------------- - */ + */ /* make a dataset */ if (H5LTmake_dataset_int(fid,"dset_b",rank,dims,buf)<0) @@ -378,7 +378,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * attach the scale to "dset_b" *------------------------------------------------------------------------- - */ + */ if ((did = H5Dopen(fid,"dset_b"))<0) goto out; @@ -394,7 +394,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * verify if "dset_b" has dimension scales *------------------------------------------------------------------------- - */ + */ /* get the dataset id for "dset_b" */ if ((did = H5Dopen(fid,"dset_b"))<0) @@ -422,7 +422,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * test 3: detach scales *------------------------------------------------------------------------- - */ + */ TESTING2("detach scales "); @@ -430,7 +430,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * create datasets: one "data" dataset and 4 dimension scales *------------------------------------------------------------------------- - */ + */ /* make a dataset */ if (H5LTmake_dataset_int(fid,"dset_c",rank,dims,buf)<0) @@ -456,7 +456,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * attach the scales to "dset_c" *------------------------------------------------------------------------- - */ + */ if ((did = H5Dopen(fid,"dset_c"))<0) goto out; @@ -495,7 +495,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * verify if "dset_c" has dimension scales *------------------------------------------------------------------------- - */ + */ if ((did = H5Dopen(fid,"dset_c"))<0) goto out; @@ -511,11 +511,11 @@ static int test_simple(void) goto out; if (H5Dclose(did)<0) goto out; - + /*------------------------------------------------------------------------- * detach the "ds_c_21" dimension scale to "dset_c" *------------------------------------------------------------------------- - */ + */ /* get the dataset id for "dset_c" */ if ((did = H5Dopen(fid,"dset_c"))<0) @@ -526,7 +526,7 @@ static int test_simple(void) goto out; /* detach the "ds_c_21" dimension scale to "dset_c" in DIM 1 */ - if (H5DSdetach_scale(did,dsid,1)<0) + if (H5DSdetach_scale(did,dsid,1)<0) goto out; /* close DS id */ @@ -540,7 +540,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * "dset_c" must have now 2 dimension scales at DIM 1 *------------------------------------------------------------------------- - */ + */ if ((did = H5Dopen(fid,"dset_c"))<0) goto out; @@ -555,7 +555,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * detach the "ds_c_22" dimension scale to "dset_c" *------------------------------------------------------------------------- - */ + */ /* get the dataset id for "dset_c" */ if ((did = H5Dopen(fid,"dset_c"))<0) @@ -566,7 +566,7 @@ static int test_simple(void) goto out; /* detach the "ds_c_22" dimension scale to "dset_c" in DIM 1 */ - if (H5DSdetach_scale(did,dsid,1)<0) + if (H5DSdetach_scale(did,dsid,1)<0) goto out; /* close DS id */ @@ -580,7 +580,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * "dset_c" must have now 1 dimension scale at DIM 1 *------------------------------------------------------------------------- - */ + */ if ((did = H5Dopen(fid,"dset_c"))<0) goto out; @@ -595,7 +595,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * detach the "ds_c_2" dimension scale to "dset_c" *------------------------------------------------------------------------- - */ + */ /* get the dataset id for "dset_c" */ if ((did = H5Dopen(fid,"dset_c"))<0) @@ -606,7 +606,7 @@ static int test_simple(void) goto out; /* detach the "ds_c_2" dimension scale to "dset_c" in DIM 1 */ - if (H5DSdetach_scale(did,dsid,1)<0) + if (H5DSdetach_scale(did,dsid,1)<0) goto out; /* close DS id */ @@ -620,7 +620,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * "dset_c" must have now 0 dimension scales at DIM 1 *------------------------------------------------------------------------- - */ + */ if ((did = H5Dopen(fid,"dset_c"))<0) goto out; @@ -634,9 +634,9 @@ static int test_simple(void) /*------------------------------------------------------------------------- - * create 3 datasets: 1 "data" dataset and 2 dimension scales + * create 3 datasets: 1 "data" dataset and 2 dimension scales *------------------------------------------------------------------------- - */ + */ if (H5LTmake_dataset_int(fid,"dset_d",rank,dims,NULL)<0) goto out; if (H5LTmake_dataset_int(fid,"ds_d_1",rankds,s1_dim,NULL)<0) @@ -647,7 +647,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * attach them *------------------------------------------------------------------------- - */ + */ if ((did = H5Dopen(fid,"dset_d"))<0) goto out; @@ -670,7 +670,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * verify *------------------------------------------------------------------------- - */ + */ if ((did = H5Dopen(fid,"dset_d"))<0) goto out; @@ -696,7 +696,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * detach *------------------------------------------------------------------------- - */ + */ /* get the dataset id for "dset_d" */ if ((did = H5Dopen(fid,"dset_d"))<0) @@ -707,7 +707,7 @@ static int test_simple(void) goto out; /* detach the dimension scale to "dset_d" in DIM 0 */ - if (H5DSdetach_scale(did,dsid,DIM0)<0) + if (H5DSdetach_scale(did,dsid,DIM0)<0) goto out; /* verify attach, it must return 0 for no attach */ @@ -725,8 +725,8 @@ static int test_simple(void) /*------------------------------------------------------------------------- * attach again *------------------------------------------------------------------------- - */ - + */ + /* get the dataset id for "dset_d" */ if ((did = H5Dopen(fid,"dset_d"))<0) goto out; @@ -736,7 +736,7 @@ static int test_simple(void) goto out; /* attach "ds_d_1" again in DIM 0 */ - if (H5DSattach_scale(did,dsid,DIM0)<0) + if (H5DSattach_scale(did,dsid,DIM0)<0) goto out; /* verify attach, it must return 1 for attach */ @@ -760,8 +760,8 @@ static int test_simple(void) /*------------------------------------------------------------------------- * detach/detach *------------------------------------------------------------------------- - */ - + */ + /* get the dataset id for "dset_d" */ if ((did = H5Dopen(fid,"dset_d"))<0) goto out; @@ -771,11 +771,11 @@ static int test_simple(void) goto out; /* detach the "ds_d_2" dimension scale to "dset_d" in DIM 1 */ - if (H5DSdetach_scale(did,dsid,DIM1)<0) + if (H5DSdetach_scale(did,dsid,DIM1)<0) goto out; /* detach again, it should fail */ - if (H5DSdetach_scale(did,dsid,DIM1)==SUCCESS) + if (H5DSdetach_scale(did,dsid,DIM1)==SUCCESS) goto out; /* verify attach, it must return 0 for no attach */ @@ -799,8 +799,8 @@ static int test_simple(void) /*------------------------------------------------------------------------- * attach twice *------------------------------------------------------------------------- - */ - + */ + /* get the dataset id for "dset_d" */ if ((did = H5Dopen(fid,"dset_d"))<0) goto out; @@ -810,7 +810,7 @@ static int test_simple(void) goto out; /* attach "ds_d_2" in DIM 1 */ - if (H5DSattach_scale(did,dsid,DIM1)<0) + if (H5DSattach_scale(did,dsid,DIM1)<0) goto out; /* verify attach, it must return 1 for attach */ @@ -824,9 +824,9 @@ static int test_simple(void) goto out; /* attach "ds_d_2" again in DIM 1 */ - if (H5DSattach_scale(did,dsid,DIM1)<0) + if (H5DSattach_scale(did,dsid,DIM1)<0) goto out; - + /* verify attach, it must return 1 for attach */ if (H5DSis_attached(did,dsid,DIM1)!=1) goto out; @@ -846,19 +846,19 @@ static int test_simple(void) goto out; /*------------------------------------------------------------------------- - * create 10 datasets: 5 "data" dataset and 5 dimension scales + * create 10 datasets: 5 "data" dataset and 5 dimension scales *------------------------------------------------------------------------- - */ + */ /* create a group */ - if ((gid=H5Gcreate(fid,"grp",0))<0) + if ((gid=H5Gcreate(fid,"grp",0))<0) goto out; - + /* create the data space for the dataset */ if ((sid=H5Screate_simple(rank,dims,NULL))<0) goto out; - for (i=0; i<5; i++) + for (i=0; i<5; i++) { sprintf(dname,"dset_%d",i); if ((did = H5Dcreate(gid,dname,H5T_NATIVE_INT,sid,H5P_DEFAULT))<0) @@ -877,14 +877,14 @@ static int test_simple(void) /*------------------------------------------------------------------------- * attach for DIM 0 *------------------------------------------------------------------------- - */ + */ - for (i=0; i<5; i++) + for (i=0; i<5; i++) { sprintf(dname,"dset_%d",i); if ((did = H5Dopen(gid,dname))<0) goto out; - for (j=0; j<5; j++) + for (j=0; j<5; j++) { sprintf(sname,"ds_%d",j); if((dsid = H5Dopen(gid,sname))<0) @@ -901,14 +901,14 @@ static int test_simple(void) /*------------------------------------------------------------------------- * dettach for DIM0 *------------------------------------------------------------------------- - */ + */ - for (i=0; i<5; i++) + for (i=0; i<5; i++) { sprintf(dname,"dset_%d",i); if ((did = H5Dopen(gid,dname))<0) goto out; - for (j=0; j<5; j++) + for (j=0; j<5; j++) { sprintf(sname,"ds_%d",j); if((dsid = H5Dopen(gid,sname))<0) @@ -926,14 +926,14 @@ static int test_simple(void) /*------------------------------------------------------------------------- * attach again for DIM0 *------------------------------------------------------------------------- - */ + */ - for (i=0; i<5; i++) + for (i=0; i<5; i++) { sprintf(dname,"dset_%d",i); if ((did = H5Dopen(gid,dname))<0) goto out; - for (j=0; j<5; j++) + for (j=0; j<5; j++) { sprintf(sname,"ds_%d",j); if((dsid = H5Dopen(gid,sname))<0) @@ -960,10 +960,10 @@ static int test_simple(void) /*------------------------------------------------------------------------- * create a dataset and attach only to 1 dimension *------------------------------------------------------------------------- - */ + */ TESTING2("attach only to 1 dimension"); - + /* make a dataset */ if (H5LTmake_dataset_int(fid,"dset_e",rank,dims,NULL)<0) goto out; @@ -984,7 +984,7 @@ static int test_simple(void) /* try to detach all dimensions. for dimensions 0 and 2, it is an error */ - for (i=0; i<rank; i++) + for (i=0; i<rank; i++) { if ( i==1 ) { @@ -1002,15 +1002,15 @@ static int test_simple(void) goto out; if (H5Dclose(did)<0) goto out; - + PASSED(); /*------------------------------------------------------------------------- * test 4: set/get label *------------------------------------------------------------------------- - */ - + */ + TESTING2("set/get label"); if ((did = H5Dopen(fid,"dset_a"))<0) @@ -1019,7 +1019,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * set label *------------------------------------------------------------------------- - */ + */ if (H5DSset_label(did,DIM0,DIM0_LABEL)<0) goto out; @@ -1029,7 +1029,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * get the scale name using a static buffer *------------------------------------------------------------------------- - */ + */ if (H5DSget_label(did,DIM0,dim0_label,sizeof(dim0_label))<0) goto out; @@ -1044,7 +1044,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * get the scale name using a dynamic buffer *------------------------------------------------------------------------- - */ + */ if ((dim0_label_size=H5DSget_label(did,DIM0,NULL,0))<0) goto out; @@ -1061,19 +1061,19 @@ static int test_simple(void) goto out; if (H5DSget_label(did,DIM1,dim1_labeld,dim1_label_size)<0) goto out; - + if (strncmp(DIM0_LABEL,dim0_labeld,dim0_label_size-1)!=0) goto out; if (strncmp(DIM1_LABEL,dim1_labeld,dim1_label_size-1)!=0) goto out; if (dim0_labeld) - { + { free(dim0_labeld); dim0_labeld=NULL; } if (dim1_labeld) - { + { free(dim1_labeld); dim1_labeld=NULL; } @@ -1082,7 +1082,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * get the label using a static buffer smaller than the string lenght *------------------------------------------------------------------------- - */ + */ if (H5DSget_label(did,DIM0,dim0_labels,sizeof(dim0_labels))<0) goto out; @@ -1100,11 +1100,11 @@ static int test_simple(void) goto out; PASSED(); - + /*------------------------------------------------------------------------- * test 5: set scale/get scale name *------------------------------------------------------------------------- - */ + */ TESTING2("set scale/get scale name"); if ((dsid = H5Dopen(fid,DS_1_NAME))<0) @@ -1120,7 +1120,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * get the scale name using a dynamic buffer *------------------------------------------------------------------------- - */ + */ /* get the lenght of the scale name (pass NULL in name) */ if ((name_len=H5DSget_scale_name(dsid,NULL,0))<0) @@ -1134,12 +1134,12 @@ static int test_simple(void) /* get the scale name using this buffer */ if (H5DSget_scale_name(dsid,name_out,name_len)<0) goto out; - + if (strcmp(SCALE_1_NAME,name_out)!=0) goto out; if (name_out) - { + { free(name_out); name_out=NULL; } @@ -1147,24 +1147,24 @@ static int test_simple(void) /*------------------------------------------------------------------------- * get the scale name using a static buffer *------------------------------------------------------------------------- - */ + */ /* get the scale name using this buffer */ if (H5DSget_scale_name(dsid,sname,sizeof(sname))<0) goto out; - + if (strcmp(SCALE_1_NAME,sname)!=0) goto out; /*------------------------------------------------------------------------- * get the scale name using a static buffer smaller than the string lenght *------------------------------------------------------------------------- - */ + */ /* get the scale name using this buffer */ if (H5DSget_scale_name(dsid,snames,sizeof(snames))<0) goto out; - + if (strncmp(SCALE_1_NAME,snames,sizeof(snames)-1)!=0) goto out; @@ -1172,9 +1172,9 @@ static int test_simple(void) goto out; /*------------------------------------------------------------------------- - * add scale names + * add scale names *------------------------------------------------------------------------- - */ + */ if ((dsid = H5Dopen(fid,DS_11_NAME))<0) goto out; @@ -1210,7 +1210,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * test 6: test iterate scales with a function verifiy_scale *------------------------------------------------------------------------- - */ + */ TESTING2("iterate scales (verify scale)"); /* get the dataset id for "dset_a" */ @@ -1241,7 +1241,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * test 7: test iterate scales with a function read_scale *------------------------------------------------------------------------- - */ + */ TESTING2("iterate scales (read scale values)"); @@ -1272,7 +1272,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * test 8: test iterate scales with a function match_dim_scale *------------------------------------------------------------------------- - */ + */ TESTING2("iterate scales (verify the scale sizes match)"); /* get the dataset id for "dset_a" */ @@ -1282,7 +1282,7 @@ static int test_simple(void) /* get dataset space */ if ((sid = H5Dget_space(did))<0) goto out; - + /* get rank */ if ((rank=H5Sget_simple_extent_ndims(sid))<0) goto out; @@ -1294,13 +1294,13 @@ static int test_simple(void) { int match_size; /* does this scale size matches the dataset DIM size */ int idx=0; /* scale index to start iterating, on return, index where iterator stoped */ - + /* iterate trough all the dimensions */ for(dim=0; dim<(unsigned)rank; dim++) { if ((match_size=H5DSiterate_scales(did,dim,&idx,match_dim_scale,NULL))<0) goto out; - + /* "dset_a" was defined with all dimension scales size matching the size of its dimensions */ if (match_size==0) goto out; @@ -1311,7 +1311,7 @@ static int test_simple(void) } } - + /* close */ if (H5Dclose(did)<0) goto out; @@ -1323,13 +1323,13 @@ static int test_simple(void) /*------------------------------------------------------------------------- * test 9: test iterate scales with a function match_dim_scale *------------------------------------------------------------------------- - */ + */ TESTING2("iterate scales (verify the scale sizes do not match)"); /*------------------------------------------------------------------------- * create 3 datasets: 1 "data" dataset and dimension scales (some are empty) *------------------------------------------------------------------------- - */ + */ if (H5LTmake_dataset_int(fid,"dset_f",rank,dims,buf)<0) goto out; if (H5LTmake_dataset_int(fid,"ds_f_1",rankds,s1_dim,NULL)<0) @@ -1342,7 +1342,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * attach them *------------------------------------------------------------------------- - */ + */ if ((did = H5Dopen(fid,"dset_f"))<0) goto out; @@ -1371,7 +1371,7 @@ static int test_simple(void) /*------------------------------------------------------------------------- * verify match *------------------------------------------------------------------------- - */ + */ /* get the dataset id for "dset_f" */ if ((did = H5Dopen(fid,"dset_f"))<0) goto out; @@ -1379,7 +1379,7 @@ static int test_simple(void) /* get dataset space */ if ((sid = H5Dget_space(did))<0) goto out; - + /* get rank */ if ((rank=H5Sget_simple_extent_ndims(sid))<0) goto out; @@ -1391,7 +1391,7 @@ static int test_simple(void) { int match_size; /* does this scale size matches the dataset DIM size */ int idx; /* scale index to start iterating, on return, index where iterator stoped */ - + /* iterate trough all the dimensions */ for(dim=0; dim<(unsigned)rank; dim++) { @@ -1400,7 +1400,7 @@ static int test_simple(void) if ((match_size=H5DSiterate_scales(did,dim,&idx,match_dim_scale,NULL))<0) goto out; - + /* "dset_e" was defined with : dim 0: 2 scales, first is empty dim 1: 1 scale, empty */ @@ -1416,7 +1416,7 @@ static int test_simple(void) }/*switch*/ }/*for*/ } - + /* close */ if (H5Dclose(did)<0) goto out; @@ -1429,13 +1429,13 @@ static int test_simple(void) /*------------------------------------------------------------------------- * end *------------------------------------------------------------------------- - */ + */ /* close */ H5Fclose(fid); return 0; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { @@ -1454,13 +1454,13 @@ out: * Purpose: example operator function used by H5DSiterate_scales, used * to verify that SCALE_ID refers to a valid DS dataset * - * Return: - * The return values from an operator are: - * Zero causes the iterator to continue, returning zero when all group members have been processed. - * Positive causes the iterator to immediately return that positive value, indicating - * short-circuit success. The iterator can be restarted at the next group member. - * Negative causes the iterator to immediately return that value, indicating failure. - * The iterator can be restarted at the next group member. + * Return: + * The return values from an operator are: + * Zero causes the iterator to continue, returning zero when all group members have been processed. + * Positive causes the iterator to immediately return that positive value, indicating + * short-circuit success. The iterator can be restarted at the next group member. + * Negative causes the iterator to immediately return that value, indicating failure. + * The iterator can be restarted at the next group member. * *------------------------------------------------------------------------- */ @@ -1468,15 +1468,15 @@ out: static herr_t verifiy_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data) { /* define a default zero value for return. This will cause the iterator to continue */ - int ret = 0; - + int ret = 0; + /* unused */ dset=dset; dim=dim; visitor_data=visitor_data; - /* define a positive value for return value. This will cause the iterator to - immediately return that positive value, indicating short-circuit success + /* define a positive value for return value. This will cause the iterator to + immediately return that positive value, indicating short-circuit success */ /* the parameter DS dataset must be a valid DS dataset */ @@ -1484,9 +1484,9 @@ static herr_t verifiy_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visi { ret = 1; } - + return ret; -} +} /*------------------------------------------------------------------------- @@ -1495,13 +1495,13 @@ static herr_t verifiy_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visi * Purpose: example operator function used by H5DSiterate_scales, used * to read data from DS dataset. compare read and write buffers * - * Return: - * The return values from an operator are: - * Zero causes the iterator to continue, returning zero when all group members have been processed. - * Positive causes the iterator to immediately return that positive value, indicating - * short-circuit success. The iterator can be restarted at the next group member. - * Negative causes the iterator to immediately return that value, indicating failure. - * The iterator can be restarted at the next group member + * Return: + * The return values from an operator are: + * Zero causes the iterator to continue, returning zero when all group members have been processed. + * Positive causes the iterator to immediately return that positive value, indicating + * short-circuit success. The iterator can be restarted at the next group member. + * Negative causes the iterator to immediately return that value, indicating failure. + * The iterator can be restarted at the next group member * * *------------------------------------------------------------------------- @@ -1538,7 +1538,7 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor /* get type size */ if ((size=H5Tget_size(mtid))==0) goto out; - + if (nelmts) { buf=(char *) malloc((unsigned)(nelmts*size)); @@ -1546,7 +1546,7 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor goto out; if (H5Dread(scale_id,mtid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) goto out; - + for(i=0; i<nelmts; i++) { if (buf[i] != data[i]) @@ -1555,19 +1555,19 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor goto out; } } - + } /* if */ - + if (H5Sclose(sid)<0) goto out; - if (H5Tclose(tid)<0) + if (H5Tclose(tid)<0) goto out; - if (H5Tclose(mtid)<0) + if (H5Tclose(mtid)<0) goto out; if (buf) free(buf); - - + + return ret; /* error zone, gracefully close */ @@ -1581,7 +1581,7 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor } H5E_END_TRY; return FAIL; -} +} /*------------------------------------------------------------------------- @@ -1590,13 +1590,13 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor * Purpose: example operator function used by H5DSiterate_scales, used * to verify the the DSID scale size matches the dataset DIM size * - * Return: - * The return values from an operator are: - * Zero causes the iterator to continue, returning zero when all group members have been processed. - * Positive causes the iterator to immediately return that positive value, indicating - * short-circuit success. The iterator can be restarted at the next group member. - * Negative causes the iterator to immediately return that value, indicating failure. - * The iterator can be restarted at the next group member. + * Return: + * The return values from an operator are: + * Zero causes the iterator to continue, returning zero when all group members have been processed. + * Positive causes the iterator to immediately return that positive value, indicating + * short-circuit success. The iterator can be restarted at the next group member. + * Negative causes the iterator to immediately return that value, indicating failure. + * The iterator can be restarted at the next group member. * *------------------------------------------------------------------------- */ @@ -1612,7 +1612,7 @@ static herr_t match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor /*------------------------------------------------------------------------- * get DID (dataset) space info *------------------------------------------------------------------------- - */ + */ /* get dataset space */ if ((sid = H5Dget_space(did))<0) @@ -1625,16 +1625,16 @@ static herr_t match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor /* close the dataspace id */ if (H5Sclose(sid)<0) goto out; - + /*------------------------------------------------------------------------- * get DSID (scale) space info *------------------------------------------------------------------------- - */ - + */ + /* get the space for the scale */ if ((sid = H5Dget_space(dsid))<0) goto out; - + /* get size of the DS array */ if ((nelmts = H5Sget_simple_extent_npoints(sid))<0) goto out; @@ -1642,7 +1642,7 @@ static herr_t match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor /* close */ if (H5Sclose(sid)<0) goto out; - + /* the size of the DS array must match the dimension of the dataset */ if (nelmts == (hssize_t)dims[dim]) ret = 1; @@ -1654,13 +1654,13 @@ static herr_t match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor ret = 0; return ret; - + out: H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; return FAIL; -} +} /*------------------------------------------------------------------------- @@ -1668,13 +1668,13 @@ out: * * Purpose: example operator function used by H5DSiterate_scales, that does nothing * - * Return: - * The return values from an operator are: - * Zero causes the iterator to continue, returning zero when all group members have been processed. - * Positive causes the iterator to immediately return that positive value, indicating - * short-circuit success. The iterator can be restarted at the next group member. - * Negative causes the iterator to immediately return that value, indicating failure. - * The iterator can be restarted at the next group member. + * Return: + * The return values from an operator are: + * Zero causes the iterator to continue, returning zero when all group members have been processed. + * Positive causes the iterator to immediately return that positive value, indicating + * short-circuit success. The iterator can be restarted at the next group member. + * Negative causes the iterator to immediately return that value, indicating failure. + * The iterator can be restarted at the next group member. * *------------------------------------------------------------------------- */ @@ -1682,15 +1682,15 @@ out: static herr_t op_bogus(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_data) { /* define a default zero value for return. This will cause the iterator to continue */ - int ret = 0; - + int ret = 0; + /* unused */ dset=dset; dim=dim; visitor_data=visitor_data; - + return ret; -} +} @@ -1716,19 +1716,19 @@ static int test_errors(void) hid_t sid; /* space ID */ hid_t sidds; /* space ID */ hsize_t pal_dims[] = {9,3}; - + printf("Testing error conditions\n"); /*------------------------------------------------------------------------- * create a file, spaces, dataset and group ids *------------------------------------------------------------------------- - */ + */ /* create a file using default properties */ if ((fid=H5Fcreate(FILE2,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) goto out; /* create a group */ - if ((gid=H5Gcreate(fid,"grp",0))<0) + if ((gid=H5Gcreate(fid,"grp",0))<0) goto out; /* create the data space for the dataset */ if ((sid=H5Screate_simple(rank,dims,NULL))<0) @@ -1746,7 +1746,7 @@ static int test_errors(void) /*------------------------------------------------------------------------- * attempt to attach a dataset to itself, it should fail *------------------------------------------------------------------------- - */ + */ TESTING2("attach a dataset to itself"); @@ -1758,7 +1758,7 @@ static int test_errors(void) /*------------------------------------------------------------------------- * attempt to attach a group with a dataset, it should fail *------------------------------------------------------------------------- - */ + */ TESTING2("attach a group with a dataset"); if (H5DSattach_scale(gid,dsid,0)==SUCCESS) @@ -1769,7 +1769,7 @@ static int test_errors(void) /*------------------------------------------------------------------------- * attempt to attach a dataset with a group, it should fail *------------------------------------------------------------------------- - */ + */ TESTING2("attach a dataset with a group"); if (H5DSattach_scale(did,gid,0)==SUCCESS) @@ -1780,7 +1780,7 @@ static int test_errors(void) /*------------------------------------------------------------------------- * attempt to set scale for a group, it should fail *------------------------------------------------------------------------- - */ + */ TESTING2("set scale for a group"); if (H5DSset_scale(gid,"scale 1")==SUCCESS) @@ -1791,7 +1791,7 @@ static int test_errors(void) /*------------------------------------------------------------------------- * close IDs for this set *------------------------------------------------------------------------- - */ + */ /* close */ if (H5Dclose(dsid)<0) @@ -1809,14 +1809,14 @@ static int test_errors(void) /*------------------------------------------------------------------------- * try to attach a scale that has scales *------------------------------------------------------------------------- - */ + */ TESTING2("attach a scale that has scales"); /* create the data space for the scale */ if ((sidds=H5Screate_simple(rankds,s1_dim,NULL))<0) goto out; - + /* create a dataset "ds_b" for the scale */ if ((dsid=H5Dcreate(fid,"ds_b",H5T_NATIVE_INT,sidds,H5P_DEFAULT))<0) goto out; @@ -1876,9 +1876,9 @@ static int test_errors(void) PASSED(); /*------------------------------------------------------------------------- - * try to attach a dataset that is a scale + * try to attach a dataset that is a scale *------------------------------------------------------------------------- - */ + */ TESTING2("attach to a dataset that is a scale"); @@ -1905,7 +1905,7 @@ static int test_errors(void) /*------------------------------------------------------------------------- * try to attach a scale to an image, pallete or table *------------------------------------------------------------------------- - */ + */ TESTING2("attach to a dataset that is a reserved class dataset"); @@ -1940,7 +1940,7 @@ static int test_errors(void) /*------------------------------------------------------------------------- * is scale *------------------------------------------------------------------------- - */ + */ TESTING2("is scale"); @@ -1972,9 +1972,9 @@ static int test_errors(void) /*------------------------------------------------------------------------- - * detach + * detach *------------------------------------------------------------------------- - */ + */ TESTING2("detach scale from dataset it is not attached to"); @@ -2000,9 +2000,9 @@ static int test_errors(void) /*------------------------------------------------------------------------- - * detach + * detach *------------------------------------------------------------------------- - */ + */ TESTING2("detach scale from group"); @@ -2028,9 +2028,9 @@ static int test_errors(void) /*------------------------------------------------------------------------- - * detach + * detach *------------------------------------------------------------------------- - */ + */ TESTING2("detach scale when scale is group"); @@ -2060,7 +2060,7 @@ static int test_errors(void) goto out; return 0; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { @@ -2094,19 +2094,19 @@ static int test_iterators(void) hid_t dsid; /* scale ID */ char dname[30]; /* dataset name */ int i; - + printf("Testing iterators\n"); /*------------------------------------------------------------------------- * create a file, spaces, dataset and group ids *------------------------------------------------------------------------- - */ + */ /* create a file using default properties */ if ((fid=H5Fcreate(FILE3,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) goto out; /* create a group */ - if ((gid=H5Gcreate(fid,"grp",0))<0) + if ((gid=H5Gcreate(fid,"grp",0))<0) goto out; /* close */ if (H5Gclose(gid)<0) @@ -2119,9 +2119,9 @@ static int test_iterators(void) goto out; /*------------------------------------------------------------------------- - * iterate when the dataset has no scales + * iterate when the dataset has no scales *------------------------------------------------------------------------- - */ + */ TESTING2("iterate when the dataset has no scales "); @@ -2143,7 +2143,7 @@ static int test_iterators(void) /*------------------------------------------------------------------------- * iterate on dimension that is outside the rank *------------------------------------------------------------------------- - */ + */ TESTING2("iterate on dimension that is outside the rank "); @@ -2164,7 +2164,7 @@ static int test_iterators(void) /*------------------------------------------------------------------------- * iterate for dimension with many scales *------------------------------------------------------------------------- - */ + */ TESTING2("iterate for dimension with many scales "); @@ -2172,7 +2172,7 @@ static int test_iterators(void) if ((did = H5Dopen(fid,"dset_a"))<0) goto out; - for (i=0; i<100; i++) + for (i=0; i<100; i++) { /* make a DS */ sprintf(dname,"ds_%d",i); @@ -2188,11 +2188,11 @@ static int test_iterators(void) if (H5Dclose(dsid)<0) goto out; } - + /* iterate trough the 1st dimension of "dset_a" */ if (H5DSiterate_scales(did,0,NULL,op_bogus,NULL)<0) goto out; - + /* close */ if (H5Dclose(did)<0) goto out; @@ -2202,7 +2202,7 @@ static int test_iterators(void) /*------------------------------------------------------------------------- * iterate on group *------------------------------------------------------------------------- - */ + */ TESTING2("iterate on group "); @@ -2224,7 +2224,7 @@ static int test_iterators(void) /*------------------------------------------------------------------------- * iterate in deleted scales *------------------------------------------------------------------------- - */ + */ TESTING2("iterate in deleted scales "); @@ -2234,11 +2234,11 @@ static int test_iterators(void) /* open the previously written "dset_a" */ if ((did = H5Dopen(fid,"dset_a"))<0) goto out; - + /* iterate */ if (H5DSiterate_scales(did,0,NULL,op_bogus,NULL)==SUCCESS) goto out; - + /* close */ if (H5Dclose(did)<0) goto out; @@ -2251,7 +2251,7 @@ static int test_iterators(void) goto out; return 0; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { @@ -2264,7 +2264,7 @@ out: /*------------------------------------------------------------------------- - * test several ranks + * test several ranks *------------------------------------------------------------------------- */ @@ -2285,18 +2285,18 @@ static int test_rank(void) int bufi[1]={2}; float buff[1]={1}; int i; - + printf("Testing ranks\n"); /*------------------------------------------------------------------------- * create a file, a dataset, scales *------------------------------------------------------------------------- - */ + */ /* create a file using default properties */ if ((fid=H5Fcreate(FILE4,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) goto out; - + /* make a dataset a 3D data dataset */ if (H5LTmake_dataset_int(fid,"dset_a",3,dims3,NULL)<0) goto out; @@ -2312,18 +2312,18 @@ static int test_rank(void) /* make a 3D scale dataset */ if (H5LTmake_dataset_int(fid,"ds_a_2",3,dims3,NULL)<0) goto out; - + /*------------------------------------------------------------------------- - * attach + * attach *------------------------------------------------------------------------- - */ + */ TESTING2("attach"); - + if ((did = H5Dopen(fid,"dset_a"))<0) goto out; - - for (i=0; i<3; i++) + + for (i=0; i<3; i++) { sprintf(name,"ds_a_%d",i); if((dsid = H5Dopen(fid,name))<0) @@ -2335,24 +2335,24 @@ static int test_rank(void) if (H5Dclose(dsid)<0) goto out; } - + if (H5Dclose(did)<0) goto out; - + PASSED(); - + /*------------------------------------------------------------------------- - * detach + * detach *------------------------------------------------------------------------- - */ + */ TESTING2("detach"); - + if ((did = H5Dopen(fid,"dset_a"))<0) goto out; - - for (i=0; i<3; i++) + + for (i=0; i<3; i++) { sprintf(name,"ds_a_%d",i); if((dsid = H5Dopen(fid,name))<0) @@ -2366,20 +2366,20 @@ static int test_rank(void) } if (H5Dclose(did)<0) goto out; - + PASSED(); /*------------------------------------------------------------------------- * attach, set, get names, labels *------------------------------------------------------------------------- - */ + */ TESTING2("attach, set, get names, labels"); - + if ((did = H5Dopen(fid,"dset_a"))<0) goto out; - - for (i=0; i<3; i++) + + for (i=0; i<3; i++) { sprintf(name,"ds_a_%d",i); if((dsid = H5Dopen(fid,name))<0) @@ -2403,19 +2403,19 @@ static int test_rank(void) if (strcmp(name,namel)!=0) goto out; } - + if (H5Dclose(did)<0) goto out; - + PASSED(); /*------------------------------------------------------------------------- - * attach a scalar scale + * attach a scalar scale *------------------------------------------------------------------------- - */ + */ TESTING2("attach a scalar scale"); - + /* create the data space for the dataset */ if ((sid=H5Screate_simple(2,dimss,NULL))<0) goto out; @@ -2447,18 +2447,18 @@ static int test_rank(void) goto out; if (H5Dclose(dsid)<0) goto out; - + PASSED(); /*------------------------------------------------------------------------- - * close + * close *------------------------------------------------------------------------- - */ + */ if (H5Fclose(fid)<0) goto out; return 0; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { @@ -2474,7 +2474,7 @@ out: /*------------------------------------------------------------------------- * attach scales with several datatypes *------------------------------------------------------------------------- - */ + */ static int test_types(void) { @@ -2491,21 +2491,21 @@ static int test_types(void) unsigned short s2_ushort[DIM2_SIZE] = {10,20,30,40}; /* data of DS 2 dataset */ char *s1_str = "ABC"; char *s2_str = "ABCD"; - + printf("Testing scales with several datatypes\n"); - + /*------------------------------------------------------------------------- * create a file for the test *------------------------------------------------------------------------- - */ + */ /* create a file using default properties */ if ((fid=H5Fcreate(FILE5,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) goto out; - + /*------------------------------------------------------------------------- * create datasets: 1 "data" dataset and 2 dimension scales *------------------------------------------------------------------------- - */ + */ /* make a dataset */ if (H5LTmake_dataset_int(fid,"dset_a",rank,dims,buf)<0) @@ -2518,11 +2518,11 @@ static int test_types(void) /* make a DS dataset for the second dimension */ if (H5LTmake_dataset(fid,DS_2_NAME,rankds,s2_dim,H5T_NATIVE_USHORT,s2_ushort)<0) goto out; - + /*------------------------------------------------------------------------- * floating point and short scales *------------------------------------------------------------------------- - */ + */ TESTING2("floating point and short scales"); @@ -2536,7 +2536,7 @@ static int test_types(void) /* attach the DS_1_NAME dimension scale to "dset_a" at dimension 0 */ if (H5DSattach_scale(did,dsid,DIM0)<0) goto out; - /* set name */ + /* set name */ if (H5DSset_scale(dsid,SCALE_1_NAME)<0) goto out; /* close DS id */ @@ -2548,7 +2548,7 @@ static int test_types(void) /* attach the DS_2_NAME dimension scale to "dset_a" at dimension 1 */ if (H5DSattach_scale(did,dsid,DIM1)<0) goto out; - /* set name */ + /* set name */ if (H5DSset_scale(dsid,SCALE_2_NAME)<0) goto out; /* close DS id */ @@ -2564,11 +2564,11 @@ static int test_types(void) goto out; PASSED(); - + /*------------------------------------------------------------------------- * create datasets: 1 "data" dataset and 2 dimension scales *------------------------------------------------------------------------- - */ + */ /* make a dataset */ if (H5LTmake_dataset_int(fid,"dset_b",rank,dims,buf)<0) @@ -2581,11 +2581,11 @@ static int test_types(void) /* make a DS dataset for the second dimension */ if (H5LTmake_dataset_string(fid,"ds_b_2",s2_str)<0) goto out; - + /*------------------------------------------------------------------------- * floating point and short scales *------------------------------------------------------------------------- - */ + */ TESTING2("string scales"); @@ -2598,7 +2598,7 @@ static int test_types(void) /* attach the DS_1_NAME dimension scale to "dset_b" at dimension 0 */ if (H5DSattach_scale(did,dsid,DIM0)<0) goto out; - /* set name */ + /* set name */ if (H5DSset_scale(dsid,SCALE_1_NAME)<0) goto out; /* close DS id */ @@ -2610,7 +2610,7 @@ static int test_types(void) /* attach the DS_2_NAME dimension scale to "dset_b" at dimension 1 */ if (H5DSattach_scale(did,dsid,DIM1)<0) goto out; - /* set name */ + /* set name */ if (H5DSset_scale(dsid,SCALE_2_NAME)<0) goto out; /* close DS id */ @@ -2628,14 +2628,14 @@ static int test_types(void) PASSED(); /*------------------------------------------------------------------------- - * close + * close *------------------------------------------------------------------------- - */ + */ if (H5Fclose(fid)<0) goto out; return 0; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { @@ -2650,7 +2650,7 @@ out: /*------------------------------------------------------------------------- * read realistic data and generate an HDF5 file with dimension scales *------------------------------------------------------------------------- - */ + */ static int test_data(void) { @@ -2667,13 +2667,13 @@ static int test_data(void) hsize_t londims[1]; /* array to hold dimensions */ float fill=-99; /* fill value */ - + printf("Testing reading ASCII data and generate HDF5 data with scales\n"); - + /*------------------------------------------------------------------------- * create a file for the test *------------------------------------------------------------------------- - */ + */ /* create a file using default properties */ if ((fid=H5Fcreate(FILE6,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) goto out; @@ -2681,7 +2681,7 @@ static int test_data(void) /*------------------------------------------------------------------------- * read data *------------------------------------------------------------------------- - */ + */ /* read ASCII bathymetry data */ if (read_data("dsdata.txt",2,dims,&vals)<0) @@ -2698,14 +2698,14 @@ static int test_data(void) /*------------------------------------------------------------------------- * generating scales *------------------------------------------------------------------------- - */ + */ TESTING2("generating scales"); - + /*------------------------------------------------------------------------- * create datasets: 1 "data" dataset and 2 dimension scales *------------------------------------------------------------------------- - */ + */ /* make a DS dataset for the first dimension */ if (H5LTmake_dataset_float(fid,"lat",1,latdims,latbuf)<0) @@ -2734,9 +2734,9 @@ static int test_data(void) goto out; /*------------------------------------------------------------------------- - * attach + * attach *------------------------------------------------------------------------- - */ + */ /* get the dataset id for "data" */ if ((did = H5Dopen(fid,"data"))<0) @@ -2748,7 +2748,7 @@ static int test_data(void) /* attach the DS_1_NAME dimension scale to "data" at dimension 0 */ if (H5DSattach_scale(did,dsid,DIM0)<0) goto out; - /* set name */ + /* set name */ if (H5DSset_scale(dsid,SCALE_1_NAME)<0) goto out; /* close DS id */ @@ -2760,7 +2760,7 @@ static int test_data(void) /* attach the DS_2_NAME dimension scale to "data" at dimension 1 */ if (H5DSattach_scale(did,dsid,DIM1)<0) goto out; - /* set name */ + /* set name */ if (H5DSset_scale(dsid,SCALE_2_NAME)<0) goto out; /* close DS id */ @@ -2776,18 +2776,18 @@ static int test_data(void) goto out; PASSED(); - + /*------------------------------------------------------------------------- - * close + * close *------------------------------------------------------------------------- - */ + */ if (H5Fclose(fid)<0) goto out; return 0; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { @@ -2808,7 +2808,7 @@ out: * * dimension i * n - * + * * followed by the data * *------------------------------------------------------------------------- @@ -2832,7 +2832,7 @@ static int read_data( const char* fname, int ndims, hsize_t *dims, float **buf ) strcpy(data_file, srcdir); strcat(data_file, "/"); } - /* read first data file */ + /* read first data file */ strcat(data_file,fname); f = fopen(data_file, "r"); diff --git a/hl/test/test_image.c b/hl/test/test_image.c index 539991d..3803afe 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -53,7 +53,7 @@ static int read_data(const char* file_name, hsize_t *width, hsize_t *height ); static int read_palette(const char* file_name, rgb_t *palette, int palette_size); /* globals */ -unsigned char *image_data = NULL; +unsigned char *image_data = NULL; /*------------------------------------------------------------------------- * the main program @@ -71,7 +71,7 @@ int main(void) if (nerrors) goto error; printf("All image tests passed.\n"); return 0; - + error: printf("***** %d IMAGE TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S"); return 1; @@ -113,13 +113,13 @@ static int test_simple(void) 252,252,84, /* yellow */ 252,168,0, /* orange */ 252,0,0}; /* red */ - + /* create an image of 9 values divided evenly by the array */ space = WIDTH*HEIGHT / PAL_ENTRIES; for (i=0, j=0, n=0; i < WIDTH*HEIGHT; i++, j++ ) { image_in1[i] = n; - if ( j > space ) + if ( j > space ) { n++; j=0; @@ -130,14 +130,14 @@ static int test_simple(void) for (i=0, j=0, n=0; i < WIDTH*HEIGHT*3; i++, j++) { image_in2[i] = n; - if (j==3) + if (j==3) { n++; j=0; } if (n>255) n=0; } - + /* create a file using default properties */ if ((fid=H5Fcreate(FILE1,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) goto out; @@ -163,7 +163,7 @@ static int test_simple(void) /* attach the palette to the image dataset */ if (H5IMlink_palette(fid,"image1","palette")<0) goto out; - + /* get info */ if (H5IMget_image_info(fid,"image1",&width,&height,&planes,interlace,&npals)<0) goto out; @@ -180,11 +180,11 @@ static int test_simple(void) /* read image */ if (H5IMread_image(fid,"image1",image_out1)<0) goto out; - + /* check */ - for (i = 0; i < height*width*planes; i++) + for (i = 0; i < height*width*planes; i++) { - if ( image_in1[i] != image_out1[i] ) + if ( image_in1[i] != image_out1[i] ) { goto out; } @@ -199,7 +199,7 @@ static int test_simple(void) */ TESTING2("true color image"); - + /* write image */ if (H5IMmake_image_24bit(fid,"image2",WIDTH,HEIGHT,"INTERLACE_PIXEL",image_in2)) goto out; @@ -220,9 +220,9 @@ static int test_simple(void) goto out; /* check */ - for (i = 0; i < height*width*planes; i++) + for (i = 0; i < height*width*planes; i++) { - if ( image_in2[i] != image_out2[i] ) + if ( image_in2[i] != image_out2[i] ) { goto out; } @@ -252,9 +252,9 @@ static int test_simple(void) goto out; /* check */ - for (i = 0; i < 2; i++) + for (i = 0; i < 2; i++) { - if ( pal_dims[i] != pal_dims_out[i] ) + if ( pal_dims[i] != pal_dims_out[i] ) { goto out; } @@ -269,9 +269,9 @@ static int test_simple(void) goto out; /* check */ - for (i = 0; i < PAL_ENTRIES*3; i++) + for (i = 0; i < PAL_ENTRIES*3; i++) { - if ( pal_data_in[i] != pal_data_out[i] ) + if ( pal_data_in[i] != pal_data_out[i] ) { goto out; } @@ -308,14 +308,14 @@ static int test_simple(void) PASSED(); /*------------------------------------------------------------------------- - * close + * close *------------------------------------------------------------------------- - */ + */ if (H5Fclose(fid)<0) goto out; return 0; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { @@ -354,7 +354,7 @@ static int test_data(void) TESTING2("make indexed image"); - /* read first data file */ + /* read first data file */ if (read_data(DATA_FILE1,&width,&height)<0) goto out; @@ -371,11 +371,11 @@ static int test_data(void) * palette #1. rainbow palette. data is contained in "pal_rgb.h" *------------------------------------------------------------------------- */ - + /* initialize the palette data */ pal_dims[0] = 256; pal_dims[1] = 3; - + /* make a palette */ if (H5IMmake_palette(fid,PAL1_NAME,pal_dims,pal_rgb)<0) goto out; @@ -385,7 +385,7 @@ static int test_data(void) goto out; /*------------------------------------------------------------------------- - * palette #2. sepia palette. + * palette #2. sepia palette. * read a PAL file and attach the palette to the HDF5 file *------------------------------------------------------------------------- */ @@ -411,7 +411,7 @@ static int test_data(void) goto out; /*------------------------------------------------------------------------- - * palette #3. earth palette. + * palette #3. earth palette. * read a PAL file and attach the palette to the HDF5 file *------------------------------------------------------------------------- */ @@ -440,7 +440,7 @@ static int test_data(void) /*------------------------------------------------------------------------- - * palette #4. blue-red + * palette #4. blue-red * make a palette whith blue to red colors *------------------------------------------------------------------------- */ @@ -467,16 +467,16 @@ static int test_data(void) TESTING2("make true color image with pixel interlace"); - /* read second data file */ + /* read second data file */ if ((read_data(DATA_FILE2,&width,&height))<0) goto out; - + /* make image */ if ((H5IMmake_image_24bit(fid,IMAGE2_NAME,width,height,"INTERLACE_PIXEL",image_data))<0) goto out; PASSED(); - + /*------------------------------------------------------------------------- * True color image example with plane interlace *------------------------------------------------------------------------- @@ -484,26 +484,26 @@ static int test_data(void) TESTING2("make true color image with plane interlace"); - /* read third data file */ + /* read third data file */ if ((read_data(DATA_FILE3,&width,&height))<0) goto out; - + /* make image */ if ((H5IMmake_image_24bit(fid,IMAGE3_NAME,width,height,"INTERLACE_PLANE",image_data))<0) goto out; PASSED(); - + /*------------------------------------------------------------------------- - * close + * close *------------------------------------------------------------------------- - */ + */ if (H5Fclose(fid)<0) goto out; return 0; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { @@ -515,23 +515,23 @@ out: /* - The following test provides an examples of how to generate HDF5 image data from - floating point data. In the example we use real life topographic data - (from the North American hemisphere). In the dataset sea values are represented - as negative numbers and land values are represented as positive numbers. - The example generates 3 HDF5 images, one that generates an image from all the values, - another that generates an image from the land values and another that generates an + The following test provides an examples of how to generate HDF5 image data from + floating point data. In the example we use real life topographic data + (from the North American hemisphere). In the dataset sea values are represented + as negative numbers and land values are represented as positive numbers. + The example generates 3 HDF5 images, one that generates an image from all the values, + another that generates an image from the land values and another that generates an image from the sea values. For the example we used data from MODB, the Mediterranean Oceanic Data Base http://modb.oce.ulg.ac.be/ - + */ static int test_generate(void) { hid_t fid; hsize_t pal_dims[2] = { 256, 3 }; - float *data; + float *data; int imax, jmax, kmax; float valex, xmin, xmax, value; FILE *f; @@ -555,7 +555,7 @@ static int test_generate(void) strcat(data_file, "/"); } strcat(data_file,DATA_FILE4); - + /*------------------------------------------------------------------------- * read data; the file data format is described below *------------------------------------------------------------------------- @@ -570,14 +570,14 @@ static int test_generate(void) } /* -!The first line of the ASCII file contains the dimension of the array : -! IMAX, JMAX, KMAX. The integers are stored with the FORTRAN format I5. -!The second line contains the exclusion value, the minimum and the maximum value of this -! file. These numbers are stored with the FORTRAN format E12.5. -! The remaining lines contains the data of the array, with 5 numbers per line -! (except the last line for each I-line). -! The array is stored in horizontal slices from sea surface to sea bottom and from -! north to south. So the indexes go from : +!The first line of the ASCII file contains the dimension of the array : +! IMAX, JMAX, KMAX. The integers are stored with the FORTRAN format I5. +!The second line contains the exclusion value, the minimum and the maximum value of this +! file. These numbers are stored with the FORTRAN format E12.5. +! The remaining lines contains the data of the array, with 5 numbers per line +! (except the last line for each I-line). +! The array is stored in horizontal slices from sea surface to sea bottom and from +! north to south. So the indexes go from : ! ! DO K = KMAX to 1 ! DO J = JMAX to 1 @@ -586,7 +586,7 @@ static int test_generate(void) ! OD ! OD ! OD -! +! ! ____________________________ ! / /| (imax,jmax,kmax) ! / sea surface / | @@ -603,21 +603,21 @@ static int test_generate(void) ! i ! */ - - - fscanf( f, "%d %d %d", &imax, &jmax, &kmax ); - fscanf( f, "%f %f %f", &valex, &xmin, &xmax ); - + + + fscanf( f, "%d %d %d", &imax, &jmax, &kmax ); + fscanf( f, "%f %f %f", &valex, &xmin, &xmax ); + data = (float*) malloc ( imax * jmax * kmax * sizeof( float )); image_data = (unsigned char*) malloc ( imax * jmax * kmax * sizeof( unsigned char )); - - for ( i = 0; i < imax * jmax * kmax; i++ ) + + for ( i = 0; i < imax * jmax * kmax; i++ ) { - fscanf( f, "%f ", &value ); + fscanf( f, "%f ", &value ); data[i] = value; } fclose( f ); - + /*------------------------------------------------------------------------- * transform the data from floating point to unsigend char * we are processing all the data here @@ -625,18 +625,18 @@ static int test_generate(void) */ TESTING2("make indexed image from all the data"); - - for ( i = 0; i < imax * jmax * kmax; i++ ) + + for ( i = 0; i < imax * jmax * kmax; i++ ) { image_data[i] = (unsigned char)(( 255 * (data[i] - xmin ) ) / (xmax - xmin )); } - + /* Make the image */ if ((H5IMmake_image_8bit(fid,"All data",(hsize_t)imax,(hsize_t)jmax,image_data))<0) goto out; PASSED(); - + /*------------------------------------------------------------------------- * transform the data from floating point to unsigend char * here we just process the land data @@ -644,21 +644,21 @@ static int test_generate(void) */ TESTING2("make indexed image from land data"); - - for ( i = 0; i < imax * jmax * kmax; i++ ) + + for ( i = 0; i < imax * jmax * kmax; i++ ) { if ( data[i] < 0 ) image_data[i] = 0; else image_data[i] = (unsigned char)(( 255 * (data[i] ) ) / xmax ); } - + /* make the image */ if ((H5IMmake_image_8bit(fid,"Land data",(hsize_t)imax,(hsize_t)jmax,image_data))<0) goto out; PASSED(); - + /*------------------------------------------------------------------------- * transform the data from floating point to unsigend char * here we just process the sea data @@ -666,32 +666,32 @@ static int test_generate(void) */ TESTING2("make indexed image from sea data"); - - for ( i = 0; i < imax * jmax * kmax; i++ ) + + for ( i = 0; i < imax * jmax * kmax; i++ ) { if ( data[i] > 0 ) image_data[i] = 0; else image_data[i] = (unsigned char)(( 255 * (data[i] - xmin ) ) / xmin ); } - + /* make the image */ if ((H5IMmake_image_8bit(fid,"Sea data",(hsize_t)imax,(hsize_t)jmax,image_data))<0) goto out; PASSED(); - + /*------------------------------------------------------------------------- * make a palette and attach it to the datasets *------------------------------------------------------------------------- */ TESTING2("attaching palettes"); - + /* make a palette */ if ((H5IMmake_palette(fid,PAL1_NAME,pal_dims,pal_rgb))<0) goto out; - + /* attach the palette to the image datasets */ if ((H5IMlink_palette(fid,"All data",PAL1_NAME))<0) goto out; @@ -701,17 +701,17 @@ static int test_generate(void) goto out; PASSED(); - + /*------------------------------------------------------------------------- - * close + * close *------------------------------------------------------------------------- - */ + */ if (H5Fclose(fid)<0) goto out; return 0; - + /* error zone, gracefully close */ out: H5E_BEGIN_TRY { @@ -733,7 +733,7 @@ out: * n * width * n - * + * * followed by the image data * *------------------------------------------------------------------------- @@ -778,10 +778,10 @@ static int read_data( const char* fname, /*IN*/ fscanf( f, "%s", str ); fscanf( f, "%d", &color_planes ); fscanf( f, "%s", str ); - fscanf( f, "%d", &h); + fscanf( f, "%d", &h); fscanf( f, "%s", str ); - fscanf( f, "%d", &w); - + fscanf( f, "%d", &w); + *width = (hsize_t)w; *height = (hsize_t)h; @@ -811,7 +811,7 @@ static int read_data( const char* fname, /*IN*/ * Read an ASCII palette file .PAL into an array * the files have a header of the type * - * Parameters: + * Parameters: * fname - name of file to read. * palette - array of rgb_t to store the read palette. * palette_size - number of elements in 'palette' array @@ -825,8 +825,8 @@ static int read_data( const char* fname, /*IN*/ #define STRING_CWPAL "CWPAL" #define VERSION_CWPAL "100" -static int read_palette(const char* fname, - rgb_t *palette, +static int read_palette(const char* fname, + rgb_t *palette, int palette_size) { FILE *file; @@ -850,42 +850,42 @@ static int read_palette(const char* fname, strcat(data_file, "/"); } strcat(data_file,fname); - + /* ensure the given palette is valid */ if (!palette) return -1; - + /* open the input file */ if (!(file = fopen(data_file, "r"))) { printf( "Could not open file %s. Try set $srcdir \n", data_file ); return -1; } - + /* read the file ident string */ if (fgets(buffer, sizeof(buffer), file) == NULL) { fclose(file); return -1; } - + /* ensure it matches the palette file ident string */ - if ( strncmp(buffer, STRING_JASC, sizeof(STRING_JASC) - 1) != 0 && + if ( strncmp(buffer, STRING_JASC, sizeof(STRING_JASC) - 1) != 0 && strncmp(buffer, STRING_CWPAL, sizeof(STRING_CWPAL) - 1) != 0 ) { fclose(file); return -1; } - + /* read the version string */ if (fgets(buffer, sizeof(buffer), file) == NULL) { fclose(file); return -1; } - - /* ensure it matches the palette file version string */ - if ( strncmp(buffer, VERSION_JASC, sizeof(VERSION_JASC) - 1) != 0 && + + /* ensure it matches the palette file version string */ + if ( strncmp(buffer, VERSION_JASC, sizeof(VERSION_JASC) - 1) != 0 && strncmp(buffer, VERSION_CWPAL, sizeof(VERSION_CWPAL) - 1) != 0 ) { fclose(file); @@ -898,31 +898,31 @@ static int read_palette(const char* fname, fclose(file); return -1; } - - - /* extract the number of colors. + + + /* extract the number of colors. check for missing version or number of colors in this case it reads the first entry */ - if ( strlen( buffer ) > 4 ) + if ( strlen( buffer ) > 4 ) { fclose(file); return -1; } - + if (sscanf(buffer, "%d", &nentries) != 1) { fclose(file); return -1; } - - /* ensure there are a sensible number of colors in the palette */ + + /* ensure there are a sensible number of colors in the palette */ if ((nentries < 0) || (nentries > 256) || (nentries > palette_size)) { fclose(file); return(-1); } - + /* read the palette entries */ for (i = 0; i < nentries; i++) { @@ -940,7 +940,7 @@ static int read_palette(const char* fname, /* close file */ fclose(file); - + return nentries; } diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index bc5fb72..ae29444 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -62,7 +62,7 @@ static int test_dsets( void ) char data_char_out[DIM]; short data_short_in[DIM] = {1,2,3,4,5,6}; short data_short_out[DIM]; - int data_int_in[DIM] = {1,2,3,4,5,6}; + int data_int_in[DIM] = {1,2,3,4,5,6}; int data_int_out[DIM]; long data_long_in[DIM] = {1,2,3,4,5,6}; long data_long_out[DIM]; @@ -74,7 +74,7 @@ static int test_dsets( void ) char data_string_out[20]; int i; - + /* Create a new file using default properties. */ file_id = H5Fcreate( FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT ); @@ -91,13 +91,13 @@ static int test_dsets( void ) /* Read dataset using the basic HDF5 API */ - if ( ( dataset_id = H5Dopen ( file_id, DSET0_NAME) ) < 0 ) + if ( ( dataset_id = H5Dopen ( file_id, DSET0_NAME) ) < 0 ) goto out; - if ( H5Dread ( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_int_out ) < 0 ) + if ( H5Dread ( dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_int_out ) < 0 ) goto out; - if ( H5Dclose( dataset_id ) < 0 ) + if ( H5Dclose( dataset_id ) < 0 ) goto out; for (i = 0; i < DIM; i++) @@ -110,7 +110,7 @@ static int test_dsets( void ) PASSED(); /*------------------------------------------------------------------------- - * read using the LT function H5LTread_dataset + * read using the LT function H5LTread_dataset *------------------------------------------------------------------------- */ @@ -127,7 +127,7 @@ static int test_dsets( void ) } PASSED(); - + /*------------------------------------------------------------------------- * test the H5LTmake_dataset_ functions *------------------------------------------------------------------------- @@ -135,7 +135,7 @@ static int test_dsets( void ) /*------------------------------------------------------------------------- - * H5LTmake_dataset_char + * H5LTmake_dataset_char *------------------------------------------------------------------------- */ @@ -171,7 +171,7 @@ static int test_dsets( void ) /*------------------------------------------------------------------------- - * H5LTmake_dataset_short + * H5LTmake_dataset_short *------------------------------------------------------------------------- */ @@ -206,7 +206,7 @@ static int test_dsets( void ) PASSED(); /*------------------------------------------------------------------------- - * H5LTmake_dataset_int + * H5LTmake_dataset_int *------------------------------------------------------------------------- */ @@ -219,14 +219,14 @@ static int test_dsets( void ) /* Read dataset */ if ( H5LTread_dataset( file_id, DSET3_NAME, H5T_NATIVE_INT, data_int_out ) < 0 ) goto out; - + for (i = 0; i < DIM; i++) { if ( data_int_in[i] != data_int_out[i] ) { goto out; } } - + /* Read dataset */ if ( H5LTread_dataset_int( file_id, DSET3_NAME, data_int_out ) < 0 ) goto out; @@ -242,7 +242,7 @@ static int test_dsets( void ) /*------------------------------------------------------------------------- - * H5LTmake_dataset_long + * H5LTmake_dataset_long *------------------------------------------------------------------------- */ @@ -278,7 +278,7 @@ static int test_dsets( void ) /*------------------------------------------------------------------------- - * H5LTmake_dataset_float + * H5LTmake_dataset_float *------------------------------------------------------------------------- */ @@ -314,7 +314,7 @@ static int test_dsets( void ) /*------------------------------------------------------------------------- - * H5LTmake_dataset_double + * H5LTmake_dataset_double *------------------------------------------------------------------------- */ @@ -327,7 +327,7 @@ static int test_dsets( void ) /* Read dataset */ if ( H5LTread_dataset( file_id, DSET6_NAME, H5T_NATIVE_DOUBLE, data_double_out ) < 0 ) goto out; - + for (i = 0; i < DIM; i++) { if ( data_double_in[i] != data_double_out[i] ) { @@ -350,7 +350,7 @@ static int test_dsets( void ) /*------------------------------------------------------------------------- - * H5LTmake_dataset_string + * H5LTmake_dataset_string *------------------------------------------------------------------------- */ @@ -363,17 +363,17 @@ static int test_dsets( void ) /* Read dataset */ if ( H5LTread_dataset_string(file_id,DSET7_NAME,data_string_out) < 0 ) goto out; - - if ( strcmp(data_string_in,data_string_out) != 0 ) + + if ( strcmp(data_string_in,data_string_out) != 0 ) goto out; - - + + /*------------------------------------------------------------------------- * end tests *------------------------------------------------------------------------- */ - + /* Close the file. */ H5Fclose( file_id ); @@ -399,7 +399,7 @@ static int test_attr( void ) hid_t file_id; hid_t dataset_id; hid_t group_id; - hid_t space_id; + hid_t space_id; hsize_t dims[1] = { 5 }; /* Create a new file using default properties. */ @@ -414,7 +414,7 @@ static int test_attr( void ) if ((space_id = H5Screate_simple( 1, dims, NULL ))<0) goto out; /* Create the dataset */ - if ((dataset_id = H5Dcreate( file_id , "dset", H5T_NATIVE_INT, space_id, + if ((dataset_id = H5Dcreate( file_id , "dset", H5T_NATIVE_INT, space_id, H5P_DEFAULT ))<0) goto out; /* Close */ @@ -426,33 +426,33 @@ static int test_attr( void ) */ /* Create a group. */ - if ((group_id = H5Gcreate( file_id, "grp", 0 ))<0) + if ((group_id = H5Gcreate( file_id, "grp", 0 ))<0) goto out; - + /* Close */ H5Gclose( group_id ); - + /*------------------------------------------------------------------------- - * + * * Create attributes in the root group - * Note that we are calling the H5LTset_attribute functions with the name "." - * + * Note that we are calling the H5LTset_attribute functions with the name "." + * *------------------------------------------------------------------------- */ if (make_attributes( file_id, "." )<0) goto out; - + /*------------------------------------------------------------------------- - * + * * Create attributes in the dataset "dset" - * + * *------------------------------------------------------------------------- */ if (make_attributes( file_id, "dset" )<0) goto out; - + /*------------------------------------------------------------------------- - * + * * Create attributes in the group "grp" * *------------------------------------------------------------------------- @@ -519,7 +519,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) */ TESTING("H5LTset_attribute_string"); - + /* Set the attribute */ if ( H5LTset_attribute_string( loc_id, obj_name, ATTR1_NAME, attr_str_in ) < 0 ) return -1; @@ -533,12 +533,12 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) TESTING("H5LTget_attribute_string"); - + /* Get the attribute */ if ( H5LTget_attribute_string( loc_id, obj_name, ATTR1_NAME, attr_str_out ) < 0 ) return -1; - if ( strcmp( attr_str_in, attr_str_out ) != 0 ) + if ( strcmp( attr_str_in, attr_str_out ) != 0 ) { return -1; } @@ -994,13 +994,13 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) /*------------------------------------------------------------------------- - * H5LTget_attribute_ndims test + * H5LTget_attribute_ndims test *------------------------------------------------------------------------- */ TESTING("H5LTget_attribute_ndims"); - + if ( H5LTget_attribute_ndims( loc_id, obj_name, ATTR2_NAME, &rank_out ) < 0 ) return -1; @@ -1011,7 +1011,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) PASSED(); /*------------------------------------------------------------------------- - * H5LTget_attribute_info test + * H5LTget_attribute_info test *------------------------------------------------------------------------- */ @@ -1060,12 +1060,12 @@ int main( void ) /* check for errors */ if (nerrors) goto error; - + return 0; - + error: return 1; - + } diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c index 38e1bc4..cd9a9e9 100644 --- a/hl/test/test_packet.c +++ b/hl/test/test_packet.c @@ -38,20 +38,20 @@ * structure used for some tests, a particle *------------------------------------------------------------------------- */ -typedef struct particle_t +typedef struct particle_t { char name[16]; int lati; int longi; float pressure; - double temperature; + double temperature; } particle_t; /*------------------------------------------------------------------------- * a static array of particles for writing and checking reads *------------------------------------------------------------------------- */ -static particle_t testPart[NRECORDS] = { +static particle_t testPart[NRECORDS] = { {"zero", 0,0, 0.0f, 0.0}, {"one", 10,10, 1.0f, 10.0}, {"two", 20,20, 2.0f, 20.0}, @@ -122,14 +122,14 @@ static int create_hl_table(hid_t fid) HOFFSET( particle_t, temperature )}; /* Define field information */ - const char *field_names[NFIELDS] = + const char *field_names[NFIELDS] = { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; hid_t field_type[NFIELDS]; hid_t string_type; hsize_t chunk_size = 10; int *fill_data = NULL; int compress = 0; - herr_t status; + herr_t status; /* Initialize the field field_type */ string_type = H5Tcopy( H5T_C_S1 ); @@ -142,13 +142,13 @@ static int create_hl_table(hid_t fid) /*------------------------------------------------------------------------ - * H5TBmake_table + * H5TBmake_table *------------------------------------------------------------------------- */ status=H5TBmake_table( "Table Title", fid, H5TB_TABLE_NAME, (hsize_t) NFIELDS, - (hsize_t)NRECORDS, sizeof(particle_t), - field_names, part_offset, field_type, + (hsize_t)NRECORDS, sizeof(particle_t), + field_names, part_offset, field_type, chunk_size, fill_data, compress, testPart ); if(status<0) @@ -750,7 +750,7 @@ int test_opaque(hid_t fid) * * ensures that the packet table API throws the correct errors used on * objects that are not packet tables. - * + * *------------------------------------------------------------------------- */ int test_error(hid_t fid) @@ -807,7 +807,7 @@ int test_error(hid_t fid) if(H5PTread_packets(id, 0, 1, readBuf) >= 0) goto out; if(H5PTcreate_index(id) >= 0) - goto out; + goto out; H5E_END_TRY id_open=0; @@ -833,7 +833,7 @@ int test_error(hid_t fid) if(H5PTread_packets(id, 0, 1, readBuf) >= 0) goto out; if(H5PTcreate_index(id) >= 0) - goto out; + goto out; H5E_END_TRY PASSED(); @@ -882,7 +882,7 @@ int main(void) /*------------------------------------------------------------------------- * Packet test: test each function of the packet table *------------------------------------------------------------------------- - */ + */ /* create a file using default properties */ fid=H5Fcreate(TEST_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/hl/test/test_table.c b/hl/test/test_table.c index 42987b2..6483932 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -29,7 +29,7 @@ * * Functions tested: * - * H5TBmake_table + * H5TBmake_table * H5TBread_table * H5TBwrite_records * H5TBread_records @@ -56,12 +56,12 @@ * structure used for all tests, a particle with properties *------------------------------------------------------------------------- */ -typedef struct particle_t +typedef struct particle_t { char name[16]; long longi; float pressure; - double temperature; + double temperature; int lati; } particle_t; @@ -72,24 +72,24 @@ typedef struct particle_t static hid_t h5file_open(const char *fname, unsigned flags); static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf ); -static int compare_deleted(hsize_t rrecords, hsize_t dstart, hsize_t drecords, +static int compare_deleted(hsize_t rrecords, hsize_t dstart, hsize_t drecords, particle_t *rbuf, particle_t *wbuf); /*------------------------------------------------------------------------- * a subset of particle_t, with latitude and longitude fields *------------------------------------------------------------------------- */ - typedef struct position_t + typedef struct position_t { long longi; int lati; } position_t; /*------------------------------------------------------------------------- - * a subset of particle_t, with name and pressure fields + * a subset of particle_t, with name and pressure fields *------------------------------------------------------------------------- */ - typedef struct namepressure_t + typedef struct namepressure_t { char name[16]; float pressure; @@ -117,7 +117,7 @@ static int compare_deleted(hsize_t rrecords, hsize_t dstart, hsize_t drecords, { char name[16]; long longi; - double temperature; + double temperature; int lati; } particle3_t; @@ -159,7 +159,7 @@ int test_table(hid_t fid, int write) hsize_t start2; /* record to start writing in 2nd table */ /*------------------------------------------------------------------------- - * read, write, insert, append buffers + * read, write, insert, append buffers *------------------------------------------------------------------------- */ particle_t rbuf[NRECORDS+4]; @@ -169,7 +169,7 @@ int test_table(hid_t fid, int write) particle_t abuf[2]={{"eight",80,8.0f,80.0,80},{"nine",90,9.0f,90.0,90}}; particle_t ibuf[2]={{"zero", 0, 0.0f, 0.0, 0},{"zero", 0, 0.0f, 0.0, 0}}; particle_t wbufd[NRECORDS]; - particle_t wbuf[NRECORDS] = { + particle_t wbuf[NRECORDS] = { {"zero", 0, 0.0f, 0.0, 0,}, {"one", 10, 1.0f, 10.0, 10}, {"two", 20, 2.0f, 20.0, 20}, @@ -187,23 +187,23 @@ int test_table(hid_t fid, int write) position_t position_out[NRECORDS]; position_t position_in[NRECORDS] = { {0,0}, {10,10}, - {20,20}, - {30,30}, + {20,20}, + {30,30}, {40,40}, - {50,50}, - {60,60}, + {50,50}, + {60,60}, {70,70} }; /* buffers for the fields "Name,Pressure" */ namepressure_t namepre_out[NRECORDS]; - namepressure_t namepre_in[NRECORDS] = + namepressure_t namepre_in[NRECORDS] = { {"zero",0.0f}, - {"one", 1.0f}, - {"two", 2.0f}, - {"three", 3.0f}, + {"one", 1.0f}, + {"two", 2.0f}, + {"three", 3.0f}, {"four", 4.0f}, {"five", 5.0f}, - {"six", 6.0f}, - {"seven", 7.0f}, + {"six", 6.0f}, + {"seven", 7.0f}, }; @@ -219,7 +219,7 @@ int test_table(hid_t fid, int write) HOFFSET( position_t, lati ) }; size_t field_offset_namepre[2]= - { + { HOFFSET( namepressure_t, name ), HOFFSET( namepressure_t, pressure ) }; @@ -229,12 +229,12 @@ int test_table(hid_t fid, int write) sizeof(position_in[0].lati) }; size_t field_sizes_namepre[2]= - { + { sizeof(namepre_in[0].name), sizeof(namepre_in[0].pressure) }; size_t field_sizes_pre[1]= - { + { sizeof(namepre_in[0].pressure) }; @@ -295,7 +295,7 @@ int test_table(hid_t fid, int write) sizeof( rbuf3[0].longi), sizeof( rbuf3[0].temperature), sizeof( rbuf3[0].lati)}; - + /*------------------------------------------------------------------------- * initialize table parameters @@ -306,7 +306,7 @@ int test_table(hid_t fid, int write) */ size_t type_size_mem = sizeof( particle_t ); - size_t field_offset[NFIELDS]= + size_t field_offset[NFIELDS]= { HOFFSET( particle_t, name ), HOFFSET( particle_t, longi ), @@ -314,17 +314,17 @@ int test_table(hid_t fid, int write) HOFFSET( particle_t, temperature ), HOFFSET( particle_t, lati ) }; - size_t field_size[NFIELDS] = + size_t field_size[NFIELDS] = { sizeof( rbuf[0].name), sizeof( rbuf[0].longi), sizeof( rbuf[0].pressure), sizeof( rbuf[0].temperature), - sizeof( rbuf[0].lati) + sizeof( rbuf[0].lati) }; - const char *field_names[NFIELDS] = + const char *field_names[NFIELDS] = { "Name","Longitude","Pressure","Temperature","Latitude" }; - hid_t field_type[NFIELDS]; + hid_t field_type[NFIELDS]; hid_t string_type = H5Tcopy( H5T_C_S1 ); H5Tset_size( string_type, 16 ); field_type[0] = string_type; @@ -337,7 +337,7 @@ int test_table(hid_t fid, int write) * * Functions tested: * - * H5TBmake_table + * H5TBmake_table * H5TBread_table * *------------------------------------------------------------------------- @@ -348,29 +348,29 @@ int test_table(hid_t fid, int write) if (H5TBmake_table(TITLE,fid,"table1",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill,compress,wbuf)<0) + chunk_size,fill,compress,wbuf)<0) goto out; PASSED(); } TESTING2("reading table"); - + /*------------------------------------------------------------------------- * read the table *------------------------------------------------------------------------- */ - - if (H5TBread_table(fid,"table1",type_size_mem,field_offset,field_size,rbuf)<0) + + if (H5TBread_table(fid,"table1",type_size_mem,field_offset,field_size,rbuf)<0) goto out; - + /* compare the extracted table with the original array */ - for( i = 0; i < NRECORDS; i++ ) + for( i = 0; i < NRECORDS; i++ ) { - if (cmp_par(i,i,rbuf,wbuf)<0) + if (cmp_par(i,i,rbuf,wbuf)<0) goto out; } - + PASSED(); @@ -382,35 +382,35 @@ int test_table(hid_t fid, int write) * *------------------------------------------------------------------------- */ - if (write) + if (write) { TESTING2("writing records"); /* create an empty table */ if (H5TBmake_table(TITLE,fid,"table2",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill,compress,0)<0) + chunk_size,fill,compress,0)<0) goto out; /*------------------------------------------------------------------------- * write records, start at 0, write 8 - * pos = 0 1 2 3 4 5 6 7 - * data= 0 1 2 3 4 5 6 7 + * pos = 0 1 2 3 4 5 6 7 + * data= 0 1 2 3 4 5 6 7 *------------------------------------------------------------------------- */ wstart=0; wrecords=8; if (H5TBwrite_records(fid,"table2",wstart,wrecords,type_size_mem,field_offset, - field_size,wbuf)<0) + field_size,wbuf)<0) goto out; /* read it back */ - if (H5TBread_table(fid,"table2",type_size_mem,field_offset,field_size,rbuf)<0) + if (H5TBread_table(fid,"table2",type_size_mem,field_offset,field_size,rbuf)<0) goto out; - + /* compare */ - for( i = 0; i < NRECORDS; i++ ) + for( i = 0; i < NRECORDS; i++ ) { - if (cmp_par(i,i,rbuf,wbuf)<0) + if (cmp_par(i,i,rbuf,wbuf)<0) goto out; } @@ -427,14 +427,14 @@ int test_table(hid_t fid, int write) */ TESTING2("reading records"); - + /*------------------------------------------------------------------------- * read records, start at 0, read 8 - * pos = 0 1 2 3 4 5 6 7 + * pos = 0 1 2 3 4 5 6 7 * data= 0 1 2 3 4 5 6 7 *------------------------------------------------------------------------- */ - + /*------------------------------------------------------------------------- * for the read test we cannot use "table2" because it has been appended * we use the original "table1" instead @@ -444,16 +444,16 @@ int test_table(hid_t fid, int write) strcpy(tname,"table2"); else strcpy(tname,"table1"); - + rstart=0; rrecords=8; if (H5TBread_records(fid,tname,rstart,rrecords,type_size_mem,field_offset, - field_size,rbuf)<0) + field_size,rbuf)<0) goto out; /* compare */ - for( i=rstart; i<rrecords; i++) + for( i=rstart; i<rrecords; i++) { - if (cmp_par(i,i,rbuf,wbuf)<0) + if (cmp_par(i,i,rbuf,wbuf)<0) goto out; } PASSED(); @@ -473,32 +473,32 @@ int test_table(hid_t fid, int write) /*------------------------------------------------------------------------- * append 2 records - * pos = 0 1 2 3 4 5 6 7 8 9 + * pos = 0 1 2 3 4 5 6 7 8 9 * data= 0 1 2 3 4 5 6 7 8 9 *------------------------------------------------------------------------- */ arecords=2; - if (H5TBappend_records(fid,"table2",arecords,type_size_mem,field_offset,field_size,abuf)<0) + if (H5TBappend_records(fid,"table2",arecords,type_size_mem,field_offset,field_size,abuf)<0) return 1; - if (H5TBget_table_info(fid,"table2",&rfields,&rrecords)<0) + if (H5TBget_table_info(fid,"table2",&rfields,&rrecords)<0) return 1; rstart=0; rrecords=NRECORDS+arecords; if (H5TBread_records(fid,"table2",rstart,rrecords,type_size_mem,field_offset, - field_size,rbuf)<0) + field_size,rbuf)<0) return 1; /* compare */ wrecords=8; - for( i=rstart; i<wrecords; i++) + for( i=rstart; i<wrecords; i++) { - if (cmp_par(i,i,rbuf,wbuf)<0) + if (cmp_par(i,i,rbuf,wbuf)<0) goto out; } - for( i=wrecords, j=0; i<rrecords; i++,j++) + for( i=wrecords, j=0; i<rrecords; i++,j++) { - if (cmp_par(i,j,rbuf,abuf)<0) + if (cmp_par(i,j,rbuf,abuf)<0) goto out; } PASSED(); @@ -520,44 +520,44 @@ int test_table(hid_t fid, int write) /*------------------------------------------------------------------------- * insert 2 records * pos = 0 1 2 3 4 5 6 7 8 9 10 11 - * data= 0 0 0 1 2 3 4 5 6 7 8 9 + * data= 0 0 0 1 2 3 4 5 6 7 8 9 *------------------------------------------------------------------------- */ istart=1; irecords=2; - if (H5TBinsert_record(fid,"table2",istart,irecords,type_size_mem,field_offset,field_size,ibuf)<0) + if (H5TBinsert_record(fid,"table2",istart,irecords,type_size_mem,field_offset,field_size,ibuf)<0) return 1; - if (H5TBget_table_info(fid,"table2",&rfields,&rrecords)<0) + if (H5TBget_table_info(fid,"table2",&rfields,&rrecords)<0) return 1; if (H5TBread_records(fid,"table2",rstart,rrecords,type_size_mem,field_offset, - field_size,rbuf)<0) + field_size,rbuf)<0) return 1; /* compare */ - for( i=0; i<12; i++) + for( i=0; i<12; i++) { if (i<istart) { - if (cmp_par(i,i,rbuf,wbuf)<0) + if (cmp_par(i,i,rbuf,wbuf)<0) goto out; } else if (i>=istart && i<istart+irecords) { j=i-istart; - if (cmp_par(i,j,rbuf,ibuf)<0) + if (cmp_par(i,j,rbuf,ibuf)<0) goto out; } else if (i>=istart+irecords && i<10) { j=i-irecords; - if (cmp_par(i,j,rbuf,wbuf)<0) + if (cmp_par(i,j,rbuf,wbuf)<0) goto out; } - else + else { j=i-10; - if (cmp_par(i,j,rbuf,abuf)<0) + if (cmp_par(i,j,rbuf,abuf)<0) goto out; } } @@ -579,151 +579,151 @@ int test_table(hid_t fid, int write) /*------------------------------------------------------------------------- * Create a table - * pos = 0 1 2 3 4 5 6 7 - * data= 0 1 2 3 4 5 6 7 + * pos = 0 1 2 3 4 5 6 7 + * data= 0 1 2 3 4 5 6 7 *------------------------------------------------------------------------- */ - for( i=0; i<NRECORDS; i++) + for( i=0; i<NRECORDS; i++) wbufd[i] = wbuf[i]; if (H5TBmake_table(TITLE,fid,"table3",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill,compress,wbufd)<0) + chunk_size,fill,compress,wbufd)<0) goto out; /*------------------------------------------------------------------------- * Delete records, start at 2, delete 3 - * pos = 0 1 2 3 4 - * data= 0 1 5 6 7 + * pos = 0 1 2 3 4 + * data= 0 1 5 6 7 *------------------------------------------------------------------------- */ dstart=2; drecords=3; - if (H5TBdelete_record(fid,"table3",dstart,drecords)<0) + if (H5TBdelete_record(fid,"table3",dstart,drecords)<0) goto out; - if (H5TBget_table_info(fid,"table3",&rfields,&rrecords)<0) + if (H5TBget_table_info(fid,"table3",&rfields,&rrecords)<0) goto out; - rstart=0; + rstart=0; if (H5TBread_records(fid,"table3",rstart,rrecords,type_size_mem,field_offset, - field_size,rbuf)<0) + field_size,rbuf)<0) goto out; /* Compare */ - nrecords=NRECORDS; + nrecords=NRECORDS; assert(rrecords == nrecords-drecords); - if (compare_deleted(rrecords,dstart,drecords,rbuf,wbufd)<0) + if (compare_deleted(rrecords,dstart,drecords,rbuf,wbufd)<0) goto out; - + /*------------------------------------------------------------------------- * reset compare buffer *------------------------------------------------------------------------- */ - nrecords=rrecords; - for( i=0; i<nrecords; i++) + nrecords=rrecords; + for( i=0; i<nrecords; i++) wbufd[i] = rbuf[i]; /*------------------------------------------------------------------------- * Delete records, start at 0, delete 2 - * pos = 0 1 2 - * data= 5 6 7 + * pos = 0 1 2 + * data= 5 6 7 *------------------------------------------------------------------------- */ dstart=0; drecords=2; - if (H5TBdelete_record(fid,"table3",dstart,drecords)<0) + if (H5TBdelete_record(fid,"table3",dstart,drecords)<0) goto out; - if (H5TBget_table_info(fid,"table3",&rfields,&rrecords)<0) + if (H5TBget_table_info(fid,"table3",&rfields,&rrecords)<0) goto out; - rstart=0; + rstart=0; if (H5TBread_records(fid,"table3",rstart,rrecords,type_size_mem,field_offset, - field_size,rbuf)<0) + field_size,rbuf)<0) goto out; /* Compare */ assert(rrecords == nrecords-drecords); - if (compare_deleted(rrecords,dstart,drecords,rbuf,wbufd)<0) + if (compare_deleted(rrecords,dstart,drecords,rbuf,wbufd)<0) goto out; /*------------------------------------------------------------------------- * reset compare buffer *------------------------------------------------------------------------- */ - nrecords=rrecords; - for( i=0; i<nrecords; i++) + nrecords=rrecords; + for( i=0; i<nrecords; i++) wbufd[i] = rbuf[i]; /*------------------------------------------------------------------------- * Delete records, start at 1, delete 1 - * pos = 0 1 - * data= 5 7 + * pos = 0 1 + * data= 5 7 *------------------------------------------------------------------------- */ dstart=1; drecords=1; - if (H5TBdelete_record(fid,"table3",dstart,drecords)<0) + if (H5TBdelete_record(fid,"table3",dstart,drecords)<0) goto out; - if (H5TBget_table_info(fid,"table3",&rfields,&rrecords)<0) + if (H5TBget_table_info(fid,"table3",&rfields,&rrecords)<0) goto out; - rstart=0; + rstart=0; if (H5TBread_records(fid,"table3",rstart,rrecords,type_size_mem,field_offset, - field_size,rbuf)<0) + field_size,rbuf)<0) goto out; /* Compare */ assert(rrecords == nrecords-drecords); - if (compare_deleted(rrecords,dstart,drecords,rbuf,wbufd)<0) + if (compare_deleted(rrecords,dstart,drecords,rbuf,wbufd)<0) goto out; /*------------------------------------------------------------------------- * reset compare buffer *------------------------------------------------------------------------- */ - nrecords=rrecords; - for( i=0; i<nrecords; i++) + nrecords=rrecords; + for( i=0; i<nrecords; i++) wbufd[i] = rbuf[i]; /*------------------------------------------------------------------------- * Delete records, start at 0, delete 1 - * pos = 0 - * data= 7 + * pos = 0 + * data= 7 *------------------------------------------------------------------------- */ dstart=0; drecords=1; - if (H5TBdelete_record(fid,"table3",dstart,drecords)<0) + if (H5TBdelete_record(fid,"table3",dstart,drecords)<0) goto out; - if (H5TBget_table_info(fid,"table3",&rfields,&rrecords)<0) + if (H5TBget_table_info(fid,"table3",&rfields,&rrecords)<0) goto out; - rstart=0; + rstart=0; if (H5TBread_records(fid,"table3",rstart,rrecords,type_size_mem,field_offset, - field_size,rbuf)<0) + field_size,rbuf)<0) goto out; /* Compare */ assert(rrecords == nrecords-drecords); - if (compare_deleted(rrecords,dstart,drecords,rbuf,wbufd)<0) + if (compare_deleted(rrecords,dstart,drecords,rbuf,wbufd)<0) goto out; /*------------------------------------------------------------------------- * reset compare buffer *------------------------------------------------------------------------- */ - nrecords=rrecords; - for( i=0; i<nrecords; i++) + nrecords=rrecords; + for( i=0; i<nrecords; i++) wbufd[i] = rbuf[i]; /* Read complete table */ - if (H5TBread_table(fid,"table3",type_size_mem,field_offset,field_size,rbuf)<0) + if (H5TBread_table(fid,"table3",type_size_mem,field_offset,field_size,rbuf)<0) goto out; /* Compare */ - for( i=0; i<rrecords; i++) + for( i=0; i<rrecords; i++) { - if (cmp_par(i,i,rbuf,wbufd)<0) + if (cmp_par(i,i,rbuf,wbufd)<0) goto out; } @@ -739,7 +739,7 @@ int test_table(hid_t fid, int write) * *------------------------------------------------------------------------- */ - + if (write) { TESTING2("adding records"); @@ -747,42 +747,42 @@ int test_table(hid_t fid, int write) /* create 2 tables */ if (H5TBmake_table(TITLE,fid,"table4",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill,compress,wbuf)<0) + chunk_size,fill,compress,wbuf)<0) goto out; if (H5TBmake_table(TITLE,fid,"table5",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill,compress,wbuf)<0) + chunk_size,fill,compress,wbuf)<0) goto out; /* add the records from "table4" to "table5" */ - start1 = 3; - nrecords = 2; - start2 = 6; + start1 = 3; + nrecords = 2; + start2 = 6; if ( H5TBadd_records_from(fid,"table4",start1,nrecords,"table5",start2)<0) goto out; /* read final table */ - if (H5TBread_table(fid,"table5",type_size_mem,field_offset,field_size,rbuf)<0) + if (H5TBread_table(fid,"table5",type_size_mem,field_offset,field_size,rbuf)<0) goto out; /* compare */ - for( i = 0; i < NRECORDS+2; i++ ) + for( i = 0; i < NRECORDS+2; i++ ) { if ( i < start2 ) { - if (cmp_par(i,i,rbuf,wbuf)<0) + if (cmp_par(i,i,rbuf,wbuf)<0) goto out; } else if ( i < start2+nrecords ) { j = i-start1; - if (cmp_par(i,j,rbuf,wbuf)<0) + if (cmp_par(i,j,rbuf,wbuf)<0) goto out; } - else + else { j = i-nrecords; - if (cmp_par(i,j,rbuf,wbuf)<0) + if (cmp_par(i,j,rbuf,wbuf)<0) goto out; } } @@ -799,7 +799,7 @@ int test_table(hid_t fid, int write) * *------------------------------------------------------------------------- */ - + if (write) { TESTING2("combining tables"); @@ -807,11 +807,11 @@ int test_table(hid_t fid, int write) /* create 2 tables */ if (H5TBmake_table(TITLE,fid,"table6",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill,compress,wbuf)<0) + chunk_size,fill,compress,wbuf)<0) goto out; if (H5TBmake_table(TITLE,fid,"table7",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill,compress,wbuf)<0) + chunk_size,fill,compress,wbuf)<0) goto out; /* combine the two tables into a third */ @@ -819,20 +819,20 @@ int test_table(hid_t fid, int write) goto out; /* read merged table */ - if (H5TBread_table(fid,"table8",type_size_mem,field_offset,field_size,rbufc)<0) + if (H5TBread_table(fid,"table8",type_size_mem,field_offset,field_size,rbufc)<0) goto out; /* compare */ - for( i = 0; i < NRECORDS*2; i++ ) + for( i = 0; i < NRECORDS*2; i++ ) { if ( i < NRECORDS ) { - if (cmp_par(i,i,rbufc,wbuf)<0) + if (cmp_par(i,i,rbufc,wbuf)<0) goto out; } else { - if (cmp_par(i,i-NRECORDS,rbufc,wbuf)<0) + if (cmp_par(i,i-NRECORDS,rbufc,wbuf)<0) goto out; } } @@ -845,15 +845,15 @@ int test_table(hid_t fid, int write) /* create 2 files using default properties. */ fid1 = H5Fcreate("combine_tables1.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT); fid2 = H5Fcreate("combine_tables2.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT); - + /* create 2 tables, one in each file */ if (H5TBmake_table(TITLE,fid1,"table1",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill,compress,wbuf)<0) + chunk_size,fill,compress,wbuf)<0) goto out; if (H5TBmake_table(TITLE,fid2,"table2",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill,compress,wbuf)<0) + chunk_size,fill,compress,wbuf)<0) goto out; /* combine the two tables into a third */ @@ -861,20 +861,20 @@ int test_table(hid_t fid, int write) goto out; /* read merged table */ - if (H5TBread_table(fid1,"table3",type_size_mem,field_offset,field_size,rbufc)<0) + if (H5TBread_table(fid1,"table3",type_size_mem,field_offset,field_size,rbufc)<0) goto out; /* compare */ - for( i = 0; i < NRECORDS*2; i++ ) + for( i = 0; i < NRECORDS*2; i++ ) { if ( i < NRECORDS ) { - if (cmp_par(i,i,rbufc,wbuf)<0) + if (cmp_par(i,i,rbufc,wbuf)<0) goto out; } else { - if (cmp_par(i,i-NRECORDS,rbufc,wbuf)<0) + if (cmp_par(i,i-NRECORDS,rbufc,wbuf)<0) goto out; } } @@ -902,37 +902,37 @@ int test_table(hid_t fid, int write) /* make an empty table with fill values */ if (H5TBmake_table(TITLE,fid,"table9",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill1,compress,0)<0) + chunk_size,fill1,compress,0)<0) goto out; /* write the pressure field starting at record 2 */ - start = 2; - nrecords = 3; + start = 2; + nrecords = 3; if (H5TBwrite_fields_name(fid,"table9","Pressure",start,nrecords,sizeof(float), 0,field_sizes_pre,pressure_in)<0) goto out; /* write the new longitude and latitude information starting at record 2 */ - start = 2; + start = 2; nrecords = 3; if (H5TBwrite_fields_name(fid,"table9","Latitude,Longitude",start,nrecords,sizeof(position_t), field_offset_pos,field_sizes_pos,position_in)<0) goto out; /* read back the all table */ - start = 0; - nrecords = NRECORDS; - if (H5TBread_table(fid,"table9",type_size_mem,field_offset,field_size,rbuf)<0) + start = 0; + nrecords = NRECORDS; + if (H5TBread_table(fid,"table9",type_size_mem,field_offset,field_size,rbuf)<0) goto out; /* compare the read values with the initial values */ - for( i = 0; i < NRECORDS; i++ ) + for( i = 0; i < NRECORDS; i++ ) { if ( i >= 2 && i <= 4 ) { if ( rbuf[i].lati != position_in[i].lati || rbuf[i].longi != position_in[i].longi || - rbuf[i].pressure != pressure_in[i] ) + rbuf[i].pressure != pressure_in[i] ) { fprintf(stderr,"%ld %f %d\n", rbuf[i].longi,rbuf[i].pressure,rbuf[i].lati); @@ -955,7 +955,7 @@ int test_table(hid_t fid, int write) *------------------------------------------------------------------------- */ TESTING2("reading fields by name"); - + /*------------------------------------------------------------------------- * write and read the "Pressure" field *------------------------------------------------------------------------- @@ -964,32 +964,32 @@ int test_table(hid_t fid, int write) { if (H5TBmake_table(TITLE,fid,"table10",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill1,compress,0)<0) + chunk_size,fill1,compress,0)<0) goto out; - + /* write the pressure field to all the records */ - start = 0; - nrecords = NRECORDS; - if ( H5TBwrite_fields_name(fid,"table10","Pressure",start,nrecords, + start = 0; + nrecords = NRECORDS; + if ( H5TBwrite_fields_name(fid,"table10","Pressure",start,nrecords, sizeof( float ),0,field_sizes_pre,pressure_in)<0) goto out; } - + /* read the "Pressure" field */ - start = 0; - nrecords = NRECORDS; - if ( H5TBread_fields_name(fid,"table10","Pressure",start,nrecords, + start = 0; + nrecords = NRECORDS; + 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++ ) + for( i = 0; i < NRECORDS; i++ ) { if ( pressure_out[i] != pressure_in[i] ) { goto out; } } - + /*------------------------------------------------------------------------- * Write and read the "Latitude,Longitude" fields *------------------------------------------------------------------------- @@ -997,28 +997,28 @@ int test_table(hid_t fid, int write) if (write) { /* Write the new longitude and latitude information to all the records */ - start = 0; - nrecords = NRECORDS; - if ( H5TBwrite_fields_name(fid,"table10", "Latitude,Longitude", start, nrecords, + start = 0; + nrecords = NRECORDS; + if ( H5TBwrite_fields_name(fid,"table10", "Latitude,Longitude", start, nrecords, sizeof( position_t ), field_offset_pos, field_sizes_pos, position_in ) < 0 ) goto out; }/*write*/ - + /* Read the "Latitude,Longitude" fields */ - start = 0; - nrecords = NRECORDS; - if ( H5TBread_fields_name( fid, "table10", "Latitude,Longitude", + start = 0; + nrecords = NRECORDS; + if ( H5TBread_fields_name( fid, "table10", "Latitude,Longitude", start, nrecords, sizeof(position_t), field_offset_pos, field_sizes_pos, position_out ) < 0 ) goto out; - + /* Compare the extracted table with the initial values */ - for( i = 0; i < NRECORDS; i++ ) + for( i = 0; i < NRECORDS; i++ ) { if ( position_out[i].lati != position_in[i].lati || - position_out[i].longi != position_in[i].longi ) + position_out[i].longi != position_in[i].longi ) goto out; } - + /*------------------------------------------------------------------------- * Write and read the "Name,Pressure" fields @@ -1027,23 +1027,23 @@ int test_table(hid_t fid, int write) if (write) { /* Write the new name and pressure information to all the records */ - start = 0; - nrecords = NRECORDS; - if ( H5TBwrite_fields_name( fid, "table10", "Name,Pressure", start, nrecords, + start = 0; + nrecords = NRECORDS; + if ( H5TBwrite_fields_name( fid, "table10", "Name,Pressure", start, nrecords, sizeof( namepressure_t ), field_offset_namepre, field_sizes_namepre, namepre_in ) < 0 ) goto out; }/*write*/ /* Read the "Name,Pressure" fields */ - start = 0; - nrecords = NRECORDS; - if ( H5TBread_fields_name( fid, "table10", "Name,Pressure", + start = 0; + nrecords = NRECORDS; + if ( H5TBread_fields_name( fid, "table10", "Name,Pressure", start, nrecords, sizeof(namepressure_t), field_offset_namepre, field_sizes_namepre, namepre_out ) < 0 ) goto out; /* Compare the extracted table with the initial values */ - for( i = 0; i < NRECORDS; i++ ) + for( i = 0; i < NRECORDS; i++ ) { if ( ( strcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || namepre_out[i].pressure != namepre_in[i].pressure ) { @@ -1051,7 +1051,7 @@ int test_table(hid_t fid, int write) } } /* reset buffer */ - for( i = 0; i < NRECORDS; i++ ) + for( i = 0; i < NRECORDS; i++ ) { strcpy( namepre_out[i].name, "\0" ); namepre_out[i].pressure = -1; @@ -1061,15 +1061,15 @@ int test_table(hid_t fid, int write) * read only 3 records of the "Name,Pressure" fields, starting at record 2 *------------------------------------------------------------------------- */ - start = 2; - nrecords = 3; - if ( H5TBread_fields_name( fid, "table10", "Name,Pressure", - start, nrecords, sizeof(namepressure_t), field_offset_namepre, + start = 2; + nrecords = 3; + if ( H5TBread_fields_name( fid, "table10", "Name,Pressure", + start, nrecords, sizeof(namepressure_t), field_offset_namepre, field_sizes_namepre, namepre_out ) < 0 ) goto out; /* Compare the extracted table with the initial values */ - for( i = 0; i < 3; i++ ) + for( i = 0; i < 3; i++ ) { if ( ( strcmp( namepre_out[i].name, namepre_in[start+i].name ) != 0 ) || namepre_out[i].pressure != namepre_in[start+i].pressure ) { @@ -1093,42 +1093,42 @@ int test_table(hid_t fid, int write) /* make an empty table */ if (H5TBmake_table(TITLE,fid,"table11",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill,compress,NULL)<0) + chunk_size,fill,compress,NULL)<0) goto out; /* write the pressure field starting at record 2 */ nfields = 1; - start = 2; - nrecords = 3; - if ( H5TBwrite_fields_index(fid, "table11", nfields, field_index_pre, start, nrecords, + start = 2; + nrecords = 3; + if ( H5TBwrite_fields_index(fid, "table11", nfields, field_index_pre, start, nrecords, sizeof( float ), 0, field_sizes_pre, pressure_in ) < 0 ) goto out; /* write the new longitude and latitude information starting at record 2 */ nfields = 2; - start = 2; - nrecords = 3; - if ( H5TBwrite_fields_index(fid, "table11", nfields, field_index_pos, start, nrecords, + start = 2; + nrecords = 3; + if ( H5TBwrite_fields_index(fid, "table11", nfields, field_index_pos, start, nrecords, sizeof( position_t ), field_offset_pos, field_sizes_pos, position_in ) < 0 ) goto out; /* read back the all table */ nfields = 5; - start = 0; - nrecords = NRECORDS; - if ( H5TBread_fields_index(fid, "table11", nfields, field_index, + start = 0; + nrecords = NRECORDS; + if ( H5TBread_fields_index(fid, "table11", nfields, field_index, start, nrecords, type_size_mem, field_offset, field_size, rbuf ) < 0 ) goto out; /* Compare the extracted table with the initial values */ - for( i = 0; i < NRECORDS; i++ ) + for( i = 0; i < NRECORDS; i++ ) { if ( i >= 2 && i <= 4 ) { if ( rbuf[i].lati != position_in[i].lati || rbuf[i].longi != position_in[i].longi || - rbuf[i].pressure != pressure_in[i] ) + rbuf[i].pressure != pressure_in[i] ) goto out; } } @@ -1145,7 +1145,7 @@ int test_table(hid_t fid, int write) * *------------------------------------------------------------------------- */ - + TESTING2("reading fields by index"); if (write) @@ -1153,9 +1153,9 @@ int test_table(hid_t fid, int write) /* make an empty table */ if (H5TBmake_table(TITLE,fid,"table12",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill,compress,NULL)<0) + chunk_size,fill,compress,NULL)<0) goto out; - + /*------------------------------------------------------------------------- * write and read the "Pressure" field *------------------------------------------------------------------------- @@ -1163,29 +1163,29 @@ int test_table(hid_t fid, int write) /* write the pressure field to all the records */ nfields = 1; - start = 0; - nrecords = NRECORDS; - if ( H5TBwrite_fields_index(fid, "table12", nfields, field_index_pre, start, nrecords, + start = 0; + nrecords = NRECORDS; + if ( H5TBwrite_fields_index(fid, "table12", nfields, field_index_pre, start, nrecords, sizeof( float ), 0, field_sizes_pre, pressure_in ) < 0 ) goto out; } - + /* read the "Pressure" field */ nfields = 1; - start = 0; - nrecords = NRECORDS; - if ( H5TBread_fields_index(fid, "table12", nfields, field_index_pre, + start = 0; + nrecords = NRECORDS; + if ( H5TBread_fields_index(fid, "table12", nfields, field_index_pre, 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++ ) + for( i = 0; i < NRECORDS; i++ ) { if ( pressure_out[i] != pressure_in[i] ) { goto out; } } - + /*------------------------------------------------------------------------- * write and read the "Latitude,Longitude" fields *------------------------------------------------------------------------- @@ -1194,23 +1194,23 @@ int test_table(hid_t fid, int write) { /* write the new longitude and latitude information to all the records */ nfields = 2; - start = 0; - nrecords = NRECORDS; - if ( H5TBwrite_fields_index(fid, "table12", nfields, field_index_pos, start, nrecords, + start = 0; + nrecords = NRECORDS; + if ( H5TBwrite_fields_index(fid, "table12", nfields, field_index_pos, start, nrecords, sizeof( position_t ), field_offset_pos, field_sizes_pos, position_in ) < 0 ) goto out; } /*write*/ /* read the "Latitude,Longitude" fields */ nfields = 2; - start = 0; - nrecords = NRECORDS; - if ( H5TBread_fields_index(fid, "table12", nfields, field_index_pos, + start = 0; + nrecords = NRECORDS; + if ( H5TBread_fields_index(fid, "table12", nfields, field_index_pos, start, nrecords, sizeof(position_t), field_offset_pos, field_sizes_pos, position_out ) < 0 ) goto out; /* compare the extracted table with the initial values */ - for( i = 0; i < NRECORDS; i++ ) + for( i = 0; i < NRECORDS; i++ ) { if ( position_out[i].lati != position_in[i].lati || position_out[i].longi != position_in[i].longi ) { @@ -1227,24 +1227,24 @@ int test_table(hid_t fid, int write) { /* write the new name and pressure information to all the records */ nfields = 2; - start = 0; - nrecords = NRECORDS; - if ( H5TBwrite_fields_index(fid, "table12", nfields, field_index_namepre, start, nrecords, + start = 0; + nrecords = NRECORDS; + if ( H5TBwrite_fields_index(fid, "table12", nfields, field_index_namepre, start, nrecords, sizeof( namepressure_t ), field_offset_namepre, field_sizes_namepre, namepre_in ) < 0 ) goto out; } /* read the "Name,Pressure" fields */ nfields = 2; - start = 0; - nrecords = NRECORDS; - if ( H5TBread_fields_index(fid, "table12", nfields, field_index_namepre, - start, nrecords, sizeof(namepressure_t), field_offset_namepre, + start = 0; + nrecords = NRECORDS; + if ( H5TBread_fields_index(fid, "table12", nfields, field_index_namepre, + start, nrecords, sizeof(namepressure_t), field_offset_namepre, field_sizes_namepre, namepre_out ) < 0 ) goto out; /* compare the extracted table with the initial values */ - for( i = 0; i < NRECORDS; i++ ) + for( i = 0; i < NRECORDS; i++ ) { if ( ( strcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || namepre_out[i].pressure != namepre_in[i].pressure ) { @@ -1253,7 +1253,7 @@ int test_table(hid_t fid, int write) } /* reset buffer */ - for( i = 0; i < NRECORDS; i++ ) + for( i = 0; i < NRECORDS; i++ ) { strcpy( namepre_out[i].name, "\0" ); namepre_out[i].pressure = -1; @@ -1263,18 +1263,18 @@ int test_table(hid_t fid, int write) * read only 3 records of the "Name,Pressure" fields, starting at record 2 *------------------------------------------------------------------------- */ - + /* write the new name and pressure information to all the records */ nfields = 2; - start = 2; - nrecords = 3; - if ( H5TBread_fields_index(fid, "table12", nfields, field_index_namepre, - start, nrecords, sizeof(namepressure_t), field_offset_namepre, + start = 2; + nrecords = 3; + if ( H5TBread_fields_index(fid, "table12", nfields, field_index_namepre, + start, nrecords, sizeof(namepressure_t), field_offset_namepre, field_sizes_namepre, namepre_out ) < 0 ) goto out; /* compare the extracted table with the initial values */ - for( i = 0; i < 3; i++ ) + for( i = 0; i < 3; i++ ) { if ( ( strcmp( namepre_out[i].name, wbuf[start+i].name ) != 0 ) || namepre_out[i].pressure != wbuf[start+i].pressure ) { @@ -1293,7 +1293,7 @@ int test_table(hid_t fid, int write) * *------------------------------------------------------------------------- */ - + if (write) { TESTING2("inserting fields"); @@ -1301,12 +1301,12 @@ int test_table(hid_t fid, int write) /* make a table */ if (H5TBmake_table(TITLE,fid,"table13",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill1,compress,wbuf)<0) + chunk_size,fill1,compress,wbuf)<0) goto out; - + /* insert the new field at the end of the field list */ position = NFIELDS; - if ( H5TBinsert_field( fid, "table13", "New Field", field_type_new, position, + if ( H5TBinsert_field( fid, "table13", "New Field", field_type_new, position, fill1_new, buf_new ) < 0 ) goto out; @@ -1315,7 +1315,7 @@ int test_table(hid_t fid, int write) goto out; /* compare the extracted table with the original array */ - for( i = 0; i < NRECORDS; i++ ) + for( i = 0; i < NRECORDS; i++ ) { if ( ( strcmp( rbuf2[i].name, wbuf[i].name ) != 0 ) || rbuf2[i].lati != wbuf[i].lati || @@ -1345,7 +1345,7 @@ int test_table(hid_t fid, int write) /* make a table */ if (H5TBmake_table(TITLE,fid,"table14",NFIELDS,NRECORDS,type_size_mem, field_names,field_offset,field_type, - chunk_size,fill,compress,wbuf)<0) + chunk_size,fill,compress,wbuf)<0) goto out; @@ -1356,9 +1356,9 @@ int test_table(hid_t fid, int write) /* read the table */ if ( H5TBread_table(fid, "table14", dst_size3, dst_offset3, dst_sizes3, rbuf3 ) < 0 ) goto out; - + /* compare the extracted table with the original array */ - for( i = 0; i < NRECORDS; i++ ) + for( i = 0; i < NRECORDS; i++ ) { if ( ( strcmp( rbuf3[i].name, wbuf[i].name ) != 0 ) || rbuf3[i].lati != wbuf[i].lati || @@ -1403,10 +1403,10 @@ int test_table(hid_t fid, int write) */ TESTING2("getting field info"); - + /* alocate */ names_out = malloc( sizeof(char*) * (size_t)NFIELDS ); - for ( i = 0; i < NFIELDS; i++) + for ( i = 0; i < NFIELDS; i++) { names_out[i] = malloc( sizeof(char) * 255 ); } @@ -1415,7 +1415,7 @@ int test_table(hid_t fid, int write) if ( H5TBget_field_info(fid, "table1", names_out, sizes_out, offset_out, &size_out ) < 0 ) goto out; - for ( i = 0; i < NFIELDS; i++) + for ( i = 0; i < NFIELDS; i++) { if ( (strcmp( field_names[i], names_out[i] ) != 0)) { goto out; @@ -1423,7 +1423,7 @@ int test_table(hid_t fid, int write) } /* release */ - for ( i = 0; i < NFIELDS; i++) + for ( i = 0; i < NFIELDS; i++) { free ( names_out[i] ); } @@ -1451,11 +1451,11 @@ int main(void) { hid_t fid; /* identifier for the file */ unsigned flags=H5F_ACC_RDONLY; - + /*------------------------------------------------------------------------- * test1: create a file for the write/read test *------------------------------------------------------------------------- - */ + */ /* create a file using default properties */ fid=H5Fcreate("test_table.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT); @@ -1472,7 +1472,7 @@ int main(void) /*------------------------------------------------------------------------- * test2: open a file written in test1 on a big-endian machine *------------------------------------------------------------------------- - */ + */ puts("Testing table with file open mode (read big-endian data):"); fid=h5file_open(TEST_FILE_BE,flags); @@ -1527,18 +1527,18 @@ out: */ static hid_t h5file_open(const char *fname, unsigned flags) { - + hid_t fid; /* identifier for the file */ char *srcdir = getenv("srcdir"); /* the source directory */ char data_file[512]=""; /* buffer to hold name of existing file */ - + /* compose the name of the file to open, using the srcdir, if appropriate */ if (srcdir){ strcpy(data_file,srcdir); strcat(data_file,"/"); - } + } strcat(data_file,fname); - + /* open */ if((fid=H5Fopen(data_file,flags,H5P_DEFAULT))<0) { fprintf(stderr,"Error: Cannot open file <%s>\n",data_file ); @@ -1573,21 +1573,21 @@ static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf ) * function to compare deleted records *------------------------------------------------------------------------- */ -static int compare_deleted(hsize_t rrecords, hsize_t dstart, hsize_t drecords, +static int compare_deleted(hsize_t rrecords, hsize_t dstart, hsize_t drecords, particle_t *rbuf, particle_t *wbuf) { hsize_t i,j; - for( i=0; i<rrecords; i++) + for( i=0; i<rrecords; i++) { if (i<dstart) { - if (cmp_par(i,i,rbuf,wbuf)<0) + if (cmp_par(i,i,rbuf,wbuf)<0) return -1; } else { j=i+drecords; - if (cmp_par(i,j,rbuf,wbuf)<0) + if (cmp_par(i,j,rbuf,wbuf)<0) return -1; } } diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c index 410778f..2ebf28d 100644 --- a/hl/tools/gif2h5/decompress.c +++ b/hl/tools/gif2h5/decompress.c @@ -81,7 +81,7 @@ int numused; * our location in the Raster array as a BIT Offset. We compute the BYTE * Offset WORDo the raster array by dividing this by 8, pick up three BYTEs, * compute the bit Offset WORDo our 24-bit chunk, shift to bring the desired - * code to the bottom, then mask it off and return it. + * code to the bottom, then mask it off and return it. */ static int ReadCode(void) @@ -166,39 +166,39 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) { int i; - XC = 0; + XC = 0; YC = 0; Pass = 0; OutCount = 0; BitOffset = 0; - + DataMask = (1 << ((GifHead->PackedField & 0x07) +1)) -1; Raster = GifImageDesc->GIFImage; /* Check for image seperator */ - + /* Now read in values from the image descriptor */ IWidth = GifImageDesc->ImageWidth; IHeight = GifImageDesc->ImageHeight; Interlace = GifImageDesc->PackedField & 0x40; - + /* * Note that I ignore the possible existence of a local color map. I'm * told there aren't many files around that use them, and the spec says * it's defined for future use. This could lead to an error reading some - * files. + * files. */ - + /* * Start reading the raster data. First we get the WORDial code size and * compute decompressor constant values, based on this code size. */ - + CodeSize = GifImageDesc->CodeSize; ClearCode = (1 << CodeSize); EOFCode = ClearCode + 1; FreeCode = FirstFree = ClearCode + 2; - + /* * The GIF spec has it that the code size is the code size used to compute * the above values is the code size given in the file, but the code size @@ -218,19 +218,19 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) */ /* Allocate the Image */ - + if (!(Image = (BYTE *)malloc((size_t)IWidth*(size_t)IHeight))) { printf("Out of memory"); exit(-1); } - + BytesPerScanline = IWidth; - + /* * Decompress the file, continuing until you see the GIF EOF code. One * obvious enhancement is to add checking for corrupt files here. */ - + Code = ReadCode(); while (Code != EOFCode) { @@ -269,7 +269,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) */ while (CurCode > DataMask) { if (OutCount > 1024) { - /*return error message*/ + /*return error message*/ } OutCode[OutCount++] = Suffix[CurCode]; @@ -316,5 +316,5 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) Code = ReadCode(); } - return Image; + return Image; } diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h index 282085f..ad60968 100644 --- a/hl/tools/gif2h5/gif.h +++ b/hl/tools/gif2h5/gif.h @@ -47,8 +47,8 @@ typedef unsigned char boolean; ** Set EndianOrder = 0 if machine is little endian ** EndianOrder = 1 if machine is big endian. */ -extern int EndianOrder; - +extern int EndianOrder; + /* ** The GIF header format. ** @@ -63,9 +63,9 @@ typedef struct _GifHeader { /* Offset Description */ BYTE ApplicationCount; BYTE PlainTextCount; BYTE HDFPalette[256][3]; - BYTE HeaderDump[6]; /* BYTE array to dump header contents */ + BYTE HeaderDump[6]; /* BYTE array to dump header contents */ BYTE LSDDump[7]; /* Logical Screen Descriptor dump */ -} GIFHEAD; +} GIFHEAD; /* @@ -122,9 +122,9 @@ typedef struct _GifCommentExtension { /* ** GIF to HDF Memory Struct -** Purpose : The gif to hdf structure is used to pass all the +** Purpose : The gif to hdf structure is used to pass all the ** gif data to the memory, which gets caught by the hdf driver -** Its the drivers job to put the data in the appropriate places +** Its the drivers job to put the data in the appropriate places ** in the HDF file. ** I have assumed that the ImageDescriptors and GraphicControls follow ** one another, ie. I have not associated them with each other. The driver diff --git a/hl/tools/gif2h5/gif2mem.c b/hl/tools/gif2h5/gif2mem.c index 01aa5a2..0695995 100644 --- a/hl/tools/gif2h5/gif2mem.c +++ b/hl/tools/gif2h5/gif2mem.c @@ -100,7 +100,7 @@ Gif2Mem(BYTE *MemGif) /* Read the GIF image file header information */ ReadGifHeader(gifHead, &MemGif); - + /* Check for FILE stream error */ #if 0 if (ferror(fpGif)) @@ -121,7 +121,7 @@ Gif2Mem(BYTE *MemGif) for (;;) { Identifier = *MemGif++; - + switch (Identifier) { case 0x3B: /* Trailer */ /* @@ -140,16 +140,16 @@ Gif2Mem(BYTE *MemGif) GifMemoryStruct.GifApplicationExtension = gifApplication; GifMemoryStruct.GifCommentExtension = gifComment; GifMemoryStruct.GifGraphicControlExtension = gifGraphicControl; - + /* return the struct */ return GifMemoryStruct; case 0x2C: /* Image Descriptor */ /* * If there was no image descriptor before this increase image - * count. If an imagedescriptor was present, reset GCEflag + * count. If an imagedescriptor was present, reset GCEflag */ - if (GCEflag == 0) + if (GCEflag == 0) ImageCount++; else GCEflag = 0; @@ -180,17 +180,17 @@ Gif2Mem(BYTE *MemGif) printf("Out of memory!"); exit(-1); } - + if (ReadGifImageDesc(gifImageDesc[ImageCount-1], &MemGif) == -1) fputs("Error reading Image Descriptor information\n", stderr); - + /* Decompress the Image */ gifImageDesc[ImageCount-1]->Image = Decompress(gifImageDesc[ImageCount-1], gifHead); free(gifImageDesc[ImageCount-1]->GIFImage); - /* + /* * Convert the local palette into an HDF compatible palette In * case the local color table is present, it is written out as * the HDFPalette If it is absent the global table is written @@ -213,8 +213,8 @@ Gif2Mem(BYTE *MemGif) } break; - - case 0x21: /* Extension Block */ + + case 0x21: /* Extension Block */ Label = *MemGif++; switch (Label) { @@ -240,7 +240,7 @@ Gif2Mem(BYTE *MemGif) "Error reading Plain Text Extension information.\n"); break; - + case 0xFE: /* Comment Extension */ CommentCount++; @@ -251,19 +251,19 @@ Gif2Mem(BYTE *MemGif) printf("Out of memory!"); exit(-1); } - + if(!(gifComment[CommentCount - 1] = (GIFCOMMENT *)malloc(sizeof(GIFCOMMENT)))) { printf("Out of memory!"); exit(-1); } - + if (ReadGifComment(gifComment[CommentCount - 1], &MemGif)) fprintf(stderr, "Error reading Comment Extension information\n"); break; - + case 0xF9: /* Graphic Control Extension */ if (GCEflag == 0 ) ImageCount++; @@ -289,17 +289,17 @@ Gif2Mem(BYTE *MemGif) gifImageDesc[j] = NULL; } } - + if(!(gifGraphicControl[ImageCount-1] = (GIFGRAPHICCONTROL*)malloc(sizeof(GIFGRAPHICCONTROL)))) { printf("Out of memory!"); exit(-1); } - - + + if (ReadGifGraphicControl(gifGraphicControl[ImageCount-1], &MemGif)) fprintf(stderr, "Error reading Graphic Control Extension information\n"); - + if (!*MemGif++ == 0) fprintf(stderr, "Error reading Graphic Control Extension\n"); @@ -311,18 +311,18 @@ Gif2Mem(BYTE *MemGif) if (ApplicationCount > ApplicationArray) ApplicationArray = (ApplicationArray << 1) + 1; - + if (!(gifApplication = (GIFAPPLICATION **)realloc(gifApplication , sizeof(GIFAPPLICATION *) * ApplicationArray))) { printf("Out of memory!"); exit(-1); } - + if(!(gifApplication[ApplicationCount - 1] = (GIFAPPLICATION *)malloc(sizeof(GIFAPPLICATION)))) { printf("Out of memory!"); exit(-1); } - + if (ReadGifApplication(gifApplication[ApplicationCount - 1], &MemGif)) fprintf(stderr, "Error reading Application Extension information\n"); diff --git a/hl/tools/gif2h5/gifread.c b/hl/tools/gif2h5/gifread.c index b135617..5f4aba0 100644 --- a/hl/tools/gif2h5/gifread.c +++ b/hl/tools/gif2h5/gifread.c @@ -11,16 +11,16 @@ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include <stdio.h> -#include <stdlib.h> +#include <stdio.h> +#include <stdlib.h> -#include "gif.h" +#include "gif.h" int EndianOrder; static BYTE *ReadDataSubBlocks(BYTE **MemGif2, WORD *DSize); -WORD +WORD GetWord(BYTE *MemGif) { WORD w; @@ -39,7 +39,7 @@ GetWord(BYTE *MemGif) BYTE GetByte(BYTE *MemGif) -{ +{ return *MemGif; } @@ -69,7 +69,7 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */ printf("The file does not appear to be a valid GIF file.\n"); exit(-1); } - + for (i = 0 ; i < 7 ; i++) { GifHead->LSDDump[i] = *(*MemGif2)++; } @@ -84,7 +84,7 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */ /* Read the Global Color Table */ - /* + /* * There are some changes made here apart from just reading in the * global color table as would seem intuitively obvious. The colors * are stored in the bottom part of the palette as opposed to the top @@ -100,7 +100,7 @@ ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */ /* Check for a FILE stream error */ #if 0 if (ferror(FpGif)) - return -1; + return -1; #endif /* 0 */ return 0; /* No FILE stream error occured */ @@ -136,11 +136,11 @@ ReadGifImageDesc( for (i = 0 ; i < 9 ; i++) { GifImageDesc->GIDDump[i] = *(*MemGif2)++; } - + /* ** Get the relevant fields. I need ImageWidth and Height actively hence I have ** taken information from those fields. I intend to keep the GifImageDesc data - ** structure as it is so that anyone needing the rest of the fields can do so + ** structure as it is so that anyone needing the rest of the fields can do so ** quickly. */ @@ -160,10 +160,10 @@ ReadGifImageDesc( GifImageDesc->ImageHeight = (WORD) (GifImageDesc->GIDDump[6] & 0xFF); GifImageDesc->ImageHeight = ((WORD) (GifImageDesc->GIDDump[7] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08); - + } - + GifImageDesc->PackedField = GifImageDesc->GIDDump[8]; /* Interlace = GifImageDesc->PackedField & 0x20; */ @@ -193,7 +193,7 @@ ReadGifImageDesc( printf("Out of memory"); exit(-1); } - + TempPtr = GifImageDesc->GIFImage; do @@ -258,7 +258,7 @@ ReadGifPlainText( if (!(GifPlainText->PlainTextData = ReadDataSubBlocks(MemGif2 , &(GifPlainText->DataSize)))) return(1); - /* + /* GifPlainText->Terminator = 0; */ @@ -299,7 +299,7 @@ ReadGifApplication( /* GifApplication->Terminator = 0; */ - + /* Check for a FILE stream error */ /* if (ferror(FpGif)) @@ -325,13 +325,13 @@ ReadGifComment( BYTE **MemGif2 /* GIF image file input FILE stream */ ) { - + /* Read in the Plain Text data sub-blocks */ if (!(GifComment->CommentData = ReadDataSubBlocks(MemGif2 , &(GifComment->DataSize)))) return(1); GifComment->Terminator = 0; - + return(0); /* No FILE stream error occured */ } @@ -357,9 +357,9 @@ ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream int tempcount = 0; bufSize = 0; /* The output buffer is empty */ - + dataSize = *(*MemGif2)++; /* Get the size of the first sub-block */ - + /* Allocate initial data buffer */ if (!(ptr1 = ptr2 = (BYTE *) malloc((size_t)dataSize + 1))) { printf("Out of memory. Allocation of memory for data sub-blocks for\neither Comment, Plain Text or Application Extensions failed"); @@ -376,23 +376,23 @@ ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream #endif /* COMMENTED_OUT */ while (dataSize--) /* Read/write the Plain Text data */ *ptr1++ = *(*MemGif2)++; - + /* Check if there is another data sub-block */ if ((dataSize = *(*MemGif2)++) == 0) break; /* Block Terminator encountered */ - + /* Increase the buffer size to accomodate the next sub-block */ if (!(ptr1 = ptr2 = (BYTE *) realloc(ptr2, bufSize + dataSize + 1))) return((BYTE *) NULL); - + ptr1 += bufSize; /* Move pointer to the end of the data */ - - + + } *ptr1++ = '\0'; - + return(ptr2); /* Return a pointer to the sub-block data */ } diff --git a/hl/tools/gif2h5/hdf2gif.c b/hl/tools/gif2h5/hdf2gif.c index 51ec144..52e57f7 100644 --- a/hl/tools/gif2h5/hdf2gif.c +++ b/hl/tools/gif2h5/hdf2gif.c @@ -64,7 +64,7 @@ usage(void) FILE *fpGif = NULL; int main(int argc , char **argv) { - + hsize_t dim_sizes[2]; BYTE *Image; @@ -180,7 +180,7 @@ int main(int argc , char **argv) return -1; } - + /* we shall always have a palette - read hdf will see to that */ has_local_palette = true; @@ -188,12 +188,12 @@ int main(int argc , char **argv) idx = 0x0001; b = (BYTE *) &idx; EndianOrder = (b[0] ? 1:0); - + if (!(fpGif = fopen(GIFName , "wb"))) { printf("Error opening gif file for output. Aborting.\n"); return -1; } - + /* hardwire n_images to 1 for now. */ n_images = number_of_images; @@ -249,7 +249,7 @@ int main(int argc , char **argv) Blue[i] = GlobalPalette[i][2]; } } - + for (i = 0; i < 256; i++) { pc2nc[i] = r1[i] = g1[i] = b1[i] = 0; } @@ -288,7 +288,7 @@ int main(int argc , char **argv) #ifdef UNUSED CountDown = w * h; /* # of pixels we'll be doing */ #endif /* UNUSED */ - + if (BitsPerPixel <= 1) InitCodeSize = 2; else @@ -305,7 +305,7 @@ int main(int argc , char **argv) /* * If it is the first image we do all the header stuff that isn't - * required for the rest of the images. + * required for the rest of the images. */ if (idx == 0) { /* Write out the GIF header and logical screen descriptor */ @@ -379,7 +379,7 @@ int main(int argc , char **argv) i = hdfWriteGIF(fpGif , Image , 0 , (int)dim_sizes[0] , (int)dim_sizes[1] , r1, g1 , b1 , pc2nc , 256 , 8 , BitsPerPixel); - fputc(0x00, fpGif); + fputc(0x00, fpGif); free(Image); } diff --git a/hl/tools/gif2h5/hdfgifwr.c b/hl/tools/gif2h5/hdfgifwr.c index a18b81f..b1b5be5 100644 --- a/hl/tools/gif2h5/hdfgifwr.c +++ b/hl/tools/gif2h5/hdfgifwr.c @@ -13,13 +13,13 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * hdfgifwr.c - handles writing of GIF files. - * - * Contains: + * hdfgifwr.c - handles writing of GIF files. + * + * Contains: * hdfWriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, numcols, colorstyle, * comment) * - * Note: slightly brain-damaged, in that it'll only write non-interlaced + * Note: slightly brain-damaged, in that it'll only write non-interlaced * GIF files (in the interests of speed, or something) */ @@ -44,7 +44,7 @@ * James A. Woods (decvax!ihnp4!ames!jaw) * Joe Orost (decvax!vax135!petsd!joe) *****************************************************************/ - + #include <stdio.h> #include <stdlib.h> @@ -125,7 +125,7 @@ int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap, Background = 0; #endif /* UNUSED */ - for (i = 0; i < 256; i++) { + for (i = 0; i < 256; i++) { pc2nc[i] = pc2ncmap[i]; #ifdef UNUSED r1[i] = rmap[i]; @@ -325,7 +325,7 @@ probe: continue; } - if ((long)HashTabOf (i) >= 0) + if ((long)HashTabOf (i) >= 0) goto probe; nomatch: @@ -380,7 +380,7 @@ output(int code) cur_accum |= ((long)code << cur_bits); else cur_accum = code; - + cur_bits += n_bits; while( cur_bits >= 8 ) { @@ -406,7 +406,7 @@ output(int code) maxcode = MAXCODE(n_bits); } } - + if (code == EOFCode) { /* At EOF, write the rest of the buffer */ while( cur_bits > 0 ) { diff --git a/hl/tools/gif2h5/readhdf.c b/hl/tools/gif2h5/readhdf.c index 2720d4d..3fc454c 100644 --- a/hl/tools/gif2h5/readhdf.c +++ b/hl/tools/gif2h5/readhdf.c @@ -30,17 +30,17 @@ cleanup(BYTE *ptr) ** BYTE palette[256][3] - the corresponding palette ** hsize_t* image_size - the size of each dimension of the image ** -** Future Notes: -** The way readHDF works right now is that it expects the user +** Future Notes: +** The way readHDF works right now is that it expects the user ** to know the exact path to the HDF image. Thus it does not ** parse the HDF file looking for image datasets and corresponding -** palettes. Also it takes in the default palette for the image +** palettes. Also it takes in the default palette for the image ** specified, if the palette is missing, it makes a default greyscale ** palette and throws it in. ** */ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size, - CHAR *h5_file, CHAR *dset_name, CHAR *pal_name) + CHAR *h5_file, CHAR *dset_name, CHAR *pal_name) { hid_t fHfile; /* H5 file to open */ hid_t dspace; /* dataspace identifier for the the dataset */ @@ -130,7 +130,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size, pal_exist = 0; return -1; } - + pal_dtype = H5Dget_type(pal_set); if (dtype < 0) { fprintf(stderr , "Unable to open palette datatype\n"); @@ -151,7 +151,7 @@ int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size, pal_exist = 0; return -1; } - + /* get the dimension size of the palette. */ if (H5Sget_simple_extent_dims(pal_space , loc_pal_size , NULL) !=2 ) { fprintf(stderr , "Unable to get dimension info\n"); diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c index d343aae..8d7405e 100644 --- a/hl/tools/gif2h5/writehdf.c +++ b/hl/tools/gif2h5/writehdf.c @@ -49,11 +49,11 @@ static int write_text_attribute(hid_t dataset_id , const char *attr_name, attr_dataspace_id , H5P_DEFAULT); /* write out the attribute data */ - if (H5Awrite(attr_attr_id , attr_type_id , attr_value) < 0) + if (H5Awrite(attr_attr_id , attr_type_id , attr_value) < 0) return -1; /* close the attribute */ - if (H5Aclose(attr_attr_id) < 0) + if (H5Aclose(attr_attr_id) < 0) return -1; /* close the dataspace */ @@ -192,12 +192,12 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName) return -1; } - /* write the reference out */ + /* write the reference out */ if (H5Dwrite(ref_dataset_id , H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL , H5P_DEFAULT, &pal_ref) < 0) { fprintf(stderr , "Unable to write Palette Reference"); return -1; } - + /* close dataset */ if (H5Dclose(ref_dataset_id) < 0) { fprintf(stderr , "Unable to close palette dataset.\n"); @@ -271,7 +271,7 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName) /* This info is available at http://hdf.ncsa.uiuc.edu/HDF5/doc/ImageSpec.html */ /* The following attributes must be set for each image: ** --------------------------------------- - ** Attribute Name Value + ** Attribute Name Value ** CLASS IMAGE ** IMAGE_VERSION 1.0 ** IMAGE_SUBCLASS IMAGE_BITMAP @@ -324,7 +324,7 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName) ** Attribute: PALETTE ** Value : Reference to Palette *****************************************/ - + /**** MAKE SURE PALETTE EXISTS!!! ****/ if (gifHead.PackedField & 0x80) { /* global palette exists */ |