diff options
297 files changed, 7284 insertions, 7049 deletions
@@ -766,6 +766,8 @@ ./src/.indent.pro _DO_NOT_DISTRIBUTE_ ./src/hdf5.lnt _DO_NOT_DISTRIBUTE_ +./src/hdf5-win.lnt _DO_NOT_DISTRIBUTE_ +./src/hdf5-lin.lnt _DO_NOT_DISTRIBUTE_ ./src/Dependencies ./src/H5.c ./src/H5api_adpt.h @@ -1017,6 +1019,7 @@ ./test/gen_old_array.c _DO_NOT_DISTRIBUTE_ ./test/gen_new_array.c _DO_NOT_DISTRIBUTE_ ./test/gen_new_fill.c _DO_NOT_DISTRIBUTE_ +./test/gen_nullspace.c _DO_NOT_DISTRIBUTE_ ./test/gen_old_layout.c _DO_NOT_DISTRIBUTE_ ./test/gen_old_mtime.c _DO_NOT_DISTRIBUTE_ ./test/gen_new_mtime.c _DO_NOT_DISTRIBUTE_ diff --git a/bin/buildhdf5 b/bin/buildhdf5 index 45fc6de..72ecfb8 100755 --- a/bin/buildhdf5 +++ b/bin/buildhdf5 @@ -1,4 +1,17 @@ #!/bin/sh +## +## Copyright by the Board of Trustees of the University of Illinois. +## All rights reserved. +## +## This file is part of HDF5. The full HDF5 copyright notice, including +## terms governing use, modification, and redistribution, is contained in +## the files COPYING and Copyright.html. COPYING can be found at the root +## of the source code distribution tree; Copyright.html can be found at the +## root level of an installed copy of the electronic HDF5 document set and +## is linked from the top-level documents page. It can also be found at +## 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. +## # Build HDF5 library by doing configure, make, and tests. # Usage: See USAGE() # Programmer: Albert Cheng diff --git a/bin/dependencies b/bin/dependencies index b561128..513306c 100755 --- a/bin/dependencies +++ b/bin/dependencies @@ -14,7 +14,6 @@ # my $depend_file; my $new_depend_file; - my $srcdir; my $top_srcdir; my $top_builddir; @@ -1,4 +1,17 @@ #!/usr/bin/perl -w +## +## Copyright by the Board of Trustees of the University of Illinois. +## All rights reserved. +## +## This file is part of HDF5. The full HDF5 copyright notice, including +## terms governing use, modification, and redistribution, is contained in +## the files COPYING and Copyright.html. COPYING can be found at the root +## of the source code distribution tree; Copyright.html can be found at the +## root level of an installed copy of the electronic HDF5 document set and +## is linked from the top-level documents page. It can also be found at +## 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. +## require 5.003; $Source = ""; @@ -49,7 +62,6 @@ $Source = ""; "H5FD_mem_t" => "Mt", "off_t" => "o", "H5P_class_t" => "p", - "href_t" => "r", "H5R_type_t" => "Rt", "char*" => "s", "H5S_class_t" => "Sc", @@ -88,7 +100,6 @@ $Source = ""; "H5T_cdata_t**" => "x", "H5T_conv_t" => "x", "H5T_conv_except_func_t" => "x", - "H5T_overflow_t" => "x", "H5Z_func_t" => "x", "H5Z_filter_func_t" => "x", "size_t" => "z", diff --git a/c++/examples/chunks.cpp b/c++/examples/chunks.cpp index 3cc4e20..0efd95d 100644 --- a/c++/examples/chunks.cpp +++ b/c++/examples/chunks.cpp @@ -144,7 +144,7 @@ int main (void) /* * Define the column (hyperslab) to read. */ - hssize_t offset[2] = { 0, 2 }; + hsize_t offset[2] = { 0, 2 }; hsize_t count[2] = { 10, 1 }; int column[10]; // buffer for column to be read diff --git a/c++/examples/extend_ds.cpp b/c++/examples/extend_ds.cpp index c4409db..9c12304 100644 --- a/c++/examples/extend_ds.cpp +++ b/c++/examples/extend_ds.cpp @@ -95,7 +95,7 @@ int main (void) * Select a hyperslab. */ DataSpace fspace1 = dataset.getSpace (); - hssize_t offset[2]; + hsize_t offset[2]; offset[0] = 0; offset[1] = 0; hsize_t dims1[2] = { 3, 3}; /* data1 dimensions */ diff --git a/c++/examples/readdata.cpp b/c++/examples/readdata.cpp index 1797d27..7e5b195 100644 --- a/c++/examples/readdata.cpp +++ b/c++/examples/readdata.cpp @@ -128,7 +128,7 @@ int main (void) * Define hyperslab in the dataset; implicitly giving strike and * block NULL. */ - hssize_t offset[2]; // hyperslab offset in the file + hsize_t offset[2]; // hyperslab offset in the file hsize_t count[2]; // size of the hyperslab in the file offset[0] = 1; offset[1] = 2; @@ -148,7 +148,7 @@ int main (void) /* * Define memory hyperslab. */ - hssize_t offset_out[3]; // hyperslab offset in memory + hsize_t offset_out[3]; // hyperslab offset in memory hsize_t count_out[3]; // size of the hyperslab in memory offset_out[0] = 3; offset_out[1] = 0; diff --git a/c++/examples/writedata.cpp b/c++/examples/writedata.cpp index 8e0404c..0bed680 100644 --- a/c++/examples/writedata.cpp +++ b/c++/examples/writedata.cpp @@ -98,7 +98,7 @@ int main (void) * Select hyperslab for the dataset in the file, using 3x2 blocks, * (4,3) stride and (2,4) count starting at the position (0,1). */ - hssize_t start[2]; // Start of hyperslab + hsize_t start[2]; // Start of hyperslab hsize_t stride[2]; // Stride of hyperslab hsize_t count[2]; // Block count hsize_t block[2]; // Block sizes @@ -156,14 +156,14 @@ int main (void) /* * Select sequence of NPOINTS points in the file dataspace. */ - hssize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points + hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points from the file dataspace */ coord[0][0] = 0; coord[0][1] = 0; coord[1][0] = 3; coord[1][1] = 3; coord[2][0] = 3; coord[2][1] = 5; coord[3][0] = 5; coord[3][1] = 6; - fspace.selectElements( H5S_SELECT_SET, NPOINTS, (const hssize_t **)coord); + fspace.selectElements( H5S_SELECT_SET, NPOINTS, (const hsize_t **)coord); /* * Write new selection of points to the dataset. diff --git a/c++/src/H5Alltypes.h b/c++/src/H5Alltypes.h index 5cd9d29..17ae0d9 100644 --- a/c++/src/H5Alltypes.h +++ b/c++/src/H5Alltypes.h @@ -24,3 +24,5 @@ #include "H5FloatType.h" #include "H5StrType.h" #include "H5CompType.h" +#include "H5ArrayType.h" +#include "H5VarLenType.h" diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp index f95c32f..738506e 100644 --- a/c++/src/H5CompType.cpp +++ b/c++/src/H5CompType.cpp @@ -113,7 +113,7 @@ int CompType::getNmembers() const ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -string CompType::getMemberName( int member_num ) const +string CompType::getMemberName( unsigned member_num ) const { char* member_name_C = H5Tget_member_name( id, member_num ); if( member_name_C == NULL ) // NULL means failure @@ -169,7 +169,7 @@ int CompType::getMemberIndex(const string& name) const // Note that byte offset being returned as 0 doesn't indicate // a failure. (According to Quincey) //-------------------------------------------------------------------------- -size_t CompType::getMemberOffset( int member_num ) const +size_t CompType::getMemberOffset( unsigned member_num ) const { size_t offset = H5Tget_member_offset( id, member_num ); return( offset ); @@ -191,7 +191,7 @@ int CompType::getMemberDims( int member_num, size_t* dims, int* perm ) const ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -H5T_class_t CompType::getMemberClass( int member_num ) const +H5T_class_t CompType::getMemberClass( unsigned member_num ) const { // get the member datatype first hid_t member_type_id = H5Tget_member_type( id, member_num ); @@ -215,7 +215,7 @@ H5T_class_t CompType::getMemberClass( int member_num ) const // of the specified member. It provides the id to construct appropriate // sub-types in the functions getMemberXxxType below, where Xxx indicates // the sub-types. -hid_t CompType::p_get_member_type(int member_num) const +hid_t CompType::p_get_member_type(unsigned member_num) const { // get the id of the specified member first hid_t member_type_id = H5Tget_member_type( id, member_num ); @@ -325,27 +325,27 @@ StrType CompType::getMemberStrType( int member_num ) const May, 2004: These should be reconsidered to provide more convenience. // Returns the datatype of the specified member in this compound datatype. // Several overloading of getMemberType are for different datatypes -void CompType::getMemberType( int member_num, EnumType& enumtype ) const +void CompType::getMemberType( unsigned member_num, EnumType& enumtype ) const { p_get_member_type(member_num, enumtype); } -void CompType::getMemberType( int member_num, CompType& comptype ) const +void CompType::getMemberType( unsigned member_num, CompType& comptype ) const { p_get_member_type(member_num, comptype); } -void CompType::getMemberType( int member_num, IntType& inttype ) const +void CompType::getMemberType( unsigned member_num, IntType& inttype ) const { p_get_member_type(member_num, inttype); } -void CompType::getMemberType( int member_num, FloatType& floatype ) const +void CompType::getMemberType( unsigned member_num, FloatType& floatype ) const { p_get_member_type(member_num, floatype); } -void CompType::getMemberType( int member_num, StrType& strtype ) const +void CompType::getMemberType( unsigned member_num, StrType& strtype ) const { p_get_member_type(member_num, strtype); } diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index 0c530b1..bc96969 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -34,7 +34,7 @@ class H5_DLLCPP CompType : public DataType { // Returns the type class of the specified member of this compound // datatype. It provides to the user a way of knowing what type // to create another datatype of the same class - H5T_class_t getMemberClass( int member_num ) const; + H5T_class_t getMemberClass( unsigned member_num ) const; // Returns the dimensionality of the specified member. int getMemberDims( int member_num, size_t* dims, int* perm ) const; @@ -44,10 +44,10 @@ class H5_DLLCPP CompType : public DataType { int getMemberIndex(const string& name) const; // Returns the offset of a member of this compound datatype. - size_t getMemberOffset( int memb_no ) const; + size_t getMemberOffset( unsigned memb_no ) const; // Returns the name of a member of this compound datatype. - string getMemberName( int member_num ) const; + string getMemberName( unsigned member_num ) const; // Returns the compound datatype of the specified member in // this compound datatype. @@ -97,7 +97,7 @@ class H5_DLLCPP CompType : public DataType { private: // Contains common code that is used by the member functions // getMemberXxxType - hid_t p_get_member_type(int member_num) const; + hid_t p_get_member_type(unsigned member_num) const; }; #ifndef H5_NO_NAMESPACE } diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 548e280..f5584a6 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -417,7 +417,7 @@ void DataSpace::getSelectElemPointlist ( hsize_t startpoint, hsize_t numpoints, /// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5S.html#Dataspace-SelectBounds // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSpace::getSelectBounds ( hssize_t* start, hssize_t* end ) const +void DataSpace::getSelectBounds ( hsize_t* start, hsize_t* end ) const { herr_t ret_value = H5Sget_select_bounds( id, start, end ); if( ret_value < 0 ) @@ -443,7 +443,7 @@ void DataSpace::getSelectBounds ( hssize_t* start, hssize_t* end ) const /// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5S.html#Dataspace-SelectElements // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSpace::selectElements ( H5S_seloper_t op, const size_t num_elements, const hssize_t *coord[ ] ) const +void DataSpace::selectElements ( H5S_seloper_t op, const size_t num_elements, const hsize_t *coord[ ] ) const { herr_t ret_value; ret_value = H5Sselect_elements( id, op, num_elements, coord ); @@ -523,7 +523,7 @@ bool DataSpace::selectValid () const /// http://hdf.ncsa.uiuc.edu/HDF5/doc/RM_H5S.html#Dataspace-SelectHyperslab // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DataSpace::selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hssize_t *start, const hsize_t *stride, const hsize_t *block ) const +void DataSpace::selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride, const hsize_t *block ) const { herr_t ret_value; ret_value = H5Sselect_hyperslab( id, op, start, stride, count, block ); diff --git a/c++/src/H5DataSpace.h b/c++/src/H5DataSpace.h index 01fb40d..1edaabf 100644 --- a/c++/src/H5DataSpace.h +++ b/c++/src/H5DataSpace.h @@ -41,7 +41,7 @@ class H5_DLLCPP DataSpace : public IdComponent { void extentCopy( DataSpace& dest_space ) const; // Gets the bounding box containing the current selection. - void getSelectBounds( hssize_t* start, hssize_t* end ) const; + void getSelectBounds( hsize_t* start, hsize_t* end ) const; // Gets the number of element points in the current selection. hssize_t getSelectElemNpoints() const; @@ -82,10 +82,10 @@ class H5_DLLCPP DataSpace : public IdComponent { // Selects array elements to be included in the selection for // this dataspace. - void selectElements( H5S_seloper_t op, const size_t num_elements, const hssize_t *coord[ ] ) const; + void selectElements( H5S_seloper_t op, const size_t num_elements, const hsize_t *coord[ ] ) const; // Selects a hyperslab region to add to the current selected region. - void selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hssize_t *start, const hsize_t *stride = NULL, const hsize_t *block = NULL ) const; + void selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride = NULL, const hsize_t *block = NULL ) const; // Resets the selection region to include no elements. void selectNone() const; diff --git a/c++/src/H5DataType.h b/c++/src/H5DataType.h index fe56cb1..b2f7392 100644 --- a/c++/src/H5DataType.h +++ b/c++/src/H5DataType.h @@ -106,6 +106,7 @@ class H5_DLLCPP DataType : public H5Object { // Default constructor DataType(); + // Destructor: properly terminates access to this datatype. virtual ~DataType(); protected: diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index ae98a79..8379b57 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -357,6 +357,7 @@ H5Z_filter_t DSetCreatPropList::getFilter(int filter_number, unsigned int &flags ///\param name - OUT: Name of the filter ///\param filter_config - OUT: Flags indicating whether filter can encode/decode ///\exception H5::PropListIException +// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts, unsigned int* cd_values, size_t namelen, char name[], @@ -622,7 +623,7 @@ int DSetCreatPropList::getExternalCount() const /// will not be returned. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void DSetCreatPropList::getExternal( int idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const +void DSetCreatPropList::getExternal( unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const { herr_t ret_value = H5Pget_external( id, idx, name_size, name, &offset, &size ); if( ret_value < 0 ) diff --git a/c++/src/H5DcreatProp.h b/c++/src/H5DcreatProp.h index 15a85e3..d1b5fb5 100644 --- a/c++/src/H5DcreatProp.h +++ b/c++/src/H5DcreatProp.h @@ -42,7 +42,7 @@ class H5_DLLCPP DSetCreatPropList : public PropList { void setChunk( int ndims, const hsize_t* dim ) const; // Returns information about an external file. - void getExternal( int idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const; + void getExternal( unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const; // Returns the number of external files for a dataset. int getExternalCount() const; diff --git a/c++/src/H5EnumType.cpp b/c++/src/H5EnumType.cpp index 2872c22..2f04d1e 100644 --- a/c++/src/H5EnumType.cpp +++ b/c++/src/H5EnumType.cpp @@ -255,7 +255,7 @@ int EnumType::getNmembers() const ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -void EnumType::getMemberValue( int memb_no, void *value ) const +void EnumType::getMemberValue( unsigned memb_no, void *value ) const { // Call C routine H5Tget_member_value to get the datatype member's value hid_t ret_value = H5Tget_member_value( id, memb_no, value ); diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h index 4cb6cbd..f88b337 100644 --- a/c++/src/H5EnumType.h +++ b/c++/src/H5EnumType.h @@ -41,7 +41,7 @@ class H5_DLLCPP EnumType : public DataType { int getMemberIndex(const string& name) const; // Returns the value of an enumeration datatype member - void getMemberValue( int memb_no, void *value ) const; + void getMemberValue( unsigned memb_no, void *value ) const; // Inserts a new member to this enumeration type. void insert( const char* name, void *value ) const; diff --git a/c++/src/H5FcreatProp.h b/c++/src/H5FcreatProp.h index 7a11ede..aa955d5 100644 --- a/c++/src/H5FcreatProp.h +++ b/c++/src/H5FcreatProp.h @@ -23,6 +23,7 @@ namespace H5 { // class for file access properties class H5_DLLCPP FileCreatPropList : public PropList { public: + // Default file creation property list. static const FileCreatPropList DEFAULT; // Retrieves version information for various parts of a file. @@ -34,27 +35,27 @@ class H5_DLLCPP FileCreatPropList : public PropList { // Gets the size of a user block in this file creation property list. hsize_t getUserblock() const; - // Sets file size-of addresses and sizes. - void setSizes( size_t sizeof_addr = 4, size_t sizeof_size = 4 ) const; - // Retrieves the size-of address and size quantities stored in a // file according to this file creation property list. void getSizes( size_t& sizeof_addr, size_t& sizeof_size ) const; - // Sets the size of parameters used to control the symbol table nodes. - void setSymk( unsigned int_nodes_k, unsigned leaf_nodes_k ) const; + // Sets file size-of addresses and sizes. + void setSizes( size_t sizeof_addr = 4, size_t sizeof_size = 4 ) const; // Retrieves the size of the symbol table B-tree 1/2 rank and the // symbol table leaf node 1/2 size. void getSymk( unsigned& int_nodes_k, unsigned& leaf_nodes_k ) const; - // Sets the size of parameter used to control the B-trees for - // indexing chunked datasets. - void setIstorek( unsigned ik ) const; + // Sets the size of parameters used to control the symbol table nodes. + void setSymk( unsigned int_nodes_k, unsigned leaf_nodes_k ) const; // Returns the 1/2 rank of an indexed storage B-tree. unsigned getIstorek() const; + // Sets the size of parameter used to control the B-trees for + // indexing chunked datasets. + void setIstorek( unsigned ik ) const; + // Creates a file create property list. FileCreatPropList(); diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp index c8af186..ff9a7d1 100644 --- a/c++/src/H5Library.cpp +++ b/c++/src/H5Library.cpp @@ -14,7 +14,7 @@ #include <string> -#include "H5CppDoc.h" // included only for Doxygen to generate part of RM +#include "H5CppDoc.h" // included only for Doxygen to generate part of RM #include "H5Include.h" #include "H5Exception.h" #include "H5Library.h" @@ -60,7 +60,7 @@ void H5Library::close() //-------------------------------------------------------------------------- // Function: H5Library::dontAtExit -///\brief Instructs library not to install \c atexit cleanup routine. +///\brief Instructs library not to install \c atexit cleanup routine ///\exception H5::LibraryIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- @@ -95,9 +95,9 @@ void H5Library::getLibVersion( unsigned& majnum, unsigned& minnum, unsigned& rel // Function: H5Library::checkVersion ///\brief Verifies that the arguments match the version numbers /// compiled into the library -///\param majnum - OUT: Major version of the library -///\param minnum - OUT: Minor version of the library -///\param relnum - OUT: Release number of the library +///\param majnum - IN: Major version of the library +///\param minnum - IN: Minor version of the library +///\param relnum - IN: Release number of the library ///\exception H5::LibraryIException ///\par Description /// For information about library version, please refer to diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index c158844..33d086d 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -33,7 +33,6 @@ #endif #include "testhdf5.h" -#include "h5test.h" #include "H5Cpp.h" #ifndef H5_NO_NAMESPACE @@ -603,7 +602,7 @@ test_compression(H5File& file) TESTING("compression (partial I/O)"); const hsize_t hs_size[2] = {4, 50}; - const hssize_t hs_offset[2] = {7, 30}; + const hsize_t hs_offset[2] = {7, 30}; for (i = 0; i < hs_size[0]; i++) { for (j = 0; j < hs_size[1]; j++) { points[hs_offset[0]+i][hs_offset[1]+j] = rand (); diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index 020bab0..8bb0d85 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -93,4 +93,3 @@ void issue_fail_msg(const char* where, int line, const char* file_name) } } - diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index d67c459..93ba1b9 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -46,7 +46,7 @@ template <class Type1, class Type2> cerr << "*** UNEXPECTED VALUE from " << where << " should be " << value << ", but is " << x << " at line " << line << " in " << file_name << endl; - H5Eprint (stdout); + H5Eprint (stderr); } } diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 1e859bc..9e3322f 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -118,7 +118,7 @@ test_file_create(void) */ try { file1 = new H5File( FILE1, H5F_ACC_EXCL ); // should throw E - verify_val(file1->getId(), FAIL, "H5File constructor", __LINE__, __FILE__); + verify_val(file1->getId(), FAIL, "H5File constructor", __LINE__, __FILE__); } catch( FileIException E ) {} // do nothing, FAIL expected @@ -131,7 +131,7 @@ test_file_create(void) */ try { H5File file2 (FILE1, H5F_ACC_TRUNC); // should throw E - verify_val(file2.getId(), FAIL, "H5File constructor", __LINE__, __FILE__); + verify_val(file2.getId(), FAIL, "H5File constructor", __LINE__, __FILE__); } catch( FileIException E ) {} // do nothing, FAIL expected @@ -141,7 +141,7 @@ test_file_create(void) */ try { H5File file3 (FILE1, H5F_ACC_EXCL); // should throw E - verify_val(file3.getId(), FAIL, "H5File constructor", __LINE__, __FILE__); + verify_val(file3.getId(), FAIL, "H5File constructor", __LINE__, __FILE__); } catch( FileIException E ) {} // do nothing, FAIL expected @@ -149,12 +149,12 @@ test_file_create(void) FileCreatPropList tmpl1 = file1->getCreatePlist(); hsize_t ublock = tmpl1.getUserblock(); - verify_val(ublock, F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); + verify_val(ublock, F1_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); size_t parm1, parm2; /*file-creation parameters */ tmpl1.getSizes( parm1, parm2); - verify_val(parm1, F1_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); - verify_val(parm2, F1_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + verify_val(parm1, F1_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + verify_val(parm2, F1_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); unsigned iparm1,iparm2; /*file-creation parameters */ tmpl1.getSymk( iparm1, iparm2); @@ -198,12 +198,12 @@ test_file_create(void) /* Get the file-creation parameters */ hsize_t ublock = tmpl1->getUserblock(); - verify_val(ublock, F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); + verify_val(ublock, F2_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); size_t parm1, parm2; /*file-creation parameters */ tmpl1->getSizes( parm1, parm2); - verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); - verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + verify_val(parm1, F2_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + verify_val(parm2, F2_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); unsigned iparm1,iparm2; /*file-creation parameters */ tmpl1->getSymk( iparm1, iparm2); @@ -231,15 +231,15 @@ test_file_create(void) /* Get the file-creation parameters */ ublock = tmpl1->getUserblock(); - verify_val(ublock, F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); + verify_val(ublock, F3_USERBLOCK_SIZE, "FileCreatPropList::getUserblock", __LINE__, __FILE__); tmpl1->getSizes( parm1, parm2); - verify_val(parm1, F3_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); - verify_val(parm2, F3_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + verify_val(parm1, F3_OFFSET_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); + verify_val(parm2, F3_LENGTH_SIZE, "FileCreatPropList::getSizes", __LINE__, __FILE__); tmpl1->getSymk( iparm1, iparm2); - verify_val(iparm1, F3_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); - verify_val(iparm2, F3_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); + verify_val(iparm1, F3_SYM_INTERN_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); + verify_val(iparm2, F3_SYM_LEAF_K, "FileCreatPropList::getSymk", __LINE__, __FILE__); /* Dynamically release file-creation template */ delete tmpl1; @@ -394,12 +394,14 @@ test_file_name() // Get file name from the file instance. file_name = file4.getFileName(); + verify_val(file_name, FILE4, "H5File::getFileName", __LINE__, __FILE__); /* Create a group in the root group */ Group group(file4.createGroup(GROUPNAME, 0)); /* Get and verify file name */ file_name = group.getFileName(); + verify_val(file_name, FILE4, "Group::getFileName", __LINE__, __FILE__); /* Create the data space */ hsize_t dims[RANK] = {NX, NY}; @@ -410,12 +412,14 @@ test_file_name() /* Get and verify file name */ file_name = dataset.getFileName(); + verify_val(file_name, FILE4, "DataSet::getFileName", __LINE__, __FILE__); /* Create an attribute for the dataset */ Attribute attr(dataset.createAttribute(ATTRNAME, PredType::NATIVE_INT, space)); /* Get and verify file name */ file_name = attr.getFileName(); + verify_val(file_name, FILE4, "Attribute::getFileName", __LINE__, __FILE__); /* Create a compound datatype */ CompType comp_type (sizeof(s1_t)); @@ -429,6 +433,7 @@ test_file_name() /* Get and verify file name */ comp_type.getFileName(); + verify_val(file_name, FILE4, "CompType::getFileName", __LINE__, __FILE__); } // end of try block catch (Exception E) { issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__); diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index dacd1ef..afa7713 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -27,8 +27,8 @@ #include <iostream> #endif -#include "H5Cpp.h" #include "testhdf5.h" +#include "H5Cpp.h" #include "h5cpputil.h" #ifndef H5_NO_NAMESPACE @@ -159,7 +159,7 @@ test_h5s_basic(void) } // end of first try block catch( DataSpaceIException error ) { - issue_fail_msg(error.getCFuncName(), __LINE__, __FILE__); + issue_fail_msg(error.getCFuncName(), __LINE__, __FILE__); } /* @@ -229,8 +229,8 @@ test_h5s_basic(void) try { sid3.setExtentSimple( SPACE1_RANK, dims1 ); - // but didn't, issue an error message - issue_fail_msg("DataSpace::setExtentSimple", __LINE__, __FILE__); + // but didn't, issue an error message + issue_fail_msg("DataSpace::setExtentSimple", __LINE__, __FILE__); } catch (DataSpaceIException error) {} // do nothing, FAIL expected } /* test_h5s_basic() */ diff --git a/config/dec-flags b/config/dec-flags index c228e60..59ae66f 100644 --- a/config/dec-flags +++ b/config/dec-flags @@ -66,15 +66,15 @@ case "$cc_vendor-$cc_version" in DEC-V6.*) # Production - PROD_CFLAGS="-std1 -verbose -warnprotos -ieee -misalign -O4 -fp_reorder -readonly_strings -inline speed" + PROD_CFLAGS="-c99 -verbose -warnprotos -ieee -misalign -O4 -fp_reorder -readonly_strings -inline speed" PROD_CPPFLAGS="-D_INTRINSICS -D_INLINE_INTRINSICS" # Debug - DEBUG_CFLAGS="-g -std1 -verbose -warnprotos -ieee -misalign" + DEBUG_CFLAGS="-g -c99 -verbose -warnprotos -ieee -misalign" DEBUG_CPPFLAGS= # Profile - PROFILE_CFLAGS="-pg -std1 -verbose -warnprotos -ieee -misalign" + PROFILE_CFLAGS="-pg -c99 -verbose -warnprotos -ieee -misalign" PROFILE_CPPFLAGS= # Flags are set diff --git a/config/ia64-linux-gnu b/config/ia64-linux-gnu index 60b67aa..41cdf97 100644 --- a/config/ia64-linux-gnu +++ b/config/ia64-linux-gnu @@ -13,11 +13,7 @@ fi #---------------------------------------------------------------------------- # Compiler flags. The CPPFLAGS values should not include package debug # flags like `-DH5G_DEBUG' since these are added with the -# `--enable-debug' switch of configure. For ecc 7.1, because of the -# overlapping definitions of int64_t(starting from int8_t) in sys/types.h -# and stdint.h, we added -D__GNUC__ to CFLAGS. -# This problem is no longer true and the -D_GNUC__ actually caused failure. -# So it is removed. +# `--enable-debug' switch of configure. case $CC_BASENAME in ecc|icc) diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 0758a4b..2167c46 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -12,7 +12,7 @@ if test -z "$CC"; then CC_BASENAME=gcc fi -# Figure out GNU compiler flags +# Figure out GNU C compiler flags . $srcdir/config/gnu-flags # Figure out PGI C compiler flags @@ -911,10 +911,6 @@ ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} @@ -927,6 +923,10 @@ ac_env_CXXCPP_set=${CXXCPP+set} ac_env_CXXCPP_value=$CXXCPP ac_cv_env_CXXCPP_set=${CXXCPP+set} ac_cv_env_CXXCPP_value=$CXXCPP +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP # # Report the --help message. @@ -1008,14 +1008,14 @@ Optional Features: (including versions of GCC before 2.8.0). Disabling the feature causes dataset sizes to be restricted to the size of core memory, or 'size_t'. - --enable-shared=PKGS build shared libraries default=yes - --enable-static=PKGS build static libraries default=yes - --enable-fast-install=PKGS optimize for fast installation default=yes - --disable-libtool-lock avoid locking (might break parallel builds) --enable-fortran Compile the Fortran interface [default=no] --enable-cxx Compile the C++ interface [default=no] --enable-static-exec Build only statically linked executables [default=no] + --enable-shared=PKGS build shared libraries default=yes + --enable-static=PKGS build static libraries default=yes + --enable-fast-install=PKGS optimize for fast installation default=yes + --disable-libtool-lock avoid locking (might break parallel builds) --enable-production Determines how to run the compiler. --enable-linux-lfs Enable support for large (64-bit) files on Linux. [default=check] @@ -1076,10 +1076,10 @@ Some influential environment variables: nonstandard directory <lib dir> CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> - CPP C preprocessor CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor + CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -2457,6 +2457,1226 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu CC_BASENAME="`echo $CC | cut -f1 -d' ' | xargs basename 2>/dev/null`" + + HDF5_INTERFACES="" +echo "$as_me:$LINENO: checking if Fortran interface enabled" >&5 +echo $ECHO_N "checking if Fortran interface enabled... $ECHO_C" >&6 +# Check whether --enable-fortran or --disable-fortran was given. +if test "${enable_fortran+set}" = set; then + enableval="$enable_fortran" + HDF_FORTRAN=$enableval +fi; + +if test "X$HDF_FORTRAN" = "Xyes"; then + echo "yes" + + HDF5_INTERFACES="$HDF5_INTERFACES fortran" + + + + + + + + + + + + + + for ac_prog in f90 pgf90 xlf90 f95 g95 xlf95 efc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_F9X+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$F9X"; then + ac_cv_prog_F9X="$F9X" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_F9X="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +F9X=$ac_cv_prog_F9X +if test -n "$F9X"; then + echo "$as_me:$LINENO: result: $F9X" >&5 +echo "${ECHO_T}$F9X" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$F9X" && break +done + +test -z "$F9X" && { { echo "$as_me:$LINENO: error: no acceptable f9X compiler found in \$PATH" >&5 +echo "$as_me: error: no acceptable f9X compiler found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + + +echo "$as_me:$LINENO: checking whether the Fortran 9X compiler ($F9X $FFLAGS $LDFLAGS) works" >&5 +echo $ECHO_N "checking whether the Fortran 9X compiler ($F9X $FFLAGS $LDFLAGS) works... $ECHO_C" >&6 + + +ac_ext=f90 +ac_compile='${F9X-f90} -c $FFLAGS conftest.$ac_ext 1>&5' +ac_link='${F9X-f90} -o conftest${ac_exeext} $FFLAGS conftest.$ac_ext $LDFLAGS $LIBS 1>&5' +cross_compiling=$ac_cv_prog_f9x_cross + + +cat > conftest.$ac_ext << EOF + + program conftest + end + +EOF +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext}; then + ac_cv_prog_f9x_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_f9x_cross=no + else + ac_cv_prog_f9x_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_f9x_works=no +fi +rm -fr conftest* + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +echo "$as_me:$LINENO: result: $ac_cv_prog_f9x_works" >&5 +echo "${ECHO_T}$ac_cv_prog_f9x_works" >&6 +if test $ac_cv_prog_f9x_works = no; then + { { echo "$as_me:$LINENO: error: installation or configuration problem: Fortran 9X compiler cannot create executables." >&5 +echo "$as_me: error: installation or configuration problem: Fortran 9X compiler cannot create executables." >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: checking whether the Fortran 9X compiler ($F9X $FFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo $ECHO_N "checking whether the Fortran 9X compiler ($F9X $FFLAGS $LDFLAGS) is a cross-compiler... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $ac_cv_prog_f9x_cross" >&5 +echo "${ECHO_T}$ac_cv_prog_f9x_cross" >&6 +cross_compiling=$ac_cv_prog_f9x_cross + +echo "$as_me:$LINENO: checking whether we are using GNU Fortran 95" >&5 +echo $ECHO_N "checking whether we are using GNU Fortran 95... $ECHO_C" >&6 +if test "${ac_cv_prog_g9x+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat > conftest.fpp <<EOF +#ifdef __GNUC__ + yes +#endif +EOF +if { ac_try='$F9X -E conftest.fpp' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_g9x=yes +else + ac_cv_prog_g9x=no +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_g9x" >&5 +echo "${ECHO_T}$ac_cv_prog_g9x" >&6 + +if test $ac_cv_prog_g9x = yes; then + G9X=yes + ac_test_FFLAGS="${FFLAGS+set}" + ac_save_FFLAGS="$FFLAGS" + FFLAGS= + echo "$as_me:$LINENO: checking whether $F9X accepts -g" >&5 +echo $ECHO_N "checking whether $F9X accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_f9x_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat > conftest.f << EOF + program conftest + end +EOF +if test -z "`$F9X -g -c conftest.f 2>&1`"; then + ac_cv_prog_f9x_g=yes +else + ac_cv_prog_f9x_g=no +fi +rm -f conftest* + +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_f9x_g" >&5 +echo "${ECHO_T}$ac_cv_prog_f9x_g" >&6 + if test "$ac_test_FFLAGS" = set; then + FFLAGS="$ac_save_FFLAGS" + elif test $ac_cv_prog_f9x_g = yes; then + FFLAGS="-g -O2" + else + FFLAGS="-O2" + fi +else + G9X= + test "${FFLAGS+set}" = set || FFLAGS="-g" +fi + + echo "$as_me:$LINENO: checking what $F9X does with modules" >&5 +echo $ECHO_N "checking what $F9X does with modules... $ECHO_C" >&6 + + +ac_ext=f90 +ac_compile='${F9X-f90} -c $FFLAGS conftest.$ac_ext 1>&5' +ac_link='${F9X-f90} -o conftest${ac_exeext} $FFLAGS conftest.$ac_ext $LDFLAGS $LIBS 1>&5' +cross_compiling=$ac_cv_prog_f9x_cross + + +test -d conftestdir || mkdir conftestdir +cd conftestdir +rm -rf * + +cat >conftest.$ac_ext <<EOF + module module + integer foo + end module module +EOF + +eval $ac_compile +modfiles="" +F9XMODEXT="" + +for f in conftest.o module.mod MODULE.mod module.M MODULE.M; do + if test -f "$f" ; then + modfiles="$f" + + case "$f" in + *.o) F9XMODEXT="o" ;; + *.mod) F9XMODEXT="mod" ;; + *.M) F9XMODEXT="M" ;; + esac + fi +done + +echo $modfiles 6>&1 +if test "$modfiles" = file.o; then + echo $ac_n "checking whether $F9X -em is saner""... $ac_c" 1>&6 + OLD_FFLAGS=$FFLAGS + FFLAGS="$FFLAGS -em" + eval $ac_compile + modfiles="" + for f in file.o module.mod MODULE.mod module.M MODULE.M; do + test -f $f && modfiles="$f" + done + if test "$modfiles" = "file.o"; then + FFLAGS=$OLD_FFLAGS + echo no 6>&1 + else + echo yes 6>&1 + fi +fi +cd .. + +echo "$as_me:$LINENO: checking how $F9X finds modules" >&5 +echo $ECHO_N "checking how $F9X finds modules... $ECHO_C" >&6 + +for flag in "-I" "-M" "-p"; do + cat >conftest.$ac_ext <<EOF + program conftest + use module + end program conftest +EOF + + ac_compile='${F9X-f90} $FFLAGS ${flag}conftestdir -c conftest.$ac_ext 1>&5' + + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + F9XMODFLAG=$flag + break + fi +done + +if test -n "$F9XMODFLAG"; then + echo $F9XMODFLAG 1>&6 + FFLAGS="$F9XMODFLAG. $F9XMODFLAG../src $F9XMODFLAG../../../fortran/src $FFLAGS" +else + echo unknown 1>&6 +fi + + +rm -rf conftest* + + + ac_ext=f90 +ac_compile='${F9X-f90} -c $FFLAGS conftest.$ac_ext 1>&5' +ac_link='${F9X-f90} -o conftest${ac_exeext} $FFLAGS conftest.$ac_ext $LDFLAGS $LIBS 1>&5' +cross_compiling=$ac_cv_prog_f9x_cross + + + FFLAGS_saved=$FFLAGS + FFLAGS="$FFLAGS -I." + + echo "$as_me:$LINENO: checking if compiler supports -I. option" >&5 +echo $ECHO_N "checking if compiler supports -I. option... $ECHO_C" >&6 + + +ac_ext=f90 +ac_compile='${F9X-f90} -c $FFLAGS conftest.$ac_ext 1>&5' +ac_link='${F9X-f90} -o conftest${ac_exeext} $FFLAGS conftest.$ac_ext $LDFLAGS $LIBS 1>&5' +cross_compiling=$ac_cv_prog_f9x_cross + + +test -d conftestdir || mkdir conftestdir +cd conftestdir +rm -rf * + +cat >conftest.$ac_ext <<EOF + + program conftest + end + +EOF + +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + : + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + : + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + FFLAGS="$FFLAGS_saved" +fi +cd .. +rm -rf conftest* + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +else + echo "no" +fi + +echo "$as_me:$LINENO: checking if c++ interface enabled" >&5 +echo $ECHO_N "checking if c++ interface enabled... $ECHO_C" >&6 +# Check whether --enable-cxx or --disable-cxx was given. +if test "${enable_cxx+set}" = set; then + enableval="$enable_cxx" + HDF_CXX=$enableval +fi; + +if test "X$HDF_CXX" = "Xyes"; then + echo "yes" + HDF5_INTERFACES="$HDF5_INTERFACES c++" + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C++ compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cxx_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <stdlib.h> +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +$ac_declaration +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 +echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 +if test -z "$CXXCPP"; then + if test "${ac_cv_prog_CXXCPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <assert.h> + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +echo "$as_me:$LINENO: result: $CXXCPP" >&5 +echo "${ECHO_T}$CXXCPP" >&6 +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <assert.h> + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_cxx_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&5 +echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + echo "$as_me:$LINENO: checking if $CXX needs old style header files in includes" >&5 +echo $ECHO_N "checking if $CXX needs old style header files in includes... $ECHO_C" >&6 + +if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#include <iostream> + +int main(void) { return 0; } + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo no + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + + echo yes + CXXFLAGS="${CXXFLAGS} -DOLD_HEADER_FILENAME" + +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + echo "$as_me:$LINENO: checking if $CXX can handle namespaces" >&5 +echo $ECHO_N "checking if $CXX can handle namespaces... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +namespace H5 { +int fnord; +} + +int main(void) { + using namespace H5; + fnord = 37; + return 0; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo yes + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + + echo no + CXXFLAGS="${CXXFLAGS} -DH5_NO_NAMESPACE" + +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + echo "$as_me:$LINENO: checking if $CXX supports std" >&5 +echo $ECHO_N "checking if $CXX supports std... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +#include <string> + +using namespace std; + +int main(void) { + string myString("testing namespace std"); + return 0; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo yes + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + + echo no + CXXFLAGS="${CXXFLAGS} -DH5_NO_STD" + +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + echo "$as_me:$LINENO: checking if $CXX supports bool types" >&5 +echo $ECHO_N "checking if $CXX supports bool types... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +int main(void) { + bool flag; + return 0; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo yes + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + + echo no + CXXFLAGS="${CXXFLAGS} -DBOOL_NOTDEFINED" + +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + echo "$as_me:$LINENO: checking if $CXX can handle static cast" >&5 +echo $ECHO_N "checking if $CXX can handle static cast... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +int main(void) { + float test_float; + int test_int; + test_float = 37.0; + test_int = static_cast <int> (test_float); + return 0; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo yes + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +( exit $ac_status ) + + echo no + CXXFLAGS="${CXXFLAGS} -DNO_STATIC_CAST" + +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +else + echo "no" +fi + +echo "$as_me:$LINENO: checking if should build only statically linked executables" >&5 +echo $ECHO_N "checking if should build only statically linked executables... $ECHO_C" >&6 +# Check whether --enable-static_exec or --disable-static_exec was given. +if test "${enable_static_exec+set}" = set; then + enableval="$enable_static_exec" + STATIC_EXEC=$enableval +fi; + +if test "X$STATIC_EXEC" = "Xyes"; then + echo "yes" + LT_STATIC_EXEC="-all-static" +else + echo "no" + LT_STATIC_EXEC="" +fi + + + PERL="" +if test "X$GCC" = "Xyes"; then + for ac_prog in perl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_PERL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$PERL"; then + ac_cv_prog_PERL="$PERL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_PERL="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +PERL=$ac_cv_prog_PERL +if test -n "$PERL"; then + echo "$as_me:$LINENO: result: $PERL" >&5 +echo "${ECHO_T}$PERL" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$PERL" && break +done + +fi + +if test -z "$AR"; then + for ac_prog in ar xar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AR" && break +done +test -n "$AR" || AR=":" + +fi + + +export AR + echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` @@ -4019,7 +5239,7 @@ test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes case $host in *-*-irix6*) # Find out which ABI we are using. - echo '#line 4022 "configure"' > conftest.$ac_ext + echo '#line 5242 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -4560,7 +5780,7 @@ chmod -w . save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" compiler_c_o=no -if { (eval echo configure:4563: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then +if { (eval echo configure:5783: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings if test -s out/conftest.err; then @@ -6367,7 +7587,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 6370 "configure" +#line 7590 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -6465,7 +7685,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 6468 "configure" +#line 7688 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -7190,1225 +8410,6 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool' - HDF5_INTERFACES="" -echo "$as_me:$LINENO: checking if Fortran interface enabled" >&5 -echo $ECHO_N "checking if Fortran interface enabled... $ECHO_C" >&6 -# Check whether --enable-fortran or --disable-fortran was given. -if test "${enable_fortran+set}" = set; then - enableval="$enable_fortran" - HDF_FORTRAN=$enableval -fi; - -if test "X$HDF_FORTRAN" = "Xyes"; then - echo "yes" - - HDF5_INTERFACES="$HDF5_INTERFACES fortran" - - - - - - - - - - - - - - for ac_prog in f90 pgf90 xlf90 f95 g95 xlf95 efc -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_F9X+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$F9X"; then - ac_cv_prog_F9X="$F9X" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_F9X="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -F9X=$ac_cv_prog_F9X -if test -n "$F9X"; then - echo "$as_me:$LINENO: result: $F9X" >&5 -echo "${ECHO_T}$F9X" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$F9X" && break -done - -test -z "$F9X" && { { echo "$as_me:$LINENO: error: no acceptable f9X compiler found in \$PATH" >&5 -echo "$as_me: error: no acceptable f9X compiler found in \$PATH" >&2;} - { (exit 1); exit 1; }; } - - -echo "$as_me:$LINENO: checking whether the Fortran 9X compiler ($F9X $FFLAGS $LDFLAGS) works" >&5 -echo $ECHO_N "checking whether the Fortran 9X compiler ($F9X $FFLAGS $LDFLAGS) works... $ECHO_C" >&6 - - -ac_ext=f90 -ac_compile='${F9X-f90} -c $FFLAGS conftest.$ac_ext 1>&5' -ac_link='${F9X-f90} -o conftest${ac_exeext} $FFLAGS conftest.$ac_ext $LDFLAGS $LIBS 1>&5' -cross_compiling=$ac_cv_prog_f9x_cross - - -cat > conftest.$ac_ext << EOF - - program conftest - end - -EOF -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext}; then - ac_cv_prog_f9x_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_f9x_cross=no - else - ac_cv_prog_f9x_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_f9x_works=no -fi -rm -fr conftest* - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -echo "$as_me:$LINENO: result: $ac_cv_prog_f9x_works" >&5 -echo "${ECHO_T}$ac_cv_prog_f9x_works" >&6 -if test $ac_cv_prog_f9x_works = no; then - { { echo "$as_me:$LINENO: error: installation or configuration problem: Fortran 9X compiler cannot create executables." >&5 -echo "$as_me: error: installation or configuration problem: Fortran 9X compiler cannot create executables." >&2;} - { (exit 1); exit 1; }; } -fi -echo "$as_me:$LINENO: checking whether the Fortran 9X compiler ($F9X $FFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo $ECHO_N "checking whether the Fortran 9X compiler ($F9X $FFLAGS $LDFLAGS) is a cross-compiler... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $ac_cv_prog_f9x_cross" >&5 -echo "${ECHO_T}$ac_cv_prog_f9x_cross" >&6 -cross_compiling=$ac_cv_prog_f9x_cross - -echo "$as_me:$LINENO: checking whether we are using GNU Fortran 95" >&5 -echo $ECHO_N "checking whether we are using GNU Fortran 95... $ECHO_C" >&6 -if test "${ac_cv_prog_g9x+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat > conftest.fpp <<EOF -#ifdef __GNUC__ - yes -#endif -EOF -if { ac_try='$F9X -E conftest.fpp' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_g9x=yes -else - ac_cv_prog_g9x=no -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_g9x" >&5 -echo "${ECHO_T}$ac_cv_prog_g9x" >&6 - -if test $ac_cv_prog_g9x = yes; then - G9X=yes - ac_test_FFLAGS="${FFLAGS+set}" - ac_save_FFLAGS="$FFLAGS" - FFLAGS= - echo "$as_me:$LINENO: checking whether $F9X accepts -g" >&5 -echo $ECHO_N "checking whether $F9X accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_f9x_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat > conftest.f << EOF - program conftest - end -EOF -if test -z "`$F9X -g -c conftest.f 2>&1`"; then - ac_cv_prog_f9x_g=yes -else - ac_cv_prog_f9x_g=no -fi -rm -f conftest* - -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_f9x_g" >&5 -echo "${ECHO_T}$ac_cv_prog_f9x_g" >&6 - if test "$ac_test_FFLAGS" = set; then - FFLAGS="$ac_save_FFLAGS" - elif test $ac_cv_prog_f9x_g = yes; then - FFLAGS="-g -O2" - else - FFLAGS="-O2" - fi -else - G9X= - test "${FFLAGS+set}" = set || FFLAGS="-g" -fi - - echo "$as_me:$LINENO: checking what $F9X does with modules" >&5 -echo $ECHO_N "checking what $F9X does with modules... $ECHO_C" >&6 - - -ac_ext=f90 -ac_compile='${F9X-f90} -c $FFLAGS conftest.$ac_ext 1>&5' -ac_link='${F9X-f90} -o conftest${ac_exeext} $FFLAGS conftest.$ac_ext $LDFLAGS $LIBS 1>&5' -cross_compiling=$ac_cv_prog_f9x_cross - - -test -d conftestdir || mkdir conftestdir -cd conftestdir -rm -rf * - -cat >conftest.$ac_ext <<EOF - module module - integer foo - end module module -EOF - -eval $ac_compile -modfiles="" -F9XMODEXT="" - -for f in conftest.o module.mod MODULE.mod module.M MODULE.M; do - if test -f "$f" ; then - modfiles="$f" - - case "$f" in - *.o) F9XMODEXT="o" ;; - *.mod) F9XMODEXT="mod" ;; - *.M) F9XMODEXT="M" ;; - esac - fi -done - -echo $modfiles 6>&1 -if test "$modfiles" = file.o; then - echo $ac_n "checking whether $F9X -em is saner""... $ac_c" 1>&6 - OLD_FFLAGS=$FFLAGS - FFLAGS="$FFLAGS -em" - eval $ac_compile - modfiles="" - for f in file.o module.mod MODULE.mod module.M MODULE.M; do - test -f $f && modfiles="$f" - done - if test "$modfiles" = "file.o"; then - FFLAGS=$OLD_FFLAGS - echo no 6>&1 - else - echo yes 6>&1 - fi -fi -cd .. - -echo "$as_me:$LINENO: checking how $F9X finds modules" >&5 -echo $ECHO_N "checking how $F9X finds modules... $ECHO_C" >&6 - -for flag in "-I" "-M" "-p"; do - cat >conftest.$ac_ext <<EOF - program conftest - use module - end program conftest -EOF - - ac_compile='${F9X-f90} $FFLAGS ${flag}conftestdir -c conftest.$ac_ext 1>&5' - - if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - F9XMODFLAG=$flag - break - fi -done - -if test -n "$F9XMODFLAG"; then - echo $F9XMODFLAG 1>&6 - FFLAGS="$F9XMODFLAG. $F9XMODFLAG../src $F9XMODFLAG../../../fortran/src $FFLAGS" -else - echo unknown 1>&6 -fi - - -rm -rf conftest* - - - ac_ext=f90 -ac_compile='${F9X-f90} -c $FFLAGS conftest.$ac_ext 1>&5' -ac_link='${F9X-f90} -o conftest${ac_exeext} $FFLAGS conftest.$ac_ext $LDFLAGS $LIBS 1>&5' -cross_compiling=$ac_cv_prog_f9x_cross - - - FFLAGS_saved=$FFLAGS - FFLAGS="$FFLAGS -I." - - echo "$as_me:$LINENO: checking if compiler supports -I. option" >&5 -echo $ECHO_N "checking if compiler supports -I. option... $ECHO_C" >&6 - - -ac_ext=f90 -ac_compile='${F9X-f90} -c $FFLAGS conftest.$ac_ext 1>&5' -ac_link='${F9X-f90} -o conftest${ac_exeext} $FFLAGS conftest.$ac_ext $LDFLAGS $LIBS 1>&5' -cross_compiling=$ac_cv_prog_f9x_cross - - -test -d conftestdir || mkdir conftestdir -cd conftestdir -rm -rf * - -cat >conftest.$ac_ext <<EOF - - program conftest - end - -EOF - -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - : - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - : - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 - FFLAGS="$FFLAGS_saved" -fi -cd .. -rm -rf conftest* - - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -else - echo "no" -fi - -echo "$as_me:$LINENO: checking if c++ interface enabled" >&5 -echo $ECHO_N "checking if c++ interface enabled... $ECHO_C" >&6 -# Check whether --enable-cxx or --disable-cxx was given. -if test "${enable_cxx+set}" = set; then - enableval="$enable_cxx" - HDF_CXX=$enableval -fi; - -if test "X$HDF_CXX" = "Xyes"; then - echo "yes" - HDF5_INTERFACES="$HDF5_INTERFACES c++" - ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - echo "$as_me:$LINENO: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CXX" && break -done -test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - - CXX=$ac_ct_CXX -fi - - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C++ compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 - (eval $ac_compiler --version </dev/null >&5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 - (eval $ac_compiler -v </dev/null >&5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 - (eval $ac_compiler -V </dev/null >&5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" - -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_compiler_gnu=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" - -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_prog_cxx_g=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -for ac_declaration in \ - ''\ - '#include <stdlib.h>' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include <stdlib.h> -$ac_declaration -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -continue -fi -rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -$ac_declaration -#ifdef F77_DUMMY_MAIN -# ifdef __cplusplus - extern "C" -# endif - int F77_DUMMY_MAIN() { return 1; } -#endif -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 -echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 -if test -z "$CXXCPP"; then - if test "${ac_cv_prog_CXXCPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include <assert.h> - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include <ac_nonexistent.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -echo "$as_me:$LINENO: result: $CXXCPP" >&5 -echo "${ECHO_T}$CXXCPP" >&6 -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include <assert.h> - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include <ac_nonexistent.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_cxx_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&5 -echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - echo "$as_me:$LINENO: checking if $CXX needs old style header files in includes" >&5 -echo $ECHO_N "checking if $CXX needs old style header files in includes... $ECHO_C" >&6 - -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 -echo "$as_me: error: cannot run test program while cross compiling" >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" - -#include <iostream> - -int main(void) { return 0; } - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - echo no - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -( exit $ac_status ) - - echo yes - CXXFLAGS="${CXXFLAGS} -DOLD_HEADER_FILENAME" - -fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - echo "$as_me:$LINENO: checking if $CXX can handle namespaces" >&5 -echo $ECHO_N "checking if $CXX can handle namespaces... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 -echo "$as_me: error: cannot run test program while cross compiling" >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" - -namespace H5 { -int fnord; -} - -int main(void) { - using namespace H5; - fnord = 37; - return 0; -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - echo yes - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -( exit $ac_status ) - - echo no - CXXFLAGS="${CXXFLAGS} -DH5_NO_NAMESPACE" - -fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - echo "$as_me:$LINENO: checking if $CXX supports std" >&5 -echo $ECHO_N "checking if $CXX supports std... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 -echo "$as_me: error: cannot run test program while cross compiling" >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" - -#include <string> - -using namespace std; - -int main(void) { - string myString("testing namespace std"); - return 0; -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - echo yes - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -( exit $ac_status ) - - echo no - CXXFLAGS="${CXXFLAGS} -DH5_NO_STD" - -fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - echo "$as_me:$LINENO: checking if $CXX supports bool types" >&5 -echo $ECHO_N "checking if $CXX supports bool types... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 -echo "$as_me: error: cannot run test program while cross compiling" >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" - -int main(void) { - bool flag; - return 0; -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - echo yes - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -( exit $ac_status ) - - echo no - CXXFLAGS="${CXXFLAGS} -DBOOL_NOTDEFINED" - -fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - echo "$as_me:$LINENO: checking if $CXX can handle static cast" >&5 -echo $ECHO_N "checking if $CXX can handle static cast... $ECHO_C" >&6 - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5 -echo "$as_me: error: cannot run test program while cross compiling" >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" - -int main(void) { - float test_float; - int test_int; - test_float = 37.0; - test_int = static_cast <int> (test_float); - return 0; -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - echo yes - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -( exit $ac_status ) - - echo no - CXXFLAGS="${CXXFLAGS} -DNO_STATIC_CAST" - -fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -else - echo "no" -fi - -echo "$as_me:$LINENO: checking if should build only statically linked executables" >&5 -echo $ECHO_N "checking if should build only statically linked executables... $ECHO_C" >&6 -# Check whether --enable-static_exec or --disable-static_exec was given. -if test "${enable_static_exec+set}" = set; then - enableval="$enable_static_exec" - STATIC_EXEC=$enableval -fi; - -if test "X$STATIC_EXEC" = "Xyes"; then - echo "yes" - LT_STATIC_EXEC="-all-static" -else - echo "no" - LT_STATIC_EXEC="" -fi - - - PERL="" -if test "X$GCC" = "Xyes"; then - for ac_prog in perl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_PERL+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$PERL"; then - ac_cv_prog_PERL="$PERL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_PERL="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -PERL=$ac_cv_prog_PERL -if test -n "$PERL"; then - echo "$as_me:$LINENO: result: $PERL" >&5 -echo "${ECHO_T}$PERL" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$PERL" && break -done - -fi - -if test -z "$AR"; then - for ac_prog in ar xar -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AR+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - echo "$as_me:$LINENO: result: $AR" >&5 -echo "${ECHO_T}$AR" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$AR" && break -done -test -n "$AR" || AR=":" - -fi - - -export AR - case $host_os in linux*) # If gcc is not used, need to set $wl to use "-Wl," @@ -31368,7 +31369,7 @@ else LD_LIBRARY_PATH="$LD_LIBRARY_PATH`echo $LDFLAGS | sed -e 's/-L/:/g' -e 's/ //g'`" export LD_LIBRARY_PATH -for hdf5_cv_printf_ll in l L ll q unknown; do +for hdf5_cv_printf_ll in l ll L q unknown; do if test "$cross_compiling" = yes; then continue else @@ -33947,7 +33948,6 @@ else echo "no" fi - COMMENCE=config/commence CONCLUDE=config/conclude @@ -34034,9 +34034,7 @@ if test "X$HDF5_HL" = "Xyes" && test "X$HDF_FORTRAN" = "Xyes"; then HL_FOR="fortran" fi - - -ac_config_files="$ac_config_files src/libhdf5.settings config/depend1 config/depend2 config/depend3 config/depend4 config/dependN config/commence config/conclude Makefile src/Makefile $PABLO_MAKE test/Makefile $PARALLEL_MAKE perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5import/Makefile tools/h5diff/Makefile tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/gifconv/Makefile tools/h5jam/Makefile tools/h5jam/testh5jam.sh examples/Makefile doc/Makefile doc/html/Makefile doc/html/ed_libs/Makefile doc/html/ed_styles/Makefile doc/html/ADGuide/Makefile doc/html/Graphics/Makefile doc/html/Intro/Makefile doc/html/PSandPDF/Makefile doc/html/TechNotes/Makefile doc/html/Tutor/Makefile doc/html/Tutor/Graphics/Makefile doc/html/Tutor/examples/Makefile doc/html/cpplus/Makefile doc/html/fortran/Makefile $FORTRAN_FILES $CXX_FILES $HL_FILES" +ac_config_files="$ac_config_files src/libhdf5.settings config/depend1 config/depend2 config/depend3 config/depend4 config/dependN config/commence config/conclude Makefile src/Makefile $PABLO_MAKE test/Makefile $PARALLEL_MAKE perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5import/Makefile tools/h5diff/Makefile tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/gifconv/Makefile examples/Makefile doc/Makefile doc/html/Makefile doc/html/ed_libs/Makefile doc/html/ed_styles/Makefile doc/html/ADGuide/Makefile doc/html/Graphics/Makefile doc/html/Intro/Makefile doc/html/PSandPDF/Makefile doc/html/TechNotes/Makefile doc/html/Tutor/Makefile doc/html/Tutor/Graphics/Makefile doc/html/Tutor/examples/Makefile doc/html/cpplus/Makefile doc/html/fortran/Makefile $FORTRAN_FILES $CXX_FILES $HL_FILES" cat >confcache <<\_ACEOF @@ -34539,6 +34537,8 @@ do "tools/h5dump/testh5dump.sh" ) CONFIG_FILES="$CONFIG_FILES tools/h5dump/testh5dump.sh" ;; "tools/h5import/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/h5import/Makefile" ;; "tools/h5diff/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/h5diff/Makefile" ;; + "tools/h5jam/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/h5jam/Makefile" ;; + "tools/h5jam/testh5jam.sh" ) CONFIG_FILES="$CONFIG_FILES tools/h5jam/testh5jam.sh" ;; "tools/h5repack/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/h5repack/Makefile" ;; "tools/h5repack/h5repack.sh" ) CONFIG_FILES="$CONFIG_FILES tools/h5repack/h5repack.sh" ;; "tools/h5ls/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/h5ls/Makefile" ;; @@ -34546,8 +34546,6 @@ do "tools/misc/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/misc/Makefile" ;; "tools/misc/h5cc" ) CONFIG_FILES="$CONFIG_FILES tools/misc/h5cc" ;; "tools/gifconv/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/gifconv/Makefile" ;; - "tools/h5jam/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/h5jam/Makefile" ;; - "tools/h5jam/testh5jam.sh" ) CONFIG_FILES="$CONFIG_FILES tools/h5jam/testh5jam.sh" ;; "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "doc/html/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/html/Makefile" ;; @@ -34667,18 +34665,6 @@ s,@LDFLAGS@,$LDFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@LN_S@,$LN_S,;t t -s,@ECHO@,$ECHO,;t t -s,@RANLIB@,$RANLIB,;t t -s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@STRIP@,$STRIP,;t t -s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t -s,@CPP@,$CPP,;t t -s,@LIBTOOL@,$LIBTOOL,;t t s,@HDF5_INTERFACES@,$HDF5_INTERFACES,;t t s,@R_LARGE@,$R_LARGE,;t t s,@R_INTEGER@,$R_INTEGER,;t t @@ -34700,6 +34686,18 @@ s,@CXXCPP@,$CXXCPP,;t t s,@LT_STATIC_EXEC@,$LT_STATIC_EXEC,;t t s,@PERL@,$PERL,;t t s,@AR@,$AR,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@LN_S@,$LN_S,;t t +s,@ECHO@,$ECHO,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@CPP@,$CPP,;t t +s,@LIBTOOL@,$LIBTOOL,;t t /@DEPEND@/r $DEPEND s,@DEPEND@,,;t t s,@USE_FILTER_DEFLATE@,$USE_FILTER_DEFLATE,;t t diff --git a/configure.in b/configure.in index 4806e6e..93354db 100644 --- a/configure.in +++ b/configure.in @@ -228,10 +228,6 @@ dnl Check for programs. dnl AC_PROG_CC CC_BASENAME="`echo $CC | cut -f1 -d' ' | xargs basename 2>/dev/null`" -AC_PROG_MAKE_SET -AC_PROG_INSTALL -AC_LIBTOOL_DLOPEN -AC_PROG_LIBTOOL dnl ---------------------------------------------------------------------- dnl Check if they would like the Fortran interface compiled @@ -436,6 +432,11 @@ dnl Export the AR macro so that it will be placed in the libtool file dnl correctly. export AR +AC_PROG_MAKE_SET +AC_PROG_INSTALL +AC_LIBTOOL_DLOPEN +AC_PROG_LIBTOOL + dnl Post processing to patch up some deficiencies in libtool case $host_os in linux*) @@ -1761,7 +1762,7 @@ AC_CACHE_VAL([hdf5_cv_printf_ll], LD_LIBRARY_PATH="$LD_LIBRARY_PATH`echo $LDFLAGS | sed -e 's/-L/:/g' -e 's/ //g'`" export LD_LIBRARY_PATH -for hdf5_cv_printf_ll in l L ll q unknown; do +for hdf5_cv_printf_ll in l ll L q unknown; do AC_TRY_RUN([ #include <stdio.h> #include <stdlib.h> @@ -2824,18 +2825,17 @@ AC_SUBST(HL) HL="" AC_SUBST(HL_FOR) HL_FOR="" AC_MSG_CHECKING([if high level library is enabled]) AC_ARG_ENABLE([hl], - [AC_HELP_STRING([--enable-hl], - [Enable the high level library [default=yes]])], - [HDF5_HL=$enableval], - [HDF5_HL=yes]) - + [AC_HELP_STRING([--enable-hl], + [Enable the high level library [default=yes]])], + [HDF5_HL=$enableval], + [HDF5_HL=yes]) + if test "X$HDF5_HL" = "Xyes"; then echo "yes" HL="hl" else echo "no" fi - dnl ---------------------------------------------------------------------- dnl Build the Makefiles. Almost every Makefile.in will begin with the line @@ -2935,8 +2935,6 @@ if test "X$HDF5_HL" = "Xyes" && test "X$HDF_FORTRAN" = "Xyes"; then # name of folder inside "hl" HL_FOR="fortran" fi - - AC_CONFIG_FILES([src/libhdf5.settings config/depend1 @@ -2957,6 +2955,8 @@ AC_CONFIG_FILES([src/libhdf5.settings tools/h5dump/testh5dump.sh tools/h5import/Makefile tools/h5diff/Makefile + tools/h5jam/Makefile + tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile @@ -2964,8 +2964,6 @@ AC_CONFIG_FILES([src/libhdf5.settings tools/misc/Makefile tools/misc/h5cc tools/gifconv/Makefile - tools/h5jam/Makefile - tools/h5jam/testh5jam.sh examples/Makefile doc/Makefile doc/html/Makefile diff --git a/doc/html/Datasets.html b/doc/html/Datasets.html index ccea555..eca195d 100644 --- a/doc/html/Datasets.html +++ b/doc/html/Datasets.html @@ -314,7 +314,7 @@ H5Pset_chunk (plist, 2, size); external data then zero is returned. <br><br> - <dt><code>herr_t H5Pget_external (hid_t <em>plist</em>, int + <dt><code>herr_t H5Pget_external (hid_t <em>plist</em>, unsigned <em>idx</em>, size_t <em>name_size</em>, char *<em>name</em>, off_t *<em>offset</em>, hsize_t *<em>size</em>)</code> <dd>This is the counterpart for the <code>H5Pset_external()</code> @@ -800,7 +800,7 @@ H5Pset_external (plist, "scan3.data", 0, 16); <p><code><pre> 1 hid_t file, mem_space, file_space, dataset; 2 double dd[200][400]; - 3 hssize_t offset[2]; + 3 hsize_t offset[2]; 4 hsize size[2]; 5 6 /* diff --git a/doc/html/Dataspaces.html b/doc/html/Dataspaces.html index b19e0c3..c83d285 100644 --- a/doc/html/Dataspaces.html +++ b/doc/html/Dataspaces.html @@ -438,7 +438,7 @@ portions of a dataspace may be added in the future. <DL> <DT> <TT>herr_t H5Sselect_hyperslab (hid_t <I>space</I>, h5s_seloper_t <I>op</I>, - const hssize_t * <I>start</I>, const hsize_t * <I>stride</I>, + const hsize_t * <I>start</I>, const hsize_t * <I>stride</I>, const hsize_t * <I>count</I>, const hsize_t * <I>block</I>)</TT></DT> <DD> @@ -488,7 +488,7 @@ I/O is performed. <DT> <TT>herr_t H5Sselect_elements (hid_t <I>space</I>, h5s_seloper_t <I>op</I>, - const size_t <I>num_elements</I>, const hssize_t *<I>coord</I>[])</TT></DT> + const size_t <I>num_elements</I>, const hsize_t *<I>coord</I>[])</TT></DT> <DD> This function selects array elements to be included in the selection for the diff --git a/doc/html/Datatypes.html b/doc/html/Datatypes.html index f738d44..232d7fb 100644 --- a/doc/html/Datatypes.html +++ b/doc/html/Datatypes.html @@ -610,7 +610,7 @@ <code>H5Tget_nmembers()</code> returns -1 on failure. <br><br> - <dt><code>char *H5Tget_member_name (hid_t <em>type</em>, int + <dt><code>char *H5Tget_member_name (hid_t <em>type</em>, unsigned <em>membno</em>)</code> <dd>Each member has a name which is unique among its siblings in a compound datatype. This function returns a pointer to a @@ -620,7 +620,7 @@ function. <br><br> - <dt><code>size_t H5Tget_member_offset (hid_t <em>type</em>, int + <dt><code>size_t H5Tget_member_offset (hid_t <em>type</em>, unsigned <em>membno</em>)</code> <dd>The byte offset of member number <em>membno</em> with respect to the beginning of the containing compound datum is @@ -631,7 +631,7 @@ <em>membno</em> arguments. <br><br> - <dt><code>hid_t H5Tget_member_type (hid_t <em>type</em>, int + <dt><code>hid_t H5Tget_member_type (hid_t <em>type</em>, unsigned <em>membno</em>)</code> <dd>Each member has its own datatype, a copy of which is returned by this function. The returned datatype identifier @@ -1297,7 +1297,7 @@ H5Tlock(hdf_fr_colors);</pre> datatypes. <br><br> - <dt><code>char *H5Tget_member_name(hid_t <em>etype</em>, int + <dt><code>char *H5Tget_member_name(hid_t <em>etype</em>, unsigned <em>membno</em>)</code> <dd>Given an enumeration datatype <em>etype</em> this function returns the symbol name for the member indexed by @@ -1310,7 +1310,7 @@ H5Tlock(hdf_fr_colors);</pre> <code>free()</code>. <br><br> - <dt><code>herr_t H5Tget_member_value(hid_t <em>etype</em>, int + <dt><code>herr_t H5Tget_member_value(hid_t <em>etype</em>, unsigned <em>membno</em>, void *<em>value</em>/*out*/)</code> <dd>Given an enumeration datatype <em>etype</em> this function returns the value associated with the member indexed by @@ -1325,12 +1325,13 @@ H5Tlock(hdf_fr_colors);</pre> when the type is not known by the C compiler. <pre> -int i, n = H5Tget_nmembers(hdf_en_colors); -for (i=0; i<n; i++) { - char *symbol = H5Tget_member_name(hdf_en_colors, i); +int n = H5Tget_nmembers(hdf_en_colors); +unsigned u; +for (u=0; u<(unsigned)n; u++) { + char *symbol = H5Tget_member_name(hdf_en_colors, u); short val; - H5Tget_member_value(hdf_en_colors, i, &val); - printf("#%d %20s = %d\n", i, symbol, val); + H5Tget_member_value(hdf_en_colors, u, &val); + printf("#%u %20s = %d\n", u, symbol, val); free(symbol); }</pre> @@ -1502,13 +1503,13 @@ int n = H5Tget_nmembers(foreign); hid_t itype = H5Tget_super(foreign); void *val = malloc(n * MAX(H5Tget_size(itype), sizeof(int))); char *name = malloc(n * sizeof(char*)); -int i; +unsigned u; /* Get foreign type information */ -for (i=0; i<n; i++) { - name[i] = H5Tget_member_name(foreign, i); - H5Tget_member_value(foreign, i, - (char*)val+i*H5Tget_size(foreign)); +for (u=0; u<(unsigned)n; u++) { + name[u] = H5Tget_member_name(foreign, u); + H5Tget_member_value(foreign, u, + (char*)val+u*H5Tget_size(foreign)); } /* Convert integer values to new type */ diff --git a/doc/html/DatatypesEnum.html b/doc/html/DatatypesEnum.html index 2926e7c..607030a 100644 --- a/doc/html/DatatypesEnum.html +++ b/doc/html/DatatypesEnum.html @@ -239,7 +239,7 @@ H5Tlock(hdf_fr_colors);</pre> types. <br><br> - <dt><code>char *H5Tget_member_name(hid_t <em>etype</em>, int + <dt><code>char *H5Tget_member_name(hid_t <em>etype</em>, unsigned <em>membno</em>)</code> <dd>Given an enumeration data type <em>etype</em> this function returns the symbol name for the member indexed by @@ -252,7 +252,7 @@ H5Tlock(hdf_fr_colors);</pre> <code>free()</code>. <br><br> - <dt><code>herr_t H5Tget_member_value(hid_t <em>etype</em>, int + <dt><code>herr_t H5Tget_member_value(hid_t <em>etype</em>, unsigned <em>membno</em>, void *<em>value</em>/*out*/)</code> <dd>Given an enumeration data type <em>etype</em> this function returns the value associated with the member indexed by @@ -267,12 +267,13 @@ H5Tlock(hdf_fr_colors);</pre> when the type is not known by the C compiler. <pre> -int i, n = H5Tget_nmembers(hdf_en_colors); -for (i=0; i<n; i++) { - char *symbol = H5Tget_member_name(hdf_en_colors, i); +int n = H5Tget_nmembers(hdf_en_colors); +unsigned u; +for (u=0; u<(unsigned)n; u++) { + char *symbol = H5Tget_member_name(hdf_en_colors, u); short val; - H5Tget_member_value(hdf_en_colors, i, &val); - printf("#%d %20s = %d\n", i, symbol, val); + H5Tget_member_value(hdf_en_colors, u, &val); + printf("#%u %20s = %d\n", u, symbol, val); free(symbol); }</pre> @@ -445,13 +446,13 @@ int n = H5Tget_nmembers(foreign); hid_t itype = H5Tget_super(foreign); void *val = malloc(n * MAX(H5Tget_size(itype), sizeof(int))); char *name = malloc(n * sizeof(char*)); -int i; +unsigned u; /* Get foreign type information */ -for (i=0; i<n; i++) { - name[i] = H5Tget_member_name(foreign, i); - H5Tget_member_value(foreign, i, - (char*)val+i*H5Tget_size(foreign)); +for (u=0; u<(unsigned)n; u++) { + name[u] = H5Tget_member_name(foreign, u); + H5Tget_member_value(foreign, u, + (char*)val+u*H5Tget_size(foreign)); } /* Convert integer values to new type */ diff --git a/doc/html/Glossary.html b/doc/html/Glossary.html index 94ff8e5..fd32c97 100644 --- a/doc/html/Glossary.html +++ b/doc/html/Glossary.html @@ -42,7 +42,8 @@ HDF5 Glossary </td></tr> </table> </center> -<hr><!-- #EndLibraryItem --><center> +<hr> +<!-- #EndLibraryItem --><center> <h1>HDF5 Glossary</h1> </center> @@ -557,7 +558,8 @@ HDF5 Glossary </td></tr> </table> </center> -<hr><!-- #EndLibraryItem --><!-- #BeginLibraryItem "/ed_libs/Footer.lbi" --><address> +<hr> +<!-- #EndLibraryItem --><!-- #BeginLibraryItem "/ed_libs/Footer.lbi" --><address> <a href="mailto:hdfhelp@ncsa.uiuc.edu">HDF Help Desk</a> <br> Describes HDF5 Release 1.7, the unreleased development branch; working toward HDF5 Release 1.8.0 diff --git a/doc/html/H5.format.html b/doc/html/H5.format.html index 172afa7..8d2ba87 100644 --- a/doc/html/H5.format.html +++ b/doc/html/H5.format.html @@ -5949,7 +5949,7 @@ value with all bits set, i.e. <code>0xffff...ff</code>. <br> Describes HDF5 Release 1.7, the unreleased development branch; working toward HDF5 Release 1.8.0 </address><!-- #EndLibraryItem --><!-- hhmts start --> -Last modified: 5 July 2002 +Last modified: 12 July 2004 <!-- hhmts end --> </body> diff --git a/doc/html/H5.intro.html b/doc/html/H5.intro.html index d2c1463..8984153 100644 --- a/doc/html/H5.intro.html +++ b/doc/html/H5.intro.html @@ -1387,7 +1387,7 @@ A hyperslab specifies a regular pattern of elements in a dataset. It is also po hsize_t dim2[] = {MSPACE2_DIM}; /* Dimension size of the second dataset (in memory) */ int values[] = {53, 59, 61, 67}; /* New values to be written */ -hssize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points +hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points from the file dataspace */ /* @@ -1404,7 +1404,7 @@ coord[2][0] = 3; coord[2][1] = 5; coord[3][0] = 5; coord[3][1] = 6; ret = H5Sselect_elements(fid, H5S_SELECT_SET, NPOINTS, - (const hssize_t **)coord); + (const hsize_t **)coord); /* * Write new selection of points to the dataset. diff --git a/doc/html/Intro/IntroExamples.html b/doc/html/Intro/IntroExamples.html index e036207..6511683 100644 --- a/doc/html/Intro/IntroExamples.html +++ b/doc/html/Intro/IntroExamples.html @@ -246,9 +246,9 @@ main (void) int data_out[NX][NY][NZ ]; /* output buffer */ hsize_t count[2]; /* size of the hyperslab in the file */ - hssize_t offset[2]; /* hyperslab offset in the file */ + hsize_t offset[2]; /* hyperslab offset in the file */ hsize_t count_out[3]; /* size of the hyperslab in memory */ - hssize_t offset_out[3]; /* hyperslab offset in memory */ + hsize_t offset_out[3]; /* hyperslab offset in memory */ int i, j, k, status_n, rank; for (j = 0; j < NX; j++) { @@ -404,12 +404,12 @@ int main (void) hsize_t fdim[] = {FSPACE_DIM1, FSPACE_DIM2}; /* Dimension sizes of the dataset (on disk) */ - hssize_t start[2]; /* Start of hyperslab */ + hsize_t start[2]; /* Start of hyperslab */ hsize_t stride[2]; /* Stride of hyperslab */ hsize_t count[2]; /* Block count */ hsize_t block[2]; /* Block sizes */ - hssize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points + hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points from the file dataspace */ herr_t ret; uint i,j; @@ -504,7 +504,7 @@ int main (void) coord[3][0] = 5; coord[3][1] = 6; ret = H5Sselect_elements(fid, H5S_SELECT_SET, NPOINTS, - (const hssize_t **)coord); + (const hsize_t **)coord); /* * Write new selection of points to the dataset. @@ -779,7 +779,7 @@ main (void) hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; hsize_t chunk_dims[2] ={2, 5}; hsize_t size[2]; - hssize_t offset[2]; + hsize_t offset[2]; herr_t status; @@ -956,7 +956,7 @@ main (void) hsize_t chunk_dims[2]; hsize_t col_dims[1]; hsize_t count[2]; - hssize_t offset[2]; + hsize_t offset[2]; herr_t status, status_n; @@ -1117,7 +1117,7 @@ main (void) H5Fclose(file); return 0; -) +} </pre> @@ -1851,18 +1851,18 @@ and then written to the dataset in the file. int main(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dset1, /* Dataset ID */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dset1, /* Dataset ID */ dset2; /* Dereferenced dataset ID */ - hid_t sid1, /* Dataspace ID #1 */ + hid_t sid1, /* Dataspace ID #1 */ sid2; /* Dataspace ID #2 */ - hsize_t dims1[] = {SPACE1_DIM1}, + hsize_t dims1[] = {SPACE1_DIM1}, dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ - hssize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ hdset_reg_ref_t *wbuf; /* buffer to write to disk */ int *dwbuf; /* Buffer for writing numeric data to disk */ @@ -1921,7 +1921,7 @@ main(void) coord1[7][0]=9; coord1[7][1]=0; coord1[8][0]=7; coord1[8][1]=1; coord1[9][0]=3; coord1[9][1]=3; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1); + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); /* Store second dataset region */ ret = H5Rcreate(&wbuf[1],fid1,"/Dataset2",H5R_DATASET_REGION,sid2); @@ -1988,8 +1988,8 @@ main(void) hid_t sid1, /* Dataspace ID #1 */ sid2; /* Dataspace ID #2 */ hsize_t * coords; /* Coordinate buffer */ - hssize_t low[SPACE2_RANK]; /* Selection bounds */ - hssize_t high[SPACE2_RANK]; /* Selection bounds */ + hsize_t low[SPACE2_RANK]; /* Selection bounds */ + hsize_t high[SPACE2_RANK]; /* Selection bounds */ hdset_reg_ref_t *rbuf; /* buffer to to read disk */ int *drbuf; /* Buffer for reading numeric data from disk */ int i, j; /* counting variables */ diff --git a/doc/html/RM_H5.html b/doc/html/RM_H5.html index 0f7d673..1d1bb15 100644 --- a/doc/html/RM_H5.html +++ b/doc/html/RM_H5.html @@ -123,18 +123,9 @@ and it users. <br> <strong>The FORTRAN90 Interfaces:</strong> - <br> -<font size=-1> -<i>In general, each FORTRAN90 subroutine performs exactly the same task -as the corresponding C function. The links below go to the C function -descriptions, which serve as general descriptions for both. A button, -under <strong>Non-C API(s)</strong> at the end of the C function description, -opens an external browser window displaying the FORTRAN90-specific -information. You will probably want to adjust the size and location of -this external window so that both browser windows are visible and to -facilitate moving easily between them.</i> -</font> +In general, each FORTRAN90 subroutine performs exactly the same task +as the corresponding C function. <br> <table border=0> @@ -158,6 +149,7 @@ facilitate moving easily between them.</i> </table> <!-- NEW PAGE --> +<!-- HEADER RIGHT " " --> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5check_version" --> <hr> diff --git a/doc/html/RM_H5A.html b/doc/html/RM_H5A.html index 68b51c3..b9efa38 100644 --- a/doc/html/RM_H5A.html +++ b/doc/html/RM_H5A.html @@ -188,6 +188,7 @@ See <a href="Attributes.html"><cite>Attributes</cite></a> in the <a href="H5.user.html"><cite>HDF5 User's Guide</cite></a> for further information. <!-- NEW PAGE --> +<!-- HEADER RIGHT " " --> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Aclose" --> <hr> @@ -311,7 +312,9 @@ SUBROUTINE h5acreate_f(obj_id, name, type_id, space_id, attr_id, & INTEGER(HID_T), INTENT(IN) :: space_id ! Attribute dataspace identifier INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier INTEGER, INTENT(OUT) :: hdferr ! Error code: - ! 0 on success and -1 on failure + ! 0 on success and -1 on failure</pre> +<!-- NEW PAGE --> +<pre> INTEGER(HID_T), OPTIONAL, INTENT(IN) :: creation_prp ! Attribute creation property ! list identifier @@ -547,10 +550,10 @@ END SUBROUTINE h5aget_space_f <pre> SUBROUTINE h5aget_type_f(attr_id, type_id, hdferr) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier - INTEGER(HID_T), INTENT(OUT) :: type_id ! Attribute datatype identifier - INTEGER, INTENT(OUT) :: hdferr ! Error code: - ! 0 on success and -1 on failure + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(OUT) :: type_id ! Attribute datatype identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code: + ! 0 on success and -1 on failure END SUBROUTINE h5aget_type_f </pre> @@ -684,11 +687,11 @@ SUBROUTINE <pre> SUBROUTINE h5aopen_idx_f(obj_id, index, attr_id, hdferr) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier - INTEGER, INTENT(IN) :: index ! Attribute index - INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier - INTEGER, INTENT(OUT) :: hdferr ! Error code: - ! 0 on success and -1 on failure + INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier + INTEGER, INTENT(IN) :: index ! Attribute index + INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code: + ! 0 on success and -1 on failure END SUBROUTINE h5aopen_idx_f </pre> @@ -738,11 +741,11 @@ END SUBROUTINE h5aopen_idx_f <pre> SUBROUTINE h5aopen_name_f(obj_id, name, attr_id, hdferr) IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier - CHARACTER(LEN=*), INTENT(IN) :: name ! Attribute name - INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier - INTEGER, INTENT(OUT) :: hdferr ! Error code: - ! 0 on success and -1 on failure + INTEGER(HID_T), INTENT(IN) :: obj_id ! Object identifier + CHARACTER(LEN=*), INTENT(IN) :: name ! Attribute name + INTEGER(HID_T), INTENT(OUT) :: attr_id ! Attribute identifier + INTEGER, INTENT(OUT) :: hdferr ! Error code: + ! 0 on success and -1 on failure END SUBROUTINE h5aopen_name_f </pre> @@ -877,8 +880,8 @@ SUBROUTINE h5awrite_f(attr_id, memtype_id, buf, dims, hdferr) DIMENSION(*), INTEGER(HSIZE_T), INTENT(IN) :: dims ! Array to hold corresponding ! dimension sizes of data buffer buf; - ! dim(k) has value of the - ! k-th dimension of buffer buf; + ! dim(k) has value of the k-th + ! dimension of buffer buf; ! values are ignored if buf is ! a scalar INTEGER, INTENT(OUT) :: hdferr ! Error code: diff --git a/doc/html/RM_H5D.html b/doc/html/RM_H5D.html index ed93c9a..cb9be00 100644 --- a/doc/html/RM_H5D.html +++ b/doc/html/RM_H5D.html @@ -190,6 +190,7 @@ as the corresponding C function. </table> <!-- NEW PAGE --> +<!-- HEADER RIGHT " " --> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Dclose" --> <hr> @@ -309,6 +310,29 @@ END SUBROUTINE h5dclose_f “HDF5 Datasets” chapter of the new <cite>HDF5 User's Guide</cite>, which is being prepared for release. +<dt><strong>Note:</strong> + <dd><code>H5Dcreate</code> can fail if there has been an error + in setting up an element of the dataset creation property list. + In such cases, each item in the property list must be examined + to ensure that the setup satisfies to all required conditions. + This problem is most likely to occur with the use of filters. + <p> + For example, <code>H5Dcreate</code> will fail without a meaningful + explanation if + <ul> + <li>SZIP compression is being used on the dataset and + <li>the SZIP parameter <code>pixels_per_block</code> + is set to an inappropriate value. + </ul> + <p> + In such a case, one would refer to the description of + <a href="RM_H5P.html#Property-SetSzip"><code>H5Pset_szip</code></a>, + looking for any conditions or requirements that might affect the + local computing environment. + <!-- + <p> + Other known similar problems can occur with . . . + --> <dt><strong>Parameters:</strong> <ul><table> <tr> diff --git a/doc/html/RM_H5E.html b/doc/html/RM_H5E.html index 8f4d3ce..250302f 100644 --- a/doc/html/RM_H5E.html +++ b/doc/html/RM_H5E.html @@ -184,6 +184,7 @@ statically allocated to reduce the complexity of handling errors within the H5E package. <!-- NEW PAGE --> +<!-- HEADER RIGHT " " --> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Eclear" --> <hr> diff --git a/doc/html/RM_H5F.html b/doc/html/RM_H5F.html index 7156c3b..b77873d 100644 --- a/doc/html/RM_H5F.html +++ b/doc/html/RM_H5F.html @@ -93,12 +93,12 @@ documented below. </ul> </td><td> </td><td valign=top> <ul> - <li><a href="#File-GetAccessPlist">H5Fget_access_plist</a> <li><a href="#File-GetCreatePlist">H5Fget_create_plist</a> + <li><a href="#File-GetAccessPlist">H5Fget_access_plist</a> <li><a href="#File-GetName">H5Fget_name</a> <li><a href="#File-GetObjCount">H5Fget_obj_count</a> <li><a href="#File-GetObjIDs">H5Fget_obj_ids</a> - <li><a href="#File-GetFreespace">H5Fget_freespace</a> + <li><a href="#File-GetFreeSpace">H5Fget_freespace</a> </ul> </td></tr> </table> @@ -123,7 +123,7 @@ documented below. <td valign="top"> <ul> - <li><a href="#File-GetFreespace">H5Fget_freespace</a> + <li><a href="#File-GetFreeSpace">H5Fget_freespace</a> <li><a href="#File-GetName">H5Fget_name</a> <li><a href="#File-GetObjCount">H5Fget_obj_count</a> <li><a href="#File-GetObjIDs">H5Fget_obj_ids</a> @@ -147,18 +147,10 @@ documented below. <br> <strong>The FORTRAN90 Interfaces:</strong> - <br> -<font size=-1> -<i>In general, each FORTRAN90 subroutine performs exactly the same task -as the corresponding C function. The links below (electronic versions only) go to the C function -descriptions, which serve as general descriptions for both. A button, -under <strong>Non-C API(s)</strong> at the end of the C function description, -opens an external browser window displaying the FORTRAN90-specific -information. You will probably want to adjust the size and location of -this external window so that both browser windows are visible and to -facilitate moving easily between them.</i> -</font><br> +In general, each FORTRAN90 subroutine performs exactly the same task +as the corresponding C function. +<br> <table border=0> <tr><td valign=top> @@ -190,6 +182,7 @@ facilitate moving easily between them.</i> </table> <!-- NEW PAGE --> +<!-- HEADER RIGHT " " --> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Fclose" --> <hr> @@ -429,6 +422,7 @@ END SUBROUTINE h5fcreate_f <p> <code>scope</code> specifies whether the scope of the flushing action is global or local. Valid values are + <center> <table border=0> <tr><td align=left valign=top><code>H5F_SCOPE_GLOBAL</code></td> <td> </td> @@ -437,6 +431,7 @@ END SUBROUTINE h5fcreate_f <td></td> <td align=left valign=top>Flushes only the specified file.</td></tr> </table> + </center> <dt><strong>Note:</strong> <dd>HDF5 does not possess full control over buffering. <code>H5Fflush</code> flushes the internal HDF5 buffers then @@ -639,7 +634,7 @@ END SUBROUTINE h5fget_filesize_f <!-- HEADER RIGHT "H5Fget_freespace" --> <hr> <dl> -<dt><strong>Name:</strong> <a name="File-GetFreespace">H5Fget_freespace</a> +<dt><strong>Name:</strong> <a name="File-GetFreeSpace">H5Fget_freespace</a> <dt><strong>Signature:</strong> <dd><em>hssize_t </em><code>H5Fget_freespace</code>(<em>hid_t</em> <code>file_id</code>) <dt><strong>Purpose:</strong> @@ -749,8 +744,6 @@ SUBROUTINE h5fget_name_f(obj_id, buf, size, hdferr) INTEGER(SIZE_T), INTENT(OUT) :: size ! Size of the filename INTEGER, INTENT(OUT) :: hdferr ! Error code: 0 on success, ! -1 if fail - INTEGER(SIZE_T) :: buflen - END SUBROUTINE h5fget_name_f </pre> diff --git a/doc/html/RM_H5G.html b/doc/html/RM_H5G.html index 717667e..7284051 100644 --- a/doc/html/RM_H5G.html +++ b/doc/html/RM_H5G.html @@ -204,6 +204,7 @@ create or access function. <p> <!-- NEW PAGE --> +<!-- HEADER RIGHT " " --> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Gclose" --> <hr> @@ -550,7 +551,8 @@ SUBROUTINE The existence of an object can be tested by calling this function with a null <code>statbuf</code>. <p> - <code>H5Gget_objinfo</code> fills in the following data structure: + <code>H5Gget_objinfo</code> fills in the following data structure + (defined in H5Gpublic.h): <pre> typedef struct H5G_stat_t { unsigned long fileno; @@ -562,9 +564,20 @@ SUBROUTINE H5O_stat_t ohdr; } H5G_stat_t </pre> + + where H5O_stat_t (defined in H5Opublic.h) is: + + <pre> + typedef struct H5O_stat_t { + hsize_t size; + hsize_t free; + unsigned nmesgs; + unsigned nchunks; + } H5O_stat_t + </pre> The <code>fileno</code> and <code>objno</code> fields contain - values which uniquely identify an object among those - HDF5 files which are open: if both values are the same + four values which uniquely identify an object among those + HDF5 files which are open: if all four values are the same between two objects, then the two objects are the same (provided both files are still open). <ul> @@ -580,26 +593,41 @@ SUBROUTINE the object or zero when information is being returned about a symbolic link (symbolic links do not have hard links but all other objects always have at least one). + <p> The <code>type</code> field contains the type of the object, one of <code>H5G_GROUP</code>, <code>H5G_DATASET</code>, <code>H5G_LINK</code>, or <code>H5G_TYPE</code>. + <p> The <code>mtime</code> field contains the modification time. + <p> If information is being returned about a symbolic link then <code>linklen</code> will be the length of the link value (the name of the pointed-to object with the null terminator); otherwise <code>linklen</code> will be zero. + <p> + The fields in the <code>H5O_stat_t</code> struct contain information + about the object header for the object queried: + <ul><dl> + <dt><code>size</code> + <dd>The total size of all the object header information in + the file (for all chunks). + <dt><code>free</code> + <dd>The size of unused space in the object header. + <dt><code>nmesgs</code> + <dd>The number of object header messages. + <dt><code>nchunks</code> + <dd>The number of chunks the object header is broken up into. + </dl> </ul> -<!-- INSERT H50_stat_t DESCRIPTION AS IN 1.6 --> - + <p> Other fields may be added to this structure in the future. <dt><strong>Note:</strong> <dd>Some systems will be able to record the time accurately but unable to retrieve the correct time; such systems (e.g., Irix64) will report an <code>mtime</code> value of 0 (zero). -<!-- NEW PAGE --> <dt><strong>Parameters:</strong> <ul><table> <tr> diff --git a/doc/html/RM_H5I.html b/doc/html/RM_H5I.html index 1569a09..62f4fd7 100644 --- a/doc/html/RM_H5I.html +++ b/doc/html/RM_H5I.html @@ -158,8 +158,8 @@ as the corresponding C function. <table border=0> <tr><td valign=top> <ul> - <li><a href="#Identify-GetType">h5iget_type_f</a> <li><a href="#Identify-GetName">h5iget_name_f</a> + <li><a href="#Identify-GetType">h5iget_type_f</a> </ul> </td><td> </td><td valign=top> <ul> @@ -413,8 +413,7 @@ END SUBROUTINE h5idec_ref_f <ul> <table> <tr> - <td valign="top"><em>hid_t</em> <code>obj_id </code> -</td> + <td valign="top"><em>hid_t</em> <code>obj_id </code></td> <td valign="top">IN: Identifier of the object whose associated file identifier will be returned.</td> </tr> diff --git a/doc/html/RM_H5P.html b/doc/html/RM_H5P.html index 76d552a..4504519 100644 --- a/doc/html/RM_H5P.html +++ b/doc/html/RM_H5P.html @@ -2067,7 +2067,7 @@ END SUBROUTINE h5pget_buffer_f <dt><strong>Fortran90 Interface:</strong> h5pget_cache_f <dd> <pre> -SUBROUTINE h5pget_cache_f(prp_id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, & +SUBROUTINE h5pget_cache_f(prp_id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -2572,7 +2572,7 @@ END SUBROUTINE h5pget_edc_check_f <dt><strong>Name:</strong> <a name="Property-GetExternal">H5Pget_external</a> <dt><strong>Signature:</strong> <dd><em>herr_t</em> <code>H5Pget_external</code>(<em>hid_t</em> <code>plist</code>, - <em>int</em> <code>idx</code>, + <em>unsigned</em> <code>idx</code>, <em>size_t</em> <code>name_size</code>, <em>char</em> <code>*name</code>, <em>off_t</em> <code>*offset</code>, @@ -2600,7 +2600,7 @@ END SUBROUTINE h5pget_edc_check_f <td valign="top"><em>hid_t</em> <code>plist</code></td> <td valign="top">IN: Identifier of a dataset creation property list.</td></tr> <tr> - <td valign="top"><em>int</em> <code>idx</code></td> + <td valign="top"><em>unsigned</em> <code>idx</code></td> <td valign="top">IN: External file index.</td></tr> <tr> <td valign="top"><em>size_t</em> <code>name_size </code></td> @@ -3072,7 +3072,7 @@ END SUBROUTINE h5pget_fapl_mpiposix_f <dt><strong>Fortran90 Interface:</strong> h5pget_fapl_multi_f <dd> <pre> -SUBROUTINE h5pget_fapl_multi_f(prp_id, memb_map, memb_fapl, memb_name, & +SUBROUTINE h5pget_fapl_multi_f(prp_id, memb_map, memb_fapl, memb_name, memb_addr, relax, hdferr) IMPLICIT NONE INTEGER(HID_T),INTENT(IN) :: prp_id ! Property list identifier @@ -3512,8 +3512,8 @@ END SUBROUTINE h5pget_fill_value_f <dt><strong>Fortran90 Interface:</strong> h5pget_filter_f <dd> <pre> -SUBROUTINE h5pget_filter_f(prp_id, filter_number, flags, cd_nelmts, cd_values, - namelen, name, filter_id, hdferr) +SUBROUTINE h5pget_filter_f(prp_id, filter_number, flags, cd_nelmts, + cd_values, namelen, name, filter_id, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier INTEGER, INTENT(IN) :: filter_number ! Sequence number within the filter @@ -3618,16 +3618,15 @@ END SUBROUTINE h5pget_filter_f <dt><strong>Returns:</strong> <dd>Returns a non-negative value if successful; otherwise returns a negative value. +<!-- NEW PAGE --> <dt><strong>Fortran90 Interface:</strong> h5pget_filter_by_id_f <dd> <pre> -SUBROUTINE h5pget_filter_by_id_f(prp_id, filter_id, flags, cd_nelmts, & +SUBROUTINE h5pget_filter_by_id_f(prp_id, filter_id, flags, cd_nelmts, cd_values, namelen, name, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier - INTEGER, INTENT(IN) :: filter_id ! Filter identifier</pre> -<!-- NEW PAGE --> -<pre> + INTEGER, INTENT(IN) :: filter_id ! Filter identifier INTEGER(SIZE_T), INTENT(INOUT) :: cd_nelmts ! Number of elements in cd_values INTEGER, DIMENSION(*), INTENT(OUT) :: cd_values @@ -3703,7 +3702,6 @@ END SUBROUTINE h5pget_gc_references_f --> </dl> - <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Pget_hyper_vector_size" --> <hr> @@ -3766,7 +3764,7 @@ END SUBROUTINE h5pget_hyper_vector_size_f <dt><strong>Name:</strong> <a name="Property-GetIstoreK">H5Pget_istore_k</a> <dt><strong>Signature:</strong> <dd><em>herr_t </em><code>H5Pget_istore_k</code>(<em>hid_t</em> <code>plist</code>, - <em>int *</em> <code>ik</code> + <em>unsigned *</em> <code>ik</code> ) <dt><strong>Purpose:</strong> <dd>Queries the 1/2 rank of an indexed storage B-tree. @@ -3783,7 +3781,7 @@ END SUBROUTINE h5pget_hyper_vector_size_f <td valign="top"><em>hid_t</em> <code>plist </code></td> <td valign="top">IN: Identifier of property list to query.</td></tr> <tr> - <td valign="top"><em>int *</em> <code>ik</code></td> + <td valign="top"><em>unsigned *</em> <code>ik</code></td> <td valign="top">OUT: Pointer to location to return the chunked storage B-tree 1/2 rank.</td></tr> </table></ul> <dt><strong>Returns:</strong> @@ -4374,8 +4372,8 @@ END SUBROUTINE h5pget_small_data_block_size_f <dt><strong>Name:</strong> <a name="Property-GetSymK">H5Pget_sym_k</a> <dt><strong>Signature:</strong> <dd><em>herr_t </em><code>H5Pget_sym_k</code>(<em>hid_t</em> <code>plist</code>, - <em>int *</em> <code>ik</code>, - <em>int *</em> <code>lk</code> + <em>unsigned *</em> <code>ik</code>, + <em>unsigned *</em> <code>lk</code> ) <dt><strong>Purpose:</strong> <dd>Retrieves the size of the symbol table B-tree 1/2 rank @@ -4394,10 +4392,10 @@ END SUBROUTINE h5pget_small_data_block_size_f <td valign="top"><em>hid_t</em> <code>plist </code></td> <td valign="top">IN: Property list to query.</td></tr> <tr> - <td valign="top"><em>int *</em> <code>ik</code></td> + <td valign="top"><em>unsigned *</em> <code>ik</code></td> <td valign="top">OUT: Pointer to location to return the symbol table's B-tree 1/2 rank.</td></tr> <tr> - <td valign="top"><em>int *</em> <code>size</code></td> + <td valign="top"><em>unsigned *</em> <code>size</code></td> <td valign="top">OUT: Pointer to location to return the symbol table's leaf node 1/2 size.</td></tr> </table></ul> <dt><strong>Returns:</strong> @@ -4478,10 +4476,10 @@ END SUBROUTINE h5pget_userblock_f <dt><strong>Name:</strong> <a name="Property-GetVersion">H5Pget_version</a> <dt><strong>Signature:</strong> <dd><em>herr_t </em><code>H5Pget_version</code>(<em>hid_t</em> <code>plist</code>, - <em>int *</em> <code>super</code>, - <em>int *</em> <code>freelist</code>, - <em>int *</em> <code>stab</code>, - <em>int *</em> <code>shhdr</code> + <em>unsigned *</em> <code>super</code>, + <em>unsigned *</em> <code>freelist</code>, + <em>unsigned *</em> <code>stab</code>, + <em>unsigned *</em> <code>shhdr</code> ) <dt><strong>Purpose:</strong> <dd>Retrieves the version information of various objects for @@ -4496,16 +4494,16 @@ END SUBROUTINE h5pget_userblock_f <td valign="top"><em>hid_t</em> <code>plist</code></td> <td valign="top">IN: Identifier of the file creation property list.</td></tr> <tr> - <td valign="top"><em>int *</em> <code>super</code></td> + <td valign="top"><em>unsigned *</em> <code>super</code></td> <td valign="top">OUT: Pointer to location to return super block version number.</td></tr> <tr> - <td valign="top"><em>int *</em> <code>freelist </code></td> + <td valign="top"><em>unsigned *</em> <code>freelist </code></td> <td valign="top">OUT: Pointer to location to return global freelist version number.</td></tr> <tr> - <td valign="top"><em>int *</em> <code>stab</code></td> + <td valign="top"><em>unsigned *</em> <code>stab</code></td> <td valign="top">OUT: Pointer to location to return symbol table version number.</td></tr> <tr> - <td valign="top"><em>int *</em> <code>shhdr</code></td> + <td valign="top"><em>unsigned *</em> <code>shhdr</code></td> <td valign="top">OUT: Pointer to location to return shared object header version number.</td></tr> </table></ul> <dt><strong>Returns:</strong> @@ -4889,6 +4887,10 @@ SUBROUTINE <td>IN: Callback routine called when a property is copied from an existing property list</td></tr> <tr> + <td><em>H5P_prp_compare_func_t</em> <code>compare</code></td> + <td>IN: Callback routine called when a property is compared with + another property list</td></tr> + <tr> <td><em>H5P_prp_close_func_t</em> <code>close</code></td> <td>IN: Callback routine called when a property list is being closed and the property value will be disposed of</td></tr> @@ -5295,7 +5297,9 @@ END SUBROUTINE h5pmodify_filter_f to range check the value being set for the property or may perform some transformation or translation of the value set. The <code>get</code> callback would then - reverse the <!-- NEW PAGE -->transformation or translation. + reverse the + <!-- NEW PAGE --> + transformation or translation. A single <code>get</code> or <code>set</code> callback could handle multiple properties by performing different actions based on the @@ -5497,6 +5501,10 @@ END SUBROUTINE h5pmodify_filter_f <td valign="top">IN: Callback routine called when a property is copied from a property list</td></tr> <tr> + <td valign="top"><code>H5P_prp_compare_func_t</code> <em>compare</em></td> + <td valign="top">IN: Callback routine called when a property is compared with + another property list</td></tr> + <tr> <td valign="top"><code>H5P_prp_close_func_t</code> <em>close</em></td> <td valign="top">IN: Callback routine called when a property list is being closed and the property value will be disposed of</td></tr> @@ -5598,6 +5606,7 @@ END SUBROUTINE h5premove_f --> </dl> + <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Pset" --> <hr> @@ -5716,14 +5725,12 @@ END SUBROUTINE h5pset_f <tr> <td valign="top"><em>hsize_t</em> <code>threshold </code></td> <td valign="top">IN: Threshold value. - Must be non-negative. Note that setting the threshold value to 0 (zero) has the effect of a special case, forcing everything to be aligned.</td></tr> <tr> <td valign="top"><em>hsize_t</em> <code>alignment</code></td> - <td valign="top">IN: Alignment value. - Must be a positive value.</td></tr> + <td valign="top">IN: Alignment value.</td></tr> </table></ul> <dt><strong>Returns:</strong> <dd>Returns a non-negative value if successful; @@ -6437,18 +6444,18 @@ END SUBROUTINE h5pset_edc_check_f <dd>Adds an external file to the list of external files. <dt><strong>Description:</strong> <dd>The first call to <code>H5Pset_external</code> sets the - <i>external storage</i> property in the property list, - thus designating that the dataset will be stored in - one or more non-HDF5 file(s) external to the HDF5 file. - This call also adds the file <code>name</code> as the - first file in the list of external files. - Subsequent calls to the function add the named file as - the next file in the list. + <i>external storage</i> property in the property list, + thus designating that the dataset will be stored in + one or more non-HDF5 file(s) external to the HDF5 file. + This call also adds the file <code>name</code> as the + first file in the list of external files. + Subsequent calls to the function add the named file as + the next file in the list. <p> If a dataset is split across multiple files, then the files should be defined in order. The total size of the dataset is - the sum of the <code>size</code> arguments for all the external files. If - the total size is larger than the size of a dataset then the + the sum of the <code>size</code> arguments for all the external files. + If the total size is larger than the size of a dataset then the dataset can be extended (provided the data space also allows the extending). <p> @@ -6458,12 +6465,12 @@ END SUBROUTINE h5pset_edc_check_f external file can be of unlimited size and no more files can be added to the external files list. <p> - All of the external files for a given dataset must be - specified with <code>H5Pset_external</code> - <i>before</i> <code>H5Dcreate</code> is called to create - the dataset. - If one these files does not exist on the system when - <code>H5Dwrite</code> is called to write data to it, + All of the external files for a given dataset must be + specified with <code>H5Pset_external</code> + <i>before</i> <code>H5Dcreate</code> is called to create + the dataset. + If one these files does not exist on the system when + <code>H5Dwrite</code> is called to write data to it, the library will create the file. <dt><strong>Parameters:</strong> <ul><table> @@ -7336,16 +7343,14 @@ END SUBROUTINE h5pset_fapl_mpiposix_f <dt><strong>Fortran90 Interface:</strong> h5pset_fapl_multi_f <dd> <pre> -SUBROUTINE h5pset_fapl_multi_f(prp_id, memb_map, memb_fapl, memb_name, & +SUBROUTINE h5pset_fapl_multi_f(prp_id, memb_map, memb_fapl, memb_name, memb_addr, relax, hdferr) IMPLICIT NONE INTEGER(HID_T),INTENT(IN) :: prp_id ! Property list identifier INTEGER,DIMENSION(0:H5FD_MEM_NTYPES_F-1),INTENT(IN) :: memb_map INTEGER(HID_T),DIMENSION(0:H5FD_MEM_NTYPES_F-1),INTENT(IN) :: memb_fapl - CHARACTER(LEN=*),DIMENSION(0:H5FD_MEM_NTYPES_F-1),INTENT(IN) :: memb_name</pre> -<!-- NEW PAGE --> -<pre> + CHARACTER(LEN=*),DIMENSION(0:H5FD_MEM_NTYPES_F-1),INTENT(IN) :: memb_name REAL, DIMENSION(0:H5FD_MEM_NTYPES_F-1), INTENT(IN) :: memb_addr ! Numbers in the interval [0,1) (e.g. 0.0 0.1 0.5 0.2 0.3 0.4) ! real address in the file will be calculated as X*HADDR_MAX @@ -8357,7 +8362,7 @@ END SUBROUTINE h5pset_hyper_vector_size_f <dt><strong>Name:</strong> <a name="Property-SetIstoreK">H5Pset_istore_k</a> <dt><strong>Signature:</strong> <dd><em>herr_t </em><code>H5Pset_istore_k</code>(<em>hid_t</em> <code>plist</code>, - <em>int</em> <code>ik</code> + <em>unsigned</em> <code>ik</code> ) <dt><strong>Purpose:</strong> <dd>Sets the size of the parameter used to control the @@ -8377,7 +8382,7 @@ END SUBROUTINE h5pset_hyper_vector_size_f <td valign="top"><em>hid_t</em> <code>plist </code></td> <td valign="top">IN: Identifier of property list to query.</td></tr> <tr> - <td valign="top"><em>int</em> <code>ik</code></td> + <td valign="top"><em>unsigned</em> <code>ik</code></td> <td valign="top">IN: 1/2 rank of chunked storage B-tree.</td></tr> </table></ul> <dt><strong>Returns:</strong> @@ -8717,9 +8722,9 @@ END SUBROUTINE h5pset_preserve_f closely related to each other and putting them together can increase the compression ratio. <p> - As implied above, the primary value of the shuffle filter + As implied above, the primary value of the shuffle filter lies in its coordinated use with a compression filter; - it does not provide data compression when used alone. + it does not provide data compression when used alone. When the shuffle filter is applied to a dataset immediately prior to the use of a compression filter, the compression ratio achieved is often superior to that @@ -8952,8 +8957,8 @@ END SUBROUTINE h5pset_small_data_block_size_f <dt><strong>Name:</strong> <a name="Property-SetSymK">H5Pset_sym_k</a> <dt><strong>Signature:</strong> <dd><em>herr_t </em><code>H5Pset_sym_k</code>(<em>hid_t</em> <code>plist</code>, - <em>int</em> <code>ik</code>, - <em>int</em> <code>lk</code> + <em>unsigned</em> <code>ik</code>, + <em>unsigned</em> <code>lk</code> ) <dt><strong>Purpose:</strong> <dd>Sets the size of parameters used to control the symbol table nodes. @@ -8981,10 +8986,10 @@ END SUBROUTINE h5pset_small_data_block_size_f <td valign="top"><em>hid_t</em> <code>plist </code></td> <td valign="top">IN: Identifier for property list to query.</td></tr> <tr> - <td valign="top"><em>int</em> <code>ik</code></td> + <td valign="top"><em>unsigned</em> <code>ik</code></td> <td valign="top">IN: Symbol table tree rank.</td></tr> <tr> - <td valign="top"><em>int</em> <code>lk</code></td> + <td valign="top"><em>unsigned</em> <code>lk</code></td> <td valign="top">IN: Symbol table node size.</td></tr> </table></ul> <dt><strong>Returns:</strong> @@ -9023,9 +9028,53 @@ END SUBROUTINE h5pset_sym_k_f <dt><strong>Purpose:</strong> <dd>Sets up use of the SZIP compression filter. <dt><strong>Description:</strong> - <dd><code>H5Pset_szip</code> sets a filter for the dataset - to SZIP compression, <code>H5Z_FILTER_SZIP</code>, - a compression method designed for use with scientific data. + <dd><code>H5Pset_szip</code> sets an SZIP compression filter, + <code>H5Z_FILTER_SZIP</code>, for a dataset. + SZIP is a compression method designed for use with scientific data. + <p> + Before proceeding, be aware that there are factors that affect + your rights and ability to use SZIP compression. + See the documents at + <a href="http://hdf.ncsa.uiuc.edu/HDF5/doc_resource/SZIP/index.html" + target="External">SZIP Compression in HDF5</a> + for <em>important information regarding terms of use and + the SZIP copyright notice</em>, + for further discussion of SZIP compression in HDF5, + and for a list of SZIP-related references. + + <p> + In the text below, the term <em>pixel</em> refers to + an HDF5 data element. + This terminology derives from SZIP compression's use with image data, + where pixel referred to an image pixel. + <p> + The SZIP <code>bits_per_pixel</code> value (see <b>Notes</b>, below) + is automatically set, based on the HDF5 datatype. + SZIP can be used with atomic datatypes that may have size + of 8, 16, 32, or 64 bits. + Specifically, a dataset with a datatype that is + 8-, 16-, 32-, or 64-bit + signed or unsigned integer; + char; or + 32- or 64-bit float + can be compressed with SZIP. + See <b>Notes</b>, below, for further discussion of the + the SZIP <code>bits_per_pixel</code> setting. + + <p> + SZIP compression cannot be applied to + compound datatypes, + array datatypes, + variable-length datatypes, + enumerations, or + any other user-defined datatypes. + If an SZIP filter is set up for a dataset containing a non-allowed + datatype, <code>H5Pset_szip</code> will succeed but the subsequent call + to <a href="RM_H5D.html#Dataset-Create"><code>H5Dcreate</code></a> + will fail; + the conflict is detected only when the property list is used. + + <p> SZIP options are passed in an options mask, <code>options_mask</code>, as follows. @@ -9038,62 +9087,20 @@ END SUBROUTINE h5pset_sym_k_f <hr> <b>Description</b> <br> - <font size=-1>(Paired options are mutually exclusive.)</font> - </td></tr> - - <tr valign=top align=left><td> - <hr> - <code>H5_SZIP_CHIP_OPTION_MASK </code> - </td><td> - <hr> - Compresses exactly as in hardware. - </td></tr> - <tr valign=top align=left><td> - <code>H5_SZIP_ALLOW_K13_OPTION_MASK </code> - </td><td> - Allows k split = 13 compression mode. (Default) + <font size=-1>(Mutually exclusive; select one.)</font> </td></tr> - <tr valign=top align=left><td> <hr> - <code>H5_SZIP_EC_OPTION_MASK</code> + <code>H5_SZIP_EC_OPTION_MASK </code> </td><td> <hr> - Selects entropy coding method. (Default) + Selects entropy coding method. </td></tr> <tr valign=top align=left><td> <code>H5_SZIP_NN_OPTION_MASK</code> </td><td> Selects nearest neighbor coding method. </td></tr> - -<!-- THESE OPTIONS ARE SET DIRECTLY BY THE LIBRARY AND - ARE NOT AVAILABLE FOR USER CONTROL - - <tr valign=top align=left><td> - <hr> - <code>LSB_OPTION_MASK</code> - </td><td> - <hr> - Data format is least significant byte first. (Default) - </td></tr> - <tr valign=top align=left><td> - <code>MSB_OPTION_MASK</code> - </td><td> - Data format is most significant byte first. - </td></tr> - - <tr valign=top align=left><td> - <hr> - <code>RAW_OPTION_MASK</code> - </td><td> - <hr> - Do not output SZIP header.<br> - Not a default setting, but should always be set in HDF5. - </td></tr> - -END LIBRARY-SET OPTION TAGS --> - <tr valign=top align=left><td> <hr> </td><td> @@ -9101,50 +9108,50 @@ END LIBRARY-SET OPTION TAGS --> </td></tr> </table> </center> - Some typical usages are as follows: + The following guidelines can be used in determining + which option to select: <ul> - <li>One of the compression methods, - <code>H5_SZIP_EC_OPTION_MASK</code> or - <code>H5_SZIP_NN_OPTION_MASK</code>, is specified. - <li>The <code>H5_SZIP_ALLOW_K13_OPTION_MASK</code> is used. + <li>The entropy coding method, the EC option specified by + <code>H5_SZIP_EC_OPTION_MASK</code>, is best suited for + data that has been processed. + The EC method works best for small numbers. + <li>The nearest neighbor coding method, the NN option + specified by <code>H5_SZIP_NN_OPTION_MASK</code>, + preprocesses the data then the applies EC method as above. </ul> - <p> - Options are combined to create the options mask by means of - a logical <code>OR</code> operation. For example, the - option mask can be set as follows: - <br><br><code> - options_mask = H5_SZIP_NN_OPTION_MASK | H5_SZIP_ALLOW_K13_OPTION_MASK; - </code> + Other factors may affect results, but the above criteria + provides a good starting point for optimizing data compression. + <p> SZIP compresses data block by block, with a user-tunable block size. This block size is passed in the parameter - <code>pixels_per_block</code> and must be even, + <code>pixels_per_block</code> and must be even and not greater than 32, with typical values being <code>8</code>, <code>10</code>, - <code>16</code>, and <code>32</code>. - The more pixel values vary, the smaller this number should be. - For optimal performance, the number of pixels per scan line - (i.e., the size of the fastest-changing dimension in the chunk) - should be an even multiple of the number of pixels per block. - <p> - <dt><strong>Notes:</strong> - <dd>SZIP works only with datasets with 1 through 24 bits/pixel, - 32 pits/pixel, or 64 bits/pixel. + <code>16</code>, or <code>32</code>. + This parameter affects compression ratio; + the more pixel values vary, the smaller this number should be to + achieve better performance. <p> - SZIP typically requires that the user application also supply - the number of pixels in the object to be compressed, - the number of bits per pixel, and the number of pixels per scan line. - These values need not be independently supplied in the HDF5 - environment as they are derived from the datatype and dataspace, - which are already known. + In HDF5, compression can be applied only to chunked datasets. + If <code>pixels_per_block</code> is bigger than the total + number of elements in a dataset chunk, + <code>H5Pset_szip</code> will succeed but the subsequent call to + <a href="RM_H5D.html#Dataset-Create"><code>H5Dcreate</code></a> + will fail; the conflict is detected only when the property list + is used. <p> - Also see - <a href="http://hdf.ncsa.uiuc.edu/HDF5/doc_resource/SZIP/index.html" - target="External">SZIP Compression in HDF5</a> - for further discussion of SZIP compression in HDF5, - for <em>important information regarding terms of use and - the SZIP copyright notice</em>, - and for a list of SZIP-related references. - + To achieve optimal performance for SZIP compression, + it is recommended that a chunk's fastest-changing dimension + be equal to <em>N</em> times <code>pixels_per_block</code> + where <em>N</em> is the maximum number of blocks per scan line + allowed by the SZIP library. + In the current version of SZIP, <em>N</em> is set to 128. + <p> + <code>H5Pset_szip</code> will fail if SZIP encoding is + disabled in the available copy of the SZIP library. + <a href="RM_H5Z.html#Compression-GetFilterInfo"> + <code>H5Zget_filter_info</code></a> can be employed + to avoid such a failure. <dt><strong>Parameters:</strong> <ul><table> <tr> @@ -9153,7 +9160,9 @@ END LIBRARY-SET OPTION TAGS --> identifier.</td></tr> <tr> <td valign="top"><em>unsigned int</em> <code>options_mask</code></td> - <td valign="top">IN: A bit-mask conveying the desired SZIP options.</td></tr> + <td valign="top">IN: A bit-mask conveying the desired SZIP options. + Valid values are <code>H5_SZIP_EC_OPTION_MASK</code> + and <code>H5_SZIP_NN_OPTION_MASK</code>.</td></tr> <tr> <td valign="top"><em>unsigned int</em> <code>pixels_per_block </code></td> <td valign="top">IN: The number of pixels or data elements in each data block.</td></tr> @@ -9161,6 +9170,81 @@ END LIBRARY-SET OPTION TAGS --> <dt><strong>Returns:</strong> <dd>Returns a non-negative value if successful; otherwise returns a negative value. + <dt><strong>Notes:</strong> + <dd>The following notes are of interest primarily to those who have + used SZIP compression outside of the HDF5 context. + <p> + In non-HDF5 applications, SZIP typically requires that the + user application supply additional parameters: + <ul> + <li><code>pixels_in_object</code>, + the number of pixels in the object to be compressed + <li><code>bits_per_pixel</code>, + the number of bits per pixel + <li><code>pixels_per_scanline</code>, + the number of pixels per scan line + </ul> + <p> + These values need not be independently supplied in the HDF5 + environment as they are derived from the datatype and dataspace, + which are already known. + In particular, HDF5 sets + <code>pixels_in_object</code> to the number of elements in a chunk + and <code>bits_per_pixel</code> to the size of the element or + pixel datatype. + The following algorithm is used to set + <code>pixels_per_scanline</code>: + <ul> + <li>If the size of a chunk's fastest-changing dimension, + <em>size</em>, is greater than 4K, + set <code>pixels_per_scanline</code> to + 128 times <code>pixels_per_block</code>. + <li>If <em>size</em> is less than 4K + but greater than <code>pixels_per_block</code>, + set <code>pixels_per_scanline</code> to the minimum of + <em>size</em> and 128 times <code>pixels_per_block</code>. + <li>If <em>size</em> is less than <code>pixels_per_block</code> + but greater than the number elements in the chunk, + set <code>pixels_per_scanline</code> to the minimum of + the number elements in the chunk and + 128 times <code>pixels_per_block</code>. + </ul> + + <p> + The HDF5 datatype may have precision that is less than the + full size of the data element, e.g., an 11-bit integer can be + defined using + <a href="RM_H5T.html#Datatype-SetPrecision"><code>H5Tset_precision</code></a>. + To a certain extent, SZIP can take advantage of the + precision of the datatype to improve compression: + <ul><li> + If the HDF5 datatype size is 24-bit or less and + the offset of the bits in the HDF5 datatype is zero + (see <a href="RM_H5T.html#Datatype-SetOffset"><code>H5Tset_offset</code></a> + or <a href="RM_H5T.html#Datatype-GetOffset"><code>H5Tget_offset</code></a>), + the data is the in lowest N bits of the data element. + In this case, the SZIP <code>bits_per_pixel</code> + is set to the precision + of the HDF5 datatype. + <li> + If the offset is not zero, the SZIP <code>bits_per_pixel</code> + will be set to the number of bits in the full size of the data + element. + <li> + If the HDF5 datatype precision is 25-bit to 32-bit, + the SZIP <code>bits_per_pixel</code> will be set to 32. + <li> + If the HDF5 datatype precision is 33-bit to 64-bit, + the SZIP <code>bits_per_pixel</code> will be set to 64. + </ul> + + <p> + HDF5 always modifies the options mask provided by the user + to set up usage of <code>RAW_OPTION_MASK</code>, + <code>ALLOW_K13_OPTION_MASK</code>, and one of + <code>LSB_OPTION_MASK</code> or <code>MSB_OPTION_MASK</code>, + depending on endianness of the datatype. + <dt><strong>Fortran90 Interface:</strong> h5pset_szip_f <dd> <pre> diff --git a/doc/html/RM_H5R.html b/doc/html/RM_H5R.html index 5c93eb9..6573567 100644 --- a/doc/html/RM_H5R.html +++ b/doc/html/RM_H5R.html @@ -151,6 +151,7 @@ as the corresponding C function. <p> <!-- NEW PAGE --> +<!-- HEADER RIGHT " " --> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Rcreate" --> <hr> @@ -218,8 +219,8 @@ as the corresponding C function. otherwise returns a negative value. <dt><strong>Fortran90 Interface:</strong> h5rcreate_f - <dd><p><strong>To create an object reference</strong> - + <p><strong>To create an object reference</strong> + <dd> <pre> SUBROUTINE h5rcreate_f(loc_id, name, ref, hdferr) IMPLICIT NONE @@ -233,8 +234,8 @@ END SUBROUTINE h5rcreate_f </pre></dt> <!-- NEW PAGE --> -<dt><dd><strong>To create a region reference</strong> - +<dt><strong>To create a region reference</strong> + <dd> <pre> SUBROUTINE h5rcreate_f(loc_id, name, space_id, ref, hdferr) IMPLICIT NONE diff --git a/doc/html/RM_H5S.html b/doc/html/RM_H5S.html index 7b50c0d..cea30c5 100644 --- a/doc/html/RM_H5S.html +++ b/doc/html/RM_H5S.html @@ -234,6 +234,7 @@ of the <cite>HDF5 User's Guide.</cite>. --> <!-- NEW PAGE --> +<!-- HEADER RIGHT " " --> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Sclose" --> <hr> @@ -500,8 +501,8 @@ END SUBROUTINE h5sextent_copy_f <dt><strong>Name:</strong> <a name="Dataspace-SelectBounds">H5Sget_select_bounds</a> <dt><strong>Signature:</strong> <dd><em>herr_t </em><code>H5Sget_select_bounds</code>(<em>hid_t </em><code>space_id</code>, - <em>hssize_t *</em><code>start</code>, - <em>hssize_t *</em><code>end</code> + <em>hsize_t *</em><code>start</code>, + <em>hsize_t *</em><code>end</code> ) <dt><strong>Purpose:</strong> <dd>Gets the bounding box containing the current selection. @@ -529,10 +530,10 @@ END SUBROUTINE h5sextent_copy_f <td valign="top"><em>hid_t</em> <code>space_id </code></td> <td valign="top">IN: Identifier of dataspace to query.</td></tr> <tr> - <td valign="top"><em>hssize_t *</em><code>start</code></td> + <td valign="top"><em>hsize_t *</em><code>start</code></td> <td valign="top">OUT: Starting coordinates of the bounding box.</td></tr> <tr> - <td valign="top"><em>hssize_t *</em><code>end</code></td> + <td valign="top"><em>hsize_t *</em><code>end</code></td> <td valign="top">OUT: Ending coordinates of the bounding box, i.e., the coordinates of the diagonally opposite corner.</td></tr> </table></ul> @@ -546,9 +547,9 @@ SUBROUTINE h5sget_select_bounds_f(space_id, start, end, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier - INTEGER(HSSIZE_T), DIMENSION(*), INTENT(OUT) :: start + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: start ! Starting coordinates of the bounding box - INTEGER(HSSIZE_T), DIMENSION(*), INTENT(OUT) :: end + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: end ! Ending coordinates of the bounding box, ! i.e., the coordinates of the diagonally ! opposite corner @@ -662,7 +663,7 @@ END SUBROUTINE h5sget_select_elem_npoints_f <dt><strong>Fortran90 Interface:</strong> h5sget_select_elem_pointlist_f <dd> <pre> -SUBROUTINE h5sget_select_elem_pointlist_f(space_id, startpoint, num_points, & +SUBROUTINE h5sget_select_elem_pointlist_f(space_id, startpoint, num_points, buf, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier @@ -741,7 +742,7 @@ END SUBROUTINE h5sget_select_elem_pointlist_f <dt><strong>Fortran90 Interface:</strong> h5sget_select_hyper_blocklist_f <dd> <pre> -SUBROUTINE h5sget_select_hyper_blocklist_f(space_id, startblock, num_blocks, & +SUBROUTINE h5sget_select_hyper_blocklist_f(space_id, startblock, num_blocks, buf, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier @@ -1270,7 +1271,7 @@ END SUBROUTINE h5sselect_all_f <dd><em>herr_t</em> <code>H5Sselect_elements</code>(<em>hid_t </em><code>space_id</code>, <em>H5S_seloper_t</em> <code>op</code>, <em>const size_t</em> <code>num_elements</code>, - <em>const hssize_t *</em><code>coord</code>[ ] + <em>const hsize_t *</em><code>coord</code>[ ] ) <dt><strong>Purpose:</strong> <dd>Selects array elements to be included in the selection for a dataspace. @@ -1336,7 +1337,7 @@ END SUBROUTINE h5sselect_all_f <td valign="top"><em>const size_t</em> <code>num_elements </code></td> <td valign="top">Number of elements to be selected.</td></tr> <tr> - <td valign="top"><em>const hssize_t *</em><code>coord</code>[ ]</td> + <td valign="top"><em>const hsize_t *</em><code>coord</code>[ ]</td> <td valign="top">A 2-dimensional array of 0-based values specifying the coordinates of the elements being selected.</td></tr> </table></ul> @@ -1346,7 +1347,7 @@ END SUBROUTINE h5sselect_all_f <dt><strong>Fortran90 Interface:</strong> h5sselect_elements_f <dd> <pre> -SUBROUTINE h5sselect_elements_f(space_id, operator, num_elements, & +SUBROUTINE h5sselect_elements_f(space_id, operator, num_elements, coord, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier @@ -1354,7 +1355,7 @@ SUBROUTINE h5sselect_elements_f(space_id, operator, num_elements, & ! H5S_SELECT_SET_F ! H5S_SELECT_OR_F INTEGER, INTENT(IN) :: num_elements ! Number of elements to be selected - INTEGER(HSSIZE_T), DIMENSION(*,*), INTENT(IN) :: coord + INTEGER(HSIZE_T), DIMENSION(*,*), INTENT(IN) :: coord ! Array with the coordinates ! of the selected elements: ! coord(num_elements, rank)</pre> @@ -1381,7 +1382,7 @@ END SUBROUTINE h5sselect_elements_f <dt><strong>Signature:</strong> <dd><em>herr_t</em> <code>H5Sselect_hyperslab</code>(<em>hid_t</em> <code>space_id</code>, <em>H5S_seloper_t</em> <code>op</code>, - <em>const hssize_t *</em><code>start</code>, + <em>const hsize_t *</em><code>start</code>, <em>const hsize_t *</em><code>stride</code>, <em>const hsize_t *</em><code>count</code>, <em>const hsize_t *</em><code>block</code> @@ -1492,7 +1493,7 @@ END SUBROUTINE h5sselect_elements_f <td valign="top"><em>H5S_seloper_t</em> <code>op</code></td> <td valign="top">IN: Operation to perform on current selection.</td></tr> <tr> - <td valign="top"><em>const hssize_t *</em><code>start</code></td> + <td valign="top"><em>const hsize_t *</em><code>start</code></td> <td valign="top">IN: Offset of start of hyperslab</td></tr> <tr> <td valign="top"><em>const hsize_t *</em><code>count</code></td> @@ -1510,14 +1511,14 @@ END SUBROUTINE h5sselect_elements_f <dt><strong>Fortran90 Interface:</strong> h5sselect_hyperslab_f <dd> <pre> -SUBROUTINE h5sselect_hyperslab_f(space_id, operator, start, count, & +SUBROUTINE h5sselect_hyperslab_f(space_id, operator, start, count, hdferr, stride, block) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier INTEGER, INTENT(IN) :: op ! Flag, valid values are: ! H5S_SELECT_SET_F ! H5S_SELECT_OR_F - INTEGER(HSSIZE_T), DIMENSION(*), INTENT(IN) :: start + INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: start ! Starting coordinates of hyperslab INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: count ! Number of blocks to select @@ -1719,7 +1720,7 @@ END SUBROUTINE h5sset_extent_none_f <dt><strong>Fortran90 Interface:</strong> h5sset_extent_simple_f <dd> <pre> -SUBROUTINE h5sset_extent_simple_f(space_id, rank, current_size, & +SUBROUTINE h5sset_extent_simple_f(space_id, rank, current_size, maximum_size, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier diff --git a/doc/html/RM_H5T.html b/doc/html/RM_H5T.html index 87591bc..2bcb045 100644 --- a/doc/html/RM_H5T.html +++ b/doc/html/RM_H5T.html @@ -164,6 +164,7 @@ of a dataset. <br> +<!-- NEW PAGE --> <i>Alphabetical Listing</i> <table border="0" width=100%> <tr> @@ -376,6 +377,7 @@ See <a href="Datatypes.html"><cite>The Datatype Interface (H5T)</cite></a> in the <cite>HDF5 User's Guide</cite> for further information, including a complete list of all supported datatypes. <!-- NEW PAGE --> +<!-- HEADER RIGHT " " --> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Tarray_create" --> <hr> @@ -1593,7 +1595,7 @@ END SUBROUTINE h5tget_inpad_f <dt><strong>Signature:</strong> <dd><em>H5T_class_t</em> <code>H5Tget_member_class</code>( <em>hid_t</em> <code>cdtype_id</code>, - <em>int </em><code>member_no</code> + <em>unsigned </em><code>member_no</code> ) <dt><strong>Purpose:</strong> <dd>Returns datatype class of compound datatype member. @@ -1607,7 +1609,7 @@ END SUBROUTINE h5tget_inpad_f <td valign="top"><em>hid_t</em> <code>cdtype_id </code></td> <td valign="top">IN: Datatype identifier of compound object.</td></tr> <tr> - <td valign="top"><em>int</em> <code>member_no</code></td> + <td valign="top"><em>unsigned</em> <code>member_no</code></td> <td valign="top">IN: Compound object member number.</td></tr> </table></ul> <dt><strong>Returns:</strong> @@ -1684,7 +1686,7 @@ END SUBROUTINE h5tget_inpad_f <dt><strong>Name:</strong> <a name="Datatype-GetMemberName">H5Tget_member_name</a> <dt><strong>Signature:</strong> <dd><em>char *</em> <code>H5Tget_member_name</code>(<em>hid_t </em><code>type_id</code>, - <em>int</em> <code>field_idx</code> + <em>unsigned</em> <code>field_idx</code> ) <dt><strong>Purpose:</strong> <dd>Retrieves the name of a compound or enumeration datatype member. @@ -1708,7 +1710,7 @@ END SUBROUTINE h5tget_inpad_f <td valign="top"><em>hid_t</em> <code>type_id </code></td> <td valign="top">Identifier of datatype to query.</td></tr> <tr> - <td valign="top"><em>int</em> <code>field_idx</code></td> + <td valign="top"><em>unsigned</em> <code>field_idx</code></td> <td valign="top">Zero-based index of the field or element whose name is to be retrieved.</td></tr> </table></ul> @@ -1746,7 +1748,7 @@ END SUBROUTINE h5tget_member_name_f <dt><strong>Name:</strong> <a name="Datatype-GetMemberOffset">H5Tget_member_offset</a> <dt><strong>Signature:</strong> <dd><em>size_t</em> <code>H5Tget_member_offset</code>(<em>hid_t </em><code>type_id</code>, - <em>int</em> <code>memb_no</code> + <em>unsigned</em> <code>memb_no</code> ) <dt><strong>Purpose:</strong> <dd>Retrieves the offset of a field of a compound datatype. @@ -1761,7 +1763,7 @@ END SUBROUTINE h5tget_member_name_f <td valign="top"><em>hid_t</em> <code>type_id </code></td> <td valign="top">Identifier of datatype to query.</td></tr> <tr> - <td valign="top"><em>int</em> <code>memb_no</code></td> + <td valign="top"><em>unsigned</em> <code>memb_no</code></td> <td valign="top">Number of the field whose offset is requested.</td></tr> </table></ul> <dt><strong>Returns:</strong> @@ -1799,7 +1801,7 @@ END SUBROUTINE h5tget_member_offset_f <dt><strong>Name:</strong> <a name="Datatype-GetMemberType">H5Tget_member_type</a> <dt><strong>Signature:</strong> <dd><em>hid_t</em> <code>H5Tget_member_type</code>(<em>hid_t </em><code>type_id</code>, - <em>int</em> <code>field_idx</code> + <em>unsigned</em> <code>field_idx</code> ) <dt><strong>Purpose:</strong> <dd>Returns the datatype of the specified member. @@ -1812,7 +1814,7 @@ END SUBROUTINE h5tget_member_offset_f <td valign="top"><em>hid_t</em> <code>type_id </code></td> <td valign="top">Identifier of datatype to query.</td></tr> <tr> - <td valign="top"><em>int</em> <code>field_idx</code></td> + <td valign="top"><em>unsigned</em> <code>field_idx</code></td> <td valign="top">Field index (0-based) of the field type to retrieve.</td></tr> </table></ul> <dt><strong>Returns:</strong> @@ -1848,7 +1850,7 @@ END SUBROUTINE h5tget_member_type_f <dt><strong>Name:</strong> <a name="Datatype-GetMemberValue">H5Tget_member_value</a> <dt><strong>Signature:</strong> <dd><em>hid_t</em> <code>H5Tget_member_value</code>(<em>hid_t</em> <code>type</code> - <em>int</em> <code>memb_no</code>, + <em>unsigned</em> <code>memb_no</code>, <em>void</em> *<code>value</code> ) <dt><strong>Purpose:</strong> @@ -1865,7 +1867,7 @@ END SUBROUTINE h5tget_member_type_f <td valign="top"><em>hid_t</em> <code>type</code></td> <td valign="top">IN: Datatype identifier for the enumeration datatype.</td></tr> <tr> - <td valign="top"><em>int</em> <code>memb_no</code>,</td> + <td valign="top"><em>unsigned</em> <code>memb_no</code>,</td> <td valign="top">IN: Number of the enumeration datatype member.</td></tr> <tr> <td valign="top"><em>void</em> *<code>value </code></td> diff --git a/doc/html/RM_H5Z.html b/doc/html/RM_H5Z.html index 2310e7b..b0497db 100644 --- a/doc/html/RM_H5Z.html +++ b/doc/html/RM_H5Z.html @@ -143,18 +143,18 @@ are as follows: <table align=center border=0> <tr valign=top align=left> <td> - <code>H5Z_FILTER_DEFLATE</code></td><td>The gzip compression, + <code>H5Z_FILTER_DEFLATE</code></td><td>The gzip compression, or deflation, filter </td></tr><tr><td> <code>H5Z_FILTER_SZIP</code></td><td>The SZIP compression filter </td></tr><tr><td> <code>H5Z_FILTER_SHUFFLE</code></td><td>The shuffle algorithm filter </td></tr><tr><td> - <code>H5Z_FILTER_FLETCHER32 </code></td><td>The Fletcher32 checksum, + <code>H5Z_FILTER_FLETCHER32 </code></td><td>The Fletcher32 checksum, or error checking, filter </td></tr> </table> -Custom filters that have been registered with the library will have +Custom filters that have been registered with the library will have additional unique identifiers. <p> See <a href="Datasets.html"><cite>The Dataset Interface (H5D)</cite></a> @@ -162,6 +162,7 @@ in the <cite>HDF5 User's Guide</cite> for further information regarding data compression. <!-- NEW PAGE --> +<!-- HEADER RIGHT " " --> <!-- NEW PAGE --> <!-- HEADER RIGHT "H5Zfilter_avail" --> <hr> @@ -301,7 +302,8 @@ END SUBROUTINE h5zfilter_avail_f <dd>Returns a non-negative value on success, a negative value on failure. -<dt><strong>Fortran90 Interface:</strong> +<!-- NEW PAGE --> +<dt><strong>Fortran90 Interface:</strong> <dd> <pre> SUBROUTINE h5zget_filter_info_f(filter, config_flags, hdferr) diff --git a/doc/html/References.html b/doc/html/References.html index 2b7b4cf..766b92c 100644 --- a/doc/html/References.html +++ b/doc/html/References.html @@ -339,7 +339,7 @@ write the dataset to the file. href_t data[10][10]; /* HDF5 reference type */ int rank; size_t dimsf[2]; - hssize_t start[3],count[3]; + hsize_t start[3],count[3]; int i, j; /* Open the file */ diff --git a/doc/html/Tutor/examples/h5_copy.c b/doc/html/Tutor/examples/h5_copy.c index b0a5e00..357596b 100644 --- a/doc/html/Tutor/examples/h5_copy.c +++ b/doc/html/Tutor/examples/h5_copy.c @@ -38,7 +38,7 @@ int main (void) int bufnew[DIM1][DIM2]; int val[] = {53, 59}; hsize_t marray[] = {2}; - hssize_t coord[NUMP][RANK]; + hsize_t coord[NUMP][RANK]; herr_t ret; uint i, j; @@ -95,7 +95,7 @@ int main (void) coord[0][0] = 0; coord[0][1] = 3; coord[1][0] = 0; coord[1][1] = 1; - ret = H5Sselect_elements (fid1, H5S_SELECT_SET, NUMP, (const hssize_t **)coord); + ret = H5Sselect_elements (fid1, H5S_SELECT_SET, NUMP, (const hsize_t **)coord); ret = H5Dwrite (dataset1, H5T_NATIVE_INT, mid1, fid1, H5P_DEFAULT, val); diff --git a/doc/html/Tutor/examples/h5_extend.c b/doc/html/Tutor/examples/h5_extend.c index ae26ed6..1f81827 100644 --- a/doc/html/Tutor/examples/h5_extend.c +++ b/doc/html/Tutor/examples/h5_extend.c @@ -32,7 +32,7 @@ main (void) hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; hsize_t size[2]; - hssize_t offset[2]; + hsize_t offset[2]; hsize_t i,j; herr_t status, status_n; int data1[3][3] = { {1, 1, 1}, /* data to write */ diff --git a/doc/html/Tutor/examples/h5_hyperslab.c b/doc/html/Tutor/examples/h5_hyperslab.c index fc953d5..120e30d 100644 --- a/doc/html/Tutor/examples/h5_hyperslab.c +++ b/doc/html/Tutor/examples/h5_hyperslab.c @@ -40,9 +40,9 @@ main (void) int data_out[NX][NY][NZ ]; /* output buffer */ hsize_t count[2]; /* size of the hyperslab in the file */ - hssize_t offset[2]; /* hyperslab offset in the file */ + hsize_t offset[2]; /* hyperslab offset in the file */ hsize_t count_out[3]; /* size of the hyperslab in memory */ - hssize_t offset_out[3]; /* hyperslab offset in memory */ + hsize_t offset_out[3]; /* hyperslab offset in memory */ int i, j, k, status_n, rank; diff --git a/doc/html/Tutor/examples/h5_read.c b/doc/html/Tutor/examples/h5_read.c index 31cb882..8f2f179 100644 --- a/doc/html/Tutor/examples/h5_read.c +++ b/doc/html/Tutor/examples/h5_read.c @@ -36,9 +36,9 @@ main (void) int data_out[NX][NY][NZ ]; /* output buffer */ hsize_t count[2]; /* size of the hyperslab in the file */ - hssize_t offset[2]; /* hyperslab offset in the file */ + hsize_t offset[2]; /* hyperslab offset in the file */ hsize_t count_out[3]; /* size of the hyperslab in memory */ - hssize_t offset_out[3]; /* hyperslab offset in memory */ + hsize_t offset_out[3]; /* hyperslab offset in memory */ int i, j, k, status_n, rank; for (j = 0; j < NX; j++) { diff --git a/doc/html/Tutor/examples/h5_ref2regr.c b/doc/html/Tutor/examples/h5_ref2regr.c index 26b5daf..9f747ae 100644 --- a/doc/html/Tutor/examples/h5_ref2regr.c +++ b/doc/html/Tutor/examples/h5_ref2regr.c @@ -24,8 +24,8 @@ main(void) hid_t sid1, /* Dataspace ID #1 */ sid2; /* Dataspace ID #2 */ hsize_t * coords; /* Coordinate buffer */ - hssize_t low[SPACE2_RANK]; /* Selection bounds */ - hssize_t high[SPACE2_RANK]; /* Selection bounds */ + hsize_t low[SPACE2_RANK]; /* Selection bounds */ + hsize_t high[SPACE2_RANK]; /* Selection bounds */ hdset_reg_ref_t *rbuf; /* buffer to to read disk */ int *drbuf; /* Buffer for reading numeric data from disk */ int i, j; /* counting variables */ diff --git a/doc/html/Tutor/examples/h5_ref2regw.c b/doc/html/Tutor/examples/h5_ref2regw.c index 5f27950..35352f8 100644 --- a/doc/html/Tutor/examples/h5_ref2regw.c +++ b/doc/html/Tutor/examples/h5_ref2regw.c @@ -18,18 +18,18 @@ int main(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dset1, /* Dataset ID */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dset1, /* Dataset ID */ dset2; /* Dereferenced dataset ID */ - hid_t sid1, /* Dataspace ID #1 */ + hid_t sid1, /* Dataspace ID #1 */ sid2; /* Dataspace ID #2 */ - hsize_t dims1[] = {SPACE1_DIM1}, + hsize_t dims1[] = {SPACE1_DIM1}, dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ - hssize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ hdset_reg_ref_t *wbuf; /* buffer to write to disk */ int *dwbuf; /* Buffer for writing numeric data to disk */ @@ -88,7 +88,7 @@ main(void) coord1[7][0]=9; coord1[7][1]=0; coord1[8][0]=7; coord1[8][1]=1; coord1[9][0]=3; coord1[9][1]=3; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1); + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); /* Store second dataset region */ ret = H5Rcreate(&wbuf[1],fid1,"/Dataset2",H5R_DATASET_REGION,sid2); diff --git a/doc/html/Tutor/examples/refregexample.f90 b/doc/html/Tutor/examples/refregexample.f90 index 05fcf3f..5d72f1e 100644 --- a/doc/html/Tutor/examples/refregexample.f90 +++ b/doc/html/Tutor/examples/refregexample.f90 @@ -27,13 +27,13 @@ TYPE(hdset_reg_ref_t_f) , DIMENSION(2) :: ref_out ! INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/2,9/) ! Datasets dimensions INTEGER(HSIZE_T), DIMENSION(1) :: dimsr = (/2/) ! - INTEGER(HSSIZE_T), DIMENSION(2) :: start + INTEGER(HSIZE_T), DIMENSION(2) :: start INTEGER(HSIZE_T), DIMENSION(2) :: count INTEGER :: rankr = 1 INTEGER :: rank = 2 INTEGER , DIMENSION(2,9) :: data INTEGER , DIMENSION(2,9) :: data_out = 0 - INTEGER(HSSIZE_T) , DIMENSION(2,3) :: coord + INTEGER(HSIZE_T) , DIMENSION(2,3) :: coord INTEGER(SIZE_T) ::num_points = 3 ! Number of selected points INTEGER :: i, j INTEGER :: ref_size diff --git a/doc/html/Tutor/examples/selectele.f90 b/doc/html/Tutor/examples/selectele.f90 index c75958c..8727bd9 100644 --- a/doc/html/Tutor/examples/selectele.f90 +++ b/doc/html/Tutor/examples/selectele.f90 @@ -38,7 +38,7 @@ ! Memory dataspace dimensions INTEGER(HSIZE_T), DIMENSION(2) :: dimsf = (/3,4/) ! File dataspace dimensions - INTEGER(HSSIZE_T), DIMENSION(RANK,NUMP) :: coord ! Elements coordinates + INTEGER(HSIZE_T), DIMENSION(RANK,NUMP) :: coord ! Elements coordinates ! in the file INTEGER, DIMENSION(3,4) :: buf1, buf2, bufnew ! Data buffers diff --git a/doc/html/Tutor/select.html b/doc/html/Tutor/select.html index b8381e5..b4109b0 100644 --- a/doc/html/Tutor/select.html +++ b/doc/html/Tutor/select.html @@ -195,7 +195,7 @@ add to the current selected region for a specified dataspace. <I><B>C</B></I>: <pre> herr_t H5Sselect_hyperslab (hid_t space_id, H5S_seloper_t operator, - const hssize_t *start, const hsize_t *stride, + const hsize_t *start, const hsize_t *stride, const hsize_t *count, const hsize_t *block ) </pre> <P> @@ -206,7 +206,7 @@ add to the current selected region for a specified dataspace. space_id IN: INTEGER(HID_T) operator IN: INTEGER - start IN: INTEGER(HSSIZE_T), DIMENSION(*) + start IN: INTEGER(HSIZE_T), DIMENSION(*) count IN: INTEGER(HSIZE_T), DIMENSION(*) hdferr OUT: INTEGER stride IN: INTEGER(HSIZE_T), DIMENSION(*), OPTIONAL diff --git a/doc/html/Tutor/selectc.html b/doc/html/Tutor/selectc.html index c73b754..59c464c 100644 --- a/doc/html/Tutor/selectc.html +++ b/doc/html/Tutor/selectc.html @@ -71,7 +71,7 @@ included in the selection for a dataspace: <pre> herr_t H5Sselect_elements (hid_t space_id, H5S_seloper_t operator, size_t num_elements, - const hssize_t **coord ) + const hsize_t **coord ) </pre> <P> <I><B>FORTRAN</B></I>: @@ -81,7 +81,7 @@ included in the selection for a dataspace: space_id IN: INTEGER(HID_T) operator IN: INTEGER num_elements IN: INTEGER - coord IN: INTEGER(HSSIZE_T), DIMENSION(*,*) + coord IN: INTEGER(HSIZE_T), DIMENSION(*,*) hdferr OUT: INTEGER </pre> <P> diff --git a/doc/html/cpplus/CppInterfaces.html b/doc/html/cpplus/CppInterfaces.html index 66bddfd..f8f37f2 100644 --- a/doc/html/cpplus/CppInterfaces.html +++ b/doc/html/cpplus/CppInterfaces.html @@ -253,10 +253,10 @@ class CompType : public DataType int getNmembers() const; // Returns the name of a member of this compound datatype. - string getMemberName( int member_num ) const; + string getMemberName( unsigned member_num ) const; // Returns the offset of a member of this compound datatype. - size_t getMemberOffset( int memb_no ) const; + size_t getMemberOffset( unsigned memb_no ) const; // Returns the dimensionality of the specified member of this compound datatype. int getMemberDims( int member_num, size_t* dims, int* perm ) const; @@ -264,7 +264,7 @@ class CompType : public DataType // Returns the type class of the specified member of this compound // datatype. It provides to the user a way of knowing what type // to create another datatype of the same class. - H5T_class_t getMemberClass( int member_num ) const; + H5T_class_t getMemberClass( unsigned member_num ) const; // Returns the generic datatype of the specified member in // this compound datatype. @@ -405,7 +405,7 @@ class DataSpace : public IdComponent // Selects array elements to be included in the selection for // this dataspace. - void selectElements ( H5S_seloper_t op, const size_t num_elements, const hssize_t* coord[ ] ) const; + void selectElements ( H5S_seloper_t op, const size_t num_elements, const hsize_t* coord[ ] ) const; // Selects the entire dataspace. void selectAll () const; @@ -417,7 +417,7 @@ class DataSpace : public IdComponent bool selectValid () const; // Selects a hyperslab region to add to the current selected region. - void selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hssize_t *start, const hsize_t *stride = NULL, const hsize_t *block = NULL ) const; + void selectHyperslab( H5S_seloper_t op, const hsize_t *count, const hsize_t *start, const hsize_t *stride = NULL, const hsize_t *block = NULL ) const; // Default constructor DataSpace(); @@ -560,7 +560,7 @@ class DSetCreatPropList : public PropList int getExternalCount() const; // Returns information about an external file - void getExternal( int idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const; + void getExternal( unsigned idx, size_t name_size, char* name, off_t& offset, hsize_t& size ) const; // Creates a copy of an existing dataset creation property list // using the property list id @@ -674,7 +674,7 @@ class EnumType : public DataType void valueOf( const char* name, void *value ) const; // Returns the value of an enumeration datatype member - void getMemberValue( int memb_no, void *value ) const; + void getMemberValue( unsigned memb_no, void *value ) const; // Default constructor EnumType(); @@ -872,7 +872,7 @@ class FileCreatPropList : public PropList FileCreatPropList& operator=( const FileCreatPropList& rhs ); // Retrieves version information for various parts of a file. - void getVersion( int& boot, int& freelist, int& stab, int& shhdr ) const; + void getVersion( unsigned& boot, unsigned& freelist, unsigned& stab, unsigned& shhdr ) const; // Sets the userblock size field of a file creation property list. void setUserblock( hsize_t size ) const; @@ -888,18 +888,18 @@ class FileCreatPropList : public PropList void getSizes( size_t& sizeof_addr, size_t& sizeof_size ) const; // Sets the size of parameters used to control the symbol table nodes. - void setSymk( int int_nodes_k, int leaf_nodes_k ) const; + void setSymk( unsigned int_nodes_k, unsigned leaf_nodes_k ) const; // Retrieves the size of the symbol table B-tree 1/2 rank and the // symbol table leaf node 1/2 size. - void getSymk( int& int_nodes_k, int& leaf_nodes_k ) const; + void getSymk( unsigned& int_nodes_k, unsigned& leaf_nodes_k ) const; // Sets the size of parameter used to control the B-trees for // indexing chunked datasets. - void setIstorek( int ik ) const; + void setIstorek( unsigned ik ) const; // Returns the 1/2 rank of an indexed storage B-tree. - int getIstorek() const; + unsigned getIstorek() const; // Creates a copy of an existing file create property list // using the property list id. diff --git a/doc/html/h5s.examples b/doc/html/h5s.examples index e7a479f..688382f 100644 --- a/doc/html/h5s.examples +++ b/doc/html/h5s.examples @@ -51,7 +51,7 @@ Example 2: Create a simple fixed size 3-D dataspace in memory and on disk and hid_t dataset; /* Dataset ID */ hid_t mem_space, file_space; /* Dataspaces for memory and the file */ uint8 *buf; /* Buffer for data */ - hssize_t start[3]={3,4,5}; /* Start of hyperslab */ + hsize_t start[3]={3,4,5}; /* Start of hyperslab */ hsize_t stride[3]={1,2,2}; /* Stride for hyperslab */ hsize_t count[3]={3,3,3}; /* Hyperslab block count in each dimension */ hsize_t block[3]={2,2,2}; /* Hyperslab block size in each dimension */ @@ -169,7 +169,7 @@ Example 4: Create a simple fixed size 3-D dataspace in memory and on disk and hid_t dataset; /* Dataset ID */ hid_t mem_space, file_space; /* Dataspaces for memory and the file */ uint8 *buf; /* Buffer for data */ - hssize_t start[3]; /* Start of hyperslab */ + hsize_t start[3]; /* Start of hyperslab */ hsize_t stride[3]; /* Stride for hyperslab */ hsize_t count[3]; /* Hyperslab block count in each dimension */ hsize_t block[3]; /* Hyperslab block size in each dimension */ @@ -299,7 +299,7 @@ Example 6: Create a stored dataspace on disk and use the H5Ssubspace function { hid_t file; /* File ID */ hid_t space1, space2; /* Dataspace IDs */ - hssize_t start[3]; /* Start of hyperslab */ + hsize_t start[3]; /* Start of hyperslab */ hsize_t count[3]; /* Hyperslab block count in each dimension */ hsize_t curr_dims[3]={13,14,15};/* Dimensions of the dataset */ diff --git a/doc/html/ph5example.c b/doc/html/ph5example.c index 84f5ab7..a69f221 100644 --- a/doc/html/ph5example.c +++ b/doc/html/ph5example.c @@ -70,7 +70,7 @@ int dowrite=1; /* write test */ * Assume dimension rank is 2. */ void -slab_set(hssize_t start[], hsize_t count[], hsize_t stride[], int mode) +slab_set(hsize_t start[], hsize_t count[], hsize_t stride[], int mode) { switch (mode){ case BYROW: @@ -110,7 +110,7 @@ slab_set(hssize_t start[], hsize_t count[], hsize_t stride[], int mode) * Assume dimension rank is 2 and data is stored contiguous. */ void -dataset_fill(hssize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset) +dataset_fill(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset) { DATATYPE *dataptr = dataset; int i, j; @@ -127,7 +127,7 @@ dataset_fill(hssize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dat /* * Print the content of the dataset. */ -void dataset_print(hssize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset) +void dataset_print(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset) { DATATYPE *dataptr = dataset; int i, j; @@ -146,7 +146,7 @@ void dataset_print(hssize_t start[], hsize_t count[], hsize_t stride[], DATATYPE /* * Print the content of the dataset. */ -int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *dataset, DATATYPE *original) +int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *dataset, DATATYPE *original) { #define MAX_ERR_REPORT 10 /* Maximum number of errors reported */ DATATYPE *dataptr = dataset; @@ -204,7 +204,7 @@ phdf5writeInd(char *filename) {SPACE1_DIM1,SPACE1_DIM2}; /* local dataspace dim sizes */ DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */ - hssize_t start[SPACE1_RANK]; /* for hyperslab setting */ + hsize_t start[SPACE1_RANK]; /* for hyperslab setting */ hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */ herr_t ret; /* Generic return value */ @@ -342,7 +342,7 @@ phdf5readInd(char *filename) DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */ DATATYPE data_origin1[SPACE1_DIM1][SPACE1_DIM2]; /* expected data buffer */ - hssize_t start[SPACE1_RANK]; /* for hyperslab setting */ + hsize_t start[SPACE1_RANK]; /* for hyperslab setting */ hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */ herr_t ret; /* Generic return value */ @@ -466,7 +466,7 @@ phdf5writeAll(char *filename) {SPACE1_DIM1,SPACE1_DIM2}; /* dataspace dim sizes */ DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */ - hssize_t start[SPACE1_RANK]; /* for hyperslab setting */ + hsize_t start[SPACE1_RANK]; /* for hyperslab setting */ hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */ herr_t ret; /* Generic return value */ @@ -670,7 +670,7 @@ phdf5readAll(char *filename) DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */ DATATYPE data_origin1[SPACE1_DIM1][SPACE1_DIM2]; /* expected data buffer */ - hssize_t start[SPACE1_RANK]; /* for hyperslab setting */ + hsize_t start[SPACE1_RANK]; /* for hyperslab setting */ hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */ herr_t ret; /* Generic return value */ diff --git a/examples/h5_attribute.c b/examples/h5_attribute.c index 5b3c4f4..76609ec 100644 --- a/examples/h5_attribute.c +++ b/examples/h5_attribute.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * diff --git a/examples/h5_chunk_read.c b/examples/h5_chunk_read.c index c6bf728..af87c10 100644 --- a/examples/h5_chunk_read.c +++ b/examples/h5_chunk_read.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * @@ -39,7 +38,7 @@ main (void) hsize_t chunk_dims[2]; hsize_t col_dims[1]; hsize_t count[2]; - hssize_t offset[2]; + hsize_t offset[2]; herr_t status, status_n; @@ -68,24 +67,6 @@ main (void) rank, (unsigned long)(dims[0]), (unsigned long)(dims[1])); /* - * Get creation properties list. - */ - cparms = H5Dget_create_plist(dataset); /* Get properties handle first. */ - - /* - * Check if dataset is chunked. - */ - if (H5D_CHUNKED == H5Pget_layout(cparms)) { - - /* - * Get chunking information: rank and dimensions - */ - rank_chunk = H5Pget_chunk(cparms, 2, chunk_dims); - printf("chunk rank %d, dimensions %lu x %lu\n", rank_chunk, - (unsigned long)(chunk_dims[0]), (unsigned long)(chunk_dims[1])); - } - - /* * Define the memory space to read dataset. */ memspace = H5Screate_simple(RANK,dims,NULL); @@ -103,6 +84,11 @@ main (void) } /* + * Close/release resources. + */ + H5Sclose(memspace); + + /* * dataset rank 2, dimensions 10 x 5 * chunk rank 2, dimensions 2 x 5 @@ -145,6 +131,11 @@ main (void) } /* + * Close/release resources. + */ + H5Sclose(memspace); + + /* * Third column: * 1 * 1 @@ -159,36 +150,56 @@ main (void) */ /* - * Define the memory space to read a chunk. + * Get creation properties list. */ - memspace = H5Screate_simple(rank_chunk,chunk_dims,NULL); + cparms = H5Dget_create_plist(dataset); /* Get properties handle first. */ - /* - * Define chunk in the file (hyperslab) to read. - */ - offset[0] = 2; - offset[1] = 0; - count[0] = chunk_dims[0]; - count[1] = chunk_dims[1]; - status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, - count, NULL); + if (H5D_CHUNKED == H5Pget_layout(cparms)) { - /* - * Read chunk back and display. - */ - status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace, - H5P_DEFAULT, chunk_out); - printf("\n"); - printf("Chunk: \n"); - for (j = 0; j < chunk_dims[0]; j++) { - for (i = 0; i < chunk_dims[1]; i++) printf("%d ", chunk_out[j][i]); - printf("\n"); - } - /* - * Chunk: - * 1 1 1 0 0 - * 2 0 0 0 0 - */ + /* + * Get chunking information: rank and dimensions + */ + rank_chunk = H5Pget_chunk(cparms, 2, chunk_dims); + printf("chunk rank %d, dimensions %lu x %lu\n", rank_chunk, + (unsigned long)(chunk_dims[0]), (unsigned long)(chunk_dims[1])); + + /* + * Define the memory space to read a chunk. + */ + memspace = H5Screate_simple(rank_chunk,chunk_dims,NULL); + + /* + * Define chunk in the file (hyperslab) to read. + */ + offset[0] = 2; + offset[1] = 0; + count[0] = chunk_dims[0]; + count[1] = chunk_dims[1]; + status = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, + count, NULL); + + /* + * Read chunk back and display. + */ + status = H5Dread(dataset, H5T_NATIVE_INT, memspace, filespace, + H5P_DEFAULT, chunk_out); + printf("\n"); + printf("Chunk: \n"); + for (j = 0; j < chunk_dims[0]; j++) { + for (i = 0; i < chunk_dims[1]; i++) printf("%d ", chunk_out[j][i]); + printf("\n"); + } + /* + * Chunk: + * 1 1 1 0 0 + * 2 0 0 0 0 + */ + + /* + * Close/release resources. + */ + H5Sclose(memspace); + } /* * Close/release resources. @@ -196,7 +207,6 @@ main (void) H5Pclose(cparms); H5Dclose(dataset); H5Sclose(filespace); - H5Sclose(memspace); H5Fclose(file); return 0; diff --git a/examples/h5_compound.c b/examples/h5_compound.c index 6cde056..1819734 100644 --- a/examples/h5_compound.c +++ b/examples/h5_compound.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * diff --git a/examples/h5_drivers.c b/examples/h5_drivers.c index 51c7657..ebe870b 100644 --- a/examples/h5_drivers.c +++ b/examples/h5_drivers.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * diff --git a/examples/h5_dtransform.c b/examples/h5_dtransform.c index 153778a..3c15eec 100644 --- a/examples/h5_dtransform.c +++ b/examples/h5_dtransform.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * diff --git a/examples/h5_extend_write.c b/examples/h5_extend_write.c index 862cb98..bcb9949 100644 --- a/examples/h5_extend_write.c +++ b/examples/h5_extend_write.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * @@ -46,7 +45,7 @@ main (void) hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; hsize_t chunk_dims[2] ={2, 5}; hsize_t size[2]; - hssize_t offset[2]; + hsize_t offset[2]; herr_t status; diff --git a/examples/h5_group.c b/examples/h5_group.c index f82978d..4e3eac1 100644 --- a/examples/h5_group.c +++ b/examples/h5_group.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * diff --git a/examples/h5_mount.c b/examples/h5_mount.c index 0811a09..7075201 100644 --- a/examples/h5_mount.c +++ b/examples/h5_mount.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * diff --git a/examples/h5_read.c b/examples/h5_read.c index 213bf47..9d57351 100644 --- a/examples/h5_read.c +++ b/examples/h5_read.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * @@ -51,9 +50,9 @@ main (void) int data_out[NX][NY][NZ ]; /* output buffer */ hsize_t count[2]; /* size of the hyperslab in the file */ - hssize_t offset[2]; /* hyperslab offset in the file */ + hsize_t offset[2]; /* hyperslab offset in the file */ hsize_t count_out[3]; /* size of the hyperslab in memory */ - hssize_t offset_out[3]; /* hyperslab offset in memory */ + hsize_t offset_out[3]; /* hyperslab offset in memory */ int i, j, k, status_n, rank; for (j = 0; j < NX; j++) { diff --git a/examples/h5_reference.c b/examples/h5_reference.c index 7e159d1..45f8850 100644 --- a/examples/h5_reference.c +++ b/examples/h5_reference.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * diff --git a/examples/h5_select.c b/examples/h5_select.c index 498795c..0c34b1a 100644 --- a/examples/h5_select.c +++ b/examples/h5_select.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * @@ -67,12 +66,12 @@ main (void) read selection from the dataset on the disk */ - hssize_t start[2]; /* Start of hyperslab */ + hsize_t start[2]; /* Start of hyperslab */ hsize_t stride[2]; /* Stride of hyperslab */ hsize_t count[2]; /* Block count */ hsize_t block[2]; /* Block sizes */ - hssize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points + hsize_t coord[NPOINTS][FSPACE_RANK]; /* Array to store selected points from the file dataspace */ herr_t ret; unsigned i,j; @@ -171,7 +170,7 @@ main (void) coord[3][0] = 5; coord[3][1] = 6; ret = H5Sselect_elements(fid, H5S_SELECT_SET, NPOINTS, - (const hssize_t **)coord); + (const hsize_t **)coord); /* * Write new selection of points to the dataset. diff --git a/examples/h5_write.c b/examples/h5_write.c index 2c52fa7..8cc4b8f 100644 --- a/examples/h5_write.c +++ b/examples/h5_write.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * diff --git a/examples/ph5example.c b/examples/ph5example.c index c79d0ee..b2929ab 100644 --- a/examples/ph5example.c +++ b/examples/ph5example.c @@ -1,4 +1,3 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * @@ -96,10 +95,10 @@ int dowrite=1; /* write test */ int docleanup=1; /* cleanup */ /* Prototypes */ -void slab_set(hssize_t start[], hsize_t count[], hsize_t stride[], int mode); -void dataset_fill(hssize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset); -void dataset_print(hssize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset); -int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *dataset, DATATYPE *original); +void slab_set(hsize_t start[], hsize_t count[], hsize_t stride[], int mode); +void dataset_fill(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset); +void dataset_print(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset); +int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *dataset, DATATYPE *original); void phdf5writeInd(char *filename); void phdf5readInd(char *filename); void phdf5writeAll(char *filename); @@ -117,7 +116,7 @@ void cleanup(void); * Assume dimension rank is 2. */ void -slab_set(hssize_t start[], hsize_t count[], hsize_t stride[], int mode) +slab_set(hsize_t start[], hsize_t count[], hsize_t stride[], int mode) { switch (mode){ case BYROW: @@ -157,10 +156,10 @@ slab_set(hssize_t start[], hsize_t count[], hsize_t stride[], int mode) * Assume dimension rank is 2 and data is stored contiguous. */ void -dataset_fill(hssize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset) +dataset_fill(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset) { DATATYPE *dataptr = dataset; - int i, j; + hsize_t i, j; /* put some trivial data in the data_array */ for (i=0; i < count[0]; i++){ @@ -174,14 +173,14 @@ dataset_fill(hssize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dat /* * Print the content of the dataset. */ -void dataset_print(hssize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset) +void dataset_print(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * dataset) { DATATYPE *dataptr = dataset; - int i, j; + hsize_t i, j; /* print the slab read */ for (i=0; i < count[0]; i++){ - printf("Row %d: ", (int)(i*stride[0]+start[0])); + printf("Row %lu: ", (unsigned long)(i*stride[0]+start[0])); for (j=0; j < count[1]; j++){ printf("%03d ", *dataptr++); } @@ -193,11 +192,12 @@ void dataset_print(hssize_t start[], hsize_t count[], hsize_t stride[], DATATYPE /* * Print the content of the dataset. */ -int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *dataset, DATATYPE *original) +int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], DATATYPE *dataset, DATATYPE *original) { #define MAX_ERR_REPORT 10 /* Maximum number of errors reported */ - int i, j, nerr; + hsize_t i, j; + int nerr; /* print it if verbose */ if (verbose) @@ -209,9 +209,9 @@ int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], DATATYPE * if (*dataset++ != *original++){ nerr++; if (nerr <= MAX_ERR_REPORT){ - printf("Dataset Verify failed at [%d][%d](row %d, col %d): expect %d, got %d\n", - i, j, - (int)(i*stride[0]+start[0]), (int)(j*stride[1]+start[1]), + printf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %d, got %d\n", + (unsigned long)i, (unsigned long)j, + (unsigned long)(i*stride[0]+start[0]), (unsigned long)(j*stride[1]+start[1]), *(dataset-1), *(original-1)); } } @@ -246,7 +246,7 @@ phdf5writeInd(char *filename) {SPACE1_DIM1,SPACE1_DIM2}; /* dataspace dim sizes */ DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */ - hssize_t start[SPACE1_RANK]; /* for hyperslab setting */ + hsize_t start[SPACE1_RANK]; /* for hyperslab setting */ hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */ herr_t ret; /* Generic return value */ @@ -311,8 +311,10 @@ phdf5writeInd(char *filename) stride[0] = 1; stride[1] =1; if (verbose) - printf("start[]=(%d,%d), count[]=(%d,%d), total datapoints=%d\n", - start[0], start[1], count[0], count[1], count[0]*count[1]); + printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], + (unsigned long)count[0], (unsigned long)count[1], + (unsigned long)(count[0]*count[1])); /* put some trivial data in the data_array */ dataset_fill(start, count, stride, &data_array1[0][0]); @@ -373,7 +375,7 @@ phdf5readInd(char *filename) DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */ DATATYPE data_origin1[SPACE1_DIM1][SPACE1_DIM2]; /* expected data buffer */ - hssize_t start[SPACE1_RANK]; /* for hyperslab setting */ + hsize_t start[SPACE1_RANK]; /* for hyperslab setting */ hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */ herr_t ret; /* Generic return value */ @@ -417,8 +419,10 @@ phdf5readInd(char *filename) stride[0] = 1; stride[1] =1; if (verbose) - printf("start[]=(%d,%d), count[]=(%d,%d), total datapoints=%d\n", - start[0], start[1], count[0], count[1], count[0]*count[1]); + printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], + (unsigned long)count[0], (unsigned long)count[1], + (unsigned long)(count[0]*count[1])); /* create a file dataspace independently */ file_dataspace = H5Dget_space (dataset1); @@ -489,7 +493,7 @@ phdf5writeAll(char *filename) {SPACE1_DIM1,SPACE1_DIM2}; /* dataspace dim sizes */ DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */ - hssize_t start[SPACE1_RANK]; /* for hyperslab setting */ + hsize_t start[SPACE1_RANK]; /* for hyperslab setting */ hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */ herr_t ret; /* Generic return value */ @@ -549,8 +553,10 @@ phdf5writeAll(char *filename) /* Dataset1: each process takes a block of rows. */ slab_set(start, count, stride, BYROW); if (verbose) - printf("start[]=(%d,%d), count[]=(%d,%d), total datapoints=%d\n", - start[0], start[1], count[0], count[1], count[0]*count[1]); + printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], + (unsigned long)count[0], (unsigned long)count[1], + (unsigned long)(count[0]*count[1])); /* create a file dataspace independently */ file_dataspace = H5Dget_space (dataset1); @@ -596,8 +602,10 @@ if (verbose) /* Dataset2: each process takes a block of columns. */ slab_set(start, count, stride, BYCOL); if (verbose) - printf("start[]=(%d,%d), count[]=(%d,%d), total datapoints=%d\n", - start[0], start[1], count[0], count[1], count[0]*count[1]); + printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], + (unsigned long)count[0], (unsigned long)count[1], + (unsigned long)(count[0]*count[1])); /* put some trivial data in the data_array */ dataset_fill(start, count, stride, &data_array1[0][0]); @@ -685,7 +693,7 @@ phdf5readAll(char *filename) DATATYPE data_array1[SPACE1_DIM1][SPACE1_DIM2]; /* data buffer */ DATATYPE data_origin1[SPACE1_DIM1][SPACE1_DIM2]; /* expected data buffer */ - hssize_t start[SPACE1_RANK]; /* for hyperslab setting */ + hsize_t start[SPACE1_RANK]; /* for hyperslab setting */ hsize_t count[SPACE1_RANK], stride[SPACE1_RANK]; /* for hyperslab setting */ herr_t ret; /* Generic return value */ @@ -738,8 +746,10 @@ phdf5readAll(char *filename) /* Dataset1: each process takes a block of columns. */ slab_set(start, count, stride, BYCOL); if (verbose) - printf("start[]=(%d,%d), count[]=(%d,%d), total datapoints=%d\n", - start[0], start[1], count[0], count[1], count[0]*count[1]); + printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], + (unsigned long)count[0], (unsigned long)count[1], + (unsigned long)(count[0]*count[1])); /* create a file dataspace independently */ file_dataspace = H5Dget_space (dataset1); @@ -789,8 +799,10 @@ if (verbose) /* Dataset2: each process takes a block of rows. */ slab_set(start, count, stride, BYROW); if (verbose) - printf("start[]=(%d,%d), count[]=(%d,%d), total datapoints=%d\n", - start[0], start[1], count[0], count[1], count[0]*count[1]); + printf("start[]=(%lu,%lu), count[]=(%lu,%lu), total datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], + (unsigned long)count[0], (unsigned long)count[1], + (unsigned long)(count[0]*count[1])); /* create a file dataspace independently */ file_dataspace = H5Dget_space (dataset1); @@ -918,7 +930,7 @@ test_split_comm_access(char filenames[][PATH_MAX]) * Show command usage */ void -usage() +usage(void) { printf("Usage: testphdf5 [-f <prefix>] [-r] [-w] [-v]\n"); printf("\t-f\tfile prefix for parallel test files.\n"); @@ -1111,7 +1123,7 @@ finish: #else /* H5_HAVE_PARALLEL */ /* dummy program since H5_HAVE_PARALLE is not configured in */ int -main() +main(void) { printf("No PHDF5 example because parallel is not configured in\n"); return(0); diff --git a/fortran/examples/attrexample.f90 b/fortran/examples/attrexample.f90 index 1664568..dd29c55 100644 --- a/fortran/examples/attrexample.f90 +++ b/fortran/examples/attrexample.f90 @@ -41,7 +41,7 @@ CHARACTER(LEN=80), DIMENSION(2) :: attr_data ! Attribute data INTEGER :: error ! Error flag - INTEGER(HSIZE_T), DIMENSION(2) :: data_dims + INTEGER(HSIZE_T), DIMENSION(1) :: data_dims ! diff --git a/fortran/examples/compound.f90 b/fortran/examples/compound.f90 index 0cc7fc5..058db2a 100644 --- a/fortran/examples/compound.f90 +++ b/fortran/examples/compound.f90 @@ -62,7 +62,7 @@ DOUBLE PRECISION, DIMENSION(dimsize) :: double_member REAL, DIMENSION(dimsize) :: real_member INTEGER :: i - INTEGER(HSIZE_T), DIMENSION(2) :: data_dims + INTEGER(HSIZE_T), DIMENSION(1) :: data_dims data_dims(1) = dimsize ! ! Initialize data buffer. diff --git a/fortran/examples/refregexample.f90 b/fortran/examples/refregexample.f90 index 5367da8..ab0e0fd 100644 --- a/fortran/examples/refregexample.f90 +++ b/fortran/examples/refregexample.f90 @@ -41,13 +41,13 @@ TYPE(hdset_reg_ref_t_f) , DIMENSION(2) :: ref_out ! INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/2,9/) ! Datasets dimensions INTEGER(HSIZE_T), DIMENSION(1) :: dimsr = (/2/) ! - INTEGER(HSSIZE_T), DIMENSION(2) :: start + INTEGER(HSIZE_T), DIMENSION(2) :: start INTEGER(HSIZE_T), DIMENSION(2) :: count INTEGER :: rankr = 1 INTEGER :: rank = 2 INTEGER , DIMENSION(2,9) :: data INTEGER , DIMENSION(2,9) :: data_out = 0 - INTEGER(HSSIZE_T) , DIMENSION(2,3) :: coord + INTEGER(HSIZE_T) , DIMENSION(2,3) :: coord INTEGER(SIZE_T) ::num_points = 3 ! Number of selected points INTEGER :: i, j INTEGER(HSIZE_T), DIMENSION(1) :: ref_size diff --git a/fortran/examples/selectele.f90 b/fortran/examples/selectele.f90 index f476ec5..096bd3f 100644 --- a/fortran/examples/selectele.f90 +++ b/fortran/examples/selectele.f90 @@ -52,7 +52,7 @@ ! Memory dataspace dimensions INTEGER(HSIZE_T), DIMENSION(2) :: dimsf = (/3,4/) ! File dataspace dimensions - INTEGER(HSSIZE_T), DIMENSION(RANK,NUMP) :: coord ! Elements coordinates + INTEGER(HSIZE_T), DIMENSION(RANK,NUMP) :: coord ! Elements coordinates ! in the file INTEGER, DIMENSION(3,4) :: buf1, buf2, bufnew ! Data buffers diff --git a/fortran/src/H5Af.c b/fortran/src/H5Af.c index a25161e..1541626 100644 --- a/fortran/src/H5Af.c +++ b/fortran/src/H5Af.c @@ -167,7 +167,7 @@ nh5areadc_c (hid_t_f *attr_id, hid_t_f *mem_type_id, _fcd buf, void *dims) /*---------------------------------------------------------------------------- * Name: h5aread_c - * Purpose: Call H5Araed to read an attribute + * Purpose: Call H5Aread to read an attribute * Inputs: dset_id - dataset identifier * mem_type_id - memory datatype identifier * dims - array to store dimensions sizes of buf; used only diff --git a/fortran/src/H5Aff.f90 b/fortran/src/H5Aff.f90 index ee325f5..56d5782 100644 --- a/fortran/src/H5Aff.f90 +++ b/fortran/src/H5Aff.f90 @@ -18,7 +18,13 @@ MODULE H5A USE H5GLOBAL - +! +!On Windows there are no big (integer*8) integers, so overloading +!for bug #670 does not work. I have to use DEC compilation directives to make +!Windows DEC Visual Fortran and OSF compilers happy and do right things. +! 05/01/02 EP + +! INTERFACE h5awrite_f MODULE PROCEDURE h5awrite_integer_scalar @@ -294,6 +300,38 @@ END SUBROUTINE h5aopen_idx_f + SUBROUTINE h5awrite_integer_scalar(attr_id, memtype_id, buf, dims, hdferr) +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5awrite_integer_scalar +!DEC$endif + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + INTEGER, INTENT(IN) :: buf ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + +! INTEGER, EXTERNAL :: h5awrite_c +! MS FORTRAN needs explicit interface for C functions called here. +! + INTERFACE + INTEGER FUNCTION h5awrite_c(attr_id, memtype_id, buf, dims) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5AWRITE_C'::h5awrite_c + !DEC$ ENDIF + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + INTEGER(HID_T), INTENT(IN) :: attr_id + INTEGER(HID_T), INTENT(IN) :: memtype_id + INTEGER, INTENT(IN)::buf + END FUNCTION h5awrite_c + END INTERFACE + + hdferr = h5awrite_c(attr_id, memtype_id, buf, dims) + END SUBROUTINE h5awrite_integer_scalar + SUBROUTINE h5awrite_integer_1(attr_id, memtype_id, buf, dims, hdferr) !This definition is needed for Windows DLLs !DEC$if defined(BUILD_HDF5_DLL) @@ -546,6 +584,38 @@ END SUBROUTINE h5awrite_integer_7 + SUBROUTINE h5awrite_real_scalar(attr_id, memtype_id, buf, dims, hdferr) +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5awrite_real_scalar +!DEC$endif + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + REAL, INTENT(IN) :: buf ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + +! INTEGER, EXTERNAL :: h5awrite_c +! MS FORTRAN needs explicit interface for C functions called here. +! + INTERFACE + INTEGER FUNCTION h5awrite_c(attr_id, memtype_id, buf, dims) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5AWRITE_C'::h5awrite_c + !DEC$ ENDIF + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + INTEGER(HID_T), INTENT(IN) :: attr_id + INTEGER(HID_T), INTENT(IN) :: memtype_id + REAL, INTENT(IN)::buf + END FUNCTION h5awrite_c + END INTERFACE + + hdferr = h5awrite_c(attr_id, memtype_id, buf, dims) + END SUBROUTINE h5awrite_real_scalar + SUBROUTINE h5awrite_real_1(attr_id, memtype_id, buf, dims, hdferr) !This definition is needed for Windows DLLs !DEC$if defined(BUILD_HDF5_DLL) @@ -798,6 +868,38 @@ END SUBROUTINE h5awrite_real_7 + SUBROUTINE h5awrite_double_scalar(attr_id, memtype_id, buf, dims, hdferr) +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5awrite_double_scalar +!DEC$endif + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + DOUBLE PRECISION, INTENT(IN) :: buf ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + +! INTEGER, EXTERNAL :: h5awrite_c +! MS FORTRAN needs explicit interface for C functions called here. +! + INTERFACE + INTEGER FUNCTION h5awrite_c(attr_id, memtype_id, buf, dims) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5AWRITE_C'::h5awrite_c + !DEC$ ENDIF + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + INTEGER(HID_T), INTENT(IN) :: attr_id + INTEGER(HID_T), INTENT(IN) :: memtype_id + DOUBLE PRECISION, INTENT(IN)::buf + END FUNCTION h5awrite_c + END INTERFACE + + hdferr = h5awrite_c(attr_id, memtype_id, buf, dims) + END SUBROUTINE h5awrite_double_scalar + SUBROUTINE h5awrite_double_1(attr_id, memtype_id, buf, dims, hdferr) !This definition is needed for Windows DLLs !DEC$if defined(BUILD_HDF5_DLL) @@ -1048,6 +1150,39 @@ hdferr = h5awrite_c(attr_id, memtype_id, buf, dims) END SUBROUTINE h5awrite_double_7 + SUBROUTINE h5awrite_char_scalar(attr_id, memtype_id, buf, dims, hdferr) +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5awrite_char_scalar +!DEC$endif + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + CHARACTER(LEN=*),INTENT(IN) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code +! INTEGER, EXTERNAL :: h5awritec_c +! MS FORTRAN needs explicit interface for C functions called here. +! + INTERFACE + INTEGER FUNCTION h5awritec_c(attr_id, memtype_id, buf, dims) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5AWRITEC_C'::h5awritec_c + !DEC$ ENDIF + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + !DEC$ATTRIBUTES reference :: buf + INTEGER(HID_T), INTENT(IN) :: attr_id + INTEGER(HID_T), INTENT(IN) :: memtype_id + CHARACTER(LEN=*), INTENT(IN)::buf + END FUNCTION h5awritec_c + END INTERFACE + + hdferr = h5awritec_c(attr_id, memtype_id, buf, dims) + END SUBROUTINE h5awrite_char_scalar + SUBROUTINE h5awrite_char_1(attr_id, memtype_id, buf, dims, hdferr) !This definition is needed for Windows DLLs !DEC$if defined(BUILD_HDF5_DLL) @@ -1299,135 +1434,6 @@ hdferr = h5awritec_c(attr_id, memtype_id, buf, dims) END SUBROUTINE h5awrite_char_7 - SUBROUTINE h5awrite_integer_scalar(attr_id, memtype_id, buf, dims, hdferr) -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) -!DEC$attributes dllexport :: h5awrite_integer_scalar -!DEC$endif - IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier - INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype - ! identifier (in memory) - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - INTEGER, INTENT(IN) :: buf ! Attribute data - INTEGER, INTENT(OUT) :: hdferr ! Error code - -! INTEGER, EXTERNAL :: h5awrite_c -! MS FORTRAN needs explicit interface for C functions called here. -! - INTERFACE - INTEGER FUNCTION h5awrite_c(attr_id, memtype_id, buf, dims) - USE H5GLOBAL - !DEC$ IF DEFINED(HDF5F90_WINDOWS) - !MS$ATTRIBUTES C,reference,alias:'_H5AWRITE_C'::h5awrite_c - !DEC$ ENDIF - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - INTEGER(HID_T), INTENT(IN) :: attr_id - INTEGER(HID_T), INTENT(IN) :: memtype_id - INTEGER, INTENT(IN)::buf - END FUNCTION h5awrite_c - END INTERFACE - - hdferr = h5awrite_c(attr_id, memtype_id, buf, dims) - END SUBROUTINE h5awrite_integer_scalar - - SUBROUTINE h5awrite_real_scalar(attr_id, memtype_id, buf, dims, hdferr) -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) -!DEC$attributes dllexport :: h5awrite_real_scalar -!DEC$endif - IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier - INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype - ! identifier (in memory) - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - REAL, INTENT(IN) :: buf ! Attribute data - INTEGER, INTENT(OUT) :: hdferr ! Error code - -! INTEGER, EXTERNAL :: h5awrite_c -! MS FORTRAN needs explicit interface for C functions called here. -! - INTERFACE - INTEGER FUNCTION h5awrite_c(attr_id, memtype_id, buf, dims) - USE H5GLOBAL - !DEC$ IF DEFINED(HDF5F90_WINDOWS) - !MS$ATTRIBUTES C,reference,alias:'_H5AWRITE_C'::h5awrite_c - !DEC$ ENDIF - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - INTEGER(HID_T), INTENT(IN) :: attr_id - INTEGER(HID_T), INTENT(IN) :: memtype_id - REAL, INTENT(IN)::buf - END FUNCTION h5awrite_c - END INTERFACE - - hdferr = h5awrite_c(attr_id, memtype_id, buf, dims) - END SUBROUTINE h5awrite_real_scalar - - SUBROUTINE h5awrite_double_scalar(attr_id, memtype_id, buf, dims, hdferr) -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) -!DEC$attributes dllexport :: h5awrite_double_scalar -!DEC$endif - IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier - INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype - ! identifier (in memory) - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - DOUBLE PRECISION, INTENT(IN) :: buf ! Attribute data - INTEGER, INTENT(OUT) :: hdferr ! Error code - -! INTEGER, EXTERNAL :: h5awrite_c -! MS FORTRAN needs explicit interface for C functions called here. -! - INTERFACE - INTEGER FUNCTION h5awrite_c(attr_id, memtype_id, buf, dims) - USE H5GLOBAL - !DEC$ IF DEFINED(HDF5F90_WINDOWS) - !MS$ATTRIBUTES C,reference,alias:'_H5AWRITE_C'::h5awrite_c - !DEC$ ENDIF - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - INTEGER(HID_T), INTENT(IN) :: attr_id - INTEGER(HID_T), INTENT(IN) :: memtype_id - DOUBLE PRECISION, INTENT(IN)::buf - END FUNCTION h5awrite_c - END INTERFACE - - hdferr = h5awrite_c(attr_id, memtype_id, buf, dims) - END SUBROUTINE h5awrite_double_scalar - - SUBROUTINE h5awrite_char_scalar(attr_id, memtype_id, buf, dims, hdferr) -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) -!DEC$attributes dllexport :: h5awrite_char_scalar -!DEC$endif - IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier - INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype - ! identifier (in memory) - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - CHARACTER(LEN=*),INTENT(IN) :: buf - ! Attribute data - INTEGER, INTENT(OUT) :: hdferr ! Error code -! INTEGER, EXTERNAL :: h5awritec_c -! MS FORTRAN needs explicit interface for C functions called here. -! - INTERFACE - INTEGER FUNCTION h5awritec_c(attr_id, memtype_id, buf, dims) - USE H5GLOBAL - !DEC$ IF DEFINED(HDF5F90_WINDOWS) - !MS$ATTRIBUTES C,reference,alias:'_H5AWRITEC_C'::h5awritec_c - !DEC$ ENDIF - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - !DEC$ATTRIBUTES reference :: buf - INTEGER(HID_T), INTENT(IN) :: attr_id - INTEGER(HID_T), INTENT(IN) :: memtype_id - CHARACTER(LEN=*), INTENT(IN)::buf - END FUNCTION h5awritec_c - END INTERFACE - - hdferr = h5awritec_c(attr_id, memtype_id, buf, dims) - END SUBROUTINE h5awrite_char_scalar - !---------------------------------------------------------------------- ! Name: h5aread_f ! @@ -1461,6 +1467,38 @@ ! up to 7 dimensions. !---------------------------------------------------------------------- + SUBROUTINE h5aread_integer_scalar(attr_id, memtype_id, buf, dims, hdferr) +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5aread_integer_scalar +!DEC$endif + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + INTEGER, INTENT(OUT) :: buf ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + +! INTEGER, EXTERNAL :: h5aread_c +! MS FORTRAN needs explicit interface for C functions called here. +! + INTERFACE + INTEGER FUNCTION h5aread_c(attr_id, memtype_id, buf, dims) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5AREAD_C'::h5aread_c + !DEC$ ENDIF + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + INTEGER(HID_T), INTENT(IN) :: attr_id + INTEGER(HID_T), INTENT(IN) :: memtype_id + INTEGER, INTENT(OUT)::buf + END FUNCTION h5aread_c + END INTERFACE + + hdferr = h5aread_c(attr_id, memtype_id, buf, dims) + END SUBROUTINE h5aread_integer_scalar + SUBROUTINE h5aread_integer_1(attr_id, memtype_id, buf, dims, hdferr) !This definition is needed for Windows DLLs !DEC$if defined(BUILD_HDF5_DLL) @@ -1710,6 +1748,38 @@ END SUBROUTINE h5aread_integer_7 + SUBROUTINE h5aread_real_scalar(attr_id, memtype_id, buf, dims, hdferr) +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5aread_real_scalar +!DEC$endif + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + REAL, INTENT(OUT) :: buf ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + +! INTEGER, EXTERNAL :: h5aread_c +! MS FORTRAN needs explicit interface for C functions called here. +! + INTERFACE + INTEGER FUNCTION h5aread_c(attr_id, memtype_id, buf, dims) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5AREAD_C'::h5aread_c + !DEC$ ENDIF + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + INTEGER(HID_T), INTENT(IN) :: attr_id + INTEGER(HID_T), INTENT(IN) :: memtype_id + REAL, INTENT(OUT)::buf + END FUNCTION h5aread_c + END INTERFACE + + hdferr = h5aread_c(attr_id, memtype_id, buf, dims) + END SUBROUTINE h5aread_real_scalar + SUBROUTINE h5aread_real_1(attr_id, memtype_id, buf, dims, hdferr) !This definition is needed for Windows DLLs !DEC$if defined(BUILD_HDF5_DLL) @@ -1962,6 +2032,38 @@ END SUBROUTINE h5aread_real_7 + SUBROUTINE h5aread_double_scalar(attr_id, memtype_id, buf, dims, hdferr) +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5aread_double_scalar +!DEC$endif + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + DOUBLE PRECISION, INTENT(OUT) :: buf ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + +! INTEGER, EXTERNAL :: h5aread_c +! MS FORTRAN needs explicit interface for C functions called here. +! + INTERFACE + INTEGER FUNCTION h5aread_c(attr_id, memtype_id, buf, dims) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5AREAD_C'::h5aread_c + !DEC$ ENDIF + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + INTEGER(HID_T), INTENT(IN) :: attr_id + INTEGER(HID_T), INTENT(IN) :: memtype_id + DOUBLE PRECISION, INTENT(OUT)::buf + END FUNCTION h5aread_c + END INTERFACE + + hdferr = h5aread_c(attr_id, memtype_id, buf, dims) + END SUBROUTINE h5aread_double_scalar + SUBROUTINE h5aread_double_1(attr_id, memtype_id, buf, dims, hdferr) !This definition is needed for Windows DLLs !DEC$if defined(BUILD_HDF5_DLL) @@ -2214,6 +2316,40 @@ END SUBROUTINE h5aread_double_7 + SUBROUTINE h5aread_char_scalar(attr_id, memtype_id, buf, dims, hdferr) +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5aread_char_scalar +!DEC$endif + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier + INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype + ! identifier (in memory) + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + CHARACTER(LEN=*), INTENT(OUT) :: buf + ! Attribute data + INTEGER, INTENT(OUT) :: hdferr ! Error code + +! INTEGER, EXTERNAL :: h5areadc_c +! MS FORTRAN needs explicit interface for C functions called here. +! + INTERFACE + INTEGER FUNCTION h5areadc_c(attr_id, memtype_id, buf, dims) + USE H5GLOBAL + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5AREADC_C'::h5areadc_c + !DEC$ ENDIF + !DEC$ATTRIBUTES reference :: buf + INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes + INTEGER(HID_T), INTENT(IN) :: attr_id + INTEGER(HID_T), INTENT(IN) :: memtype_id + CHARACTER(LEN=*) :: buf + END FUNCTION h5areadc_c + END INTERFACE + + hdferr = h5areadc_c(attr_id, memtype_id, buf, dims) + END SUBROUTINE h5aread_char_scalar + SUBROUTINE h5aread_char_1(attr_id, memtype_id, buf, dims, hdferr) !This definition is needed for Windows DLLs !DEC$if defined(BUILD_HDF5_DLL) @@ -2472,136 +2608,6 @@ hdferr = h5areadc_c(attr_id, memtype_id, buf, dims) END SUBROUTINE h5aread_char_7 - SUBROUTINE h5aread_integer_scalar(attr_id, memtype_id, buf, dims, hdferr) -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) -!DEC$attributes dllexport :: h5aread_integer_scalar -!DEC$endif - IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier - INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype - ! identifier (in memory) - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - INTEGER, INTENT(OUT) :: buf ! Attribute data - INTEGER, INTENT(OUT) :: hdferr ! Error code - -! INTEGER, EXTERNAL :: h5aread_c -! MS FORTRAN needs explicit interface for C functions called here. -! - INTERFACE - INTEGER FUNCTION h5aread_c(attr_id, memtype_id, buf, dims) - USE H5GLOBAL - !DEC$ IF DEFINED(HDF5F90_WINDOWS) - !MS$ATTRIBUTES C,reference,alias:'_H5AREAD_C'::h5aread_c - !DEC$ ENDIF - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - INTEGER(HID_T), INTENT(IN) :: attr_id - INTEGER(HID_T), INTENT(IN) :: memtype_id - INTEGER, INTENT(OUT)::buf - END FUNCTION h5aread_c - END INTERFACE - - hdferr = h5aread_c(attr_id, memtype_id, buf, dims) - END SUBROUTINE h5aread_integer_scalar - - SUBROUTINE h5aread_real_scalar(attr_id, memtype_id, buf, dims, hdferr) -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) -!DEC$attributes dllexport :: h5aread_real_scalar -!DEC$endif - IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier - INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype - ! identifier (in memory) - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - REAL, INTENT(OUT) :: buf ! Attribute data - INTEGER, INTENT(OUT) :: hdferr ! Error code - -! INTEGER, EXTERNAL :: h5aread_c -! MS FORTRAN needs explicit interface for C functions called here. -! - INTERFACE - INTEGER FUNCTION h5aread_c(attr_id, memtype_id, buf, dims) - USE H5GLOBAL - !DEC$ IF DEFINED(HDF5F90_WINDOWS) - !MS$ATTRIBUTES C,reference,alias:'_H5AREAD_C'::h5aread_c - !DEC$ ENDIF - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - INTEGER(HID_T), INTENT(IN) :: attr_id - INTEGER(HID_T), INTENT(IN) :: memtype_id - REAL, INTENT(OUT)::buf - END FUNCTION h5aread_c - END INTERFACE - - hdferr = h5aread_c(attr_id, memtype_id, buf, dims) - END SUBROUTINE h5aread_real_scalar - - SUBROUTINE h5aread_double_scalar(attr_id, memtype_id, buf, dims, hdferr) -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) -!DEC$attributes dllexport :: h5aread_double_scalar -!DEC$endif - IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier - INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype - ! identifier (in memory) - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - DOUBLE PRECISION, INTENT(OUT) :: buf ! Attribute data - INTEGER, INTENT(OUT) :: hdferr ! Error code - -! INTEGER, EXTERNAL :: h5aread_c -! MS FORTRAN needs explicit interface for C functions called here. -! - INTERFACE - INTEGER FUNCTION h5aread_c(attr_id, memtype_id, buf, dims) - USE H5GLOBAL - !DEC$ IF DEFINED(HDF5F90_WINDOWS) - !MS$ATTRIBUTES C,reference,alias:'_H5AREAD_C'::h5aread_c - !DEC$ ENDIF - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - INTEGER(HID_T), INTENT(IN) :: attr_id - INTEGER(HID_T), INTENT(IN) :: memtype_id - DOUBLE PRECISION, INTENT(OUT)::buf - END FUNCTION h5aread_c - END INTERFACE - - hdferr = h5aread_c(attr_id, memtype_id, buf, dims) - END SUBROUTINE h5aread_double_scalar - - SUBROUTINE h5aread_char_scalar(attr_id, memtype_id, buf, dims, hdferr) -!This definition is needed for Windows DLLs -!DEC$if defined(BUILD_HDF5_DLL) -!DEC$attributes dllexport :: h5aread_char_scalar -!DEC$endif - IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier - INTEGER(HID_T), INTENT(IN) :: memtype_id ! Attribute datatype - ! identifier (in memory) - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - CHARACTER(LEN=*), INTENT(OUT) :: buf - ! Attribute data - INTEGER, INTENT(OUT) :: hdferr ! Error code - -! INTEGER, EXTERNAL :: h5areadc_c -! MS FORTRAN needs explicit interface for C functions called here. -! - INTERFACE - INTEGER FUNCTION h5areadc_c(attr_id, memtype_id, buf, dims) - USE H5GLOBAL - !DEC$ IF DEFINED(HDF5F90_WINDOWS) - !MS$ATTRIBUTES C,reference,alias:'_H5AREADC_C'::h5areadc_c - !DEC$ ENDIF - !DEC$ATTRIBUTES reference :: buf - INTEGER(HSIZE_T), INTENT(IN), DIMENSION(*) :: dims ! Array to story buf dimension sizes - INTEGER(HID_T), INTENT(IN) :: attr_id - INTEGER(HID_T), INTENT(IN) :: memtype_id - CHARACTER(LEN=*) :: buf - END FUNCTION h5areadc_c - END INTERFACE - - hdferr = h5areadc_c(attr_id, memtype_id, buf, dims) - END SUBROUTINE h5aread_char_scalar - !---------------------------------------------------------------------- ! Name: h5aget_space_f diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c index b7c5263..b7f01f0 100644 --- a/fortran/src/H5Df.c +++ b/fortran/src/H5Df.c @@ -386,7 +386,6 @@ nh5dread_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t return ret_value; } - /*---------------------------------------------------------------------------- * Name: h5dread_ref_obj_c * Purpose: Call H5Dread to read a dataset of object references diff --git a/fortran/src/H5Dff.f90 b/fortran/src/H5Dff.f90 index 42b9558..0001aca 100644 --- a/fortran/src/H5Dff.f90 +++ b/fortran/src/H5Dff.f90 @@ -307,7 +307,6 @@ END SUBROUTINE h5dclose_f - SUBROUTINE h5dwrite_reference_obj(dset_id, mem_type_id, buf, dims, hdferr, & mem_space_id, file_space_id, xfer_prp) !This definition is needed for Windows DLLs @@ -4604,7 +4603,7 @@ file_space_id_default, xfer_prp_default, buf, dims) END SUBROUTINE h5dread_double_7 -! + !---------------------------------------------------------------------- ! Name: h5dget_space_f ! diff --git a/fortran/src/H5Ef.c b/fortran/src/H5Ef.c index 80be243..3921ebf 100644 --- a/fortran/src/H5Ef.c +++ b/fortran/src/H5Ef.c @@ -183,7 +183,7 @@ nh5eset_auto_c(int_f* printflag) herr_t status; if (*printflag == 1) - status = H5Eset_auto_stack(H5E_DEFAULT, (H5E_auto_t)H5Eprint, stderr); + status = H5Eset_auto_stack(H5E_DEFAULT, (H5E_auto_stack_t)H5Eprint, stderr); if (*printflag == 0) status = H5Eset_auto_stack(H5E_DEFAULT, NULL,NULL); if (status >= 0) ret_val = 0; diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 0ae0a19..910ab89 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -749,21 +749,18 @@ int_f nh5pget_driver_c (hid_t_f *prp_id, hid_t_f* driver) { int ret_value = -1; - /* - hid_t c_prp_id; hid_t c_driver; - */ /* * Call H5Pget_driver function. */ - /* - c_prp_id = *prp_id; - c_driver = H5Pget_driver(c_prp_id); + c_driver = H5Pget_driver((hid_t)*prp_id); + if (c_driver < 0) goto DONE; + *driver = (hid_t_f) c_driver; - if (c_driver < 0) return ret_value; - */ ret_value = 0; + +DONE: return ret_value; } @@ -1631,7 +1628,7 @@ nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, { int ret_value = -1; hid_t c_prp_id; - int c_idx; + unsigned c_idx; herr_t status; size_t c_namelen; char* c_name = NULL; @@ -1649,7 +1646,7 @@ nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, * Call H5Pget_external function. */ c_prp_id = (hid_t)*prp_id; - c_idx = (int)*idx; + c_idx = (unsigned)*idx; status = H5Pget_external(c_prp_id, c_idx, c_namelen, c_name, &c_offset, &size ); if (status < 0) goto DONE; @@ -1841,7 +1838,7 @@ nh5pget_buffer_c ( hid_t_f *prp_id , hsize_t_f *size) c_prp_id = (hid_t)*prp_id; c_size = H5Pget_buffer(c_prp_id, NULL, NULL); - if ( c_size <= 0 ) return ret_value; + if ( c_size == 0 ) return ret_value; *size = (hsize_t_f)c_size; ret_value = 0; return ret_value; @@ -2240,7 +2237,7 @@ nh5pregisterc_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, _fcd int_f nh5pregister_c(hid_t_f *class, _fcd name, int_f *name_len, size_t_f *size, void *value) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_class; char* c_name; size_t c_size; @@ -2276,7 +2273,7 @@ DONE: int_f nh5pinsertc_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, _fcd value, int_f *value_len) { - int ret_value = -1; + int_f ret_value = -1; /* * Call h5pinsert_c function @@ -2301,7 +2298,7 @@ nh5pinsertc_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, _fcd v int_f nh5pinsert_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void *value) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_plist; char* c_name; size_t c_size; @@ -2337,7 +2334,7 @@ DONE: int_f nh5pexist_c(hid_t_f *class, _fcd name, int_f *name_len) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_class; char* c_name; htri_t status; @@ -2370,7 +2367,7 @@ DONE: int_f nh5pisa_class_c(hid_t_f *plist, hid_t_f *class) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_class; hid_t c_plist; htri_t status; @@ -2400,7 +2397,7 @@ nh5pisa_class_c(hid_t_f *plist, hid_t_f *class) int_f nh5pget_size_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_plist; char* c_name; size_t c_size; @@ -2433,7 +2430,7 @@ DONE: int_f nh5pget_nprops_c(hid_t_f *plist, size_t_f *nprops) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_plist; size_t c_nprops; @@ -2462,7 +2459,7 @@ nh5pget_nprops_c(hid_t_f *plist, size_t_f *nprops) int_f nh5pget_class_parent_c(hid_t_f *prp_id, hid_t_f *parent_id) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_prp_id; hid_t c_parent_id; @@ -2494,7 +2491,7 @@ nh5pget_class_parent_c(hid_t_f *prp_id, hid_t_f *parent_id) int_f nh5pcopy_prop_c(hid_t_f *dst_id, hid_t_f *src_id, _fcd name, int_f *name_len) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_dst_id, c_src_id; char* c_name; @@ -2527,7 +2524,7 @@ DONE: int_f nh5premove_c(hid_t_f *plid, _fcd name, int_f *name_len) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_plid; char* c_name; @@ -2559,7 +2556,7 @@ DONE: int_f nh5punregister_c(hid_t_f *class, _fcd name, int_f *name_len) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_class; char* c_name; @@ -2589,7 +2586,7 @@ DONE: int_f nh5pclose_class_c(hid_t_f *class) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_class; c_class = (hid_t)*class; @@ -2614,7 +2611,7 @@ nh5pclose_class_c(hid_t_f *class) int_f nh5pget_class_name_c(hid_t_f *class, _fcd name, int_f *name_len) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_class; char* c_name; @@ -2648,7 +2645,7 @@ DONE: int_f nh5psetc_c(hid_t_f *plist, _fcd name, int_f *name_len, _fcd value, int_f *value_len) { - int ret_value = -1; + int_f ret_value = -1; /* * Call h5pset_c function @@ -2672,7 +2669,7 @@ nh5psetc_c(hid_t_f *plist, _fcd name, int_f *name_len, _fcd value, int_f *value_ int_f nh5pset_c(hid_t_f *plist, _fcd name, int_f *name_len, void *value) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_plist; char* c_name; @@ -2705,7 +2702,7 @@ DONE: int_f nh5pgetc_c(hid_t_f *plist, _fcd name, int_f *name_len, _fcd value, int_f *value_len) { - int ret_value = -1; + int_f ret_value = -1; /* * Call h5pget_c function @@ -2729,7 +2726,7 @@ nh5pgetc_c(hid_t_f *plist, _fcd name, int_f *name_len, _fcd value, int_f *value_ int_f nh5pget_c(hid_t_f *plist, _fcd name, int_f *name_len, void *value) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_plist; char* c_name; @@ -2761,7 +2758,7 @@ DONE: int_f nh5pset_shuffle_c ( hid_t_f *prp_id ) { - int ret_value = 0; + int_f ret_value = 0; hid_t c_prp_id; herr_t status; @@ -2783,7 +2780,7 @@ nh5pset_shuffle_c ( hid_t_f *prp_id ) int_f nh5pset_fletcher32_c ( hid_t_f *prp_id ) { - int ret_value = 0; + int_f ret_value = 0; hid_t c_prp_id; herr_t status; @@ -2807,7 +2804,7 @@ nh5pset_fletcher32_c ( hid_t_f *prp_id ) int_f nh5pset_edc_check_c ( hid_t_f *prp_id, int_f *flag ) { - int ret_value = 0; + int_f ret_value = 0; hid_t c_prp_id; H5Z_EDC_t c_flag; herr_t status; @@ -2833,7 +2830,7 @@ nh5pset_edc_check_c ( hid_t_f *prp_id, int_f *flag ) int_f nh5pget_edc_check_c ( hid_t_f *prp_id, int_f *flag ) { - int ret_value = 0; + int_f ret_value = 0; hid_t c_prp_id; H5Z_EDC_t c_flag; @@ -2857,7 +2854,7 @@ nh5pget_edc_check_c ( hid_t_f *prp_id, int_f *flag ) int_f nh5pset_family_offset_c ( hid_t_f *prp_id , hsize_t_f *offset) { - int ret_value = 0; + int_f ret_value = 0; hid_t c_prp_id; hsize_t c_offset; herr_t status; @@ -2889,11 +2886,11 @@ int_f /*nh5pset_fapl_multi_c ( hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _fcd memb_name, int_f *len, int_f *lenmax, haddr_t_f *memb_addr, int_f *flag) */ nh5pset_fapl_multi_c ( hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _fcd memb_name, int_f *len, int_f *lenmax, real_f *memb_addr, int_f *flag) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_prp_id; H5FD_mem_t c_memb_map[H5FD_MEM_NTYPES]; hid_t c_memb_fapl[H5FD_MEM_NTYPES]; - const char *c_memb_name[H5FD_MEM_NTYPES]; + char *c_memb_name[H5FD_MEM_NTYPES]; haddr_t c_memb_addr[H5FD_MEM_NTYPES]; hbool_t relax; herr_t status; @@ -2916,9 +2913,9 @@ nh5pset_fapl_multi_c ( hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _f if (tmp ==NULL) return ret_value; tmp_p = tmp; for (i=0; i < H5FD_MEM_NTYPES; i++) { - c_memb_name[i] = (char *) malloc((size_t)len[i] + 1); - memcpy((char *)c_memb_name[i], tmp_p, (size_t)len[i]); - tmp_pp = (char *)c_memb_name[i]; + c_memb_name[i] = malloc((size_t)len[i] + 1); + memcpy(c_memb_name[i], tmp_p, (size_t)len[i]); + tmp_pp = c_memb_name[i]; tmp_pp[len[i]] = '\0'; tmp_p = tmp_p + c_lenmax; /* printf(" %d \n", len[i]); @@ -2949,7 +2946,7 @@ nh5pset_fapl_multi_c ( hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _f DONE: free(tmp); - for (i=0; i < H5FD_MEM_NTYPES; i++) free((char *)c_memb_name[i]); + for (i=0; i < H5FD_MEM_NTYPES; i++) free(c_memb_name[i]); return ret_value; } @@ -2966,7 +2963,7 @@ DONE: int_f nh5pset_fapl_multi_sc ( hid_t_f *prp_id , int_f *flag) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_prp_id; hbool_t relax; herr_t status; @@ -3001,7 +2998,7 @@ nh5pset_fapl_multi_sc ( hid_t_f *prp_id , int_f *flag) int_f nh5pget_fapl_multi_c ( hid_t_f *prp_id , int_f *memb_map, hid_t_f *memb_fapl, _fcd memb_name, int_f *len, int_f *lenmax, real_f *memb_addr, int_f *flag, int_f *maxlen_out) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_prp_id; H5FD_mem_t c_memb_map[H5FD_MEM_NTYPES]; hid_t c_memb_fapl[H5FD_MEM_NTYPES]; @@ -3075,7 +3072,7 @@ HD5packFstring(tmp, _fcdtocp(memb_name), (int)(c_lenmax*H5FD_MEM_NTYPES)); int_f nh5pset_szip_c ( hid_t_f *prp_id , int_f *options_mask, int_f *pixels_per_block) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_prp_id; unsigned c_options_mask; unsigned c_pixels_per_block; @@ -3107,7 +3104,7 @@ nh5pset_szip_c ( hid_t_f *prp_id , int_f *options_mask, int_f *pixels_per_block) int_f nh5pall_filters_avail_c ( hid_t_f *prp_id , int_f *status) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_prp_id; htri_t c_status; @@ -3144,7 +3141,7 @@ nh5pall_filters_avail_c ( hid_t_f *prp_id , int_f *status) int_f nh5pget_filter_by_id_c(hid_t_f *prp_id, int_f* filter_id, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_prp_id; H5Z_filter_t c_filter_id; unsigned int c_flags; @@ -3206,7 +3203,7 @@ DONE: int_f nh5pmodify_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values ) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_prp_id; herr_t ret; size_t c_cd_nelmts; @@ -3250,9 +3247,8 @@ DONE: int_f nh5premove_filter_c (hid_t_f *prp_id, int_f* filter) { - int ret_value = -1; + int_f ret_value = -1; hid_t c_prp_id; - herr_t ret; H5Z_filter_t c_filter; c_filter = (H5Z_filter_t)*filter; @@ -3261,9 +3257,7 @@ nh5premove_filter_c (hid_t_f *prp_id, int_f* filter) /* * Call H5Premove_filter function. */ - ret = H5Premove_filter(c_prp_id, c_filter); - - if (ret < 0) goto DONE; + if(H5Premove_filter(c_prp_id, c_filter) < 0) goto DONE; ret_value = 0; DONE: diff --git a/fortran/src/H5Pff.f90 b/fortran/src/H5Pff.f90 index a0191a1..15d115a 100644 --- a/fortran/src/H5Pff.f90 +++ b/fortran/src/H5Pff.f90 @@ -6340,7 +6340,7 @@ ! Inputs: ! prp_id - data creation or transfer property list ! identifier -! filter - filter to be deleted +! filter - filter to be removed ! Outputs: ! hdferr: - error code ! Success: 0 @@ -6364,10 +6364,10 @@ !DEC$endif ! IMPLICIT NONE - INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier - INTEGER, INTENT(IN) :: filter !Filter to be modified - - INTEGER, INTENT(OUT) :: hdferr ! Error code + INTEGER(HID_T), INTENT(IN) :: prp_id ! Dataset creation property list + ! identifier + INTEGER, INTENT(IN) :: filter ! Filter to be removed + INTEGER, INTENT(OUT) :: hdferr ! Error code ! INTEGER, EXTERNAL :: h5premove_filter_c ! MS FORTRAN needs explicit interface for C functions called here. @@ -6376,7 +6376,7 @@ INTEGER FUNCTION h5premove_filter_c(prp_id, filter) USE H5GLOBAL !DEC$ IF DEFINED(HDF5F90_WINDOWS) - !MS$ATTRIBUTES C,reference,alias:'_H5PMODIFY_FILTER_C'::h5premove_filter_c + !MS$ATTRIBUTES C,reference,alias:'_H5PREMOVE_FILTER_C'::h5premove_filter_c !DEC$ ENDIF INTEGER(HID_T), INTENT(IN) :: prp_id INTEGER, INTENT(IN) :: filter diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c index d8b86b5..df93eae 100644 --- a/fortran/src/H5Sf.c +++ b/fortran/src/H5Sf.c @@ -261,28 +261,28 @@ nh5sget_select_hyper_blocklist_c( hid_t_f *space_id ,hsize_t_f * startblock, *---------------------------------------------------------------------------*/ int_f -nh5sget_select_bounds_c( hid_t_f *space_id , hssize_t_f * start, hssize_t_f * end) +nh5sget_select_bounds_c( hid_t_f *space_id , hsize_t_f * start, hsize_t_f * end) { int ret_value = -1; hid_t c_space_id; - hssize_t* c_start, *c_end; + hsize_t* c_start, *c_end; int i, rank; c_space_id = *space_id; rank = H5Sget_simple_extent_ndims(c_space_id); if (rank < 0 ) return ret_value; - c_start =(hssize_t*) malloc(sizeof(hssize_t)*rank); + c_start =(hsize_t*) malloc(sizeof(hsize_t)*rank); if (!c_start) return ret_value; - c_end = (hssize_t*)malloc(sizeof(hssize_t)*rank); + c_end = (hsize_t*)malloc(sizeof(hsize_t)*rank); if(!c_end) return ret_value; ret_value = H5Sget_select_bounds(c_space_id, c_start, c_end); for(i = 0; i < rank; i++) { - start[i] = (hssize_t_f)(c_start[i]+1); - end[i] = (hssize_t_f)(c_end[i]+1); + start[i] = (hsize_t_f)(c_start[i]+1); + end[i] = (hsize_t_f)(c_end[i]+1); } if (ret_value >= 0 ) ret_value = 0; @@ -756,11 +756,11 @@ nh5sset_extent_none_c ( hid_t_f *space_id ) *---------------------------------------------------------------------------*/ int_f -nh5sselect_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block) +nh5sselect_hyperslab_c ( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block) { int ret_value = -1; hid_t c_space_id; - hssize_t *c_start = NULL; + hsize_t *c_start = NULL; hsize_t *c_count = NULL; hsize_t *c_stride = NULL; hsize_t *c_block = NULL; @@ -772,7 +772,7 @@ nh5sselect_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsize rank = H5Sget_simple_extent_ndims(*space_id); if (rank < 0 ) return ret_value; - c_start = (hssize_t *)HDmalloc(sizeof(hssize_t)*rank); + c_start = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); if (c_start == NULL) goto DONE; c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); @@ -791,7 +791,7 @@ nh5sselect_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsize for (i=0; i < rank; i++) { int t= (rank - i) - 1; - c_start[i] = (hssize_t)start[t]; + c_start[i] = (hsize_t)start[t]; c_count[i] = (hsize_t)count[t]; c_stride[i] = (hsize_t)stride[t]; c_block[i] = (hsize_t)block[t]; @@ -831,12 +831,12 @@ DONE: *---------------------------------------------------------------------------*/ int_f -nh5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block, hid_t_f *hyper_id) +nh5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block, hid_t_f *hyper_id) { int ret_value = -1; hid_t c_space_id; hid_t c_hyper_id; - hssize_t *c_start = NULL; + hsize_t *c_start = NULL; hsize_t *c_count = NULL; hsize_t *c_stride = NULL; hsize_t *c_block = NULL; @@ -848,7 +848,7 @@ nh5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsiz rank = H5Sget_simple_extent_ndims(*space_id); if (rank < 0 ) return ret_value; - c_start = (hssize_t *)HDmalloc(sizeof(hssize_t)*rank); + c_start = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); if (c_start == NULL) goto DONE; c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank); @@ -867,7 +867,7 @@ nh5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsiz for (i=0; i < rank; i++) { int t= (rank - i) - 1; - c_start[i] = (hssize_t)start[t]; + c_start[i] = (hsize_t)start[t]; c_count[i] = (hsize_t)count[t]; c_stride[i] = (hsize_t)stride[t]; c_block[i] = (hsize_t)block[t]; @@ -991,7 +991,7 @@ nh5sget_select_type_c ( hid_t_f *space_id , int_f *type) *---------------------------------------------------------------------------*/ int_f -nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *nelements, hssize_t_f *coord) +nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *nelements, hsize_t_f *coord) { int ret_value = -1; hid_t c_space_id; @@ -999,7 +999,7 @@ nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *nelements, hss herr_t status; int rank; int i, j; - hssize_t *c_coord; + hsize_t *c_coord; size_t c_nelements; /* if (*op != H5S_SELECT_SET_F) return ret_value; @@ -1010,16 +1010,16 @@ nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *nelements, hss c_space_id = *space_id; rank = H5Sget_simple_extent_ndims(c_space_id); - c_coord = malloc(sizeof(hssize_t)*rank*(*nelements)); + c_coord = malloc(sizeof(hsize_t)*rank*(*nelements)); if(!c_coord) return ret_value; for (i=0; i< *nelements; i++) { for (j = 0; j < rank; j++) { - c_coord[j+i*rank] = (hssize_t)coord[j + i*rank]; + c_coord[j+i*rank] = (hsize_t)coord[j + i*rank]; } } c_nelements = *nelements; - status = H5Sselect_elements(c_space_id, c_op, c_nelements, (const hssize_t **)c_coord); + status = H5Sselect_elements(c_space_id, c_op, c_nelements, (const hsize_t **)c_coord); if ( status >= 0 ) ret_value = 0; HDfree(c_coord); return ret_value; diff --git a/fortran/src/H5Sff.f90 b/fortran/src/H5Sff.f90 index 27e8839..8d01758 100644 --- a/fortran/src/H5Sff.f90 +++ b/fortran/src/H5Sff.f90 @@ -436,9 +436,9 @@ IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: space_id ! Dataspace identifier - INTEGER(HSSIZE_T), DIMENSION(*), INTENT(OUT) :: start + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: start !Starting coordinates of the bounding box. - INTEGER(HSSIZE_T), DIMENSION(*), INTENT(OUT) :: end + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: end !Ending coordinates of the bounding box, !i.e., the coordinates of the diagonally !opposite corner @@ -454,8 +454,8 @@ !MS$ATTRIBUTES C,reference,alias:'_H5SGET_SELECT_BOUNDS_C'::h5sget_select_bounds_c !DEC$ ENDIF INTEGER(HID_T), INTENT(IN) :: space_id - INTEGER(HSSIZE_T), DIMENSION(*), INTENT(OUT) :: start - INTEGER(HSSIZE_T), DIMENSION(*), INTENT(OUT) :: end + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: start + INTEGER(HSIZE_T), DIMENSION(*), INTENT(OUT) :: end END FUNCTION h5sget_select_bounds_c END INTERFACE @@ -635,13 +635,13 @@ INTEGER, INTENT(IN) :: rank ! Number of dataspace dimensions INTEGER(SIZE_T), INTENT(IN) :: num_elements ! Number of elements to be ! selected - INTEGER(HSSIZE_T), & + INTEGER(HSIZE_T), & DIMENSION(rank,num_elements), INTENT(IN) :: coord ! Array with the coordinates ! of the selected elements ! coord(rank, num_elements) INTEGER, INTENT(OUT) :: hdferr ! Error code - INTEGER(HSSIZE_T), ALLOCATABLE, DIMENSION(:,:) :: c_coord + INTEGER(HSIZE_T), ALLOCATABLE, DIMENSION(:,:) :: c_coord INTEGER :: error, i,j ! INTEGER, EXTERNAL :: h5sselect_elements_c @@ -657,7 +657,7 @@ INTEGER(HID_T), INTENT(IN) :: space_id INTEGER, INTENT(IN) :: operator INTEGER(SIZE_T), INTENT(IN) :: num_elements - INTEGER(HSSIZE_T),DIMENSION(*) :: c_c_coord + INTEGER(HSIZE_T),DIMENSION(*) :: c_c_coord END FUNCTION h5sselect_elements_c END INTERFACE @@ -1492,7 +1492,7 @@ ! H5S_SELECT_SET_F (0) ! H5S_SELECT_OR_F (1) ! - INTEGER(HSSIZE_T), DIMENSION(*), INTENT(IN) :: start + INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: start ! Starting coordinates of the hyperslab INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: count ! Number of blocks to select @@ -1520,7 +1520,7 @@ !DEC$ ENDIF INTEGER(HID_T), INTENT(IN) :: space_id INTEGER, INTENT(IN) :: operator - INTEGER(HSSIZE_T), DIMENSION(*), INTENT(IN) :: start + INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: start INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: count INTEGER(HSIZE_T), DIMENSION(*), OPTIONAL, INTENT(IN) :: stride INTEGER(HSIZE_T), DIMENSION(*), OPTIONAL, INTENT(IN) :: block @@ -1638,7 +1638,7 @@ ! H5S_SELECT_APPEND_F ! H5S_SELECT_PREPEND_F ! -! INTEGER(HSSIZE_T), DIMENSION(*), INTENT(IN) :: start +! INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: start ! Starting coordinates of the hyperslab ! INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: count ! Number of blocks to select @@ -1664,7 +1664,7 @@ !DEC$ ENDIF ! INTEGER(HID_T), INTENT(IN) :: space_id ! INTEGER, INTENT(IN) :: operator -! INTEGER(HSSIZE_T), DIMENSION(*), INTENT(IN) :: start +! INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: start ! INTEGER(HSIZE_T), DIMENSION(*), INTENT(IN) :: count ! INTEGER(HSIZE_T), DIMENSION(*), OPTIONAL, INTENT(IN) :: stride ! INTEGER(HSIZE_T), DIMENSION(*), OPTIONAL, INTENT(IN) :: block diff --git a/fortran/src/H5Zff.f90 b/fortran/src/H5Zff.f90 index a7f0494..2d0afde 100644 --- a/fortran/src/H5Zff.f90 +++ b/fortran/src/H5Zff.f90 @@ -131,7 +131,7 @@ END SUBROUTINE h5zfilter_avail_f !---------------------------------------------------------------------- -! Name: h5zfilter_avail_f +! Name: h5zget_filter_info_f ! ! Purpose: Queries if filter has its encoder and/or decoder ! available diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 9f75ad5..04e8df6 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -373,7 +373,6 @@ nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags, h5z_flags[12] = H5Z_FILTER_CONFIG_DECODE_ENABLED; h5z_flags[13] = H5Z_FILTER_ALL; - ret_value = 0; return ret_value; } diff --git a/fortran/src/H5f90global.f90 b/fortran/src/H5f90global.f90 index 392fd6c..b224045 100644 --- a/fortran/src/H5f90global.f90 +++ b/fortran/src/H5f90global.f90 @@ -555,7 +555,7 @@ ! ! H5 Library flags declaration ! - INTEGER, PARAMETER :: H5LIB_FLAGS_LEN = 2 + INTEGER, PARAMETER :: H5LIB_FLAGS_LEN = 2 INTEGER :: H5LIB_flags(H5LIB_FLAGS_LEN) !DEC$if defined(BUILD_HDF5_DLL) !DEC$ ATTRIBUTES DLLEXPORT :: /H5LIB_FLAGS/ diff --git a/fortran/src/H5f90i.h b/fortran/src/H5f90i.h index 1eb6480..21498eb 100644 --- a/fortran/src/H5f90i.h +++ b/fortran/src/H5f90i.h @@ -67,7 +67,6 @@ typedef float real_f; #endif /*APPLE*/ - /* LINUX definitions */ #if (defined(linux) || defined(__gnu_linux__) || defined(__linux__)) @@ -106,7 +105,7 @@ typedef long hssize_t_f; typedef long size_t_f; #define FNAME_POST_UNDERSCORE -#endif /* IA64 LINUX*/ +#endif /* IA64 */ #endif /* LINUX*/ #if defined(IRIX) || defined(IRIS4) || defined(sgi) || defined(__sgi__) || defined(__sgi) diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h index 3a159a1..8876e67 100644 --- a/fortran/src/H5f90proto.h +++ b/fortran/src/H5f90proto.h @@ -59,28 +59,16 @@ H5_FCDLL void HD5packFstring(char *src, char *dest, size_t len); #endif /* DF_CAPFNAMES */ #endif /* H5Ff90_FNAMES */ -H5_FCDLL int_f nh5fcreate_c -(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *crt_prp, hid_t_f *acc_prp, hid_t_f *file_id); - -H5_FCDLL int_f nh5fopen_c -(_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hid_t_f *file_id); - -H5_FCDLL int_f nh5fis_hdf5_c -(_fcd name, int_f *namelen, int_f *flag); - +H5_FCDLL int_f nh5fcreate_c (_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *crt_prp, hid_t_f *acc_prp, hid_t_f *file_id); +H5_FCDLL int_f nh5fopen_c (_fcd name, int_f *namelen, int_f *access_flags, hid_t_f *acc_prp, hid_t_f *file_id); +H5_FCDLL int_f nh5fis_hdf5_c (_fcd name, int_f *namelen, int_f *flag); H5_FCDLL int_f nh5fclose_c (hid_t_f *file_id); -H5_FCDLL int_f nh5fmount_c -(hid_t_f *loc_id, _fcd dsetname, int_f *namelen, hid_t_f *file_id, hid_t_f *acc_prp); -H5_FCDLL int_f nh5funmount_c -(hid_t_f *loc_id, _fcd dsetname, int_f *namelen); +H5_FCDLL int_f nh5fmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen, hid_t_f *file_id, hid_t_f *acc_prp); +H5_FCDLL int_f nh5funmount_c (hid_t_f *loc_id, _fcd dsetname, int_f *namelen); H5_FCDLL int_f nh5freopen_c (hid_t_f *file_id1, hid_t_f *file_id2); - H5_FCDLL int_f nh5fget_create_plist_c (hid_t_f *file_id, hid_t_f *prop_id); - H5_FCDLL int_f nh5fget_access_plist_c (hid_t_f *file_id, hid_t_f *access_id); - H5_FCDLL int_f nh5fget_obj_count_c (hid_t_f *file_id, int_f *obj_type, int_f *obj_count); - H5_FCDLL int_f nh5fget_obj_ids_c (hid_t_f *file_id, int_f *obj_type, int_f *max_objs, int_f *obj_ids); H5_FCDLL int_f nh5fget_freespace_c (hid_t_f *file_id, hssize_t_f *free_space); H5_FCDLL int_f nh5fflush_c (hid_t_f *obj_id, int_f *scope); @@ -155,67 +143,39 @@ H5_FCDLL int_f nh5fget_filesize_c(hid_t_f *file_id, hsize_t_f *size); #endif /* DF_CAPFNAMES */ #endif -H5_FCDLL int_f nh5screate_simple_c -( int_f *rank, hsize_t_f *dims, hsize_t_f *maxdims, hid_t_f *space_id ); - +H5_FCDLL int_f nh5screate_simple_c ( int_f *rank, hsize_t_f *dims, hsize_t_f *maxdims, hid_t_f *space_id ); H5_FCDLL int_f nh5sclose_c ( hid_t_f *space_id ); - H5_FCDLL int_f nh5screate_c ( int_f *classtype, hid_t_f *space_id ); - H5_FCDLL int_f nh5scopy_c ( hid_t_f *space_id , hid_t_f *new_space_id); H5_FCDLL int_f nh5sget_select_hyper_nblocks_c( hid_t_f *space_id , hssize_t_f * num_blocks); H5_FCDLL int_f nh5sget_select_hyper_blocklist_c( hid_t_f *space_id ,hsize_t_f * startblock, hsize_t_f * num_blocks, hsize_t_f * buf); - -H5_FCDLL int_f nh5sget_select_bounds_c( hid_t_f *space_id , hssize_t_f * start, hssize_t_f * end); - +H5_FCDLL int_f nh5sget_select_bounds_c( hid_t_f *space_id , hsize_t_f * start, hsize_t_f * end); H5_FCDLL int_f nh5sget_select_elem_npoints_c( hid_t_f *space_id , hssize_t_f * num_points); - H5_FCDLL int_f nh5sget_select_elem_pointlist_c( hid_t_f *space_id ,hsize_t_f * startpoint, hsize_t_f * numpoints, hsize_t_f * buf); H5_FCDLL int_f nh5sselect_all_c ( hid_t_f *space_id ); - H5_FCDLL int_f nh5sselect_none_c ( hid_t_f *space_id ); - H5_FCDLL int_f nh5sselect_valid_c ( hid_t_f *space_id , int_f *flag ); - H5_FCDLL int_f nh5sget_simple_extent_npoints_c ( hid_t_f *space_id , hsize_t_f *npoints ); - H5_FCDLL int_f nh5sget_select_npoints_c ( hid_t_f *space_id , hssize_t_f *npoints ); - H5_FCDLL int_f nh5sget_simple_extent_ndims_c ( hid_t_f *space_id , int_f *ndims ); - H5_FCDLL int_f nh5sget_simple_extent_type_c ( hid_t_f *space_id , int_f *classtype); - H5_FCDLL int_f nh5soffset_simple_c ( hid_t_f *space_id , hssize_t_f *offset); - H5_FCDLL int_f nh5sset_extent_simple_c ( hid_t_f *space_id , int_f *rank, hsize_t_f * current_size, hsize_t_f *maximum_size); - H5_FCDLL int_f nh5sis_simple_c ( hid_t_f *space_id , int_f *flag ); - H5_FCDLL int_f nh5sextent_class_c ( hid_t_f *space_id , int_f *classtype); - H5_FCDLL int_f nh5sget_simple_extent_dims_c ( hid_t_f *space_id , hsize_t_f *dims, hsize_t_f *maxdims); - H5_FCDLL int_f nh5sextent_copy_c ( hid_t_f *dest_space_id , hid_t_f *source_space_id); - H5_FCDLL int_f nh5sset_extent_none_c ( hid_t_f *space_id ); - -H5_FCDLL int_f nh5sselect_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block); - -H5_FCDLL int_f nh5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block, hid_t_f *hyper_id); - +H5_FCDLL int_f nh5sselect_hyperslab_c ( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block); +H5_FCDLL int_f nh5sget_select_type_c ( hid_t_f *space_id , int_f *op); +H5_FCDLL int_f nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *nelements, hsize_t_f *coord); +H5_FCDLL int_f nh5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hsize_t_f *start, hsize_t_f *count, hsize_t_f *stride, hsize_t_f *block, hid_t_f *hyper_id); H5_FCDLL int_f nh5scombine_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id, hid_t_f *ds_id); - H5_FCDLL int_f nh5sselect_select_c ( hid_t_f *space1_id , int_f *op, hid_t_f *space2_id); -H5_FCDLL int_f nh5sget_select_type_c ( hid_t_f *space_id , int_f *op); - -H5_FCDLL int_f nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f *nelements, hssize_t_f *coord); - - /* * Functions from H5Df.c */ - #ifndef H5Df90_FNAMES # define H5Df90_FNAMES #ifdef DF_CAPFNAMES @@ -226,7 +186,6 @@ H5_FCDLL int_f nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f * # define nh5dwrite_ref_obj_c FNAME(H5DWRITE_REF_OBJ_C) # define nh5dwrite_ref_reg_c FNAME(H5DWRITE_REF_REG_C) # define nh5dwritec_c FNAME(H5DWRITEC_C) -# define nh5dwritec_c_b FNAME(H5DWRITEC_C_B) # define nh5dread_c FNAME(H5DREAD_C) # define nh5dread_c_b FNAME(H5DREAD_C_B) # define nh5dread_ref_reg_c FNAME(H5DREAD_REF_REG_C) @@ -257,11 +216,9 @@ H5_FCDLL int_f nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f * # define nh5dwrite_ref_obj_c FNAME(h5dwrite_ref_obj_c) # define nh5dwrite_ref_reg_c FNAME(h5dwrite_ref_reg_c) # define nh5dread_c FNAME(h5dread_c) -# define nh5dread_c_b FNAME(h5dread_c_b) # define nh5dread_ref_reg_c FNAME(h5dread_ref_reg_c) # define nh5dread_ref_obj_c FNAME(h5dread_ref_obj_c) # define nh5dreadc_c FNAME(h5dreadc_c) -# define nh5dreadc_c_b FNAME(h5dreadc_c_b) # define nh5dget_space_c FNAME(h5dget_space_c) # define nh5dget_type_c FNAME(h5dget_type_c) # define nh5dget_create_plist_c FNAME(h5dget_create_plist_c) @@ -280,76 +237,36 @@ H5_FCDLL int_f nh5sselect_elements_c ( hid_t_f *space_id , int_f *op, size_t_f * #endif /* DF_CAPFNAMES */ #endif -H5_FCDLL int_f nh5dcreate_c -(hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *space_id, hid_t_f *crt_prp, hid_t_f *dset_id); - +H5_FCDLL int_f nh5dcreate_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id, hid_t_f *space_id, hid_t_f *crt_prp, hid_t_f *dset_id); H5_FCDLL int_f nh5dopen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *dset_id); - H5_FCDLL int_f nh5dclose_c ( hid_t_f *dset_id ); - -H5_FCDLL int_f nh5dwrite_c -(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf, hsize_t_f *dims); - -H5_FCDLL int_f nh5dwrite_vl_integer_c -(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims, size_t_f *len); - -H5_FCDLL int_f nh5dread_vl_integer_c -(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims, size_t_f *len); - -H5_FCDLL int_f nh5dwrite_vl_real_c -(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, real_f *buf, hsize_t_f *dims, size_t_f *len); - -H5_FCDLL int_f nh5dread_vl_real_c -(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, real_f *buf, hsize_t_f *dims, size_t_f *len); - -H5_FCDLL int_f nh5dwrite_vl_string_c -(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims, size_t_f *len); - -H5_FCDLL int_f nh5dread_vl_string_c -(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims, size_t_f *len); - -H5_FCDLL int_f nh5dwrite_ref_obj_c -(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims); - -H5_FCDLL int_f nh5dwrite_ref_reg_c -(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims); - -H5_FCDLL int_f nh5dwritec_c -(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims); - - -H5_FCDLL int_f nh5dread_c -(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf, hsize_t_f *dims); - -H5_FCDLL int_f nh5dread_ref_obj_c -(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f * buf, hsize_t_f *dims); - -H5_FCDLL int_f nh5dread_ref_reg_c -(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f * buf, hsize_t_f *dims); - -H5_FCDLL int_f nh5dreadc_c -(hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims); - +H5_FCDLL int_f nh5dwrite_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf, hsize_t_f *dims); +H5_FCDLL int_f nh5dwrite_vl_integer_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims, size_t_f *len); +H5_FCDLL int_f nh5dwrite_vl_real_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, real_f *buf, hsize_t_f *dims, size_t_f *len); +H5_FCDLL int_f nh5dwrite_vl_string_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims, size_t_f *len); +H5_FCDLL int_f nh5dwrite_ref_obj_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims); +H5_FCDLL int_f nh5dwrite_ref_reg_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims); +H5_FCDLL int_f nh5dwritec_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims); +H5_FCDLL int_f nh5dread_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, void *buf, hsize_t_f *dims); +H5_FCDLL int_f nh5dread_vl_integer_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f *buf, hsize_t_f *dims, size_t_f *len); +H5_FCDLL int_f nh5dread_vl_real_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, real_f *buf, hsize_t_f *dims, size_t_f *len); +H5_FCDLL int_f nh5dread_vl_string_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims, size_t_f *len); +H5_FCDLL int_f nh5dread_ref_obj_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f * buf, hsize_t_f *dims); +H5_FCDLL int_f nh5dread_ref_reg_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, int_f * buf, hsize_t_f *dims); +H5_FCDLL int_f nh5dreadc_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_id, hid_t_f *file_space_id, hid_t_f *xfer_prp, _fcd buf, hsize_t_f *dims); H5_FCDLL int_f nh5dget_space_c ( hid_t_f *dset_id , hid_t_f *space_id); - H5_FCDLL int_f nh5dget_type_c ( hid_t_f *dset_id , hid_t_f *type_id); - H5_FCDLL int_f nh5dget_create_plist_c ( hid_t_f *dset_id , hid_t_f *plist_id); - H5_FCDLL int_f nh5dextend_c ( hid_t_f *dset_id , hsize_t_f *dims); - H5_FCDLL int_f nh5dvlen_get_max_len_c(hid_t_f *dataset_id, hid_t_f *type_id, hid_t_f *space_id, size_t_f *len); - H5_FCDLL int_f nh5dget_storage_size_c(hid_t_f *dataset_id, hsize_t_f *size); H5_FCDLL int_f nh5dfillc_c(_fcd fill_value, hid_t_f *fill_type_id, hid_t_f *space_id, _fcd buf, hid_t_f *mem_type_id); H5_FCDLL int_f nh5dfill_c(void * fill_value, hid_t_f *fill_type_id, hid_t_f *space_id, void * buf, hid_t_f *mem_type_id); - H5_FCDLL int_f nh5dget_space_status_c ( hid_t_f *dset_id, int_f *flag); /* * Functions from H5Gf.c */ - #ifndef H5Gf90_FNAMES # define H5Gf90_FNAMES #ifdef DF_CAPFNAMES @@ -383,48 +300,23 @@ H5_FCDLL int_f nh5dget_space_status_c ( hid_t_f *dset_id, int_f *flag); #endif /* DF_CAPFNAMES */ #endif -H5_FCDLL int_f nh5gcreate_c -(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size_hint, hid_t_f *grp_id); - +H5_FCDLL int_f nh5gcreate_c (hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size_hint, hid_t_f *grp_id); H5_FCDLL int_f nh5gopen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *grp_id); - H5_FCDLL int_f nh5gclose_c ( hid_t_f *grp_id ); - -H5_FCDLL int_f nh5gget_obj_info_idx_c -(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, _fcd obj_name, int_f *obj_namelen, int_f *obj_type); - -H5_FCDLL int_f nh5gn_members_c -(hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *nmembers); - -H5_FCDLL int_f nh5glink_c -(hid_t_f *loc_id, int_f *link_type, _fcd current_name, int_f *current_namelen, _fcd new_name, int_f *new_namelen); - -H5_FCDLL int_f nh5glink2_c -(hid_t_f *cur_loc_id, _fcd cur_name, int_f *cur_namelen, int_f *link_type, hid_t_f *new_loc_id, _fcd new_name, int_f *new_namelen); - -H5_FCDLL int_f nh5gunlink_c -(hid_t_f *loc_id, _fcd name, int_f *namelen); - -H5_FCDLL int_f nh5gmove_c -(hid_t_f *loc_id, _fcd src_name, int_f *src_namelen, _fcd dst_name, int_f *dst_namelen); - -H5_FCDLL int_f nh5gmove2_c -(hid_t_f *src_loc_id, _fcd src_name, int_f *src_namelen, hid_t_f *dst_loc_id,_fcd dst_name, int_f *dst_namelen); - -H5_FCDLL int_f nh5gget_linkval_c -(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size, _fcd value ); - -H5_FCDLL int_f nh5gset_comment_c -(hid_t_f *loc_id, _fcd name, int_f *namelen, _fcd comment, int_f *commentlen); - -H5_FCDLL int_f nh5gget_comment_c -(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *bufsize, _fcd comment); - +H5_FCDLL int_f nh5gget_obj_info_idx_c (hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *idx, _fcd obj_name, int_f *obj_namelen, int_f *obj_type); +H5_FCDLL int_f nh5gn_members_c (hid_t_f *loc_id, _fcd name, int_f *namelen, int_f *nmembers); +H5_FCDLL int_f nh5glink_c (hid_t_f *loc_id, int_f *link_type, _fcd current_name, int_f *current_namelen, _fcd new_name, int_f *new_namelen); +H5_FCDLL int_f nh5glink2_c (hid_t_f *cur_loc_id, _fcd cur_name, int_f *cur_namelen, int_f *link_type, hid_t_f *new_loc_id, _fcd new_name, int_f *new_namelen); +H5_FCDLL int_f nh5gunlink_c (hid_t_f *loc_id, _fcd name, int_f *namelen); +H5_FCDLL int_f nh5gmove_c (hid_t_f *loc_id, _fcd src_name, int_f *src_namelen, _fcd dst_name, int_f *dst_namelen); +H5_FCDLL int_f nh5gmove2_c (hid_t_f *src_loc_id, _fcd src_name, int_f *src_namelen, hid_t_f *dst_loc_id,_fcd dst_name, int_f *dst_namelen); +H5_FCDLL int_f nh5gget_linkval_c (hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size, _fcd value ); +H5_FCDLL int_f nh5gset_comment_c (hid_t_f *loc_id, _fcd name, int_f *namelen, _fcd comment, int_f *commentlen); +H5_FCDLL int_f nh5gget_comment_c (hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *bufsize, _fcd comment); /* * Functions from H5Af.c */ - #ifndef H5Af90_FNAMES # define H5Af90_FNAMES #ifdef DF_CAPFNAMES @@ -458,32 +350,18 @@ H5_FCDLL int_f nh5gget_comment_c #endif /* DF_CAPFNAMES */ #endif - H5_FCDLL int_f nh5acreate_c (hid_t_f *obj_id, _fcd name, size_t_f *namelen, hid_t_f *type_id, hid_t_f *space_id, hid_t_f *crt_prp, hid_t_f *attr_id); - -H5_FCDLL int_f -nh5aopen_name_c (hid_t_f *obj_id, _fcd name, size_t_f *namelen, hid_t_f *attr_id); - +H5_FCDLL int_f nh5aopen_name_c (hid_t_f *obj_id, _fcd name, size_t_f *namelen, hid_t_f *attr_id); H5_FCDLL int_f nh5awritec_c (hid_t_f *attr_id, hid_t_f *mem_type_id, _fcd buf, void *dims); - H5_FCDLL int_f nh5awrite_c (hid_t_f *attr_id, hid_t_f *mem_type_id, void *buf, void *dims); - H5_FCDLL int_f nh5areadc_c (hid_t_f *attr_id, hid_t_f *mem_type_id, _fcd buf, void *dims); - H5_FCDLL int_f nh5aread_c (hid_t_f *attr_id, hid_t_f *mem_type_id, void *buf, void *dims); - H5_FCDLL int_f nh5aclose_c ( hid_t_f *attr_id ); - H5_FCDLL int_f nh5adelete_c (hid_t_f *obj_id, _fcd name, size_t_f *namelen); - H5_FCDLL int_f nh5aopen_idx_c (hid_t_f *obj_id, int_f *idx, hid_t_f *attr_id); - H5_FCDLL int_f nh5aget_space_c (hid_t_f *attr_id, hid_t_f *space_id); - H5_FCDLL int_f nh5aget_type_c (hid_t_f *attr_id, hid_t_f *type_id); - H5_FCDLL int_f nh5aget_num_attrs_c (hid_t_f *obj_id, int_f *attr_num); - H5_FCDLL int_f nh5aget_name_c(hid_t_f *attr_id, size_t_f *size, _fcd buf); /* @@ -547,7 +425,6 @@ H5_FCDLL int_f nh5aget_name_c(hid_t_f *attr_id, size_t_f *size, _fcd buf); # define nh5tget_super_c FNAME(H5TGET_SUPER_C) # define nh5tvlen_create_c FNAME(H5TVLEN_CREATE_C) # define nh5tis_variable_str_c FNAME(H5TIS_VARIABLE_STR_C) - #else # define nh5topen_c FNAME(h5topen_c) # define nh5tcommit_c FNAME(h5tcommit_c) @@ -608,26 +485,15 @@ H5_FCDLL int_f nh5aget_name_c(hid_t_f *attr_id, size_t_f *size, _fcd buf); #endif H5_FCDLL int_f nh5tcreate_c(int_f *class, size_t_f *size, hid_t_f *type_id); - H5_FCDLL int_f nh5topen_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id); - -H5_FCDLL int_f -nh5tcommit_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id); - +H5_FCDLL int_f nh5tcommit_c (hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *type_id); H5_FCDLL int_f nh5tclose_c ( hid_t_f *type_id ); - H5_FCDLL int_f nh5tequal_c ( hid_t_f *type1_id , hid_t_f *type2_id, int_f *c_flag); - H5_FCDLL int_f nh5tcopy_c ( hid_t_f *type_id , hid_t_f *new_type_id); - H5_FCDLL int_f nh5tget_class_c ( hid_t_f *type_id , int_f *classtype); - H5_FCDLL int_f nh5tget_order_c ( hid_t_f *type_id , int_f *order); - H5_FCDLL int_f nh5tset_order_c ( hid_t_f *type_id , int_f *order); - H5_FCDLL int_f nh5tget_size_c ( hid_t_f *type_id , size_t_f *size); - H5_FCDLL int_f nh5tset_size_c ( hid_t_f *type_id , size_t_f *size); H5_FCDLL int_f nh5tcommitted_c (hid_t_f *type_id); H5_FCDLL int_f nh5tget_precision_c ( hid_t_f *type_id , size_t_f *precision); @@ -641,10 +507,8 @@ H5_FCDLL int_f nh5tset_sign_c ( hid_t_f *type_id , int_f *sign); H5_FCDLL int_f nh5tget_fields_c ( hid_t_f *type_id, size_t_f *spos, size_t_f *epos, size_t_f* esize, size_t_f* mpos, size_t_f* msize); H5_FCDLL int_f nh5tset_fields_c ( hid_t_f *type_id, size_t_f *spos, size_t_f *epos, size_t_f* esize, size_t_f* mpos, size_t_f* msize); H5_FCDLL int_f nh5tget_ebias_c ( hid_t_f *type_id , size_t_f *ebias); - H5_FCDLL int_f nh5tset_ebias_c ( hid_t_f *type_id , size_t_f *ebias); H5_FCDLL int_f nh5tget_norm_c ( hid_t_f *type_id , int_f *norm); - H5_FCDLL int_f nh5tset_norm_c ( hid_t_f *type_id , int_f *norm); H5_FCDLL int_f nh5tget_inpad_c ( hid_t_f *type_id, int_f * padtype); H5_FCDLL int_f nh5tset_inpad_c ( hid_t_f *type_id, int_f * padtype); @@ -658,43 +522,27 @@ H5_FCDLL int_f nh5tget_member_dims_c ( hid_t_f *type_id ,int_f* field_idx, int_f H5_FCDLL int_f nh5tget_member_offset_c ( hid_t_f *type_id ,int_f* member_no, size_t_f* offset); H5_FCDLL int_f nh5tget_member_type_c ( hid_t_f *type_id ,int_f* field_idx, hid_t_f * datatype); H5_FCDLL int_f nh5tget_member_index_c ( hid_t_f *type_id ,_fcd name, int_f* namelen, int_f *idx); - H5_FCDLL int_f nh5tinsert_c(hid_t_f *type_id, _fcd name, int_f* namelen, size_t_f *offset, hid_t_f * field_id); H5_FCDLL int_f nh5tpack_c(hid_t_f * type_id); - H5_FCDLL int_f nh5tinsert_array_c(hid_t_f * parent_id, _fcd name, int_f* namelen, size_t_f* offset, int_f* ndims, size_t_f* dims, hid_t_f* member_id, int_f* perm ); - H5_FCDLL int_f nh5tinsert_array_c2(hid_t_f * parent_id, _fcd name, int_f* namelen, size_t_f* offset, int_f* ndims, size_t_f* dims, hid_t_f* member_id); - H5_FCDLL int_f nh5tenum_create_c ( hid_t_f *parent_id , hid_t_f *new_type_id); - H5_FCDLL int_f nh5tenum_insert_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value); -H5_FCDLL int_f -nh5tenum_nameof_c(hid_t_f *type_id, int_f* value, _fcd name, size_t_f* namelen); -H5_FCDLL int_f -nh5tenum_valueof_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value); -H5_FCDLL int_f -nh5tget_member_value_c(hid_t_f *type_id, int_f* member_no, int_f* value); -H5_FCDLL int_f -nh5tset_tag_c(hid_t_f* type_id, _fcd tag, int_f* namelen); -H5_FCDLL int_f -nh5tget_tag_c(hid_t_f* type_id, _fcd tag, int_f* namelen); -H5_FCDLL int_f -nh5tarray_create_c(hid_t_f * base_id, int_f *rank, hsize_t_f* dims, hid_t_f* type_id); -H5_FCDLL int_f -nh5tget_array_dims_c ( hid_t_f *type_id , hsize_t_f * dims); -H5_FCDLL int_f -nh5tget_array_ndims_c ( hid_t_f *type_id , int_f * ndims); -H5_FCDLL int_f -nh5tget_super_c ( hid_t_f *type_id , hid_t_f *base_type_id); -H5_FCDLL int_f -nh5tvlen_create_c ( hid_t_f *type_id , hid_t_f *vltype_id); +H5_FCDLL int_f nh5tenum_nameof_c(hid_t_f *type_id, int_f* value, _fcd name, size_t_f* namelen); +H5_FCDLL int_f nh5tenum_valueof_c(hid_t_f *type_id, _fcd name, int_f* namelen, int_f* value); +H5_FCDLL int_f nh5tget_member_value_c(hid_t_f *type_id, int_f* member_no, int_f* value); +H5_FCDLL int_f nh5tset_tag_c(hid_t_f* type_id, _fcd tag, int_f* namelen); +H5_FCDLL int_f nh5tget_tag_c(hid_t_f* type_id, _fcd tag, int_f* namelen); +H5_FCDLL int_f nh5tarray_create_c(hid_t_f * base_id, int_f *rank, hsize_t_f* dims, hid_t_f* type_id); +H5_FCDLL int_f nh5tget_array_dims_c ( hid_t_f *type_id , hsize_t_f * dims); +H5_FCDLL int_f nh5tget_array_ndims_c ( hid_t_f *type_id , int_f * ndims); +H5_FCDLL int_f nh5tget_super_c ( hid_t_f *type_id , hid_t_f *base_type_id); +H5_FCDLL int_f nh5tvlen_create_c ( hid_t_f *type_id , hid_t_f *vltype_id); H5_FCDLL int_f nh5tis_variable_str_c ( hid_t_f *type_id , int_f *flag ); /* * Functions from H5Pf.c */ - #ifndef H5Pf90_FNAMES # define H5Pf90_FNAMES #ifdef DF_CAPFNAMES @@ -910,146 +758,77 @@ H5_FCDLL int_f nh5tis_variable_str_c ( hid_t_f *type_id , int_f *flag ); # define nh5pset_fapl_multi_sc FNAME(h5pset_fapl_multi_sc) # define nh5pset_szip_c FNAME(h5pset_szip_c) # define nh5pall_filters_avail_c FNAME(h5pall_filters_avail_c) - - #endif #endif H5_FCDLL int_f nh5pcreate_c ( hid_t_f *class, hid_t_f *prp_id ); - H5_FCDLL int_f nh5pclose_c ( hid_t_f *prp_id ); - H5_FCDLL int_f nh5pcopy_c ( hid_t_f *prp_id , hid_t_f *new_prp_id); - H5_FCDLL int_f nh5pequal_c ( hid_t_f *plist1_id , hid_t_f *plist2_id, int_f *c_flag); - H5_FCDLL int_f nh5pget_class_c ( hid_t_f *prp_id , int_f *classtype); - H5_FCDLL int_f nh5pset_deflate_c ( hid_t_f *prp_id , int_f *level); - H5_FCDLL int_f nh5pset_chunk_c ( hid_t_f *prp_id, int_f *rank, hsize_t_f *dims ); - H5_FCDLL int_f nh5pget_chunk_c ( hid_t_f *prp_id, int_f *max_rank, hsize_t_f *dims ); - -H5_FCDLL int_f -nh5pset_fill_valuec_c (hid_t_f *prp_id, hid_t_f *type_id, _fcd fillvalue); - -H5_FCDLL int_f -nh5pset_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue); - -H5_FCDLL int_f -nh5pget_fill_valuec_c (hid_t_f *prp_id, hid_t_f *type_id, _fcd fillvalue); - -H5_FCDLL int_f -nh5pget_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue); - -H5_FCDLL int_f -nh5pset_preserve_c ( hid_t_f *prp_id , int_f *flag); - -H5_FCDLL int_f -nh5pget_preserve_c ( hid_t_f *prp_id , int_f *flag); -H5_FCDLL int_f -nh5pget_version_c (hid_t_f *prp_id, int_f * boot,int_f * freelist, int_f * stab, int_f *shhdr); -H5_FCDLL int_f -nh5pset_userblock_c (hid_t_f *prp_id, hsize_t_f * size); -H5_FCDLL int_f -nh5pget_userblock_c (hid_t_f *prp_id, hsize_t_f * size); -H5_FCDLL int_f -nh5pget_sizes_c (hid_t_f *prp_id, size_t_f * sizeof_addr, size_t_f * sizeof_size); -H5_FCDLL int_f -nh5pset_sizes_c (hid_t_f *prp_id, size_t_f * sizeof_addr, size_t_f * sizeof_size); -H5_FCDLL int_f -nh5pset_sym_k_c (hid_t_f *prp_id, int_f* ik, int_f* lk); -H5_FCDLL int_f -nh5pget_sym_k_c (hid_t_f *prp_id, int_f* ik, int_f* lk); -H5_FCDLL int_f -nh5pset_istore_k_c (hid_t_f *prp_id, int_f* ik); -H5_FCDLL int_f -nh5pget_istore_k_c (hid_t_f *prp_id, int_f* ik); -H5_FCDLL int_f -nh5pget_driver_c (hid_t_f *prp_id, hid_t_f*driver); -H5_FCDLL int_f -nh5pset_fapl_stdio_c (hid_t_f *prp_id); -H5_FCDLL int_f -nh5pget_fapl_stdio_c (hid_t_f *prp_id, int_f* io); -H5_FCDLL int_f -nh5pset_fapl_sec2_c (hid_t_f *prp_id); -H5_FCDLL int_f -nh5pget_fapl_sec2_c (hid_t_f *prp_id, int_f* sec2); -H5_FCDLL int_f -nh5pset_alignment_c(hid_t_f *prp_id, hsize_t_f* threshold, hsize_t_f* alignment); -H5_FCDLL int_f -nh5pget_alignment_c(hid_t_f *prp_id, hsize_t_f* threshold, hsize_t_f* alignment); -H5_FCDLL int_f -nh5pget_fapl_core_c (hid_t_f *prp_id, size_t_f* increment, int_f *flag); -H5_FCDLL int_f -nh5pset_fapl_core_c (hid_t_f *prp_id, size_t_f* increment, int_f *flag); -H5_FCDLL int_f -nh5pset_fapl_family_c (hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist ); -H5_FCDLL int_f -nh5pget_fapl_family_c (hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist ); -H5_FCDLL int_f -nh5pset_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, size_t_f* rdcc_nelmts, size_t_f* rdcc_nbytes, real_f* rdcc_w0); -H5_FCDLL int_f -nh5pget_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, size_t_f* rdcc_nelmts, size_t_f* rdcc_nbytes, real_f* rdcc_w0); -H5_FCDLL int_f -nh5pget_fapl_split_c(hid_t_f *prp_id, size_t_f* meta_ext_size , _fcd meta_ext, hid_t_f* meta_plist, size_t_f* raw_ext_size, _fcd raw_ext, hid_t_f * raw_plist); -H5_FCDLL int_f -nh5pset_fapl_split_c(hid_t_f *prp_id, int_f* meta_len, _fcd meta_ext, hid_t_f* meta_plist, int_f* raw_len, _fcd raw_ext, hid_t_f * raw_plist); -H5_FCDLL int_f -nh5pset_gc_references_c(hid_t_f *prp_id, int_f* gc_references); -H5_FCDLL int_f -nh5pget_gc_references_c(hid_t_f *prp_id, int_f* gc_references); -H5_FCDLL int_f -nh5pset_layout_c (hid_t_f *prp_id, int_f* layout); -H5_FCDLL int_f -nh5pget_layout_c (hid_t_f *prp_id, int_f* layout); -H5_FCDLL int_f -nh5pset_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values ); -H5_FCDLL int_f -nh5premove_filter_c (hid_t_f *prp_id, int_f* filter); -H5_FCDLL int_f -nh5pmodify_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values ); -H5_FCDLL int_f -nh5pget_nfilters_c (hid_t_f *prp_id, int_f* nfilters); -H5_FCDLL int_f -nh5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name, int_f* filter_id); -H5_FCDLL int_f -nh5pget_filter_by_id_c(hid_t_f *prp_id, int_f* filter_id, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name); -H5_FCDLL int_f -nh5pset_external_c (hid_t_f *prp_id, _fcd name, int_f* namelen, int_f* offset, hsize_t_f*bytes); -H5_FCDLL int_f -nh5pget_external_count_c (hid_t_f *prp_id, int_f* count); -H5_FCDLL int_f -nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, int_f* offset, hsize_t_f*bytes); -H5_FCDLL int_f -nh5pget_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right); -H5_FCDLL int_f -nh5pset_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right); -H5_FCDLL int_f -nh5pget_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info); -H5_FCDLL int_f -nh5pset_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info); -H5_FCDLL int_f -nh5pget_fapl_mpiposix_c(hid_t_f *prp_id, int_f* comm, int_f* flag); -H5_FCDLL int_f -nh5pset_fapl_mpiposix_c(hid_t_f *prp_id, int_f* comm, int_f* flag); -H5_FCDLL int_f -nh5pget_dxpl_mpio_rc(hid_t_f *prp_id, int_f* data_xfer_mode); -H5_FCDLL int_f -nh5pset_dxpl_mpio_c(hid_t_f *prp_id, int_f* data_xfer_mode); - +H5_FCDLL int_f nh5pset_fill_valuec_c (hid_t_f *prp_id, hid_t_f *type_id, _fcd fillvalue); +H5_FCDLL int_f nh5pset_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue); +H5_FCDLL int_f nh5pget_fill_valuec_c (hid_t_f *prp_id, hid_t_f *type_id, _fcd fillvalue); +H5_FCDLL int_f nh5pget_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue); +H5_FCDLL int_f nh5pset_preserve_c ( hid_t_f *prp_id , int_f *flag); +H5_FCDLL int_f nh5pget_preserve_c ( hid_t_f *prp_id , int_f *flag); +H5_FCDLL int_f nh5pget_version_c (hid_t_f *prp_id, int_f * boot,int_f * freelist, int_f * stab, int_f *shhdr); +H5_FCDLL int_f nh5pset_userblock_c (hid_t_f *prp_id, hsize_t_f * size); +H5_FCDLL int_f nh5pget_userblock_c (hid_t_f *prp_id, hsize_t_f * size); +H5_FCDLL int_f nh5pget_sizes_c (hid_t_f *prp_id, size_t_f * sizeof_addr, size_t_f * sizeof_size); +H5_FCDLL int_f nh5pset_sizes_c (hid_t_f *prp_id, size_t_f * sizeof_addr, size_t_f * sizeof_size); +H5_FCDLL int_f nh5pset_sym_k_c (hid_t_f *prp_id, int_f* ik, int_f* lk); +H5_FCDLL int_f nh5pget_sym_k_c (hid_t_f *prp_id, int_f* ik, int_f* lk); +H5_FCDLL int_f nh5pset_istore_k_c (hid_t_f *prp_id, int_f* ik); +H5_FCDLL int_f nh5pget_istore_k_c (hid_t_f *prp_id, int_f* ik); +H5_FCDLL int_f nh5pget_driver_c (hid_t_f *prp_id, hid_t_f*driver); +H5_FCDLL int_f nh5pset_fapl_stdio_c (hid_t_f *prp_id); +H5_FCDLL int_f nh5pget_fapl_stdio_c (hid_t_f *prp_id, int_f* io); +H5_FCDLL int_f nh5pset_fapl_sec2_c (hid_t_f *prp_id); +H5_FCDLL int_f nh5pget_fapl_sec2_c (hid_t_f *prp_id, int_f* sec2); +H5_FCDLL int_f nh5pset_alignment_c(hid_t_f *prp_id, hsize_t_f* threshold, hsize_t_f* alignment); +H5_FCDLL int_f nh5pget_alignment_c(hid_t_f *prp_id, hsize_t_f* threshold, hsize_t_f* alignment); +H5_FCDLL int_f nh5pget_fapl_core_c (hid_t_f *prp_id, size_t_f* increment, int_f *flag); +H5_FCDLL int_f nh5pset_fapl_core_c (hid_t_f *prp_id, size_t_f* increment, int_f *flag); +H5_FCDLL int_f nh5pset_fapl_family_c (hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist ); +H5_FCDLL int_f nh5pget_fapl_family_c (hid_t_f *prp_id, hsize_t_f* memb_size, hid_t_f* memb_plist ); +H5_FCDLL int_f nh5pset_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, size_t_f* rdcc_nelmts, size_t_f* rdcc_nbytes, real_f* rdcc_w0); +H5_FCDLL int_f nh5pget_cache_c(hid_t_f *prp_id, int_f* mdc_nelmts, size_t_f* rdcc_nelmts, size_t_f* rdcc_nbytes, real_f* rdcc_w0); +H5_FCDLL int_f nh5pget_fapl_split_c(hid_t_f *prp_id, size_t_f* meta_ext_size , _fcd meta_ext, hid_t_f* meta_plist, size_t_f* raw_ext_size, _fcd raw_ext, hid_t_f * raw_plist); +H5_FCDLL int_f nh5pset_fapl_split_c(hid_t_f *prp_id, int_f* meta_len, _fcd meta_ext, hid_t_f* meta_plist, int_f* raw_len, _fcd raw_ext, hid_t_f * raw_plist); +H5_FCDLL int_f nh5pset_gc_references_c(hid_t_f *prp_id, int_f* gc_references); +H5_FCDLL int_f nh5pget_gc_references_c(hid_t_f *prp_id, int_f* gc_references); +H5_FCDLL int_f nh5pset_layout_c (hid_t_f *prp_id, int_f* layout); +H5_FCDLL int_f nh5pget_layout_c (hid_t_f *prp_id, int_f* layout); +H5_FCDLL int_f nh5pset_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values ); +H5_FCDLL int_f nh5premove_filter_c (hid_t_f *prp_id, int_f* filter); +H5_FCDLL int_f nh5pmodify_filter_c (hid_t_f *prp_id, int_f* filter, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values ); +H5_FCDLL int_f nh5pget_nfilters_c (hid_t_f *prp_id, int_f* nfilters); +H5_FCDLL int_f nh5pget_filter_c(hid_t_f *prp_id, int_f* filter_number, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name, int_f* filter_id); +H5_FCDLL int_f nh5pget_filter_by_id_c(hid_t_f *prp_id, int_f* filter_id, int_f* flags, size_t_f* cd_nelmts, int_f* cd_values, size_t_f *namelen, _fcd name); +H5_FCDLL int_f nh5pset_external_c (hid_t_f *prp_id, _fcd name, int_f* namelen, int_f* offset, hsize_t_f*bytes); +H5_FCDLL int_f nh5pget_external_count_c (hid_t_f *prp_id, int_f* count); +H5_FCDLL int_f nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name, int_f* offset, hsize_t_f*bytes); +H5_FCDLL int_f nh5pget_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right); +H5_FCDLL int_f nh5pset_btree_ratios_c(hid_t_f *prp_id, real_f* left, real_f* middle, real_f* right); +H5_FCDLL int_f nh5pget_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info); +H5_FCDLL int_f nh5pset_fapl_mpio_c(hid_t_f *prp_id, int_f* comm, int_f* info); +H5_FCDLL int_f nh5pget_fapl_mpiposix_c(hid_t_f *prp_id, int_f* comm, int_f* flag); +H5_FCDLL int_f nh5pset_fapl_mpiposix_c(hid_t_f *prp_id, int_f* comm, int_f* flag); +H5_FCDLL int_f nh5pget_dxpl_mpio_rc(hid_t_f *prp_id, int_f* data_xfer_mode); +H5_FCDLL int_f nh5pset_dxpl_mpio_c(hid_t_f *prp_id, int_f* data_xfer_mode); H5_FCDLL int_f nh5pset_fclose_degree_c(hid_t_f *fapl, int_f *degree); H5_FCDLL int_f nh5pget_fclose_degree_c(hid_t_f *fapl, int_f *degree); H5_FCDLL int_f nh5pget_buffer_c(hid_t_f *plist, hsize_t_f *size); H5_FCDLL int_f nh5pset_buffer_c(hid_t_f *plist, hsize_t_f *size); - H5_FCDLL int_f nh5pfill_value_define_c(hid_t_f *plist, int_f *flag); H5_FCDLL int_f nh5pset_alloc_time_c(hid_t_f *plist, int_f *flag); H5_FCDLL int_f nh5pget_alloc_time_c(hid_t_f *plist, int_f *flag); H5_FCDLL int_f nh5pset_fill_time_c(hid_t_f *plist, int_f *flag); H5_FCDLL int_f nh5pget_fill_time_c(hid_t_f *plist, int_f *flag); - H5_FCDLL int_f nh5pset_meta_block_size_c(hid_t_f *plist, hsize_t_f *size); H5_FCDLL int_f nh5pget_meta_block_size_c(hid_t_f *plist, hsize_t_f *size); H5_FCDLL int_f nh5pset_sieve_buf_size_c(hid_t_f *plist, size_t_f *size); @@ -1058,32 +837,15 @@ H5_FCDLL int_f nh5pset_small_data_block_size_c(hid_t_f *plist, hsize_t_f *size); H5_FCDLL int_f nh5pget_small_data_block_size_c(hid_t_f *plist, hsize_t_f *size); H5_FCDLL int_f nh5pset_hyper_vector_size_c(hid_t_f *plist, size_t_f *size); H5_FCDLL int_f nh5pget_hyper_vector_size_c(hid_t_f *plist, size_t_f *size); - -H5_FCDLL int_f -nh5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *class); - -H5_FCDLL int_f -nh5pregister_c(hid_t_f *class, _fcd name, int_f * name_len, size_t_f *size, void *value); - -H5_FCDLL int_f -nh5pregisterc_c(hid_t_f *class, _fcd name, int_f * name_len, size_t_f *size, _fcd value, int_f *value_len); - -H5_FCDLL int_f -nh5pinsert_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void *value); - -H5_FCDLL int_f -nh5pinsertc_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, _fcd value, int_f *value_len); - +H5_FCDLL int_f nh5pcreate_class_c(hid_t_f *parent, _fcd name, int_f *name_len, hid_t_f *class); +H5_FCDLL int_f nh5pregister_c(hid_t_f *class, _fcd name, int_f * name_len, size_t_f *size, void *value); +H5_FCDLL int_f nh5pregisterc_c(hid_t_f *class, _fcd name, int_f * name_len, size_t_f *size, _fcd value, int_f *value_len); +H5_FCDLL int_f nh5pinsert_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, void *value); +H5_FCDLL int_f nh5pinsertc_c(hid_t_f *plist, _fcd name, int_f *name_len, size_t_f *size, _fcd value, int_f *value_len); H5_FCDLL int_f nh5pset_c(hid_t_f *prp_id, _fcd name, int_f *name_len, void *value); - -H5_FCDLL int_f -nh5psetc_c(hid_t_f *prp_id, _fcd name, int_f *name_len, _fcd value, int_f *value_len); - +H5_FCDLL int_f nh5psetc_c(hid_t_f *prp_id, _fcd name, int_f *name_len, _fcd value, int_f *value_len); H5_FCDLL int_f nh5pget_c(hid_t_f *prp_id, _fcd name, int_f *name_len, void *value); - -H5_FCDLL int_f -nh5pgetc_c(hid_t_f *prp_id, _fcd name, int_f *name_len, _fcd value, int_f *value_len); - +H5_FCDLL int_f nh5pgetc_c(hid_t_f *prp_id, _fcd name, int_f *name_len, _fcd value, int_f *value_len); H5_FCDLL int_f nh5pexist_c(hid_t_f *prp_id, _fcd name, int_f *name_len); H5_FCDLL int_f nh5pget_size_c(hid_t_f *prp_id, _fcd name, int_f *name_len, size_t_f *size); H5_FCDLL int_f nh5pget_nprops_c(hid_t_f *prp_id, size_t_f *nprops); @@ -1128,24 +890,12 @@ H5_FCDLL int_f nh5pfill_value_defined_c ( hid_t_f *prp_id , int_f *flag); #endif /* DF_CAPFNAMES */ #endif /* H5Rf90_FNAMES */ -H5_FCDLL int_f -nh5rcreate_object_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen); - - -H5_FCDLL int_f -nh5rcreate_region_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id); - -H5_FCDLL int_f -nh5rdereference_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id); - -H5_FCDLL int_f -nh5rdereference_object_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id); - -H5_FCDLL int_f -nh5rget_region_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *space_id); - -H5_FCDLL int_f -nh5rget_object_type_obj_c (hid_t_f *dset_id, int_f *ref, int_f *obj_type); +H5_FCDLL int_f nh5rcreate_object_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen); +H5_FCDLL int_f nh5rcreate_region_c (int_f *ref, hid_t_f *loc_id, _fcd name, int_f *namelen, hid_t_f *space_id); +H5_FCDLL int_f nh5rdereference_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id); +H5_FCDLL int_f nh5rdereference_object_c (hid_t_f *dset_id, int_f *ref, hid_t_f *obj_id); +H5_FCDLL int_f nh5rget_region_region_c (hid_t_f *dset_id, int_f *ref, hid_t_f *space_id); +H5_FCDLL int_f nh5rget_object_type_obj_c (hid_t_f *dset_id, int_f *ref, int_f *obj_type); /* * Functions from H5If.c @@ -1174,8 +924,7 @@ H5_FCDLL int_f nh5iget_name_c(hid_t_f *obj_id, _fcd buf, size_t_f *buf_size, siz H5_FCDLL int_f nh5iinc_ref_c(hid_t_f *obj_id, int_f *ref_count); H5_FCDLL int_f nh5idec_ref_c(hid_t_f *obj_id, int_f *ref_count); H5_FCDLL int_f nh5iget_ref_c(hid_t_f *obj_id, int_f *ref_count); -H5_FCDLL int_f nh5iget_file_id_c(hid_t_f *obj_id, hid_t *file_id); - +H5_FCDLL int_f nh5iget_file_id_c(hid_t_f *obj_id, hid_t_f *file_id); #ifndef H5Ef90_FNAMES # define H5Ef90_FNAMES @@ -1232,23 +981,19 @@ H5_FCDLL int_f nh5eset_auto_c(int_f* printflag); # define nh5dont_atexit_c FNAME(h5dont_atexit_c) #endif #endif + H5_FCDLL int_f nh5open_c(void); H5_FCDLL int_f nh5close_c(void); H5_FCDLL int_f nh5init_types_c(hid_t_f *types, hid_t_f * floatingtypes, hid_t_f * integertypes); H5_FCDLL int_f nh5close_types_c(hid_t_f *types, int_f *lentypes, hid_t_f * floatingtypes, int_f * floatinglen, hid_t_f * integertypes, int_f * integerlen); - -H5_FCDLL int_f nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags, + H5_FCDLL int_f nh5init_flags_c( int_f *h5d_flags, int_f *h5f_flags, int_f *h5fd_flags, int_f *h5g_flags, int_f *h5i_flags, int_f *h5p_flags, int_f *h5r_flags, int_f *h5s_flags, int_f *h5t_flags, int_f *h5z_flags); H5_FCDLL int_f nh5init1_flags_c(int_f *h5lib_flags); - H5_FCDLL int_f nh5get_libversion_c(int_f *majnum, int_f *minnum, int_f *relnum); - H5_FCDLL int_f nh5check_version_c(int_f *majnum, int_f *minnum, int_f *relnum); - H5_FCDLL int_f nh5garbage_collect_c(void); - H5_FCDLL int_f nh5dont_atexit_c(void); /* @@ -1266,9 +1011,10 @@ H5_FCDLL int_f nh5dont_atexit_c(void); # define nh5zget_filter_info_c FNAME(h5zget_filter_info_c) #endif #endif + H5_FCDLL int_f nh5zunregister_c (int_f *filter); -H5_FCDLL int_f nh5zfilter_avail_c ( int_f *filter , int_f *flag ); -H5_FCDLL int_f nh5zget_filter_info_c ( int_f *filter , int_f *flag ); +H5_FCDLL int_f nh5zfilter_avail_c (int_f *filter, int_f *flag); +H5_FCDLL int_f nh5zget_filter_info_c (int_f *filter, int_f *flag); #endif /* _H5f90proto_H */ diff --git a/fortran/test/fflush1.f90 b/fortran/test/fflush1.f90 index 6c1cad8..52efb21 100644 --- a/fortran/test/fflush1.f90 +++ b/fortran/test/fflush1.f90 @@ -145,7 +145,7 @@ ! if errors detected, exit with non-zero code. This is not truly fortran ! standard but likely supported by most fortran compilers. - IF (total_error .ne. 0) CALL exit (total_error) + IF (total_error .ne. 0) CALL h5_exit_f (total_error) 001 STOP diff --git a/fortran/test/fflush2.f90 b/fortran/test/fflush2.f90 index acfe320..313a2a5 100644 --- a/fortran/test/fflush2.f90 +++ b/fortran/test/fflush2.f90 @@ -178,6 +178,6 @@ ! if errors detected, exit with non-zero code. This is not truly fortran ! standard but likely supported by most fortran compilers. - IF (total_error .ne. 0) CALL exit (total_error) + IF (total_error .ne. 0) CALL h5_exit_f (total_error) END PROGRAM FFLUSH2EXAMPLE diff --git a/fortran/test/t.c b/fortran/test/t.c index 3109523..0299869 100644 --- a/fortran/test/t.c +++ b/fortran/test/t.c @@ -28,11 +28,10 @@ * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5_fixname_c(_fcd base_name, int_f *base_namelen, hid_t_f* fapl, _fcd full_name, int_f *full_namelen) +nh5_fixname_c(_fcd base_name, size_t_f *base_namelen, hid_t_f* fapl, _fcd full_name, size_t_f *full_namelen) { int ret_value = -1; char *c_base_name; - int c_base_namelen; char *c_full_name; hid_t c_fapl; @@ -43,8 +42,7 @@ nh5_fixname_c(_fcd base_name, int_f *base_namelen, hid_t_f* fapl, _fcd full_name /* * Convert FORTRAN name to C name */ - c_base_namelen = *base_namelen; - c_base_name = (char *)HD5f2cstring(base_name, c_base_namelen); + c_base_name = (char *)HD5f2cstring(base_name, (size_t)*base_namelen); if (c_base_name == NULL) goto DONE; c_full_name = (char *) HDmalloc((size_t)*full_namelen + 1); if (c_full_name == NULL) goto DONE; @@ -53,10 +51,11 @@ nh5_fixname_c(_fcd base_name, int_f *base_namelen, hid_t_f* fapl, _fcd full_name * Call h5_fixname function. */ if (NULL != h5_fixname(c_base_name, c_fapl, c_full_name, (size_t)*full_namelen + 1)) { - HD5packFstring(c_full_name, _fcdtocp(full_name), *full_namelen); - ret_value = 0; - goto DONE; + HD5packFstring(c_full_name, _fcdtocp(full_name), (size_t)*full_namelen); + ret_value = 0; + goto DONE; } + DONE: if (NULL != c_base_name) HDfree(c_base_name); if (NULL != c_full_name) HDfree(c_full_name); @@ -75,12 +74,11 @@ DONE: * Modifications: *---------------------------------------------------------------------------*/ int_f -nh5_cleanup_c(_fcd base_name, int_f *base_namelen, hid_t_f* fapl) +nh5_cleanup_c(_fcd base_name, size_t_f *base_namelen, hid_t_f* fapl) { char filename[1024]; int ret_value = -1; char *c_base_name[1]; - int c_base_namelen; hid_t c_fapl; /* @@ -91,8 +89,7 @@ nh5_cleanup_c(_fcd base_name, int_f *base_namelen, hid_t_f* fapl) /* * Convert FORTRAN name to C name */ - c_base_namelen = *base_namelen; - c_base_name[0] = (char *)HD5f2cstring(base_name, c_base_namelen); + c_base_name[0] = (char *)HD5f2cstring(base_name, (size_t)*base_namelen); if (c_base_name[0] == NULL) goto DONE; /* @@ -104,10 +101,27 @@ nh5_cleanup_c(_fcd base_name, int_f *base_namelen, hid_t_f* fapl) } */ h5_fixname(c_base_name[0], c_fapl, filename, sizeof(filename)); - remove(filename); + HDremove(filename); ret_value =0; + DONE: if (NULL != c_base_name[0]) HDfree(c_base_name[0]); return ret_value; } + +/*---------------------------------------------------------------------------- + * Name: h5_exit_c + * Purpose: Call 'exit()' to terminate application + * Inputs: status - status for exit() to return + * Returns: none + * Programmer: Quincey Koziol + * Tuesday, December 14, 2004 + * Modifications: + *---------------------------------------------------------------------------*/ +void +nh5_exit_c(int_f *status) +{ + HDexit((int)*status); +} /* h5_exit_c */ + diff --git a/fortran/test/t.h b/fortran/test/t.h index fca9cb1..0286028 100644 --- a/fortran/test/t.h +++ b/fortran/test/t.h @@ -24,13 +24,19 @@ char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) #ifdef DF_CAPFNAMES # define nh5_fixname_c FNAME(H5_FIXNAME_C) # define nh5_cleanup_c FNAME(H5_CLEANUP_C) +# define nh5_exit_c FNAME(H5_EXIT_C) #else /* !DF_CAPFNAMES */ # define nh5_fixname_c FNAME(h5_fixname_c) # define nh5_cleanup_c FNAME(h5_cleanup_c) +# define nh5_exit_c FNAME(h5_exit_c) #endif /* DF_CAPFNAMES */ H5_FCTESTDLL int_f nh5_fixname_c -(_fcd base_name, int_f *base_namelen, hid_t_f *fapl, _fcd full_name, int_f *full_namelen); +(_fcd base_name, size_t_f *base_namelen, hid_t_f *fapl, _fcd full_name, size_t_f *full_namelen); H5_FCTESTDLL int_f nh5_cleanup_c -(_fcd base_name, int_f *base_namelen, hid_t_f *fapl); +(_fcd base_name, size_t_f *base_namelen, hid_t_f *fapl); + +H5_FCTESTDLL void nh5_exit_c +(int_f *status); + diff --git a/fortran/test/tH5I.f90 b/fortran/test/tH5I.f90 index fb526e4..8790bc3 100644 --- a/fortran/test/tH5I.f90 +++ b/fortran/test/tH5I.f90 @@ -31,7 +31,7 @@ INTEGER(HID_T) :: file_id ! File identifier - INTEGER(HID_T) :: new_file_id ! File identifier + INTEGER(HID_T) :: new_file_id ! File identifier INTEGER(HID_T) :: group_id ! group identifier INTEGER(HID_T) :: dset_id ! Dataset identifier INTEGER(HID_T) :: dspace_id ! Dataspace identifier @@ -103,12 +103,13 @@ total_error = total_error + 1 endif endif + ! ! Get file identifier from dataset identifier and then get file name ! CALL h5iget_file_id_f(dset_id, new_file_id, error) CALL check("h5iget_file_id_f",error,total_error) - name_size = 80 + name_size = 280 CALL h5fget_name_f(new_file_id, name_buf1, name_size, error) CALL check("h5fget_name_f",error,total_error) if (name_buf1(1:name_size) .ne. fix_filename(1:name_size)) then diff --git a/fortran/test/tH5R.f90 b/fortran/test/tH5R.f90 index 7cc71a5..d4f2911 100644 --- a/fortran/test/tH5R.f90 +++ b/fortran/test/tH5R.f90 @@ -223,13 +223,13 @@ INTEGER(HSIZE_T), DIMENSION(2) :: data_dims INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/2,9/) ! Datasets dimensions INTEGER(HSIZE_T), DIMENSION(1) :: dimsr = (/2/) ! - INTEGER(HSSIZE_T), DIMENSION(2) :: start + INTEGER(HSIZE_T), DIMENSION(2) :: start INTEGER(HSIZE_T), DIMENSION(2) :: count INTEGER :: rankr = 1 INTEGER :: rank = 2 INTEGER , DIMENSION(2,9) :: data INTEGER , DIMENSION(2,9) :: data_out = 0 - INTEGER(HSSIZE_T) , DIMENSION(2,3) :: coord + INTEGER(HSIZE_T) , DIMENSION(2,3) :: coord INTEGER(SIZE_T) ::num_points = 3 ! Number of selected points INTEGER :: i, j coord = reshape((/1,1,2,7,1,9/), (/2,3/)) ! Coordinates of selected points diff --git a/fortran/test/tH5Sselect.f90 b/fortran/test/tH5Sselect.f90 index ad95ecf..690e957 100644 --- a/fortran/test/tH5Sselect.f90 +++ b/fortran/test/tH5Sselect.f90 @@ -371,7 +371,7 @@ ! !Points positions in the file ! - INTEGER(HSSIZE_T), DIMENSION(RANK,NUMP) :: coord + INTEGER(HSIZE_T), DIMENSION(RANK,NUMP) :: coord ! !data buffers @@ -760,7 +760,7 @@ ! !array to give selected points' coordinations ! - INTEGER(HSSIZE_T), DIMENSION(RANK, NUMPS) :: coord + INTEGER(HSIZE_T), DIMENSION(RANK, NUMPS) :: coord ! !Size of the hyperslab in memory @@ -793,7 +793,7 @@ ! !start and end bounds in the current dataspace selection ! - INTEGER(HSSIZE_T), DIMENSION(RANK) :: startout, endout + INTEGER(HSIZE_T), DIMENSION(RANK) :: startout, endout ! !data to write diff --git a/fortran/test/tH5T.f90 b/fortran/test/tH5T.f90 index 5e406b8..f2dddb4 100644 --- a/fortran/test/tH5T.f90 +++ b/fortran/test/tH5T.f90 @@ -85,7 +85,7 @@ INTEGER :: array_dims_range = 3 INTEGER :: elements = 24 ! number of elements in the array_dims array. INTEGER(SIZE_T) :: sizechar - INTEGER(HSIZE_T), DIMENSION(2) :: data_dims + INTEGER(HSIZE_T), DIMENSION(1) :: data_dims LOGICAL :: flag = .TRUE. data_dims(1) = dimsize ! diff --git a/fortran/test/tH5Z.f90 b/fortran/test/tH5Z.f90 index 4260fca..c64d99b 100644 --- a/fortran/test/tH5Z.f90 +++ b/fortran/test/tH5Z.f90 @@ -145,7 +145,6 @@ endif endif - RETURN END SUBROUTINE filters_test @@ -181,7 +180,6 @@ INTEGER :: num_errors = 0 ! Number of data errors INTEGER :: i, j !general purpose integers - INTEGER :: config_flags ! for h5zget_filter_info_f INTEGER(HSIZE_T), DIMENSION(2) :: data_dims INTEGER(HID_T) :: crp_list INTEGER :: options_mask, pix_per_block @@ -191,26 +189,36 @@ INTEGER :: filter_flag = -1 INTEGER(SIZE_T) :: cd_nelemnts = 4 INTEGER(SIZE_T) :: filter_name_len = 4 - INTEGER, DIMENSION(4) :: cd_values + INTEGER, DIMENSION(4) :: cd_values + INTEGER :: config_flag = 0 ! for h5zget_filter_info_f ! ! Verify that SZIP exists and has an encoder ! - CALL h5zfilter_avail_f(H5Z_FILTER_SZIP_F, flag, error) - CALL check("h5zfilter_avail_f", error, total_error) - if(.NOT. flag) then + CALL h5zget_filter_info_f(H5Z_FILTER_SZIP_F, config_flag, error) + CALL check("h5zget_filter_info", error, total_error) + if ( IAND(config_flag, H5Z_FILTER_ENCODE_ENABLED_F) .EQ. 0 ) then szip_flag = .FALSE. total_error = -1 return endif + CALL h5zfilter_avail_f(H5Z_FILTER_SZIP_F, flag, error) + CALL check("h5zfilter_avail", error, total_error) - CALL h5zget_filter_info_f(H5Z_FILTER_SZIP_F, config_flags, error) - CALL check("h5zget_filter_info_f", error, total_error) - if(.NOT. (IAND(config_flags, H5Z_FILTER_ENCODE_ENABLED_F) .eq. 1) ) then - szip_flag = .FALSE. - total_error = -1 - return - endif + ! + ! Make sure h5zget_filter_info_f returns the right flag + ! + if( flag ) then + if ( config_flag .NE. IOR( H5Z_FILTER_ENCODE_ENABLED_F, H5Z_FILTER_DECODE_ENABLED_F) ) then + error = -1 + CALL check("h5zget_filter_info config_flag", error, total_error) + endif + else + if ( config_flag .NE. 0 ) then + error = -1 + CALL check("h5zget_filter_info config_flag", error, total_error) + endif + endif options_mask = H5_SZIP_NN_OM_F pix_per_block = 32 @@ -255,6 +263,8 @@ CALL h5pclose_f(crp_list, error) CALL h5sclose_f(dspace_id, error) CALL h5fclose_f(file_id, error) + szip_flag = .FALSE. + total_error = -1 return endif diff --git a/fortran/test/tf.f90 b/fortran/test/tf.f90 index 3a72571..057d47c 100644 --- a/fortran/test/tf.f90 +++ b/fortran/test/tf.f90 @@ -80,8 +80,8 @@ INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER(HID_T), INTENT(IN) :: fapl ! file access property list - INTEGER :: base_namelen ! Length of the base name character string - INTEGER :: full_namelen ! Length of the full name character string + INTEGER(SIZE_T) :: base_namelen ! Length of the base name character string + INTEGER(SIZE_T) :: full_namelen ! Length of the full name character string ! INTEGER(HID_T) :: fapl_default INTERFACE @@ -94,10 +94,10 @@ !DEC$ATTRIBUTES reference :: base_name !DEC$ATTRIBUTES reference :: full_name CHARACTER(LEN=*), INTENT(IN) :: base_name - INTEGER :: base_namelen + INTEGER(SIZE_T) :: base_namelen INTEGER(HID_T), INTENT(IN) :: fapl CHARACTER(LEN=*), INTENT(IN) :: full_name - INTEGER :: full_namelen + INTEGER(SIZE_T) :: full_namelen END FUNCTION h5_fixname_c END INTERFACE @@ -139,7 +139,7 @@ INTEGER, INTENT(OUT) :: hdferr ! Error code INTEGER(HID_T), INTENT(IN) :: fapl ! file access property list - INTEGER :: base_namelen ! Length of the base name character string + INTEGER(SIZE_T) :: base_namelen ! Length of the base name character string INTERFACE INTEGER FUNCTION h5_cleanup_c(base_name, base_namelen, fapl) @@ -149,7 +149,7 @@ !DEC$ ENDIF !DEC$ATTRIBUTES reference :: base_name CHARACTER(LEN=*), INTENT(IN) :: base_name - INTEGER :: base_namelen + INTEGER(SIZE_T) :: base_namelen INTEGER(HID_T), INTENT(IN) :: fapl END FUNCTION h5_cleanup_c END INTERFACE @@ -158,3 +158,43 @@ hdferr = h5_cleanup_c(base_name, base_namelen, fapl) END SUBROUTINE h5_cleanup_f + +!---------------------------------------------------------------------- +! Name: h5_exit_f +! +! Purpose: Exit application +! It is a fortran counterpart for the standard C 'exit()' routine +! +! Inputs: +! status - Status to return from application +! +! Outputs: +! none +! +! Programmer: Quincey Koziol +! December 14, 2004 +! +! +!---------------------------------------------------------------------- + SUBROUTINE h5_exit_f(status) +! +!This definition is needed for Windows DLLs +!DEC$if defined(BUILD_HDF5_DLL) +!DEC$attributes dllexport :: h5_exit_f +!DEC$endif + IMPLICIT NONE + INTEGER, INTENT(IN) :: status ! Return code + + INTERFACE + SUBROUTINE h5_exit_c(status) + !DEC$ IF DEFINED(HDF5F90_WINDOWS) + !MS$ATTRIBUTES C,reference,alias:'_H5_EXIT_C':: h5_exit_c + !DEC$ ENDIF + INTEGER, INTENT(IN) :: status + END SUBROUTINE h5_exit_c + END INTERFACE + + CALL h5_exit_c(status) + + END SUBROUTINE h5_exit_f + diff --git a/hl/fortran/src/H5LTfc.c b/hl/fortran/src/H5LTfc.c index f2b1aca..12a8a3c 100755 --- a/hl/fortran/src/H5LTfc.c +++ b/hl/fortran/src/H5LTfc.c @@ -870,7 +870,7 @@ nh5ltget_dataset_info_c(hid_t_f *loc_id, ret = H5LTget_dataset_info(c_loc_id, c_name, c_dims, &c_classtype, &c_type_size); *type_class = c_classtype; - *type_size = c_type_size; + *type_size = (size_t_f)c_type_size; for (i = 0; i < 32 ; i++) { dims[i] = (hsize_t_f) c_dims[i]; } @@ -1000,7 +1000,7 @@ nh5ltget_attribute_info_c(hid_t_f *loc_id, ret = H5LTget_attribute_info(c_loc_id,c_name,c_attrname,c_dims,&c_classtype,&c_type_size); *type_class = c_classtype; - *type_size = c_type_size; + *type_size = (size_t_f)c_type_size; for (i = 0; i < 32 ; i++) { dims[i] = (hsize_t_f) c_dims[i]; } diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c index 68bade4..78866c8 100755 --- a/hl/fortran/src/H5TBfc.c +++ b/hl/fortran/src/H5TBfc.c @@ -65,7 +65,6 @@ nh5tbmake_table_c(int_f *namelen1, hsize_t c_nfields = *nfields; hsize_t c_nrecords = *nrecords; hsize_t c_chunk_size = *chunk_size; - int c_compress = *compress; size_t c_type_size = *type_size; size_t *c_field_offset; hid_t *c_field_types; @@ -689,11 +688,11 @@ nh5tbget_field_info_c(hid_t_f *loc_id, HD5packFstring(tmp, _fcdtocp(field_names), (int)(c_lenmax*c_nfields)); - *type_size = c_type_size; + *type_size = (size_t_f)c_type_size; for (i=0; i < num_elem; i++) { - field_sizes[i] = c_field_sizes[i]; - field_offsets[i] = c_field_offsets[i]; + field_sizes[i] = (size_t_f)c_field_sizes[i]; + field_offsets[i] = (size_t_f)c_field_offsets[i]; } diff --git a/hl/fortran/test/tsttable.f90 b/hl/fortran/test/tsttable.f90 index 2f27d3c..44a42ce 100755 --- a/hl/fortran/test/tsttable.f90 +++ b/hl/fortran/test/tsttable.f90 @@ -54,7 +54,7 @@ integer(SIZE_T) :: type_sized ! Size of the double prec integer(SIZE_T) :: type_sizer ! Size of the real datatype integer(HID_T) :: type_id_c ! Memory datatype identifier (for character field) integer(SIZE_T) :: offset ! Member's offset -integer(HSIZE_T) :: start ! start record +integer(HSIZE_T) :: start = 0 ! start record integer, dimension(nrecords) :: bufi ! Data buffer integer, dimension(nrecords) :: bufir ! Data buffer real, dimension(nrecords) :: bufr ! Data buffer diff --git a/hl/src/H5IM.c b/hl/src/H5IM.c index a2b8172..4d5ce75 100644 --- a/hl/src/H5IM.c +++ b/hl/src/H5IM.c @@ -535,10 +535,7 @@ herr_t H5IMlink_palette( hid_t loc_id, hobj_ref_t *refbuf; /* buffer to read references */ hssize_t n_refs; hsize_t dim_ref; - int ok_pal, has_pal; - - /* Try to find the palette dataset */ - has_pal = H5LTfind_dataset( loc_id, pal_name ); + int ok_pal; /* 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. @@ -888,7 +885,6 @@ herr_t H5IMget_palette_info( hid_t loc_id, hsize_t dim_ref; hobj_ref_t *refbuf; /* buffer to read references */ hid_t pal_id; - int rank; hid_t pal_space_id; hsize_t pal_maxdims[2]; @@ -938,7 +934,7 @@ herr_t H5IMget_palette_info( hid_t loc_id, if ( (pal_space_id = H5Dget_space( pal_id )) < 0 ) goto out; - if ( (rank = H5Sget_simple_extent_ndims( pal_space_id )) < 0 ) + if ( H5Sget_simple_extent_ndims( pal_space_id ) < 0 ) goto out; if ( H5Sget_simple_extent_dims( pal_space_id, pal_dims, pal_maxdims ) < 0 ) @@ -1114,7 +1110,6 @@ herr_t H5IMis_image( hid_t loc_id, int has_class; hid_t attr_type; hid_t attr_id; - hid_t attr_class; char attr_data[20]; herr_t ret; @@ -1143,7 +1138,7 @@ herr_t H5IMis_image( hid_t loc_id, if ( (attr_type = H5Aget_type( attr_id )) < 0 ) goto out; - if ( (attr_class = H5Tget_class( attr_type )) < 0 ) + if ( H5Tget_class( attr_type ) < 0 ) goto out; if ( H5Aread( attr_id, attr_type, attr_data ) < 0 ) @@ -1203,7 +1198,6 @@ herr_t H5IMis_palette( hid_t loc_id, int has_class; hid_t attr_type; hid_t attr_id; - hid_t attr_class; char attr_data[20]; herr_t ret; @@ -1232,7 +1226,7 @@ herr_t H5IMis_palette( hid_t loc_id, if ( (attr_type = H5Aget_type( attr_id )) < 0 ) goto out; - if ( (attr_class = H5Tget_class( attr_type )) < 0 ) + if ( H5Tget_class( attr_type ) < 0 ) goto out; if ( H5Aread( attr_id, attr_type, attr_data ) < 0 ) diff --git a/hl/src/H5TA.c b/hl/src/H5TA.c index 79a845b..f90819c 100644 --- a/hl/src/H5TA.c +++ b/hl/src/H5TA.c @@ -305,10 +305,9 @@ herr_t H5TBappend_records( hid_t loc_id, hid_t tid=-1; hid_t mem_type_id=-1; hsize_t count[1]; - hssize_t offset[1]; + hsize_t offset[1]; hid_t sid=-1; hid_t mem_space_id=-1; - int rank; hsize_t dims[1]; hsize_t mem_dims[1]; hsize_t nrecords_orig; @@ -346,7 +345,7 @@ herr_t H5TBappend_records( hid_t loc_id, return -1; /* Get the dimensions */ - if ( (rank = H5Sget_simple_extent_dims( sid, dims, NULL )) != 1 ) + if ( H5Sget_simple_extent_dims( sid, dims, NULL ) != 1 ) goto out; /* Define a hyperslab in the dataset */ @@ -426,7 +425,7 @@ herr_t H5TBwrite_records( hid_t loc_id, hid_t did; hid_t tid; hsize_t count[1]; - hssize_t offset[1]; + hsize_t offset[1]; hid_t sid=-1; hid_t mem_space_id=-1; hsize_t mem_size[1]; @@ -540,7 +539,7 @@ herr_t H5TBwrite_fields_name( hid_t loc_id, hid_t member_type_id; hid_t nmtype_id; hsize_t count[1]; - hssize_t offset[1]; + hsize_t offset[1]; hid_t sid=-1; char *member_name; hssize_t nfields; @@ -710,10 +709,9 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, hid_t member_type_id; hid_t nmtype_id; hsize_t count[1]; - hssize_t offset[1]; + hsize_t offset[1]; hid_t sid=-1; char *member_name; - int nmenbers; hsize_t i, j; hid_t PRESERVE; size_t size_native; @@ -733,7 +731,7 @@ herr_t H5TBwrite_fields_index( hid_t loc_id, goto out; /* Get the number of fields */ - if ( ( nmenbers = H5Tget_nmembers( tid )) < 0 ) + if ( H5Tget_nmembers( tid ) < 0 ) goto out; /* Create a write id */ @@ -954,7 +952,7 @@ herr_t H5TBread_records( hid_t loc_id, hid_t ftype_id; hid_t mem_type_id=-1; hsize_t count[1]; - hssize_t offset[1]; + hsize_t offset[1]; hid_t sid=-1; hsize_t dims[1]; hid_t mem_space_id=-1; @@ -1071,7 +1069,7 @@ herr_t H5TBread_fields_name( hid_t loc_id, char *member_name; hssize_t nfields; hsize_t count[1]; - hssize_t offset[1]; + hsize_t offset[1]; hid_t sid=-1; hid_t mem_space_id=-1; hsize_t mem_size[1]; @@ -1224,10 +1222,9 @@ herr_t H5TBread_fields_index( hid_t loc_id, hid_t read_type_id=-1; hid_t member_type_id; hid_t nmtype_id; - hssize_t member_size; char *member_name; hsize_t count[1]; - hssize_t offset[1]; + hsize_t offset[1]; hid_t sid=-1; hid_t mem_space_id=-1; hsize_t mem_size[1]; @@ -1259,7 +1256,7 @@ herr_t H5TBread_fields_index( hid_t loc_id, goto out; /* Get the member size */ - if ( ( member_size = H5Tget_size( member_type_id )) < 0 ) + if ( H5Tget_size( member_type_id ) == 0 ) goto out; /* Convert to native type */ @@ -1387,7 +1384,7 @@ herr_t H5TBdelete_record( hid_t loc_id, hid_t did; hid_t tid; hsize_t count[1]; - hssize_t offset[1]; + hsize_t offset[1]; hid_t sid; hid_t mem_space_id; hsize_t mem_size[1]; @@ -1558,7 +1555,7 @@ herr_t H5TBinsert_record( hid_t loc_id, hid_t tid=-1; hid_t mem_type_id=-1; hsize_t count[1]; - hssize_t offset[1]; + hsize_t offset[1]; hid_t sid=-1; hid_t mem_space_id=-1; hsize_t dims[1]; @@ -1719,10 +1716,10 @@ herr_t H5TBadd_records_from( hid_t loc_id, hid_t type_id1; hid_t space_id1=-1; hid_t mem_space_id1=-1; - hssize_t type_size1; + size_t type_size1; hsize_t count[1]; - hssize_t offset[1]; + hsize_t offset[1]; hsize_t mem_size[1]; hsize_t nfields; hsize_t ntotal_records; @@ -1768,10 +1765,10 @@ herr_t H5TBadd_records_from( hid_t loc_id, goto out; /* Get the size of the datatype */ - if ( ( type_size1 = H5Tget_size( type_id1 )) < 0 ) + if ( ( type_size1 = H5Tget_size( type_id1 )) == 0 ) goto out; - tmp_buf = (unsigned char *)calloc((size_t)nrecords, (size_t)type_size1 ); + tmp_buf = (unsigned char *)calloc((size_t)nrecords, type_size1 ); /* Define a hyperslab in the dataset of the size of the records */ offset[0] = start1; @@ -1877,7 +1874,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, hid_t plist_id3; hsize_t count[1]; - hssize_t offset[1]; + hsize_t offset[1]; hid_t mem_space_id; hsize_t mem_size[1]; hsize_t nfields; @@ -1889,7 +1886,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, size_t type_size; hid_t sid; hid_t member_type_id; - hssize_t member_offset; + size_t member_offset; char attr_name[255]; hid_t attr_id; char aux[255]; @@ -2012,8 +2009,7 @@ herr_t H5TBcombine_tables( hid_t loc_id1, goto out; /* Get the member offset */ - if ( ( member_offset = H5Tget_member_offset( type_id3, (unsigned) i )) < 0 ) - goto out; + member_offset = H5Tget_member_offset( type_id3, (unsigned) i ); strcpy( attr_name, "FIELD_" ); sprintf( aux, "%d", (int) i ); @@ -2260,15 +2256,14 @@ herr_t H5TBinsert_field( hid_t loc_id, size_t member_size; size_t new_member_size = 0; char *member_name; - hssize_t total_size; + size_t total_size; hsize_t nfields; hsize_t nrecords; - int rank_chunk; hsize_t dims_chunk[1]; hsize_t dims[1]; hsize_t maxdims[1] = { H5S_UNLIMITED }; hsize_t count[1]; - hssize_t offset[1]; + hsize_t offset[1]; hsize_t mem_size[1]; hid_t write_type_id; hid_t PRESERVE; @@ -2276,7 +2271,7 @@ herr_t H5TBinsert_field( hid_t loc_id, int inserted; hsize_t idx; char table_title[255]; - hssize_t member_offset; + size_t member_offset; char attr_name[255]; hid_t attr_id; char aux[255]; @@ -2306,7 +2301,7 @@ herr_t H5TBinsert_field( hid_t loc_id, goto out; /* Get the size of the datatype */ - if ( ( total_size = H5Tget_size( type_id1 )) < 0 ) + if ( ( total_size = H5Tget_size( type_id1 )) == 0 ) goto out; /* Get the dataspace handle */ @@ -2327,7 +2322,7 @@ herr_t H5TBinsert_field( hid_t loc_id, goto out; /* alloc fill value attribute buffer */ - tmp_fill_buf = (unsigned char *)malloc((size_t) total_size ); + tmp_fill_buf = (unsigned char *)malloc(total_size ); /* Get the fill value attributes */ if ( (H5TBAget_fill( loc_id, dset_name, dataset_id1, tmp_fill_buf )) < 0 ) @@ -2405,7 +2400,7 @@ herr_t H5TBinsert_field( hid_t loc_id, */ /* Retrieve the size of chunk */ - if ( ( rank_chunk = H5Pget_chunk( plist_id1, 1, dims_chunk )) < 0 ) + if ( H5Pget_chunk( plist_id1, 1, dims_chunk ) < 0 ) goto out; /* Create a new simple data space with unlimited size, using the dimension */ @@ -2593,8 +2588,7 @@ herr_t H5TBinsert_field( hid_t loc_id, goto out; /* Get the member offset */ - if ( ( member_offset = H5Tget_member_offset( type_id1, (unsigned) i )) < 0 ) - goto out; + member_offset = H5Tget_member_offset( type_id1, (unsigned) i ); strcpy( attr_name, "FIELD_" ); sprintf( aux, "%d", (int)i ); @@ -2714,7 +2708,6 @@ herr_t H5TBdelete_field( hid_t loc_id, size_t type_size2; hsize_t nfields; hsize_t nrecords; - int rank_chunk; hsize_t dims_chunk[1]; hsize_t dims[1]; hsize_t maxdims[1] = { H5S_UNLIMITED }; @@ -2892,7 +2885,7 @@ herr_t H5TBdelete_field( hid_t loc_id, */ /* Retrieve the size of chunk */ - if ( ( rank_chunk = H5Pget_chunk( plist_id1, 1, dims_chunk )) < 0 ) + if ( H5Pget_chunk( plist_id1, 1, dims_chunk ) < 0 ) goto out; /* Create a new simple data space with unlimited size, using the dimension */ diff --git a/hl/test/test_image.c b/hl/test/test_image.c index d47cab1..c01dd0d 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -31,15 +31,12 @@ unsigned char image_out2[ WIDTH*HEIGHT*3 ]; int main( void ) { hid_t file_id; - herr_t status; hsize_t width, height, planes; hsize_t pal_dims[] = {9,3}; hsize_t pal_dims_out[2]; hsize_t i; char interlace[20]; hssize_t npals; - herr_t is_image; - herr_t is_palette; unsigned char pal_data_out[9*3]; /* create a 9 entry grey palette */ @@ -165,10 +162,10 @@ int main( void ) *------------------------------------------------------------------------- */ - if ( (is_image = H5IMis_image( file_id, "Image1" )) < 0 ) + if ( H5IMis_image( file_id, "Image1" ) < 0 ) goto out; - if ( (is_image = H5IMis_image( file_id, "Image2" )) < 0 ) + if ( H5IMis_image( file_id, "Image2" ) < 0 ) goto out; /*------------------------------------------------------------------------- @@ -176,7 +173,7 @@ int main( void ) *------------------------------------------------------------------------- */ - if ( (is_palette = H5IMis_palette( file_id, "Pallete" )) < 0 ) + if ( H5IMis_palette( file_id, "Pallete" ) < 0 ) goto out; /*------------------------------------------------------------------------- @@ -185,7 +182,7 @@ int main( void ) */ /* Close the file. */ - status = H5Fclose( file_id ); + if(H5Fclose( file_id ) < 0) goto out; PASSED(); return 0; diff --git a/hl/test/test_table.c b/hl/test/test_table.c index b791fe1..57b3791 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -934,9 +934,9 @@ int test_table(hid_t fid, int write) rbuf[i].longi != position_in[i].longi || rbuf[i].pressure != pressure_in[i] ) { - fprintf(stderr,"%d %f %d\n", + fprintf(stderr,"%ld %f %d\n", rbuf[i].longi,rbuf[i].pressure,rbuf[i].lati); - fprintf(stderr,"%d %f %d\n", + fprintf(stderr,"%ld %f %d\n", position_in[i].longi,pressure_in[i],position_in[i].lati); goto out; } @@ -1560,9 +1560,9 @@ static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf ) rbuf[i].pressure != wbuf[j].pressure || rbuf[i].temperature != wbuf[j].temperature ) { fprintf(stderr,"read and write buffers have differences\n"); - fprintf(stderr,"%s %d %f %f %d\n", + fprintf(stderr,"%s %ld %f %f %d\n", rbuf[i].name,rbuf[i].longi,rbuf[i].pressure,rbuf[i].temperature,rbuf[i].lati); - fprintf(stderr,"%s %d %f %f %d\n", + fprintf(stderr,"%s %ld %f %f %d\n", wbuf[j].name,wbuf[j].longi,wbuf[j].pressure,wbuf[j].temperature,wbuf[j].lati); return -1; } diff --git a/pablo/ProcTrace.h b/pablo/ProcTrace.h index 3f1ea4e..e9e3d31 100644 --- a/pablo/ProcTrace.h +++ b/pablo/ProcTrace.h @@ -84,6 +84,9 @@ /*======================================================================*/ /* Assign HDF identifier routine tags */ /*======================================================================*/ +#ifdef RUNTIME_TRACE +#undef RUNTIME_TRACE +#endif enum HDF_IDS { NO_TRACE = 0, RUNTIME_TRACE = 1, diff --git a/perform/chunk.c b/perform/chunk.c index 7e75762..4150b49 100644 --- a/perform/chunk.c +++ b/perform/chunk.c @@ -195,7 +195,7 @@ test_rowmaj (int op, size_t cache_size, size_t io_size) hid_t file, dset, mem_space, file_space; signed char *buf = calloc (1, (size_t)(SQUARE(io_size))); hsize_t i, j, hs_size[2]; - hssize_t hs_offset[2]; + hsize_t hs_offset[2]; int mdc_nelmts; size_t rdcc_nelmts; double w0; @@ -271,7 +271,7 @@ test_diag (int op, size_t cache_size, size_t io_size, size_t offset) hid_t file, dset, mem_space, file_space; hsize_t i, hs_size[2]; hsize_t nio = 0; - hssize_t hs_offset[2]; + hsize_t hs_offset[2]; signed char *buf = calloc (1, (size_t)(SQUARE (io_size))); int mdc_nelmts; size_t rdcc_nelmts; diff --git a/perform/iopipe.c b/perform/iopipe.c index aa1ac77..92c85c3 100644 --- a/perform/iopipe.c +++ b/perform/iopipe.c @@ -203,7 +203,7 @@ main (void) int i, fd; hssize_t n; off_t offset; - hssize_t start[2]; + hsize_t start[2]; hsize_t count[2]; diff --git a/perform/overhead.c b/perform/overhead.c index 915d468..d9715e7 100644 --- a/perform/overhead.c +++ b/perform/overhead.c @@ -195,7 +195,7 @@ test(fill_t fill_style, const double splits[], hsize_t ch_size[1] = {1}; /*chunk size */ hsize_t cur_size[1] = {1000}; /*current dataset size */ hsize_t max_size[1] = {H5S_UNLIMITED}; /*maximum dataset size */ - hssize_t hs_start[1]; /*hyperslab start offset*/ + hsize_t hs_start[1]; /*hyperslab start offset*/ hsize_t hs_count[1] = {1}; /*hyperslab nelmts */ int fd = (-1); /*h5 file direct */ static int *had = NULL; /*for random filling */ diff --git a/perform/perf_meta.c b/perform/perf_meta.c index fc9872d..e157c78 100644 --- a/perform/perf_meta.c +++ b/perform/perf_meta.c @@ -170,10 +170,8 @@ parse_options(int argc, char **argv) } /*while*/ /* Check valid values */ +#ifndef H5_HAVE_PARALLEL if(facc_type == FACC_MPIO || facc_type == FACC_MPIPOSIX) -#ifdef H5_HAVE_PARALLEL - ; -#else { nerrors++; return(1); @@ -852,3 +850,4 @@ main(int argc, char **argv) return 1; } + diff --git a/perform/pio_engine.c b/perform/pio_engine.c index b4dd5b8..153f823 100644 --- a/perform/pio_engine.c +++ b/perform/pio_engine.c @@ -520,7 +520,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, hsize_t h5block[1]; /*dataspace selection */ hsize_t h5stride[1]; hsize_t h5count[1]; - hssize_t h5start[1]; + hsize_t h5start[1]; hssize_t h5offset[1]; /* Selection offset within dataspace */ hid_t h5dcpl = -1; /* Dataset creation property list */ hid_t h5dxpl = -1; /* Dataset transfer property list */ @@ -1001,7 +1001,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, hsize_t h5block[1]; /*dataspace selection */ hsize_t h5stride[1]; hsize_t h5count[1]; - hssize_t h5start[1]; + hsize_t h5start[1]; hssize_t h5offset[1]; /* Selection offset within dataspace */ hid_t h5dxpl = -1; /* Dataset transfer property list */ diff --git a/perform/zip_perf.c b/perform/zip_perf.c index 37f264a..321d6e6 100644 --- a/perform/zip_perf.c +++ b/perform/zip_perf.c @@ -12,8 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* @(#) $Id$ */ - /* =========================================================================== * Usage: zip_perf [-d] [-f] [-h] [-1 to -9] [files...] * -d : decompress diff --git a/release_docs/INSTALL_parallel b/release_docs/INSTALL_parallel index d6f1979..65014da 100644 --- a/release_docs/INSTALL_parallel +++ b/release_docs/INSTALL_parallel @@ -5,21 +5,21 @@ 1. Overview ----------- -This file contains instructions for the installation of parallel -HDF5. Platforms supported by this release are SGI Origin 2000, IBM SP2, -Intel TFLOPs, and Linux version 2.2 and greater. The steps are kind of -unnatural and will be more automized in the next release. If you have -difficulties installing the software in your system, please send mail to +This file contains instructions for the installation of parallel HDF5 (PHDF5). +PHDF5 requires an MPI compiler with MPI-IO support and a parallel file system. +If you don't know yet, you should first consult with your system support staff +of information how to compile an MPI program, how to run an MPI application, +and how to access the parallel file system. There are sample MPI-IO C and +Fortran programs in the section of "Sample programs". You can use them to +run simple tests of your MPI compilers and the parallel file system. - hdfparallel@ncsa.uiuc.edu +If you still have difficulties installing PHDF5 in your system, please +send mail to + hdfhelp@ncsa.uiuc.edu -In your mail, please include the output of "uname -a". Also attach the -content of "config.log" if you ran the "configure" command. - -First, you must obtain and unpack the HDF5 source as described in the -INSTALL file. You also need to obtain the information of the include and -library paths of MPI and MPIO software installed in your system since the -parallel HDF5 library uses them for parallel I/O access. +In your mail, please include the output of "uname -a". If you have run the +"configure" command, attach the output of the command and the content of +the file "config.log". 2. Quick Instruction for known systems @@ -34,7 +34,7 @@ to the next section for more detailed explanations. Know parallel compilers ------ -HDF5 knows serveral parallel compilers: mpicc, hcc, mpcc, mpcc_r. +HDF5 knows several parallel compilers: mpicc, hcc, mpcc, mpcc_r. To build parallel HDF5 with one of the above, just set CC as it and configure. The "--enable-parallel" is optional in this case. @@ -48,7 +48,7 @@ and configure. The "--enable-parallel" is optional in this case. TFLOPS ------ -Follow the instuctions in INSTALL_TFLOPS. +Follow the instructions in INSTALL_TFLOPS. ------- IBM SP @@ -76,6 +76,18 @@ Then do the following steps: $ make install +We also suggest that you add "-qxlf90=autodealloc" to FFLAGS when +building parallel with fortran enabled. This can be done by invoking: + + setenv FFLAGS -qxlf90=autodealloc # 32 bit build + +or + + setenv FFLAGS "-q64 -qxlf90=autodealloc" # 64 bit build + +prior to running configure. Recall that the "-q64" is necessary +for 64 bit builds. + --------------- SGI Origin 2000 Cray T3E @@ -213,9 +225,9 @@ Parallel HDF5. It usually exits with non-zero code if a required MPI-IO feature does not succeed as expected. One exception is the testing of accessing files larger than 2GB. If the underlaying filesystem or if the MPI-IO library fails to handle file sizes larger than 2GB, the test -will print informational essages stating the failure but will not exit +will print informational messages stating the failure but will not exit with non-zero code. Failure to support file size greater than 2GB is -not a fatal error for HDF5 becuase HDF5 can use other file-drivers such +not a fatal error for HDF5 because HDF5 can use other file-drivers such as families of files to by pass the file size limit. By default, the parallel tests use the current directory as the test directory. @@ -227,3 +239,177 @@ For example, if the tests should use directory /PFS/user/me, do (In some batch job system, you many need to hardset HDF5_PARAPREFIX in the shell initial files like .profile, .cshrc, etc.) + + +5. Sample programs +------------------ + +Here are sample MPI-IO C and Fortran programs. You may use them to run simple +tests of your MPI compilers and the parallel file system. The MPI commands +used here are mpicc, mpif90 and mpirun. Replace them with the commands of +your system. + +The programs assume they run in the parallel file system. Thus they create +the test data file in the current directory. If the parallel file system +is somewhere else, you need to run the sample programs there or edit the +programs to use a different file name. + +Example compiling and running: + +% mpicc Sample_mpio.c -o c.out +% mpirun -np 4 c.out + +% mpif90 Sample_mpio.f90 -o f.out +% mpirun -np 4 f.out + + +==> Sample_mpio.c <== +/* Simple MPI-IO program testing if a parallel file can be created. + * Default filename can be specified via first program argument. + * Each process writes something, then reads all data back. + */ + +#include <mpi.h> +#ifndef MPI_FILE_NULL /*MPIO may be defined in mpi.h already */ +# include <mpio.h> +#endif + +#define DIMSIZE 10 /* dimension size, avoid powers of 2. */ +#define PRINTID printf("Proc %d: ", mpi_rank) + +main(int ac, char **av) +{ + char hostname[128]; + int mpi_size, mpi_rank; + MPI_File fh; + char *filename = "./mpitest.data"; + char mpi_err_str[MPI_MAX_ERROR_STRING]; + int mpi_err_strlen; + int mpi_err; + char writedata[DIMSIZE], readdata[DIMSIZE]; + char expect_val; + int i, irank; + int nerrors = 0; /* number of errors */ + MPI_Offset mpi_off; + MPI_Status mpi_stat; + + MPI_Init(&ac, &av); + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + /* get file name if provided */ + if (ac > 1){ + filename = *++av; + } + if (mpi_rank==0){ + printf("Testing simple MPIO program with %d processes accessing file %s\n", + mpi_size, filename); + printf(" (Filename can be specified via program argument)\n"); + } + + /* show the hostname so that we can tell where the processes are running */ + if (gethostname(hostname, 128) < 0){ + PRINTID; + printf("gethostname failed\n"); + return 1; + } + PRINTID; + printf("hostname=%s\n", hostname); + + if ((mpi_err = MPI_File_open(MPI_COMM_WORLD, filename, + MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, + MPI_INFO_NULL, &fh)) + != MPI_SUCCESS){ + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_open failed (%s)\n", mpi_err_str); + return 1; + } + + /* each process writes some data */ + for (i=0; i < DIMSIZE; i++) + writedata[i] = mpi_rank*DIMSIZE + i; + mpi_off = mpi_rank*DIMSIZE; + if ((mpi_err = MPI_File_write_at(fh, mpi_off, writedata, DIMSIZE, MPI_BYTE, + &mpi_stat)) + != MPI_SUCCESS){ + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_write_at offset(%ld), bytes (%d), failed (%s)\n", + (long) mpi_off, (int) DIMSIZE, mpi_err_str); + return 1; + }; + + /* make sure all processes has done writing. */ + MPI_Barrier(MPI_COMM_WORLD); + + /* each process reads all data and verify. */ + for (irank=0; irank < mpi_size; irank++){ + mpi_off = irank*DIMSIZE; + if ((mpi_err = MPI_File_read_at(fh, mpi_off, readdata, DIMSIZE, MPI_BYTE, + &mpi_stat)) + != MPI_SUCCESS){ + MPI_Error_string(mpi_err, mpi_err_str, &mpi_err_strlen); + PRINTID; + printf("MPI_File_read_at offset(%ld), bytes (%d), failed (%s)\n", + (long) mpi_off, (int) DIMSIZE, mpi_err_str); + return 1; + }; + for (i=0; i < DIMSIZE; i++){ + expect_val = irank*DIMSIZE + i; + if (readdata[i] != expect_val){ + PRINTID; + printf("read data[%d:%d] got %d, expect %d\n", irank, i, + readdata[i], expect_val); + nerrors++; + } + } + } + if (nerrors) + return 1; + + MPI_File_close(&fh); + + PRINTID; + printf("all tests passed\n"); + + MPI_Finalize(); + return 0; +} + +==> Sample_mpio.f90 <== +! +! The following example demonstrates how to create and close a parallel +! file using MPI-IO calls. +! +! USE MPI is the proper way to bring in MPI definitions but many +! MPI Fortran compiler supports the pseudo standard of INCLUDE. +! So, HDF5 uses the INCLUDE statement instead. +! + + PROGRAM MPIOEXAMPLE + + ! USE MPI + + IMPLICIT NONE + + INCLUDE 'mpif.h' + + CHARACTER(LEN=80), PARAMETER :: filename = "filef.h5" ! File name + INTEGER :: ierror ! Error flag + INTEGER :: fh ! File handle + INTEGER :: amode ! File access mode + + call MPI_INIT(ierror) + amode = MPI_MODE_RDWR + MPI_MODE_CREATE + MPI_MODE_DELETE_ON_CLOSE + call MPI_FILE_OPEN(MPI_COMM_WORLD, filename, amode, MPI_INFO_NULL, fh, ierror) + print *, "Trying to create ", filename + if ( ierror .eq. MPI_SUCCESS ) then + print *, "MPI_FILE_OPEN succeeded" + call MPI_FILE_CLOSE(fh, ierror) + else + print *, "MPI_FILE_OPEN failed" + endif + + call MPI_FINALIZE(ierror); + END PROGRAM @@ -32,8 +32,10 @@ #include "H5Tprivate.h" /* Datatypes */ #include "H5Zprivate.h" /* I/O pipeline filters */ +#ifdef H5_HAVE_PARALLEL /* datatypes of predefined drivers needed by H5_trace() */ #include "H5FDmpio.h" +#endif /* H5_HAVE_PARALLEL */ /* we need this for the struct rusage declaration */ #if defined(H5_HAVE_GETRUSAGE) && defined(H5_HAVE_SYS_RESOURCE_H) @@ -53,7 +55,7 @@ hbool_t H5_MPEinit_g = FALSE; /* MPE Library hasn't been initialized */ #endif char H5_lib_vers_info_g[] = H5_VERS_INFO; -hbool_t dont_atexit_g = FALSE; +static hbool_t H5_dont_atexit_g = FALSE; H5_debug_t H5_debug_g; /*debugging info */ static void H5_debug_mask(const char*); @@ -121,12 +123,12 @@ H5_init_library(void) /* * Install atexit() library cleanup routine unless the H5dont_atexit() * has been called. Once we add something to the atexit() list it stays - * there permanently, so we set dont_atexit_g after we add it to prevent + * there permanently, so we set H5_dont_atexit_g after we add it to prevent * adding it again later if the library is cosed and reopened. */ - if (!dont_atexit_g) { + if (!H5_dont_atexit_g) { (void)HDatexit(H5_term_library); - dont_atexit_g = TRUE; + H5_dont_atexit_g = TRUE; } /* @@ -319,10 +321,10 @@ H5dont_atexit(void) FUNC_ENTER_API_NOINIT(H5dont_atexit) H5TRACE0("e",""); - if (dont_atexit_g) + if (H5_dont_atexit_g) ret_value=FAIL; else - dont_atexit_g = TRUE; + H5_dont_atexit_g = TRUE; FUNC_LEAVE_API(ret_value) } @@ -464,9 +466,9 @@ H5_debug_mask(const char *s) } /* Get the name */ - for (i=0; HDisalpha(*s); i++, s++) { - if (i<sizeof pkg_name) pkg_name[i] = *s; - } + for (i=0; HDisalpha(*s); i++, s++) + if (i<sizeof pkg_name) + pkg_name[i] = *s; pkg_name[MIN(sizeof(pkg_name)-1, i)] = '\0'; /* Trace, all, or one? */ @@ -479,26 +481,23 @@ H5_debug_mask(const char *s) H5_debug_g.trace = stream; H5_debug_g.ttimes = !clear; } else if (!HDstrcmp(pkg_name, "all")) { - for (i=0; i<H5_NPKGS; i++) { + for (i=0; i<(size_t)H5_NPKGS; i++) H5_debug_g.pkg[i].stream = clear?NULL:stream; - } } else { - for (i=0; i<H5_NPKGS; i++) { + for (i=0; i<(size_t)H5_NPKGS; i++) { if (!HDstrcmp(H5_debug_g.pkg[i].name, pkg_name)) { H5_debug_g.pkg[i].stream = clear?NULL:stream; break; } } - if (i>=H5_NPKGS) { + if (i>=(size_t)H5_NPKGS) fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name); - } } } else if (HDisdigit(*s)) { int fd = (int)HDstrtol (s, &rest, 0); - if ((stream=HDfdopen(fd, "w"))) { + if ((stream=HDfdopen(fd, "w"))!=NULL) (void)HDsetvbuf (stream, NULL, _IOLBF, 0); - } s = rest; } else { s++; @@ -1014,13 +1013,13 @@ HDfprintf(FILE *stream, const char *fmt, ...) unsigned short x = (unsigned short)va_arg (ap, unsigned int); n = fprintf (stream, format_templ, x); } else if (!*modifier) { - unsigned int x = va_arg (ap, unsigned int); + unsigned int x = va_arg (ap, unsigned int); /*lint !e732 Loss of sign not really occuring */ n = fprintf (stream, format_templ, x); } else if (!HDstrcmp (modifier, "l")) { - unsigned long x = va_arg (ap, unsigned long); + unsigned long x = va_arg (ap, unsigned long); /*lint !e732 Loss of sign not really occuring */ n = fprintf (stream, format_templ, x); } else { - uint64_t x = va_arg(ap, uint64_t); + uint64_t x = va_arg(ap, uint64_t); /*lint !e732 Loss of sign not really occuring */ n = fprintf (stream, format_templ, x); } break; @@ -1053,7 +1052,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 'a': { - haddr_t x = va_arg (ap, haddr_t); + haddr_t x = va_arg (ap, haddr_t); /*lint !e732 Loss of sign not really occuring */ if (H5F_addr_defined(x)) { sprintf(format_templ, "%%%s%s%s%s%s", leftjust?"-":"", plussign?"+":"", @@ -1095,7 +1094,7 @@ HDfprintf(FILE *stream, const char *fmt, ...) case 's': case 'p': { - char *x = va_arg (ap, char*); + char *x = va_arg (ap, char*); /*lint !e64 Type mismatch not really occuring */ n = fprintf (stream, format_templ, x); } break; @@ -1564,7 +1563,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) * name is the null pointer then don't print the argument or the * following `='. This is used for return values. */ - argname = va_arg (ap, char*); + argname = va_arg (ap, char*); /*lint !e64 Type mismatch not really occuring */ if (argname) { unsigned n = (unsigned)MAX (0, (int)HDstrlen(argname)-3); /*lint !e666 Allow expression with side effects */ if (!HDstrcmp (argname+n, "_id")) { @@ -1578,7 +1577,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) } /* The value */ - if (ptr) vp = va_arg (ap, void*); + if (ptr) vp = va_arg (ap, void*); /*lint !e64 Type mismatch not really occuring */ switch (type[0]) { case 'a': if (ptr) { @@ -1588,7 +1587,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - haddr_t addr = va_arg(ap, haddr_t); + haddr_t addr = va_arg(ap, haddr_t); /*lint !e732 Loss of sign not really occuring */ HDfprintf(out, "%a", addr); } break; @@ -1601,7 +1600,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - hbool_t bool_var = va_arg (ap, hbool_t); + hbool_t bool_var = va_arg (ap, hbool_t); /*lint !e732 Loss of sign not really occuring */ if (TRUE==bool_var) fprintf (out, "TRUE"); else if (!bool_var) fprintf (out, "FALSE"); else fprintf (out, "TRUE(%u)", (unsigned)bool_var); @@ -1631,7 +1630,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5D_alloc_time_t alloc_time = va_arg (ap, H5D_alloc_time_t); + H5D_alloc_time_t alloc_time = va_arg (ap, H5D_alloc_time_t); /*lint !e64 Type mismatch not really occuring */ switch (alloc_time) { case H5D_ALLOC_TIME_ERROR: fprintf (out, "H5D_ALLOC_TIME_ERROR"); @@ -1660,7 +1659,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5D_fill_time_t fill_time = va_arg (ap, H5D_fill_time_t); + H5D_fill_time_t fill_time = va_arg (ap, H5D_fill_time_t); /*lint !e64 Type mismatch not really occuring */ switch (fill_time) { case H5D_FILL_TIME_ERROR: fprintf (out, "H5D_FILL_TIME_ERROR"); @@ -1686,7 +1685,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5D_fill_value_t fill_value = va_arg (ap, H5D_fill_value_t); + H5D_fill_value_t fill_value = va_arg (ap, H5D_fill_value_t); /*lint !e64 Type mismatch not really occuring */ switch (fill_value) { case H5D_FILL_VALUE_ERROR: fprintf (out, "H5D_FILL_VALUE_ERROR"); @@ -1712,7 +1711,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5D_layout_t layout = va_arg (ap, H5D_layout_t); + H5D_layout_t layout = va_arg (ap, H5D_layout_t); /*lint !e64 Type mismatch not really occuring */ switch (layout) { case H5D_LAYOUT_ERROR: fprintf (out, "H5D_LAYOUT_ERROR"); @@ -1726,6 +1725,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5D_CHUNKED: fprintf (out, "H5D_CHUNKED"); break; + case H5D_NLAYOUTS: + fprintf (out, "H5D_NLAYOUTS"); + break; default: fprintf (out, "%ld", (long)layout); break; @@ -1741,7 +1743,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5D_space_status_t space_status = va_arg(ap, H5D_space_status_t); + H5D_space_status_t space_status = va_arg(ap, H5D_space_status_t); /*lint !e64 Type mismatch not really occuring */ switch (space_status) { case H5D_SPACE_STATUS_NOT_ALLOCATED: fprintf (out, "H5D_SPACE_STATUS_NOT_ALLOCATED"); @@ -1752,6 +1754,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5D_SPACE_STATUS_ALLOCATED: fprintf (out, "H5D_SPACE_STATUS_ALLOCATED"); break; + case H5D_SPACE_STATUS_ERROR: + fprintf (out, "H5D_SPACE_STATUS_ERROR"); + break; default: fprintf (out, "%ld", (long)space_status); break; @@ -1767,7 +1772,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5FD_mpio_xfer_t transfer = va_arg(ap, H5FD_mpio_xfer_t); + H5FD_mpio_xfer_t transfer = va_arg(ap, H5FD_mpio_xfer_t); /*lint !e64 Type mismatch not really occuring */ switch (transfer) { case H5FD_MPIO_INDEPENDENT: fprintf (out, "H5FD_MPIO_INDEPENDENT"); @@ -1812,7 +1817,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5E_direction_t direction = va_arg (ap, H5E_direction_t); + H5E_direction_t direction = va_arg (ap, H5E_direction_t); /*lint !e64 Type mismatch not really occuring */ switch (direction) { case H5E_WALK_UPWARD: fprintf (out, "H5E_WALK_UPWARD"); @@ -1835,7 +1840,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5E_error_t *error = va_arg (ap, H5E_error_t*); + H5E_error_t *error = va_arg (ap, H5E_error_t*); /*lint !e64 Type mismatch not really occuring */ fprintf (out, "0x%lx", (unsigned long)error); } break; @@ -1848,7 +1853,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5E_type_t etype = va_arg (ap, H5E_type_t); + H5E_type_t etype = va_arg (ap, H5E_type_t); /*lint !e64 Type mismatch not really occuring */ switch (etype) { case H5E_MAJOR: fprintf (out, "H5E_MAJOR"); @@ -1879,7 +1884,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5F_close_degree_t degree = va_arg(ap, H5F_close_degree_t); + H5F_close_degree_t degree = va_arg(ap, H5F_close_degree_t); /*lint !e64 Type mismatch not really occuring */ switch (degree) { case H5F_CLOSE_DEFAULT: fprintf(out, "H5F_CLOSE_DEFAULT"); @@ -1905,7 +1910,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5F_scope_t scope = va_arg(ap, H5F_scope_t); + H5F_scope_t scope = va_arg(ap, H5F_scope_t); /*lint !e64 Type mismatch not really occuring */ switch (scope) { case H5F_SCOPE_LOCAL: fprintf(out, "H5F_SCOPE_LOCAL"); @@ -1937,7 +1942,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5G_link_t link_type = va_arg (ap, H5G_link_t); + H5G_link_t link_type = va_arg (ap, H5G_link_t); /*lint !e64 Type mismatch not really occuring */ switch (link_type) { case H5G_LINK_ERROR: fprintf (out, "H5G_LINK_ERROR"); @@ -1963,7 +1968,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5G_obj_t obj_type = va_arg (ap, H5G_obj_t); + H5G_obj_t obj_type = va_arg (ap, H5G_obj_t); /*lint !e64 Type mismatch not really occuring */ switch (obj_type) { case H5G_UNKNOWN: fprintf (out, "H5G_UNKNOWN"); @@ -1980,6 +1985,12 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5G_TYPE: fprintf (out, "H5G_TYPE"); break; + case H5G_RESERVED_4: + case H5G_RESERVED_5: + case H5G_RESERVED_6: + case H5G_RESERVED_7: + fprintf (out, "H5G_RESERVED(%ld)",(long)obj_type); + break; default: fprintf (out, "%ld", (long)obj_type); break; @@ -1995,7 +2006,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5G_stat_t *statbuf = va_arg (ap, H5G_stat_t*); + H5G_stat_t *statbuf = va_arg (ap, H5G_stat_t*); /*lint !e64 Type mismatch not really occuring */ fprintf (out, "0x%lx", (unsigned long)statbuf); } break; @@ -2026,7 +2037,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - hsize_t hsize = va_arg (ap, hsize_t); + hsize_t hsize = va_arg (ap, hsize_t); /*lint !e732 Loss of sign not really occuring */ if (H5S_UNLIMITED==hsize) { HDfprintf(out, "H5S_UNLIMITED"); } else { @@ -2081,12 +2092,18 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf (out, "FAIL"); } else { switch (H5I_TYPE(obj)) { /* Use internal H5I macro instead of function call */ + case H5I_UNINIT: + fprintf (out, "%ld (uninit - error)", (long)obj); + break; case H5I_BADID: fprintf (out, "%ld (error)", (long)obj); break; case H5I_FILE: fprintf(out, "%ld (file)", (long)obj); break; + case H5I_FILE_CLOSING: + fprintf(out, "%ld (file closing)", (long)obj); + break; case H5I_GROUP: fprintf(out, "%ld (group)", (long)obj); break; @@ -2219,6 +2236,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5I_ERROR_STACK: fprintf(out, "%ld (err stack)", (long)obj); break; + case H5I_NTYPES: + fprintf (out, "%ld (ntypes - error)", (long)obj); + break; default: fprintf(out, "%ld (unknown class)", (long)obj); break; @@ -2267,7 +2287,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - unsigned iu = va_arg (ap, unsigned); + unsigned iu = va_arg (ap, unsigned); /*lint !e732 Loss of sign not really occuring */ fprintf (out, "%u", iu); asize[argno] = iu; } @@ -2281,14 +2301,20 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5I_type_t id_type = va_arg (ap, H5I_type_t); + H5I_type_t id_type = va_arg (ap, H5I_type_t); /*lint !e64 Type mismatch not really occuring */ switch (id_type) { + case H5I_UNINIT: + fprintf (out, "H5I_UNINIT"); + break; case H5I_BADID: fprintf (out, "H5I_BADID"); break; case H5I_FILE: fprintf (out, "H5I_FILE"); break; + case H5I_FILE_CLOSING: + fprintf (out, "H5I_FILE_CLOSING"); + break; case H5I_GROUP: fprintf (out, "H5I_GROUP"); break; @@ -2379,7 +2405,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5FD_mem_t mt = va_arg(ap, H5FD_mem_t); + H5FD_mem_t mt = va_arg(ap, H5FD_mem_t); /*lint !e64 Type mismatch not really occuring */ switch (mt) { case H5FD_MEM_NOLIST: fprintf(out, "H5FD_MEM_NOLIST"); @@ -2405,6 +2431,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5FD_MEM_OHDR: fprintf(out, "H5FD_MEM_OHDR"); break; + case H5FD_MEM_NTYPES: + fprintf(out, "H5FD_MEM_NTYPES"); + break; default: fprintf(out, "%ld", (long)mt); break; @@ -2463,7 +2492,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - hobj_ref_t ref = va_arg (ap, hobj_ref_t); + hobj_ref_t ref = va_arg (ap, hobj_ref_t); /*lint !e732 Loss of sign not really occuring */ HDfprintf(out, "Reference Object=%a", ref); } break; @@ -2478,7 +2507,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5R_type_t reftype = va_arg(ap, H5R_type_t); + H5R_type_t reftype = va_arg(ap, H5R_type_t); /*lint !e64 Type mismatch not really occuring */ switch (reftype) { case H5R_BADTYPE: fprintf(out, "H5R_BADTYPE"); @@ -2518,7 +2547,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5S_class_t cls = va_arg(ap, H5S_class_t); + H5S_class_t cls = va_arg(ap, H5S_class_t); /*lint !e64 Type mismatch not really occuring */ switch (cls) { case H5S_NO_CLASS: fprintf(out, "H5S_NO_CLASS"); @@ -2529,6 +2558,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5S_SIMPLE: fprintf(out, "H5S_SIMPLE"); break; + case H5S_NULL: + fprintf(out, "H5S_NULL"); + break; case H5S_COMPLEX: fprintf(out, "H5S_COMPLEX"); break; @@ -2547,7 +2579,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5S_seloper_t so = va_arg(ap, H5S_seloper_t); + H5S_seloper_t so = va_arg(ap, H5S_seloper_t); /*lint !e64 Type mismatch not really occuring */ switch (so) { case H5S_SELECT_NOOP: fprintf(out, "H5S_NOOP"); @@ -2558,6 +2590,27 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5S_SELECT_OR: fprintf(out, "H5S_SELECT_OR"); break; + case H5S_SELECT_AND: + fprintf(out, "H5S_SELECT_AND"); + break; + case H5S_SELECT_XOR: + fprintf(out, "H5S_SELECT_XOR"); + break; + case H5S_SELECT_NOTB: + fprintf(out, "H5S_SELECT_NOTB"); + break; + case H5S_SELECT_NOTA: + fprintf(out, "H5S_SELECT_NOTA"); + break; + case H5S_SELECT_APPEND: + fprintf(out, "H5S_SELECT_APPEND"); + break; + case H5S_SELECT_PREPEND: + fprintf(out, "H5S_SELECT_PREPEND"); + break; + case H5S_SELECT_INVALID: + fprintf(out, "H5S_SELECT_INVALID"); + break; default: fprintf(out, "%ld", (long)so); break; @@ -2573,7 +2626,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5S_sel_type st = va_arg(ap, H5S_sel_type); + H5S_sel_type st = va_arg(ap, H5S_sel_type); /*lint !e64 Type mismatch not really occuring */ switch (st) { case H5S_SEL_ERROR: fprintf(out, "H5S_SEL_ERROR"); @@ -2590,6 +2643,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5S_SEL_ALL: fprintf(out, "H5S_SEL_ALL"); break; + case H5S_SEL_N: + fprintf(out, "H5S_SEL_N"); + break; default: fprintf(out, "%ld", (long)st); break; @@ -2611,7 +2667,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - const char *str = va_arg (ap, const char*); + const char *str = va_arg (ap, const char*); /*lint !e64 Type mismatch not really occuring */ fprintf (out, "\"%s\"", str); } break; @@ -2626,7 +2682,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5T_cset_t cset = va_arg (ap, H5T_cset_t); + H5T_cset_t cset = va_arg (ap, H5T_cset_t); /*lint !e64 Type mismatch not really occuring */ switch (cset) { case H5T_CSET_ERROR: fprintf (out, "H5T_CSET_ERROR"); @@ -2634,6 +2690,23 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5T_CSET_ASCII: fprintf (out, "H5T_CSET_ASCII"); break; + case H5T_CSET_RESERVED_1: + case H5T_CSET_RESERVED_2: + case H5T_CSET_RESERVED_3: + case H5T_CSET_RESERVED_4: + case H5T_CSET_RESERVED_5: + case H5T_CSET_RESERVED_6: + case H5T_CSET_RESERVED_7: + case H5T_CSET_RESERVED_8: + case H5T_CSET_RESERVED_9: + case H5T_CSET_RESERVED_10: + case H5T_CSET_RESERVED_11: + case H5T_CSET_RESERVED_12: + case H5T_CSET_RESERVED_13: + case H5T_CSET_RESERVED_14: + case H5T_CSET_RESERVED_15: + fprintf (out, "H5T_CSET_RESERVED(%ld)",(long)cset); + break; default: fprintf (out, "%ld", (long)cset); break; @@ -2649,7 +2722,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5T_direction_t direct = va_arg (ap, H5T_direction_t); + H5T_direction_t direct = va_arg (ap, H5T_direction_t); /*lint !e64 Type mismatch not really occuring */ switch (direct) { case H5T_DIR_DEFAULT: fprintf (out, "H5T_DIR_DEFAULT"); @@ -2675,7 +2748,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5T_pers_t pers = va_arg(ap, H5T_pers_t); + H5T_pers_t pers = va_arg(ap, H5T_pers_t); /*lint !e64 Type mismatch not really occuring */ switch (pers) { case H5T_PERS_DONTCARE: fprintf(out, "H5T_PERS_DONTCARE"); @@ -2701,7 +2774,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5T_norm_t norm = va_arg (ap, H5T_norm_t); + H5T_norm_t norm = va_arg (ap, H5T_norm_t); /*lint !e64 Type mismatch not really occuring */ switch (norm) { case H5T_NORM_ERROR: fprintf (out, "H5T_NORM_ERROR"); @@ -2730,7 +2803,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5T_order_t order = va_arg (ap, H5T_order_t); + H5T_order_t order = va_arg (ap, H5T_order_t); /*lint !e64 Type mismatch not really occuring */ switch (order) { case H5T_ORDER_ERROR: fprintf (out, "H5T_ORDER_ERROR"); @@ -2762,7 +2835,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5T_pad_t pad = va_arg (ap, H5T_pad_t); + H5T_pad_t pad = va_arg (ap, H5T_pad_t); /*lint !e64 Type mismatch not really occuring */ switch (pad) { case H5T_PAD_ERROR: fprintf (out, "H5T_PAD_ERROR"); @@ -2776,6 +2849,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5T_PAD_BACKGROUND: fprintf (out, "H5T_PAD_BACKGROUND"); break; + case H5T_NPAD: + fprintf (out, "H5T_NPAD"); + break; default: fprintf (out, "%ld", (long)pad); break; @@ -2791,7 +2867,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5T_sign_t sign = va_arg (ap, H5T_sign_t); + H5T_sign_t sign = va_arg (ap, H5T_sign_t); /*lint !e64 Type mismatch not really occuring */ switch (sign) { case H5T_SGN_ERROR: fprintf (out, "H5T_SGN_ERROR"); @@ -2802,6 +2878,9 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5T_SGN_2: fprintf (out, "H5T_SGN_2"); break; + case H5T_NSGN: + fprintf (out, "H5T_NSGN"); + break; default: fprintf (out, "%ld", (long)sign); break; @@ -2817,7 +2896,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5T_class_t type_class = va_arg(ap, H5T_class_t); + H5T_class_t type_class = va_arg(ap, H5T_class_t); /*lint !e64 Type mismatch not really occuring */ switch (type_class) { case H5T_NO_CLASS: fprintf(out, "H5T_NO_CLASS"); @@ -2843,9 +2922,21 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5T_COMPOUND: fprintf(out, "H5T_COMPOUND"); break; + case H5T_REFERENCE: + fprintf(out, "H5T_REFERENCE"); + break; case H5T_ENUM: fprintf(out, "H5T_ENUM"); break; + case H5T_VLEN: + fprintf(out, "H5T_VLEN"); + break; + case H5T_ARRAY: + fprintf(out, "H5T_ARRAY"); + break; + case H5T_NCLASSES: + fprintf(out, "H5T_NCLASSES"); + break; default: fprintf(out, "%ld", (long)type_class); break; @@ -2861,7 +2952,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5T_str_t str = va_arg(ap, H5T_str_t); + H5T_str_t str = va_arg(ap, H5T_str_t); /*lint !e64 Type mismatch not really occuring */ switch (str) { case H5T_STR_ERROR: fprintf(out, "H5T_STR_ERROR"); @@ -2875,6 +2966,21 @@ H5_trace (const double *returning, const char *func, const char *type, ...) case H5T_STR_SPACEPAD: fprintf(out, "H5T_STR_SPACEPAD"); break; + case H5T_STR_RESERVED_3: + case H5T_STR_RESERVED_4: + case H5T_STR_RESERVED_5: + case H5T_STR_RESERVED_6: + case H5T_STR_RESERVED_7: + case H5T_STR_RESERVED_8: + case H5T_STR_RESERVED_9: + case H5T_STR_RESERVED_10: + case H5T_STR_RESERVED_11: + case H5T_STR_RESERVED_12: + case H5T_STR_RESERVED_13: + case H5T_STR_RESERVED_14: + case H5T_STR_RESERVED_15: + fprintf(out, "H5T_STR_RESERVED(%ld)",(long)str); + break; default: fprintf(out, "%ld", (long)str); break; @@ -2924,7 +3030,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - vp = va_arg (ap, void*); + vp = va_arg (ap, void*); /*lint !e64 Type mismatch not really occuring */ if (vp) { fprintf (out, "0x%lx", (unsigned long)vp); } else { @@ -2949,7 +3055,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - size_t size = va_arg (ap, size_t); + size_t size = va_arg (ap, size_t); /*lint !e732 Loss of sign not really occuring */ HDfprintf (out, "%Zu", size); asize[argno] = (hssize_t)size; @@ -2966,7 +3072,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5Z_class_t *filter = va_arg (ap, H5Z_class_t*); + H5Z_class_t *filter = va_arg (ap, H5Z_class_t*); /*lint !e64 Type mismatch not really occuring */ fprintf (out, "0x%lx", (unsigned long)filter); } break; @@ -2979,7 +3085,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "NULL"); } } else { - H5Z_EDC_t edc = va_arg (ap, H5Z_EDC_t); + H5Z_EDC_t edc = va_arg (ap, H5Z_EDC_t); /*lint !e64 Type mismatch not really occuring */ if (H5Z_DISABLE_EDC==edc) { fprintf (out, "H5Z_DISABLE_EDC"); @@ -13,7 +13,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #define H5A_PACKAGE /*suppress error about including H5Apkg */ -#define H5S_PACKAGE /*suppress error about including H5Spkg */ /* Interface initialization */ #define H5_INTERFACE_INIT_FUNC H5A_init_interface @@ -29,7 +28,7 @@ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Spkg.h" /* Dataspace functions */ +#include "H5Sprivate.h" /* Dataspace functions */ /* PRIVATE PROTOTYPES */ static hid_t H5A_create(const H5G_entry_t *ent, const char *name, @@ -81,7 +80,7 @@ H5A_init_interface(void) /* * Create attribute group. */ - if (H5I_register_type(H5I_ATTR, H5I_ATTRID_HASHSIZE, H5A_RESERVED_ATOMS, (H5I_free_t)H5A_close)<0) + if (H5I_register_type(H5I_ATTR, H5I_ATTRID_HASHSIZE, H5A_RESERVED_ATOMS, (H5I_free_t)H5A_close)<H5I_FILE) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTINIT, FAIL, "unable to initialize interface") done: @@ -113,10 +112,10 @@ H5A_term_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5A_term_interface) if (H5_interface_initialize_g) { - if ((n=H5I_nmembers(H5I_ATTR))) { - H5I_clear_type(H5I_ATTR, FALSE); + if ((n=H5I_nmembers(H5I_ATTR))>0) { + (void)H5I_clear_type(H5I_ATTR, FALSE); } else { - H5I_dec_type_ref(H5I_ATTR); + (void)H5I_dec_type_ref(H5I_ATTR); H5_interface_initialize_g = 0; n = 1; } @@ -161,7 +160,7 @@ H5A_term_interface(void) * * Modifications: * Robb Matzke, 5 Jun 1998 - * The LOC_ID can also be a committed data type. + * The LOC_ID can also be a committed datatype. * --------------------------------------------------------------------------*/ /* ARGSUSED */ @@ -291,7 +290,7 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type, else attr->dt_size=H5O_raw_size(H5O_DTYPE_ID,attr->ent.file,type); assert(attr->dt_size>0); - attr->ds_size=H5O_raw_size(H5O_SDSPACE_ID,attr->ent.file,&(space->extent)); + attr->ds_size=H5S_raw_size(attr->ent.file,space); assert(attr->ds_size>0); H5_ASSIGN_OVERFLOW(attr->data_size,H5S_GET_EXTENT_NPOINTS(attr->ds)*H5T_get_size(attr->dt),hssize_t,size_t); @@ -436,7 +435,7 @@ done: * * Modifications: * Robb Matzke, 5 Jun 1998 - * The LOC_ID can also be a named (committed) data type. + * The LOC_ID can also be a named (committed) datatype. --------------------------------------------------------------------------*/ hid_t H5Aopen_name(hid_t loc_id, const char *name) @@ -493,7 +492,7 @@ done: * * Modifications: * Robb Matzke, 5 Jun 1998 - * The LOC_ID can also be a named (committed) data type. + * The LOC_ID can also be a named (committed) datatype. * --------------------------------------------------------------------------*/ hid_t @@ -614,7 +613,7 @@ H5Awrite(hid_t attr_id, hid_t type_id, const void *buf) if (NULL == (attr = H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") if (NULL == (mem_type = H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") @@ -648,7 +647,7 @@ done: static herr_t H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) { - uint8_t *tconv_buf = NULL; /* data type conv buffer */ + uint8_t *tconv_buf = NULL; /* datatype conv buffer */ uint8_t *bkg_buf = NULL; /* temp conversion buffer */ hssize_t snelmts; /* elements in attribute */ size_t nelmts; /* elements in attribute */ @@ -679,7 +678,7 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) /* Convert memory buffer into disk buffer */ /* Set up type conversion function */ if (NULL == (tpath = H5T_path_find(mem_type, attr->dt, NULL, NULL, dxpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types") + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes") /* Check for type conversion required */ if (!H5T_path_noop(tpath)) { @@ -695,9 +694,9 @@ H5A_write(H5A_t *attr, const H5T_t *mem_type, const void *buf, hid_t dxpl_id) /* Copy the user's data into the buffer for conversion */ HDmemcpy(tconv_buf,buf,(src_type_size*nelmts)); - /* Perform data type conversion */ + /* Perform datatype conversion */ if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "data type conversion failed") + HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed") /* Free the previous attribute data buffer, if there is one */ if(attr->data) @@ -776,7 +775,7 @@ H5Aread(hid_t attr_id, hid_t type_id, void *buf) if (NULL == (attr = H5I_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") if (NULL == (mem_type = H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") @@ -810,7 +809,7 @@ done: static herr_t H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id) { - uint8_t *tconv_buf = NULL; /* data type conv buffer*/ + uint8_t *tconv_buf = NULL; /* datatype conv buffer*/ uint8_t *bkg_buf = NULL; /* background buffer */ hssize_t snelmts; /* elements in attribute */ size_t nelmts; /* elements in attribute*/ @@ -845,7 +844,7 @@ H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id) /* Convert memory buffer into disk buffer */ /* Set up type conversion function */ if (NULL == (tpath = H5T_path_find(attr->dt, mem_type, NULL, NULL, dxpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types") + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes") /* Check for type conversion required */ if (!H5T_path_noop(tpath)) { @@ -861,9 +860,9 @@ H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id) /* Copy the attribute data into the buffer for conversion */ HDmemcpy(tconv_buf,attr->data,(src_type_size*nelmts)); - /* Perform data type conversion. */ + /* Perform datatype conversion. */ if (H5T_convert(tpath, src_id, dst_id, nelmts, 0, 0, tconv_buf, bkg_buf, dxpl_id)<0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "data type conversion failed") + HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed") /* Copy the converted data into the user's buffer */ HDmemcpy(buf,tconv_buf,(dst_type_size*nelmts)); @@ -958,10 +957,10 @@ done: * * Modifications: * Robb Matzke, 4 Jun 1998 - * The data type is reopened if it's a named type before returning it to - * the application. The data types returned by this function are always - * read-only. If an error occurs when atomizing the return data type - * then the data type is closed. + * The datatype is reopened if it's a named type before returning it to + * the application. The datatypes returned by this function are always + * read-only. If an error occurs when atomizing the return datatype + * then the datatype is closed. --------------------------------------------------------------------------*/ hid_t H5Aget_type(hid_t attr_id) @@ -978,7 +977,7 @@ H5Aget_type(hid_t attr_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") /* - * Copy the attribute's data type. If the type is a named type then + * Copy the attribute's datatype. If the type is a named type then * reopen the type before returning it to the user. Make the type * read-only. */ @@ -989,7 +988,7 @@ H5Aget_type(hid_t attr_id) if (H5T_set_loc(dst, NULL, H5T_LOC_MEMORY)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") if (H5T_lock(dst, FALSE)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient datatype") /* Atomize */ if ((ret_value=H5I_register(H5I_DATATYPE, dst))<0) @@ -1160,7 +1159,7 @@ H5A_get_storage_size(const H5A_t *attr) * * Modifications: * Robb Matzke, 5 Jun 1998 - * The LOC_ID can also be a named (committed) data type. + * The LOC_ID can also be a named (committed) datatype. --------------------------------------------------------------------------*/ int H5Aget_num_attrs(hid_t loc_id) @@ -1183,14 +1182,14 @@ H5Aget_num_attrs(hid_t loc_id) break; case H5I_DATATYPE: if (NULL==(ent=H5T_entof ((H5T_t*)obj))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "target data type is not committed") + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "target datatype is not committed") break; case H5I_GROUP: ent = H5G_entof ((H5G_t*)obj); break; default: HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "inappropriate attribute target") - } + } /*lint !e788 All appropriate cases are covered */ /* Look up the attribute for the object */ ret_value=H5O_count(ent, H5O_ATTR_ID, H5AC_ind_dxpl_id); @@ -1352,7 +1351,7 @@ done: * * Modifications: * Robb Matzke, 5 Jun 1998 - * The LOC_ID can also be a named (committed) data type. + * The LOC_ID can also be a named (committed) datatype. * * Robb Matzke, 5 Jun 1998 * Like the group iterator, if ATTR_NUM is the null pointer then all @@ -1433,7 +1432,7 @@ done: * * Modifications: * Robb Matzke, 5 Jun 1998 - * The LOC_ID can also be a named (committed) data type. + * The LOC_ID can also be a named (committed) datatype. * --------------------------------------------------------------------------*/ herr_t @@ -89,7 +89,7 @@ hid_t H5AC_ind_dxpl_id=(-1); * Private file-scope function declarations: */ -static herr_t H5AC_check_if_write_permitted(H5F_t *f, +static herr_t H5AC_check_if_write_permitted(const H5F_t *f, hid_t dxpl_id, hbool_t * write_permitted_ptr); @@ -340,7 +340,7 @@ H5AC_term_interface(void) *------------------------------------------------------------------------- */ -const char * H5AC_entry_type_names[H5AC_NTYPES] = +static const char * H5AC_entry_type_names[H5AC_NTYPES] = { "B-tree nodes", "symbol table nodes", @@ -349,10 +349,9 @@ const char * H5AC_entry_type_names[H5AC_NTYPES] = "object headers" }; -int +herr_t H5AC_create(const H5F_t *f, int UNUSED size_hint) { - H5AC_t * cache_ptr = NULL; int ret_value = SUCCEED; /* Return value */ #if 1 /* JRM */ /* test code -- remove when done */ H5C_auto_size_ctl_t auto_size_ctl = @@ -416,47 +415,29 @@ H5AC_create(const H5F_t *f, int UNUSED size_hint) * in proper size hints. * -- JRM */ - cache_ptr = H5C_create(H5C__DEFAULT_MAX_CACHE_SIZE, + f->shared->cache = H5C_create(H5C__DEFAULT_MAX_CACHE_SIZE, H5C__DEFAULT_MIN_CLEAN_SIZE, (H5AC_NTYPES - 1), (const char **)H5AC_entry_type_names, H5AC_check_if_write_permitted); - if ( NULL == cache_ptr ) { + if ( NULL == f->shared->cache ) { HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - } else { - - f->shared->cache = cache_ptr; - } #if 1 /* JRM */ /* test code -- remove when done */ - if ( cache_ptr ) { + if ( H5C_set_cache_auto_resize_config(f->shared->cache, &auto_size_ctl) + != SUCCEED ) { - if ( H5C_set_cache_auto_resize_config(cache_ptr, &auto_size_ctl) - != SUCCEED ) { - - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \ - "auto resize config test failed") - } + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, \ + "auto resize config test failed") } #endif /* JRM */ done: - if ( ret_value < 0 ) { - - if ( cache_ptr != NULL ) { - - H5C_dest_empty(cache_ptr); - f->shared->cache = NULL; - - } /* end if */ - - } /* end if */ - FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_create() */ @@ -791,8 +772,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_rename(H5F_t *f, hid_t UNUSED dxpl_id, const H5AC_class_t *type, haddr_t old_addr, - haddr_t new_addr) +H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr) { herr_t result; herr_t ret_value=SUCCEED; /* Return value */ @@ -826,8 +806,7 @@ H5AC_rename(H5F_t *f, hid_t UNUSED dxpl_id, const H5AC_class_t *type, haddr_t ol #endif /* H5_HAVE_FPHDF5 */ #endif /* H5_HAVE_PARALLEL */ - result = H5C_rename_entry(f, - f->shared->cache, + result = H5C_rename_entry(f->shared->cache, type, old_addr, new_addr); @@ -994,7 +973,7 @@ H5AC_protect(H5F_t *f, HGOTO_ERROR(H5E_FPHDF5, H5E_CANTUNLOCK, NULL, \ "can't unlock data on SAP!") - HGOTO_DONE(NULL); + HGOTO_DONE(NULL) } info = (H5AC_info_t *)thing; @@ -1018,7 +997,7 @@ H5AC_protect(H5F_t *f, info->aux_next = NULL; info->aux_prev = NULL; - HGOTO_DONE(thing); + HGOTO_DONE(thing) } } #endif /* H5_HAVE_FPHDF5 */ @@ -1231,7 +1210,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_stats(H5F_t UNUSED *f) +H5AC_stats(const H5F_t *f) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1240,7 +1219,7 @@ H5AC_stats(H5F_t UNUSED *f) HDassert(f); HDassert(f->shared->cache); - H5C_stats(f->shared->cache, f->name, FALSE); /* at present, this can't fail */ + (void)H5C_stats(f->shared->cache, f->name, FALSE); /* at present, this can't fail */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1276,12 +1255,12 @@ done: #ifdef H5_HAVE_PARALLEL static herr_t -H5AC_check_if_write_permitted(H5F_t *f, +H5AC_check_if_write_permitted(const H5F_t *f, hid_t dxpl_id, hbool_t * write_permitted_ptr) #else /* H5_HAVE_PARALLEL */ static herr_t -H5AC_check_if_write_permitted(H5F_t UNUSED * f, +H5AC_check_if_write_permitted(const H5F_t UNUSED * f, hid_t UNUSED dxpl_id, hbool_t * write_permitted_ptr) #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 214f38e..8c34d92 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -172,10 +172,10 @@ H5_DLL void *H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, void *thing, hbool_t deleted); H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id, unsigned flags); -H5_DLL herr_t H5AC_rename(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, +H5_DLL herr_t H5AC_rename(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr); H5_DLL herr_t H5AC_dest(H5F_t *f, hid_t dxpl_id); -H5_DLL herr_t H5AC_stats(H5F_t *f); +H5_DLL herr_t H5AC_stats(const H5F_t *f); #endif /* !_H5ACprivate_H */ @@ -141,7 +141,7 @@ static herr_t H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, haddr_t old_addr, unsigned idx, void *udata, haddr_t *new_addr/*out*/); static H5B_t * H5B_copy(const H5B_t *old_bt); -static herr_t H5B_serialize(H5F_t *f, H5B_t *bt); +static herr_t H5B_serialize(const H5F_t *f, const H5B_t *bt); #ifdef H5B_DEBUG static herr_t H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void *udata); @@ -152,7 +152,7 @@ static H5B_t *H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, static herr_t H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *b); static herr_t H5B_dest(H5F_t *f, H5B_t *b); static herr_t H5B_clear(H5F_t *f, H5B_t *b, hbool_t destroy); -static herr_t H5B_compute_size(H5F_t *f, H5B_t *bt, size_t *size_ptr); +static herr_t H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr); /* H5B inherits cache-like properties from H5AC */ static const H5AC_class_t H5AC_BT[1] = {{ @@ -324,7 +324,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) p += 4; /* node type and level */ - if (*p++ != type->id) + if (*p++ != (uint8_t)type->id) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B-tree node type") bt->level = *p++; @@ -383,7 +383,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B_serialize(H5F_t *f, H5B_t *bt) +H5B_serialize(const H5F_t *f, const H5B_t *bt) { H5B_shared_t *shared=NULL; /* Pointer to shared B-tree info */ unsigned u; @@ -407,7 +407,7 @@ H5B_serialize(H5F_t *f, H5B_t *bt) p += 4; /* node type and level */ - *p++ = shared->type->id; + *p++ = (uint8_t)shared->type->id; H5_CHECK_OVERFLOW(bt->level, unsigned, uint8_t); *p++ = (uint8_t)bt->level; @@ -601,7 +601,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5B_compute_size(H5F_t *f, H5B_t *bt, size_t *size_ptr) +H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr) { H5B_shared_t *shared; /* Pointer to shared B-tree info */ size_t size; @@ -618,23 +618,15 @@ H5B_compute_size(H5F_t *f, H5B_t *bt, size_t *size_ptr) HDassert(shared->type); HDassert(size_ptr); - size = H5B_nodesize(f, shared, NULL); + /* Check node's size */ + if ((size = H5B_nodesize(f, shared, NULL)) == 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, "H5B_nodesize() failed") - if ( size == 0 ) { - - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGETSIZE, FAIL, \ - "H5B_nodesize() failed"); - - } else { - - *size_ptr = size; - - } + /* Set size value */ + *size_ptr = size; done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5B_H5B_compute_size() */ @@ -733,7 +725,7 @@ H5B_find(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *u HGOTO_DONE(FAIL) #endif /* OLD_WAY */ } else { - if ((type->found) (f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), udata, H5B_NKEY(bt,shared,idx+1)) < 0) + if ((type->found) (f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), udata) < 0) /* Note: don't push error on stack, leave that to next higher level, * since many times the B-tree is searched in order to determine * if an object exists in the B-tree or not. -QAK @@ -811,7 +803,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, haddr_t old_addr, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") /* Get B-tree split ratios */ - if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &split_ratios)<0) + if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &split_ratios[0])<0) HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios") #ifdef H5B_DEBUG @@ -971,9 +963,8 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, assert(type->sizeof_nkey <= sizeof _lt_key); assert(H5F_addr_defined(addr)); - if ((my_ins = H5B_insert_helper(f, dxpl_id, addr, type, lt_key, - <_key_changed, md_key, udata, rt_key, &rt_key_changed, &child/*out*/))<0 || - my_ins<0) + if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, addr, type, lt_key, + <_key_changed, md_key, udata, rt_key, &rt_key_changed, &child/*out*/))<0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key") if (H5B_INS_NOOP == my_ins) HGOTO_DONE(SUCCEED) @@ -1056,7 +1047,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, bt=NULL; /* Make certain future references will be caught */ /* Move the location of the old root on the disk */ - if (H5AC_rename(f, dxpl_id, H5AC_BT, addr, old_root) < 0) + if (H5AC_rename(f, H5AC_BT, addr, old_root) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node") /* clear the old root info at the old address (we already copied it) */ @@ -1278,7 +1269,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type idx = 0; if (type->follow_min) { - if ((my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), + if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1), rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert first leaf node") @@ -1291,7 +1282,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * The value being inserted is less than any value in this tree. * Follow the minimum branch out of this node to a subtree. */ - if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, + if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1), rt_key_changed, &child_addr/*out*/))<0) @@ -1302,7 +1293,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * current node. Follow the minimum branch to a leaf node and let the * subclass handle the problem. */ - if ((my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), + if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1), rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node") @@ -1325,7 +1316,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * Follow the maximum branch out of this node to a subtree. */ idx = bt->nchildren - 1; - if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, + if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1), rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum subtree") @@ -1336,7 +1327,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * subclass handle the problem. */ idx = bt->nchildren - 1; - if ((my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), + if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1), rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node") @@ -1368,7 +1359,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * Follow a branch out of this node to another subtree. */ assert(idx < bt->nchildren); - if ((my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, + if ((int)(my_ins = H5B_insert_helper(f, dxpl_id, bt->child[idx], type, H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1), rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert subtree") @@ -1377,12 +1368,12 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * Follow a branch out of this node to a leaf node of some other type. */ assert(idx < bt->nchildren); - if ((my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), + if ((int)(my_ins = (type->insert)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), lt_key_changed, md_key, udata, H5B_NKEY(bt,shared,idx+1), rt_key_changed, &child_addr/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert leaf node") } - assert(my_ins >= 0); + assert((int)my_ins >= 0); /* * Update the left and right keys of the current node. @@ -1619,10 +1610,9 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type { H5B_t *bt = NULL, *sibling = NULL; H5B_shared_t *shared; /* Pointer to shared B-tree info */ - H5B_ins_t ret_value = H5B_INS_ERROR; unsigned idx=0, lt=0, rt; /* Final, left & right indices */ int cmp=1; /* Key comparison value */ - size_t sizeof_rec; + H5B_ins_t ret_value = H5B_INS_ERROR; FUNC_ENTER_NOAPI(H5B_remove_helper, H5B_INS_ERROR) @@ -1631,7 +1621,6 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type assert(type); assert(type->decode); assert(type->cmp3); - assert(type->found); assert(lt_key && lt_key_changed); assert(udata); assert(rt_key && rt_key_changed); @@ -1665,7 +1654,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type assert(idx<bt->nchildren); if (bt->level>0) { /* We're at an internal node -- call recursively */ - if ((ret_value=H5B_remove_helper(f, dxpl_id, + if ((int)(ret_value=H5B_remove_helper(f, dxpl_id, bt->child[idx], type, level+1, H5B_NKEY(bt,shared,idx)/*out*/, lt_key_changed/*out*/, udata, H5B_NKEY(bt,shared,idx+1)/*out*/, rt_key_changed/*out*/))<0) @@ -1676,7 +1665,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * has a removal method. Pass the removal request to the pointed-to * object and let it decide how to progress. */ - if ((ret_value=(type->remove)(f, dxpl_id, + if ((int)(ret_value=(type->remove)(f, dxpl_id, bt->child[idx], H5B_NKEY(bt,shared,idx), lt_key_changed, udata, H5B_NKEY(bt,shared,idx+1), rt_key_changed))<0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in leaf node") @@ -1742,7 +1731,6 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * If the subtree returned H5B_INS_REMOVE then we should remove the * subtree entry from the current node. There are four cases: */ - sizeof_rec = shared->sizeof_rkey + H5F_SIZEOF_ADDR(f); if (H5B_INS_REMOVE==ret_value && 1==bt->nchildren) { /* * The subtree is the only child of this node. Discard both @@ -1997,7 +1985,7 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void /* Call user's callback for each entry */ if ((type->remove)(f, dxpl_id, bt->child[u], H5B_NKEY(bt,shared,u), <_key_changed, udata, - H5B_NKEY(bt,shared,u+1), &rt_key_changed)<0) + H5B_NKEY(bt,shared,u+1), &rt_key_changed)<H5B_INS_NOOP) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't remove B-tree node") } /* end for */ } /* end if */ diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index 87e57f3..b4b1a97 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -67,8 +67,8 @@ typedef enum H5B_ins_t { #define H5B_ITER_STOP (1) /* Define the operator callback function pointer for H5B_iterate() */ -typedef int (*H5B_operator_t)(H5F_t *f, hid_t, void *_lt_key, haddr_t addr, - void *_rt_key, void *_udata); +typedef int (*H5B_operator_t)(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, + const void *_rt_key, void *_udata); /* Typedef for B-tree in memory (defined in H5Bpkg.h) */ typedef struct H5B_t H5B_t; @@ -98,11 +98,11 @@ typedef struct H5B_class_t { H5B_subid_t id; /*id as found in file*/ size_t sizeof_nkey; /*size of native (memory) key*/ size_t (*get_sizeof_rkey)(const H5F_t*, const void*); /*raw key size */ - H5RC_t * (*get_shared)(H5F_t*, const void*); /*shared info for node */ + H5RC_t * (*get_shared)(const H5F_t*, const void*); /*shared info for node */ herr_t (*new_node)(H5F_t*, hid_t, H5B_ins_t, void*, void*, void*, haddr_t*); int (*cmp2)(H5F_t*, hid_t, void*, void*, void*); /*compare 2 keys */ int (*cmp3)(H5F_t*, hid_t, void*, void*, void*); /*compare 3 keys */ - herr_t (*found)(H5F_t*, hid_t, haddr_t, const void*, void*, const void*); + herr_t (*found)(H5F_t*, hid_t, haddr_t, const void*, void*); /* insert new data */ H5B_ins_t (*insert)(H5F_t*, hid_t, haddr_t, void*, hbool_t*, void*, void*, @@ -117,8 +117,8 @@ typedef struct H5B_class_t { hbool_t*); /* encode, decode, debug key values */ - herr_t (*decode)(H5F_t*, struct H5B_t*, uint8_t*, void*); - herr_t (*encode)(H5F_t*, struct H5B_t*, uint8_t*, void*); + herr_t (*decode)(const H5F_t*, const struct H5B_t*, const uint8_t*, void*); + herr_t (*encode)(const H5F_t*, const struct H5B_t*, uint8_t*, void*); herr_t (*debug_key)(FILE*, H5F_t*, hid_t, int, int, const void*, const void*); } H5B_class_t; @@ -1706,7 +1706,7 @@ static herr_t H5C_epoch_marker_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, void *thing); static herr_t H5C_epoch_marker_dest(H5F_t *f, void *thing); static herr_t H5C_epoch_marker_clear(H5F_t *f, void *thing, hbool_t dest); -static herr_t H5C_epoch_marker_size(H5F_t *f, void *thing, size_t *size_ptr); +static herr_t H5C_epoch_marker_size(const H5F_t *f, const void *thing, size_t *size_ptr); const H5C_class_t epoch_marker_class = { @@ -1795,8 +1795,8 @@ done: } static herr_t -H5C_epoch_marker_size(UNUSED H5F_t *f, - UNUSED void *thing, +H5C_epoch_marker_size(UNUSED const H5F_t *f, + UNUSED const void *thing, UNUSED size_t *size_ptr) { herr_t ret_value = FAIL; /* Return value */ @@ -2940,8 +2940,7 @@ done: */ herr_t -H5C_rename_entry(H5F_t * f, - H5C_t * cache_ptr, +H5C_rename_entry(H5C_t * cache_ptr, const H5C_class_t * type, haddr_t old_addr, haddr_t new_addr) @@ -2954,7 +2953,6 @@ H5C_rename_entry(H5F_t * f, HDassert( cache_ptr ); HDassert( cache_ptr->magic == H5C__H5C_T_MAGIC ); - HDassert( cache_ptr->skip_file_checks || f ); HDassert( type ); HDassert( H5F_addr_defined(old_addr) ); HDassert( H5F_addr_defined(new_addr) ); @@ -3546,7 +3544,6 @@ H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, default: /* should be unreachable */ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown incr_mode?!?!?.") - break; } switch ( config_ptr->decr_mode ) @@ -3588,7 +3585,6 @@ H5C_set_cache_auto_resize_config(H5C_t * cache_ptr, default: /* should be unreachable */ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown decr_mode?!?!?.") - break; } if ( config_ptr->max_size == config_ptr->min_size ) { @@ -4352,7 +4348,6 @@ H5C__auto_adjust_cache_size(H5C_t * cache_ptr, default: HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode.") - break; } /* If the decr_mode is either age out or age out with threshold, we @@ -4478,7 +4473,6 @@ H5C__auto_adjust_cache_size(H5C_t * cache_ptr, default: HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode.") - break; } } @@ -25,13 +25,16 @@ * expected to be a rare condition. * */ + +/* Pablo information */ +/* (Put before include files to avoid problems with inline functions) */ +#define PABLO_MASK H5FS_mask + #include "H5private.h" /* Generic Functions */ #include "H5FSprivate.h" /* Private function stack routines */ #ifdef H5_HAVE_FUNCSTACK -#define PABLO_MASK H5FS_mask - #ifdef H5_HAVE_THREADSAFE /* * The per-thread function stack. pthread_once() initializes a special diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 20d67f2..71cdc90 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -129,8 +129,8 @@ typedef herr_t (*H5C_dest_func_t)(H5F_t *f, typedef herr_t (*H5C_clear_func_t)(H5F_t *f, void *thing, hbool_t dest); -typedef herr_t (*H5C_size_func_t)(H5F_t *f, - void *thing, +typedef herr_t (*H5C_size_func_t)(const H5F_t *f, + const void *thing, size_t *size_ptr); typedef struct H5C_class_t { @@ -145,7 +145,7 @@ typedef struct H5C_class_t { /* Type defintions of call back functions used by the cache as a whole */ -typedef herr_t (*H5C_write_permitted_func_t)(H5F_t *f, +typedef herr_t (*H5C_write_permitted_func_t)(const H5F_t *f, hid_t dxpl_id, hbool_t * write_permitted_ptr); @@ -703,8 +703,7 @@ H5_DLL herr_t H5C_insert_entry(H5F_t * f, haddr_t addr, void * thing); -H5_DLL herr_t H5C_rename_entry(H5F_t * f, - H5C_t * cache_ptr, +H5_DLL herr_t H5C_rename_entry(H5C_t * cache_ptr, const H5C_class_t * type, haddr_t old_addr, haddr_t new_addr); @@ -45,7 +45,7 @@ static hsize_t H5D_get_storage_size(H5D_t *dset, hid_t dxpl_id); static haddr_t H5D_get_offset(const H5D_t *dset); static herr_t H5D_extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id); static herr_t H5D_set_extent(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id); -static herr_t H5D_init_type(H5F_t *file, H5D_t *dset, hid_t type_id, const H5T_t *type); +static herr_t H5D_init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); static int H5D_crt_fill_value_cmp(const void *value1, const void *value2, size_t size); static int H5D_crt_ext_file_list_cmp(const void *value1, const void *value2, size_t size); static int H5D_crt_data_pipeline_cmp(const void *value1, const void *value2, size_t size); @@ -201,7 +201,7 @@ H5D_init_interface(void) FUNC_ENTER_NOAPI_NOINIT(H5D_init_interface) /* Initialize the atom group for the dataset IDs */ - if (H5I_register_type(H5I_DATASET, H5I_DATASETID_HASHSIZE, H5D_RESERVED_ATOMS, (H5I_free_t)H5D_close)<0) + if (H5I_register_type(H5I_DATASET, H5I_DATASETID_HASHSIZE, H5D_RESERVED_ATOMS, (H5I_free_t)H5D_close)<H5I_FILE) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize interface") /* =========Dataset Transfer Property Class Initialization========= */ @@ -420,7 +420,7 @@ H5D_term_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_term_interface) if (H5_interface_initialize_g) { - if ((n=H5I_nmembers(H5I_DATASET))) { + if ((n=H5I_nmembers(H5I_DATASET))>0) { /* The dataset API uses the "force" flag set to true because it * is using the "file objects" (H5FO) API functions to track open * objects in the file. Using the H5FO code means that dataset @@ -471,6 +471,7 @@ H5D_term_interface(void) * *------------------------------------------------------------------------- */ +/* ARGSUSED */ static herr_t H5D_xfer_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED size, void *value) { @@ -479,9 +480,6 @@ H5D_xfer_xform_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED FUNC_ENTER_NOAPI(H5D_xfer_xform_del, FAIL) assert(value); -#ifdef H5Z_XFORM_DEBUG - fprintf(stderr, "Freeing memory b/c of delete\n"); -#endif if(H5Z_xform_destroy(*(H5Z_data_xform_t **)value)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing the parse tree") @@ -510,6 +508,7 @@ done: * *------------------------------------------------------------------------- */ +/* ARGSUSED */ static herr_t H5D_xfer_xform_copy(const char UNUSED *name, size_t UNUSED size, void *value) { @@ -543,6 +542,7 @@ done: * *------------------------------------------------------------------------- */ +/* ARGSUSED */ static herr_t H5D_xfer_xform_close(const char UNUSED *name, size_t UNUSED size, void *value) { @@ -551,9 +551,6 @@ H5D_xfer_xform_close(const char UNUSED *name, size_t UNUSED size, void *value) FUNC_ENTER_NOAPI(H5D_xfer_xform_close, FAIL) assert(value); -#ifdef H5Z_XFORM_DEBUG - fprintf(stderr, "Freeing memory b/c of close\n"); -#endif if(H5Z_xform_destroy(*(H5Z_data_xform_t **)value)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing the parse tree") @@ -1748,7 +1745,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_init_type(H5F_t *file, H5D_t *dset, hid_t type_id, const H5T_t *type) +H5D_init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) { htri_t relocatable; /* Flag whether the type is relocatable */ htri_t immutable; /* Flag whether the type is immutable */ @@ -2359,7 +2356,7 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space default: HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet") - } /* end switch */ + } /* end switch */ /*lint !e788 All appropriate cases are covered */ /* Update the dataset's entry info. */ if (H5D_update_entry_info(file, dxpl_id, new_dset, dc_plist) != SUCCEED) @@ -2492,7 +2489,7 @@ done: *------------------------------------------------------------------------- */ H5D_t* -H5D_open(H5G_entry_t *ent, hid_t dxpl_id) +H5D_open(const H5G_entry_t *ent, hid_t dxpl_id) { H5D_shared_t *shared_fo=NULL; H5D_t *dataset=NULL; @@ -2534,16 +2531,15 @@ H5D_open(H5G_entry_t *ent, hid_t dxpl_id) ret_value = dataset; done: - if(ret_value==NULL) { + if(ret_value==NULL) { if(dataset) { - if(shared_fo==NULL) { /* Need to free shared fo */ + if(shared_fo==NULL) /* Need to free shared fo */ H5FL_FREE(H5D_shared_t, dataset->shared); - } H5FL_FREE(H5D_t, dataset); } if(shared_fo) shared_fo->fo_count--; - } + } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } @@ -2693,7 +2689,7 @@ H5D_open_oid(const H5G_entry_t *ent, hid_t dxpl_id) default: HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet") - } /* end switch */ + } /* end switch */ /*lint !e788 All appropriate cases are covered */ /* Point at dataset's copy, to cache it for later */ fill_prop=&dataset->shared->fill; @@ -2725,7 +2721,7 @@ H5D_open_oid(const H5G_entry_t *ent, hid_t dxpl_id) default: HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, NULL, "not implemented yet") - } /* end switch */ + } /* end switch */ /*lint !e788 All appropriate cases are covered */ /* Set the default fill time */ fill.fill_time=H5D_CRT_FILL_TIME_DEF; @@ -2900,7 +2896,7 @@ H5D_close(H5D_t *dataset) #ifdef NDEBUG HGOTO_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout") #endif /* NDEBUG */ - } /* end switch */ + } /* end switch */ /*lint !e788 All appropriate cases are covered */ /* * Release datatype, dataspace and creation property list -- there isn't @@ -3224,7 +3220,7 @@ H5D_alloc_storage (H5F_t *f, hid_t dxpl_id, H5D_t *dset/*in,out*/, H5D_time_allo #ifdef NDEBUG HGOTO_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout") #endif /* NDEBUG */ - } /* end switch */ + } /* end switch */ /*lint !e788 All appropriate cases are covered */ /* Check if we need to initialize the space */ if(init_space) { @@ -3349,7 +3345,7 @@ H5D_init_storage(H5D_t *dset, hbool_t full_overwrite, hid_t dxpl_id) #ifdef NDEBUG HGOTO_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout") #endif /* NDEBUG */ - } /* end switch */ + } /* end switch */ /*lint !e788 All appropriate cases are covered */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -3443,7 +3439,7 @@ H5D_get_storage_size(H5D_t *dset, hid_t dxpl_id) default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataset type") - } + } /*lint !e788 All appropriate cases are covered */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -3539,7 +3535,7 @@ H5D_get_offset(const H5D_t *dset) #ifdef NDEBUG HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "unknown dataset layout type") #endif /* NDEBUG */ - } + } /*lint !e788 All appropriate cases are covered */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -3574,14 +3570,14 @@ done: * Operation information: * H5D_operator_t is defined as: * typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, - * hsize_t ndim, hssize_t *point, void *operator_data); + * unsigned ndim, const hsize_t *point, void *operator_data); * * H5D_operator_t parameters: * void *elem; IN/OUT: Pointer to the element in memory containing * the current point. * hid_t type_id; IN: Datatype ID for the elements stored in ELEM. - * hsize_t ndim; IN: Number of dimensions for POINT array - * hssize_t *point; IN: Array containing the location of the element + * unsigned ndim; IN: Number of dimensions for POINT array + * const hsize_t *point; IN: Array containing the location of the element * within the original dataspace. * void *operator_data; IN/OUT: Pointer to any user-defined data * associated with the operation. @@ -3753,7 +3749,7 @@ done: */ /* ARGSUSED */ static herr_t -H5D_vlen_get_buf_size(void UNUSED *elem, hid_t type_id, hsize_t UNUSED ndim, hssize_t *point, void *op_data) +H5D_vlen_get_buf_size(void UNUSED *elem, hid_t type_id, unsigned UNUSED ndim, const hsize_t *point, void *op_data) { H5D_vlen_bufsize_t *vlen_bufsize=(H5D_vlen_bufsize_t *)op_data; H5T_t *dt = NULL; @@ -3773,7 +3769,7 @@ H5D_vlen_get_buf_size(void UNUSED *elem, hid_t type_id, hsize_t UNUSED ndim, hss HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't resize tbuf") /* Select point to read in */ - if (H5Sselect_elements(vlen_bufsize->fspace_id,H5S_SELECT_SET,1,(const hssize_t **)point)<0) + if (H5Sselect_elements(vlen_bufsize->fspace_id,H5S_SELECT_SET,1,(const hsize_t **)point)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't select point") /* Read in the point (with the custom VL memory allocator) */ @@ -4075,7 +4071,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D_flush(H5F_t *f, hid_t dxpl_id, unsigned flags) +H5D_flush(const H5F_t *f, hid_t dxpl_id, unsigned flags) { int num_dsets; /* Number of datasets in file */ hid_t *id_list=NULL; /* list of dataset IDs */ @@ -4140,7 +4136,7 @@ H5D_flush(H5F_t *f, hid_t dxpl_id, unsigned flags) #ifdef NDEBUG HGOTO_ERROR (H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout") #endif /* NDEBUG */ - } /* end switch */ + } /* end switch */ /*lint !e788 All appropriate cases are covered */ } } /* end if */ diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 658aae0..8a032e3 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -57,23 +57,23 @@ *------------------------------------------------------------------------- */ ssize_t -H5D_compact_readvv(H5D_io_info_t *io_info, +H5D_compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[], void *buf) { ssize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5D_compact_readvv, FAIL); + FUNC_ENTER_NOAPI(H5D_compact_readvv, FAIL) assert(io_info->dset); /* Use the vectorized memory copy routine to do actual work */ if((ret_value=H5V_memcpyvv(buf,mem_max_nseq,mem_curr_seq,mem_size_arr,mem_offset_arr,io_info->dset->shared->layout.u.compact.buf,dset_max_nseq,dset_curr_seq,dset_size_arr,dset_offset_arr))<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_compact_readvv() */ @@ -101,23 +101,23 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5D_compact_writevv(H5D_io_info_t *io_info, +H5D_compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[], const void *buf) { ssize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5D_compact_writevv, FAIL); + FUNC_ENTER_NOAPI(H5D_compact_writevv, FAIL) assert(io_info->dset); /* Use the vectorized memory copy routine to do actual work */ if((ret_value=H5V_memcpyvv(io_info->dset->shared->layout.u.compact.buf,dset_max_nseq,dset_curr_seq,dset_size_arr,dset_offset_arr,buf,mem_max_nseq,mem_curr_seq,mem_size_arr,mem_offset_arr))<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") io_info->dset->shared->layout.u.compact.dirty = TRUE; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_compact_writevv() */ diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 6cb3b39..18c6677 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -73,7 +73,7 @@ H5D_contig_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */ ) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_contig_create, FAIL); + FUNC_ENTER_NOAPI(H5D_contig_create, FAIL) /* check args */ assert(f); @@ -81,10 +81,10 @@ H5D_contig_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */ ) /* Allocate space for the contiguous data */ if (HADDR_UNDEF==(layout->u.contig.addr=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, layout->u.contig.size))) - HGOTO_ERROR (H5E_IO, H5E_NOSPACE, FAIL, "unable to reserve file space"); + HGOTO_ERROR (H5E_IO, H5E_NOSPACE, FAIL, "unable to reserve file space") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_contig_create */ @@ -129,7 +129,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) int non_zero_fill_f=(-1); /* Indicate that a non-zero fill-value was used */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_contig_fill, FAIL); + FUNC_ENTER_NOAPI(H5D_contig_fill, FAIL) /* Check args */ assert(TRUE==H5P_isa_class(dxpl_id,H5P_DATASET_XFER)); @@ -143,11 +143,11 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) if(IS_H5FD_MPI(dset->ent.file)) { /* Get the MPI communicator */ if (MPI_COMM_NULL == (mpi_comm=H5F_mpi_get_comm(dset->ent.file))) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator"); + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator") /* Get the MPI rank */ if ((mpi_rank=H5F_mpi_get_rank(dset->ent.file))<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank") /* Set the MPI-capable file driver flag */ using_mpi=1; @@ -194,7 +194,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) if(dset->shared->fill.buf) { /* Allocate temporary buffer */ if ((buf=H5FL_BLK_MALLOC(non_zero_fill,bufsize))==NULL) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer"); + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer") H5V_array_fill(buf, dset->shared->fill.buf, elmt_size, ptsperbuf); @@ -214,7 +214,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) else buf=H5FL_BLK_MALLOC(zero_fill,bufsize); if(buf==NULL) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer"); + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer") /* Indicate that a zero fill buffer was used */ non_zero_fill_f=0; @@ -234,7 +234,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) /* !! Use the internal "independent" DXPL!! -QAK */ if(H5_PAR_META_WRITE==mpi_rank) { if (H5D_contig_write(dset, dxpl_cache, H5AC_ind_dxpl_id, &store, offset, size, buf)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset"); + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset") } /* end if */ /* Indicate that blocks are being written */ @@ -244,7 +244,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) #endif /* H5_HAVE_PARALLEL */ H5_CHECK_OVERFLOW(size,size_t,hsize_t); if (H5D_contig_write(dset, dxpl_cache, dxpl_id, &store, offset, size, buf)<0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset"); + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset") #ifdef H5_HAVE_PARALLEL } /* end else */ #endif /* H5_HAVE_PARALLEL */ @@ -262,7 +262,7 @@ H5D_contig_fill(H5D_t *dset, hid_t dxpl_id) * in, getting bogus data. */ if (MPI_SUCCESS != (mpi_code=MPI_Barrier(mpi_comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code); + HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_code) } /* end if */ #endif /* H5_HAVE_PARALLEL */ @@ -276,7 +276,7 @@ done: H5FL_BLK_FREE(zero_fill,buf); } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_contig_fill() */ @@ -299,7 +299,7 @@ H5D_contig_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_contig_delete, FAIL); + FUNC_ENTER_NOAPI(H5D_contig_delete, FAIL) /* check args */ assert(f); @@ -307,10 +307,10 @@ H5D_contig_delete(H5F_t *f, hid_t dxpl_id, const struct H5O_layout_t *layout) /* Free the file space for the chunk */ if (H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, layout->u.contig.addr, layout->u.contig.size)<0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object header"); + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free object header") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_contig_delete */ @@ -331,13 +331,13 @@ done: haddr_t H5D_contig_get_addr(const H5D_t *dset) { - FUNC_ENTER_NOAPI_NOFUNC(H5D_contig_get_addr); + FUNC_ENTER_NOAPI_NOFUNC(H5D_contig_get_addr) /* check args */ assert(dset); assert(dset->shared->layout.type==H5D_CONTIGUOUS); - FUNC_LEAVE_NOAPI(dset->shared->layout.u.contig.addr); + FUNC_LEAVE_NOAPI(dset->shared->layout.u.contig.addr) } /* end H5D_contig_get_addr */ @@ -372,7 +372,7 @@ H5D_contig_write(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, size_t mem_curr_seq=0; /* "Current sequence" in memory */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_contig_write, FAIL); + FUNC_ENTER_NOAPI(H5D_contig_write, FAIL) assert (dset); assert (dxpl_cache); @@ -382,10 +382,10 @@ H5D_contig_write(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, H5D_BUILD_IO_INFO(&io_info,dset,dxpl_cache,dxpl_id,store); if (H5D_contig_writevv(&io_info, 1, &dset_curr_seq, &dset_len, &dset_off, 1, &mem_curr_seq, &mem_len, &mem_off, buf)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vector write failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vector write failed") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_contig_write() */ @@ -410,7 +410,7 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5D_contig_readvv(H5D_io_info_t *io_info, +H5D_contig_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], void *_buf) @@ -420,12 +420,13 @@ H5D_contig_readvv(H5D_io_info_t *io_info, const H5D_contig_storage_t *store_contig=&(io_info->store->contig); /* Contiguous storage info for this I/O operation */ unsigned char *buf=(unsigned char *)_buf; /* Pointer to buffer to fill */ haddr_t addr; /* Actual address to read */ + size_t total_size=0; /* Total size of sequence in bytes */ size_t size; /* Size of sequence in bytes */ size_t u; /* Counting variable */ size_t v; /* Counting variable */ - ssize_t ret_value=0; /* Return value */ + ssize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5D_contig_readvv, FAIL); + FUNC_ENTER_NOAPI(H5D_contig_readvv, FAIL) /* Check args */ assert(io_info); @@ -452,7 +453,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info, sieve_size=dset_contig->sieve_size; sieve_end=sieve_start+sieve_size; } /* end if */ - + /* Works through sequences as fast as possible */ for(; u<dset_max_nseq && v<mem_max_nseq; ) { /* Choose smallest buffer to write */ @@ -472,19 +473,19 @@ H5D_contig_readvv(H5D_io_info_t *io_info, /* Check if we can actually hold the I/O request in the sieve buffer */ if(size>dset_contig->sieve_buf_size) { if (H5F_block_read(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf)<0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed"); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed") } /* end if */ else { /* Allocate room for the data sieve buffer */ if (NULL==(dset_contig->sieve_buf=H5FL_BLK_MALLOC(sieve_buf,dset_contig->sieve_buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Determine the new sieve buffer size & location */ dset_contig->sieve_loc=addr; /* Make certain we don't read off the end of the file */ if (HADDR_UNDEF==(abs_eoa=H5F_get_eoa(file))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size") /* Adjust absolute EOA address to relative EOA address */ rel_eoa=abs_eoa-H5F_get_base_addr(file); @@ -497,7 +498,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info, /* Read the new sieve buffer */ if (H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed"); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed") /* Grab the data out of the buffer (must be first piece of data in buffer ) */ HDmemcpy(buf,dset_contig->sieve_buf,size); @@ -533,7 +534,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info, if(dset_contig->sieve_dirty) { /* Write to file */ if (H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed") /* Reset sieve buffer dirty flag */ dset_contig->sieve_dirty=0; @@ -542,7 +543,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info, /* Read directly into the user's buffer */ if (H5F_block_read(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf)<0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed"); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed") } /* end if */ /* Element size fits within the buffer size */ else { @@ -550,7 +551,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info, if(dset_contig->sieve_dirty) { /* Write to file */ if (H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed") /* Reset sieve buffer dirty flag */ dset_contig->sieve_dirty=0; @@ -561,7 +562,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info, /* Make certain we don't read off the end of the file */ if (HADDR_UNDEF==(abs_eoa=H5F_get_eoa(file))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size") /* Adjust absolute EOA address to relative EOA address */ rel_eoa=abs_eoa-H5F_get_base_addr(file); @@ -580,7 +581,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info, /* Read the new sieve buffer */ if (H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed"); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed") /* Grab the data out of the buffer (must be first piece of data in buffer ) */ HDmemcpy(buf,dset_contig->sieve_buf,size); @@ -604,7 +605,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info, u++; /* Increment number of bytes copied */ - ret_value+=size; + total_size+=size; } /* end for */ } /* end if */ else { @@ -624,7 +625,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info, /* Write data */ if (H5F_block_read(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed") /* Update memory information */ mem_len_arr[v]-=size; @@ -639,7 +640,7 @@ H5D_contig_readvv(H5D_io_info_t *io_info, u++; /* Increment number of bytes copied */ - ret_value+=size; + total_size+=size; } /* end for */ } /* end else */ @@ -647,8 +648,11 @@ H5D_contig_readvv(H5D_io_info_t *io_info, *dset_curr_seq=u; *mem_curr_seq=v; + /* Set return value */ + H5_ASSIGN_OVERFLOW(ret_value,total_size,size_t,ssize_t); + done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_contig_readvv() */ @@ -673,7 +677,7 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5D_contig_writevv(H5D_io_info_t *io_info, +H5D_contig_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], const void *_buf) @@ -683,12 +687,13 @@ H5D_contig_writevv(H5D_io_info_t *io_info, const H5D_contig_storage_t *store_contig=&(io_info->store->contig); /* Contiguous storage info for this I/O operation */ const unsigned char *buf=_buf; /* Pointer to buffer to fill */ haddr_t addr; /* Actual address to read */ + size_t total_size=0; /* Size of sequence in bytes */ size_t size; /* Size of sequence in bytes */ size_t u; /* Counting variable */ size_t v; /* Counting variable */ - ssize_t ret_value=0; /* Return value */ + ssize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5D_contig_writevv, FAIL); + FUNC_ENTER_NOAPI(H5D_contig_writevv, FAIL) /* Check args */ assert(io_info); @@ -735,19 +740,19 @@ H5D_contig_writevv(H5D_io_info_t *io_info, /* Check if we can actually hold the I/O request in the sieve buffer */ if(size>dset_contig->sieve_buf_size) { if (H5F_block_write(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed") } /* end if */ else { /* Allocate room for the data sieve buffer */ if (NULL==(dset_contig->sieve_buf=H5FL_BLK_MALLOC(sieve_buf,dset_contig->sieve_buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Determine the new sieve buffer size & location */ dset_contig->sieve_loc=addr; /* Make certain we don't read off the end of the file */ if (HADDR_UNDEF==(abs_eoa=H5F_get_eoa(file))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size") /* Adjust absolute EOA address to relative EOA address */ rel_eoa=abs_eoa-H5F_get_base_addr(file); @@ -762,7 +767,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info, if(dset_contig->sieve_size>size) { /* Read the new sieve buffer */ if (H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed"); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed") } /* end if */ /* Grab the data out of the buffer (must be first piece of data in buffer ) */ @@ -790,7 +795,6 @@ H5D_contig_writevv(H5D_io_info_t *io_info, /* Set sieve buffer dirty flag */ dset_contig->sieve_dirty=1; - } /* end if */ /* Entire request is not within this data sieve buffer */ else { @@ -803,7 +807,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info, if(dset_contig->sieve_dirty) { /* Write to file */ if (H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed") /* Reset sieve buffer dirty flag */ dset_contig->sieve_dirty=0; @@ -816,7 +820,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info, /* Write directly from the user's buffer */ if (H5F_block_write(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed") } /* end if */ /* Element size fits within the buffer size */ else { @@ -827,7 +831,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info, /* Prepend to existing sieve buffer */ if((addr+size)==sieve_start) { /* Move existing sieve information to correct location */ - HDmemmove(dset_contig->sieve_buf+size,dset_contig->sieve_buf,sieve_size); + HDmemmove(dset_contig->sieve_buf+size,dset_contig->sieve_buf,dset_contig->sieve_size); /* Copy in new information (must be first in sieve buffer) */ HDmemcpy(dset_contig->sieve_buf,buf,size); @@ -849,7 +853,6 @@ H5D_contig_writevv(H5D_io_info_t *io_info, sieve_start=dset_contig->sieve_loc; sieve_size=dset_contig->sieve_size; sieve_end=sieve_start+sieve_size; - } /* end if */ /* Can't add the new data onto the existing sieve buffer */ else { @@ -857,7 +860,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info, if(dset_contig->sieve_dirty) { /* Write to file */ if (H5F_block_write(file, H5FD_MEM_DRAW, sieve_start, sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed") /* Reset sieve buffer dirty flag */ dset_contig->sieve_dirty=0; @@ -868,7 +871,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info, /* Make certain we don't read off the end of the file */ if (HADDR_UNDEF==(abs_eoa=H5F_get_eoa(file))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to determine file size") /* Adjust absolute EOA address to relative EOA address */ rel_eoa=abs_eoa-H5F_get_base_addr(file); @@ -889,7 +892,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info, if(dset_contig->sieve_size>size) { /* Read the new sieve buffer */ if (H5F_block_read(file, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, io_info->dxpl_id, dset_contig->sieve_buf)<0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed"); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "block read failed") } /* end if */ /* Grab the data out of the buffer (must be first piece of data in buffer ) */ @@ -897,7 +900,6 @@ H5D_contig_writevv(H5D_io_info_t *io_info, /* Set sieve buffer dirty flag */ dset_contig->sieve_dirty=1; - } /* end else */ } /* end else */ } /* end else */ @@ -916,7 +918,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info, u++; /* Increment number of bytes copied */ - ret_value+=size; + total_size+=size; } /* end for */ } /* end if */ else { @@ -936,7 +938,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info, /* Write data */ if (H5F_block_write(file, H5FD_MEM_DRAW, addr, size, io_info->dxpl_id, buf)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed") /* Update memory information */ mem_len_arr[v]-=size; @@ -951,7 +953,7 @@ H5D_contig_writevv(H5D_io_info_t *io_info, u++; /* Increment number of bytes copied */ - ret_value+=size; + total_size+=size; } /* end for */ } /* end else */ @@ -959,7 +961,10 @@ H5D_contig_writevv(H5D_io_info_t *io_info, *dset_curr_seq=u; *mem_curr_seq=v; + /* Set return value */ + H5_ASSIGN_OVERFLOW(ret_value,total_size,size_t,ssize_t); + done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_contig_writevv() */ diff --git a/src/H5Defl.c b/src/H5Defl.c index ab3e260..3a7b079 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -67,7 +67,7 @@ H5D_efl_read (const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) size_t u; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_efl_read); + FUNC_ENTER_NOAPI_NOINIT(H5D_efl_read) /* Check args */ assert (efl && efl->nused>0); @@ -86,14 +86,15 @@ H5D_efl_read (const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) /* Read the data */ while (size) { + assert(buf); if (u>=efl->nused) - HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file"); + HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file") if (H5F_OVERFLOW_HSIZET2OFFT (efl->slot[u].offset+skip)) - HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed"); + HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") if ((fd=HDopen (efl->slot[u].name, O_RDONLY, 0))<0) - HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file"); + HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") if (HDlseek (fd, (off_t)(efl->slot[u].offset+skip), SEEK_SET)<0) - HGOTO_ERROR (H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file"); + HGOTO_ERROR (H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") #ifndef NDEBUG tempto_read = MIN(efl->slot[u].size-skip,(hsize_t)size); H5_CHECK_OVERFLOW(tempto_read,hsize_t,size_t); @@ -102,7 +103,7 @@ H5D_efl_read (const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) to_read = MIN((size_t)(efl->slot[u].size-skip), size); #endif /* NDEBUG */ if ((n=HDread (fd, buf, to_read))<0) { - HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file"); + HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file") } else if ((size_t)n<to_read) { HDmemset (buf+n, 0, to_read-n); } @@ -118,7 +119,7 @@ done: if (fd>=0) HDclose (fd); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -153,7 +154,7 @@ H5D_efl_write (const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b size_t u; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_efl_write); + FUNC_ENTER_NOAPI_NOINIT(H5D_efl_write) /* Check args */ assert (efl && efl->nused>0); @@ -172,19 +173,20 @@ H5D_efl_write (const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b /* Write the data */ while (size) { + assert(buf); if (u>=efl->nused) - HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file"); + HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file") if (H5F_OVERFLOW_HSIZET2OFFT (efl->slot[u].offset+skip)) - HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed"); + HGOTO_ERROR (H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") if ((fd=HDopen (efl->slot[u].name, O_CREAT|O_RDWR, 0666))<0) { if (HDaccess (efl->slot[u].name, F_OK)<0) { - HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist"); + HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist") } else { - HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file"); + HGOTO_ERROR (H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") } } if (HDlseek (fd, (off_t)(efl->slot[u].offset+skip), SEEK_SET)<0) - HGOTO_ERROR (H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file"); + HGOTO_ERROR (H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") #ifndef NDEBUG tempto_write = MIN(efl->slot[u].size-skip,(hsize_t)size); H5_CHECK_OVERFLOW(tempto_write,hsize_t,size_t); @@ -193,7 +195,7 @@ H5D_efl_write (const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b to_write = MIN((size_t)(efl->slot[u].size-skip), size); #endif /* NDEBUG */ if ((size_t)HDwrite (fd, buf, to_write)!=to_write) - HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file"); + HGOTO_ERROR (H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file") HDclose (fd); fd = -1; size -= to_write; @@ -206,7 +208,7 @@ done: if (fd>=0) HDclose (fd); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -228,7 +230,7 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5D_efl_readvv(H5D_io_info_t *io_info, +H5D_efl_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], void *_buf) @@ -236,12 +238,13 @@ H5D_efl_readvv(H5D_io_info_t *io_info, const H5O_efl_t *efl=&(io_info->store->efl); /* Pointer to efl info */ unsigned char *buf; /* Pointer to buffer to write */ haddr_t addr; /* Actual address to read */ + size_t total_size=0; /* Total size of sequence in bytes */ size_t size; /* Size of sequence in bytes */ size_t u; /* Counting variable */ size_t v; /* Counting variable */ - ssize_t ret_value=0; /* Return value */ + ssize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5D_efl_readvv, FAIL); + FUNC_ENTER_NOAPI(H5D_efl_readvv, FAIL) /* Check args */ assert (efl && efl->nused>0); @@ -263,7 +266,7 @@ H5D_efl_readvv(H5D_io_info_t *io_info, /* Read data */ if (H5D_efl_read(efl, addr, size, buf)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed") /* Update memory information */ mem_len_arr[v]-=size; @@ -278,15 +281,18 @@ H5D_efl_readvv(H5D_io_info_t *io_info, u++; /* Increment number of bytes copied */ - ret_value+=size; + total_size+=size; } /* end for */ /* Update current sequence vectors */ *dset_curr_seq=u; *mem_curr_seq=v; + /* Set return value */ + H5_ASSIGN_OVERFLOW(ret_value,total_size,size_t,ssize_t); + done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_efl_readvv() */ @@ -308,7 +314,7 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5D_efl_writevv(H5D_io_info_t *io_info, +H5D_efl_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], const void *_buf) @@ -316,12 +322,13 @@ H5D_efl_writevv(H5D_io_info_t *io_info, const H5O_efl_t *efl=&(io_info->store->efl); /* Pointer to efl info */ const unsigned char *buf; /* Pointer to buffer to write */ haddr_t addr; /* Actual address to read */ + size_t total_size=0; /* Total size of sequence in bytes */ size_t size; /* Size of sequence in bytes */ size_t u; /* Counting variable */ size_t v; /* Counting variable */ - ssize_t ret_value=0; /* Return value */ + ssize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5D_efl_writevv, FAIL); + FUNC_ENTER_NOAPI(H5D_efl_writevv, FAIL) /* Check args */ assert (efl && efl->nused>0); @@ -343,7 +350,7 @@ H5D_efl_writevv(H5D_io_info_t *io_info, /* Write data */ if (H5D_efl_write(efl, addr, size, buf)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed") /* Update memory information */ mem_len_arr[v]-=size; @@ -358,14 +365,17 @@ H5D_efl_writevv(H5D_io_info_t *io_info, u++; /* Increment number of bytes copied */ - ret_value+=size; + total_size+=size; } /* end for */ /* Update current sequence vectors */ *dset_curr_seq=u; *mem_curr_seq=v; + /* Set return value */ + H5_ASSIGN_OVERFLOW(ret_value,total_size,size_t,ssize_t); + done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_efl_writevv() */ diff --git a/src/H5Dio.c b/src/H5Dio.c index 1a1802e..7e8e1a0 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -44,7 +44,7 @@ typedef struct H5D_chunk_info_t { hsize_t index; /* "Index" of chunk in dataset (must be first for TBBT routines) */ size_t chunk_points; /* Number of elements selected in chunk */ H5S_t *fspace; /* Dataspace describing chunk & selection in it */ - hssize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of chunk in file dataset's dataspace */ + hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of chunk in file dataset's dataspace */ H5S_t *mspace; /* Dataspace describing selection in memory corresponding to this chunk */ unsigned mspace_shared; /* Indicate that the memory space for a chunk is shared and shouldn't be freed */ } H5D_chunk_info_t; @@ -117,16 +117,16 @@ H5D_ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, unsigned flags, hbool_t *use_par_opt_io, H5D_io_info_t *io_info); /* Chunk operations */ -static herr_t H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type, +static herr_t H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_space, const H5S_t *mem_space, fm_map *fm); static herr_t H5D_destroy_chunk_map(const fm_map *fm); static void H5D_free_chunk_info(void *chunk_info); -static herr_t H5D_create_chunk_file_map_hyper(fm_map *fm); +static herr_t H5D_create_chunk_file_map_hyper(const fm_map *fm); static herr_t H5D_create_chunk_mem_map_hyper(const fm_map *fm); -static herr_t H5D_chunk_file_cb(void *elem, hid_t type_id, hsize_t ndims, - hssize_t *coords, void *fm); -static herr_t H5D_chunk_mem_cb(void *elem, hid_t type_id, hsize_t ndims, - hssize_t *coords, void *fm); +static herr_t H5D_chunk_file_cb(void *elem, hid_t type_id, unsigned ndims, + const hsize_t *coords, void *fm); +static herr_t H5D_chunk_mem_cb(void *elem, hid_t type_id, unsigned ndims, + const hsize_t *coords, void *fm); /* Declare a free list to manage blocks of single datatype element data */ H5FL_BLK_DEFINE(type_elem); @@ -337,11 +337,7 @@ H5D_get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache) /* Get B-tree split ratios */ if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &cache->btree_split_ratio)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type") - - /* Get B-tree split ratios */ - if(H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &cache->btree_split_ratio)<0) - HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve background buffer type") + HGOTO_ERROR (H5E_PLIST, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios") /* Get I/O vector size */ if(H5P_get(dx_plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &cache->vec_size)<0) @@ -2356,7 +2352,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_space, +H5D_create_chunk_map(const H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_space, const H5S_t *mem_space, fm_map *fm) { H5S_t *tmp_mspace=NULL; /* Temporary memory dataspace */ @@ -2435,9 +2431,9 @@ H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_sp fm->mem_space_copy=equiv_mspace_init; /* Make certain to copy memory dataspace if necessary */ /* Get type of selection on disk & in memory */ - if((fsel_type=H5S_GET_SELECT_TYPE(file_space))<0) + if((fsel_type=H5S_GET_SELECT_TYPE(file_space))<H5S_SEL_NONE) HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space") - if((fm->msel_type=H5S_GET_SELECT_TYPE(equiv_mspace))<0) + if((fm->msel_type=H5S_GET_SELECT_TYPE(equiv_mspace))<H5S_SEL_NONE) HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space") /* Check if file selection is a point selection */ @@ -2664,14 +2660,15 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_create_chunk_file_map_hyper(fm_map *fm) +H5D_create_chunk_file_map_hyper(const fm_map *fm) { - hssize_t sel_points; /* Number of elements in file selection */ - hssize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */ - hssize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */ - hssize_t start_coords[H5O_LAYOUT_NDIMS]; /* Starting coordinates of selection */ - hssize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */ - hssize_t end[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */ + hssize_t ssel_points; /* Number of elements in file selection */ + hsize_t sel_points; /* Number of elements in file selection */ + hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */ + hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */ + hsize_t start_coords[H5O_LAYOUT_NDIMS]; /* Starting coordinates of selection */ + hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */ + hsize_t end[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */ hsize_t chunk_index; /* Index of chunk */ int curr_dim; /* Current dimension to increment */ unsigned u; /* Local index variable */ @@ -2683,8 +2680,9 @@ H5D_create_chunk_file_map_hyper(fm_map *fm) assert(fm->f_ndims>0); /* Get number of elements selected in file */ - if((sel_points=H5S_GET_SELECT_NPOINTS(fm->file_space))<0) + if((ssel_points=H5S_GET_SELECT_NPOINTS(fm->file_space))<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements") + H5_ASSIGN_OVERFLOW(sel_points,ssel_points,hssize_t,hsize_t); /* Get bounding box for selection (to reduce the number of chunks to iterate over) */ if(H5S_SELECT_BOUNDS(fm->file_space, sel_start, sel_end)<0) @@ -2692,8 +2690,7 @@ H5D_create_chunk_file_map_hyper(fm_map *fm) /* Set initial chunk location & hyperslab size */ for(u=0; u<fm->f_ndims; u++) { - H5_CHECK_OVERFLOW(fm->layout->u.chunk.dim[u],hsize_t,hssize_t); - start_coords[u]=(sel_start[u]/(hssize_t)fm->layout->u.chunk.dim[u])*(hssize_t)fm->layout->u.chunk.dim[u]; + start_coords[u]=(sel_start[u]/fm->layout->u.chunk.dim[u])*fm->layout->u.chunk.dim[u]; coords[u]=start_coords[u]; end[u]=(coords[u]+fm->chunk_dim[u])-1; } /* end for */ @@ -2716,12 +2713,16 @@ H5D_create_chunk_file_map_hyper(fm_map *fm) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space") /* Make certain selections are stored in span tree form (not "optimized hyperslab" or "all") */ - if(H5S_hyper_convert(tmp_fchunk)<0) + if(H5S_hyper_convert(tmp_fchunk)<0) { + (void)H5S_close(tmp_fchunk); HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to convert selection to span trees") + } /* end if */ /* Normalize hyperslab selections by adjusting them by the offset */ - if(H5S_hyper_normalize_offset(tmp_fchunk)<0) + if(H5S_hyper_normalize_offset(tmp_fchunk)<0) { + (void)H5S_close(tmp_fchunk); HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset") + } /* end if */ /* "AND" temporary chunk and current chunk */ if(H5S_select_hyperslab(tmp_fchunk,H5S_SELECT_AND,coords,NULL,fm->chunk_dim,NULL)<0) { @@ -2736,7 +2737,7 @@ H5D_create_chunk_file_map_hyper(fm_map *fm) } /* end if */ /* Move selection back to have correct offset in chunk */ - if(H5S_hyper_adjust(tmp_fchunk,coords)<0) { + if(H5S_hyper_adjust_u(tmp_fchunk,coords)<0) { (void)H5S_close(tmp_fchunk); HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection") } /* end if */ @@ -2778,7 +2779,7 @@ H5D_create_chunk_file_map_hyper(fm_map *fm) H5_ASSIGN_OVERFLOW(new_chunk_info->chunk_points,schunk_points,hssize_t,size_t); /* Decrement # of points left in file selection */ - sel_points-=schunk_points; + sel_points-=(hsize_t)schunk_points; /* Leave if we are done */ if(sel_points==0) @@ -2794,8 +2795,8 @@ H5D_create_chunk_file_map_hyper(fm_map *fm) /* Increment chunk location in fastest changing dimension */ H5_CHECK_OVERFLOW(fm->chunk_dim[curr_dim],hsize_t,hssize_t); - coords[curr_dim]+=(hssize_t)fm->chunk_dim[curr_dim]; - end[curr_dim]+=(hssize_t)fm->chunk_dim[curr_dim]; + coords[curr_dim]+=fm->chunk_dim[curr_dim]; + end[curr_dim]+=fm->chunk_dim[curr_dim]; /* Bring chunk location back into bounds, if necessary */ if(coords[curr_dim]>sel_end[curr_dim]) { @@ -2808,8 +2809,8 @@ H5D_create_chunk_file_map_hyper(fm_map *fm) curr_dim--; /* Increment chunk location in current dimension */ - coords[curr_dim]+=(hssize_t)fm->chunk_dim[curr_dim]; - end[curr_dim]=(coords[curr_dim]+(hssize_t)fm->chunk_dim[curr_dim])-1; + coords[curr_dim]+=fm->chunk_dim[curr_dim]; + end[curr_dim]=(coords[curr_dim]+fm->chunk_dim[curr_dim])-1; } while(coords[curr_dim]>sel_end[curr_dim]); /* Re-Calculate the index of this chunk */ @@ -2845,10 +2846,10 @@ static herr_t H5D_create_chunk_mem_map_hyper(const fm_map *fm) { H5TB_NODE *curr_node; /* Current node in TBBT */ - hssize_t file_sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */ - hssize_t file_sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */ - hssize_t mem_sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */ - hssize_t mem_sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */ + hsize_t file_sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */ + hsize_t file_sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */ + hsize_t mem_sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */ + hsize_t mem_sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */ hssize_t adjust[H5O_LAYOUT_NDIMS]; /* Adjustment to make to all file chunks */ hssize_t chunk_adjust[H5O_LAYOUT_NDIMS]; /* Adjustment to make to a particular chunk */ unsigned u; /* Local index variable */ @@ -2896,8 +2897,11 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm) /* Calculate the adjustment for memory selection from file selection */ assert(fm->m_ndims==fm->f_ndims); - for(u=0; u<fm->f_ndims; u++) - adjust[u]=file_sel_start[u]-mem_sel_start[u]; + for(u=0; u<fm->f_ndims; u++) { + H5_CHECK_OVERFLOW(file_sel_start[u],hsize_t,hssize_t); + H5_CHECK_OVERFLOW(mem_sel_start[u],hsize_t,hssize_t); + adjust[u]=(hssize_t)file_sel_start[u]-(hssize_t)mem_sel_start[u]; + } /* end for */ /* Iterate over each chunk in the chunk list */ curr_node=H5TB_first(fm->fsel->root); @@ -2923,11 +2927,13 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection") /* Compensate for the chunk offset */ - for(u=0; u<fm->f_ndims; u++) - chunk_adjust[u]=adjust[u]-chunk_info->coords[u]; /*lint !e771 The adjust array will always be initialized */ + for(u=0; u<fm->f_ndims; u++) { + H5_CHECK_OVERFLOW(chunk_info->coords[u],hsize_t,hssize_t); + chunk_adjust[u]=adjust[u]-(hssize_t)chunk_info->coords[u]; /*lint !e771 The adjust array will always be initialized */ + } /* end for */ /* Adjust the selection */ - if(H5S_hyper_adjust(chunk_info->mspace,chunk_adjust)<0) /*lint !e772 The chunk_adjust array will always be initialized */ + if(H5S_hyper_adjust_s(chunk_info->mspace,chunk_adjust)<0) /*lint !e772 The chunk_adjust array will always be initialized */ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection") /* Get the next chunk node in the TBBT */ @@ -2956,11 +2962,11 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize_t *coords, void *_fm) +H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const hsize_t *coords, void *_fm) { fm_map *fm = (fm_map*)_fm; /* File<->memory chunk mapping info */ H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */ - hssize_t coords_in_chunk[H5O_LAYOUT_NDIMS]; /* Coordinates of element in chunk */ + hsize_t coords_in_chunk[H5O_LAYOUT_NDIMS]; /* Coordinates of element in chunk */ hsize_t chunk_index; /* Chunk index */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2968,7 +2974,7 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_file_cb) /* Calculate the index of this chunk */ - if(H5V_chunk_index((unsigned)ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0) + if(H5V_chunk_index(ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") /* Find correct chunk in file & memory TBBTs */ @@ -3051,7 +3057,7 @@ H5D_chunk_file_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize coords_in_chunk[u]=coords[u]%fm->layout->u.chunk.dim[u]; /* Add point to file selection for chunk */ - if(H5S_select_elements(chunk_info->fspace,H5S_SELECT_APPEND,1,(const hssize_t **)coords_in_chunk)<0) + if(H5S_select_elements(chunk_info->fspace,H5S_SELECT_APPEND,1,(const hsize_t **)coords_in_chunk)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element") /* Increment the number of elemented selected in chunk */ @@ -3081,18 +3087,18 @@ done: */ /* ARGSUSED */ static herr_t -H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize_t *coords, void *_fm) +H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, unsigned ndims, const hsize_t *coords, void *_fm) { fm_map *fm = (fm_map*)_fm; /* File<->memory chunk mapping info */ H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */ - hssize_t coords_in_mem[H5O_LAYOUT_NDIMS]; /* Coordinates of element in memory */ + hsize_t coords_in_mem[H5O_LAYOUT_NDIMS]; /* Coordinates of element in memory */ hsize_t chunk_index; /* Chunk index */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_mem_cb) /* Calculate the index of this chunk */ - if(H5V_chunk_index((unsigned)ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0) + if(H5V_chunk_index(ndims,coords,fm->layout->u.chunk.dim,fm->down_chunks,&chunk_index)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_BADRANGE, FAIL, "can't get chunk index") /* Find correct chunk in file & memory TBBTs */ @@ -3133,7 +3139,7 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize_ /* Add point to memory selection for chunk */ if(fm->msel_type==H5S_SEL_POINTS) { - if(H5S_select_elements(chunk_info->mspace,H5S_SELECT_APPEND,1,(const hssize_t **)coords_in_mem)<0) + if(H5S_select_elements(chunk_info->mspace,H5S_SELECT_APPEND,1,(const hsize_t **)coords_in_mem)<0) HGOTO_ERROR (H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element") } /* end if */ else { @@ -3151,7 +3157,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5S_get_collective_io_consensus + * Function: H5D_get_collective_io_consensus * * Purpose: Compare notes with all other processes involved in this I/O * and see if all are go for collective I/O. @@ -3248,7 +3254,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5D_chunk_mem_cb + * Function: H5D_ioinfo_init * * Purpose: Routine for determining correct I/O operations for * each I/O action. @@ -3264,15 +3270,34 @@ done: */ static herr_t H5D_ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, - const H5S_t *mem_space, const H5S_t *file_space, - unsigned flags, hbool_t *use_par_opt_io, H5D_io_info_t *io_info) + const H5S_t +#if !(defined H5_HAVE_PARALLEL || defined H5S_DEBUG) + UNUSED +#endif /* H5_HAVE_PARALLEL */ + *mem_space, const H5S_t +#if !(defined H5_HAVE_PARALLEL || defined H5S_DEBUG) + UNUSED +#endif /* H5_HAVE_PARALLEL */ + *file_space, unsigned +#ifndef H5_HAVE_PARALLEL + UNUSED +#endif /* H5_HAVE_PARALLEL */ + flags, hbool_t +#ifndef H5_HAVE_PARALLEL + UNUSED +#endif /* H5_HAVE_PARALLEL */ + *use_par_opt_io, H5D_io_info_t *io_info) { #ifdef H5_HAVE_PARALLEL htri_t opt; /* Flag whether a selection is optimizable */ #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ +#if defined H5_HAVE_PARALLEL || defined H5S_DEBUG FUNC_ENTER_NOAPI_NOINIT(H5D_ioinfo_init) +#else /* defined H5_HAVE_PARALLEL || defined H5S_DEBUG */ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_ioinfo_init) +#endif /* defined H5_HAVE_PARALLEL || defined H5S_DEBUG */ /* check args */ HDassert(dset); @@ -3325,7 +3350,6 @@ H5D_ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, } /* end if */ else { /* Indicate that the I/O will _NOT_ be parallel */ - *use_par_opt_io=FALSE; io_info->ops.read = H5D_select_read; io_info->ops.write = H5D_select_write; @@ -3343,6 +3367,8 @@ H5D_ioinfo_init(H5D_t *dset, const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "can't set up selection statistics"); #endif /* H5S_DEBUG */ +#if defined H5_HAVE_PARALLEL || defined H5S_DEBUG done: +#endif /* H5_HAVE_PARALLEL || H5S_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_ioinfo_init() */ diff --git a/src/H5Distore.c b/src/H5Distore.c index 9fc906d..bcf384e 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -92,13 +92,13 @@ * Given a B-tree node return the dimensionality of the chunks pointed to by * that node. */ -#define H5D_ISTORE_NDIMS(X) ((int)(((X)->sizeof_rkey-8)/8)) +#define H5D_ISTORE_NDIMS(X) (((X)->sizeof_rkey-8)/8) /* Raw data chunks are cached. Each entry in the cache is: */ typedef struct H5D_rdcc_ent_t { hbool_t locked; /*entry is locked in cache */ hbool_t dirty; /*needs to be written to disk? */ - hssize_t offset[H5O_LAYOUT_NDIMS]; /*chunk name */ + hsize_t offset[H5O_LAYOUT_NDIMS]; /*chunk name */ size_t rd_count; /*bytes remaining to be read */ size_t wr_count; /*bytes remaining to be written */ size_t chunk_size; /*size of a chunk */ @@ -126,7 +126,7 @@ typedef H5D_rdcc_ent_t *H5D_rdcc_ent_ptr_t; /* For free lists */ */ typedef struct H5D_istore_key_t { size_t nbytes; /*size of stored data */ - hssize_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/ + hsize_t offset[H5O_LAYOUT_NDIMS]; /*logical offset to start*/ unsigned filter_mask; /*excluded filters */ } H5D_istore_key_t; @@ -148,16 +148,16 @@ static herr_t H5D_istore_shared_create (const H5F_t *f, H5O_layout_t *layout); static herr_t H5D_istore_shared_free (void *page); /* B-tree iterator callbacks */ -static int H5D_istore_iter_allocated(H5F_t *f, hid_t dxpl_id, void *left_key, haddr_t addr, - void *right_key, void *_udata); -static int H5D_istore_iter_dump(H5F_t *f, hid_t dxpl_id, void *left_key, haddr_t addr, - void *right_key, void *_udata); -static int H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t addr, - void *_rt_key, void *_udata); +static int H5D_istore_iter_allocated(H5F_t *f, hid_t dxpl_id, const void *left_key, haddr_t addr, + const void *right_key, void *_udata); +static int H5D_istore_iter_dump(H5F_t *f, hid_t dxpl_id, const void *left_key, haddr_t addr, + const void *right_key, void *_udata); +static int H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, + const void *_rt_key, void *_udata); /* B-tree callbacks */ static size_t H5D_istore_sizeof_rkey(const H5F_t *f, const void *_udata); -static H5RC_t *H5D_istore_get_shared(H5F_t *f, const void *_udata); +static H5RC_t *H5D_istore_get_shared(const H5F_t *f, const void *_udata); static herr_t H5D_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t, void *_lt_key, void *_udata, void *_rt_key, haddr_t *addr_p /*out*/); @@ -166,7 +166,7 @@ static int H5D_istore_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, static int H5D_istore_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key); static herr_t H5D_istore_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_lt_key, - void *_udata, const void *_rt_key); + void *_udata); static H5B_ins_t H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, @@ -175,9 +175,9 @@ static H5B_ins_t H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void * static H5B_ins_t H5D_istore_remove( H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, void *_udata, void *_rt_key, hbool_t *rt_key_changed); -static herr_t H5D_istore_decode_key(H5F_t *f, H5B_t *bt, uint8_t *raw, +static herr_t H5D_istore_decode_key(const H5F_t *f, const H5B_t *bt, const uint8_t *raw, void *_key); -static herr_t H5D_istore_encode_key(H5F_t *f, H5B_t *bt, uint8_t *raw, +static herr_t H5D_istore_encode_key(const H5F_t *f, const H5B_t *bt, uint8_t *raw, void *_key); static herr_t H5D_istore_debug_key(FILE *stream, H5F_t *f, hid_t dxpl_id, int indent, int fwidth, const void *key, @@ -240,13 +240,14 @@ H5FL_BLK_DEFINE_STATIC(chunk_page); * *------------------------------------------------------------------------- */ +/* ARGSUSED */ static size_t H5D_istore_sizeof_rkey(const H5F_t UNUSED *f, const void *_udata) { const H5D_istore_ud1_t *udata = (const H5D_istore_ud1_t *) _udata; size_t nbytes; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_sizeof_rkey); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_sizeof_rkey) assert(udata); assert(udata->mesg->u.chunk.ndims > 0 && udata->mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); @@ -255,7 +256,7 @@ H5D_istore_sizeof_rkey(const H5F_t UNUSED *f, const void *_udata) 4 + /*filter mask */ udata->mesg->u.chunk.ndims*8; /*dimension indices */ - FUNC_LEAVE_NOAPI(nbytes); + FUNC_LEAVE_NOAPI(nbytes) } /* end H5D_istore_sizeof_rkey() */ @@ -275,12 +276,13 @@ H5D_istore_sizeof_rkey(const H5F_t UNUSED *f, const void *_udata) * *------------------------------------------------------------------------- */ +/* ARGSUSED */ static H5RC_t * -H5D_istore_get_shared(H5F_t UNUSED *f, const void *_udata) +H5D_istore_get_shared(const H5F_t UNUSED *f, const void *_udata) { const H5D_istore_ud1_t *udata = (const H5D_istore_ud1_t *) _udata; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_get_shared); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_get_shared) assert(udata); assert(udata->mesg); @@ -290,7 +292,7 @@ H5D_istore_get_shared(H5F_t UNUSED *f, const void *_udata) H5RC_INC(udata->mesg->u.chunk.btree_shared); /* Return the pointer to the ref-count object */ - FUNC_LEAVE_NOAPI(udata->mesg->u.chunk.btree_shared); + FUNC_LEAVE_NOAPI(udata->mesg->u.chunk.btree_shared) } /* end H5D_istore_get_shared() */ @@ -309,14 +311,14 @@ H5D_istore_get_shared(H5F_t UNUSED *f, const void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5D_istore_decode_key(H5F_t UNUSED *f, H5B_t *bt, uint8_t *raw, void *_key) +H5D_istore_decode_key(const H5F_t UNUSED *f, const H5B_t *bt, const uint8_t *raw, void *_key) { H5D_istore_key_t *key = (H5D_istore_key_t *) _key; H5B_shared_t *shared; /* Pointer to shared B-tree info */ + size_t ndims; unsigned u; - unsigned ndims; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_decode_key); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_decode_key) /* check args */ assert(f); @@ -334,7 +336,7 @@ H5D_istore_decode_key(H5F_t UNUSED *f, H5B_t *bt, uint8_t *raw, void *_key) for (u=0; u<ndims; u++) UINT64DECODE(raw, key->offset[u]); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_istore_decode_key() */ @@ -353,14 +355,14 @@ H5D_istore_decode_key(H5F_t UNUSED *f, H5B_t *bt, uint8_t *raw, void *_key) *------------------------------------------------------------------------- */ static herr_t -H5D_istore_encode_key(H5F_t UNUSED *f, H5B_t *bt, uint8_t *raw, void *_key) +H5D_istore_encode_key(const H5F_t UNUSED *f, const H5B_t *bt, uint8_t *raw, void *_key) { H5D_istore_key_t *key = (H5D_istore_key_t *) _key; H5B_shared_t *shared; /* Pointer to shared B-tree info */ - unsigned ndims; + size_t ndims; unsigned u; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_encode_key); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_encode_key) /* check args */ assert(f); @@ -378,7 +380,7 @@ H5D_istore_encode_key(H5F_t UNUSED *f, H5B_t *bt, uint8_t *raw, void *_key) for (u=0; u<ndims; u++) UINT64ENCODE(raw, key->offset[u]); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_istore_encode_key() */ @@ -396,6 +398,7 @@ H5D_istore_encode_key(H5F_t UNUSED *f, H5B_t *bt, uint8_t *raw, void *_key) * *------------------------------------------------------------------------- */ +/* ARGSUSED */ static herr_t H5D_istore_debug_key (FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth, const void *_key, const void *_udata) @@ -404,7 +407,7 @@ H5D_istore_debug_key (FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int i const H5D_istore_ud1_t *udata = (const H5D_istore_ud1_t *)_udata; unsigned u; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_debug_key); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_debug_key) assert (key); @@ -418,7 +421,7 @@ H5D_istore_debug_key (FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int i HDfprintf (stream, "%s%Hd", u?", ":"", key->offset[u]); HDfputs ("}\n", stream); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D_istore_debug_key() */ @@ -443,6 +446,7 @@ H5D_istore_debug_key (FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int i * *------------------------------------------------------------------------- */ +/* ARGSUSED */ static int H5D_istore_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, void *_rt_key) @@ -452,7 +456,7 @@ H5D_istore_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda H5D_istore_ud1_t *udata = (H5D_istore_ud1_t *) _udata; int ret_value; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_cmp2); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_cmp2) assert(lt_key); assert(rt_key); @@ -460,9 +464,9 @@ H5D_istore_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda assert(udata->mesg->u.chunk.ndims > 0 && udata->mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); /* Compare the offsets but ignore the other fields */ - ret_value = H5V_vector_cmp_s(udata->mesg->u.chunk.ndims, lt_key->offset, rt_key->offset); + ret_value = H5V_vector_cmp_u(udata->mesg->u.chunk.ndims, lt_key->offset, rt_key->offset); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_cmp2() */ @@ -495,6 +499,7 @@ H5D_istore_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda * *------------------------------------------------------------------------- */ +/* ARGSUSED */ static int H5D_istore_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, void *_rt_key) @@ -504,7 +509,7 @@ H5D_istore_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda H5D_istore_ud1_t *udata = (H5D_istore_ud1_t *) _udata; int ret_value = 0; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_cmp3); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_cmp3) assert(lt_key); assert(rt_key); @@ -527,15 +532,15 @@ H5D_istore_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_uda ret_value=(-1); } /* end if */ else { - if (H5V_vector_ge_s(udata->mesg->u.chunk.ndims, udata->key.offset, + if (H5V_vector_ge_u(udata->mesg->u.chunk.ndims, udata->key.offset, rt_key->offset)) ret_value = 1; - else if (H5V_vector_lt_s(udata->mesg->u.chunk.ndims, udata->key.offset, + else if (H5V_vector_lt_u(udata->mesg->u.chunk.ndims, udata->key.offset, lt_key->offset)) ret_value = -1; } /* end else */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_cmp3() */ @@ -570,7 +575,7 @@ H5D_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, unsigned u; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_istore_new_node); + FUNC_ENTER_NOAPI_NOINIT(H5D_istore_new_node) /* check args */ assert(f); @@ -584,7 +589,7 @@ H5D_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, assert (udata->key.nbytes > 0); H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t); if (HADDR_UNDEF==(*addr_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes))) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "couldn't allocate new file storage"); + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "couldn't allocate new file storage") udata->addr = *addr_p; /* @@ -604,15 +609,14 @@ H5D_istore_new_node(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, rt_key->nbytes = 0; rt_key->filter_mask = 0; for (u=0; u<udata->mesg->u.chunk.ndims; u++) { - assert (udata->key.offset[u]+(hssize_t)(udata->mesg->u.chunk.dim[u]) > + assert (udata->key.offset[u]+udata->mesg->u.chunk.dim[u] > udata->key.offset[u]); - rt_key->offset[u] = udata->key.offset[u] + - (hssize_t)(udata->mesg->u.chunk.dim[u]); + rt_key->offset[u] = udata->key.offset[u] + udata->mesg->u.chunk.dim[u]; } } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_new_node() */ @@ -643,16 +647,17 @@ done: * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ +/* ARGSUSED */ static herr_t H5D_istore_found(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t addr, const void *_lt_key, - void *_udata, const void UNUSED *_rt_key) + void *_udata) { H5D_istore_ud1_t *udata = (H5D_istore_ud1_t *) _udata; const H5D_istore_key_t *lt_key = (const H5D_istore_key_t *) _lt_key; unsigned u; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_found); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_found) /* Check arguments */ assert(f); @@ -661,10 +666,9 @@ H5D_istore_found(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t addr, const void assert(lt_key); /* Is this *really* the requested chunk? */ - for (u=0; u<udata->mesg->u.chunk.ndims; u++) { - if (udata->key.offset[u] >= lt_key->offset[u]+(hssize_t)(udata->mesg->u.chunk.dim[u])) - HGOTO_DONE(FAIL); - } + for (u=0; u<udata->mesg->u.chunk.ndims; u++) + if (udata->key.offset[u] >= lt_key->offset[u]+udata->mesg->u.chunk.dim[u]) + HGOTO_DONE(FAIL) /* Initialize return values */ udata->addr = addr; @@ -675,7 +679,7 @@ H5D_istore_found(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t addr, const void udata->key.offset[u] = lt_key->offset[u]; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_found() */ @@ -711,6 +715,7 @@ done: * is renamed NEW_NODE_P. *------------------------------------------------------------------------- */ +/* ARGSUSED */ static H5B_ins_t H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, @@ -726,7 +731,7 @@ H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, unsigned u; H5B_ins_t ret_value; - FUNC_ENTER_NOAPI_NOINIT(H5D_istore_insert); + FUNC_ENTER_NOAPI_NOINIT(H5D_istore_insert) /* check args */ assert(f); @@ -736,7 +741,6 @@ H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, assert(md_key); assert(udata); assert(rt_key); - assert(rt_key_changed); assert(new_node_p); cmp = H5D_istore_cmp3(f, dxpl_id, lt_key, udata, rt_key); @@ -744,10 +748,9 @@ H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, if (cmp < 0) { /* Negative indices not supported yet */ - assert("HDF5 INTERNAL ERROR -- see rpm" && 0); - HGOTO_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error"); + HGOTO_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error") - } else if (H5V_vector_eq_s (udata->mesg->u.chunk.ndims, + } else if (H5V_vector_eq_u (udata->mesg->u.chunk.ndims, udata->key.offset, lt_key->offset) && lt_key->nbytes>0) { /* @@ -767,14 +770,14 @@ H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, #ifdef OLD_WAY if (HADDR_UNDEF==(*new_node_p=H5MF_realloc(f, H5FD_MEM_DRAW, addr, (hsize_t)lt_key->nbytes, (hsize_t)udata->key.nbytes))) - HGOTO_ERROR (H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk storage"); + HGOTO_ERROR (H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk storage") #else /* OLD_WAY */ H5_CHECK_OVERFLOW( lt_key->nbytes ,size_t, hsize_t); if (H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes)<0) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk"); + HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk") H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t); if (HADDR_UNDEF==(*new_node_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes))) - HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk"); + HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "unable to reallocate chunk") #endif /* OLD_WAY */ lt_key->nbytes = udata->key.nbytes; lt_key->filter_mask = udata->key.filter_mask; @@ -808,17 +811,16 @@ H5D_istore_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, */ H5_CHECK_OVERFLOW( udata->key.nbytes ,size_t, hsize_t); if (HADDR_UNDEF==(*new_node_p=H5MF_alloc(f, H5FD_MEM_DRAW, dxpl_id, (hsize_t)udata->key.nbytes))) - HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "file allocation failed"); + HGOTO_ERROR(H5E_STORAGE, H5E_NOSPACE, H5B_INS_ERROR, "file allocation failed") udata->addr = *new_node_p; ret_value = H5B_INS_RIGHT; } else { - assert("HDF5 INTERNAL ERROR -- see rpm" && 0); - HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error"); + HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error") } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_insert() */ @@ -842,18 +844,19 @@ done: * Changed to callback from H5B_iterate *------------------------------------------------------------------------- */ +/* ARGSUSED */ static int -H5D_istore_iter_allocated (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, haddr_t UNUSED addr, - void UNUSED *_rt_key, void *_udata) +H5D_istore_iter_allocated (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_lt_key, haddr_t UNUSED addr, + const void UNUSED *_rt_key, void *_udata) { H5D_istore_ud1_t *bt_udata = (H5D_istore_ud1_t *)_udata; - H5D_istore_key_t *lt_key = (H5D_istore_key_t *)_lt_key; + const H5D_istore_key_t *lt_key = (const H5D_istore_key_t *)_lt_key; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_iter_allocated); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_iter_allocated) bt_udata->total_storage += lt_key->nbytes; - FUNC_LEAVE_NOAPI(H5B_ITER_CONT); + FUNC_LEAVE_NOAPI(H5B_ITER_CONT) } /* H5D_istore_iter_allocated() */ @@ -878,15 +881,16 @@ H5D_istore_iter_allocated (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, * Changed to callback from H5B_iterate *------------------------------------------------------------------------- */ +/* ARGSUSED */ static int -H5D_istore_iter_dump (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, haddr_t UNUSED addr, - void UNUSED *_rt_key, void *_udata) +H5D_istore_iter_dump (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_lt_key, haddr_t UNUSED addr, + const void UNUSED *_rt_key, void *_udata) { H5D_istore_ud1_t *bt_udata = (H5D_istore_ud1_t *)_udata; - H5D_istore_key_t *lt_key = (H5D_istore_key_t *)_lt_key; + const H5D_istore_key_t *lt_key = (const H5D_istore_key_t *)_lt_key; unsigned u; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_iter_dump); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_iter_dump) if (bt_udata->stream) { if (0==bt_udata->total_storage) { @@ -906,7 +910,7 @@ H5D_istore_iter_dump (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, hadd bt_udata->total_storage++; } - FUNC_LEAVE_NOAPI(H5B_ITER_CONT); + FUNC_LEAVE_NOAPI(H5B_ITER_CONT) } /* H5D_istore_iter_dump() */ @@ -926,26 +930,26 @@ H5D_istore_iter_dump (H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, hadd *------------------------------------------------------------------------- */ herr_t -H5D_istore_init (const H5F_t *f, H5D_t *dset) +H5D_istore_init (const H5F_t *f, const H5D_t *dset) { H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_init, FAIL); + FUNC_ENTER_NOAPI(H5D_istore_init, FAIL) if (H5F_RDCC_NBYTES(f)>0 && H5F_RDCC_NELMTS(f)>0) { rdcc->nbytes=H5F_RDCC_NBYTES(f); rdcc->nslots = H5F_RDCC_NELMTS(f); rdcc->slot = H5FL_SEQ_CALLOC (H5D_rdcc_ent_ptr_t,rdcc->nslots); if (NULL==rdcc->slot) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") } /* end if */ /* Allocate the shared structure */ if(H5D_istore_shared_create(f, &dset->shared->layout)<0) HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_init() */ @@ -967,7 +971,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_istore_flush_entry(H5D_io_info_t *io_info, H5D_rdcc_ent_t *ent, hbool_t reset) +H5D_istore_flush_entry(const H5D_io_info_t *io_info, H5D_rdcc_ent_t *ent, hbool_t reset) { herr_t ret_value=SUCCEED; /*return value */ unsigned u; /*counters */ @@ -975,7 +979,7 @@ H5D_istore_flush_entry(H5D_io_info_t *io_info, H5D_rdcc_ent_t *ent, hbool_t rese size_t alloc; /*bytes allocated for BUF */ hbool_t point_of_no_return = FALSE; - FUNC_ENTER_NOAPI_NOINIT(H5D_istore_flush_entry); + FUNC_ENTER_NOAPI_NOINIT(H5D_istore_flush_entry) assert(io_info); assert(io_info->dset); @@ -1004,7 +1008,7 @@ H5D_istore_flush_entry(H5D_io_info_t *io_info, H5D_rdcc_ent_t *ent, hbool_t rese */ alloc = ent->chunk_size; if (NULL==(buf = H5MM_malloc(alloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline") HDmemcpy(buf, ent->chunk, ent->chunk_size); } else { /* @@ -1027,9 +1031,9 @@ H5D_istore_flush_entry(H5D_io_info_t *io_info, H5D_rdcc_ent_t *ent, hbool_t rese * its size changed. Then write the data into the file. */ if (H5B_insert(io_info->dset->ent.file, io_info->dxpl_id, H5B_ISTORE, io_info->dset->shared->layout.u.chunk.addr, &udata)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk") if (H5F_block_write(io_info->dset->ent.file, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, io_info->dxpl_id, buf)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Mark cache entry as clean */ ent->dirty = FALSE; @@ -1063,7 +1067,7 @@ done: ent->chunk = H5D_istore_chunk_xfree(ent->chunk,&(io_info->dset->shared->dcpl_cache.pline)); } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_flush_entry() */ @@ -1086,12 +1090,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_istore_preempt(H5D_io_info_t *io_info, H5D_rdcc_ent_t * ent, hbool_t flush) +H5D_istore_preempt(const H5D_io_info_t *io_info, H5D_rdcc_ent_t * ent, hbool_t flush) { H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk); herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_istore_preempt); + FUNC_ENTER_NOAPI_NOINIT(H5D_istore_preempt) assert(io_info); assert(ent); @@ -1101,7 +1105,7 @@ H5D_istore_preempt(H5D_io_info_t *io_info, H5D_rdcc_ent_t * ent, hbool_t flush) if(flush) { /* Flush */ if(H5D_istore_flush_entry(io_info, ent, TRUE) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") } else { /* Don't flush, just free chunk */ @@ -1130,7 +1134,7 @@ H5D_istore_preempt(H5D_io_info_t *io_info, H5D_rdcc_ent_t * ent, hbool_t flush) H5FL_FREE(H5D_rdcc_ent_t, ent); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_preempt() */ @@ -1162,7 +1166,7 @@ H5D_istore_flush (H5D_t *dset, hid_t dxpl_id, unsigned flags) H5D_rdcc_ent_t *ent=NULL, *next=NULL; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_flush, FAIL); + FUNC_ENTER_NOAPI(H5D_istore_flush, FAIL) /* Fill the DXPL cache values for later use */ if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) @@ -1187,10 +1191,10 @@ H5D_istore_flush (H5D_t *dset, hid_t dxpl_id, unsigned flags) } /* end for */ if (nerrors) - HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks"); + HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_flush() */ @@ -1222,7 +1226,7 @@ H5D_istore_dest (H5D_t *dset, hid_t dxpl_id) H5D_rdcc_ent_t *ent=NULL, *next=NULL; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_dest, FAIL); + FUNC_ENTER_NOAPI(H5D_istore_dest, FAIL) assert(dset); @@ -1244,17 +1248,18 @@ H5D_istore_dest (H5D_t *dset, hid_t dxpl_id) nerrors++; } if (nerrors) - HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks"); + HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") - H5FL_SEQ_FREE (H5D_rdcc_ent_ptr_t,rdcc->slot); + if(rdcc->slot) + H5FL_SEQ_FREE (H5D_rdcc_ent_ptr_t,rdcc->slot); HDmemset (rdcc, 0, sizeof(H5D_rdcc_t)); /* Free the raw B-tree node buffer */ if(H5RC_DEC(dset->shared->layout.u.chunk.btree_shared)<0) - HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page"); + HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_dest() */ @@ -1306,14 +1311,14 @@ HDmemset(shared->page,0,shared->sizeof_rnode); /* Initialize the offsets into the native key buffer */ for(u=0; u<(2*H5F_KVALUE(f,H5B_ISTORE)+1); u++) - shared->nkey[u]=u*H5B_ISTORE->sizeof_nkey; + shared->nkey[u]=u*H5B_ISTORE[0].sizeof_nkey; /* Make shared B-tree info reference counted */ if(NULL==(layout->u.chunk.btree_shared=H5RC_create(shared,H5D_istore_shared_free))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_shared_create() */ @@ -1370,7 +1375,7 @@ H5D_istore_shared_free (void *_shared) *------------------------------------------------------------------------- */ static herr_t -H5D_istore_prune (H5D_io_info_t *io_info, size_t size) +H5D_istore_prune (const H5D_io_info_t *io_info, size_t size) { int i, j, nerrors=0; const H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk); @@ -1381,7 +1386,7 @@ H5D_istore_prune (H5D_io_info_t *io_info, size_t size) H5D_rdcc_ent_t *n[2]; /*list next pointers */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_istore_prune); + FUNC_ENTER_NOAPI_NOINIT(H5D_istore_prune) /* * Preemption is accomplished by having multiple pointers (currently two) @@ -1462,10 +1467,10 @@ H5D_istore_prune (H5D_io_info_t *io_info, size_t size) } if (nerrors) - HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry"); + HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_prune() */ @@ -1504,7 +1509,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5D_istore_lock(H5D_io_info_t *io_info, +H5D_istore_lock(const H5D_io_info_t *io_info, H5D_istore_ud1_t *udata, hbool_t relax, unsigned *idx_hint/*in,out*/) { H5D_t *dset=io_info->dset; /* Local pointer to the dataset info */ @@ -1521,7 +1526,7 @@ H5D_istore_lock(H5D_io_info_t *io_info, void *chunk=NULL; /*the file chunk */ void *ret_value; /*return value */ - FUNC_ENTER_NOAPI_NOINIT(H5D_istore_lock); + FUNC_ENTER_NOAPI_NOINIT(H5D_istore_lock) assert(io_info); assert(dset); @@ -1556,7 +1561,7 @@ H5D_istore_lock(H5D_io_info_t *io_info, rdcc->nhits++; #endif /* H5D_ISTORE_DEBUG */ - } else if (!found && relax) { + } else if (relax) { /* * Not in the cache, but we're about to overwrite the whole thing * anyway, so just allocate a buffer for it but don't initialize that @@ -1569,7 +1574,7 @@ H5D_istore_lock(H5D_io_info_t *io_info, rdcc->nhits++; #endif if (NULL==(chunk=H5D_istore_chunk_alloc (chunk_size,pline))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk"); + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") } else { H5D_istore_ud1_t tmp_udata; /*B-tree pass-through */ @@ -1598,14 +1603,14 @@ H5D_istore_lock(H5D_io_info_t *io_info, * size in memory, so allocate memory big enough. */ chunk_alloc = udata->key.nbytes; if (NULL==(chunk = H5D_istore_chunk_alloc (chunk_alloc,pline))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk"); + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") if (H5F_block_read(dset->ent.file, H5FD_MEM_DRAW, chunk_addr, udata->key.nbytes, io_info->dxpl_id, chunk)<0) - HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk"); + HGOTO_ERROR (H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk") if (pline->nused) if (H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata->key.filter_mask), io_info->dxpl_cache->err_detect, io_info->dxpl_cache->filter_cb, &(udata->key.nbytes), &chunk_alloc, &chunk)<0) { - HGOTO_ERROR(H5E_PLINE, H5E_READERROR, NULL, "data pipeline read failed"); + HGOTO_ERROR(H5E_PLINE, H5E_READERROR, NULL, "data pipeline read failed") } #ifdef H5D_ISTORE_DEBUG rdcc->nmisses++; @@ -1621,10 +1626,10 @@ H5D_istore_lock(H5D_io_info_t *io_info, /* Chunk size on disk isn't [likely] the same size as the final chunk * size in memory, so allocate memory big enough. */ if (NULL==(chunk = H5D_istore_chunk_alloc (chunk_size,pline))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk"); + HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") if (H5P_is_fill_value_defined(fill, &fill_status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't tell if fill value defined"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't tell if fill value defined") if(fill_time==H5D_FILL_TIME_ALLOC || (fill_time==H5D_FILL_TIME_IFSET && fill_status==H5D_FILL_VALUE_USER_DEFINED)) { @@ -1666,10 +1671,10 @@ else HDfflush(stderr); #endif if (H5D_istore_preempt(io_info, ent, TRUE)<0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache"); + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache") } if (H5D_istore_prune(io_info, chunk_size)<0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache"); + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache") /* Create a new entry */ ent = H5FL_MALLOC(H5D_rdcc_ent_t); @@ -1710,12 +1715,13 @@ else ent = NULL; idx = UINT_MAX; - } else if (found) { + } else { /* * The chunk is not at the beginning of the cache; move it backward * by one slot. This is how we implement the LRU preemption * algorithm. */ + assert(ent); if (ent->next) { if (ent->next->next) ent->next->next->prev = ent; @@ -1748,8 +1754,8 @@ else done: if (!ret_value) if(chunk) - H5D_istore_chunk_xfree (chunk,pline); - FUNC_LEAVE_NOAPI(ret_value); + chunk=H5D_istore_chunk_xfree (chunk,pline); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_lock() */ @@ -1780,29 +1786,20 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D_istore_unlock(H5D_io_info_t *io_info, +H5D_istore_unlock(const H5D_io_info_t *io_info, hbool_t dirty, unsigned idx_hint, uint8_t *chunk, size_t naccessed) { const H5O_layout_t *layout=&(io_info->dset->shared->layout); /* Dataset layout */ const H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk); H5D_rdcc_ent_t *ent = NULL; - int found = -1; unsigned u; + herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_unlock); + FUNC_ENTER_NOAPI_NOINIT(H5D_istore_unlock) assert(io_info); if (UINT_MAX==idx_hint) { - /*not in cache*/ - } else { - assert(idx_hint<rdcc->nslots); - assert(rdcc->slot[idx_hint]); - assert(rdcc->slot[idx_hint]->chunk==chunk); - found = idx_hint; - } - - if (found<0) { /* * It's not in the cache, probably because it's too big. If it's * dirty then flush it to disk. In any case, free the chunk. @@ -1821,16 +1818,22 @@ H5D_istore_unlock(H5D_io_info_t *io_info, x.alloc_size = x.chunk_size; x.chunk = chunk; - H5D_istore_flush_entry (io_info, &x, TRUE); + if (H5D_istore_flush_entry(io_info, &x, TRUE)<0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") } else { if(chunk) - H5D_istore_chunk_xfree (chunk,&(io_info->dset->shared->dcpl_cache.pline)); + chunk=H5D_istore_chunk_xfree (chunk,&(io_info->dset->shared->dcpl_cache.pline)); } } else { + /* Sanity check */ + assert(idx_hint<rdcc->nslots); + assert(rdcc->slot[idx_hint]); + assert(rdcc->slot[idx_hint]->chunk==chunk); + /* * It's in the cache so unlock it. */ - ent = rdcc->slot[found]; + ent = rdcc->slot[idx_hint]; assert (ent->locked); if (dirty) { ent->dirty = TRUE; @@ -1841,7 +1844,8 @@ H5D_istore_unlock(H5D_io_info_t *io_info, ent->locked = FALSE; } - FUNC_LEAVE_NOAPI(SUCCEED); +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_unlock() */ @@ -1861,7 +1865,7 @@ H5D_istore_unlock(H5D_io_info_t *io_info, *------------------------------------------------------------------------- */ ssize_t -H5D_istore_readvv(H5D_io_info_t *io_info, +H5D_istore_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], void *buf) @@ -1872,7 +1876,7 @@ H5D_istore_readvv(H5D_io_info_t *io_info, size_t u; /* Local index variables */ ssize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_readvv, FAIL); + FUNC_ENTER_NOAPI(H5D_istore_readvv, FAIL) /* Check args */ assert(io_info); @@ -1886,11 +1890,6 @@ H5D_istore_readvv(H5D_io_info_t *io_info, assert(mem_offset_arr); assert(buf); -#ifndef NDEBUG - for (u=0; u<dset->shared->layout.u.chunk.ndims; u++) - assert(io_info->store->chunk.offset[u]>=0); /*negative coordinates not supported (yet) */ -#endif - /* Get the address of this chunk on disk */ #ifdef QAK HDfprintf(stderr,"%s: io_info->store->chunk.offset={",FUNC); @@ -1932,7 +1931,7 @@ HDfprintf(stderr,"%s: buf=%p\n",FUNC,buf); /* Do I/O directly on chunk without reading it into the cache */ if ((ret_value=H5D_contig_readvv(&chk_io_info, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, buf))<0) - HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read raw data to file"); + HGOTO_ERROR (H5E_IO, H5E_READERROR, FAIL, "unable to read raw data to file") } /* end if */ else { uint8_t *chunk; /* Pointer to cached chunk in memory */ @@ -1974,7 +1973,7 @@ HDfprintf(stderr,"%s: buf=%p\n",FUNC,buf); if(!found) { /* Check if the fill value is defined */ if (H5P_is_fill_value_defined(fill, &fill_status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined") /* If we are never to return fill values, or if we would return them * but they aren't set, process the entire set of I/O vectors and @@ -2014,7 +2013,7 @@ HDfprintf(stderr,"%s: buf=%p\n",FUNC,buf); *mem_curr_seq=u; *chunk_curr_seq=v; - HGOTO_DONE(bytes_processed); + HGOTO_DONE(bytes_processed) } /* end if */ } /* end if */ } /* end if */ @@ -2024,22 +2023,22 @@ HDfprintf(stderr,"%s: buf=%p\n",FUNC,buf); * chunk. */ if (NULL==(chunk=H5D_istore_lock(io_info, &udata, FALSE, &idx_hint))) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk"); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk") /* Use the vectorized memory copy routine to do actual work */ if((naccessed=H5V_memcpyvv(buf,mem_max_nseq,mem_curr_seq,mem_len_arr,mem_offset_arr,chunk,chunk_max_nseq,chunk_curr_seq,chunk_len_arr,chunk_offset_arr))<0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vectorized memcpy failed"); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vectorized memcpy failed") H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t); if (H5D_istore_unlock(io_info, FALSE, idx_hint, chunk, (size_t)naccessed)<0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk"); + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk") /* Set return value */ ret_value=naccessed; } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5D_istore_readvv() */ @@ -2059,7 +2058,7 @@ done: *------------------------------------------------------------------------- */ ssize_t -H5D_istore_writevv(H5D_io_info_t *io_info, +H5D_istore_writevv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], const void *buf) @@ -2070,7 +2069,7 @@ H5D_istore_writevv(H5D_io_info_t *io_info, size_t u; /* Local index variables */ ssize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_writevv, FAIL); + FUNC_ENTER_NOAPI(H5D_istore_writevv, FAIL) /* Check args */ assert(io_info); @@ -2084,11 +2083,6 @@ H5D_istore_writevv(H5D_io_info_t *io_info, assert(mem_offset_arr); assert(buf); -#ifndef NDEBUG - for (u=0; u<dset->shared->layout.u.chunk.ndims; u++) - assert(io_info->store->chunk.offset[u]>=0); /*negative coordinates not supported (yet) */ -#endif - /* Get the address of this chunk on disk */ #ifdef QAK HDfprintf(stderr,"%s: io_info->store->chunk.offset={",FUNC); @@ -2119,9 +2113,9 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a /* Additional sanity checks when operating in parallel */ if(IS_H5FD_MPI(dset->ent.file)) { if (chunk_addr==HADDR_UNDEF) - HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to locate raw data chunk"); + HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to locate raw data chunk") if (dset->shared->dcpl_cache.pline.nused>0) - HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "cannot write to chunked storage with filters in parallel"); + HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "cannot write to chunked storage with filters in parallel") } /* end if */ #endif /* H5_HAVE_PARALLEL */ @@ -2139,7 +2133,7 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a /* Do I/O directly on chunk without reading it into the cache */ if ((ret_value=H5D_contig_writevv(&chk_io_info, chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_offset_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_offset_arr, buf))<0) - HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); + HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") } /* end if */ else { uint8_t *chunk; /* Pointer to cached chunk in memory */ @@ -2179,22 +2173,22 @@ HDfprintf(stderr,"%s: mem_offset_arr[%Zu]=%Hu\n",FUNC,*mem_curr_seq,mem_offset_a #endif /* OLD_WAY */ if (NULL==(chunk=H5D_istore_lock(io_info, &udata, relax, &idx_hint))) - HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk"); + HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk") /* Use the vectorized memory copy routine to do actual work */ if((naccessed=H5V_memcpyvv(chunk,chunk_max_nseq,chunk_curr_seq,chunk_len_arr,chunk_offset_arr,buf,mem_max_nseq,mem_curr_seq,mem_len_arr,mem_offset_arr))<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") H5_CHECK_OVERFLOW(naccessed,ssize_t,size_t); if (H5D_istore_unlock(io_info, TRUE, idx_hint, chunk, (size_t)naccessed)<0) - HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "uanble to unlock raw data chunk"); + HGOTO_ERROR (H5E_IO, H5E_WRITEERROR, FAIL, "uanble to unlock raw data chunk") /* Set return value */ ret_value=naccessed; } /* end else */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5D_istore_writevv() */ @@ -2227,7 +2221,7 @@ H5D_istore_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */ ) #endif herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_create, FAIL); + FUNC_ENTER_NOAPI(H5D_istore_create, FAIL) /* Check args */ assert(f); @@ -2242,10 +2236,10 @@ H5D_istore_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout /*out */ ) udata.mesg = layout; if (H5B_create(f, dxpl_id, H5B_ISTORE, &udata, &(layout->u.chunk.addr)/*out*/) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "can't create B-tree"); + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "can't create B-tree") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_create() */ @@ -2279,7 +2273,7 @@ H5D_istore_allocated(H5D_t *dset, hid_t dxpl_id) H5D_istore_ud1_t udata; hsize_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_allocated, 0); + FUNC_ENTER_NOAPI(H5D_istore_allocated, 0) assert(dset); @@ -2294,19 +2288,19 @@ H5D_istore_allocated(H5D_t *dset, hid_t dxpl_id) for(ent = rdcc->head; ent; ent = ent->next) { /* Flush the chunk out to disk, to make certain the size is correct later */ if (H5D_istore_flush_entry(&io_info, ent, FALSE)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, 0, "cannot flush indexed storage buffer"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, 0, "cannot flush indexed storage buffer") } /* end for */ HDmemset(&udata, 0, sizeof udata); udata.mesg = &dset->shared->layout; if (H5B_iterate(dset->ent.file, dxpl_id, H5B_ISTORE, H5D_istore_iter_allocated, dset->shared->layout.u.chunk.addr, &udata)<0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree"); + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree") /* Set return value */ ret_value=udata.total_storage; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_allocated() */ @@ -2329,14 +2323,14 @@ done: *------------------------------------------------------------------------- */ haddr_t -H5D_istore_get_addr(H5D_io_info_t *io_info, H5D_istore_ud1_t *_udata) +H5D_istore_get_addr(const H5D_io_info_t *io_info, H5D_istore_ud1_t *_udata) { H5D_istore_ud1_t tmp_udata; /* Information about a chunk */ H5D_istore_ud1_t *udata; /* Pointer to information about a chunk */ unsigned u; haddr_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_get_addr); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_get_addr) assert(io_info); assert(io_info->dset); @@ -2361,7 +2355,7 @@ H5D_istore_get_addr(H5D_io_info_t *io_info, H5D_istore_ud1_t *_udata) #ifdef OLD_WAY H5E_clear_stack(NULL); - HGOTO_ERROR(H5E_BTREE,H5E_NOTFOUND,HADDR_UNDEF,"Can't locate chunk info"); + HGOTO_ERROR(H5E_BTREE,H5E_NOTFOUND,HADDR_UNDEF,"Can't locate chunk info") #else /* OLD_WAY */ HGOTO_DONE(HADDR_UNDEF) #endif /* OLD_WAY */ @@ -2371,7 +2365,7 @@ H5D_istore_get_addr(H5D_io_info_t *io_info, H5D_istore_ud1_t *_udata) ret_value=udata->addr; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5D_istore_get_addr() */ @@ -2396,7 +2390,7 @@ H5D_istore_chunk_alloc(size_t size, const H5O_pline_t *pline) { void *ret_value=NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_chunk_alloc); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_chunk_alloc) assert(size); assert(pline); @@ -2406,7 +2400,7 @@ H5D_istore_chunk_alloc(size_t size, const H5O_pline_t *pline) else ret_value=H5FL_BLK_MALLOC(chunk,size); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5D_istore_chunk_alloc() */ @@ -2429,7 +2423,7 @@ H5D_istore_chunk_alloc(size_t size, const H5O_pline_t *pline) static void * H5D_istore_chunk_xfree(void *chk, const H5O_pline_t *pline) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_chunk_xfree); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_chunk_xfree) assert(pline); @@ -2440,7 +2434,7 @@ H5D_istore_chunk_xfree(void *chk, const H5O_pline_t *pline) H5FL_BLK_FREE(chunk,chk); } /* end if */ - FUNC_LEAVE_NOAPI(NULL); + FUNC_LEAVE_NOAPI(NULL) } /* H5D_istore_chunk_xfree() */ @@ -2492,10 +2486,11 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) { H5D_io_info_t io_info; /* Dataset I/O info */ H5D_storage_t store; /* Dataset storage information */ - hssize_t chunk_offset[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */ + hsize_t chunk_offset[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */ hsize_t chunk_size; /* Size of chunk in bytes */ unsigned filter_mask=0; /* Filter mask for chunks that have them */ H5O_pline_t pline; /* I/O pipeline information */ + hbool_t pline_initialized=FALSE; /* Flag to indicate that pline has valid info */ H5O_fill_t fill; /* Fill value information */ H5D_fill_time_t fill_time; /* When to write fill values */ H5D_fill_value_t fill_status; /* The fill value status */ @@ -2520,7 +2515,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) hsize_t space_dim[H5O_LAYOUT_NDIMS]; /* Dataset's dataspace dimensions */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_allocate, FAIL); + FUNC_ENTER_NOAPI(H5D_istore_allocate, FAIL) /* Check args */ assert(dset && H5D_CHUNKED==dset->shared->layout.type); @@ -2539,11 +2534,12 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) /* Get necessary properties from dataset creation property list */ if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "can't get fill value"); + HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "can't get fill value") if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "can't get data pipeline"); + HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "can't get data pipeline") + pline_initialized=TRUE; if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill time"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill time") /* Fill the DXPL cache values for later use */ if (H5D_get_dxpl_cache(dxpl_id,&dxpl_cache)<0) @@ -2554,11 +2550,11 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) if(IS_H5FD_MPI(dset->ent.file)) { /* Get the MPI communicator */ if (MPI_COMM_NULL == (mpi_comm=H5F_mpi_get_comm(dset->ent.file))) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator"); + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator") /* Get the MPI rank */ if ((mpi_rank=H5F_mpi_get_rank(dset->ent.file))<0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank") /* Set the MPI-capable file driver flag */ using_mpi=1; @@ -2575,7 +2571,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) /* Check the dataset's fill-value status */ if (H5P_is_fill_value_defined(&fill, &fill_status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined") /* If we are filling the dataset on allocation or "if set" and * the fill value _is_ set, _and_ we are not overwriting the new blocks, @@ -2592,7 +2588,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) /* Allocate chunk buffer for processes to use when writing fill values */ H5_CHECK_OVERFLOW(chunk_size,hsize_t,size_t); if (NULL==(chunk = H5D_istore_chunk_alloc((size_t)chunk_size,&pline))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for chunk"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for chunk") /* Fill the chunk with the proper values */ if(fill.buf) { @@ -2615,7 +2611,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) /* Push the chunk through the filters */ if (H5Z_pipeline(&pline, 0, &filter_mask, dxpl_cache->err_detect, dxpl_cache->filter_cb, &nbytes, &buf_size, &chunk)<0) - HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed"); + HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed") /* Keep the number of bytes the chunk turned in to */ chunk_size=nbytes; @@ -2661,7 +2657,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) /* Allocate the chunk with all processes */ if (H5B_insert(dset->ent.file, dxpl_id, H5B_ISTORE, dset->shared->layout.u.chunk.addr, &udata)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk") /* Check if fill values should be written to blocks */ if(should_fill) { @@ -2672,7 +2668,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) /* !! Use the internal "independent" DXPL!! -QAK */ if(H5_PAR_META_WRITE==mpi_rank) { if (H5F_block_write(dset->ent.file, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, H5AC_ind_dxpl_id, chunk)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") } /* end if */ /* Indicate that blocks are being written */ @@ -2681,7 +2677,7 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) else { #endif /* H5_HAVE_PARALLEL */ if (H5F_block_write(dset->ent.file, H5FD_MEM_DRAW, udata.addr, udata.key.nbytes, dxpl_id, chunk)<0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") #ifdef H5_HAVE_PARALLEL } /* end else */ #endif /* H5_HAVE_PARALLEL */ @@ -2689,9 +2685,9 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) } /* end if */ /* Increment indices */ - for (i=dset->shared->layout.u.chunk.ndims-1, carry=1; i>=0 && carry; --i) { + for (i=(int)dset->shared->layout.u.chunk.ndims-1, carry=1; i>=0 && carry; --i) { chunk_offset[i] += dset->shared->layout.u.chunk.dim[i]; - if (chunk_offset[i] >= (hssize_t)(space_dim[i])) + if (chunk_offset[i] >= space_dim[i]) chunk_offset[i] = 0; else carry = 0; @@ -2713,10 +2709,10 @@ H5D_istore_allocate(H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite) done: /* Free the chunk for fill values */ - if(chunk!=NULL) - H5D_istore_chunk_xfree(chunk,&pline); + if(chunk!=NULL && pline_initialized) + chunk=H5D_istore_chunk_xfree(chunk,&pline); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_allocate() */ @@ -2821,7 +2817,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D_istore_prune_by_extent(H5D_io_info_t *io_info) +H5D_istore_prune_by_extent(const H5D_io_info_t *io_info) { H5D_t *dset=io_info->dset; /* Local pointer to the dataset info */ const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */ @@ -2832,7 +2828,7 @@ H5D_istore_prune_by_extent(H5D_io_info_t *io_info) hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /*current dataspace dimensions */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_prune_by_extent, FAIL); + FUNC_ENTER_NOAPI(H5D_istore_prune_by_extent, FAIL) /* Check args */ assert(io_info); @@ -2842,7 +2838,7 @@ H5D_istore_prune_by_extent(H5D_io_info_t *io_info) /* Go get the rank & dimensions */ if(H5S_get_simple_extent_dims(dset->shared->space, curr_dims, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions"); + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") /*------------------------------------------------------------------------- * Figure out what chunks are no longer in use for the specified extent @@ -2870,7 +2866,7 @@ H5D_istore_prune_by_extent(H5D_io_info_t *io_info) /* Preempt the entry from the cache, but do not flush it to disk */ if(H5D_istore_preempt(io_info, ent, FALSE) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to preempt chunk"); + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to preempt chunk") found=0; } @@ -2887,10 +2883,10 @@ H5D_istore_prune_by_extent(H5D_io_info_t *io_info) udata.dims = curr_dims; if(H5B_iterate(dset->ent.file, io_info->dxpl_id, H5B_ISTORE, H5D_istore_prune_extent, dset->shared->layout.u.chunk.addr, &udata) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over B-tree"); + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over B-tree") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_prune_by_extent() */ @@ -2911,12 +2907,13 @@ done: * *------------------------------------------------------------------------- */ +/* ARGSUSED */ static int -H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t UNUSED addr, - void UNUSED *_rt_key, void *_udata) +H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t UNUSED addr, + const void UNUSED *_rt_key, void *_udata) { H5D_istore_ud1_t *bt_udata = (H5D_istore_ud1_t *)_udata; - H5D_istore_key_t *lt_key = (H5D_istore_key_t *)_lt_key; + const H5D_istore_key_t *lt_key = (const H5D_istore_key_t *)_lt_key; unsigned u; H5D_istore_ud1_t udata; int ret_value=H5B_ITER_CONT; /* Return value */ @@ -2925,7 +2922,7 @@ H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t UNUSED a * storage that contains the beginning of the logical address space represented by UDATA. */ - FUNC_ENTER_NOAPI_NOINIT(H5D_istore_prune_extent); + FUNC_ENTER_NOAPI_NOINIT(H5D_istore_prune_extent) /* Figure out what chunks are no longer in use for the specified extent and release them */ for(u = 0; u < bt_udata->mesg->u.chunk.ndims - 1; u++) @@ -2943,12 +2940,12 @@ H5D_istore_prune_extent(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t UNUSED a /* Remove */ if(H5B_remove(f, dxpl_id, H5B_ISTORE, bt_udata->mesg->u.chunk.addr, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_ITER_ERROR, "unable to remove entry"); + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_ITER_ERROR, "unable to remove entry") break; } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_prune_extent() */ @@ -2970,6 +2967,7 @@ done: * *------------------------------------------------------------------------- */ +/* ARGSUSED */ static H5B_ins_t H5D_istore_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key /*in,out */ , hbool_t *lt_key_changed /*out */ , @@ -2978,17 +2976,20 @@ H5D_istore_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key /*in,out hbool_t *rt_key_changed /*out */ ) { H5D_istore_key_t *lt_key = (H5D_istore_key_t *)_lt_key; + H5B_ins_t ret_value=H5B_INS_REMOVE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5D_istore_remove); + FUNC_ENTER_NOAPI_NOINIT(H5D_istore_remove) /* Remove raw data chunk from file */ - H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes); + if(H5MF_xfree(f, H5FD_MEM_DRAW, dxpl_id, addr, (hsize_t)lt_key->nbytes)<0) + HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk") /* Mark keys as unchanged */ *lt_key_changed = FALSE; *rt_key_changed = FALSE; - FUNC_LEAVE_NOAPI(H5B_INS_REMOVE); +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_remove() */ @@ -3022,13 +3023,13 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info) const H5O_layout_t *layout=&(io_info->dset->shared->layout); /* Dataset layout */ uint8_t *chunk = NULL; /*the file chunk */ unsigned idx_hint = 0; /*input value for H5F_istore_lock */ - hssize_t chunk_offset[H5O_LAYOUT_NDIMS]; /*logical location of the chunks */ + hsize_t chunk_offset[H5O_LAYOUT_NDIMS]; /*logical location of the chunks */ hsize_t idx_cur[H5O_LAYOUT_NDIMS]; /*multi-dimensional counters */ hsize_t idx_max[H5O_LAYOUT_NDIMS]; hsize_t sub_size[H5O_LAYOUT_NDIMS]; hsize_t naccessed; /*bytes accessed in chunk */ hsize_t end_chunk; /*chunk position counter */ - hssize_t start[H5O_LAYOUT_NDIMS]; /*starting location of hyperslab */ + hsize_t start[H5O_LAYOUT_NDIMS]; /*starting location of hyperslab */ hsize_t count[H5O_LAYOUT_NDIMS]; /*element count of hyperslab */ hsize_t size[H5O_LAYOUT_NDIMS]; /*current size of dimensions */ H5S_t *space_chunk = NULL; /*dataspace for a chunk */ @@ -3048,7 +3049,7 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info) H5D_storage_t store; /* Dataset storage information */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_initialize_by_extent, FAIL); + FUNC_ENTER_NOAPI(H5D_istore_initialize_by_extent, FAIL) /* Check args */ assert(io_info); @@ -3062,11 +3063,11 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info) /* Get necessary properties from property list */ if(H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value"); + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value") if(H5P_get(dc_plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill time"); + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill time") if(H5P_get(dc_plist, H5D_CRT_DATA_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data pipeline"); + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data pipeline") /* Reset start & count arrays */ HDmemset(start, 0, sizeof(start)); @@ -3094,7 +3095,7 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info) for(u = 0; u < rank; u++) chunk_dims[u] = layout->u.chunk.dim[u]; if(NULL == (space_chunk = H5S_create_simple(rank,chunk_dims,NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace"); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") /* * Set up multi-dimensional counters (idx_max, and idx_cur) and @@ -3115,7 +3116,7 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info) while(carry==0) { for(u = 0, naccessed = 1; u < layout->u.chunk.ndims; u++) { /* The location and size of the chunk being accessed */ - chunk_offset[u] = idx_cur[u] * (hssize_t)(layout->u.chunk.dim[u]); + chunk_offset[u] = idx_cur[u] * layout->u.chunk.dim[u]; sub_size[u] = MIN((idx_cur[u] + 1) * layout->u.chunk.dim[u], size[u]) - chunk_offset[u]; naccessed *= sub_size[u]; @@ -3125,7 +3126,7 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info) * Figure out what chunks have to be initialized. These are the chunks where the dataspace * extent boundary is within the chunk */ - for(u = 0, found = 0; u < layout->u.chunk.ndims - 1; u++) { + for(u = 0, found = 0; u < rank; u++) { end_chunk = chunk_offset[u] + layout->u.chunk.dim[u]; if(end_chunk > size[u]) { found = 1; @@ -3141,28 +3142,28 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info) store.chunk.offset=chunk_offset; if(NULL == (chunk = H5D_istore_lock(io_info, NULL, FALSE, &idx_hint))) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to read raw data chunk") if(H5S_select_all(space_chunk,1) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to select space"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to select space") for(u = 0; u < rank; u++) count[u] = MIN((idx_cur[u] + 1) * layout->u.chunk.dim[u], size[u] - chunk_offset[u]); #ifdef H5D_ISTORE_DEBUG HDfputs("cache:initialize:offset:[", stdout); - for(u = 0; u < layout->u.chunk.ndims - 1; u++) + for(u = 0; u < rank; u++) HDfprintf(stdout, "%s%Hd", u ? ", " : "", chunk_offset[u]); HDfputs("]", stdout); HDfputs(":count:[", stdout); - for(u = 0; u < layout->u.chunk.ndims - 1; u++) + for(u = 0; u < rank; u++) HDfprintf(stdout, "%s%Hd", u ? ", " : "", count[u]); HDfputs("]\n", stdout); #endif if(H5S_select_hyperslab(space_chunk, H5S_SELECT_NOTB, start, NULL, count, NULL) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to select hyperslab"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to select hyperslab") /* Fill the selection in the memory buffer */ /* Use the size of the elements in the chunk directly instead of */ @@ -3170,14 +3171,14 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info) /* no fill-value defined for the dataset -QAK */ H5_CHECK_OVERFLOW(size[rank],hsize_t,size_t); if(H5S_select_fill(fill.buf, (size_t)size[rank], space_chunk, chunk) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed"); + HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed") if(H5D_istore_unlock(io_info, TRUE, idx_hint, chunk, (size_t)naccessed) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to unlock raw data chunk"); + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to unlock raw data chunk") } /*found */ /* Increment indices */ - for(i = layout->u.chunk.ndims - 1, carry = 1; i >= 0 && carry; --i) { + for(i = (int)rank, carry = 1; i >= 0 && carry; --i) { if(++idx_cur[i] >= idx_max[i]) idx_cur[i] = 0; else @@ -3187,9 +3188,10 @@ H5D_istore_initialize_by_extent(H5D_io_info_t *io_info) done: if(space_chunk) - H5S_close(space_chunk); + if(H5S_close(space_chunk)<0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_initialize_by_extent() */ @@ -3213,7 +3215,7 @@ H5D_istore_delete(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout) { herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_delete, FAIL); + FUNC_ENTER_NOAPI(H5D_istore_delete, FAIL) /* Check if the B-tree has been created in the file */ if(H5F_addr_defined(layout->u.chunk.addr)) { @@ -3230,15 +3232,15 @@ H5D_istore_delete(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout) /* Delete entire B-tree */ if(H5B_delete(f, dxpl_id, H5B_ISTORE, tmp_layout.u.chunk.addr, &udata)<0) - HGOTO_ERROR(H5E_IO, H5E_CANTDELETE, 0, "unable to delete chunk B-tree"); + HGOTO_ERROR(H5E_IO, H5E_CANTDELETE, 0, "unable to delete chunk B-tree") /* Free the raw B-tree node buffer */ if(H5RC_DEC(tmp_layout.u.chunk.btree_shared)<0) - HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page"); + HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_delete() */ @@ -3267,7 +3269,6 @@ H5D_istore_update_cache(H5D_t *dset, hid_t dxpl_id) H5D_rdcc_ent_t *old_ent; /* Old cache entry */ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ H5D_dxpl_cache_t *dxpl_cache=&_dxpl_cache; /* Data transfer property cache */ - int srank; /*current # of dimensions (signed) */ unsigned rank; /*current # of dimensions */ hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /*current dataspace dimensions */ hsize_t chunks[H5O_LAYOUT_NDIMS]; /*current number of chunks in each dimension */ @@ -3277,16 +3278,16 @@ H5D_istore_update_cache(H5D_t *dset, hid_t dxpl_id) unsigned u; /*counters */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_update_cache, FAIL); + FUNC_ENTER_NOAPI(H5D_istore_update_cache, FAIL) /* Check args */ assert(dset && H5D_CHUNKED == dset->shared->layout.type); assert(dset->shared->layout.u.chunk.ndims > 0 && dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS); /* Go get the rank & dimensions */ - if((srank = H5S_get_simple_extent_dims(dset->shared->space, curr_dims, NULL)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions"); - H5_ASSIGN_OVERFLOW(rank,srank,int,unsigned); + rank = dset->shared->layout.u.chunk.ndims-1; + if(H5S_get_simple_extent_dims(dset->shared->space, curr_dims, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") /* Round up to the next integer # of chunks, to accomodate partial chunks */ for(u = 0; u < rank; u++) @@ -3327,7 +3328,7 @@ H5D_istore_update_cache(H5D_t *dset, hid_t dxpl_id) /* Remove the old entry from the cache */ if (H5D_istore_preempt(&io_info, old_ent, TRUE )<0) - HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks"); + HGOTO_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") } /* end if */ /* Insert this chunk into correct location in hash table */ @@ -3339,7 +3340,7 @@ H5D_istore_update_cache(H5D_t *dset, hid_t dxpl_id) } /* end for */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_istore_update_cache() */ @@ -3368,7 +3369,7 @@ H5D_istore_dump_btree(H5F_t *f, hid_t dxpl_id, FILE *stream, unsigned ndims, had H5D_istore_ud1_t udata; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_dump_btree, FAIL); + FUNC_ENTER_NOAPI(H5D_istore_dump_btree, FAIL) HDmemset(&udata, 0, sizeof udata); layout.u.chunk.ndims = ndims; @@ -3377,10 +3378,10 @@ H5D_istore_dump_btree(H5F_t *f, hid_t dxpl_id, FILE *stream, unsigned ndims, had if(stream) HDfprintf(stream, " Address: %a\n",addr); if(H5B_iterate(f, dxpl_id, H5B_ISTORE, H5D_istore_iter_dump, addr, &udata)<0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree"); + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, 0, "unable to iterate over chunk B-tree") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_dump_btree() */ #ifdef H5D_ISTORE_DEBUG @@ -3409,10 +3410,10 @@ H5D_istore_stats (H5D_t *dset, hbool_t headers) char ascii[32]; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_stats, FAIL); + FUNC_ENTER_NOAPI(H5D_istore_stats, FAIL) if (!H5DEBUG(AC)) - HGOTO_DONE(SUCCEED); + HGOTO_DONE(SUCCEED) if (headers) { fprintf(H5DEBUG(AC), "H5D: raw data cache statistics\n"); @@ -3445,7 +3446,7 @@ H5D_istore_stats (H5D_t *dset, hbool_t headers) } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_stats() */ #endif /* H5D_ISTORE_DEBUG */ @@ -3467,13 +3468,13 @@ done: */ herr_t H5D_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, - int fwidth, int ndims) + int fwidth, unsigned ndims) { H5O_layout_t layout; H5D_istore_ud1_t udata; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5D_istore_debug,FAIL); + FUNC_ENTER_NOAPI(H5D_istore_debug,FAIL) layout.u.chunk.ndims = ndims; HDmemset (&udata, 0, sizeof udata); @@ -3483,12 +3484,12 @@ H5D_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int inden if(H5D_istore_shared_create(f, &layout)<0) HGOTO_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") - H5B_debug (f, dxpl_id, addr, stream, indent, fwidth, H5B_ISTORE, &udata); + (void)H5B_debug (f, dxpl_id, addr, stream, indent, fwidth, H5B_ISTORE, &udata); /* Free the raw B-tree node buffer */ if(H5RC_DEC(layout.u.chunk.btree_shared)<0) - HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page"); + HGOTO_ERROR (H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_istore_debug() */ diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 1b4d21b..9d1f65c 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -110,7 +110,7 @@ H5D_mpio_opt_possible( const H5D_t *dset, const H5S_t *mem_space, const H5S_t *f if ((flags&H5S_CONV_STORAGE_MASK)==H5S_CONV_STORAGE_CHUNKED) { hsize_t chunk_dim[H5O_LAYOUT_NDIMS]; /* Chunk dimensions */ - hssize_t startf[H5S_MAX_RANK], /* Selection start bounds */ + hsize_t startf[H5S_MAX_RANK], /* Selection start bounds */ endf[H5S_MAX_RANK]; /* Selection end bounds */ unsigned dim_rankf; /* Number of dimensions of file dataspace */ int pcheck_hyper,check_hyper, /* Flags for checking if selection is in one chunk */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 68c8742..a4b4574 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -78,11 +78,11 @@ typedef herr_t (*H5D_io_write_func_t)(struct H5D_io_info_t *io_info, const void *buf); /* Function pointers for I/O on particular types of dataset layouts */ -typedef ssize_t (*H5D_io_readvv_func_t)(struct H5D_io_info_t *io_info, +typedef ssize_t (*H5D_io_readvv_func_t)(const struct H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], void *buf); -typedef ssize_t (*H5D_io_writevv_func_t)(struct H5D_io_info_t *io_info, +typedef ssize_t (*H5D_io_writevv_func_t)(const struct H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], const void *buf); @@ -217,21 +217,21 @@ H5_DLL herr_t H5D_select_write(H5D_io_info_t *io_info, H5_DLL herr_t H5D_contig_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout); H5_DLL herr_t H5D_contig_fill(H5D_t *dset, hid_t dxpl_id); H5_DLL haddr_t H5D_contig_get_addr(const H5D_t *dset); -H5_DLL ssize_t H5D_contig_readvv(H5D_io_info_t *io_info, +H5_DLL ssize_t H5D_contig_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], void *buf); -H5_DLL ssize_t H5D_contig_writevv(H5D_io_info_t *io_info, +H5_DLL ssize_t H5D_contig_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], const void *buf); /* Functions that operate on compact dataset storage */ -H5_DLL ssize_t H5D_compact_readvv(H5D_io_info_t *io_info, +H5_DLL ssize_t H5D_compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[], void *buf); -H5_DLL ssize_t H5D_compact_writevv(H5D_io_info_t *io_info, +H5_DLL ssize_t H5D_compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[], const void *buf); @@ -239,14 +239,14 @@ H5_DLL ssize_t H5D_compact_writevv(H5D_io_info_t *io_info, /* Functions that operate on indexed storage */ /* forward reference for collective-chunk IO use */ struct H5D_istore_ud1_t; /*define in H5Distore.c*/ -H5_DLL herr_t H5D_istore_init (const H5F_t *f, H5D_t *dset); +H5_DLL herr_t H5D_istore_init (const H5F_t *f, const H5D_t *dset); H5_DLL herr_t H5D_istore_flush (H5D_t *dset, hid_t dxpl_id, unsigned flags); H5_DLL herr_t H5D_istore_create(H5F_t *f, hid_t dxpl_id, H5O_layout_t *layout); H5_DLL herr_t H5D_istore_dest (H5D_t *dset, hid_t dxpl_id); H5_DLL herr_t H5D_istore_allocate (H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite); H5_DLL hsize_t H5D_istore_allocated(H5D_t *dset, hid_t dxpl_id); -H5_DLL herr_t H5D_istore_prune_by_extent(H5D_io_info_t *io_info); +H5_DLL herr_t H5D_istore_prune_by_extent(const H5D_io_info_t *io_info); H5_DLL herr_t H5D_istore_initialize_by_extent(H5D_io_info_t *io_info); H5_DLL herr_t H5D_istore_update_cache(H5D_t *dset, hid_t dxpl_id); H5_DLL herr_t H5D_istore_dump_btree(H5F_t *f, hid_t dxpl_id, FILE *stream, unsigned ndims, @@ -254,23 +254,23 @@ H5_DLL herr_t H5D_istore_dump_btree(H5F_t *f, hid_t dxpl_id, FILE *stream, unsig #ifdef H5D_ISTORE_DEBUG H5_DLL herr_t H5D_istore_stats (H5D_t *dset, hbool_t headers); #endif /* H5D_ISTORE_DEBUG */ -H5_DLL ssize_t H5D_istore_readvv(H5D_io_info_t *io_info, +H5_DLL ssize_t H5D_istore_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], void *buf); -H5_DLL ssize_t H5D_istore_writevv(H5D_io_info_t *io_info, +H5_DLL ssize_t H5D_istore_writevv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], const void *buf); -H5_DLL haddr_t H5D_istore_get_addr(H5D_io_info_t *io_info, +H5_DLL haddr_t H5D_istore_get_addr(const H5D_io_info_t *io_info, struct H5D_istore_ud1_t *_udata); /* Functions that operate on external file list (efl) storage */ -H5_DLL ssize_t H5D_efl_readvv(H5D_io_info_t *io_info, +H5_DLL ssize_t H5D_efl_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], void *buf); -H5_DLL ssize_t H5D_efl_writevv(H5D_io_info_t *io_info, +H5_DLL ssize_t H5D_efl_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[], const void *buf); @@ -302,7 +302,7 @@ H5_DLL herr_t H5D_mpio_spaces_span_write(H5D_io_info_t *io_info, /* MPI-IO function to check if a direct I/O transfer is possible between * memory and the file */ -H5_DLL htri_t H5D_mpio_opt_possible(const H5D_t *file, const H5S_t *mem_space, +H5_DLL htri_t H5D_mpio_opt_possible(const H5D_t *dset, const H5S_t *mem_space, const H5S_t *file_space, const unsigned flags); #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 4479c37..d6d2333 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -172,7 +172,7 @@ typedef struct H5D_t H5D_t; /* Typedef for dataset storage information */ typedef struct { hsize_t index; /* "Index" of chunk in dataset (must be first for TBBT routines) */ - hssize_t *offset; /* Chunk's coordinates in elements */ + hsize_t *offset; /* Chunk's coordinates in elements */ } H5D_chunk_storage_t; typedef struct { @@ -211,7 +211,7 @@ typedef struct H5D_dcpl_cache_t { /* Library-private functions defined in H5D package */ H5_DLL herr_t H5D_init(void); -H5_DLL H5D_t *H5D_open(H5G_entry_t *ent, hid_t dxpl_id); +H5_DLL H5D_t *H5D_open(const H5G_entry_t *ent, hid_t dxpl_id); H5_DLL herr_t H5D_close(H5D_t *dataset); H5_DLL htri_t H5D_isa(H5G_entry_t *ent, hid_t dxpl_id); H5_DLL H5G_entry_t *H5D_entof(H5D_t *dataset); @@ -223,7 +223,7 @@ H5_DLL herr_t H5D_xfer_create(hid_t dxpl_id, void *create_data); H5_DLL herr_t H5D_xfer_copy(hid_t new_plist_id, hid_t old_plist_id, void *copy_data); H5_DLL herr_t H5D_xfer_close(hid_t dxpl_id, void *close_data); -H5_DLL herr_t H5D_flush(H5F_t *f, hid_t dxpl_id, unsigned flags); +H5_DLL herr_t H5D_flush(const H5F_t *f, hid_t dxpl_id, unsigned flags); H5_DLL herr_t H5D_get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t **cache); H5_DLL herr_t H5D_get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache); @@ -235,6 +235,6 @@ H5_DLL herr_t H5D_contig_delete(H5F_t *f, hid_t dxpl_id, H5_DLL herr_t H5D_istore_delete(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout); H5_DLL herr_t H5D_istore_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, - int indent, int fwidth, int ndims); + int indent, int fwidth, unsigned ndims); #endif diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index ec576fe..09556c2 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -70,8 +70,8 @@ extern "C" { #endif /* Define the operator function pointer for H5Diterate() */ -typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, hsize_t ndim, - hssize_t *point, void *operator_data); +typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim, + const hsize_t *point, void *operator_data); H5_DLL hid_t H5Dcreate (hid_t file_id, const char *name, hid_t type_id, hid_t space_id, hid_t plist_id); @@ -169,15 +169,15 @@ H5E_init_interface(void) /* Initialize the atom group for the error class IDs */ if(H5I_register_type(H5I_ERROR_CLASS, H5I_ERRCLS_HASHSIZE, H5E_RESERVED_ATOMS, - (H5I_free_t)H5E_unregister_class)<0) + (H5I_free_t)H5E_unregister_class)<H5I_FILE) HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group") /* Initialize the atom group for the major error IDs */ if(H5I_register_type(H5I_ERROR_MSG, H5I_ERRMSG_HASHSIZE, H5E_RESERVED_ATOMS, - (H5I_free_t)H5E_close_msg)<0) + (H5I_free_t)H5E_close_msg)<H5I_FILE) HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group") /* Initialize the atom group for the error stacks */ if(H5I_register_type(H5I_ERROR_STACK, H5I_ERRSTK_HASHSIZE, H5E_RESERVED_ATOMS, - (H5I_free_t)H5E_close_stack)<0) + (H5I_free_t)H5E_close_stack)<H5I_FILE) HGOTO_ERROR(H5E_ATOM, H5E_CANTINIT, FAIL, "unable to initialize ID group") #ifndef H5_HAVE_THREADSAFE @@ -809,7 +809,7 @@ H5Eget_major(H5E_major_t maj) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a major one"); /* Don't know who is going to free it */ - msg_str = (char*)H5MM_malloc((++size)*sizeof(char)); + msg_str = (char*)H5MM_malloc((size_t)(++size)*sizeof(char)); if(H5E_get_msg(msg, NULL, msg_str, (size_t)size)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") @@ -859,7 +859,7 @@ H5Eget_minor(H5E_minor_t min) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a minor one"); /* Don't know who is going to free it */ - msg_str = (char*)H5MM_malloc((++size)*sizeof(char)); + msg_str = (char*)H5MM_malloc((size_t)(++size)*sizeof(char)); if(H5E_get_msg(msg, NULL, msg_str, (size_t)size)<0) HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") diff --git a/src/H5Epublic.h b/src/H5Epublic.h index d5581dd..461bc08 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -51,13 +51,13 @@ typedef struct H5E_error_t { const char *desc; /*optional supplied description */ } H5E_error_t; -/* When this header is included from H5Eprivate.h, don't make calls to H5open() */ +/* When this header is included from a private header, don't make calls to H5open() */ #undef H5OPEN -#ifndef _H5Eprivate_H +#ifndef _H5private_H #define H5OPEN H5open(), -#else /* _H5Eprivate_H */ +#else /* _H5private_H */ #define H5OPEN -#endif /* _H5Eprivate_H */ +#endif /* _H5private_H */ /* HDF5 error class */ #define H5E_ERR_CLS (H5OPEN H5E_ERR_CLS_g) @@ -69,7 +69,7 @@ static herr_t H5F_flush_all(hbool_t invalidate); static int H5F_flush_all_cb(void *f, hid_t fid, void *_invalidate); #endif /* NOT_YET */ -static hsize_t H5F_init_superblock(H5F_t *f, hid_t dxpl_id); +static hsize_t H5F_init_superblock(const H5F_t *f, hid_t dxpl_id); static herr_t H5F_write_superblock(H5F_t *f, hid_t dxpl_id, uint8_t *buf); static herr_t H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr, uint8_t *buf, size_t buf_size); @@ -87,9 +87,6 @@ H5FL_DEFINE_STATIC(H5F_t); /* Declare a free list to manage the H5F_file_t struct */ H5FL_DEFINE_STATIC(H5F_file_t); -/* Declare the external free list for the H5G_t struct */ -H5FL_EXTERN(H5G_t); - /*------------------------------------------------------------------------- * Function: H5F_init @@ -229,8 +226,8 @@ H5F_init_interface(void) * which are pending completion because there are object headers still * open within the file. */ - if (H5I_register_type(H5I_FILE, H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<0 || - H5I_register_type(H5I_FILE_CLOSING, H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<0) + if (H5I_register_type(H5I_FILE, H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<H5I_FILE || + H5I_register_type(H5I_FILE_CLOSING, H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<H5I_FILE) HGOTO_ERROR (H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface") /* ========== File Creation Property Class Initialization ============*/ @@ -429,7 +426,7 @@ H5F_term_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_term_interface) if (H5_interface_initialize_g) { - if ((n=H5I_nmembers(H5I_FILE))) { + if ((n=H5I_nmembers(H5I_FILE))!=0) { H5I_clear_type(H5I_FILE, FALSE); } else if (0==(n=H5I_nmembers(H5I_FILE_CLOSING))) { H5I_dec_type_ref(H5I_FILE); @@ -1564,7 +1561,10 @@ H5F_dest(H5F_t *f, hid_t dxpl_id) } /* end if */ /* Free the memory for the root group */ - H5G_free(f->shared->root_grp); + if(H5G_free(f->shared->root_grp)<0) { + HERROR(H5E_FILE, H5E_CANTRELEASE, "problems closing file"); + ret_value = FAIL; /*but keep going*/ + } /* end if */ f->shared->root_grp=NULL; } if (H5AC_dest(f, dxpl_id)) { @@ -1712,7 +1712,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d hbool_t driver_has_cmp; /*`cmp' callback defined? */ H5P_genplist_t *a_plist; /*file access property list */ H5F_close_degree_t fc_degree; /*file close degree */ - H5F_t *ret_value = NULL; /*actual return value */ + H5F_t *ret_value; /*actual return value */ FUNC_ENTER_NOAPI(H5F_open, NULL) @@ -1755,8 +1755,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d } /* end if */ /* Is the file already open? */ - if ((file=H5I_search(H5I_FILE, H5F_equal, lf)) || - (file=H5I_search(H5I_FILE_CLOSING, H5F_equal, lf))) { + if ((file=H5I_search(H5I_FILE, H5F_equal, lf))!=NULL || + (file=H5I_search(H5I_FILE_CLOSING, H5F_equal, lf))!=NULL) { /* * The file is already open, so use that one instead of the one we * just opened. We only one one H5FD_t* per file so one doesn't @@ -1835,7 +1835,9 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d * empty or not. */ if (0==H5FD_get_eof(lf) && (flags & H5F_ACC_RDWR)) { +#ifdef H5_HAVE_FPHDF5 hsize_t buf_size=0; /* Size of buffer needed to hold superblock info */ +#endif /* H5_HAVE_FPHDF5 */ void *buf=NULL; /* Buffer to hold superblock info */ /* @@ -1846,7 +1848,11 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d if (!H5FD_is_fphdf5_driver(lf) || H5FD_fphdf5_is_captain(lf)) { #endif /* H5_HAVE_FPHDF5 */ /* Initialize information about the superblock and allocate space for it */ - if ((buf_size=H5F_init_superblock(file, dxpl_id)) == 0) + if (( +#ifdef H5_HAVE_FPHDF5 + buf_size= +#endif /* H5_HAVE_FPHDF5 */ + H5F_init_superblock(file, dxpl_id)) == 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to allocate file superblock") /* Create and open the root group */ @@ -1938,10 +1944,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d #endif /* H5_HAVE_FPHDF5 */ /* Read the superblock if it hasn't been read before. */ - if (HADDR_UNDEF == (shared->super_addr = H5F_locate_signature(lf,dxpl_id))) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, NULL, "unable to find file signature") - - if (H5F_read_superblock(file, dxpl_id, &root_ent, shared->super_addr, NULL, 0) < 0) + if (H5F_read_superblock(file, dxpl_id, &root_ent, HADDR_UNDEF, NULL, 0) < 0) HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock") #ifdef H5_HAVE_FPHDF5 @@ -1957,7 +1960,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d #endif /* H5_HAVE_FPHDF5 */ /* Make sure we can open the root group */ - if (H5G_mkroot(file, dxpl_id, &root_ent) < 0) + if (H5G_mkroot(file, dxpl_id, &root_ent)<0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group") } @@ -2361,25 +2364,20 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr /* Superblock version */ super_vers = *p++; - if (super_vers > HDF5_SUPERBLOCK_VERSION_MAX) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad superblock version number") - if (H5P_set(c_plist, H5F_CRT_SUPER_VERS_NAME, &super_vers) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set superblock version") /* Freespace version */ freespace_vers = *p++; - if (HDF5_FREESPACE_VERSION != freespace_vers) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad free space version number") - if (H5P_set(c_plist, H5F_CRT_FREESPACE_VERS_NAME, &freespace_vers) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to free space version") /* Root group version number */ obj_dir_vers = *p++; - if (HDF5_OBJECTDIR_VERSION != obj_dir_vers) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad object directory version number") if (H5P_set(c_plist, H5F_CRT_OBJ_DIR_VERS_NAME, &obj_dir_vers) < 0) @@ -2390,35 +2388,27 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr /* Shared header version number */ share_head_vers = *p++; - if (HDF5_SHAREDHEADER_VERSION != share_head_vers) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad shared-header format version number") - if (H5P_set(c_plist, H5F_CRT_SHARE_HEAD_VERS_NAME, &share_head_vers) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set shared-header format version") /* Size of file addresses */ sizeof_addr = *p++; - if (sizeof_addr != 2 && sizeof_addr != 4 && sizeof_addr != 8 && sizeof_addr != 16 && sizeof_addr != 32) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad byte number in an address") - if (H5P_set(c_plist, H5F_CRT_ADDR_BYTE_NUM_NAME,&sizeof_addr) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set byte number in an address") - shared->sizeof_addr = sizeof_addr; /* Keep a local copy also */ /* Size of file sizes */ sizeof_size = *p++; - if (sizeof_size != 2 && sizeof_size != 4 && sizeof_size != 8 && sizeof_size != 16 && sizeof_size != 32) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad byte number for object size") - if (H5P_set(c_plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &sizeof_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set byte number for object size") - shared->sizeof_size = sizeof_size; /* Keep a local copy also */ /* Skip over reserved byte */ @@ -2426,24 +2416,18 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr /* Various B-tree sizes */ UINT16DECODE(p, sym_leaf_k); - - if (sym_leaf_k < 1) + if (sym_leaf_k == 0) HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "bad symbol table leaf node 1/2 rank") - if (H5P_set(c_plist, H5F_CRT_SYM_LEAF_NAME, &sym_leaf_k) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set rank for symbol table leaf nodes") - shared->sym_leaf_k = sym_leaf_k; /* Keep a local copy also */ /* Need 'get' call to set other array values */ if (H5P_get(c_plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes") - UINT16DECODE(p, btree_k[H5B_SNODE_ID]); - - if (btree_k[H5B_SNODE_ID] < 1) + if (btree_k[H5B_SNODE_ID] == 0) HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "bad 1/2 rank for btree internal nodes") - /* * Delay setting the value in the property list until we've checked * for the indexed storage B-tree internal 'K' value later. @@ -2477,21 +2461,19 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr if (super_vers > 0) { UINT16DECODE(p, btree_k[H5B_ISTORE_ID]); p += 2; /* reserved */ - } else { - btree_k[H5B_ISTORE_ID] = HDF5_BTREE_ISTORE_IK_DEF; } + else + btree_k[H5B_ISTORE_ID] = HDF5_BTREE_ISTORE_IK_DEF; /* Set the B-tree internal node values, etc */ if (H5P_set(c_plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set rank for btree internal nodes") - - HDmemcpy(shared->btree_k, btree_k, sizeof(unsigned) * H5B_NUM_BTREE_ID); /* Keep a local copy also */ + HDmemcpy(shared->btree_k, btree_k, sizeof(unsigned) * (size_t)H5B_NUM_BTREE_ID); /* Keep a local copy also */ H5F_addr_decode(f, (const uint8_t **)&p, &shared->base_addr/*out*/); H5F_addr_decode(f, (const uint8_t **)&p, &shared->freespace_addr/*out*/); H5F_addr_decode(f, (const uint8_t **)&p, &stored_eoa/*out*/); H5F_addr_decode(f, (const uint8_t **)&p, &shared->driver_addr/*out*/); - if (H5G_ent_decode(f, (const uint8_t **)&p, root_ent/*out*/) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to read root symbol entry") @@ -2512,7 +2494,6 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr /* Compute super block checksum */ assert(sizeof(chksum) == sizeof(shared->super_chksum)); - for (q = (uint8_t *)&chksum, chksum = 0, i = 0; i < fixed_size + variable_size; ++i) q[i % sizeof(shared->super_chksum)] ^= start_p[i]; @@ -2567,7 +2548,6 @@ H5F_read_superblock(H5F_t *f, hid_t dxpl_id, H5G_entry_t *root_ent, haddr_t addr /* Compute driver info block checksum */ assert(sizeof(chksum) == sizeof(shared->drvr_chksum)); - for (q = (uint8_t *)&chksum, chksum = 0, i = 0; i < (driver_size + 16); ++i) q[i % sizeof(shared->drvr_chksum)] ^= driver_p[i]; @@ -2627,7 +2607,7 @@ done: *------------------------------------------------------------------------- */ static hsize_t -H5F_init_superblock(H5F_t *f, hid_t dxpl_id) +H5F_init_superblock(const H5F_t *f, hid_t dxpl_id) { hsize_t userblock_size = 0; /* Size of userblock, in bytes */ size_t superblock_size; /* Size of superblock, in bytes */ @@ -2793,7 +2773,6 @@ H5F_write_superblock(H5F_t *f, hid_t dxpl_id, uint8_t *buf) H5F_addr_encode(f, &p, f->shared->freespace_addr); H5F_addr_encode(f, &p, H5FD_get_eoa(f->shared->lf)); H5F_addr_encode(f, &p, f->shared->driver_addr); - if(H5G_ent_encode(f, &p, H5G_entof(f->shared->root_grp))<0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode root group information") @@ -2845,7 +2824,7 @@ H5F_write_superblock(H5F_t *f, hid_t dxpl_id, uint8_t *buf) /* Update checksum information if different */ f->shared->super_chksum = chksum; - } + } /* end if */ /* Check for driver info block */ if (HADDR_UNDEF != f->shared->driver_addr) { @@ -3038,7 +3017,7 @@ H5F_flush(H5F_t *f, hid_t dxpl_id, H5F_scope_t scope, unsigned flags) /* Write the superblock to disk */ if (H5F_write_superblock(f, dxpl_id, NULL) != SUCCEED) - HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to superblock to file") + HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to write superblock to file") /* Flush file buffers to disk. */ if (H5FD_flush(f->shared->lf, dxpl_id, @@ -3227,7 +3206,7 @@ H5F_close(H5F_t *f) int i; /* Local index variable */ /* Get the list of IDs of open dataset objects */ - while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_DATASET, (sizeof(objs)/sizeof(objs[0])), objs))) { + while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_DATASET, (sizeof(objs)/sizeof(objs[0])), objs))!=0) { /* Try to close all the open objects */ for(i=0; i<obj_count; i++) @@ -3236,7 +3215,7 @@ H5F_close(H5F_t *f) } /* end while */ /* Get the list of IDs of open group objects */ - while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_GROUP, (sizeof(objs)/sizeof(objs[0])), objs))) { + while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_GROUP, (sizeof(objs)/sizeof(objs[0])), objs))!=0) { /* Try to close all the open objects */ for(i=0; i<obj_count; i++) @@ -3245,7 +3224,7 @@ H5F_close(H5F_t *f) } /* end while */ /* Get the list of IDs of open named datatype objects */ - while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_DATATYPE, (sizeof(objs)/sizeof(objs[0])), objs))) { + while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_DATATYPE, (sizeof(objs)/sizeof(objs[0])), objs))!=0) { /* Try to close all the open objects */ for(i=0; i<obj_count; i++) @@ -3254,7 +3233,7 @@ H5F_close(H5F_t *f) } /* end while */ /* Get the list of IDs of open attribute objects */ - while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_ATTR, (sizeof(objs)/sizeof(objs[0])), objs))) { + while((obj_count=H5F_get_obj_ids(f, H5F_OBJ_ATTR, (sizeof(objs)/sizeof(objs[0])), objs))!=0) { /* Try to close all the open objects */ for(i=0; i<obj_count; i++) @@ -3419,7 +3398,7 @@ H5F_mount(H5G_entry_t *loc, const char *name, H5F_t *child, if (child->mtab.parent) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "file is already mounted") if (H5G_find(loc, name, NULL, &mp_open_ent/*out*/, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found"); + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") if (NULL==(mount_point=H5G_open(&mp_open_ent, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found") @@ -3542,7 +3521,7 @@ H5F_unmount(H5G_entry_t *loc, const char *name, hid_t dxpl_id) * then we must have found the mount point. */ if (H5G_find(loc, name, NULL, &mnt_open_ent/*out*/, H5AC_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found"); + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") if (NULL==(mounted=H5G_open(&mnt_open_ent, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found") child = H5G_fileof(mounted); @@ -4188,7 +4167,7 @@ hbool_t H5F_has_feature(const H5F_t *f, unsigned feature) assert(f); assert(f->shared); - FUNC_LEAVE_NOAPI(f->shared->lf->feature_flags&feature); + FUNC_LEAVE_NOAPI((hbool_t)(f->shared->lf->feature_flags&feature)) } /* end H5F_has_feature() */ @@ -4295,7 +4274,7 @@ H5F_get_id(H5F_t *file) } else { /* Increment reference count on atom. */ if (H5I_inc_ref(file->file_id)<0) - HGOTO_ERROR (H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed"); + HGOTO_ERROR (H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed") } ret_value = file->file_id; @@ -4784,7 +4763,7 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) size_t len=0; ssize_t ret_value; - FUNC_ENTER_API (H5Fget_name, FAIL); + FUNC_ENTER_API (H5Fget_name, FAIL) H5TRACE3("Zs","ixz",obj_id,name,size); /* get symbol table entry */ @@ -4803,5 +4782,5 @@ H5Fget_name(hid_t obj_id, char *name/*out*/, size_t size) ret_value=(ssize_t)len; done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Fget_name() */ @@ -50,7 +50,7 @@ #include "H5FDstream.h" /* In-memory files streamed via sockets */ #include "H5FLprivate.h" /* Free lists */ #ifdef H5_HAVE_FPHDF5 -#include "H5FPprivate.h" /*Flexible Parallel HDF5 */ +#include "H5FPprivate.h" /* Flexible Parallel HDF5 */ #endif /* H5_HAVE_FPHDF5 */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -121,7 +121,7 @@ H5FD_init_interface(void) FUNC_ENTER_NOAPI_NOINIT(H5FD_init_interface) - if (H5I_register_type(H5I_VFL, H5I_VFL_HASHSIZE, 0, (H5I_free_t)H5FD_free_cls)<0) + if (H5I_register_type(H5I_VFL, H5I_VFL_HASHSIZE, 0, (H5I_free_t)H5FD_free_cls)<H5I_FILE) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface") /* Reset the file serial numbers */ @@ -160,7 +160,7 @@ H5FD_term_interface(void) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FD_term_interface) if (H5_interface_initialize_g) { - if ((n=H5I_nmembers(H5I_VFL))) { + if ((n=H5I_nmembers(H5I_VFL))!=0) { H5I_clear_type(H5I_VFL, FALSE); /* Reset the VFL drivers, if they've been closed */ @@ -634,7 +634,8 @@ H5FD_pl_close(hid_t driver_id, herr_t (*free_func)(void *), void *pl) H5MM_xfree(pl); /* Decrement reference count for driver */ - H5I_dec_ref(driver_id); + if(H5I_dec_ref(driver_id)<0) + HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement reference count for driver") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1472,7 +1473,7 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) /* Check args */ if (!file || !file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file pointer") - if (type<0 || type>=H5FD_MEM_NTYPES) + if (type<H5FD_MEM_DEFAULT || type>=H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type") if (size==0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request") @@ -1533,7 +1534,7 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) /* check args */ assert(file); assert(file->cls); - assert(type >= 0 && type < H5FD_MEM_NTYPES); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); assert(size > 0); #ifdef H5_HAVE_FPHDF5 @@ -1614,7 +1615,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, FUNC_ENTER_NOAPI(H5FD_alloc_from_free_list, HADDR_UNDEF) assert(file); - assert(type >= 0 && type < H5FD_MEM_NTYPES); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); assert(size > 0); /* @@ -1636,7 +1637,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, * 2. block address is aligned with smallest size > requested size; * 3. block address is not aligned with smallest size >= requested size. */ - if (mapped_type >= 0 && (file->maxsize == 0 || size <= file->maxsize)) { + if (mapped_type >= H5FD_MEM_DEFAULT && (file->maxsize == 0 || size <= file->maxsize)) { H5FD_free_t *prev = NULL, *best = NULL; H5FD_free_t *cur = file->fl[mapped_type]; int found_aligned = 0; @@ -1792,7 +1793,7 @@ H5FD_alloc_from_free_list(H5FD_t *file, H5FD_mem_t type, if((tmp = H5FL_MALLOC(H5FD_free_t))==NULL) HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "free block allocation failed") - if ((tmp->size = (best->size - (head + size)))) { + if ((tmp->size = (best->size - (head + size)))!=0) { tmp->addr = best->addr + (head + size); tmp->next = best->next; best->next = tmp; @@ -1836,7 +1837,7 @@ H5FD_alloc_metadata(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) /* check args */ assert(file); - assert(type >= 0 && type < H5FD_MEM_NTYPES); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); assert(size > 0); /* @@ -1951,7 +1952,7 @@ H5FD_alloc_raw(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) /* check args */ assert(file); - assert(type >= 0 && type < H5FD_MEM_NTYPES); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); assert(size > 0); /* @@ -2068,7 +2069,7 @@ H5FD_real_alloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) /* check args */ assert(file); assert(file->cls); - assert(type >= 0 && type < H5FD_MEM_NTYPES); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); assert(size > 0); /* @@ -2114,7 +2115,7 @@ H5FD_update_eoa(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) /* check args */ assert(file); assert(file->cls); - assert(type >= 0 && type < H5FD_MEM_NTYPES); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); assert(size > 0); eoa = file->cls->get_eoa(file); @@ -2206,7 +2207,7 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz /* Check args */ if (!file || !file->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file pointer") - if (type<0 || type>=H5FD_MEM_NTYPES) + if (type<H5FD_MEM_DEFAULT || type>=H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type") if (H5P_DEFAULT == dxpl_id) dxpl_id= H5P_DATASET_XFER_DEFAULT; @@ -2254,7 +2255,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si /* Check args */ assert(file); assert(file->cls); - assert(type >= 0 && type < H5FD_MEM_NTYPES); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); #ifdef H5_HAVE_FPHDF5 /* @@ -2296,7 +2297,7 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si * without ever telling the driver that it was freed. Otherwise let the * driver deallocate the memory. */ - if (mapped_type>=0) { + if (mapped_type>=H5FD_MEM_DEFAULT) { H5FD_free_t *last; /* Last merged node */ H5FD_free_t *last_prev=NULL;/* Pointer to node before merged node */ H5FD_free_t *curr; /* Current free block being inspected */ @@ -3751,7 +3752,7 @@ done: *------------------------------------------------------------------------- */ hssize_t -H5FD_get_freespace(H5FD_t *file) +H5FD_get_freespace(const H5FD_t *file) { H5FD_free_t *free_node; /* Pointer to node on free list */ H5FD_mem_t type; /* Type of memory */ @@ -3771,7 +3772,7 @@ H5FD_get_freespace(H5FD_t *file) /* Iterate through the free list, accumulating the amount of free space for this type */ free_node = file->fl[type]; while(free_node) { - ret_value+=free_node->size; + ret_value+=(hssize_t)free_node->size; free_node=free_node->next; } /* end while */ } /* end for */ diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index 100e06c..d60eca8 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -638,7 +638,7 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, /* Enlarge member array */ if (file->nmembs>=file->amembs) { - int n = MAX(64, 2*file->amembs); + unsigned n = MAX(64, 2*file->amembs); H5FD_t **x = H5MM_realloc(file->memb, n*sizeof(H5FD_t*)); if (!x) @@ -911,7 +911,7 @@ H5FD_family_set_eoa(H5FD_t *_file, haddr_t eoa) /* Enlarge member array */ if (u>=file->amembs) { - int n = MAX(64, 2*file->amembs); + unsigned n = MAX(64, 2*file->amembs); H5FD_t **x = H5MM_realloc(file->memb, n*sizeof(H5FD_t*)); if (!x) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block") @@ -989,7 +989,7 @@ H5FD_family_get_eof(H5FD_t *_file) */ assert(file->nmembs>0); for (i=(int)file->nmembs-1; i>=0; --i) { - if ((eof=H5FD_get_eof(file->memb[i]))) + if ((eof=H5FD_get_eof(file->memb[i]))!=0) break; if (0==i) break; diff --git a/src/H5FDlog.c b/src/H5FDlog.c index cd1fbac..7bc3827 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -859,7 +859,7 @@ H5FD_log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, hsize_t siz if(file->fa.flags&H5FD_LOG_FLAVOR) { assert(addr<file->iosize); H5_CHECK_OVERFLOW(size,hsize_t,size_t); - HDmemset(&file->flavor[addr],type,(size_t)size); + HDmemset(&file->flavor[addr],(int)type,(size_t)size); } /* end if */ if(file->fa.flags&H5FD_LOG_ALLOC) @@ -1164,8 +1164,8 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add assert(buf); /* Verify that we are writing out the type of data we allocated in this location */ - assert(type==H5FD_MEM_DEFAULT || type==file->flavor[addr] || file->flavor[addr]==H5FD_MEM_DEFAULT); - assert(type==H5FD_MEM_DEFAULT || type==file->flavor[(addr+size)-1] || file->flavor[(addr+size)-1]==H5FD_MEM_DEFAULT); + assert(type==H5FD_MEM_DEFAULT || type==(H5FD_mem_t)file->flavor[addr] || (H5FD_mem_t)file->flavor[addr]==H5FD_MEM_DEFAULT); + assert(type==H5FD_MEM_DEFAULT || type==(H5FD_mem_t)file->flavor[(addr+size)-1] || (H5FD_mem_t)file->flavor[(addr+size)-1]==H5FD_MEM_DEFAULT); /* Check for overflow conditions */ if (HADDR_UNDEF==addr) @@ -1266,8 +1266,8 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add /* Check if this is the first write into a "default" section, grabbed by the metadata agregation algorithm */ if(file->fa.flags&H5FD_LOG_FLAVOR) { - if(file->flavor[orig_addr]==H5FD_MEM_DEFAULT) - HDmemset(&file->flavor[orig_addr],type,orig_size); + if((H5FD_mem_t)file->flavor[orig_addr]==H5FD_MEM_DEFAULT) + HDmemset(&file->flavor[orig_addr],(int)type,orig_size); } /* end if */ #ifdef H5_HAVE_GETTIMEOFDAY diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index d1d0b6e..e54faf6 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -30,7 +30,7 @@ /*lint --emacro( {534, 830}, H5P_DEFAULT, H5P_FILE_ACCESS, H5P_DATASET_XFER) */ /*lint --emacro( {534, 830}, H5F_ACC_DEBUG, H5F_ACC_RDWR) */ /*lint --emacro( {534, 830}, H5FD_MULTI) */ -/*lint -esym( 534, H5Eclear, H5Epush) */ +/*lint -esym( 534, H5Eclear_stack, H5Epush_stack) */ #include "hdf5.h" @@ -1497,7 +1497,7 @@ H5FD_multi_set_eoa(H5FD_t *_file, haddr_t eoa) status = H5FDset_eoa(file->memb[mmt], eoa-file->fa.memb_addr[mmt]); } H5E_END_TRY; if (status<0) - H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1) + H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1) } /* Save new eoa for return later */ @@ -1541,7 +1541,7 @@ H5FD_multi_get_eof(H5FD_t *_file) tmp = H5FDget_eof(file->memb[mt]); } H5E_END_TRY; if (HADDR_UNDEF==tmp) - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", HADDR_UNDEF) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", HADDR_UNDEF) if (tmp>0) tmp += file->fa.memb_addr[mt]; } else if (file->fa.relax) { @@ -1553,7 +1553,7 @@ H5FD_multi_get_eof(H5FD_t *_file) assert(HADDR_UNDEF!=tmp); } else { - H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF) + H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "bad eof", HADDR_UNDEF) } if (tmp>eof) eof = tmp; @@ -1623,9 +1623,8 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) mmt = file->fa.memb_map[type]; if (H5FD_MEM_DEFAULT==mmt) mmt = type; - if (HADDR_UNDEF==(addr=H5FDalloc(file->memb[mmt], type, dxpl_id, size))) { + if (HADDR_UNDEF==(addr=H5FDalloc(file->memb[mmt], type, dxpl_id, size))) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file can't alloc", HADDR_UNDEF) - } addr += file->fa.memb_addr[mmt]; if (addr+size>file->eoa) file->eoa = addr+size; return addr; diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index cd8d4fe..2a412cc 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -69,7 +69,7 @@ H5_DLL herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t a H5_DLL herr_t H5FD_flush(H5FD_t *file, hid_t dxpl_id, unsigned closing); H5_DLL herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum); H5_DLL herr_t H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl, void** file_handle); -H5_DLL hssize_t H5FD_get_freespace(H5FD_t *file); +H5_DLL hssize_t H5FD_get_freespace(const H5FD_t *file); H5_DLL htri_t H5FD_can_extend(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size, hsize_t extra_requested); H5_DLL herr_t H5FD_extend(H5FD_t *file, H5FD_mem_t type, haddr_t addr, diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 5b5747f..9c86c39 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -30,7 +30,7 @@ /* Disable certain warnings in PC-Lint: */ /*lint --emacro( {534, 830}, H5P_FILE_ACCESS) */ /*lint --emacro( {534, 830}, H5F_ACC_RDWR, H5F_ACC_EXCL) */ -/*lint -esym( 534, H5Eclear, H5Epush) */ +/*lint -esym( 534, H5Eclear_stack, H5Epush_stack) */ #include "hdf5.h" @@ -1659,16 +1659,11 @@ printf("H5FL_arr_term: head->name=%s, head->allocated=%d\n", H5FL_arr_gc_head.fi void * H5FL_seq_free(H5FL_seq_head_t *head, void *obj) { - void *ret_value=NULL; /* Return value */ - - FUNC_ENTER_NOAPI(H5FL_seq_free, NULL) - - /* The H5MM_xfree code allows obj to null */ - if (!obj) - HGOTO_DONE (NULL) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5FL_seq_free) /* Double check parameters */ assert(head); + assert(obj); /* Make certain that the free list is initialized */ assert(head->queue.init); @@ -1676,8 +1671,7 @@ H5FL_seq_free(H5FL_seq_head_t *head, void *obj) /* Use block routine */ H5FL_blk_free(&(head->queue),obj); -done: - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(NULL) } /* end H5FL_seq_free() */ @@ -25,13 +25,16 @@ * expected to be a rare condition. * */ + +/* Pablo information */ +/* (Put before include files to avoid problems with inline functions) */ +#define PABLO_MASK H5FS_mask + #include "H5private.h" /* Generic Functions */ #include "H5FSprivate.h" /* Private function stack routines */ #ifdef H5_HAVE_FUNCSTACK -#define PABLO_MASK H5FS_mask - #ifdef H5_HAVE_THREADSAFE /* * The per-thread function stack. pthread_once() initializes a special diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c index 3e738d1..b14d580 100644 --- a/src/H5Fdbg.c +++ b/src/H5Fdbg.c @@ -63,7 +63,7 @@ H5F_debug(H5F_t *f, hid_t dxpl_id, FILE * stream, int indent, int fwidth) H5P_genplist_t *plist; /* Property list */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5F_debug, FAIL); + FUNC_ENTER_NOAPI(H5F_debug, FAIL) /* check args */ assert(f); @@ -73,18 +73,18 @@ H5F_debug(H5F_t *f, hid_t dxpl_id, FILE * stream, int indent, int fwidth) /* Get property list */ if(NULL == (plist = H5I_object(f->shared->fcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") if(H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, &userblock_size)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get user block size"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get user block size") if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, &super_vers)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get super block version"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get super block version") if(H5P_get(plist, H5F_CRT_FREESPACE_VERS_NAME, &freespace_vers)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get super block version"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get super block version") if(H5P_get(plist, H5F_CRT_OBJ_DIR_VERS_NAME, &obj_dir_vers)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object directory version"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object directory version") if(H5P_get(plist, H5F_CRT_SHARE_HEAD_VERS_NAME, &share_head_vers)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get shared-header format version"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get shared-header format version") /* debug */ HDfprintf(stream, "%*sFile Super Block...\n", indent, ""); @@ -140,6 +140,6 @@ H5F_debug(H5F_t *f, hid_t dxpl_id, FILE * stream, int indent, int fwidth) } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index c83f12e..4718aa3 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -35,13 +35,13 @@ * */ -/* When this header is included from H5Fprivate.h, don't make calls to H5check() */ +/* When this header is included from a private header, don't make calls to H5check() */ #undef H5CHECK -#ifndef _H5Fprivate_H +#ifndef _H5private_H #define H5CHECK H5check(), -#else /* _H5Fprivate_H */ +#else /* _H5private_H */ #define H5CHECK -#endif /* _H5Fprivate_H */ +#endif /* _H5private_H */ #define H5F_ACC_RDONLY (H5CHECK 0x0000u) /*absence of rdwr => rd-only */ #define H5F_ACC_RDWR (H5CHECK 0x0001u) /*open for read and write */ @@ -285,7 +285,6 @@ H5Gopen(hid_t loc_id, const char *name) H5G_t *grp = NULL; H5G_entry_t *loc = NULL; H5G_entry_t ent; - hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open group */ FUNC_ENTER_API(H5Gopen, FAIL); H5TRACE2("i","is",loc_id,name); @@ -297,12 +296,13 @@ H5Gopen(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); /* Open the parent group, making sure it's a group */ - if (H5G_find(loc, name, NULL, &ent/*out*/, dxpl_id) < 0) + if (H5G_find(loc, name, NULL, &ent/*out*/, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found"); /* Open the group */ if ((grp = H5G_open(&ent, H5AC_dxpl_id))==NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group"); + /* Register an atom for the group */ if ((ret_value = H5I_register(H5I_GROUP, grp)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group"); @@ -2155,6 +2155,7 @@ herr_t H5G_free(H5G_t *grp) { herr_t ret_value=SUCCEED; /* Return value */ + FUNC_ENTER_NOAPI(H5G_free, FAIL); assert(grp && grp->shared); @@ -3405,7 +3406,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_replace_name(int type, H5G_entry_t *loc, +H5G_replace_name(H5G_obj_t type, H5G_entry_t *loc, H5RS_str_t *src_name, H5G_entry_t *src_loc, H5RS_str_t *dst_name, H5G_entry_t *dst_loc, H5G_names_op_t op ) { diff --git a/src/H5Gnode.c b/src/H5Gnode.c index e690108..e6c1776 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -65,7 +65,7 @@ typedef struct H5G_node_key_t { /* PRIVATE PROTOTYPES */ static herr_t H5G_node_serialize(H5F_t *f, H5G_node_t *sym, size_t size, uint8_t *buf); -static size_t H5G_node_size(H5F_t *f); +static size_t H5G_node_size(const H5F_t *f); static herr_t H5G_node_shared_free(void *shared); /* Metadata cache callbacks */ @@ -75,11 +75,11 @@ static herr_t H5G_node_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t a H5G_node_t *sym); static herr_t H5G_node_dest(H5F_t *f, H5G_node_t *sym); static herr_t H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy); -static herr_t H5G_compute_size(H5F_t *f, H5G_node_t *sym, size_t *size_ptr); +static herr_t H5G_compute_size(const H5F_t *f, const H5G_node_t *sym, size_t *size_ptr); /* B-tree callbacks */ static size_t H5G_node_sizeof_rkey(const H5F_t *f, const void *_udata); -static H5RC_t *H5G_node_get_shared(H5F_t *f, const void *_udata); +static H5RC_t *H5G_node_get_shared(const H5F_t *f, const void *_udata); static herr_t H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t op, void *_lt_key, void *_udata, void *_rt_key, haddr_t *addr_p/*out*/); @@ -88,7 +88,7 @@ static int H5G_node_cmp2(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, static int H5G_node_cmp3(H5F_t *f, hid_t dxpl_id, void *_lt_key, void *_udata, void *_rt_key); static herr_t H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_lt_key, - void *_udata, const void *_rt_key); + void *_udata); static H5B_ins_t H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_lt_key, hbool_t *lt_key_changed, void *_md_key, void *_udata, void *_rt_key, @@ -97,9 +97,9 @@ static H5B_ins_t H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_l static H5B_ins_t H5G_node_remove(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *lt_key, hbool_t *lt_key_changed, void *udata, void *rt_key, hbool_t *rt_key_changed); -static herr_t H5G_node_decode_key(H5F_t *f, H5B_t *bt, uint8_t *raw, +static herr_t H5G_node_decode_key(const H5F_t *f, const H5B_t *bt, const uint8_t *raw, void *_key); -static herr_t H5G_node_encode_key(H5F_t *f, H5B_t *bt, uint8_t *raw, +static herr_t H5G_node_encode_key(const H5F_t *f, const H5B_t *bt, uint8_t *raw, void *_key); static herr_t H5G_node_debug_key(FILE *stream, H5F_t *f, hid_t dxpl_id, int indent, int fwidth, const void *key, @@ -199,7 +199,7 @@ H5G_node_sizeof_rkey(const H5F_t *f, const void UNUSED * udata) *------------------------------------------------------------------------- */ static H5RC_t * -H5G_node_get_shared(H5F_t *f, const void UNUSED *_udata) +H5G_node_get_shared(const H5F_t *f, const void UNUSED *_udata) { H5RC_t *rc; @@ -232,7 +232,7 @@ H5G_node_get_shared(H5F_t *f, const void UNUSED *_udata) *------------------------------------------------------------------------- */ static herr_t -H5G_node_decode_key(H5F_t *f, H5B_t UNUSED *bt, uint8_t *raw, void *_key) +H5G_node_decode_key(const H5F_t *f, const H5B_t UNUSED *bt, const uint8_t *raw, void *_key) { H5G_node_key_t *key = (H5G_node_key_t *) _key; @@ -264,7 +264,7 @@ H5G_node_decode_key(H5F_t *f, H5B_t UNUSED *bt, uint8_t *raw, void *_key) *------------------------------------------------------------------------- */ static herr_t -H5G_node_encode_key(H5F_t *f, H5B_t UNUSED *bt, uint8_t *raw, void *_key) +H5G_node_encode_key(const H5F_t *f, const H5B_t UNUSED *bt, uint8_t *raw, void *_key) { H5G_node_key_t *key = (H5G_node_key_t *) _key; @@ -344,7 +344,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5G_node_size(H5F_t *f) +H5G_node_size(const H5F_t *f) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_size); @@ -686,7 +686,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5G_compute_size(H5F_t *f, H5G_node_t UNUSED *sym, size_t *size_ptr) +H5G_compute_size(const H5F_t *f, const H5G_node_t UNUSED *sym, size_t *size_ptr) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_compute_size); @@ -932,7 +932,7 @@ done: */ static herr_t H5G_node_found(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_lt_key, - void *_udata, const void UNUSED *_rt_key) + void *_udata) { H5G_bt_ud1_t *bt_udata = (H5G_bt_ud1_t *) _udata; H5G_node_t *sn = NULL; @@ -1043,7 +1043,7 @@ done: static H5B_ins_t H5G_node_insert(H5F_t *f, hid_t dxpl_id, haddr_t addr, void UNUSED *_lt_key, hbool_t UNUSED *lt_key_changed, void *_md_key, - void *_udata, void *_rt_key, hbool_t UNUSED *rt_key_changed, + void *_udata, void *_rt_key, hbool_t *rt_key_changed, haddr_t *new_node_p) { H5G_node_key_t *md_key = (H5G_node_key_t *) _md_key; @@ -1458,8 +1458,8 @@ done: *------------------------------------------------------------------------- */ int -H5G_node_iterate (H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, - void UNUSED *_rt_key, void *_udata) +H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, + const void UNUSED *_rt_key, void *_udata) { H5G_bt_ud2_t *bt_udata = (H5G_bt_ud2_t *)_udata; H5G_node_t *sn = NULL; @@ -1486,7 +1486,7 @@ H5G_node_iterate (H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_ITER_ERROR, "unable to load symbol table node"); nsyms = sn->nsyms; - if (NULL==(name_off = H5FL_SEQ_MALLOC(size_t, nsyms))) + if (NULL==(name_off = H5FL_SEQ_MALLOC(size_t, (size_t)nsyms))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, H5B_ITER_ERROR, "memory allocation failed"); for (i=0; i<nsyms; i++) name_off[i] = sn->entry[i].name_off; @@ -1566,8 +1566,8 @@ done: *------------------------------------------------------------------------- */ int -H5G_node_sumup(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, - void UNUSED *_rt_key, void *_udata) +H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, + const void UNUSED *_rt_key, void *_udata) { hsize_t *num_objs = (hsize_t *)_udata; H5G_node_t *sn = NULL; @@ -1613,8 +1613,8 @@ done: *------------------------------------------------------------------------- */ int -H5G_node_name(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, - void UNUSED *_rt_key, void *_udata) +H5G_node_name(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, + const void UNUSED *_rt_key, void *_udata) { H5G_bt_ud3_t *bt_udata = (H5G_bt_ud3_t *)_udata; const H5HL_t *heap = NULL; @@ -1682,8 +1682,8 @@ done: *------------------------------------------------------------------------- */ int -H5G_node_type(H5F_t *f, hid_t dxpl_id, void UNUSED *_lt_key, haddr_t addr, - void UNUSED *_rt_key, void *_udata) +H5G_node_type(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, + const void UNUSED *_rt_key, void *_udata) { H5G_bt_ud3_t *bt_udata = (H5G_bt_ud3_t*)_udata; hsize_t loc_idx; diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index b9693a3..9bee5ee 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -152,12 +152,12 @@ H5_DLL herr_t H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, int n); /* Functions that understand symbol table nodes */ -H5_DLL int H5G_node_iterate (H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t addr, - void *_rt_key, void *_udata); -H5_DLL int H5G_node_sumup(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t addr, - void *_rt_key, void *_udata); -H5_DLL int H5G_node_name(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t addr, - void *_rt_key, void *_udata); -H5_DLL int H5G_node_type(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t addr, - void *_rt_key, void *_udata); +H5_DLL int H5G_node_iterate (H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, + const void *_rt_key, void *_udata); +H5_DLL int H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, + const void *_rt_key, void *_udata); +H5_DLL int H5G_node_name(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, + const void *_rt_key, void *_udata); +H5_DLL int H5G_node_type(H5F_t *f, hid_t dxpl_id, const void *_lt_key, haddr_t addr, + const void *_rt_key, void *_udata); #endif diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index b2c96d0..53bbae9 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -152,7 +152,7 @@ H5_DLL herr_t H5G_insert(H5G_entry_t *loc, const char *name, H5_DLL herr_t H5G_find(H5G_entry_t *loc, const char *name, H5G_entry_t *grp_ent/*out*/, H5G_entry_t *ent/*out*/, hid_t dxpl_id); H5_DLL H5F_t *H5G_insertion_file(H5G_entry_t *loc, const char *name, hid_t dxpl_id); -H5_DLL herr_t H5G_replace_name(int type, H5G_entry_t *loc, +H5_DLL herr_t H5G_replace_name(H5G_obj_t type, H5G_entry_t *loc, H5RS_str_t *src_name, H5G_entry_t *src_loc, H5RS_str_t *dst_name, H5G_entry_t *dst_loc, H5G_names_op_t op); H5_DLL herr_t H5G_free_grp_name(H5G_t *grp); @@ -132,7 +132,7 @@ static herr_t H5HG_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, H5HG_heap_t *heap); static herr_t H5HG_dest(H5F_t *f, H5HG_heap_t *heap); static herr_t H5HG_clear(H5F_t *f, H5HG_heap_t *heap, hbool_t destroy); -static herr_t H5HG_compute_size(H5F_t *f, H5HG_heap_t *heap, size_t *size_ptr); +static herr_t H5HG_compute_size(const H5F_t *f, const H5HG_heap_t *heap, size_t *size_ptr); /* * H5HG inherits cache-like properties from H5AC @@ -628,7 +628,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HG_compute_size(H5F_t UNUSED *f, H5HG_heap_t *heap, size_t *size_ptr) +H5HG_compute_size(const H5F_t UNUSED *f, const H5HG_heap_t *heap, size_t *size_ptr) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HG_compute_size); @@ -662,13 +662,13 @@ H5HG_compute_size(H5F_t UNUSED *f, H5HG_heap_t *heap, size_t *size_ptr) * *------------------------------------------------------------------------- */ -static unsigned +static size_t H5HG_alloc (H5F_t *f, H5HG_heap_t *heap, size_t size) { - unsigned idx; + size_t idx; uint8_t *p = NULL; size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); - unsigned ret_value; /* Return value */ + size_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HG_alloc); @@ -897,7 +897,7 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out* { size_t need; /*total space needed for object */ int cwfsno; - unsigned idx; + size_t idx; haddr_t addr = HADDR_UNDEF; H5HG_heap_t *heap = NULL; hbool_t found=0; /* Flag to indicate a heap with enough space was found */ @@ -1004,7 +1004,6 @@ H5HG_insert (H5F_t *f, hid_t dxpl_id, size_t size, void *obj, H5HG_t *hobj/*out* /* Split the free space to make room for the new object */ idx = H5HG_alloc (f, heap, size); - assert (idx>0); /* Copy data into the heap */ if(size>0) { @@ -1067,7 +1066,7 @@ H5HG_read (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object/*out*/) if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_READ))) HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "unable to load heap"); - assert (hobj->idx>0 && hobj->idx<heap->nused); + assert (hobj->idx<heap->nused); assert (heap->obj[hobj->idx].begin); size = heap->obj[hobj->idx].size; p = heap->obj[hobj->idx].begin + H5HG_SIZEOF_OBJHDR (f); @@ -1141,7 +1140,7 @@ H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); - assert (hobj->idx>0 && hobj->idx<heap->nused); + assert (hobj->idx<heap->nused); assert (heap->obj[hobj->idx].begin); if (heap->obj[hobj->idx].nrefs+adjust<0) HGOTO_ERROR (H5E_HEAP, H5E_BADRANGE, FAIL, "new link count would be out of range"); @@ -1199,7 +1198,7 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) if (NULL == (heap = H5AC_protect(f, dxpl_id, H5AC_GHEAP, hobj->addr, NULL, NULL, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); - assert (hobj->idx>0 && hobj->idx<heap->nused); + assert (hobj->idx<heap->nused); assert (heap->obj[hobj->idx].begin); obj_start = heap->obj[hobj->idx].begin; /* Include object header size */ diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h index 56589f9..2cfa773 100644 --- a/src/H5HGprivate.h +++ b/src/H5HGprivate.h @@ -34,7 +34,7 @@ /* Information to locate object in global heap */ typedef struct H5HG_t { haddr_t addr; /*address of collection */ - unsigned idx; /*object ID within collection */ + size_t idx; /*object ID within collection */ } H5HG_t; /* Typedef for heap in memory (defined in H5HGpkg.h) */ @@ -72,7 +72,7 @@ static H5HL_t *H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *udat static herr_t H5HL_flush(H5F_t *f, hid_t dxpl_id, hbool_t dest, haddr_t addr, H5HL_t *heap); static herr_t H5HL_dest(H5F_t *f, H5HL_t *heap); static herr_t H5HL_clear(H5F_t *f, H5HL_t *heap, hbool_t destroy); -static herr_t H5HL_compute_size(H5F_t *f, H5HL_t *heap, size_t *size_ptr); +static herr_t H5HL_compute_size(const H5F_t *f, const H5HL_t *heap, size_t *size_ptr); /* * H5HL inherits cache-like properties from H5AC @@ -695,7 +695,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HL_compute_size(H5F_t *f, H5HL_t *heap, size_t *size_ptr) +H5HL_compute_size(const H5F_t *f, const H5HL_t *heap, size_t *size_ptr) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HL_compute_size); @@ -1099,95 +1099,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5Iget_file_id - * - * Purpose: The public version of H5I_get_file_id(), obtains the file - * ID given an object ID. User has to close this ID. - * - * Return: Success: file ID - * - * Failure: a negative value - * - * Programmer: Raymond Lu - * Oct 27, 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -hid_t -H5Iget_file_id(hid_t obj_id) -{ - hid_t ret_value; - - FUNC_ENTER_API(H5Iget_file_id, FAIL); - H5TRACE1("i","i",obj_id); - - if((ret_value = H5I_get_file_id(obj_id))<0) - HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID"); - -done: - FUNC_LEAVE_API(ret_value); -} - - -/*------------------------------------------------------------------------- - * Function: H5I_get_file_id - * - * Purpose: The private version of H5Iget_file_id(), obtains the file - * ID given an object ID. - * - * Return: Success: file ID - * - * Failure: a negative value - * - * Programmer: Raymond Lu - * Oct 27, 2003 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static hid_t -H5I_get_file_id(hid_t obj_id) -{ - H5G_entry_t *ent; - hid_t ret_value; - H5I_type_t type; - - FUNC_ENTER_NOAPI_NOINIT(H5I_get_file_id); - - /* Get object type */ - type = H5I_TYPE(obj_id); - if(type == H5I_FILE) - { - ret_value = obj_id; - - /* Increment reference count on atom. */ - if (H5I_inc_ref(ret_value)<0) - HGOTO_ERROR (H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed"); - } - else if(type == H5I_DATATYPE) - { - if((ent = H5G_loc(obj_id))==NULL) - HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "not a named datatype"); - ret_value = H5F_get_id(ent->file); - } - else if(type == H5I_GROUP || type == H5I_DATASET || type == H5I_ATTR) - { - if((ent = H5G_loc(obj_id))==NULL) - HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't get symbol table info"); - ret_value = H5F_get_id(ent->file); - } - else - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid object ID"); - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - - -/*------------------------------------------------------------------------- * Function: H5Iremove_verify * * Purpose: Removes the specified ID from its type, first checking that the @@ -2219,3 +2130,89 @@ done: } #endif /* H5I_DEBUG_OUTPUT */ + +/*------------------------------------------------------------------------- + * Function: H5Iget_file_id + * + * Purpose: The public version of H5I_get_file_id(), obtains the file + * ID given an object ID. User has to close this ID. + * + * Return: Success: file ID + * + * Failure: a negative value + * + * Programmer: Raymond Lu + * Oct 27, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +hid_t +H5Iget_file_id(hid_t obj_id) +{ + hid_t ret_value; + + FUNC_ENTER_API(H5Iget_file_id, FAIL); + H5TRACE1("i","i",obj_id); + + if((ret_value = H5I_get_file_id(obj_id))<0) + HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve file ID"); + +done: + FUNC_LEAVE_API(ret_value); +} + + +/*------------------------------------------------------------------------- + * Function: H5I_get_file_id + * + * Purpose: The private version of H5Iget_file_id(), obtains the file + * ID given an object ID. + * + * Return: Success: file ID + * + * Failure: a negative value + * + * Programmer: Raymond Lu + * Oct 27, 2003 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static hid_t +H5I_get_file_id(hid_t obj_id) +{ + H5G_entry_t *ent; + H5I_type_t type; + hid_t ret_value; + + FUNC_ENTER_NOAPI_NOINIT(H5I_get_file_id); + + /* Get object type */ + type = H5I_TYPE(obj_id); + if(type == H5I_FILE) { + ret_value = obj_id; + + /* Increment reference count on atom. */ + if (H5I_inc_ref(ret_value)<0) + HGOTO_ERROR (H5E_ATOM, H5E_CANTSET, FAIL, "incrementing file ID failed"); + } + else if(type == H5I_DATATYPE) { + if((ent = H5G_loc(obj_id))==NULL) + HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "not a named datatype"); + ret_value = H5F_get_id(ent->file); + } + else if(type == H5I_GROUP || type == H5I_DATASET || type == H5I_ATTR) { + if((ent = H5G_loc(obj_id))==NULL) + HGOTO_ERROR (H5E_ATOM, H5E_CANTGET, FAIL, "can't get symbol table info"); + ret_value = H5F_get_id(ent->file); + } + else + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid object ID"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} + diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h index d6ed95b..0f6e1b7 100644 --- a/src/H5Ipublic.h +++ b/src/H5Ipublic.h @@ -32,25 +32,24 @@ * to verify that the H5I{inc|dec|get}_ref() routines work correctly with in. * */ -typedef enum { - H5I_UNINIT = (-2), /*uninitialized type */ +typedef enum H5I_type_t { + H5I_UNINIT = (-2), /*uninitialized type */ H5I_BADID = (-1), /*invalid Type */ H5I_FILE = 1, /*type ID for File objects */ H5I_FILE_CLOSING, /*files pending close due to open objhdrs */ H5I_GROUP, /*type ID for Group objects */ H5I_DATATYPE, /*type ID for Datatype objects */ - H5I_DATASPACE, /*type ID for Dataspace objects */ + H5I_DATASPACE, /*type ID for Dataspace objects */ H5I_DATASET, /*type ID for Dataset objects */ - H5I_ATTR, /*type ID for Attribute objects */ - H5I_TEMPBUF, /*type ID for Temporary buffer objects */ - H5I_REFERENCE, /*type ID for Reference objects */ + H5I_ATTR, /*type ID for Attribute objects */ + H5I_REFERENCE, /*type ID for Reference objects */ H5I_VFL, /*type ID for virtual file layer */ H5I_GENPROP_CLS, /*type ID for generic property list classes */ - H5I_GENPROP_LST, /*type ID for generic property lists */ - H5I_ERROR_CLASS, /*type ID for error classes */ - H5I_ERROR_MSG, /*type ID for error messages */ - H5I_ERROR_STACK, /*type ID for error stacks */ - H5I_NTYPES /*number of library types, MUST BE LAST! */ + H5I_GENPROP_LST, /*type ID for generic property lists */ + H5I_ERROR_CLASS, /*type ID for error classes */ + H5I_ERROR_MSG, /*type ID for error messages */ + H5I_ERROR_STACK, /*type ID for error stacks */ + H5I_NTYPES /*number of library types, MUST BE LAST! */ } H5I_type_t; /* Type of atoms to return to users */ @@ -91,7 +91,7 @@ static H5O_t *H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata static herr_t H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5O_t *oh); static herr_t H5O_dest(H5F_t *f, H5O_t *oh); static herr_t H5O_clear(H5F_t *f, H5O_t *oh, hbool_t destroy); -static herr_t H5O_compute_size(H5F_t *f, H5O_t *oh, size_t *size_ptr); +static herr_t H5O_compute_size(const H5F_t *f, const H5O_t *oh, size_t *size_ptr); /* H5O inherits cache-like properties from H5AC */ static const H5AC_class_t H5AC_OHDR[1] = {{ @@ -833,7 +833,8 @@ H5O_dest(H5F_t UNUSED *f, H5O_t *oh) oh->chunk[i].image = H5FL_BLK_FREE(chunk_image,oh->chunk[i].image); } - oh->chunk = H5FL_SEQ_FREE(H5O_chunk_t,oh->chunk); + if(oh->chunk) + oh->chunk = H5FL_SEQ_FREE(H5O_chunk_t,oh->chunk); /* destroy messages */ for (i = 0; i < oh->nmesgs; i++) { @@ -845,7 +846,8 @@ H5O_dest(H5F_t UNUSED *f, H5O_t *oh) else H5O_free_real(oh->mesg[i].type, oh->mesg[i].native); } - oh->mesg = H5FL_SEQ_FREE(H5O_mesg_t,oh->mesg); + if(oh->mesg) + oh->mesg = H5FL_SEQ_FREE(H5O_mesg_t,oh->mesg); /* destroy object header */ H5FL_FREE(H5O_t,oh); @@ -923,7 +925,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O_compute_size(H5F_t *f, H5O_t *oh, size_t *size_ptr) +H5O_compute_size(const H5F_t *f, const H5O_t *oh, size_t *size_ptr) { unsigned u; size_t size; @@ -938,9 +940,7 @@ H5O_compute_size(H5F_t *f, H5O_t *oh, size_t *size_ptr) size = H5O_SIZEOF_HDR(f); for (u = 0; u < oh->nchunks; u++) - { size += oh->chunk[u].size; - } HDassert(size >= H5O_SIZEOF_HDR(f)); @@ -3130,7 +3130,7 @@ done: *------------------------------------------------------------------------- */ size_t -H5O_raw_size(unsigned type_id, H5F_t *f, const void *mesg) +H5O_raw_size(unsigned type_id, const H5F_t *f, const void *mesg) { const H5O_class_t *type; /* Actual H5O class type for the ID */ size_t ret_value; /* Return value */ @@ -3487,7 +3487,7 @@ done: *------------------------------------------------------------------------- */ void* -H5O_decode(H5F_t *f, unsigned char *buf, unsigned type_id) +H5O_decode(H5F_t *f, const unsigned char *buf, unsigned type_id) { const H5O_class_t *type; /* Actual H5O class type for the ID */ void *ret_value=NULL; /* Return value */ diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 476589c..4487985 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -33,7 +33,7 @@ static herr_t H5O_attr_encode (H5F_t *f, uint8_t *p, const void *mesg); static void *H5O_attr_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static void *H5O_attr_copy (const void *_mesg, void *_dest, unsigned update_flags); -static size_t H5O_attr_size (H5F_t *f, const void *_mesg); +static size_t H5O_attr_size (const H5F_t *f, const void *_mesg); static herr_t H5O_attr_reset (void *_mesg); static herr_t H5O_attr_free (void *mesg); static herr_t H5O_attr_delete (H5F_t *f, hid_t dxpl_id, const void *_mesg); @@ -412,7 +412,7 @@ done: * Added padding between message parts for alignment. --------------------------------------------------------------------------*/ static size_t -H5O_attr_size(H5F_t UNUSED *f, const void *_mesg) +H5O_attr_size(const H5F_t UNUSED *f, const void *_mesg) { const H5A_t *attr = (const H5A_t *)_mesg; size_t name_len; diff --git a/src/H5Obogus.c b/src/H5Obogus.c index e6f7931..63b002b 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -42,7 +42,7 @@ /* PRIVATE PROTOTYPES */ static void *H5O_bogus_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_bogus_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static size_t H5O_bogus_size(H5F_t *f, const void *_mesg); +static size_t H5O_bogus_size(const H5F_t *f, const void *_mesg); static herr_t H5O_bogus_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); @@ -172,7 +172,7 @@ H5O_bogus_encode(H5F_t UNUSED *f, uint8_t *p, const void UNUSED *mesg) *------------------------------------------------------------------------- */ static size_t -H5O_bogus_size(H5F_t UNUSED *f, const void UNUSED *mesg) +H5O_bogus_size(const H5F_t UNUSED *f, const void UNUSED *mesg) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_bogus_size); diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 25b9c05..f155273 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -29,7 +29,7 @@ static herr_t H5O_dtype_encode (H5F_t *f, uint8_t *p, const void *mesg); static void *H5O_dtype_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static void *H5O_dtype_copy (const void *_mesg, void *_dest, unsigned update_flags); -static size_t H5O_dtype_size (H5F_t *f, const void *_mesg); +static size_t H5O_dtype_size (const H5F_t *f, const void *_mesg); static herr_t H5O_dtype_reset (void *_mesg); static herr_t H5O_dtype_free (void *_mesg); static herr_t H5O_dtype_get_share (H5F_t *f, const void *_mesg, @@ -453,7 +453,6 @@ done: if(dt != NULL) H5FL_FREE(H5T_t, dt); } - FUNC_LEAVE_NOAPI(ret_value); } @@ -985,7 +984,7 @@ done: sized "properties" field. --------------------------------------------------------------------------*/ static size_t -H5O_dtype_size(H5F_t *f, const void *mesg) +H5O_dtype_size(const H5F_t *f, const void *mesg) { unsigned i; size_t ret_value = 8; diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 7472084..2e8e365 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -34,7 +34,7 @@ static void *H5O_efl_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_efl_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_efl_copy(const void *_mesg, void *_dest, unsigned update_flags); -static size_t H5O_efl_size(H5F_t *f, const void *_mesg); +static size_t H5O_efl_size(const H5F_t *f, const void *_mesg); static herr_t H5O_efl_reset(void *_mesg); static herr_t H5O_efl_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); @@ -314,7 +314,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_efl_size(H5F_t *f, const void *_mesg) +H5O_efl_size(const H5F_t *f, const void *_mesg) { const H5O_efl_t *mesg = (const H5O_efl_t *) _mesg; size_t ret_value = 0; diff --git a/src/H5Ofill.c b/src/H5Ofill.c index c1d1fd1..7e3c4da 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -34,7 +34,7 @@ static void *H5O_fill_new_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_fill_new_copy(const void *_mesg, void *_dest, unsigned update_flags); -static size_t H5O_fill_new_size(H5F_t *f, const void *_mesg); +static size_t H5O_fill_new_size(const H5F_t *f, const void *_mesg); static herr_t H5O_fill_new_reset(void *_mesg); static herr_t H5O_fill_new_free(void *_mesg); static herr_t H5O_fill_new_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, @@ -43,7 +43,7 @@ static herr_t H5O_fill_new_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FIL static void *H5O_fill_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_fill_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_fill_copy(const void *_mesg, void *_dest, unsigned update_flags); -static size_t H5O_fill_size(H5F_t *f, const void *_mesg); +static size_t H5O_fill_size(const H5F_t *f, const void *_mesg); static herr_t H5O_fill_reset(void *_mesg); static herr_t H5O_fill_free(void *_mesg); static herr_t H5O_fill_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, @@ -467,7 +467,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_fill_new_size(H5F_t UNUSED *f, const void *_mesg) +H5O_fill_new_size(const H5F_t UNUSED *f, const void *_mesg) { const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg; size_t ret_value; @@ -508,7 +508,7 @@ H5O_fill_new_size(H5F_t UNUSED *f, const void *_mesg) *------------------------------------------------------------------------- */ static size_t -H5O_fill_size(H5F_t UNUSED *f, const void *_mesg) +H5O_fill_size(const H5F_t UNUSED *f, const void *_mesg) { const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg; @@ -579,7 +579,6 @@ static herr_t H5O_fill_reset(void *_mesg) { H5O_fill_t *mesg = (H5O_fill_t *)_mesg; - herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_fill_reset); diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 28db75c..fa7d40e 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -36,7 +36,7 @@ static void *H5O_layout_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_layout_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_layout_copy(const void *_mesg, void *_dest, unsigned update_flags); -static size_t H5O_layout_size(H5F_t *f, const void *_mesg); +static size_t H5O_layout_size(const H5F_t *f, const void *_mesg); static herr_t H5O_layout_reset (void *_mesg); static herr_t H5O_layout_free (void *_mesg); static herr_t H5O_layout_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg); @@ -396,7 +396,7 @@ done: *------------------------------------------------------------------------- */ size_t -H5O_layout_meta_size(H5F_t *f, const void *_mesg) +H5O_layout_meta_size(const H5F_t *f, const void *_mesg) { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; size_t ret_value; @@ -461,7 +461,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_layout_size(H5F_t *f, const void *_mesg) +H5O_layout_size(const H5F_t *f, const void *_mesg) { const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; size_t ret_value; diff --git a/src/H5Omtime.c b/src/H5Omtime.c index 57e1de1..a6cc127 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -35,12 +35,12 @@ static void *H5O_mtime_new_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_mtime_new_encode(H5F_t *f, uint8_t *p, const void *_mesg); -static size_t H5O_mtime_new_size(H5F_t *f, const void *_mesg); +static size_t H5O_mtime_new_size(const H5F_t *f, const void *_mesg); static void *H5O_mtime_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_mtime_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_mtime_copy(const void *_mesg, void *_dest, unsigned update_flags); -static size_t H5O_mtime_size(H5F_t *f, const void *_mesg); +static size_t H5O_mtime_size(const H5F_t *f, const void *_mesg); static herr_t H5O_mtime_reset(void *_mesg); static herr_t H5O_mtime_free(void *_mesg); static herr_t H5O_mtime_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE *stream, @@ -229,6 +229,7 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const uint8_t *p, /* Irix5.3 */ { struct timezone tz; + if (HDBSDgettimeofday(NULL, &tz)<0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information"); the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0); @@ -430,7 +431,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_mtime_new_size(H5F_t UNUSED * f, const void UNUSED * mesg) +H5O_mtime_new_size(const H5F_t UNUSED * f, const void UNUSED * mesg) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mtime_new_size); @@ -463,7 +464,7 @@ H5O_mtime_new_size(H5F_t UNUSED * f, const void UNUSED * mesg) *------------------------------------------------------------------------- */ static size_t -H5O_mtime_size(H5F_t UNUSED * f, const void UNUSED * mesg) +H5O_mtime_size(const H5F_t UNUSED * f, const void UNUSED * mesg) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_mtime_size); diff --git a/src/H5Oname.c b/src/H5Oname.c index b58246a..a675eff 100644 --- a/src/H5Oname.c +++ b/src/H5Oname.c @@ -38,7 +38,7 @@ static void *H5O_name_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_name_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_name_copy(const void *_mesg, void *_dest, unsigned update_flags); -static size_t H5O_name_size(H5F_t *f, const void *_mesg); +static size_t H5O_name_size(const H5F_t *f, const void *_mesg); static herr_t H5O_name_reset(void *_mesg); static herr_t H5O_name_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent, int fwidth); @@ -213,7 +213,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_name_size(H5F_t UNUSED *f, const void *_mesg) +H5O_name_size(const H5F_t UNUSED *f, const void *_mesg) { const H5O_name_t *mesg = (const H5O_name_t *) _mesg; size_t ret_value; diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 6ddfd92..5735d9c 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -63,7 +63,7 @@ typedef struct H5O_class_t { void *(*decode)(H5F_t*, hid_t, const uint8_t*, struct H5O_shared_t*); herr_t (*encode)(H5F_t*, uint8_t*, const void*); void *(*copy)(const void*, void*, unsigned); /*copy native value */ - size_t (*raw_size)(H5F_t*, const void*);/*sizeof raw val */ + size_t (*raw_size)(const H5F_t*, const void*);/*sizeof raw val */ herr_t (*reset)(void *); /*free nested data structs */ herr_t (*free)(void *); /*free main data struct */ herr_t (*del)(H5F_t *, hid_t, const void *); /* Delete space in file referenced by this message */ diff --git a/src/H5Opline.c b/src/H5Opline.c index 5319a92..1fa304f 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -35,7 +35,7 @@ static herr_t H5O_pline_encode (H5F_t *f, uint8_t *p, const void *mesg); static void *H5O_pline_decode (H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static void *H5O_pline_copy (const void *_mesg, void *_dest, unsigned update_flags); -static size_t H5O_pline_size (H5F_t *f, const void *_mesg); +static size_t H5O_pline_size (const H5F_t *f, const void *_mesg); static herr_t H5O_pline_reset (void *_mesg); static herr_t H5O_pline_free (void *_mesg); static herr_t H5O_pline_debug (H5F_t *f, hid_t dxpl_id, const void *_mesg, @@ -321,7 +321,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_pline_size (H5F_t UNUSED *f, const void *mesg) +H5O_pline_size (const H5F_t UNUSED *f, const void *mesg) { const H5O_pline_t *pline = (const H5O_pline_t*)mesg; size_t i, name_len; diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 3e256e2..568f67b 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -256,9 +256,9 @@ H5_DLL herr_t H5O_remove(H5G_entry_t *ent, unsigned type_id, int sequence, H5_DLL herr_t H5O_reset(unsigned type_id, void *native); H5_DLL void *H5O_free(unsigned type_id, void *mesg); H5_DLL herr_t H5O_encode(H5F_t *f, unsigned char *buf, void *obj, unsigned type_id); -H5_DLL void* H5O_decode(H5F_t *f, unsigned char *buf, unsigned type_id); +H5_DLL void* H5O_decode(H5F_t *f, const unsigned char *buf, unsigned type_id); H5_DLL void *H5O_copy(unsigned type_id, const void *mesg, void *dst); -H5_DLL size_t H5O_raw_size(unsigned type_id, H5F_t *f, const void *mesg); +H5_DLL size_t H5O_raw_size(unsigned type_id, const H5F_t *f, const void *mesg); H5_DLL herr_t H5O_get_share(unsigned type_id, H5F_t *f, const void *mesg, H5O_shared_t *share); H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr); H5_DLL herr_t H5O_get_info(H5G_entry_t *ent, H5O_stat_t *ostat, hid_t dxpl_id); @@ -269,7 +269,7 @@ H5_DLL herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, in int fwidth); /* Layout operators */ -H5_DLL size_t H5O_layout_meta_size(H5F_t *f, const void *_mesg); +H5_DLL size_t H5O_layout_meta_size(const H5F_t *f, const void *_mesg); /* EFL operators */ H5_DLL hsize_t H5O_efl_total_size(H5O_efl_t *efl); diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 53f8c80..a02033a 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -29,7 +29,7 @@ static void *H5O_sdspace_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_sdspace_copy(const void *_mesg, void *_dest, unsigned update_flags); -static size_t H5O_sdspace_size(H5F_t *f, const void *_mesg); +static size_t H5O_sdspace_size(const H5F_t *f, const void *_mesg); static herr_t H5O_sdspace_reset(void *_mesg); static herr_t H5O_sdspace_free (void *_mesg); static herr_t H5O_sdspace_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, @@ -324,7 +324,7 @@ done: instead of just four bytes. --------------------------------------------------------------------------*/ static size_t -H5O_sdspace_size(H5F_t *f, const void *mesg) +H5O_sdspace_size(const H5F_t *f, const void *mesg) { const H5S_extent_t *space = (const H5S_extent_t *) mesg; diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 59c8278..2f30ae6 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -42,7 +42,7 @@ static void *H5O_shared_decode (H5F_t*, hid_t dxpl_id, const uint8_t*, H5O_shared_t *sh); static herr_t H5O_shared_encode (H5F_t*, uint8_t*, const void*); static void *H5O_shared_copy(const void *_mesg, void *_dest, unsigned update_flags); -static size_t H5O_shared_size (H5F_t*, const void *_mesg); +static size_t H5O_shared_size (const H5F_t*, const void *_mesg); static herr_t H5O_shared_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg); static herr_t H5O_shared_link(H5F_t *f, hid_t dxpl_id, const void *_mesg); static herr_t H5O_shared_debug (H5F_t*, hid_t dxpl_id, const void*, FILE*, int, int); @@ -385,7 +385,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_shared_size (H5F_t *f, const void *_mesg) +H5O_shared_size (const H5F_t *f, const void *_mesg) { const H5O_shared_t *shared = (const H5O_shared_t *) _mesg; size_t ret_value; diff --git a/src/H5Ostab.c b/src/H5Ostab.c index 0fbda05..e880694 100644 --- a/src/H5Ostab.c +++ b/src/H5Ostab.c @@ -41,7 +41,7 @@ static void *H5O_stab_decode(H5F_t *f, hid_t dxpl_id, const uint8_t *p, H5O_shared_t *sh); static herr_t H5O_stab_encode(H5F_t *f, uint8_t *p, const void *_mesg); static void *H5O_stab_copy(const void *_mesg, void *_dest, unsigned update_flags); -static size_t H5O_stab_size(H5F_t *f, const void *_mesg); +static size_t H5O_stab_size(const H5F_t *f, const void *_mesg); static herr_t H5O_stab_free (void *_mesg); static herr_t H5O_stab_delete(H5F_t *f, hid_t dxpl_id, const void *_mesg); static herr_t H5O_stab_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, @@ -264,7 +264,7 @@ done: *------------------------------------------------------------------------- */ static size_t -H5O_stab_size(H5F_t *f, const void UNUSED *_mesg) +H5O_stab_size(const H5F_t *f, const void UNUSED *_mesg) { size_t ret_value; /* Return value */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index a5e1c3a..7a71c29 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -490,26 +490,16 @@ done: * *------------------------------------------------------------------------- */ -#ifdef H5_WANT_H5_V1_6_COMPAT -herr_t -H5Pget_external(hid_t plist_id, int idx, size_t name_size, char *name/*out*/, - off_t *offset/*out*/, hsize_t *size/*out*/) -#else /* H5_WANT_H5_V1_6_COMPAT */ herr_t H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name/*out*/, off_t *offset/*out*/, hsize_t *size/*out*/) -#endif /* H5_WANT_H5_V1_6_COMPAT */ { H5O_efl_t efl; H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_API(H5Pget_external, FAIL); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5TRACE6("e","iIszxxx",plist_id,idx,name_size,name,offset,size); -#else /* H5_WANT_H5_V1_6_COMPAT */ H5TRACE6("e","iIuzxxx",plist_id,idx,name_size,name,offset,size); -#endif /* H5_WANT_H5_V1_6_COMPAT */ /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id,H5P_DATASET_CREATE))) @@ -519,13 +509,8 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name/*out* if(H5P_get(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list"); -#ifdef H5_WANT_H5_V1_6_COMPAT - if (idx<0 || (size_t)idx>=efl.nused) - HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range"); -#else /* H5_WANT_H5_V1_6_COMPAT */ if (idx>=efl.nused) HGOTO_ERROR (H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range"); -#endif /* H5_WANT_H5_V1_6_COMPAT */ /* Return values */ if (name_size>0 && name) @@ -788,7 +773,7 @@ done: */ #ifdef H5_WANT_H5_V1_6_COMPAT H5Z_filter_t -H5Pget_filter(hid_t plist_id, int idx, unsigned int *flags/*out*/, +H5Pget_filter(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, size_t *cd_nelmts/*in_out*/, unsigned cd_values[]/*out*/, size_t namelen, char name[]/*out*/) #else /* H5_WANT_H5_V1_6_COMPAT */ @@ -807,7 +792,7 @@ H5Pget_filter(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, FUNC_ENTER_API(H5Pget_filter, H5Z_FILTER_ERROR); #ifdef H5_WANT_H5_V1_6_COMPAT - H5TRACE7("Zf","iIsx*zxzx",plist_id,idx,flags,cd_nelmts,cd_values,namelen, + H5TRACE7("Zf","iIux*zxzx",plist_id,idx,flags,cd_nelmts,cd_values,namelen, name); #else /* H5_WANT_H5_V1_6_COMPAT */ H5TRACE7("Zf","iIux*zxzx",plist_id,idx,flags,cd_nelmts,cd_values,namelen, @@ -845,13 +830,8 @@ H5Pget_filter(hid_t plist_id, unsigned idx, unsigned int *flags/*out*/, HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline"); /* Check more args */ -#ifdef H5_WANT_H5_V1_6_COMPAT - if (idx<0 || (size_t)idx>=pline.nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid"); -#else /* H5_WANT_H5_V1_6_COMPAT */ if (idx>=pline.nused) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid"); -#endif /* H5_WANT_H5_V1_6_COMPAT */ /* Set pointer to particular filter to query */ filter=&pline.filter[idx]; @@ -898,7 +878,7 @@ done: * Function: H5Pget_filter_by_id * * Purpose: This is an additional query counterpart of H5Pset_filter() and - * returns information about a particular filter in a permanent + * returns information about a particular filter in a permanent * or transient pipeline depending on whether PLIST_ID is a * dataset creation or transfer property list. On input, * CD_NELMTS indicates the number of entries in the CD_VALUES diff --git a/src/H5Pfcpl.c b/src/H5Pfcpl.c index 25e7b3f..2d20d3f 100644 --- a/src/H5Pfcpl.c +++ b/src/H5Pfcpl.c @@ -29,78 +29,6 @@ /* Static function prototypes */ -#ifdef H5_WANT_H5_V1_6_COMPAT - -/*------------------------------------------------------------------------- - * Function: H5Pget_version - * - * Purpose: Retrieves version information for various parts of a file. - * - * SUPER: The file super block. - * HEAP: The global heap. - * FREELIST: The global free list. - * STAB: The root symbol table entry. - * SHHDR: Shared object headers. - * - * Any (or even all) of the output arguments can be null - * pointers. - * - * Return: Success: Non-negative, version information is returned - * through the arguments. - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Change to the new generic property list. - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pget_version(hid_t plist_id, int *_super/*out*/, int *_freelist/*out*/, - int *_stab/*out*/, int *_shhdr/*out*/) -{ - unsigned super,freelist,stab,shhdr; /* Unsigned versions to query into */ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_API(H5Pget_version, FAIL); - H5TRACE5("e","ixxxx",plist_id,_super,_freelist,_stab,_shhdr); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Get values */ - if (_super) { - if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, &super) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get superblock version"); - *_super=(int)super; - } /* end if */ - if (_freelist) { - if(H5P_get(plist, H5F_CRT_FREESPACE_VERS_NAME, &freelist) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space version"); - *_freelist=(int)freelist; - } /* end if */ - if (_stab) { - if(H5P_get(plist, H5F_CRT_OBJ_DIR_VERS_NAME, &stab) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object directory version"); - *_stab=(int)stab; - } /* end if */ - if (_shhdr) { - if(H5P_get(plist, H5F_CRT_SHARE_HEAD_VERS_NAME, &shhdr) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get shared-header version"); - *_shhdr=(int)shhdr; - } /* end if */ - -done: - FUNC_LEAVE_API(ret_value); -} -#else /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- * Function: H5Pget_version @@ -162,7 +90,6 @@ H5Pget_version(hid_t plist_id, unsigned *super/*out*/, unsigned *freelist/*out*/ done: FUNC_LEAVE_API(ret_value); } -#endif /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- @@ -357,117 +284,6 @@ done: FUNC_LEAVE_API(ret_value); } -#ifdef H5_WANT_H5_V1_6_COMPAT - -/*------------------------------------------------------------------------- - * Function: H5Pset_sym_k - * - * Purpose: IK is one half the rank of a tree that stores a symbol - * table for a group. Internal nodes of the symbol table are on - * average 75% full. That is, the average rank of the tree is - * 1.5 times the value of IK. - * - * LK is one half of the number of symbols that can be stored in - * a symbol table node. A symbol table node is the leaf of a - * symbol table tree which is used to store a group. When - * symbols are inserted randomly into a group, the group's - * symbol table nodes are 75% full on average. That is, they - * contain 1.5 times the number of symbols specified by LK. - * - * Either (or even both) of IK and LK can be zero in which case - * that value is left unchanged. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Tuesday, January 6, 1998 - * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_sym_k(hid_t plist_id, int ik, unsigned lk) -{ - unsigned btree_k[H5B_NUM_BTREE_ID]; - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_API(H5Pset_sym_k, FAIL); - H5TRACE3("e","iIsIu",plist_id,ik,lk); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Set values */ - if (ik > 0) { - if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes"); - btree_k[H5B_SNODE_ID] = (unsigned)ik; - if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree nodes"); - } - if (lk > 0) - if(H5P_set(plist, H5F_CRT_SYM_LEAF_NAME, &lk) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for symbol table leaf nodes"); - -done: - FUNC_LEAVE_API(ret_value); -} - - -/*------------------------------------------------------------------------- - * Function: H5Pget_sym_k - * - * Purpose: Retrieves the symbol table B-tree 1/2 rank (IK) and the - * symbol table leaf node 1/2 size (LK). See H5Pset_sym_k() for - * details. Either (or even both) IK and LK may be null - * pointers. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * - * Modifications: - * - * Raymond Lu - * Changed to the new generic property list. - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pget_sym_k(hid_t plist_id, int *ik /*out */ , unsigned *lk /*out */ ) -{ - unsigned btree_k[H5B_NUM_BTREE_ID]; - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ - - FUNC_ENTER_API(H5Pget_sym_k, FAIL); - H5TRACE3("e","ixx",plist_id,ik,lk); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Get values */ - if (ik) { - if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree nodes"); - *ik = (int)btree_k[H5B_SNODE_ID]; - } - if (lk) - if(H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, lk) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for symbol table leaf nodes"); - -done: - FUNC_LEAVE_API(ret_value); -} -#else /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- * Function: H5Pset_sym_k @@ -577,105 +393,7 @@ H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out */ , unsigned *lk /*out */ ) done: FUNC_LEAVE_API(ret_value); } -#endif /* H5_WANT_H5_V1_6_COMPAT */ - -#ifdef H5_WANT_H5_V1_6_COMPAT - -/*------------------------------------------------------------------------- - * Function: H5Pset_istore_k - * - * Purpose: IK is one half the rank of a tree that stores chunked raw - * data. On average, such a tree will be 75% full, or have an - * average rank of 1.5 times the value of IK. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Tuesday, January 6, 1998 - * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_istore_k(hid_t plist_id, int ik) -{ - unsigned btree_k[H5B_NUM_BTREE_ID]; - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Pset_istore_k, FAIL); - H5TRACE2("e","iIs",plist_id,ik); - - /* Check arguments */ - if (ik <= 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "istore IK value must be positive"); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Set value */ - if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes"); - btree_k[H5B_ISTORE_ID] = (unsigned)ik; - if(H5P_set(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set rank for btree interanl nodes"); - -done: - FUNC_LEAVE_API(ret_value); -} - - -/*------------------------------------------------------------------------- - * Function: H5Pget_istore_k - * - * Purpose: Queries the 1/2 rank of an indexed storage B-tree. See - * H5Pset_istore_k() for details. The argument IK may be the - * null pointer. - * - * Return: Success: Non-negative, size returned through IK - * - * Failure: Negative - * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * - * Modifications: - * - * Raymond Lu, Oct 14, 2001 - * Changed to the new generic property list. - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pget_istore_k(hid_t plist_id, int *ik /*out */ ) -{ - unsigned btree_k[H5B_NUM_BTREE_ID]; - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ - - FUNC_ENTER_API(H5Pget_istore_k, FAIL); - H5TRACE2("e","ix",plist_id,ik); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - - /* Get value */ - if (ik) { - if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, btree_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get rank for btree interanl nodes"); - *ik = (int)btree_k[H5B_ISTORE_ID]; - } - -done: - FUNC_LEAVE_API(ret_value); -} -#else /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- * Function: H5Pset_istore_k @@ -771,5 +489,4 @@ H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out */ ) done: FUNC_LEAVE_API(ret_value); } -#endif /* H5_WANT_H5_V1_6_COMPAT */ diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index e4e3c78..849c34f 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -75,9 +75,9 @@ typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data); #undef H5OPEN #ifndef _H5private_H #define H5OPEN H5open(), -#else /* _H5Pprivate_H */ +#else /* _H5private_H */ #define H5OPEN -#endif /* _H5Pprivate_H */ +#endif /* _H5private_H */ #define H5P_NO_CLASS (H5OPEN H5P_CLS_NO_CLASS_g) #define H5P_FILE_CREATE (H5OPEN H5P_CLS_FILE_CREATE_g) @@ -163,15 +163,9 @@ H5_DLL herr_t H5Pclose_class(hid_t plist_id); H5_DLL herr_t H5Pclose(hid_t plist_id); H5_DLL hid_t H5Pcopy(hid_t plist_id); -#ifdef H5_WANT_H5_V1_6_COMPAT -H5_DLL herr_t H5Pget_version(hid_t plist_id, int *boot/*out*/, - int *freelist/*out*/, int *stab/*out*/, - int *shhdr/*out*/); -#else /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL herr_t H5Pget_version(hid_t plist_id, unsigned *boot/*out*/, unsigned *freelist/*out*/, unsigned *stab/*out*/, unsigned *shhdr/*out*/); -#endif /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL herr_t H5Pset_userblock(hid_t plist_id, hsize_t size); H5_DLL herr_t H5Pget_userblock(hid_t plist_id, hsize_t *size); H5_DLL herr_t H5Pset_alignment(hid_t fapl_id, hsize_t threshold, @@ -182,17 +176,10 @@ H5_DLL herr_t H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size); H5_DLL herr_t H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr/*out*/, size_t *sizeof_size/*out*/); -#ifdef H5_WANT_H5_V1_6_COMPAT -H5_DLL herr_t H5Pset_sym_k(hid_t plist_id, int ik, unsigned lk); -H5_DLL herr_t H5Pget_sym_k(hid_t plist_id, int *ik/*out*/, unsigned *lk/*out*/); -H5_DLL herr_t H5Pset_istore_k(hid_t plist_id, int ik); -H5_DLL herr_t H5Pget_istore_k(hid_t plist_id, int *ik/*out*/); -#else /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL herr_t H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk); H5_DLL herr_t H5Pget_sym_k(hid_t plist_id, unsigned *ik/*out*/, unsigned *lk/*out*/); H5_DLL herr_t H5Pset_istore_k(hid_t plist_id, unsigned ik); H5_DLL herr_t H5Pget_istore_k(hid_t plist_id, unsigned *ik/*out*/); -#endif /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout); H5_DLL H5D_layout_t H5Pget_layout(hid_t plist_id); H5_DLL herr_t H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[]); @@ -202,15 +189,9 @@ H5_DLL ssize_t H5Pget_data_transform(hid_t plist_id, char* expression /*out*/, s H5_DLL herr_t H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size); H5_DLL int H5Pget_external_count(hid_t plist_id); -#ifdef H5_WANT_H5_V1_6_COMPAT -H5_DLL herr_t H5Pget_external(hid_t plist_id, int idx, size_t name_size, - char *name/*out*/, off_t *offset/*out*/, - hsize_t *size/*out*/); -#else /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL herr_t H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name/*out*/, off_t *offset/*out*/, hsize_t *size/*out*/); -#endif /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_info); H5_DLL hid_t H5Pget_driver(hid_t plist_id); @@ -233,7 +214,7 @@ H5_DLL herr_t H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, const unsigned int c_values[]); H5_DLL int H5Pget_nfilters(hid_t plist_id); #ifdef H5_WANT_H5_V1_6_COMPAT -H5_DLL H5Z_filter_t H5Pget_filter(hid_t plist_id, int filter, +H5_DLL H5Z_filter_t H5Pget_filter(hid_t plist_id, unsigned filter, unsigned int *flags/*out*/, size_t *cd_nelmts/*out*/, unsigned cd_values[]/*out*/, @@ -69,9 +69,6 @@ H5FL_DEFINE(H5S_t); /* Declare a free list to manage the array's of hsize_t's */ H5FL_ARR_DEFINE(hsize_t,H5S_MAX_RANK); -/* Declare a free list to manage the array's of hssize_t's */ -H5FL_ARR_DEFINE(hssize_t,H5S_MAX_RANK); - /*-------------------------------------------------------------------------- NAME @@ -1737,7 +1734,6 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc) { size_t extent_size; hssize_t select_size; - H5S_class_t space_type; H5F_t f; /* fake file structure*/ herr_t ret_value = SUCCEED; @@ -1751,9 +1747,6 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc) if((extent_size=H5O_raw_size(H5O_SDSPACE_ID, &f, obj))==0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size"); - /* Get space type */ - space_type = H5S_GET_EXTENT_TYPE(obj); - if((select_size=H5S_SELECT_SERIAL_SIZE(obj))<0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size"); @@ -1771,7 +1764,7 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc) *buf++ = H5S_ENCODE_VERSION; /* Encode the "size of size" information */ - *buf++ = f.shared->sizeof_size; + *buf++ = (unsigned char)f.shared->sizeof_size; /* Encode size of extent information. Pointer is actually moved in this macro. */ UINT32ENCODE(buf, extent_size); @@ -1917,6 +1910,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5S_raw_size + * + * Purpose: Compute the 'raw' size of the extent, as stored on disk. + * + * Return: Success: non-zero + * Failure: zero + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * October 14, 2004 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +size_t +H5S_raw_size(const H5F_t *f, const H5S_t *space) +{ + size_t ret_value; + + FUNC_ENTER_NOAPI(H5S_raw_size, 0); + + /* Find out the size of buffer needed for extent */ + ret_value=H5O_raw_size(H5O_SDSPACE_ID, f, &(space->extent)); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5S_raw_size() */ + + +/*------------------------------------------------------------------------- * Function: H5S_get_simple_extent_type * * Purpose: Internal function for retrieving the type of extent for a dataspace object @@ -352,11 +352,11 @@ done: PURPOSE Count the number of objects in a skip list USAGE - ssize_t H5SL_count(slist) + size_t H5SL_count(slist) H5SL_t *slist; IN: Pointer to skip list to count RETURNS - Returns non-negative on success, negative on failure. + Returns number of objects on success, can't fail DESCRIPTION Count elements in a skip list. GLOBAL VARIABLES @@ -364,7 +364,7 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -ssize_t +size_t H5SL_count(H5SL_t *slist) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5SL_count); diff --git a/src/H5SLprivate.h b/src/H5SLprivate.h index 633e3e5..5ee6ac4 100644 --- a/src/H5SLprivate.h +++ b/src/H5SLprivate.h @@ -58,7 +58,7 @@ typedef herr_t (*H5SL_operator_t)(void *item, void *key, /* Private routines */ /********************/ H5_DLL H5SL_t *H5SL_create(H5SL_type_t type, double p, size_t max_level); -H5_DLL ssize_t H5SL_count(H5SL_t *slist); +H5_DLL size_t H5SL_count(H5SL_t *slist); H5_DLL herr_t H5SL_insert(H5SL_t *slist, void *item, void *key); H5_DLL void *H5SL_remove(H5SL_t *slist, void *key); H5_DLL void *H5SL_search(H5SL_t *slist, void *key); diff --git a/src/H5Sall.c b/src/H5Sall.c index 5c124a6..5472d42 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -43,15 +43,15 @@ static htri_t H5S_all_is_valid(const H5S_t *space); static hssize_t H5S_all_serial_size(const H5S_t *space); static herr_t H5S_all_serialize(const H5S_t *space, uint8_t *buf); static herr_t H5S_all_deserialize(H5S_t *space, const uint8_t *buf); -static herr_t H5S_all_bounds(const H5S_t *space, hssize_t *start, hssize_t *end); +static herr_t H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static htri_t H5S_all_is_contiguous(const H5S_t *space); static htri_t H5S_all_is_single(const H5S_t *space); static htri_t H5S_all_is_regular(const H5S_t *space); static herr_t H5S_all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); /* Selection iteration callbacks */ -static herr_t H5S_all_iter_coords(const H5S_sel_iter_t *iter, hssize_t *coords); -static herr_t H5S_all_iter_block(const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end); +static herr_t H5S_all_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); +static herr_t H5S_all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S_all_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S_all_iter_has_next_block(const H5S_sel_iter_t *iter); static herr_t H5S_all_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); @@ -145,7 +145,7 @@ H5S_all_iter_init (H5S_sel_iter_t *iter, const H5S_t *space) *------------------------------------------------------------------------- */ static herr_t -H5S_all_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords) +H5S_all_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords) { herr_t ret_value=SUCCEED; /* Return value */ @@ -180,7 +180,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5S_all_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end) +H5S_all_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) { unsigned u; /* Local index variable */ @@ -565,8 +565,8 @@ done: USAGE herr_t H5S_all_bounds(space, start, end) H5S_t *space; IN: Dataspace pointer of selection to query - hssize_t *start; OUT: Starting coordinate of bounding box - hssize_t *end; OUT: Opposite coordinate of bounding box + hsize_t *start; OUT: Starting coordinate of bounding box + hsize_t *end; OUT: Opposite coordinate of bounding box RETURNS Non-negative on success, negative on failure DESCRIPTION @@ -583,7 +583,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_all_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) +H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) { int rank; /* Dataspace rank */ int i; /* index variable */ @@ -600,7 +600,7 @@ H5S_all_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) /* Just copy over the complete extent */ for(i=0; i<rank; i++) { start[i]=0; - H5_ASSIGN_OVERFLOW(end[i],space->extent.size[i]-1,hsize_t,hssize_t); + end[i]=space->extent.size[i]-1; } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED); diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 5a01f6a..fac113c 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -41,7 +41,7 @@ static H5S_hyper_span_info_t *H5S_hyper_copy_span (H5S_hyper_span_info_t *spans) static herr_t H5S_hyper_span_scratch (H5S_hyper_span_info_t *spans, void *scr_value); static herr_t H5S_hyper_span_precompute (H5S_hyper_span_info_t *spans, size_t elmt_size); static herr_t H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, - const hssize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]); + const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]); static herr_t H5S_hyper_generate_spans(H5S_t *space); /* Needed for use in hyperslab code (H5Shyper.c) */ #ifdef NEW_HYPERSLAB_API @@ -58,15 +58,15 @@ static htri_t H5S_hyper_is_valid(const H5S_t *space); static hssize_t H5S_hyper_serial_size(const H5S_t *space); static herr_t H5S_hyper_serialize(const H5S_t *space, uint8_t *buf); static herr_t H5S_hyper_deserialize(H5S_t *space, const uint8_t *buf); -static herr_t H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end); +static herr_t H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static htri_t H5S_hyper_is_contiguous(const H5S_t *space); static htri_t H5S_hyper_is_single(const H5S_t *space); static htri_t H5S_hyper_is_regular(const H5S_t *space); static herr_t H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); /* Selection iteration callbacks */ -static herr_t H5S_hyper_iter_coords(const H5S_sel_iter_t *iter, hssize_t *coords); -static herr_t H5S_hyper_iter_block(const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end); +static herr_t H5S_hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); +static herr_t H5S_hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S_hyper_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S_hyper_iter_has_next_block(const H5S_sel_iter_t *sel_iter); static herr_t H5S_hyper_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); @@ -415,7 +415,7 @@ H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) *------------------------------------------------------------------------- */ static herr_t -H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords) +H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_iter_coords); @@ -435,17 +435,16 @@ H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords) flat_dim=iter->u.hyp.iter_rank-1; /* Copy the coordinates up to where things got flattened */ - HDmemcpy(coords,iter->u.hyp.off,sizeof(hssize_t)*flat_dim); + HDmemcpy(coords,iter->u.hyp.off,sizeof(hsize_t)*flat_dim); /* Compute the coordinates for the flattened dimensions */ - H5_CHECK_OVERFLOW(iter->u.hyp.off[flat_dim],hssize_t,hsize_t); - H5V_array_calc((hsize_t)iter->u.hyp.off[flat_dim],iter->rank-flat_dim,&(iter->dims[flat_dim]),&(coords[flat_dim])); + H5V_array_calc(iter->u.hyp.off[flat_dim],iter->rank-flat_dim,&(iter->dims[flat_dim]),&(coords[flat_dim])); } /* end if */ else - HDmemcpy(coords,iter->u.hyp.off,sizeof(hssize_t)*iter->rank); + HDmemcpy(coords,iter->u.hyp.off,sizeof(hsize_t)*iter->rank); } /* end if */ else - HDmemcpy(coords,iter->u.hyp.off,sizeof(hssize_t)*iter->rank); + HDmemcpy(coords,iter->u.hyp.off,sizeof(hsize_t)*iter->rank); FUNC_LEAVE_NOAPI(SUCCEED); } /* H5S_hyper_iter_coords() */ @@ -470,7 +469,7 @@ H5S_hyper_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords) *------------------------------------------------------------------------- */ static herr_t -H5S_hyper_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end) +H5S_hyper_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) { unsigned u; /* Local index variable */ @@ -562,7 +561,7 @@ H5S_hyper_iter_has_next_block(const H5S_sel_iter_t *iter) /* Check for a single "regular" hyperslab */ if(iter->u.hyp.diminfo_valid) { const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */ - const hssize_t *toff; /* Temporary offset in selection */ + const hsize_t *toff; /* Temporary offset in selection */ /* Check if the offset of the iterator is at the last location in all dimensions */ tdiminfo=iter->u.hyp.diminfo; @@ -571,8 +570,7 @@ H5S_hyper_iter_has_next_block(const H5S_sel_iter_t *iter) /* If there is only one block, continue */ if(tdiminfo[u].count==1) continue; - H5_CHECK_OVERFLOW(tdiminfo[u].start+((tdiminfo[u].count-1)*tdiminfo[u].stride),hsize_t,hssize_t); - if(toff[u]!=(hssize_t)(tdiminfo[u].start+((tdiminfo[u].count-1)*tdiminfo[u].stride))) + if(toff[u]!=(tdiminfo[u].start+((tdiminfo[u].count-1)*tdiminfo[u].stride))) HGOTO_DONE(TRUE); } /* end for */ } /* end if */ @@ -705,7 +703,7 @@ H5S_hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) else { H5S_hyper_span_t *curr_span; /* Current hyperslab span node */ H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ - hssize_t *abs_arr; /* Absolute hyperslab span position */ + hsize_t *abs_arr; /* Absolute hyperslab span position */ int curr_dim; /* Temporary rank holder */ /* Set the rank of the fastest changing dimension */ @@ -905,7 +903,7 @@ H5S_hyper_iter_next_block(H5S_sel_iter_t *iter) else { H5S_hyper_span_t *curr_span; /* Current hyperslab span node */ H5S_hyper_span_t **ispan; /* Iterator's hyperslab span nodes */ - hssize_t *abs_arr; /* Absolute hyperslab span position */ + hsize_t *abs_arr; /* Absolute hyperslab span position */ int curr_dim; /* Temporary rank holder */ /* Set the rank of the fastest changing dimension */ @@ -1031,7 +1029,7 @@ H5S_hyper_iter_release (H5S_sel_iter_t *iter) Make a new hyperslab span node USAGE H5S_hyper_span_t *H5S_hyper_new_span(low, high, down, next) - hssize_t low, high; IN: Low and high bounds for new span node + hsize_t low, high; IN: Low and high bounds for new span node H5S_hyper_span_info_t *down; IN: Down span tree for new node H5S_hyper_span_t *next; IN: Next span for new node RETURNS @@ -1046,7 +1044,7 @@ H5S_hyper_iter_release (H5S_sel_iter_t *iter) REVISION LOG --------------------------------------------------------------------------*/ static H5S_hyper_span_t * -H5S_hyper_new_span (hssize_t low, hssize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next) +H5S_hyper_new_span (hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next) { H5S_hyper_span_t *ret_value; @@ -1665,10 +1663,10 @@ H5S_hyper_is_valid_helper (const H5S_hyper_span_info_t *spans, const hssize_t *o while(curr!=NULL && ret_value==TRUE) { /* Check if an offset has been defined */ /* Bounds check the selected point + offset against the extent */ - if(((curr->low+offset[rank])>=(hssize_t)size[rank]) - || ((curr->low+offset[rank])<0) - || ((curr->high+offset[rank])>=(hssize_t)size[rank]) - || ((curr->high+offset[rank])<0)) { + if((((hssize_t)curr->low+offset[rank])>=(hssize_t)size[rank]) + || (((hssize_t)curr->low+offset[rank])<0) + || (((hssize_t)curr->high+offset[rank])>=(hssize_t)size[rank]) + || (((hssize_t)curr->high+offset[rank])<0)) { ret_value=FALSE; break; } /* end if */ @@ -1730,12 +1728,12 @@ H5S_hyper_is_valid (const H5S_t *space) /* no data point is chosen */ if (diminfo[u].count && diminfo[u].block) { /* Bounds check the start point in this dimension */ - if((diminfo[u].start+space->select.offset[u])<0 || - (diminfo[u].start+space->select.offset[u])>=(hssize_t)space->extent.size[u]) + if(((hssize_t)diminfo[u].start+space->select.offset[u])<0 || + ((hssize_t)diminfo[u].start+space->select.offset[u])>=(hssize_t)space->extent.size[u]) HGOTO_DONE(FALSE) /* Compute the largest location in this dimension */ - end=diminfo[u].start+diminfo[u].stride*(diminfo[u].count-1)+(diminfo[u].block-1)+space->select.offset[u]; + end=(hssize_t)(diminfo[u].start+diminfo[u].stride*(diminfo[u].count-1)+(diminfo[u].block-1))+space->select.offset[u]; /* Bounds check the end point in this dimension */ if(end<0 || end>=(hssize_t)space->extent.size[u]) @@ -1956,7 +1954,7 @@ H5S_hyper_serial_size (const H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hssize_t *start, hssize_t *end, hsize_t rank, uint8_t **buf) +H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start, hsize_t *end, hsize_t rank, uint8_t **buf) { H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */ hsize_t u; /* Index variable */ @@ -2035,10 +2033,10 @@ H5S_hyper_serialize (const H5S_t *space, uint8_t *buf) { const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */ - hssize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ - hssize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */ - hssize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */ - hssize_t temp_off; /* Offset in a given dimension */ + hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ + hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */ + hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */ + hsize_t temp_off; /* Offset in a given dimension */ uint8_t *lenp; /* pointer to length location for later storage */ uint32_t len=0; /* number of bytes used */ int i; /* local counting variable */ @@ -2194,13 +2192,13 @@ H5S_hyper_deserialize (H5S_t *space, const uint8_t *buf) { uint32_t rank; /* rank of points */ size_t num_elem=0; /* number of elements in selection */ - hssize_t start[H5O_LAYOUT_NDIMS]; /* hyperslab start information */ - hssize_t end[H5O_LAYOUT_NDIMS]; /* hyperslab end information */ + hsize_t start[H5O_LAYOUT_NDIMS]; /* hyperslab start information */ + hsize_t end[H5O_LAYOUT_NDIMS]; /* hyperslab end information */ hsize_t stride[H5O_LAYOUT_NDIMS]; /* hyperslab stride information */ hsize_t count[H5O_LAYOUT_NDIMS]; /* hyperslab count information */ hsize_t block[H5O_LAYOUT_NDIMS]; /* hyperslab block information */ - hssize_t *tstart=NULL; /* temporary hyperslab pointers */ - hssize_t *tend=NULL; /* temporary hyperslab pointers */ + hsize_t *tstart=NULL; /* temporary hyperslab pointers */ + hsize_t *tend=NULL; /* temporary hyperslab pointers */ hsize_t *tstride=NULL; /* temporary hyperslab pointers */ hsize_t *tcount=NULL; /* temporary hyperslab pointers */ hsize_t *tblock=NULL; /* temporary hyperslab pointers */ @@ -2258,8 +2256,8 @@ done: USAGE herr_t H5S_hyper_span_blocklist(spans, start, end, rank, startblock, numblocks, buf) H5S_hyper_span_info_t *spans; IN: Dataspace pointer of selection to query - hssize_t start[]; IN/OUT: Accumulated start points - hssize_t end[]; IN/OUT: Accumulated end points + hsize_t start[]; IN/OUT: Accumulated start points + hsize_t end[]; IN/OUT: Accumulated end points hsize_t rank; IN: Rank of dataspace hsize_t *startblock; IN/OUT: Hyperslab block to start with hsize_t *numblocks; IN/OUT: Number of hyperslab blocks to get @@ -2284,7 +2282,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_hyper_span_blocklist(H5S_hyper_span_info_t *spans, hssize_t start[], hssize_t end[], hsize_t rank, hsize_t *startblock, hsize_t *numblocks, hsize_t **buf) +H5S_hyper_span_blocklist(H5S_hyper_span_info_t *spans, hsize_t start[], hsize_t end[], hsize_t rank, hsize_t *startblock, hsize_t *numblocks, hsize_t **buf) { H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */ hsize_t u; /* Index variable */ @@ -2389,10 +2387,10 @@ H5S_get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startbloc { H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */ - hssize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ - hssize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */ - hssize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */ - hssize_t temp_off; /* Offset in a given dimension */ + hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ + hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */ + hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */ + hsize_t temp_off; /* Offset in a given dimension */ int i; /* Counter */ int fast_dim; /* Rank of the fastest changing dimension for the dataspace */ int temp_dim; /* Temporary rank holder */ @@ -2592,12 +2590,12 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *offset, hsize_t rank, hssize_t *start, hssize_t *end) +H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *offset, hsize_t rank, hsize_t *start, hsize_t *end) { H5S_hyper_span_t *curr; /* Hyperslab information nodes */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_bounds_helper); + FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_bounds_helper) assert(spans); assert(offset); @@ -2608,6 +2606,10 @@ H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *off /* Check each point to determine whether selection+offset is within extent */ curr=spans->head; while(curr!=NULL) { + /* Check for offset moving selection negative */ + if(((hssize_t)curr->low+offset[rank])<0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds") + /* Check if the current span extends the bounding box */ if((curr->low+offset[rank])<start[rank]) start[rank]=curr->low+offset[rank]; @@ -2617,7 +2619,7 @@ H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *off /* Recurse if this node has down spans */ if(curr->down!=NULL) { if(H5S_hyper_bounds_helper(curr->down,offset,rank+1,start,end)<0) - HGOTO_DONE(FAIL) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "failure in lower dimension") } /* end if */ /* Advance to next node */ @@ -2625,7 +2627,7 @@ H5S_hyper_bounds_helper (const H5S_hyper_span_info_t *spans, const hssize_t *off } /* end while */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_bounds_helper() */ @@ -2656,13 +2658,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) +H5S_hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) { int rank; /* Dataspace rank */ int i; /* index variable */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOFUNC(H5S_hyper_bounds); + FUNC_ENTER_NOAPI(H5S_hyper_bounds,FAIL) assert(space); assert(start); @@ -2671,8 +2673,8 @@ H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) /* Set the start and end arrays up */ rank=space->extent.rank; for(i=0; i<rank; i++) { - start[i]=HSSIZET_MAX; - end[i]=HSSIZET_MIN; + start[i]=HSIZET_MAX; + end[i]=0; } /* end for */ /* Check for a "regular" hyperslab selection */ @@ -2681,6 +2683,10 @@ H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) /* Check each dimension */ for(i=0; i<rank; i++) { + /* Check for offset moving selection negative */ + if((space->select.offset[i]+(hssize_t)diminfo[i].start)<0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds") + /* Compute the smallest location in this dimension */ start[i]=diminfo[i].start+space->select.offset[i]; @@ -2693,7 +2699,8 @@ H5S_hyper_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) ret_value=H5S_hyper_bounds_helper(space->select.sel_info.hslab->span_lst,space->select.offset,(hsize_t)0,start,end); } /* end if */ - FUNC_LEAVE_NOAPI(ret_value); +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_hyper_bounds() */ @@ -2819,7 +2826,7 @@ H5S_hyper_is_contiguous(const H5S_t *space) } /* end if */ else { /* If this span doesn't cover the entire dimension, then this selection isn't contiguous */ - if(((span->high-span->low)+1)!=(hssize_t)space->extent.size[u]) { + if(((span->high-span->low)+1)!=space->extent.size[u]) { large_contiguous=FALSE; break; } /* end if */ @@ -3088,7 +3095,7 @@ H5S_hyper_recover_span (unsigned *recover, H5S_hyper_span_t **curr_span, H5S_hyp USAGE H5S_hyper_span_t *H5S_hyper_coord_to_span(rank, coords) unsigned rank; IN: Number of dimensions of coordinate - hssize_t *coords; IN: Location of element + hsize_t *coords; IN: Location of element RETURNS Non-negative on success, negative on failure DESCRIPTION @@ -3099,7 +3106,7 @@ H5S_hyper_recover_span (unsigned *recover, H5S_hyper_span_t **curr_span, H5S_hyp REVISION LOG --------------------------------------------------------------------------*/ static H5S_hyper_span_t * -H5S_hyper_coord_to_span(unsigned rank, hssize_t *coords) +H5S_hyper_coord_to_span(unsigned rank, hsize_t *coords) { H5S_hyper_span_t *new_span; /* Pointer to new span tree for coordinate */ H5S_hyper_span_info_t *down=NULL; /* Pointer to new span tree for next level down */ @@ -3153,7 +3160,7 @@ done: herr_t H5S_hyper_add_span_element_helper(prev_span, span_tree, rank, coords) H5S_hyper_span_info_t *span_tree; IN/OUT: Pointer to span tree to append to unsigned rank; IN: Number of dimensions of coordinates - hssize_t *coords; IN: Location of element to add to span tree + hsize_t *coords; IN: Location of element to add to span tree RETURNS Non-negative on success, negative on failure DESCRIPTION @@ -3165,7 +3172,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned rank, hssize_t *coords) +H5S_hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned rank, hsize_t *coords) { H5S_hyper_span_info_t *tspan_info; /* Temporary pointer to span info */ H5S_hyper_span_info_t *prev_span_info; /* Pointer to span info for level above current position */ @@ -3355,7 +3362,7 @@ done: herr_t H5S_hyper_add_span_element(space, span_tree, rank, coords) H5S_t *space; IN/OUT: Pointer to dataspace to add coordinate to unsigned rank; IN: Number of dimensions of coordinates - hssize_t *coords; IN: Location of element to add to span tree + hsize_t *coords; IN: Location of element to add to span tree RETURNS Non-negative on success, negative on failure DESCRIPTION @@ -3367,7 +3374,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hssize_t *coords) +H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hsize_t *coords) { herr_t ret_value=SUCCEED; /* Return value */ @@ -3496,7 +3503,7 @@ H5S_hyper_convert(H5S_t *space) case H5S_SEL_ALL: /* All elements selected in dataspace */ /* Convert current "all" selection to "real" hyperslab selection */ { - hssize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */ + hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */ hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */ hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */ hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */ @@ -3658,9 +3665,9 @@ done: htri_t H5S_hyper_intersect_block_helper(spans, start, end) H5S_hyper_span_info_t *spans; IN: First span tree to operate with hssize_t *offset; IN: Selection offset coordinate - hssize_t *start; IN: Starting coordinate for block - hssize_t *end; IN: Ending coordinate for block - RETURNS + hsize_t *start; IN: Starting coordinate for block + hsize_t *end; IN: Ending coordinate for block + RETURN Non-negative on success, negative on failure DESCRIPTION Quickly detect intersections between span tree and block @@ -3670,7 +3677,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static htri_t -H5S_hyper_intersect_block_helper (const H5S_hyper_span_info_t *spans, hssize_t *offset, hssize_t *start, hssize_t *end) +H5S_hyper_intersect_block_helper (const H5S_hyper_span_info_t *spans, hssize_t *offset, hsize_t *start, hsize_t *end) { H5S_hyper_span_t *curr; /* Pointer to current span in 1st span tree */ htri_t status; /* Status from recursive call */ @@ -3690,11 +3697,11 @@ H5S_hyper_intersect_block_helper (const H5S_hyper_span_info_t *spans, hssize_t * /* Iterate over the spans in the tree */ while(curr!=NULL) { /* Check for span entirely before block */ - if((curr->high+*offset)<*start) + if(((hssize_t)curr->high+*offset)<(hssize_t)*start) /* Advance to next span in this dimension */ curr=curr->next; /* If this span is past the end of the block, then we're done in this dimension */ - else if((curr->low+*offset)>*end) + else if(((hssize_t)curr->low+*offset)>(hssize_t)*end) HGOTO_DONE(FALSE) /* block & span overlap */ else { @@ -3740,7 +3747,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ htri_t -H5S_hyper_intersect_block (H5S_t *space, hssize_t *start, hssize_t *end) +H5S_hyper_intersect_block (H5S_t *space, hsize_t *start, hsize_t *end) { htri_t ret_value=FAIL; /* Return value */ @@ -3756,7 +3763,7 @@ H5S_hyper_intersect_block (H5S_t *space, hssize_t *start, hssize_t *end) if(H5S_GET_SELECT_TYPE(space)==H5S_SEL_ALL) HGOTO_DONE(TRUE); - /* Check that the space selections both have span trees */ + /* Check that the space selection has a span tree */ if(space->select.sel_info.hslab->span_lst==NULL) if(H5S_hyper_generate_spans(space)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree"); @@ -3772,11 +3779,120 @@ done: /*-------------------------------------------------------------------------- NAME - H5S_hyper_adjust_helper + H5S_hyper_adjust_helper_u PURPOSE Helper routine to adjust offsets in span trees USAGE - herr_t H5S_hyper_adjust_helper(spans, offset) + herr_t H5S_hyper_adjust_helper_u(spans, offset) + H5S_hyper_span_info_t *spans; IN: Span tree to operate with + const hsize_t *offset; IN: Offset to subtract + RETURNS + Non-negative on success, negative on failure + DESCRIPTION + Adjust the location of the spans in a span tree by subtracting an offset + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +static herr_t +H5S_hyper_adjust_helper_u (H5S_hyper_span_info_t *spans, const hsize_t *offset) +{ + H5S_hyper_span_t *span; /* Pointer to current span in span tree */ + + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_adjust_helper_u); + + /* Sanity check */ + assert(spans); + assert(offset); + + /* Check if we've already set this down span tree */ + if(spans->scratch!=(H5S_hyper_span_info_t *)~((size_t)NULL)) { + /* Set the tree's scratch pointer */ + spans->scratch=(H5S_hyper_span_info_t *)~((size_t)NULL); + + /* Get the span lists for each span in this tree */ + span=spans->head; + + /* Iterate over the spans in tree */ + while(span!=NULL) { + /* Adjust span offset */ + assert(span->low>=*offset); + span->low-=*offset; + span->high-=*offset; + + /* Recursively adjust spans in next dimension down */ + if(span->down!=NULL) + H5S_hyper_adjust_helper_u(span->down,offset+1); + + /* Advance to next span in this dimension */ + span=span->next; + } /* end while */ + } /* end if */ + + FUNC_LEAVE_NOAPI(SUCCEED); +} /* H5S_hyper_adjust_helper_u() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S_hyper_adjust_u + PURPOSE + Adjust a hyperslab selection by subtracting an offset + USAGE + herr_t H5S_hyper_adjust_u(space,offset) + H5S_t *space; IN/OUT: Pointer to dataspace to adjust + const hsize_t *offset; IN: Offset to subtract + RETURNS + Non-negative on success, negative on failure + DESCRIPTION + Moves a hyperslab selection by subtracting an offset from it. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5S_hyper_adjust_u(H5S_t *space, const hsize_t *offset) +{ + unsigned u; /* Local index variable */ + herr_t ret_value=SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust_u); + + assert(space); + assert(offset); + + /* Subtract the offset from the "regular" coordinates, if they exist */ + if(space->select.sel_info.hslab->diminfo_valid) { + for(u=0; u<space->extent.rank; u++) { + assert(space->select.sel_info.hslab->opt_diminfo[u].start>=offset[u]); + space->select.sel_info.hslab->opt_diminfo[u].start-=offset[u]; + } /* end for */ + } /* end if */ + + /* Subtract the offset from the span tree coordinates, if they exist */ + if(space->select.sel_info.hslab->span_lst) { + if(H5S_hyper_adjust_helper_u(space->select.sel_info.hslab->span_lst,offset)<0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset adjustment"); + + /* Reset the scratch pointers for the next routine which needs them */ + if(H5S_hyper_span_scratch(space->select.sel_info.hslab->span_lst,NULL)==FAIL) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't reset hyperslab scratch pointer"); + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* H5S_hyper_adjust_u() */ + + +/*-------------------------------------------------------------------------- + NAME + H5S_hyper_adjust_helper_s + PURPOSE + Helper routine to adjust offsets in span trees + USAGE + herr_t H5S_hyper_adjust_helper_s(spans, offset) H5S_hyper_span_info_t *spans; IN: Span tree to operate with const hssize_t *offset; IN: Offset to subtract RETURNS @@ -3789,11 +3905,11 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_hyper_adjust_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset) +H5S_hyper_adjust_helper_s (H5S_hyper_span_info_t *spans, const hssize_t *offset) { H5S_hyper_span_t *span; /* Pointer to current span in span tree */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_adjust_helper); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_adjust_helper_s); /* Sanity check */ assert(spans); @@ -3810,14 +3926,13 @@ H5S_hyper_adjust_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset) /* Iterate over the spans in tree */ while(span!=NULL) { /* Adjust span offset */ + assert((hssize_t)span->low>=*offset); span->low-=*offset; - assert(span->low>=0); span->high-=*offset; - assert(span->high>=0); /* Recursively adjust spans in next dimension down */ if(span->down!=NULL) - H5S_hyper_adjust_helper(span->down,offset+1); + H5S_hyper_adjust_helper_s(span->down,offset+1); /* Advance to next span in this dimension */ span=span->next; @@ -3825,16 +3940,16 @@ H5S_hyper_adjust_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset) } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED); -} /* H5S_hyper_adjust_helper() */ +} /* H5S_hyper_adjust_helper_s() */ /*-------------------------------------------------------------------------- NAME - H5S_hyper_adjust + H5S_hyper_adjust_s PURPOSE Adjust a hyperslab selection by subtracting an offset USAGE - herr_t H5S_hyper_adjust(space,offset) + herr_t H5S_hyper_adjust_s(space,offset) H5S_t *space; IN/OUT: Pointer to dataspace to adjust const hssize_t *offset; IN: Offset to subtract RETURNS @@ -3847,12 +3962,12 @@ H5S_hyper_adjust_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_hyper_adjust(H5S_t *space, const hssize_t *offset) +H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset) { unsigned u; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust); + FUNC_ENTER_NOAPI_NOINIT(H5S_hyper_adjust_s); assert(space); assert(offset); @@ -3860,14 +3975,14 @@ H5S_hyper_adjust(H5S_t *space, const hssize_t *offset) /* Subtract the offset from the "regular" coordinates, if they exist */ if(space->select.sel_info.hslab->diminfo_valid) { for(u=0; u<space->extent.rank; u++) { + assert((hssize_t)space->select.sel_info.hslab->opt_diminfo[u].start>=offset[u]); space->select.sel_info.hslab->opt_diminfo[u].start-=offset[u]; - assert(space->select.sel_info.hslab->opt_diminfo[u].start>=0); } /* end for */ } /* end if */ /* Subtract the offset from the span tree coordinates, if they exist */ if(space->select.sel_info.hslab->span_lst) { - if(H5S_hyper_adjust_helper(space->select.sel_info.hslab->span_lst,offset)<0) + if(H5S_hyper_adjust_helper_s(space->select.sel_info.hslab->span_lst,offset)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab offset adjustment"); /* Reset the scratch pointers for the next routine which needs them */ @@ -3877,7 +3992,7 @@ H5S_hyper_adjust(H5S_t *space, const hssize_t *offset) done: FUNC_LEAVE_NOAPI(ret_value); -} /* H5S_hyper_adjust() */ +} /* H5S_hyper_adjust_s() */ /*-------------------------------------------------------------------------- @@ -3921,10 +4036,9 @@ H5S_hyper_move_helper (H5S_hyper_span_info_t *spans, const hssize_t *offset) /* Iterate over the spans in tree */ while(span!=NULL) { /* Adjust span location */ + assert(*offset>=0); span->high=*offset+(span->high-span->low); - assert(span->high>=0); span->low=*offset; - assert(span->low>=0); /* Recursively move spans in next dimension down */ if(span->down!=NULL) @@ -3971,8 +4085,8 @@ H5S_hyper_move(H5S_t *space, const hssize_t *offset) /* Move to the offset with the "regular" coordinates, if they exist */ if(space->select.sel_info.hslab->diminfo_valid) { for(u=0; u<space->extent.rank; u++) { + assert(offset[u]>=0); space->select.sel_info.hslab->opt_diminfo[u].start=offset[u]; - assert(space->select.sel_info.hslab->opt_diminfo[u].start>=0); } /* end for */ } /* end if */ @@ -4028,7 +4142,7 @@ H5S_hyper_normalize_offset(H5S_t *space) space->select.offset[u] =- space->select.offset[u]; /* Call the existing 'adjust' routine */ - if(H5S_hyper_adjust(space, space->select.offset)<0) + if(H5S_hyper_adjust_s(space, space->select.offset)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSELECT, FAIL, "can't perform hyperslab normalization"); /* Zero out the selection offset */ @@ -4050,7 +4164,7 @@ done: herr_t H5S_hyper_append_span(prev_span, span_tree, low, high, down, next) H5S_hyper_span_t **prev_span; IN/OUT: Pointer to previous span in list H5S_hyper_span_info_t **span_tree; IN/OUT: Pointer to span tree to append to - hssize_t low, high; IN: Low and high bounds for new span node + hsize_t low, high; IN: Low and high bounds for new span node H5S_hyper_span_info_t *down; IN: Down span tree for new node H5S_hyper_span_t *next; IN: Next span for new node RETURNS @@ -4064,7 +4178,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** span_tree, hssize_t low, hssize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next) +H5S_hyper_append_span (H5S_hyper_span_t **prev_span, H5S_hyper_span_info_t ** span_tree, hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_hyper_span_t *next) { H5S_hyper_span_t *new_span; herr_t ret_value=SUCCEED; /* Return value */ @@ -5022,7 +5136,7 @@ H5S_hyper_merge_spans (H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t c PURPOSE Count the number of elements in a span tree USAGE - hssize_t H5S_hyper_spans_nelem(spans) + hsize_t H5S_hyper_spans_nelem(spans) const H5S_hyper_span_info_t *spans; IN: Hyperslan span tree to count elements of RETURNS Number of elements in span tree on success; negative on failure @@ -5033,11 +5147,11 @@ H5S_hyper_merge_spans (H5S_t *space, H5S_hyper_span_info_t *new_spans, hbool_t c EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static hssize_t +static hsize_t H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans) { H5S_hyper_span_t *span; /* Hyperslab span */ - hssize_t ret_value; + hsize_t ret_value; FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_hyper_spans_nelem); @@ -5072,7 +5186,7 @@ H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans) USAGE H5S_hyper_span_t *H5S_hyper_make_spans(rank, start, stride, count, block) unsigned rank; IN: # of dimensions of the space - const hssize_t *start; IN: Starting location of the hyperslabs + const hsize_t *start; IN: Starting location of the hyperslabs const hsize_t *stride; IN: Stride from the beginning of one block to the next const hsize_t *count; IN: Number of blocks @@ -5090,7 +5204,7 @@ H5S_hyper_spans_nelem (H5S_hyper_span_info_t *spans) REVISION LOG --------------------------------------------------------------------------*/ static H5S_hyper_span_info_t * -H5S_hyper_make_spans (unsigned rank, const hssize_t *start, const hsize_t *stride, +H5S_hyper_make_spans (unsigned rank, const hsize_t *start, const hsize_t *stride, const hsize_t *count, const hsize_t *block) { H5S_hyper_span_info_t *down;/* Pointer to spans in next dimension down */ @@ -5320,7 +5434,7 @@ H5S_hyper_rebuild (H5S_t *space) static herr_t H5S_hyper_generate_spans(H5S_t *space) { - hssize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */ + hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */ hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */ hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */ hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */ @@ -5366,7 +5480,7 @@ done: */ static herr_t H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, - const hssize_t start[], + const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]) @@ -5375,7 +5489,6 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, H5S_hyper_span_info_t *a_not_b=NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */ H5S_hyper_span_info_t *a_and_b=NULL; /* Span tree for hyperslab spans in both old and new span trees */ H5S_hyper_span_info_t *b_not_a=NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */ - hssize_t nelem; /* Number of elements in hyperslab span tree */ htri_t status; /* Status from internal calls */ herr_t ret_value=SUCCEED; /* Return value */ @@ -5400,9 +5513,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Set the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(new_spans))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - space->select.num_elem=nelem; + space->select.num_elem=H5S_hyper_spans_nelem(new_spans); /* Indicate that the new_spans are owned */ new_spans=NULL; @@ -5420,9 +5531,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(b_not_a))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - space->select.num_elem+=nelem; + space->select.num_elem+=H5S_hyper_spans_nelem(b_not_a); } /* end if */ break; @@ -5441,9 +5550,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(a_and_b))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - space->select.num_elem=nelem; + space->select.num_elem=H5S_hyper_spans_nelem(a_and_b); /* Indicate that the a_and_b spans are owned */ a_and_b=NULL; @@ -5465,18 +5572,14 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(a_not_b))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - space->select.num_elem=nelem; + space->select.num_elem=H5S_hyper_spans_nelem(a_not_b); } /* end if */ if(b_not_a!=NULL) { if(H5S_hyper_merge_spans(space,b_not_a,FALSE)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(b_not_a))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - space->select.num_elem+=nelem; + space->select.num_elem+=H5S_hyper_spans_nelem(b_not_a); } /* end if */ break; @@ -5495,9 +5598,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(a_not_b))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - space->select.num_elem=nelem; + space->select.num_elem=H5S_hyper_spans_nelem(a_not_b); /* Indicate that the a_not_b are owned */ a_not_b=NULL; @@ -5519,9 +5620,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(b_not_a))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - space->select.num_elem=nelem; + space->select.num_elem=H5S_hyper_spans_nelem(b_not_a); /* Indicate that the b_not_a are owned */ b_not_a=NULL; @@ -5602,7 +5701,7 @@ done: */ herr_t H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, - const hssize_t start[], + const hsize_t start[], const hsize_t *stride, const hsize_t count[], const hsize_t *block) @@ -5701,7 +5800,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, /* Convert current "all" selection to "real" hyperslab selection */ /* Then allow operation to proceed */ { - hssize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */ + hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */ hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */ hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */ hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */ @@ -5810,10 +5909,10 @@ done: herr_t H5Sselect_hyperslab(dsid, op, start, stride, count, block) hid_t dsid; IN: Dataspace ID of selection to modify H5S_seloper_t op; IN: Operation to perform on current selection - const hssize_t *start; IN: Offset of start of hyperslab - const hssize_t *stride; IN: Hyperslab stride - const hssize_t *count; IN: Number of blocks included in hyperslab - const hssize_t *block; IN: Size of block in hyperslab + const hsize_t *start; IN: Offset of start of hyperslab + const hsize_t *stride; IN: Hyperslab stride + const hsize_t *count; IN: Number of blocks included in hyperslab + const hsize_t *block; IN: Size of block in hyperslab RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -5828,7 +5927,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[], +H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]) { H5S_t *space = NULL; /* Dataspace to modify selection of */ @@ -5836,7 +5935,7 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[], herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5Sselect_hyperslab, FAIL); - H5TRACE6("e","iSs*Hs*h*h*h",space_id,op,start,stride,count,block); + H5TRACE6("e","iSs*h*h*h*h",space_id,op,start,stride,count,block); /* Check args */ if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE))) @@ -5887,7 +5986,6 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper H5S_hyper_span_info_t *a_not_b=NULL; /* Span tree for hyperslab spans in old span tree and not in new span tree */ H5S_hyper_span_info_t *a_and_b=NULL; /* Span tree for hyperslab spans in both old and new span trees */ H5S_hyper_span_info_t *b_not_a=NULL; /* Span tree for hyperslab spans in new span tree and not in old span tree */ - hssize_t nelem; /* Number of elements in hyperslab span tree */ htri_t status; /* Status from internal calls */ herr_t ret_value=SUCCEED; /* Return value */ @@ -5905,9 +6003,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(spans2))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - result->select.num_elem=nelem; + result->select.num_elem=H5S_hyper_spans_nelem(spans2); /* Indicate that we took ownership of span2, if allowed */ if(can_own_span2) @@ -5929,9 +6025,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(spans1))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - result->select.num_elem=nelem; + result->select.num_elem=H5S_hyper_spans_nelem(spans1); } /* end if */ /* Add any new spans from spans2 to current selection */ @@ -5940,9 +6034,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(b_not_a))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - result->select.num_elem+=nelem; + result->select.num_elem+=H5S_hyper_spans_nelem(b_not_a); } /* end if */ break; @@ -5953,9 +6045,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(a_and_b))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - result->select.num_elem=nelem; + result->select.num_elem=H5S_hyper_spans_nelem(a_and_b); /* Indicate that the result owns the a_and_b spans */ a_and_b=NULL; @@ -5969,18 +6059,14 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(a_not_b))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - result->select.num_elem=nelem; + result->select.num_elem=H5S_hyper_spans_nelem(a_not_b); } /* end if */ if(b_not_a!=NULL) { if(H5S_hyper_merge_spans(result,b_not_a,FALSE)<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(b_not_a))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - result->select.num_elem+=nelem; + result->select.num_elem+=H5S_hyper_spans_nelem(b_not_a); } /* end if */ break; @@ -5991,9 +6077,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(a_not_b))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - result->select.num_elem=nelem; + result->select.num_elem=H5S_hyper_spans_nelem(a_not_b); /* Indicate that the result owns the a_not_b spans */ a_not_b=NULL; @@ -6007,9 +6091,7 @@ H5S_operate_hyperslab (H5S_t *result, H5S_hyper_span_info_t *spans1, H5S_seloper HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ - if((nelem=H5S_hyper_spans_nelem(b_not_a))<0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't count hyperslab span elements"); - result->select.num_elem=nelem; + result->select.num_elem=H5S_hyper_spans_nelem(b_not_a); /* Indicate that the result owns the b_not_a spans */ b_not_a=NULL; @@ -6085,7 +6167,7 @@ done: */ static herr_t H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op, - const hssize_t start[], + const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]) @@ -6158,7 +6240,7 @@ done: */ herr_t H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, - const hssize_t start[], + const hsize_t start[], const hsize_t *stride, const hsize_t count[], const hsize_t *block) @@ -6257,7 +6339,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, /* Convert current "all" selection to "real" hyperslab selection */ /* Then allow operation to proceed */ { - hssize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */ + hsize_t tmp_start[H5O_LAYOUT_NDIMS]; /* Temporary start information */ hsize_t tmp_stride[H5O_LAYOUT_NDIMS]; /* Temporary stride information */ hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary count information */ hsize_t tmp_block[H5O_LAYOUT_NDIMS]; /* Temporary block information */ @@ -6368,10 +6450,10 @@ done: herr_t H5Sselect_hyperslab(dsid, op, start, stride, count, block) hid_t dsid; IN: Dataspace ID of selection to modify H5S_seloper_t op; IN: Operation to perform on current selection - const hssize_t *start; IN: Offset of start of hyperslab - const hssize_t *stride; IN: Hyperslab stride - const hssize_t *count; IN: Number of blocks included in hyperslab - const hssize_t *block; IN: Size of block in hyperslab + const hsize_t *start; IN: Offset of start of hyperslab + const hsize_t *stride; IN: Hyperslab stride + const hsize_t *count; IN: Number of blocks included in hyperslab + const hsize_t *block; IN: Size of block in hyperslab RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -6386,14 +6468,14 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[], +H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]) { H5S_t *space = NULL; /* Dataspace to modify selection of */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5Sselect_hyperslab, FAIL); - H5TRACE6("e","iSs*Hs*h*h*h",space_id,op,start,stride,count,block); + H5TRACE6("e","iSs*h*h*h*h",space_id,op,start,stride,count,block); /* Check args */ if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE))) @@ -6435,10 +6517,10 @@ done: hid_t H5Srefine_hyperslab(dsid, op, start, stride, count, block) hid_t dsid; IN: Dataspace ID of selection to use H5S_seloper_t op; IN: Operation to perform on current selection - const hssize_t *start; IN: Offset of start of hyperslab - const hssize_t *stride; IN: Hyperslab stride - const hssize_t *count; IN: Number of blocks included in hyperslab - const hssize_t *block; IN: Size of block in hyperslab + const hsize_t *start; IN: Offset of start of hyperslab + const hsize_t *stride; IN: Hyperslab stride + const hsize_t *count; IN: Number of blocks included in hyperslab + const hsize_t *block; IN: Size of block in hyperslab RETURNS Dataspace ID on success/Negative on failure DESCRIPTION @@ -6454,7 +6536,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ hid_t -H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[], +H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]) { H5S_t *space = NULL; /* Dataspace to modify selection of */ @@ -6462,7 +6544,7 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[], hid_t ret_value; FUNC_ENTER_API(H5Scombine_hyperslab, FAIL); - H5TRACE6("i","iSs*Hs*h*h*h",space_id,op,start,stride,count,block); + H5TRACE6("i","iSs*h*h*h*h",space_id,op,start,stride,count,block); /* Check args */ if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE))) @@ -6781,7 +6863,7 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter, hsize_t acc; /* Accumulator for computing cumulative sizes */ hsize_t loc_off; /* Element offset in the dataspace */ hsize_t last_span_end=0; /* The offset of the end of the last span */ - hssize_t *abs_arr; /* Absolute hyperslab span position */ + hsize_t *abs_arr; /* Absolute hyperslab span position */ const hssize_t *off_arr; /* Offset within the dataspace extent */ size_t span_size=0; /* Number of bytes in current span to actually process */ size_t io_left; /* Number of elements left to process */ @@ -7210,16 +7292,16 @@ H5S_hyper_get_seq_list_opt(const H5S_t *space,H5S_sel_iter_t *iter, hsize_t *mem_size; /* Size of the source buffer */ hsize_t slab[H5O_LAYOUT_NDIMS]; /* Hyperslab size */ const hssize_t *sel_off; /* Selection offset in dataspace */ - hssize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */ + hsize_t offset[H5O_LAYOUT_NDIMS]; /* Coordinate offset in dataspace */ hsize_t tmp_count[H5O_LAYOUT_NDIMS];/* Temporary block count */ hsize_t tmp_block[H5O_LAYOUT_NDIMS];/* Temporary block offset */ - hssize_t wrap[H5O_LAYOUT_NDIMS]; /* Bytes to wrap around at the end of a row */ + hsize_t wrap[H5O_LAYOUT_NDIMS]; /* Bytes to wrap around at the end of a row */ hsize_t skip[H5O_LAYOUT_NDIMS]; /* Bytes to skip between blocks */ const H5S_hyper_dim_t *tdiminfo; /* Temporary pointer to diminfo information */ - hssize_t fast_dim_start, /* Local copies of fastest changing dimension info */ + hsize_t fast_dim_start, /* Local copies of fastest changing dimension info */ + fast_dim_stride, + fast_dim_block, fast_dim_offset; - hsize_t fast_dim_stride, /* Local copies of fastest changing dimension info */ - fast_dim_block; size_t fast_dim_buf_off; /* Local copy of amount to move fastest dimension buffer offset */ size_t fast_dim_count; /* Number of blocks left in fastest changing dimension */ size_t tot_blk_count; /* Total number of blocks left to output */ diff --git a/src/H5Smpio.c b/src/H5Smpio.c index cc9fc09..5491a6d 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -667,7 +667,7 @@ H5S_mpio_span_hyper_type( const H5S_t *space, size_t elmt_size, MPI_Aint extent,lb; - FUNC_ENTER_NOAPI_NOINIT(H5S_mpio_span_hyper_type); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_mpio_span_hyper_type); printf("coming to hyper type \n"); /* Check args */ @@ -729,15 +729,15 @@ static herr_t obtain_datatype(const hsize_t size[], H5S_hyper_span_t* span,MPI_D MPI_Datatype temp_type; MPI_Datatype tempinner_type; MPI_Datatype *inner_type; - int inner_blocklen; - MPI_Aint inner_disp; int *blocklen; MPI_Aint *disp; MPI_Aint stride; MPI_Aint extent,lb; H5S_hyper_span_info_t *down; H5S_hyper_span_t *tspan; +#ifdef H5_HAVE_MPI2 MPI_Aint sizeaint,sizedtype; +#endif /* H5_HAVE_MPI2 */ hsize_t total_lowd,total_lowd1; int i; int ret; diff --git a/src/H5Snone.c b/src/H5Snone.c index f2cc04f..2cc2a1e 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -44,15 +44,15 @@ static htri_t H5S_none_is_valid(const H5S_t *space); static hssize_t H5S_none_serial_size(const H5S_t *space); static herr_t H5S_none_serialize(const H5S_t *space, uint8_t *buf); static herr_t H5S_none_deserialize(H5S_t *space, const uint8_t *buf); -static herr_t H5S_none_bounds(const H5S_t *space, hssize_t *start, hssize_t *end); +static herr_t H5S_none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static htri_t H5S_none_is_contiguous(const H5S_t *space); static htri_t H5S_none_is_single(const H5S_t *space); static htri_t H5S_none_is_regular(const H5S_t *space); static herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); /* Selection iteration callbacks */ -static herr_t H5S_none_iter_coords(const H5S_sel_iter_t *iter, hssize_t *coords); -static herr_t H5S_none_iter_block(const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end); +static herr_t H5S_none_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); +static herr_t H5S_none_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S_none_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S_none_iter_has_next_block(const H5S_sel_iter_t *iter); static herr_t H5S_none_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); @@ -139,7 +139,7 @@ H5S_none_iter_init (H5S_sel_iter_t *iter, const H5S_t UNUSED *space) *------------------------------------------------------------------------- */ static herr_t -H5S_none_iter_coords (const H5S_sel_iter_t UNUSED *iter, hssize_t UNUSED *coords) +H5S_none_iter_coords (const H5S_sel_iter_t UNUSED *iter, hsize_t UNUSED *coords) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_iter_coords); @@ -167,7 +167,7 @@ H5S_none_iter_coords (const H5S_sel_iter_t UNUSED *iter, hssize_t UNUSED *coords *------------------------------------------------------------------------- */ static herr_t -H5S_none_iter_block (const H5S_sel_iter_t UNUSED *iter, hssize_t UNUSED *start, hssize_t UNUSED *end) +H5S_none_iter_block (const H5S_sel_iter_t UNUSED *iter, hsize_t UNUSED *start, hsize_t UNUSED *end) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_iter_block); @@ -533,8 +533,8 @@ done: USAGE herr_t H5S_none_bounds(space, start, end) H5S_t *space; IN: Dataspace pointer of selection to query - hssize_t *start; OUT: Starting coordinate of bounding box - hssize_t *end; OUT: Opposite coordinate of bounding box + hsize_t *start; OUT: Starting coordinate of bounding box + hsize_t *end; OUT: Opposite coordinate of bounding box RETURNS Non-negative on success, negative on failure DESCRIPTION @@ -551,7 +551,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_bounds(const H5S_t UNUSED *space, hssize_t UNUSED *start, hssize_t UNUSED *end) +H5S_none_bounds(const H5S_t UNUSED *space, hsize_t UNUSED *start, hsize_t UNUSED *end) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_none_bounds); diff --git a/src/H5Spkg.h b/src/H5Spkg.h index dc67f81..ce858a2 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -54,7 +54,7 @@ typedef struct { */ /* Node in point selection list (typedef'd in H5Sprivate.h) */ struct H5S_pnt_node_t { - hssize_t *pnt; /* Pointer to a selected point */ + hsize_t *pnt; /* Pointer to a selected point */ struct H5S_pnt_node_t *next; /* pointer to next point in list */ }; @@ -67,7 +67,7 @@ typedef struct { /* Information a particular hyperslab span */ struct H5S_hyper_span_t { - hssize_t low, high; /* Low & high bounds of span */ + hsize_t low, high; /* Low & high bounds of span */ hsize_t nelem; /* Number of elements in span (only needed during I/O) */ hsize_t pstride; /* Pseudo-stride from start of previous span (only used during I/O) */ struct H5S_hyper_span_info_t *down; /* Pointer to list of spans in next dimension down */ @@ -118,7 +118,7 @@ typedef herr_t (*H5S_sel_serialize_func_t)(const H5S_t *space, uint8_t *buf); /* Method to store create selection from "serialized" form (a byte sequence suitable for storing on disk) */ typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t *space, const uint8_t *buf); /* Method to determine to smallest n-D bounding box containing the current selection */ -typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hssize_t *start, hssize_t *end); +typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hsize_t *start, hsize_t *end); /* Method to determine if current selection is contiguous */ typedef htri_t (*H5S_sel_is_contiguous_func_t)(const H5S_t *space); /* Method to determine if current selection is a single block */ @@ -166,9 +166,9 @@ struct H5S_t { /* Selection iteration methods */ /* Method to retrieve the current coordinates of iterator for current selection */ -typedef herr_t (*H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter, hssize_t *coords); +typedef herr_t (*H5S_sel_iter_coords_func_t)(const H5S_sel_iter_t *iter, hsize_t *coords); /* Method to retrieve the current block of iterator for current selection */ -typedef herr_t (*H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end); +typedef herr_t (*H5S_sel_iter_block_func_t)(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); /* Method to determine number of elements left in iterator for current selection */ typedef hsize_t (*H5S_sel_iter_nelmts_func_t)(const H5S_sel_iter_t *iter); /* Method to determine if there are more blocks left in the current selection */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 4970321..b824875 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -45,15 +45,15 @@ static htri_t H5S_point_is_valid(const H5S_t *space); static hssize_t H5S_point_serial_size(const H5S_t *space); static herr_t H5S_point_serialize(const H5S_t *space, uint8_t *buf); static herr_t H5S_point_deserialize(H5S_t *space, const uint8_t *buf); -static herr_t H5S_point_bounds(const H5S_t *space, hssize_t *start, hssize_t *end); +static herr_t H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static htri_t H5S_point_is_contiguous(const H5S_t *space); static htri_t H5S_point_is_single(const H5S_t *space); static htri_t H5S_point_is_regular(const H5S_t *space); static herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space); /* Selection iteration callbacks */ -static herr_t H5S_point_iter_coords(const H5S_sel_iter_t *iter, hssize_t *coords); -static herr_t H5S_point_iter_block(const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end); +static herr_t H5S_point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords); +static herr_t H5S_point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static hsize_t H5S_point_iter_nelmts(const H5S_sel_iter_t *iter); static htri_t H5S_point_iter_has_next_block(const H5S_sel_iter_t *iter); static herr_t H5S_point_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); @@ -152,7 +152,7 @@ H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space) *------------------------------------------------------------------------- */ static herr_t -H5S_point_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords) +H5S_point_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_coords); @@ -161,7 +161,7 @@ H5S_point_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords) assert (coords); /* Copy the offset of the current point */ - HDmemcpy(coords,iter->u.pnt.curr->pnt,sizeof(hssize_t)*iter->rank); + HDmemcpy(coords,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); FUNC_LEAVE_NOAPI(SUCCEED); } /* H5S_point_iter_coords() */ @@ -183,7 +183,7 @@ H5S_point_iter_coords (const H5S_sel_iter_t *iter, hssize_t *coords) *------------------------------------------------------------------------- */ static herr_t -H5S_point_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end) +H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_iter_block); @@ -193,8 +193,8 @@ H5S_point_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end assert (end); /* Copy the current point as a block */ - HDmemcpy(start,iter->u.pnt.curr->pnt,sizeof(hssize_t)*iter->rank); - HDmemcpy(end,iter->u.pnt.curr->pnt,sizeof(hssize_t)*iter->rank); + HDmemcpy(start,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); + HDmemcpy(end,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); FUNC_LEAVE_NOAPI(SUCCEED); } /* H5S_point_iter_block() */ @@ -369,7 +369,7 @@ H5S_point_iter_release (H5S_sel_iter_t UNUSED * iter) herr_t H5S_point_add(space, num_elem, coord) H5S_t *space; IN: Dataspace of selection to modify size_t num_elem; IN: Number of elements in COORD array. - const hssize_t *coord[]; IN: The location of each element selected + const hsize_t *coord[]; IN: The location of each element selected RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -380,10 +380,10 @@ H5S_point_iter_release (H5S_sel_iter_t UNUSED * iter) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hssize_t **_coord) +H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t **_coord) { H5S_pnt_node_t *top, *curr, *new_node; /* Point selection nodes */ - const hssize_t *coord=(const hssize_t *)_coord; /* Pointer to the actual coordinates */ + const hsize_t *coord=(const hsize_t *)_coord; /* Pointer to the actual coordinates */ unsigned i; /* Counter */ herr_t ret_value=SUCCEED; /* Return value */ @@ -400,11 +400,11 @@ H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hssize_t * if((new_node = H5FL_MALLOC(H5S_pnt_node_t))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node"); - if((new_node->pnt = H5MM_malloc(space->extent.rank*sizeof(hssize_t)))==NULL) + if((new_node->pnt = H5MM_malloc(space->extent.rank*sizeof(hsize_t)))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); /* Copy over the coordinates */ - HDmemcpy(new_node->pnt,coord+(i*space->extent.rank),(space->extent.rank*sizeof(hssize_t))); + HDmemcpy(new_node->pnt,coord+(i*space->extent.rank),(space->extent.rank*sizeof(hsize_t))); /* Link into list */ new_node->next=NULL; @@ -505,7 +505,7 @@ H5S_point_release (H5S_t *space) hid_t dsid; IN: Dataspace ID of selection to modify H5S_seloper_t op; IN: Operation to perform on current selection size_t num_elem; IN: Number of elements in COORD array. - const hssize_t **coord; IN: The location of each element selected + const hsize_t **coord; IN: The location of each element selected RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -527,7 +527,7 @@ H5S_point_release (H5S_t *space) --------------------------------------------------------------------------*/ herr_t H5S_select_elements (H5S_t *space, H5S_seloper_t op, size_t num_elem, - const hssize_t **coord) + const hsize_t **coord) { herr_t ret_value=SUCCEED; /* return value */ @@ -603,9 +603,9 @@ H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t UNUSED share_selection) /* Create each point */ if((new_node=H5FL_MALLOC(H5S_pnt_node_t))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate point node"); - if((new_node->pnt = H5MM_malloc(src->extent.rank*sizeof(hssize_t)))==NULL) + if((new_node->pnt = H5MM_malloc(src->extent.rank*sizeof(hsize_t)))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); - HDmemcpy(new_node->pnt,curr->pnt,(src->extent.rank*sizeof(hssize_t))); + HDmemcpy(new_node->pnt,curr->pnt,(src->extent.rank*sizeof(hsize_t))); new_node->next=NULL; /* Keep the order the same when copying */ @@ -662,8 +662,8 @@ H5S_point_is_valid (const H5S_t *space) for(u=0; u<space->extent.rank; u++) { /* Check if an offset has been defined */ /* Bounds check the selected point + offset against the extent */ - if(((curr->pnt[u]+space->select.offset[u])>(hssize_t)space->extent.size[u]) - || ((curr->pnt[u]+space->select.offset[u])<0)) + if(((curr->pnt[u]+space->select.offset[u])>space->extent.size[u]) + || (((hssize_t)curr->pnt[u]+space->select.offset[u])<0)) HGOTO_DONE(FALSE) } /* end for */ @@ -852,7 +852,7 @@ H5S_point_deserialize (H5S_t *space, const uint8_t *buf) H5S_seloper_t op=H5S_SELECT_SET; /* Selection operation */ uint32_t rank; /* Rank of points */ size_t num_elem=0; /* Number of elements in selection */ - hssize_t *coord=NULL, *tcoord; /* Pointer to array of elements */ + hsize_t *coord=NULL, *tcoord; /* Pointer to array of elements */ unsigned i,j; /* local counting variables */ herr_t ret_value; /* return value */ @@ -870,7 +870,7 @@ H5S_point_deserialize (H5S_t *space, const uint8_t *buf) UINT32DECODE(buf,num_elem); /* decode the number of points */ /* Allocate space for the coordinates */ - if((coord = H5MM_malloc(num_elem*rank*sizeof(hssize_t)))==NULL) + if((coord = H5MM_malloc(num_elem*rank*sizeof(hsize_t)))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); /* Retrieve the coordinates from the buffer */ @@ -879,7 +879,7 @@ H5S_point_deserialize (H5S_t *space, const uint8_t *buf) UINT32DECODE(buf, *tcoord); /* Select points */ - if((ret_value=H5S_select_elements(space,op,num_elem,(const hssize_t **)coord))<0) + if((ret_value=H5S_select_elements(space,op,num_elem,(const hsize_t **)coord))<0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); done: @@ -945,7 +945,7 @@ H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoint /* Iterate through the node, copying each hyperslab's information */ while(node!=NULL && numpoints>0) { - HDmemcpy(buf,node->pnt,sizeof(hssize_t)*rank); + HDmemcpy(buf,node->pnt,sizeof(hsize_t)*rank); buf+=rank; numpoints--; node=node->next; @@ -1016,8 +1016,8 @@ done: USAGE herr_t H5S_point_bounds(space, start, end) H5S_t *space; IN: Dataspace pointer of selection to query - hssize_t *start; OUT: Starting coordinate of bounding box - hssize_t *end; OUT: Opposite coordinate of bounding box + hsize_t *start; OUT: Starting coordinate of bounding box + hsize_t *end; OUT: Opposite coordinate of bounding box RETURNS Non-negative on success, negative on failure DESCRIPTION @@ -1035,13 +1035,14 @@ done: REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_point_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) +H5S_point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) { H5S_pnt_node_t *node; /* Point node */ int rank; /* Dataspace rank */ int i; /* index variable */ + herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_point_bounds); + FUNC_ENTER_NOAPI_NOINIT(H5S_point_bounds); assert(space); assert(start); @@ -1052,14 +1053,18 @@ H5S_point_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) /* Set the start and end arrays up */ for(i=0; i<rank; i++) { - start[i]=HSSIZET_MAX; - end[i]=HSSIZET_MIN; + start[i]=HSIZET_MAX; + end[i]=0; } /* end for */ /* Iterate through the node, checking the bounds on each element */ node=space->select.sel_info.pnt_lst->head; while(node!=NULL) { for(i=0; i<rank; i++) { + /* Check for offset moving selection negative */ + if(((hssize_t)node->pnt[i]+space->select.offset[i])<0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds") + if(start[i]>(node->pnt[i]+space->select.offset[i])) start[i]=node->pnt[i]+space->select.offset[i]; if(end[i]<(node->pnt[i]+space->select.offset[i])) @@ -1068,7 +1073,8 @@ H5S_point_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) node=node->next; } /* end while */ - FUNC_LEAVE_NOAPI(SUCCEED); +done: + FUNC_LEAVE_NOAPI(ret_value); } /* H5S_point_bounds() */ @@ -1200,7 +1206,7 @@ H5S_point_is_regular(const H5S_t *space) hid_t dsid; IN: Dataspace ID of selection to modify H5S_seloper_t op; IN: Operation to perform on current selection size_t num_elem; IN: Number of elements in COORD array. - const hssize_t **coord; IN: The location of each element selected + const hsize_t **coord; IN: The location of each element selected RETURNS Non-negative on success/Negative on failure DESCRIPTION @@ -1222,13 +1228,13 @@ H5S_point_is_regular(const H5S_t *space) --------------------------------------------------------------------------*/ herr_t H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem, - const hssize_t **coord) + const hsize_t **coord) { H5S_t *space = NULL; /* Dataspace to modify selection of */ herr_t ret_value; /* return value */ FUNC_ENTER_API(H5Sselect_elements, FAIL); - H5TRACE4("e","iSsz**Hs",spaceid,op,num_elem,coord); + H5TRACE4("e","iSsz**h",spaceid,op,num_elem,coord); /* Check args */ if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE))) diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 61eb9a9..06c9f02 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -48,7 +48,7 @@ typedef struct H5S_hyper_span_info_t H5S_hyper_span_info_t; /* Information about one dimension in a hyperslab selection */ typedef struct H5S_hyper_dim_t { - hssize_t start; + hsize_t start; hsize_t stride; hsize_t count; hsize_t block; @@ -62,7 +62,7 @@ typedef struct { /* Hyperslab selection iteration container */ typedef struct { /* Common fields for all hyperslab selections */ - hssize_t off[H5S_MAX_RANK]; /* Offset in span node (used as position for regular hyperslabs) */ + hsize_t off[H5S_MAX_RANK]; /* Offset in span node (used as position for regular hyperslabs) */ unsigned iter_rank; /* Rank of iterator information */ /* (This should always be the same as the dataspace * rank, except for regular hyperslab selections in @@ -201,6 +201,7 @@ H5_DLL int H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[]/*out*/, H5_DLL herr_t H5S_modify(struct H5G_entry_t *ent, const H5S_t *space, hbool_t update_time, hid_t dxpl_id); H5_DLL herr_t H5S_append(H5F_t *f, hid_t dxpl_id, struct H5O_t *oh, const H5S_t *ds); +H5_DLL size_t H5S_raw_size(const H5F_t *f, const H5S_t *space); H5_DLL H5S_t *H5S_read(struct H5G_entry_t *ent, hid_t dxpl_id); H5_DLL int H5S_extend(H5S_t *space, const hsize_t *size); H5_DLL int H5S_set_extent(H5S_t *space, const hsize_t *size); @@ -219,7 +220,7 @@ H5_DLL herr_t H5S_select_fill(void *fill, size_t fill_size, const H5S_t *space, void *buf); H5_DLL htri_t H5S_select_valid(const H5S_t *space); H5_DLL hssize_t H5S_get_select_npoints(const H5S_t *space); -H5_DLL herr_t H5S_get_select_bounds(const H5S_t *space, hssize_t *start, hssize_t *end); +H5_DLL herr_t H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); H5_DLL herr_t H5S_select_offset(H5S_t *space, const hssize_t *offset); H5_DLL herr_t H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection); H5_DLL htri_t H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2); @@ -241,26 +242,27 @@ H5_DLL herr_t H5S_select_none(H5S_t *space); /* Operations on point selections */ H5_DLL herr_t H5S_select_elements (H5S_t *space, H5S_seloper_t op, - size_t num_elem, const hssize_t **coord); + size_t num_elem, const hsize_t **coord); /* Operations on hyperslab selections */ -H5_DLL herr_t H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, const hssize_t start[], +H5_DLL herr_t H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op, const hsize_t start[], const hsize_t *stride, const hsize_t count[], const hsize_t *block); H5_DLL herr_t H5S_hyper_add_span_element(H5S_t *space, unsigned rank, - hssize_t *coords); + hsize_t *coords); H5_DLL herr_t H5S_hyper_reset_scratch(H5S_t *space); H5_DLL herr_t H5S_hyper_convert(H5S_t *space); #ifdef LATER H5_DLL htri_t H5S_hyper_intersect (H5S_t *space1, H5S_t *space2); #endif /* LATER */ -H5_DLL htri_t H5S_hyper_intersect_block (H5S_t *space, hssize_t *start, hssize_t *end); -H5_DLL herr_t H5S_hyper_adjust(H5S_t *space, const hssize_t *offset); +H5_DLL htri_t H5S_hyper_intersect_block (H5S_t *space, hsize_t *start, hsize_t *end); +H5_DLL herr_t H5S_hyper_adjust_u(H5S_t *space, const hsize_t *offset); +H5_DLL herr_t H5S_hyper_adjust_s(H5S_t *space, const hssize_t *offset); H5_DLL herr_t H5S_hyper_move(H5S_t *space, const hssize_t *offset); H5_DLL herr_t H5S_hyper_normalize_offset(H5S_t *space); /* Operations on selection iterators */ H5_DLL herr_t H5S_select_iter_init(H5S_sel_iter_t *iter, const H5S_t *space, size_t elmt_size); -H5_DLL herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hssize_t *coords); +H5_DLL herr_t H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords); H5_DLL hsize_t H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter); H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter); diff --git a/src/H5Spublic.h b/src/H5Spublic.h index 84ed534..9efaeab 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -110,14 +110,14 @@ H5_DLL htri_t H5Sis_simple(hid_t space_id); H5_DLL herr_t H5Sset_space(hid_t space_id, int rank, const hsize_t *dims); H5_DLL hssize_t H5Sget_select_npoints(hid_t spaceid); H5_DLL herr_t H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, - const hssize_t start[], + const hsize_t start[], const hsize_t _stride[], const hsize_t count[], const hsize_t _block[]); /* #define NEW_HYPERSLAB_API */ #ifdef NEW_HYPERSLAB_API H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, - const hssize_t start[], + const hsize_t start[], const hsize_t _stride[], const hsize_t count[], const hsize_t _block[]); @@ -128,7 +128,7 @@ H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op, #endif /* NEW_HYPERSLAB_API */ H5_DLL herr_t H5Sselect_elements(hid_t space_id, H5S_seloper_t op, size_t num_elemn, - const hssize_t **coord); + const hsize_t **coord); H5_DLL H5S_class_t H5Sget_simple_extent_type(hid_t space_id); H5_DLL herr_t H5Sset_extent_none(hid_t space_id); H5_DLL herr_t H5Sextent_copy(hid_t dst_id,hid_t src_id); @@ -140,7 +140,7 @@ H5_DLL hssize_t H5Sget_select_hyper_nblocks(hid_t spaceid); H5_DLL hssize_t H5Sget_select_elem_npoints(hid_t spaceid); H5_DLL herr_t H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numblocks, hsize_t *buf); H5_DLL herr_t H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoints, hsize_t *buf); -H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hssize_t *start, hssize_t *end); +H5_DLL herr_t H5Sget_select_bounds(hid_t spaceid, hsize_t *start, hsize_t *end); H5_DLL H5S_sel_type H5Sget_select_type(hid_t spaceid); #ifdef __cplusplus diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 9ff1ac0..1d9e68e 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -33,7 +33,7 @@ /* Local functions */ #ifdef LATER -static herr_t H5S_select_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end); +static herr_t H5S_select_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); static htri_t H5S_select_iter_has_next_block (const H5S_sel_iter_t *iter); static herr_t H5S_select_iter_next_block(H5S_sel_iter_t *iter); #endif /* LATER */ @@ -488,8 +488,8 @@ done: USAGE herr_t H5S_get_select_bounds(space, start, end) hid_t dsid; IN: Dataspace ID of selection to query - hssize_t *start; OUT: Starting coordinate of bounding box - hssize_t *end; OUT: Opposite coordinate of bounding box + hsize_t *start; OUT: Starting coordinate of bounding box + hsize_t *end; OUT: Opposite coordinate of bounding box RETURNS Non-negative on success, negative on failure DESCRIPTION @@ -511,13 +511,13 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5Sget_select_bounds(hid_t spaceid, hssize_t *start, hssize_t *end) +H5Sget_select_bounds(hid_t spaceid, hsize_t *start, hsize_t *end) { H5S_t *space = NULL; /* Dataspace to modify selection of */ herr_t ret_value; /* return value */ FUNC_ENTER_API(H5Sget_select_bounds, FAIL); - H5TRACE3("e","i*Hs*Hs",spaceid,start,end); + H5TRACE3("e","i*h*h",spaceid,start,end); /* Check args */ if(start==NULL || end==NULL) @@ -540,8 +540,8 @@ done: USAGE herr_t H5S_get_select_bounds(space, start, end) H5S_t *space; IN: Dataspace ID of selection to query - hssize_t *start; OUT: Starting coordinate of bounding box - hssize_t *end; OUT: Opposite coordinate of bounding box + hsize_t *start; OUT: Starting coordinate of bounding box + hsize_t *end; OUT: Opposite coordinate of bounding box RETURNS Non-negative on success, negative on failure DESCRIPTION @@ -560,7 +560,7 @@ done: REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_get_select_bounds(const H5S_t *space, hssize_t *start, hssize_t *end) +H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) { herr_t ret_value; /* return value */ @@ -746,7 +746,7 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s USAGE herr_t H5S_select_iter_coords(sel_iter,coords) H5S_sel_iter_t *sel_iter; IN: Selection iterator to query - hssize_t *coords; OUT: Array to place iterator coordinates in + hsize_t *coords; OUT: Array to place iterator coordinates in RETURNS Non-negative on success, negative on failure. DESCRIPTION @@ -761,7 +761,7 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, const H5S_t *space, size_t elmt_s REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_select_iter_coords (const H5S_sel_iter_t *sel_iter, hssize_t *coords) +H5S_select_iter_coords (const H5S_sel_iter_t *sel_iter, hsize_t *coords) { herr_t ret_value; /* return value */ @@ -787,8 +787,8 @@ H5S_select_iter_coords (const H5S_sel_iter_t *sel_iter, hssize_t *coords) USAGE herr_t H5S_select_iter_block(sel_iter,start,end) const H5S_sel_iter_t *sel_iter; IN: Selection iterator to query - hssize_t *start; OUT: Array to place iterator start block coordinates - hssize_t *end; OUT: Array to place iterator end block coordinates + hsize_t *start; OUT: Array to place iterator start block coordinates + hsize_t *end; OUT: Array to place iterator end block coordinates RETURNS Non-negative on success, negative on failure. DESCRIPTION @@ -803,7 +803,7 @@ H5S_select_iter_coords (const H5S_sel_iter_t *sel_iter, hssize_t *coords) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_select_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *end) +H5S_select_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) { herr_t ret_value; /* return value */ @@ -1057,7 +1057,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t H5S_sel_iter_t iter; /* Selection iteration info */ hbool_t iter_init=0; /* Selection iteration info has been initialized */ uint8_t *loc; /* Current element location in buffer */ - hssize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of element in dataspace */ + hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of element in dataspace */ hssize_t nelmts; /* Number of elements in selection */ hsize_t space_size[H5O_LAYOUT_NDIMS]; /* Dataspace size */ hsize_t off[H5D_XFER_HYPER_VECTOR_SIZE_DEF]; /* Array to store sequence offsets */ @@ -1070,7 +1070,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t size_t nelem; /* Number of elements used in sequences */ size_t max_elem; /* Maximum number of elements allowed in sequences */ size_t elmt_size; /* Datatype size */ - int ndims; /* Number of dimensions in dataspace */ + unsigned ndims; /* Number of dimensions in dataspace */ int i; /* Local Index variable */ herr_t user_ret=0; /* User's return value */ herr_t ret_value=SUCCEED; /* Return value */ @@ -1137,7 +1137,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t loc=(unsigned char *)buf+curr_off; /* Call user's callback routine */ - user_ret=(*op)(loc,type_id,(hsize_t)ndims,coords,operator_data); + user_ret=(*op)(loc,type_id,ndims,coords,operator_data); /* Increment offset in dataspace */ curr_off+=elmt_size; @@ -1315,12 +1315,12 @@ H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2) } /* end if */ /* Iterate through all the blocks in the selection */ else { - hssize_t start1[H5O_LAYOUT_NDIMS]; /* Start point of selection block in dataspace #1 */ - hssize_t start2[H5O_LAYOUT_NDIMS]; /* Start point of selection block in dataspace #2 */ - hssize_t end1[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #1 */ - hssize_t end2[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #2 */ - hssize_t off1[H5O_LAYOUT_NDIMS]; /* Offset of selection #1 blocks */ - hssize_t off2[H5O_LAYOUT_NDIMS]; /* Offset of selection #2 blocks */ + hsize_t start1[H5O_LAYOUT_NDIMS]; /* Start point of selection block in dataspace #1 */ + hsize_t start2[H5O_LAYOUT_NDIMS]; /* Start point of selection block in dataspace #2 */ + hsize_t end1[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #1 */ + hsize_t end2[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #2 */ + hsize_t off1[H5O_LAYOUT_NDIMS]; /* Offset of selection #1 blocks */ + hsize_t off2[H5O_LAYOUT_NDIMS]; /* Offset of selection #2 blocks */ htri_t status1,status2; /* Status from next block checks */ unsigned first_block=1; /* Flag to indicate the first block */ @@ -2609,12 +2609,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Tencode(hid_t obj_id, void *buf, size_t* nalloc) +H5Tencode(hid_t obj_id, void *buf, size_t *nalloc) { H5T_t *dtype; herr_t ret_value=SUCCEED; FUNC_ENTER_API (H5Tencode, FAIL); + H5TRACE3("e","ix*z",obj_id,buf,nalloc); /* Check argument and retrieve object */ if (NULL==(dtype=H5I_object_verify(obj_id, H5I_DATATYPE))) @@ -105,8 +105,10 @@ H5TS_first_thread_init(void) /* initialize key for thread-specific error stacks */ pthread_key_create(&H5TS_errstk_key_g, H5TS_key_destructor); + /* initialize key for thread-specific function stacks */ pthread_key_create(&H5TS_funcstk_key_g, H5TS_key_destructor); + /* initialize key for thread cancellability mechanism */ pthread_key_create(&H5TS_cancel_key_g, H5TS_key_destructor); } diff --git a/src/H5Tbit.c b/src/H5Tbit.c index 452d44a..ded80a5 100644 --- a/src/H5Tbit.c +++ b/src/H5Tbit.c @@ -75,7 +75,7 @@ H5T_bit_copy (uint8_t *dst, size_t dst_offset, const uint8_t *src, * ... v v v v v V V V V V * ...+---------------+---------------+ * ...|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0| - ...+---------------+---------------+ + * ...+---------------+---------------+ * dst[d_idx+1] dst[d_idx] */ while (src_offset && size>0) { @@ -492,8 +492,8 @@ done: * * Failure: Negative * - * Programmer: Raymond Lu - * Mar 17, 2004 + * Programmer: Robb Matzke + * Friday, June 26, 1998 * * Modifications: * diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 75e8b8f..3fed9c0 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -53,16 +53,16 @@ DESCRIPTION static herr_t H5T_init_commit_interface(void) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_commit_interface); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_init_commit_interface) - FUNC_LEAVE_NOAPI(H5T_init()); + FUNC_LEAVE_NOAPI(H5T_init()) } /* H5T_init_commit_interface() */ /*------------------------------------------------------------------------- * Function: H5Tcommit * - * Purpose: Save a transient data type to a file and turn the type handle + * Purpose: Save a transient datatype to a file and turn the type handle * into a named, immutable type. * * Return: Non-negative on success/Negative on failure @@ -81,23 +81,23 @@ H5Tcommit(hid_t loc_id, const char *name, hid_t type_id) H5T_t *type = NULL; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_API(H5Tcommit, FAIL); + FUNC_ENTER_API(H5Tcommit, FAIL) H5TRACE3("e","isi",loc_id,name,type_id); /* Check arguments */ if (NULL==(loc=H5G_loc (loc_id))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a location"); + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if (!name || !*name) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if (NULL==(type=H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Commit the type */ if (H5T_commit (loc, name, type, H5AC_dxpl_id)<0) - HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit data type"); + HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } @@ -122,11 +122,11 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id) H5F_t *file = NULL; herr_t ret_value=SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5T_commit); + FUNC_ENTER_NOAPI_NOINIT(H5T_commit) - assert (loc); - assert (name && *name); - assert (type); + HDassert (loc); + HDassert (name && *name); + HDassert (type); /* * Check arguments. We cannot commit an immutable type because H5Tclose() @@ -134,17 +134,17 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id) * a named type should always succeed. */ if (H5T_STATE_NAMED==type->shared->state || H5T_STATE_OPEN==type->shared->state) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "data type is already committed"); + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is already committed") if (H5T_STATE_IMMUTABLE==type->shared->state) - HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "data type is immutable"); + HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is immutable") /* Find the insertion file */ if (NULL==(file=H5G_insertion_file(loc, name, dxpl_id))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to find insertion point"); + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to find insertion point") /* Check for a "sensible" datatype to store on disk */ - if(H5T_is_sensible(type)!=TRUE) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "datatype is not sensible"); + if(H5T_is_sensible(type)<=0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "datatype is not sensible") /* Mark datatype as being on disk now. This step changes the size of datatype as * stored on disk. */ @@ -156,11 +156,11 @@ H5T_commit (H5G_entry_t *loc, const char *name, H5T_t *type, hid_t dxpl_id) * type message and then give the object header a name. */ if (H5O_create (file, dxpl_id, 64, &(type->ent))<0) - HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create data type object header"); + HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header") if (H5O_modify (&(type->ent), H5O_DTYPE_ID, 0, H5O_FLAG_CONSTANT, H5O_UPDATE_TIME, type, dxpl_id)<0) - HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message"); + HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message") if (H5G_insert (loc, name, &(type->ent), dxpl_id)<0) - HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to name data type"); + HGOTO_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to name datatype") type->shared->state = H5T_STATE_OPEN; type->shared->fo_count=1; @@ -177,21 +177,21 @@ done: if (ret_value<0) { if ((type->shared->state==H5T_STATE_TRANSIENT || type->shared->state==H5T_STATE_RDONLY) && H5F_addr_defined(type->ent.header)) { if(H5O_close(&(type->ent))<0) - HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header"); + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header") if(H5O_delete(file, dxpl_id,type->ent.header)<0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to delete object header"); + HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to delete object header") type->ent.header = HADDR_UNDEF; } } - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /*------------------------------------------------------------------------- * Function: H5Tcommitted * - * Purpose: Determines if a data type is committed or not. + * Purpose: Determines if a datatype is committed or not. * * Return: Success: TRUE if committed, FALSE otherwise. * @@ -210,25 +210,25 @@ H5Tcommitted(hid_t type_id) H5T_t *type = NULL; htri_t ret_value; /* Return value */ - FUNC_ENTER_API(H5Tcommitted, FAIL); + FUNC_ENTER_API(H5Tcommitted, FAIL) H5TRACE1("t","i",type_id); /* Check arguments */ if (NULL==(type=H5I_object_verify(type_id,H5I_DATATYPE))) - HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + HGOTO_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Set return value */ ret_value= H5T_committed(type); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /*------------------------------------------------------------------------- * Function: H5T_committed * - * Purpose: Determines if a data type is committed or not. + * Purpose: Determines if a datatype is committed or not. * * Return: Success: TRUE if committed, FALSE otherwise. * @@ -240,14 +240,14 @@ done: *------------------------------------------------------------------------- */ htri_t -H5T_committed(H5T_t *type) +H5T_committed(const H5T_t *type) { /* Use no-init for efficiency */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_committed); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_committed) assert (type); - FUNC_LEAVE_NOAPI(H5T_STATE_OPEN==type->shared->state || H5T_STATE_NAMED==type->shared->state); + FUNC_LEAVE_NOAPI(H5T_STATE_OPEN==type->shared->state || H5T_STATE_NAMED==type->shared->state) } /* end H5T_committed() */ @@ -274,15 +274,15 @@ H5T_link(const H5T_t *type, int adjust, hid_t dxpl_id) int ret_value; /* Return value */ /* Use no-init for efficiency */ - FUNC_ENTER_NOAPI(H5T_link,FAIL); + FUNC_ENTER_NOAPI(H5T_link,FAIL) assert (type); /* Adjust the link count on the named datatype */ if((ret_value=H5O_link(&(type->ent),adjust,dxpl_id))<0) - HGOTO_ERROR (H5E_DATATYPE, H5E_LINK, FAIL, "unable to adjust named datatype link count"); + HGOTO_ERROR (H5E_DATATYPE, H5E_LINK, FAIL, "unable to adjust named datatype link count") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_link() */ diff --git a/src/H5Tcompound.c b/src/H5Tcompound.c index 48feb6c..467798f 100644 --- a/src/H5Tcompound.c +++ b/src/H5Tcompound.c @@ -36,7 +36,7 @@ #define H5T_COMPND_INC 64 /*typical max numb of members per struct */ /* Static local functions */ -static herr_t H5T_pack(H5T_t *dt); +static herr_t H5T_pack(const H5T_t *dt); /*-------------------------------------------------------------------------- @@ -81,17 +81,9 @@ H5T_init_compound_interface(void) * *------------------------------------------------------------------------- */ -#ifdef H5_WANT_H5_V1_6_COMPAT -size_t -H5Tget_member_offset(hid_t type_id, int _membno) -#else /* H5_WANT_H5_V1_6_COMPAT */ size_t H5Tget_member_offset(hid_t type_id, unsigned membno) -#endif /* H5_WANT_H5_V1_6_COMPAT */ { -#ifdef H5_WANT_H5_V1_6_COMPAT - unsigned membno = (unsigned)_membno; -#endif /* H5_WANT_H5_V1_6_COMPAT */ H5T_t *dt = NULL; size_t ret_value; @@ -138,7 +130,7 @@ H5T_get_member_offset(const H5T_t *dt, unsigned membno) { size_t ret_value; - FUNC_ENTER_NOAPI(H5T_get_member_offset, 0) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_get_member_offset) assert(dt); assert(membno < dt->shared->u.compnd.nmembs); @@ -146,7 +138,6 @@ H5T_get_member_offset(const H5T_t *dt, unsigned membno) /* Value */ ret_value = dt->shared->u.compnd.memb[membno].offset; -done: FUNC_LEAVE_NOAPI(ret_value) } @@ -167,17 +158,9 @@ done: * *------------------------------------------------------------------------- */ -#ifdef H5_WANT_H5_V1_6_COMPAT -H5T_class_t -H5Tget_member_class(hid_t type_id, int _membno) -#else /* H5_WANT_H5_V1_6_COMPAT */ H5T_class_t H5Tget_member_class(hid_t type_id, unsigned membno) -#endif /* H5_WANT_H5_V1_6_COMPAT */ { -#ifdef H5_WANT_H5_V1_6_COMPAT - unsigned membno = (unsigned)_membno; -#endif /* H5_WANT_H5_V1_6_COMPAT */ H5T_t *dt = NULL; H5T_class_t ret_value; @@ -222,22 +205,14 @@ done: * *------------------------------------------------------------------------- */ -#ifdef H5_WANT_H5_V1_6_COMPAT -hid_t -H5Tget_member_type(hid_t type_id, int _membno) -#else /* H5_WANT_H5_V1_6_COMPAT */ hid_t H5Tget_member_type(hid_t type_id, unsigned membno) -#endif /* H5_WANT_H5_V1_6_COMPAT */ { -#ifdef H5_WANT_H5_V1_6_COMPAT - unsigned membno = (unsigned)_membno; -#endif /* H5_WANT_H5_V1_6_COMPAT */ H5T_t *dt = NULL, *memb_dt = NULL; hid_t ret_value; FUNC_ENTER_API(H5Tget_member_type, FAIL) - H5TRACE2("i","iIs",type_id,membno); + H5TRACE2("i","iIu",type_id,membno); /* Check args */ if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type) @@ -250,8 +225,7 @@ H5Tget_member_type(hid_t type_id, unsigned membno) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable register datatype atom") done: - if(ret_value<0) -{ + if(ret_value<0) { if(memb_dt!=NULL) if(H5T_close(memb_dt)<0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype") @@ -316,11 +290,11 @@ done: *------------------------------------------------------------------------- */ size_t -H5T_get_member_size(H5T_t *dt, unsigned membno) +H5T_get_member_size(const H5T_t *dt, unsigned membno) { size_t ret_value = 0; - FUNC_ENTER_NOAPI(H5T_get_member_size, 0); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_get_member_size) assert(dt); assert(membno < dt->shared->u.compnd.nmembs); @@ -328,8 +302,7 @@ H5T_get_member_size(H5T_t *dt, unsigned membno) /* Value */ ret_value = dt->shared->u.compnd.memb[membno].type->shared->size; -done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -444,7 +417,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member) +H5T_insert(const H5T_t *parent, const char *name, size_t offset, const H5T_t *member) { unsigned idx, i; size_t total_size; @@ -481,7 +454,7 @@ H5T_insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member) /* Increase member array if necessary */ if (parent->shared->u.compnd.nmembs >= parent->shared->u.compnd.nalloc) { - size_t na = parent->shared->u.compnd.nalloc + H5T_COMPND_INC; + unsigned na = parent->shared->u.compnd.nalloc + H5T_COMPND_INC; H5T_cmemb_t *x = H5MM_realloc (parent->shared->u.compnd.memb, na * sizeof(H5T_cmemb_t)); @@ -551,7 +524,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T_pack(H5T_t *dt) +H5T_pack(const H5T_t *dt) { unsigned i; size_t offset; @@ -564,7 +537,7 @@ H5T_pack(H5T_t *dt) if(H5T_detect_class(dt,H5T_COMPOUND)>0) { /* If datatype has been packed, skip packing it and indicate success */ if(H5T_is_packed(dt)== TRUE) - HGOTO_DONE(SUCCEED); + HGOTO_DONE(SUCCEED) /* Check for packing unmodifiable datatype */ if (H5T_STATE_TRANSIENT!=dt->shared->state) @@ -627,7 +600,7 @@ H5T_is_packed(const H5T_t *dt) { htri_t ret_value=TRUE; /* Return value */ - FUNC_ENTER_NOAPI(H5T_is_packed,FAIL) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_is_packed) assert(dt); @@ -639,7 +612,6 @@ H5T_is_packed(const H5T_t *dt) if(dt->shared->type==H5T_COMPOUND) ret_value=(htri_t)dt->shared->u.compnd.packed; -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_is_packed() */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 871e8e1..a9c463f 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -187,44 +187,56 @@ H5FL_BLK_DEFINE_STATIC(array_seq); } #define H5T_CONV_Xx_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ - if (*((ST*)S) > (DT)(D_MAX)) { \ - if(cb_struct.func) { /*If user's exception handler is present, use it*/ \ + if (*((ST*)S) > (DT)(D_MAX)) { \ + if(cb_struct.func) { \ + H5T_conv_ret_t except_ret; /*callback return*/ \ + \ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \ src_id, dst_id, S, D, cb_struct.user_data); \ + if(except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *((DT*)D) = (D_MAX); \ + else if(except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ - \ - if(except_ret == H5T_CONV_UNHANDLED) { \ - /*let compiler convert if case is ignored by user handler*/ \ + else \ *((DT*)D) = (D_MAX); \ - } else if(except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ - } else if (*((ST*)S) < (D_MIN)) { \ - if(cb_struct.func) { /*If user's exception handler is present, use it*/ \ + } else if (*((ST*)S) < (D_MIN)) { \ + if(cb_struct.func) { \ + H5T_conv_ret_t except_ret; /*callback return*/ \ + \ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \ src_id, dst_id, S, D, cb_struct.user_data); \ + if(except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *((DT*)D) = (D_MIN); \ + else if(except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ - \ - if(except_ret == H5T_CONV_UNHANDLED) { \ - /*let compiler convert if case is ignored by user handler*/ \ + else \ *((DT*)D) = (D_MIN); \ - } else if(except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ } else \ *((DT*)D) = (DT)(*((ST*)S)); \ -} +} #define H5T_CONV_Ux_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ - if (*((ST*)S) > (D_MAX)) { \ - if(cb_struct.func) { /*If user's exception handler is present, use it*/ \ + if (*((ST*)S) > (DT)(D_MAX)) { \ + if(cb_struct.func) { \ + H5T_conv_ret_t except_ret; /*callback return*/ \ + \ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \ src_id, dst_id, S, D, cb_struct.user_data); \ + if(except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *((DT*)D) = (D_MAX); \ + else if(except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ - \ - if(except_ret == H5T_CONV_UNHANDLED) { \ - /*let compiler convert if case is ignored by user handler*/ \ + else \ *((DT*)D) = (D_MAX); \ - } else if(except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ } else \ *((DT*)D) = (DT)(*((ST*)S)); \ } @@ -235,17 +247,21 @@ H5FL_BLK_DEFINE_STATIC(array_seq); } #define H5T_CONV_sU_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ - if (*((ST*)S)<0) { \ - if(cb_struct.func) { /*If user's exception handler is present, use it*/ \ + if (*((ST*)S) < 0) { \ + if(cb_struct.func) { \ + H5T_conv_ret_t except_ret; /*callback return*/ \ + \ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \ src_id, dst_id, S, D, cb_struct.user_data); \ + if(except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *((DT*)D) = 0; \ + else if(except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ - \ - if(except_ret == H5T_CONV_UNHANDLED) { \ - /*let compiler convert if case is ignored by user handler*/ \ - *((DT*)D) = 0; \ - } else if(except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + else \ + *((DT*)D) = 0; \ } else \ *((DT*)D) = (DT)(*((ST*)S)); \ } @@ -256,17 +272,21 @@ H5FL_BLK_DEFINE_STATIC(array_seq); } #define H5T_CONV_uS_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ - if (sizeof(ST)==sizeof(DT) && *((ST*)S) > (D_MAX)) { \ - if(cb_struct.func) { /*If user's exception handler is present, use it*/ \ - except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \ - src_id, dst_id, S, D, cb_struct.user_data); \ + if (sizeof(ST)==sizeof(DT) && *((ST*)S) > (D_MAX)) { \ + if(cb_struct.func) { \ + H5T_conv_ret_t except_ret; /*callback return*/ \ + \ + except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \ + src_id, dst_id, S, D, cb_struct.user_data); \ + if(except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *((DT*)D) = (D_MAX); \ + else if(except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ - \ - if(except_ret == H5T_CONV_UNHANDLED) { \ - /*let compiler convert if case is ignored by user handler*/ \ + else \ *((DT*)D) = (D_MAX); \ - } else if(except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ } else \ *((DT*)D) = (DT)(*((ST*)S)); \ } @@ -287,29 +307,36 @@ H5FL_BLK_DEFINE_STATIC(array_seq); } #define H5T_CONV_Su_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ - if (*((ST*)S) < 0) { \ - if(cb_struct.func) { /*If user's exception handler is present, use it*/ \ + if (*((ST*)S) < 0) { \ + if(cb_struct.func) { \ + H5T_conv_ret_t except_ret; /*callback return*/ \ + \ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \ src_id, dst_id, S, D, cb_struct.user_data); \ + if(except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *((DT*)D) = 0; \ + else if(except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ + else \ + *((DT*)D) = 0; \ + } else if (sizeof(ST)>sizeof(DT) && *((ST*)S) > (D_MAX)) { \ + if(cb_struct.func) { \ + H5T_conv_ret_t except_ret; /*callback return*/ \ \ - if(except_ret == H5T_CONV_UNHANDLED) { \ - /*let compiler convert if case is ignored by user handler*/ \ - *((DT*)D) = 0; \ - } else if(except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ - } else if (sizeof(ST)>sizeof(DT) && *((ST*)S)>(ST)(D_MAX)) { \ - /*sign vs. unsign ok in previous line*/ \ - if(cb_struct.func) { /*If user's exception handler is present, use it*/ \ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \ src_id, dst_id, S, D, cb_struct.user_data); \ + if(except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *((DT*)D) = (D_MAX); \ + else if(except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ - \ - if(except_ret == H5T_CONV_UNHANDLED) { \ - /*let compiler convert if case is ignored by user handler*/ \ + else \ *((DT*)D) = (D_MAX); \ - } else if(except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ } else \ *((DT*)D) = (DT)(*((ST*)S)); \ } @@ -331,17 +358,21 @@ H5FL_BLK_DEFINE_STATIC(array_seq); #define H5T_CONV_su_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ /* Assumes memory format of unsigned & signed integers is same */ \ - if (*((ST*)S)<0) { \ - if(cb_struct.func) { /*If user's exception handler is present, use it*/ \ + if (*((ST*)S) < 0) { \ + if(cb_struct.func) { \ + H5T_conv_ret_t except_ret; /*callback return*/ \ + \ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \ src_id, dst_id, S, D, cb_struct.user_data); \ + if(except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *((DT*)D) = 0; \ + else if(except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ - \ - if(except_ret == H5T_CONV_UNHANDLED) { \ - /*let compiler convert if case is ignored by user handler*/ \ - *((DT*)D) = 0; \ - } else if(except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + else \ + *((DT*)D) = 0; \ } \ } @@ -352,17 +383,21 @@ H5FL_BLK_DEFINE_STATIC(array_seq); #define H5T_CONV_us_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ /* Assumes memory format of unsigned & signed integers is same */ \ - if (*((ST*)S) > (D_MAX)) { \ - if(cb_struct.func) { /*If user's exception handler is present, use it*/ \ + if (*((ST*)S) > (D_MAX)) { \ + if(cb_struct.func) { \ + H5T_conv_ret_t except_ret; /*callback return*/ \ + \ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \ src_id, dst_id, S, D, cb_struct.user_data); \ - } \ - \ - if(except_ret == H5T_CONV_UNHANDLED) { \ - /*let compiler convert if case is ignored by user handler*/ \ + if(except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *((DT*)D) = (D_MAX); \ + else if(except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ + } \ + else \ *((DT*)D) = (D_MAX); \ - } else if(except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ } \ } @@ -380,28 +415,36 @@ H5FL_BLK_DEFINE_STATIC(array_seq); * when an overflow occurs, use the 'float' infinity values. */ #define H5T_CONV_Ff_CORE(S,D,STYPE,DTYPE,ST,DT,D_MIN,D_MAX) { \ - if (*((ST*)S) > (DT)(D_MAX)) { \ - if(cb_struct.func) { /*If user's exception handler is present, use it*/ \ + if (*((ST*)S) > (DT)(D_MAX)) { \ + if(cb_struct.func) { \ + H5T_conv_ret_t except_ret; /*callback return*/ \ + \ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_HI, \ src_id, dst_id, S, D, cb_struct.user_data); \ + if(except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *((DT*)D) = (H5T_NATIVE_FLOAT_POS_INF_g); \ + else if(except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ - \ - if(except_ret == H5T_CONV_UNHANDLED) { \ - /*let compiler convert if case is ignored by user handler*/ \ + else \ *((DT*)D) = (H5T_NATIVE_FLOAT_POS_INF_g); \ - } else if(except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ - } else if (*((ST*)S) < (D_MIN)) { \ - if(cb_struct.func) { /*If user's exception handler is present, use it*/ \ + } else if (*((ST*)S) < (D_MIN)) { \ + if(cb_struct.func) { \ + H5T_conv_ret_t except_ret; /*callback return*/ \ + \ except_ret = (cb_struct.func)(H5T_CONV_EXCEPT_RANGE_LOW, \ src_id, dst_id, S, D, cb_struct.user_data); \ + if(except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *((DT*)D) = (H5T_NATIVE_FLOAT_NEG_INF_g); \ + else if(except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ - \ - if(except_ret == H5T_CONV_UNHANDLED) { \ - /*let compiler convert if case is ignored by user handler*/ \ + else \ *((DT*)D) = (H5T_NATIVE_FLOAT_NEG_INF_g); \ - } else if(except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ } else \ *((DT*)D) = (DT)(*((ST*)S)); \ } @@ -431,7 +474,6 @@ H5FL_BLK_DEFINE_STATIC(array_seq); size_t safe; /*how many elements are safe to process in each pass */ \ H5P_genplist_t *plist; /*Property list pointer */ \ H5T_conv_cb_t cb_struct; /*conversion callback structure */ \ - H5T_conv_ret_t except_ret; /*callback return*/ \ \ switch (cdata->command) { \ case H5T_CONV_INIT: \ @@ -440,7 +482,7 @@ H5FL_BLK_DEFINE_STATIC(array_seq); if (NULL==(st=H5I_object(src_id)) || NULL==(dt=H5I_object(dst_id))) \ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \ "unable to dereference datatype object ID") \ - if (st->shared->size!=sizeof(ST) || dt->shared->size!=sizeof(DT)) \ + if (st->shared->size!=sizeof(ST) || dt->shared->size!=sizeof(DT)) \ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \ "disagreement about datatype size") \ CI_ALLOC_PRIV \ @@ -457,7 +499,8 @@ H5FL_BLK_DEFINE_STATIC(array_seq); if (buf_stride) { \ assert(buf_stride>=sizeof(ST)); \ assert(buf_stride>=sizeof(DT)); \ - s_stride = d_stride = buf_stride; \ + H5_CHECK_OVERFLOW(buf_stride,size_t,ssize_t); \ + s_stride = d_stride = (ssize_t)buf_stride; \ } else { \ s_stride = sizeof(ST); \ d_stride = sizeof(DT); \ @@ -514,8 +557,6 @@ H5FL_BLK_DEFINE_STATIC(array_seq); safe=nelmts; \ } /* end else */ \ \ - except_ret = H5T_CONV_UNHANDLED; \ - \ /* Perform loop over elements to convert */ \ if (s_mv && d_mv) { \ /* Alignment is required for both source and dest */ \ @@ -1237,7 +1278,7 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, uint8_t dbuf[256]; /*temp destination buffer */ size_t msb_pad_offset; /*offset for dest MSB padding */ size_t i; - uint8_t *src_rev; /*order-reversed source buffer */ + uint8_t *src_rev=NULL; /*order-reversed source buffer */ H5P_genplist_t *plist; /*property list pointer */ H5T_conv_cb_t cb_struct={NULL, NULL}; /*conversion callback structure */ H5T_conv_ret_t except_ret; /*return of callback function */ @@ -1432,8 +1473,6 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } } - H5MM_free(src_rev); - break; default: @@ -1441,6 +1480,8 @@ H5T_conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } done: + if(src_rev) + H5MM_free(src_rev); FUNC_LEAVE_NOAPI(ret_value); } @@ -2322,7 +2363,6 @@ H5T_conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, n = *((int*)s); } n -= priv->base; - if (n<0 || n>=priv->length || priv->src2dst[n]<0) { /*overflow*/ except_ret = H5T_CONV_UNHANDLED; @@ -2494,14 +2534,19 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, if (buf_stride) { assert(buf_stride>=src->shared->size); assert(buf_stride>=dst->shared->size); - s_stride = d_stride = buf_stride; + H5_CHECK_OVERFLOW(buf_stride,size_t,ssize_t); + s_stride = d_stride = (ssize_t)buf_stride; } else { - s_stride = src->shared->size; - d_stride = dst->shared->size; + H5_CHECK_OVERFLOW(src->shared->size,size_t,ssize_t); + H5_CHECK_OVERFLOW(dst->shared->size,size_t,ssize_t); + s_stride = (ssize_t)src->shared->size; + d_stride = (ssize_t)dst->shared->size; } if(bkg) { - if(bkg_stride) - b_stride=bkg_stride; + if(bkg_stride) { + H5_CHECK_OVERFLOW(bkg_stride,size_t,ssize_t); + b_stride=(ssize_t)bkg_stride; + } /* end if */ else b_stride=d_stride; } /* end if */ @@ -2911,7 +2956,7 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t half_size; /*half the type size */ size_t olap; /*num overlapping elements */ uint8_t *s, *sp, *d, *dp; /*source and dest traversal ptrs*/ - uint8_t *src_rev; /*order-reversed source buffer */ + uint8_t *src_rev=NULL; /*order-reversed source buffer */ uint8_t dbuf[64]; /*temp destination buffer */ size_t first; ssize_t sfirst; /*a signed version of `first' */ @@ -3266,8 +3311,6 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } } - H5MM_free(src_rev); - break; default: @@ -3275,6 +3318,8 @@ H5T_conv_i_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } done: + if(src_rev) + H5MM_free(src_rev); FUNC_LEAVE_NOAPI(ret_value); } @@ -3323,7 +3368,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t olap; /*num overlapping elements */ ssize_t bitno; /*bit number */ uint8_t *s, *sp, *d, *dp; /*source and dest traversal ptrs*/ - uint8_t *src_rev; /*order-reversed source buffer */ + uint8_t *src_rev=NULL; /*order-reversed source buffer */ uint8_t dbuf[64]; /*temp destination buffer */ /* Conversion-related variables */ @@ -3539,7 +3584,7 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ if (H5T_NORM_NONE==dst.u.f.norm) mrsh++; - + /* * Calculate the destination exponent by adding the destination * bias and clipping by the minimum and maximum possible @@ -3723,8 +3768,6 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } } - H5MM_free(src_rev); - break; default: @@ -3732,6 +3775,9 @@ H5T_conv_f_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } done: + if(src_rev) + H5MM_free(src_rev); + FUNC_LEAVE_NOAPI(ret_value); } @@ -8686,13 +8732,13 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, ssize_t bitno; /*bit number */ size_t olap; /*num overlapping elements */ uint8_t *s, *sp, *d, *dp; /*source and dest traversal ptrs*/ - uint8_t *src_rev; /*order-reversed source buffer */ + uint8_t *src_rev=NULL; /*order-reversed source buffer */ uint8_t dbuf[64]; /*temp destination buffer */ /* Conversion-related variables */ hssize_t expo; /*source exponent */ hssize_t sign; /*source sign bit value */ - uint8_t *int_buf; /*buffer for temporary value */ + uint8_t *int_buf=NULL; /*buffer for temporary value */ size_t buf_size; /*buffer size for temporary value */ size_t i; /*miscellaneous counters */ size_t first; /*first bit(MSB) in an integer */ @@ -9102,9 +9148,6 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, HDmemset(int_buf, 0, buf_size); } - H5MM_xfree(int_buf); - H5MM_free(src_rev); - break; default: @@ -9112,6 +9155,10 @@ H5T_conv_f_i (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } done: + if(int_buf) + H5MM_xfree(int_buf); + if(src_rev) + H5MM_free(src_rev); FUNC_LEAVE_NOAPI(ret_value); } @@ -9152,7 +9199,7 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t half_size; /*half the type size */ size_t olap; /*num overlapping elements */ uint8_t *s, *sp, *d, *dp; /*source and dest traversal ptrs*/ - uint8_t *src_rev; /*order-reversed source buffer */ + uint8_t *src_rev=NULL; /*order-reversed source buffer */ uint8_t dbuf[64]; /*temp destination buffer */ /* Conversion-related variables */ @@ -9161,7 +9208,7 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t sign; /*source sign bit value */ hbool_t is_max_neg; /*source is maximal negative value*/ hbool_t do_round; /*whether there is roundup */ - uint8_t *int_buf; /*buffer for temporary value */ + uint8_t *int_buf=NULL; /*buffer for temporary value */ size_t buf_size; /*buffer size for temporary value */ size_t i; /*miscellaneous counters */ size_t first; /*first bit(MSB) in an integer */ @@ -9512,9 +9559,6 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, HDmemset(int_buf, 0, buf_size); } - H5MM_xfree(int_buf); - H5MM_free(src_rev); - break; default: @@ -9522,6 +9566,10 @@ H5T_conv_i_f (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } done: + if(int_buf) + H5MM_xfree(int_buf); + if(src_rev) + H5MM_free(src_rev); FUNC_LEAVE_NOAPI(ret_value); } diff --git a/src/H5Tcset.c b/src/H5Tcset.c index 1a9e39d..5d9c857 100644 --- a/src/H5Tcset.c +++ b/src/H5Tcset.c @@ -134,7 +134,7 @@ H5Tset_cset(hid_t type_id, H5T_cset_t cset) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") if (H5T_STATE_TRANSIENT!=dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") - if (cset < 0 || cset >= H5T_NCSET) + if (cset < H5T_CSET_ASCII || cset >= H5T_NCSET) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal character set type") while (dt->shared->parent && !H5T_IS_STRING(dt->shared)) dt = dt->shared->parent; /*defer to parent*/ diff --git a/src/H5Tenum.c b/src/H5Tenum.c index 83a3615..db1daa4 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -38,9 +38,9 @@ H5FL_EXTERN(H5T_t); H5FL_EXTERN(H5T_shared_t); /* Static local functions */ -static char *H5T_enum_nameof(H5T_t *dt, const void *value, char *name/*out*/, +static char *H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, size_t size); -static herr_t H5T_enum_valueof(H5T_t *dt, const char *name, +static herr_t H5T_enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/); @@ -141,7 +141,7 @@ H5T_enum_create(const H5T_t *parent) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") if (NULL==(ret_value->shared=H5FL_CALLOC(H5T_shared_t))) { H5FL_FREE(H5T_t, ret_value); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") } ret_value->shared->type = H5T_ENUM; ret_value->shared->parent = H5T_copy(parent, H5T_COPY_ALL); @@ -223,7 +223,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_enum_insert(H5T_t *dt, const char *name, const void *value) +H5T_enum_insert(const H5T_t *dt, const char *name, const void *value) { unsigned i; char **names=NULL; @@ -285,17 +285,9 @@ done: * *------------------------------------------------------------------------- */ -#ifdef H5_WANT_H5_V1_6_COMPAT -herr_t -H5Tget_member_value(hid_t type, int _membno, void *value/*out*/) -#else /* H5_WANT_H5_V1_6_COMPAT */ herr_t H5Tget_member_value(hid_t type, unsigned membno, void *value/*out*/) -#endif /* H5_WANT_H5_V1_6_COMPAT */ { -#ifdef H5_WANT_H5_V1_6_COMPAT - unsigned membno = (unsigned)_membno; -#endif /* H5_WANT_H5_V1_6_COMPAT */ H5T_t *dt=NULL; herr_t ret_value=SUCCEED; /* Return value */ @@ -429,7 +421,7 @@ done: *------------------------------------------------------------------------- */ static char * -H5T_enum_nameof(H5T_t *dt, const void *value, char *name/*out*/, size_t size) +H5T_enum_nameof(const H5T_t *dt, const void *value, char *name/*out*/, size_t size) { unsigned lt, md=0, rt; /*indices for binary search */ int cmp=(-1); /*comparison result */ @@ -549,7 +541,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T_enum_valueof(H5T_t *dt, const char *name, void *value/*out*/) +H5T_enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/) { unsigned lt, md=0, rt; /*indices for binary search */ int cmp=(-1); /*comparison result */ diff --git a/src/H5Tfields.c b/src/H5Tfields.c index 48a7e22..d2c2082 100644 --- a/src/H5Tfields.c +++ b/src/H5Tfields.c @@ -158,17 +158,9 @@ done: * Also works with enumeration datatypes. *------------------------------------------------------------------------- */ -#ifdef H5_WANT_H5_V1_6_COMPAT -char * -H5Tget_member_name(hid_t type_id, int _membno) -#else /* H5_WANT_H5_V1_6_COMPAT */ char * H5Tget_member_name(hid_t type_id, unsigned membno) -#endif /* H5_WANT_H5_V1_6_COMPAT */ { -#ifdef H5_WANT_H5_V1_6_COMPAT - unsigned membno = (unsigned)_membno; -#endif /* H5_WANT_H5_V1_6_COMPAT */ H5T_t *dt = NULL; char *ret_value; @@ -229,7 +221,7 @@ H5T_get_member_name(H5T_t const *dt, unsigned membno) default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "operation not supported for type class") - } + } /*lint !e788 All appropriate cases are covered */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -285,7 +277,7 @@ H5Tget_member_index(hid_t type_id, const char *name) break; default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for this type") - } + } /*lint !e788 All appropriate cases are covered */ done: FUNC_LEAVE_API(ret_value) @@ -311,7 +303,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_sort_value(H5T_t *dt, int *map) +H5T_sort_value(const H5T_t *dt, int *map) { unsigned i, j, nmembs; size_t size; @@ -422,7 +414,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_sort_name(H5T_t *dt, int *map) +H5T_sort_name(const H5T_t *dt, int *map) { unsigned i, j, nmembs; size_t size; diff --git a/src/H5Tfixed.c b/src/H5Tfixed.c index 361ba8d..99fc26a 100644 --- a/src/H5Tfixed.c +++ b/src/H5Tfixed.c @@ -164,7 +164,7 @@ H5Tset_sign(hid_t type_id, H5T_sign_t sign) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an integer datatype") if (H5T_STATE_TRANSIENT!=dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") - if (sign < 0 || sign >= H5T_NSGN) + if (sign < H5T_SGN_NONE || sign >= H5T_NSGN) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal sign type") if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") diff --git a/src/H5Tfloat.c b/src/H5Tfloat.c index 0e54468..6be73da 100644 --- a/src/H5Tfloat.c +++ b/src/H5Tfloat.c @@ -337,7 +337,7 @@ H5Tset_norm(hid_t type_id, H5T_norm_t norm) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (H5T_STATE_TRANSIENT!=dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") - if (norm < 0 || norm > H5T_NORM_NONE) + if (norm < H5T_NORM_IMPLIED || norm > H5T_NORM_NONE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal normalization") while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ @@ -431,7 +431,7 @@ H5Tset_inpad(hid_t type_id, H5T_pad_t pad) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (H5T_STATE_TRANSIENT!=dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") - if (pad < 0 || pad >= H5T_NPAD) + if (pad < H5T_PAD_ZERO || pad >= H5T_NPAD) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal internal pad type") while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 1ece922..291c41b 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -170,7 +170,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig assert(dtype); - if((h5_class = H5T_get_class(dtype))<0) + if((h5_class = H5T_get_class(dtype))==H5T_NO_CLASS) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid class") if((size = H5T_get_size(dtype))==0) @@ -478,6 +478,8 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig } break; + case H5T_NO_CLASS: + case H5T_NCLASSES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "data type doesn't match any native type") } @@ -647,9 +649,9 @@ H5T_get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, align = H5T_NATIVE_LLONG_COMP_ALIGN_g; break; + case H5T_NATIVE_INT_MATCH_UNKNOWN: default: - assert(0 && "Unknown native integer match!"); - break; + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "Unknown native integer match") } /* end switch */ /* Create new native type */ @@ -764,9 +766,9 @@ H5T_get_native_float(size_t size, H5T_direction_t direction, size_t *struct_alig align = H5T_NATIVE_LDOUBLE_COMP_ALIGN_g; break; + case H5T_NATIVE_FLOAT_MATCH_UNKNOWN: default: - assert(0 && "Unknown native floating-point match!"); - break; + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "Unknown native floating-point match") } /* end switch */ /* Create new native type */ diff --git a/src/H5Toffset.c b/src/H5Toffset.c index 943415e..99046cf 100644 --- a/src/H5Toffset.c +++ b/src/H5Toffset.c @@ -32,7 +32,7 @@ #include "H5Tpkg.h" /* Datatypes */ /* Static local functions */ -static herr_t H5T_set_offset(H5T_t *dt, size_t offset); +static herr_t H5T_set_offset(const H5T_t *dt, size_t offset); /*-------------------------------------------------------------------------- @@ -225,7 +225,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T_set_offset(H5T_t *dt, size_t offset) +H5T_set_offset(const H5T_t *dt, size_t offset) { herr_t ret_value=SUCCEED; /* Return value */ diff --git a/src/H5Torder.c b/src/H5Torder.c index 1c23de8..c43fc3c 100644 --- a/src/H5Torder.c +++ b/src/H5Torder.c @@ -127,14 +127,14 @@ H5Tset_order(hid_t type_id, H5T_order_t order) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") if (H5T_STATE_TRANSIENT!=dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") - if (order < 0 || order > H5T_ORDER_NONE) + if (order < H5T_ORDER_LE || order > H5T_ORDER_NONE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal byte order") if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_ATOMIC(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "operation not defined for specified data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type") /* Commit */ dt->shared->u.atomic.order = order; diff --git a/src/H5Tpad.c b/src/H5Tpad.c index a4fe620..254831e 100644 --- a/src/H5Tpad.c +++ b/src/H5Tpad.c @@ -130,7 +130,7 @@ H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") if (H5T_STATE_TRANSIENT!=dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") - if (lsb < 0 || lsb >= H5T_NPAD || msb < 0 || msb >= H5T_NPAD) + if (lsb < H5T_PAD_ZERO || lsb >= H5T_NPAD || msb < H5T_PAD_ZERO || msb >= H5T_NPAD) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pad type") if (H5T_ENUM==dt->shared->type && dt->shared->u.enumer.nmembs>0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index bde3403..c08f5db 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -143,9 +143,9 @@ typedef struct H5T_enum_t { } H5T_enum_t; /* VL function pointers */ -typedef ssize_t (*H5T_vlen_getlenfunc_t)(void *vl_addr); +typedef ssize_t (*H5T_vlen_getlenfunc_t)(const void *vl_addr); typedef void * (*H5T_vlen_getptrfunc_t)(void *vl_addr); -typedef htri_t (*H5T_vlen_isnullfunc_t)(H5F_t *f, void *vl_addr); +typedef htri_t (*H5T_vlen_isnullfunc_t)(const H5F_t *f, void *vl_addr); typedef herr_t (*H5T_vlen_readfunc_t)(H5F_t *f, hid_t dxpl_id, void *_vl, void *buf, size_t len); typedef herr_t (*H5T_vlen_writefunc_t)(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size); typedef herr_t (*H5T_vlen_setnullfunc_t)(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg); @@ -329,14 +329,14 @@ H5_DLL H5T_t *H5T_get_super(H5T_t *dt); H5_DLL char *H5T_get_member_name(H5T_t const *dt, unsigned membno); H5_DLL herr_t H5T_get_member_value(const H5T_t *dt, unsigned membno, void *value); H5_DLL int H5T_get_nmembers(const H5T_t *dt); -H5_DLL herr_t H5T_insert(H5T_t *parent, const char *name, size_t offset, +H5_DLL herr_t H5T_insert(const H5T_t *parent, const char *name, size_t offset, const H5T_t *member); H5_DLL H5T_t *H5T_enum_create(const H5T_t *parent); -H5_DLL herr_t H5T_enum_insert(H5T_t *dt, const char *name, const void *value); +H5_DLL herr_t H5T_enum_insert(const H5T_t *dt, const char *name, const void *value); H5_DLL int H5T_get_array_ndims(H5T_t *dt); H5_DLL int H5T_get_array_dims(H5T_t *dt, hsize_t dims[], int perm[]); -H5_DLL herr_t H5T_sort_value(H5T_t *dt, int *map); -H5_DLL herr_t H5T_sort_name(H5T_t *dt, int *map); +H5_DLL herr_t H5T_sort_value(const H5T_t *dt, int *map); +H5_DLL herr_t H5T_sort_name(const H5T_t *dt, int *map); H5_DLL herr_t H5T_set_size(H5T_t *dt, size_t size); /* Conversion functions */ @@ -1082,7 +1082,7 @@ H5_DLL void H5T_bit_neg(uint8_t *buf, size_t start, size_t size); /* VL functions */ H5_DLL H5T_t * H5T_vlen_create(const H5T_t *base); -H5_DLL htri_t H5T_vlen_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc); +H5_DLL htri_t H5T_vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc); /* Array functions */ H5_DLL H5T_t * H5T_array_create(H5T_t *base, int ndims, @@ -1091,7 +1091,7 @@ H5_DLL H5T_t * H5T_array_create(H5T_t *base, int ndims, /* Compound functions */ H5_DLL H5T_t *H5T_get_member_type(const H5T_t *dt, unsigned membno); H5_DLL size_t H5T_get_member_offset(const H5T_t *dt, unsigned membno); -H5_DLL size_t H5T_get_member_size(H5T_t *dt, unsigned membno); +H5_DLL size_t H5T_get_member_size(const H5T_t *dt, unsigned membno); H5_DLL htri_t H5T_is_packed(const H5T_t *dt); #endif diff --git a/src/H5Tprecis.c b/src/H5Tprecis.c index f5e1ef5..9728172 100644 --- a/src/H5Tprecis.c +++ b/src/H5Tprecis.c @@ -32,7 +32,7 @@ #include "H5Tpkg.h" /* Datatypes */ /* Static local functions */ -static herr_t H5T_set_precision(H5T_t *dt, size_t prec); +static herr_t H5T_set_precision(const H5T_t *dt, size_t prec); /*-------------------------------------------------------------------------- @@ -195,7 +195,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T_set_precision(H5T_t *dt, size_t prec) +H5T_set_precision(const H5T_t *dt, size_t prec) { size_t offset, size; herr_t ret_value=SUCCEED; /* Return value */ @@ -252,9 +252,8 @@ H5T_set_precision(H5T_t *dt, size_t prec) break; default: - assert("not implemented yet" && 0); HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") - } /* end switch */ + } /* end switch */ /*lint !e788 All appropriate cases are covered */ /* Commit */ dt->shared->size = size; diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h index 282b61e..e09be78 100644 --- a/src/H5Tprivate.h +++ b/src/H5Tprivate.h @@ -87,11 +87,11 @@ H5_DLL H5T_bkg_t H5T_path_bkg(const H5T_path_t *p); H5_DLL herr_t H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, size_t buf_stride, size_t bkg_stride, void *buf, void *bkg, hid_t dset_xfer_plist); -H5_DLL herr_t H5T_vlen_reclaim(void *elem, hid_t type_id, hsize_t ndim, hssize_t *point, void *_op_data); +H5_DLL herr_t H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *_op_data); H5_DLL herr_t H5T_vlen_get_alloc_info(hid_t dxpl_id, H5T_vlen_alloc_info_t **vl_alloc_info); H5_DLL htri_t H5T_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc); H5_DLL htri_t H5T_is_sensible(const H5T_t *dt); -H5_DLL htri_t H5T_committed(H5T_t *type); +H5_DLL htri_t H5T_committed(const H5T_t *type); H5_DLL int H5T_link(const H5T_t *type, int adjust, hid_t dxpl_id); /* Reference specific functions */ diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index c4daeb1..951d49b 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -94,7 +94,7 @@ typedef enum H5T_cset_t { H5T_CSET_RESERVED_14 = 14, /*reserved for later use */ H5T_CSET_RESERVED_15 = 15 /*reserved for later use */ } H5T_cset_t; -#define H5T_NCSET 1 /*Number of character sets actually defined */ +#define H5T_NCSET H5T_CSET_RESERVED_1 /*Number of character sets actually defined */ /* * Type of padding to use in character strings. Do not change these values @@ -119,7 +119,7 @@ typedef enum H5T_str_t { H5T_STR_RESERVED_14 = 14, /*reserved for later use */ H5T_STR_RESERVED_15 = 15 /*reserved for later use */ } H5T_str_t; -#define H5T_NSTR 3 /*num H5T_str_t types actually defined */ +#define H5T_NSTR H5T_STR_RESERVED_3 /*num H5T_str_t types actually defined */ /* Type of padding to use in other atomic types */ typedef enum H5T_pad_t { @@ -207,13 +207,13 @@ typedef herr_t (*H5T_conv_t) (hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, typedef H5T_conv_ret_t (*H5T_conv_except_func_t)(int except_type, hid_t src_id, hid_t dst_id, void *src_buf, void *dst_buf, void *user_data); -/* When this header is included from H5Tprivate.h, don't make calls to H5open() */ +/* When this header is included from a private header, don't make calls to H5open() */ #undef H5OPEN -#ifndef _H5Tprivate_H +#ifndef _H5private_H #define H5OPEN H5open(), -#else /* _H5Tprivate_H */ +#else /* _H5private_H */ #define H5OPEN -#endif /* _H5Tprivate_H */ +#endif /* _H5private_H */ /* * The IEEE floating point types in various byte orders. @@ -533,23 +533,12 @@ H5_DLL H5T_norm_t H5Tget_norm(hid_t type_id); H5_DLL H5T_pad_t H5Tget_inpad(hid_t type_id); H5_DLL H5T_str_t H5Tget_strpad(hid_t type_id); H5_DLL int H5Tget_nmembers(hid_t type_id); -#ifdef H5_WANT_H5_V1_6_COMPAT -H5_DLL char *H5Tget_member_name(hid_t type_id, int membno); -#else /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL char *H5Tget_member_name(hid_t type_id, unsigned membno); -#endif /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL int H5Tget_member_index(hid_t type_id, const char *name); -#ifdef H5_WANT_H5_V1_6_COMPAT -H5_DLL size_t H5Tget_member_offset(hid_t type_id, int membno); -H5_DLL H5T_class_t H5Tget_member_class(hid_t type_id, int membno); -H5_DLL hid_t H5Tget_member_type(hid_t type_id, int membno); -H5_DLL herr_t H5Tget_member_value(hid_t type_id, int membno, void *value/*out*/); -#else /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL size_t H5Tget_member_offset(hid_t type_id, unsigned membno); H5_DLL H5T_class_t H5Tget_member_class(hid_t type_id, unsigned membno); H5_DLL hid_t H5Tget_member_type(hid_t type_id, unsigned membno); H5_DLL herr_t H5Tget_member_value(hid_t type_id, unsigned membno, void *value/*out*/); -#endif /* H5_WANT_H5_V1_6_COMPAT */ H5_DLL H5T_cset_t H5Tget_cset(hid_t type_id); H5_DLL htri_t H5Tis_variable_str(hid_t type_id); H5_DLL hid_t H5Tget_native_type(hid_t type_id, H5T_direction_t direction); diff --git a/src/H5Tstrpad.c b/src/H5Tstrpad.c index c764a75..c79b60d 100644 --- a/src/H5Tstrpad.c +++ b/src/H5Tstrpad.c @@ -146,7 +146,7 @@ H5Tset_strpad(hid_t type_id, H5T_str_t strpad) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if (H5T_STATE_TRANSIENT!=dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") - if (strpad < 0 || strpad >= H5T_NSTR) + if (strpad < H5T_STR_NULLTERM || strpad >= H5T_NSTR) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal string pad type") while (dt->shared->parent && !H5T_IS_STRING(dt->shared)) dt = dt->shared->parent; /*defer to parent*/ diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 467327e..186b14f 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -38,21 +38,21 @@ /* Local functions */ static herr_t H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, void *free_info); -static ssize_t H5T_vlen_seq_mem_getlen(void *_vl); +static ssize_t H5T_vlen_seq_mem_getlen(const void *_vl); static void * H5T_vlen_seq_mem_getptr(void *_vl); -static htri_t H5T_vlen_seq_mem_isnull(H5F_t *f, void *_vl); +static htri_t H5T_vlen_seq_mem_isnull(const H5F_t *f, void *_vl); static herr_t H5T_vlen_seq_mem_read(H5F_t *f, hid_t dxpl_id, void *_vl, void *_buf, size_t len); static herr_t H5T_vlen_seq_mem_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); static herr_t H5T_vlen_seq_mem_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg); -static ssize_t H5T_vlen_str_mem_getlen(void *_vl); +static ssize_t H5T_vlen_str_mem_getlen(const void *_vl); static void * H5T_vlen_str_mem_getptr(void *_vl); -static htri_t H5T_vlen_str_mem_isnull(H5F_t *f, void *_vl); +static htri_t H5T_vlen_str_mem_isnull(const H5F_t *f, void *_vl); static herr_t H5T_vlen_str_mem_read(H5F_t *f, hid_t dxpl_id, void *_vl, void *_buf, size_t len); static herr_t H5T_vlen_str_mem_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); static herr_t H5T_vlen_str_mem_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg); -static ssize_t H5T_vlen_disk_getlen(void *_vl); +static ssize_t H5T_vlen_disk_getlen(const void *_vl); static void * H5T_vlen_disk_getptr(void *_vl); -static htri_t H5T_vlen_disk_isnull(H5F_t *f, void *_vl); +static htri_t H5T_vlen_disk_isnull(const H5F_t *f, void *_vl); static herr_t H5T_vlen_disk_read(H5F_t *f, hid_t dxpl_id, void *_vl, void *_buf, size_t len); static herr_t H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); static herr_t H5T_vlen_disk_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg); @@ -217,7 +217,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5T_vlen_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) +H5T_vlen_set_loc(const H5T_t *dt, H5F_t *f, H5T_loc_t loc) { htri_t ret_value = 0; /* Indicate that success, but no location change */ @@ -297,7 +297,7 @@ H5T_vlen_set_loc(H5T_t *dt, H5F_t *f, H5T_loc_t loc) default: HGOTO_ERROR (H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype location") - } /* end switch */ + } /* end switch */ /*lint !e788 All appropriate cases are covered */ } /* end if */ done: @@ -320,9 +320,9 @@ done: *------------------------------------------------------------------------- */ static ssize_t -H5T_vlen_seq_mem_getlen(void *_vl) +H5T_vlen_seq_mem_getlen(const void *_vl) { - hvl_t *vl=(hvl_t *)_vl; /* Pointer to the user's hvl_t information */ + const hvl_t *vl=(const hvl_t *)_vl; /* Pointer to the user's hvl_t information */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_vlen_seq_mem_getlen) @@ -377,7 +377,7 @@ H5T_vlen_seq_mem_getptr(void *_vl) */ /* ARGSUSED */ static htri_t -H5T_vlen_seq_mem_isnull(H5F_t UNUSED *f, void *_vl) +H5T_vlen_seq_mem_isnull(const H5F_t UNUSED *f, void *_vl) { hvl_t *vl=(hvl_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -532,9 +532,9 @@ H5T_vlen_seq_mem_setnull(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_vl, void *------------------------------------------------------------------------- */ static ssize_t -H5T_vlen_str_mem_getlen(void *_vl) +H5T_vlen_str_mem_getlen(const void *_vl) { - char *s=*(char **)_vl; /* Pointer to the user's string information */ + const char *s=*(const char * const *)_vl; /* Pointer to the user's string information */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_vlen_str_mem_getlen) @@ -589,13 +589,13 @@ H5T_vlen_str_mem_getptr(void *_vl) */ /* ARGSUSED */ static htri_t -H5T_vlen_str_mem_isnull(H5F_t UNUSED *f, void *_vl) +H5T_vlen_str_mem_isnull(const H5F_t UNUSED *f, void *_vl) { char *s=*(char **)_vl; /* Pointer to the user's string information */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_vlen_str_mem_isnull) - FUNC_LEAVE_NOAPI(s==NULL ? TRUE : FALSE); + FUNC_LEAVE_NOAPI(s==NULL ? TRUE : FALSE) } /* end H5T_vlen_str_mem_isnull() */ @@ -726,9 +726,9 @@ H5T_vlen_str_mem_setnull(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_vl, void *------------------------------------------------------------------------- */ static ssize_t -H5T_vlen_disk_getlen(void *_vl) +H5T_vlen_disk_getlen(const void *_vl) { - uint8_t *vl=(uint8_t *)_vl; /* Pointer to the disk VL information */ + const uint8_t *vl=(const uint8_t *)_vl; /* Pointer to the disk VL information */ size_t seq_len; /* Sequence length */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5T_vlen_disk_getlen) @@ -756,6 +756,7 @@ H5T_vlen_disk_getlen(void *_vl) * *------------------------------------------------------------------------- */ +/* ARGSUSED */ static void * H5T_vlen_disk_getptr(void UNUSED *vl) { @@ -783,7 +784,7 @@ H5T_vlen_disk_getptr(void UNUSED *vl) *------------------------------------------------------------------------- */ static htri_t -H5T_vlen_disk_isnull(H5F_t *f, void *_vl) +H5T_vlen_disk_isnull(const H5F_t *f, void *_vl) { uint8_t *vl=(uint8_t *)_vl; /* Pointer to the disk VL information */ haddr_t addr; /* Sequence's heap address */ @@ -823,7 +824,6 @@ H5T_vlen_disk_read(H5F_t *f, hid_t dxpl_id, void *_vl, void *buf, size_t UNUSED { uint8_t *vl=(uint8_t *)_vl; /* Pointer to the user's hvl_t information */ H5HG_t hobjid; - uint32_t seq_len; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5T_vlen_disk_read) @@ -833,8 +833,8 @@ H5T_vlen_disk_read(H5F_t *f, hid_t dxpl_id, void *_vl, void *buf, size_t UNUSED assert(buf); assert(f); - /* Get the length of the sequence */ - UINT32DECODE(vl, seq_len); /* Not used */ + /* Skip the length of the sequence */ + vl += 4; /* Get the heap information */ H5F_addr_decode(f,(const uint8_t **)&vl,&(hobjid.addr)); @@ -870,6 +870,7 @@ done: * *------------------------------------------------------------------------- */ +/* ARGSUSED */ static herr_t H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t UNUSED *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size) { @@ -888,11 +889,10 @@ H5T_vlen_disk_write(H5F_t *f, hid_t dxpl_id, const H5T_vlen_alloc_info_t UNUSED /* Free heap object for old data. */ if(bg!=NULL) { - size_t bg_seq_len; /* "Background" VL info sequence's length */ H5HG_t bg_hobjid; /* "Background" VL info sequence's ID info */ - /* Get the length of the sequence and heap object ID from background data. */ - UINT32DECODE(bg, bg_seq_len); + /* Skip the length of the sequence and heap object ID from background data. */ + bg += 4; /* Get heap information */ H5F_addr_decode(f, (const uint8_t **)&bg, &(bg_hobjid.addr)); @@ -953,11 +953,10 @@ H5T_vlen_disk_setnull(H5F_t *f, hid_t dxpl_id, void *_vl, void *_bg) /* Free heap object for old data. */ if(bg!=NULL) { - hsize_t bg_seq_len=0; /* "Background" VL info sequence's length */ H5HG_t bg_hobjid; /* "Background" VL info sequence's ID info */ - /* Get the length of the sequence and heap object ID from background data. */ - UINT32DECODE(bg, bg_seq_len); + /* Skip the length of the sequence and heap object ID from background data. */ + bg += 4; /* Get heap information */ H5F_addr_decode(f, (const uint8_t **)&bg, &(bg_hobjid.addr)); @@ -1085,7 +1084,7 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi default: break; - } /* end switch */ + } /* end switch */ /*lint !e788 All appropriate cases are covered */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1101,8 +1100,8 @@ done: herr_t H5T_vlen_reclaim(elem,type_id,ndim,point,op_data) void *elem; IN/OUT: Pointer to the dataset element hid_t type_id; IN: Datatype of dataset element - hsize_t ndim; IN: Number of dimensions in dataspace - hssize_t *point; IN: Coordinate location of element in dataspace + unsigned ndim; IN: Number of dimensions in dataspace + hsize_t *point; IN: Coordinate location of element in dataspace void *op_data IN: Operator data RETURNS @@ -1118,7 +1117,7 @@ done: --------------------------------------------------------------------------*/ /* ARGSUSED */ herr_t -H5T_vlen_reclaim(void *elem, hid_t type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void *op_data) +H5T_vlen_reclaim(void *elem, hid_t type_id, unsigned UNUSED ndim, const hsize_t UNUSED *point, void *op_data) { H5T_vlen_alloc_info_t *vl_alloc_info = (H5T_vlen_alloc_info_t *)op_data; /* VL allocation info from iterator */ H5T_t *dt; @@ -32,15 +32,15 @@ /* Local prototypes */ static void H5V_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, - const hsize_t *size, hssize_t *stride1); + const hsize_t *size, hsize_t *stride1); static void H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, - const hsize_t *size, hssize_t *stride1, hssize_t *stride2); + const hsize_t *size, hsize_t *stride1, hsize_t *stride2); #ifdef LATER static void H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size, - unsigned dst_n, const hsize_t *dst_size, const hssize_t *dst_stride, void *_dst, - unsigned src_n, const hsize_t *src_size, const hssize_t *src_stride, const void *_src); + unsigned dst_n, const hsize_t *dst_size, const ssize_t *dst_stride, void *_dst, + unsigned src_n, const hsize_t *src_size, const ssize_t *src_stride, const void *_src); #endif /* LATER */ @@ -66,7 +66,7 @@ H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size, */ static void H5V_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, - const hsize_t *size, hssize_t *stride1) + const hsize_t *size, hsize_t *stride1) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_stride_optimize1); @@ -82,10 +82,8 @@ H5V_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, while (*np && stride1[*np-1]>0 && (hsize_t)(stride1[*np-1])==*elmt_size) { *elmt_size *= size[*np-1]; - if (--*np) { - H5_CHECK_OVERFLOW(size[*np],hsize_t,hssize_t); - stride1[*np-1] += (hssize_t)size[*np] * stride1[*np]; - } + if (--*np) + stride1[*np-1] += size[*np] * stride1[*np]; } FUNC_LEAVE_NOAPI_VOID @@ -117,7 +115,7 @@ H5V_stride_optimize1(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, */ static void H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, - const hsize_t *size, hssize_t *stride1, hssize_t *stride2) + const hsize_t *size, hsize_t *stride1, hsize_t *stride2) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_stride_optimize2) @@ -135,24 +133,20 @@ H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, /* Unroll loop for common cases */ switch(*np) { case 1: /* For 0-D datasets (dunno if this ever gets used...) */ - if((hsize_t)(stride1[0]) == *elmt_size && - (hsize_t)(stride2[0]) == *elmt_size) { + if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) { *elmt_size *= size[0]; --*np; /* *np decrements to a value of 0 now */ } /* end if */ break; case 2: /* For 1-D datasets */ - if((hsize_t)(stride1[1]) == *elmt_size && - (hsize_t)(stride2[1]) == *elmt_size) { + if(stride1[1] == *elmt_size && stride2[1] == *elmt_size) { *elmt_size *= size[1]; --*np; /* *np decrements to a value of 1 now */ - H5_CHECK_OVERFLOW(size[1],hsize_t,hssize_t); - stride1[0] += (hssize_t)size[1] * stride1[1]; - stride2[0] += (hssize_t)size[1] * stride2[1]; + stride1[0] += size[1] * stride1[1]; + stride2[0] += size[1] * stride2[1]; - if((hsize_t)(stride1[0]) == *elmt_size && - (hsize_t)(stride2[0]) == *elmt_size) { + if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) { *elmt_size *= size[0]; --*np; /* *np decrements to a value of 0 now */ } /* end if */ @@ -160,24 +154,19 @@ H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, break; case 3: /* For 2-D datasets */ - if((hsize_t)(stride1[2]) == *elmt_size && - (hsize_t)(stride2[2]) == *elmt_size) { + if(stride1[2] == *elmt_size && stride2[2] == *elmt_size) { *elmt_size *= size[2]; --*np; /* *np decrements to a value of 2 now */ - H5_CHECK_OVERFLOW(size[2],hsize_t,hssize_t); - stride1[1] += (hssize_t)size[2] * stride1[2]; - stride2[1] += (hssize_t)size[2] * stride2[2]; + stride1[1] += size[2] * stride1[2]; + stride2[1] += size[2] * stride2[2]; - if((hsize_t)(stride1[1]) == *elmt_size && - (hsize_t)(stride2[1]) == *elmt_size) { + if(stride1[1] == *elmt_size && stride2[1] == *elmt_size) { *elmt_size *= size[1]; --*np; /* *np decrements to a value of 1 now */ - H5_CHECK_OVERFLOW(size[1],hsize_t,hssize_t); - stride1[0] += (hssize_t)size[1] * stride1[1]; - stride2[0] += (hssize_t)size[1] * stride2[1]; + stride1[0] += size[1] * stride1[1]; + stride2[0] += size[1] * stride2[1]; - if((hsize_t)(stride1[0]) == *elmt_size && - (hsize_t)(stride2[0]) == *elmt_size) { + if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) { *elmt_size *= size[0]; --*np; /* *np decrements to a value of 0 now */ } /* end if */ @@ -186,32 +175,25 @@ H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, break; case 4: /* For 3-D datasets */ - if((hsize_t)(stride1[3]) == *elmt_size && - (hsize_t)(stride2[3]) == *elmt_size) { + if(stride1[3] == *elmt_size && stride2[3] == *elmt_size) { *elmt_size *= size[3]; --*np; /* *np decrements to a value of 3 now */ - H5_CHECK_OVERFLOW(size[3],hsize_t,hssize_t); - stride1[2] += (hssize_t)size[3] * stride1[3]; - stride2[2] += (hssize_t)size[3] * stride2[3]; + stride1[2] += size[3] * stride1[3]; + stride2[2] += size[3] * stride2[3]; - if((hsize_t)(stride1[2]) == *elmt_size && - (hsize_t)(stride2[2]) == *elmt_size) { + if(stride1[2] == *elmt_size && stride2[2] == *elmt_size) { *elmt_size *= size[2]; --*np; /* *np decrements to a value of 2 now */ - H5_CHECK_OVERFLOW(size[2],hsize_t,hssize_t); - stride1[1] += (hssize_t)size[2] * stride1[2]; - stride2[1] += (hssize_t)size[2] * stride2[2]; + stride1[1] += size[2] * stride1[2]; + stride2[1] += size[2] * stride2[2]; - if((hsize_t)(stride1[1]) == *elmt_size && - (hsize_t)(stride2[1]) == *elmt_size) { + if(stride1[1] == *elmt_size && stride2[1] == *elmt_size) { *elmt_size *= size[1]; --*np; /* *np decrements to a value of 1 now */ - H5_CHECK_OVERFLOW(size[1],hsize_t,hssize_t); - stride1[0] += (hssize_t)size[1] * stride1[1]; - stride2[0] += (hssize_t)size[1] * stride2[1]; + stride1[0] += size[1] * stride1[1]; + stride2[0] += size[1] * stride2[1]; - if((hsize_t)(stride1[0]) == *elmt_size && - (hsize_t)(stride2[0]) == *elmt_size) { + if(stride1[0] == *elmt_size && stride2[0] == *elmt_size) { *elmt_size *= size[0]; --*np; /* *np decrements to a value of 0 now */ } /* end if */ @@ -222,13 +204,12 @@ H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, default: while (*np && - (hsize_t)(stride1[*np-1]) == *elmt_size && - (hsize_t)(stride2[*np-1]) == *elmt_size) { + stride1[*np-1] == *elmt_size && + stride2[*np-1] == *elmt_size) { *elmt_size *= size[*np-1]; if (--*np) { - H5_CHECK_OVERFLOW(size[*np],hsize_t,hssize_t); - stride1[*np-1] += (hssize_t)size[*np] * stride1[*np]; - stride2[*np-1] += (hssize_t)size[*np] * stride2[*np]; + stride1[*np-1] += size[*np] * stride1[*np]; + stride2[*np-1] += size[*np] * stride2[*np]; } } break; @@ -272,12 +253,11 @@ H5V_stride_optimize2(unsigned *np/*in,out*/, hsize_t *elmt_size/*in,out*/, */ hsize_t H5V_hyper_stride(unsigned n, const hsize_t *size, - const hsize_t *total_size, const hssize_t *offset, - hssize_t *stride/*out*/) + const hsize_t *total_size, const hsize_t *offset, + hsize_t *stride/*out*/) { hsize_t skip; /*starting point byte offset */ hsize_t acc; /*accumulator */ - hsize_t tmp; int i; /*counter */ hsize_t ret_value; /* Return value */ @@ -291,47 +271,41 @@ H5V_hyper_stride(unsigned n, const hsize_t *size, /* init */ assert(n>0); stride[n-1] = 1; - skip = offset ? (hsize_t)offset[n-1] : 0; + skip = offset ? offset[n-1] : 0; switch(n) { case 2: /* 1-D dataset */ - tmp = total_size[1] - size[1]; - assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - stride[0] = (hssize_t)tmp; /*overflow checked*/ + assert (total_size[1]>=size[1]); + stride[0] = total_size[1]-size[1]; /*overflow checked*/ acc = total_size[1]; - skip += acc * (offset ? (hsize_t)offset[0] : 0); + skip += acc * (offset ? offset[0] : 0); break; case 3: /* 2-D dataset */ - tmp = total_size[2] - size[2]; - assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - stride[1] = (hssize_t)tmp; /*overflow checked*/ + assert (total_size[2]>=size[2]); + stride[1] = total_size[2]-size[2]; /*overflow checked*/ acc = total_size[2]; skip += acc * (offset ? (hsize_t)offset[1] : 0); - tmp = acc * (total_size[1] - size[1]); - assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - stride[0] = (hssize_t)tmp; /*overflow checked*/ + assert (total_size[1]>=size[1]); + stride[0] = acc * (total_size[1] - size[1]); /*overflow checked*/ acc *= total_size[1]; skip += acc * (offset ? (hsize_t)offset[0] : 0); break; case 4: /* 3-D dataset */ - tmp = total_size[3] - size[3]; - assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - stride[2] = (hssize_t)tmp; /*overflow checked*/ + assert (total_size[3]>=size[3]); + stride[2] = total_size[3]-size[3]; /*overflow checked*/ acc = total_size[3]; skip += acc * (offset ? (hsize_t)offset[2] : 0); - tmp = acc * (total_size[2] - size[2]); - assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - stride[1] = (hssize_t)tmp; /*overflow checked*/ + assert (total_size[2]>=size[2]); + stride[1] = acc * (total_size[2] - size[2]); /*overflow checked*/ acc *= total_size[2]; skip += acc * (offset ? (hsize_t)offset[1] : 0); - tmp = acc * (total_size[1] - size[1]); - assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - stride[0] = (hssize_t)tmp; /*overflow checked*/ + assert (total_size[1]>=size[1]); + stride[0] = acc * (total_size[1] - size[1]); /*overflow checked*/ acc *= total_size[1]; skip += acc * (offset ? (hsize_t)offset[0] : 0); break; @@ -339,9 +313,8 @@ H5V_hyper_stride(unsigned n, const hsize_t *size, default: /* others */ for (i=(int)(n-2), acc=1; i>=0; --i) { - tmp = acc * (total_size[i+1] - size[i+1]); - assert (tmp<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - stride[i] = (hssize_t)tmp; /*overflow checked*/ + assert (total_size[i+1]>=size[i+1]); + stride[i] = acc * (total_size[i+1] - size[i+1]); /*overflow checked*/ acc *= total_size[i+1]; skip += acc * (offset ? (hsize_t)offset[i] : 0); } @@ -379,18 +352,18 @@ H5V_hyper_stride(unsigned n, const hsize_t *size, *------------------------------------------------------------------------- */ htri_t -H5V_hyper_eq(int n, - const hssize_t *offset1, const hsize_t *size1, - const hssize_t *offset2, const hsize_t *size2) +H5V_hyper_eq(unsigned n, + const hsize_t *offset1, const hsize_t *size1, + const hsize_t *offset2, const hsize_t *size2) { hsize_t nelmts1 = 1, nelmts2 = 1; - int i; + unsigned i; htri_t ret_value=TRUE; /* Return value */ /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5V_hyper_eq) - if (n <= 0) HGOTO_DONE(TRUE) + if (n == 0) HGOTO_DONE(TRUE) for (i=0; i<n; i++) { if ((offset1 ? offset1[i] : 0) != (offset2 ? offset2[i] : 0)) @@ -428,8 +401,8 @@ done: */ htri_t H5V_hyper_disjointp(unsigned n, - const hssize_t *offset1, const size_t *size1, - const hssize_t *offset2, const size_t *size2) + const hsize_t *offset1, const size_t *size1, + const hsize_t *offset2, const size_t *size2) { unsigned u; htri_t ret_value=FALSE; /* Return value */ @@ -440,17 +413,15 @@ H5V_hyper_disjointp(unsigned n, if (!n || !size1 || !size2) HGOTO_DONE(TRUE) for (u=0; u<n; u++) { - assert (size1[u]<HSSIZET_MAX); - assert (size2[u]<HSSIZET_MAX); + assert (size1[u]<HSIZET_MAX); + assert (size2[u]<HSIZET_MAX); if (0==size1[u] || 0==size2[u]) HGOTO_DONE(TRUE) if (((offset1?offset1[u]:0) < (offset2?offset2[u]:0) && - ((offset1?offset1[u]:0) + (hssize_t)size1[u] <= - (offset2?offset2[u]:0))) || + ((offset1?offset1[u]:0) + size1[u] <= (offset2?offset2[u]:0))) || ((offset2?offset2[u]:0) < (offset1?offset1[u]:0) && - ((offset2?offset2[u]:0) + (hssize_t)size2[u] <= - (offset1?offset1[u]:0)))) + ((offset2?offset2[u]:0) + size2[u] <= (offset1?offset1[u]:0)))) HGOTO_DONE(TRUE) } @@ -482,12 +453,12 @@ done: */ herr_t H5V_hyper_fill(unsigned n, const hsize_t *_size, - const hsize_t *total_size, const hssize_t *offset, void *_dst, + const hsize_t *total_size, const hsize_t *offset, void *_dst, unsigned fill_value) { uint8_t *dst = (uint8_t*)_dst; /*cast for ptr arithmetic */ hsize_t size[H5V_HYPER_NDIMS]; /*a modifiable copy of _size */ - hssize_t dst_stride[H5V_HYPER_NDIMS]; /*destination stride info */ + hsize_t dst_stride[H5V_HYPER_NDIMS]; /*destination stride info */ hsize_t dst_start; /*byte offset to start of stride*/ hsize_t elmt_size = 1; /*bytes per element */ herr_t ret_value; /*function return status */ @@ -562,22 +533,20 @@ herr_t H5V_hyper_copy(unsigned n, const hsize_t *_size, /*destination*/ - const hsize_t *dst_size, const hssize_t *dst_offset, + const hsize_t *dst_size, const hsize_t *dst_offset, void *_dst, /*source*/ - const hsize_t *src_size, const hssize_t *src_offset, + const hsize_t *src_size, const hsize_t *src_offset, const void *_src) { const uint8_t *src = (const uint8_t*)_src; /*cast for ptr arithmtc */ uint8_t *dst = (uint8_t*) _dst; /*cast for ptr arithmtc */ hsize_t size[H5V_HYPER_NDIMS]; /*a modifiable _size */ - hssize_t src_stride[H5V_HYPER_NDIMS]; /*source stride info */ - hssize_t dst_stride[H5V_HYPER_NDIMS]; /*dest stride info */ + hsize_t src_stride[H5V_HYPER_NDIMS]; /*source stride info */ + hsize_t dst_stride[H5V_HYPER_NDIMS]; /*dest stride info */ hsize_t dst_start, src_start; /*offset to start at */ hsize_t elmt_size = 1; /*element size in bytes */ - hsize_t tmp1; - hsize_t tmp2; herr_t ret_value; /*return status */ #ifndef NDEBUG unsigned u; @@ -618,96 +587,82 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size, assert(n>0); dst_stride[n-1] = 1; src_stride[n-1] = 1; - dst_start = dst_offset ? (hsize_t)dst_offset[n-1] : 0; - src_start = src_offset ? (hsize_t)src_offset[n-1] : 0; + dst_start = dst_offset ? dst_offset[n-1] : 0; + src_start = src_offset ? src_offset[n-1] : 0; /* Unroll loop for common cases */ switch(n) { case 2: - tmp1 = (dst_size[1] - size[1]); - tmp2 = (src_size[1] - size[1]); - assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - assert (tmp2<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - dst_stride[0] = (hssize_t)tmp1; /*overflow checked*/ - src_stride[0] = (hssize_t)tmp2; /*overflow checked*/ + assert (dst_size[1]>=size[1]); + assert (src_size[1]>=size[1]); + dst_stride[0] = dst_size[1] - size[1]; /*overflow checked*/ + src_stride[0] = src_size[1] - size[1]; /*overflow checked*/ dst_acc = dst_size[1]; src_acc = src_size[1]; - dst_start += dst_acc * (dst_offset ? (hsize_t)dst_offset[0] : 0); - src_start += src_acc * (src_offset ? (hsize_t)src_offset[0] : 0); + dst_start += dst_acc * (dst_offset ? dst_offset[0] : 0); + src_start += src_acc * (src_offset ? src_offset[0] : 0); break; case 3: - tmp1 = (dst_size[2] - size[2]); - tmp2 = (src_size[2] - size[2]); - assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - assert (tmp2<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - dst_stride[1] = (hssize_t)tmp1; /*overflow checked*/ - src_stride[1] = (hssize_t)tmp2; /*overflow checked*/ + assert (dst_size[2]>=size[2]); + assert (src_size[2]>=size[2]); + dst_stride[1] = dst_size[2] - size[2]; /*overflow checked*/ + src_stride[1] = src_size[2] - size[2]; /*overflow checked*/ dst_acc = dst_size[2]; src_acc = src_size[2]; - dst_start += dst_acc * (dst_offset ? (hsize_t)dst_offset[1] : 0); - src_start += src_acc * (src_offset ? (hsize_t)src_offset[1] : 0); - - tmp1 = dst_acc * (dst_size[1] - size[1]); - tmp2 = src_acc * (src_size[1] - size[1]); - assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - assert (tmp2<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - dst_stride[0] = (hssize_t)tmp1; /*overflow checked*/ - src_stride[0] = (hssize_t)tmp2; /*overflow checked*/ + dst_start += dst_acc * (dst_offset ? dst_offset[1] : 0); + src_start += src_acc * (src_offset ? src_offset[1] : 0); + + assert (dst_size[1]>=size[1]); + assert (src_size[1]>=size[1]); + dst_stride[0] = dst_acc * (dst_size[1] - size[1]); /*overflow checked*/ + src_stride[0] = src_acc * (src_size[1] - size[1]); /*overflow checked*/ dst_acc *= dst_size[1]; src_acc *= src_size[1]; - dst_start += dst_acc * (dst_offset ? (hsize_t)dst_offset[0] : 0); - src_start += src_acc * (src_offset ? (hsize_t)src_offset[0] : 0); + dst_start += dst_acc * (dst_offset ? dst_offset[0] : 0); + src_start += src_acc * (src_offset ? src_offset[0] : 0); break; case 4: - tmp1 = (dst_size[3] - size[3]); - tmp2 = (src_size[3] - size[3]); - assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - assert (tmp2<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - dst_stride[2] = (hssize_t)tmp1; /*overflow checked*/ - src_stride[2] = (hssize_t)tmp2; /*overflow checked*/ + assert (dst_size[3]>=size[3]); + assert (src_size[3]>=size[3]); + dst_stride[2] = dst_size[3] - size[3]; /*overflow checked*/ + src_stride[2] = src_size[3] - size[3]; /*overflow checked*/ dst_acc = dst_size[3]; src_acc = src_size[3]; - dst_start += dst_acc * (dst_offset ? (hsize_t)dst_offset[2] : 0); - src_start += src_acc * (src_offset ? (hsize_t)src_offset[2] : 0); - - tmp1 = dst_acc * (dst_size[2] - size[2]); - tmp2 = src_acc * (src_size[2] - size[2]); - assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - assert (tmp2<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - dst_stride[1] = (hssize_t)tmp1; /*overflow checked*/ - src_stride[1] = (hssize_t)tmp2; /*overflow checked*/ + dst_start += dst_acc * (dst_offset ? dst_offset[2] : 0); + src_start += src_acc * (src_offset ? src_offset[2] : 0); + + assert (dst_size[2]>=size[2]); + assert (src_size[2]>=size[2]); + dst_stride[1] = dst_acc * (dst_size[2] - size[2]); /*overflow checked*/ + src_stride[1] = src_acc * (src_size[2] - size[2]); /*overflow checked*/ dst_acc *= dst_size[2]; src_acc *= src_size[2]; - dst_start += dst_acc * (dst_offset ? (hsize_t)dst_offset[1] : 0); - src_start += src_acc * (src_offset ? (hsize_t)src_offset[1] : 0); - - tmp1 = dst_acc * (dst_size[1] - size[1]); - tmp2 = src_acc * (src_size[1] - size[1]); - assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - assert (tmp2<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - dst_stride[0] = (hssize_t)tmp1; /*overflow checked*/ - src_stride[0] = (hssize_t)tmp2; /*overflow checked*/ + dst_start += dst_acc * (dst_offset ? dst_offset[1] : 0); + src_start += src_acc * (src_offset ? src_offset[1] : 0); + + assert (dst_size[1]>=size[1]); + assert (src_size[1]>=size[1]); + dst_stride[0] = dst_acc * (dst_size[1] - size[1]); /*overflow checked*/ + src_stride[0] = src_acc * (src_size[1] - size[1]); /*overflow checked*/ dst_acc *= dst_size[1]; src_acc *= src_size[1]; - dst_start += dst_acc * (dst_offset ? (hsize_t)dst_offset[0] : 0); - src_start += src_acc * (src_offset ? (hsize_t)src_offset[0] : 0); + dst_start += dst_acc * (dst_offset ? dst_offset[0] : 0); + src_start += src_acc * (src_offset ? src_offset[0] : 0); break; default: /* others */ for (ii=(int)(n-2), dst_acc=1, src_acc=1; ii>=0; --ii) { - tmp1 = dst_acc * (dst_size[ii+1] - size[ii+1]); - tmp2 = src_acc * (src_size[ii+1] - size[ii+1]); - assert (tmp1<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - assert (tmp2<((hsize_t)1<<(8*sizeof(hssize_t)-1))); - dst_stride[ii] = (hssize_t)tmp1; /*overflow checked*/ - src_stride[ii] = (hssize_t)tmp2; /*overflow checked*/ + assert (dst_size[ii+1]>=size[ii+1]); + assert (src_size[ii+1]>=size[ii+1]); + dst_stride[ii] = dst_acc * (dst_size[ii+1] - size[ii+1]); /*overflow checked*/ + src_stride[ii] = src_acc * (src_size[ii+1] - size[ii+1]); /*overflow checked*/ dst_acc *= dst_size[ii+1]; src_acc *= src_size[ii+1]; - dst_start += dst_acc * (dst_offset ? (hsize_t)dst_offset[ii] : 0); - src_start += src_acc * (src_offset ? (hsize_t)src_offset[ii] : 0); + dst_start += dst_acc * (dst_offset ? dst_offset[ii] : 0); + src_start += src_acc * (src_offset ? src_offset[ii] : 0); } break; } /* end switch */ @@ -742,7 +697,7 @@ H5V_hyper_copy(unsigned n, const hsize_t *_size, */ herr_t H5V_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, - const hssize_t *stride, void *_dst, unsigned fill_value) + const hsize_t *stride, void *_dst, unsigned fill_value) { uint8_t *dst = (uint8_t*)_dst; /*cast for ptr arithmetic */ hsize_t idx[H5V_HYPER_NDIMS]; /*1-origin indices */ @@ -801,6 +756,74 @@ H5V_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, */ herr_t H5V_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, + const hsize_t *dst_stride, void *_dst, + const hsize_t *src_stride, const void *_src) +{ + uint8_t *dst = (uint8_t*)_dst; /*cast for ptr arithmetic*/ + const uint8_t *src = (const uint8_t*) _src; /*cast for ptr arithmetic*/ + hsize_t idx[H5V_HYPER_NDIMS]; /*1-origin indices */ + hsize_t nelmts; /*num elements to copy */ + hsize_t i; /*counter */ + int j; /*counters */ + hbool_t carry; /*carray for subtraction*/ + + FUNC_ENTER_NOAPI_NOFUNC(H5V_stride_copy) + assert (elmt_size<SIZET_MAX); + + if (n) { + H5V_vector_cpy(n, idx, size); + nelmts = H5V_vector_reduce_product(n, size); + for (i=0; i<nelmts; i++) { + + /* Copy an element */ + H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t); + HDmemcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ + + /* Decrement indices and advance pointers */ + for (j=(int)(n-1), carry=TRUE; j>=0 && carry; --j) { + src += src_stride[j]; + dst += dst_stride[j]; + + if (--idx[j]) + carry = FALSE; + else { + assert(size); + idx[j] = size[j]; + } + } + } + } else { + H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t); + HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ + } + + FUNC_LEAVE_NOAPI(SUCCEED) +} + + +/*------------------------------------------------------------------------- + * Function: H5V_stride_copy_s + * + * Purpose: Uses DST_STRIDE and SRC_STRIDE to advance through the arrays + * DST and SRC while copying bytes from SRC to DST. This + * function minimizes the number of calls to memcpy() by + * combining various strides, but it will never touch memory + * outside the hyperslab defined by the strides. + * + * Note: If the src_stride is all zero and elmt_size is one, then it's + * probably more efficient to use H5V_stride_fill() instead. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Robb Matzke + * Saturday, October 11, 1997 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5V_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, const hssize_t *dst_stride, void *_dst, const hssize_t *src_stride, const void *_src) { @@ -812,7 +835,7 @@ H5V_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, int j; /*counters */ hbool_t carry; /*carray for subtraction*/ - FUNC_ENTER_NOAPI_NOFUNC(H5V_stride_copy) + FUNC_ENTER_NOAPI_NOFUNC(H5V_stride_copy_s) assert (elmt_size<SIZET_MAX); if (n) { @@ -869,12 +892,12 @@ H5V_stride_copy2(hsize_t nelmts, hsize_t elmt_size, /* destination */ unsigned dst_n, const hsize_t *dst_size, - const hssize_t *dst_stride, + const hsize_t *dst_stride, void *_dst, /* source */ unsigned src_n, const hsize_t *src_size, - const hssize_t *src_stride, + const hsize_t *src_stride, const void *_src) { uint8_t *dst = (uint8_t *) _dst; @@ -1046,9 +1069,8 @@ H5V_array_down(unsigned n, const hsize_t *total_size, hsize_t *down) *------------------------------------------------------------------------- */ hsize_t -H5V_array_offset_pre(unsigned n, const hsize_t *acc, const hssize_t *offset) +H5V_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset) { - hsize_t skip; /*starting point byte offset */ int i; /*counter */ hsize_t ret_value; /* Return value */ @@ -1059,13 +1081,8 @@ H5V_array_offset_pre(unsigned n, const hsize_t *acc, const hssize_t *offset) assert(offset); /* Compute offset in array */ - for (i=(int)(n-1), skip=0; i>=0; --i) { - H5_CHECK_OVERFLOW(offset[i],hssize_t,hsize_t); - skip += acc[i] * (hsize_t)offset[i]; - } /* end for */ - - /* Set return value */ - ret_value=skip; + for (i=(int)(n-1), ret_value=0; i>=0; --i) + ret_value += acc[i] * offset[i]; FUNC_LEAVE_NOAPI(ret_value) } /* end H5V_array_offset_pre() */ @@ -1092,7 +1109,7 @@ H5V_array_offset_pre(unsigned n, const hsize_t *acc, const hssize_t *offset) *------------------------------------------------------------------------- */ hsize_t -H5V_array_offset(unsigned n, const hsize_t *total_size, const hssize_t *offset) +H5V_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset) { hsize_t acc_arr[H5V_HYPER_NDIMS]; /* Accumulated size of down dimensions */ hsize_t ret_value; /* Return value */ @@ -1136,7 +1153,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5V_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hssize_t *coords) +H5V_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hsize_t *coords) { hsize_t idx[H5V_HYPER_NDIMS]; /* Size of each dimension in bytes */ hsize_t acc; /* Size accumulator */ @@ -1159,8 +1176,7 @@ H5V_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hssize_t * /* Compute the coordinates from the offset */ for(u=0; u<n; u++) { - H5_CHECK_OVERFLOW(offset/idx[u],hsize_t,hssize_t); /*lint !e771 idx will always be initialized */ - coords[u]=(hssize_t)(offset/idx[u]); + coords[u]=offset/idx[u]; offset %= idx[u]; } /* end for */ @@ -1211,10 +1227,10 @@ H5V_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hssize_t * *------------------------------------------------------------------------- */ herr_t -H5V_chunk_index(unsigned ndims, const hssize_t *coord, const size_t *chunk, +H5V_chunk_index(unsigned ndims, const hsize_t *coord, const size_t *chunk, const hsize_t *down_nchunks, hsize_t *chunk_idx) { - hssize_t scaled_coord[H5V_HYPER_NDIMS]; /* Scaled, coordinates, in terms of chunks */ + hsize_t scaled_coord[H5V_HYPER_NDIMS]; /* Scaled, coordinates, in terms of chunks */ unsigned u; /* Local index variable */ FUNC_ENTER_NOAPI_NOFUNC(H5V_chunk_index) @@ -1226,10 +1242,8 @@ H5V_chunk_index(unsigned ndims, const hssize_t *coord, const size_t *chunk, assert(chunk_idx); /* Compute the scaled coordinates for actual coordinates */ - for(u=0; u<ndims; u++) { - H5_CHECK_OVERFLOW(chunk[u],size_t,hssize_t); - scaled_coord[u]=coord[u]/(hssize_t)chunk[u]; - } /* end for */ + for(u=0; u<ndims; u++) + scaled_coord[u]=coord[u]/chunk[u]; /* Compute the chunk index */ *chunk_idx=H5V_array_offset_pre(ndims,down_nchunks,scaled_coord); /*lint !e772 scaled_coord will always be initialized */ @@ -1268,9 +1282,10 @@ H5V_memcpyvv(void *_dst, { unsigned char *dst; /* Destination buffer pointer */ const unsigned char *src; /* Source buffer pointer */ + size_t total_size=0; /* Total size of sequence in bytes */ size_t size; /* Size of sequence in bytes */ size_t u,v; /* Local index variables */ - ssize_t ret_value=0; /* Return value */ + ssize_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOFUNC(H5V_memcpyvv) @@ -1316,13 +1331,16 @@ H5V_memcpyvv(void *_dst, u++; /* Increment number of bytes copied */ - ret_value+=(ssize_t)size; + total_size+=size; } /* end for */ /* Update current sequence vectors */ *dst_curr_seq=u; *src_curr_seq=v; + /* Set return value */ + H5_ASSIGN_OVERFLOW(ret_value,total_size,size_t,ssize_t); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5V_memcpyvv() */ diff --git a/src/H5Vprivate.h b/src/H5Vprivate.h index 24cfc19..52f9d6b 100644 --- a/src/H5Vprivate.h +++ b/src/H5Vprivate.h @@ -47,28 +47,31 @@ H5_DLL hsize_t H5V_hyper_stride(unsigned n, const hsize_t *size, const hsize_t *total_size, - const hssize_t *offset, - hssize_t *stride); -H5_DLL htri_t H5V_hyper_disjointp(unsigned n, const hssize_t *offset1, + const hsize_t *offset, + hsize_t *stride); +H5_DLL htri_t H5V_hyper_disjointp(unsigned n, const hsize_t *offset1, const size_t *size1, - const hssize_t *offset2, + const hsize_t *offset2, const size_t *size2); -H5_DLL htri_t H5V_hyper_eq(int n, const hssize_t *offset1, - const hsize_t *size1, const hssize_t *offset2, +H5_DLL htri_t H5V_hyper_eq(unsigned n, const hsize_t *offset1, + const hsize_t *size1, const hsize_t *offset2, const hsize_t *size2); H5_DLL herr_t H5V_hyper_fill(unsigned n, const hsize_t *_size, const hsize_t *total_size, - const hssize_t *offset, void *_dst, + const hsize_t *offset, void *_dst, unsigned fill_value); H5_DLL herr_t H5V_hyper_copy(unsigned n, const hsize_t *size, const hsize_t *dst_total_size, - const hssize_t *dst_offset, void *_dst, + const hsize_t *dst_offset, void *_dst, const hsize_t *src_total_size, - const hssize_t *src_offset, const void *_src); + const hsize_t *src_offset, const void *_src); H5_DLL herr_t H5V_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, - const hssize_t *stride, void *_dst, + const hsize_t *stride, void *_dst, unsigned fill_value); H5_DLL herr_t H5V_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *_size, + const hsize_t *dst_stride, void *_dst, + const hsize_t *src_stride, const void *_src); +H5_DLL herr_t H5V_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *_size, const hssize_t *dst_stride, void *_dst, const hssize_t *src_stride, const void *_src); H5_DLL herr_t H5V_array_fill(void *_dst, const void *src, size_t size, @@ -76,12 +79,12 @@ H5_DLL herr_t H5V_array_fill(void *_dst, const void *src, size_t size, H5_DLL herr_t H5V_array_down(unsigned n, const hsize_t *total_size, hsize_t *down); H5_DLL hsize_t H5V_array_offset_pre(unsigned n, - const hsize_t *acc, const hssize_t *offset); + const hsize_t *acc, const hsize_t *offset); H5_DLL hsize_t H5V_array_offset(unsigned n, const hsize_t *total_size, - const hssize_t *offset); + const hsize_t *offset); H5_DLL herr_t H5V_array_calc(hsize_t offset, unsigned n, - const hsize_t *total_size, hssize_t *coords); -H5_DLL herr_t H5V_chunk_index(unsigned ndims, const hssize_t *coord, + const hsize_t *total_size, hsize_t *coords); +H5_DLL herr_t H5V_chunk_index(unsigned ndims, const hsize_t *coord, const size_t *chunk, const hsize_t *down_nchunks, hsize_t *chunk_idx); H5_DLL ssize_t H5V_memcpyvv(void *_dst, size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize_t dst_off_arr[], @@ -213,7 +216,7 @@ done: *------------------------------------------------------------------------- */ static H5_inline int UNUSED -H5V_vector_cmp_u (int n, const hsize_t *v1, const hsize_t *v2) +H5V_vector_cmp_u (unsigned n, const hsize_t *v1, const hsize_t *v2) { int ret_value=0; /* Return value */ @@ -1198,8 +1198,10 @@ herr_t H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags fclass = H5Z_find(filter); #ifdef H5_WANT_H5_V1_6_COMPAT - if(fclass == NULL && filter_config_flags != NULL) + if(fclass == NULL && filter_config_flags != NULL) { *filter_config_flags = 0; + HGOTO_DONE(SUCCEED) + } /* end if */ #else if(fclass == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Filter not defined") @@ -1218,3 +1220,4 @@ herr_t H5Zget_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags done: FUNC_LEAVE_API(ret_value) } + diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index c1feb7a..8f1cfd0 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -118,12 +118,12 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); \ if((RESL).type == H5Z_XFORM_SYMBOL) \ { \ - tree_val = ((RESR).type==H5Z_XFORM_INTEGER ? (RESR).value.int_val : (RESR).value.float_val); \ + tree_val = ((RESR).type==H5Z_XFORM_INTEGER ? (double)(RESR).value.int_val : (RESR).value.float_val); \ p = (TYPE*)(RESL).value.dat_val; \ } \ else \ { \ - tree_val = ((RESL).type==H5Z_XFORM_INTEGER ? (RESL).value.int_val : (RESL).value.float_val); \ + tree_val = ((RESL).type==H5Z_XFORM_INTEGER ? (double)(RESL).value.int_val : (RESL).value.float_val); \ p = (TYPE*)(RESR).value.dat_val; \ } \ \ @@ -226,8 +226,8 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); ( (tree->rchild->type == H5Z_XFORM_FLOAT) || (tree->rchild->type == H5Z_XFORM_INTEGER))) \ { \ tree->type = H5Z_XFORM_FLOAT; \ - tree->value.float_val = ((tree->lchild->type == H5Z_XFORM_FLOAT) ? tree->lchild->value.float_val : tree->lchild->value.int_val) OP \ - ((tree->rchild->type == H5Z_XFORM_FLOAT) ? tree->rchild->value.float_val : tree->rchild->value.int_val); \ + tree->value.float_val = ((tree->lchild->type == H5Z_XFORM_FLOAT) ? tree->lchild->value.float_val : (double)tree->lchild->value.int_val) OP \ + ((tree->rchild->type == H5Z_XFORM_FLOAT) ? tree->rchild->value.float_val : (double)tree->rchild->value.int_val); \ H5MM_xfree(tree->lchild); \ H5MM_xfree(tree->rchild); \ tree->lchild = NULL; \ @@ -249,9 +249,9 @@ static void H5Z_print(H5Z_node *tree, FILE *stream); #define H5Z_XFORM_DO_OP5(TYPE, SIZE) \ { \ - TYPE val = (tree->type == H5Z_XFORM_INTEGER) ? tree->value.int_val : tree->value.float_val; \ + TYPE val = ((tree->type == H5Z_XFORM_INTEGER) ? (TYPE)tree->value.int_val : (TYPE)tree->value.float_val); \ H5V_array_fill(array, &val, sizeof(TYPE), (SIZE)); \ -} +} @@ -532,7 +532,7 @@ static H5Z_node * H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) { H5Z_node *expr; - void* ret_value=NULL; + void* ret_value; FUNC_ENTER_NOAPI_NOINIT(H5Z_parse_expression) @@ -540,65 +540,63 @@ H5Z_parse_expression(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) for (;;) { H5Z_node *new_node; - new_node = NULL; current = H5Z_get_token(current); switch (current->tok_type) { - case H5Z_XFORM_PLUS: - new_node = H5Z_new_node(H5Z_XFORM_PLUS); + case H5Z_XFORM_PLUS: + new_node = H5Z_new_node(H5Z_XFORM_PLUS); - if (!new_node) { - H5Z_xform_destroy_parse_tree(expr); - expr = NULL; - HGOTO_DONE(expr) - } + if (!new_node) { + H5Z_xform_destroy_parse_tree(expr); + HGOTO_DONE(expr) + } - new_node->lchild = expr; - new_node->rchild = H5Z_parse_term(current, dat_val_pointers); + new_node->lchild = expr; + new_node->rchild = H5Z_parse_term(current, dat_val_pointers); - if (!new_node->rchild) { - H5Z_xform_destroy_parse_tree(new_node); - expr = NULL; - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } + if (!new_node->rchild) { + H5Z_xform_destroy_parse_tree(new_node); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } - expr = new_node; - break; - case H5Z_XFORM_MINUS: - new_node = H5Z_new_node(H5Z_XFORM_MINUS); + expr = new_node; + break; - if (!new_node) { - H5Z_xform_destroy_parse_tree(expr); - expr = NULL; + case H5Z_XFORM_MINUS: + new_node = H5Z_new_node(H5Z_XFORM_MINUS); + + if (!new_node) { + H5Z_xform_destroy_parse_tree(expr); + HGOTO_DONE(expr) + } + + new_node->lchild = expr; + new_node->rchild = H5Z_parse_term(current, dat_val_pointers); + + if (!new_node->rchild) { + H5Z_xform_destroy_parse_tree(new_node); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } + + expr = new_node; + break; + + case H5Z_XFORM_RPAREN: + H5Z_unget_token(current); HGOTO_DONE(expr) - } - new_node->lchild = expr; - new_node->rchild = H5Z_parse_term(current, dat_val_pointers); + case H5Z_XFORM_END: + HGOTO_DONE(expr) - if (!new_node->rchild) { - H5Z_xform_destroy_parse_tree(new_node); - expr = NULL; + default: + H5Z_xform_destroy_parse_tree(expr); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } - - expr = new_node; - break; - case H5Z_XFORM_RPAREN: - H5Z_unget_token(current); - HGOTO_DONE(expr) - case H5Z_XFORM_END: - HGOTO_DONE(expr) - default: - H5Z_xform_destroy_parse_tree(expr); - expr = NULL; - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") } } done: - FUNC_LEAVE_NOAPI(expr) + FUNC_LEAVE_NOAPI(ret_value) } @@ -621,72 +619,69 @@ static H5Z_node * H5Z_parse_term(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) { H5Z_node *term = NULL; - void* ret_value=NULL; + void* ret_value; FUNC_ENTER_NOAPI(H5Z_parse_term, NULL); term = H5Z_parse_factor(current, dat_val_pointers); for (;;) { H5Z_node *new_node; - new_node = NULL; current = H5Z_get_token(current); switch (current->tok_type) { - case H5Z_XFORM_MULT: - new_node = H5Z_new_node(H5Z_XFORM_MULT); + case H5Z_XFORM_MULT: + new_node = H5Z_new_node(H5Z_XFORM_MULT); - if (!new_node) { - H5Z_xform_destroy_parse_tree(term); - term = NULL; - HGOTO_DONE(term) - } + if (!new_node) { + H5Z_xform_destroy_parse_tree(term); + HGOTO_DONE(term) + } - new_node->lchild = term; - new_node->rchild = H5Z_parse_factor(current, dat_val_pointers); + new_node->lchild = term; + new_node->rchild = H5Z_parse_factor(current, dat_val_pointers); - if (!new_node->rchild) { - H5Z_xform_destroy_parse_tree(term); - term = NULL; - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } + if (!new_node->rchild) { + H5Z_xform_destroy_parse_tree(term); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } - term = new_node; - break; - case H5Z_XFORM_DIVIDE: - new_node = H5Z_new_node(H5Z_XFORM_DIVIDE); + term = new_node; + break; - if (!new_node) { - H5Z_xform_destroy_parse_tree(term); - term = NULL; - HGOTO_DONE(term) - } + case H5Z_XFORM_DIVIDE: + new_node = H5Z_new_node(H5Z_XFORM_DIVIDE); - new_node->lchild = term; - new_node->rchild = H5Z_parse_factor(current, dat_val_pointers); - term = new_node; + if (!new_node) { + H5Z_xform_destroy_parse_tree(term); + HGOTO_DONE(term) + } - if (!new_node->rchild) { - H5Z_xform_destroy_parse_tree(term); - term = NULL; - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } + new_node->lchild = term; + new_node->rchild = H5Z_parse_factor(current, dat_val_pointers); + term = new_node; - break; - case H5Z_XFORM_RPAREN: - H5Z_unget_token(current); - HGOTO_DONE(term) - case H5Z_XFORM_END: - HGOTO_DONE(term) - default: - H5Z_unget_token(current); - HGOTO_DONE(term) + if (!new_node->rchild) { + H5Z_xform_destroy_parse_tree(term); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } + break; + + case H5Z_XFORM_RPAREN: + H5Z_unget_token(current); + HGOTO_DONE(term) + + case H5Z_XFORM_END: + HGOTO_DONE(term) + + default: + H5Z_unget_token(current); + HGOTO_DONE(term) } } done: - FUNC_LEAVE_NOAPI(term) - + FUNC_LEAVE_NOAPI(ret_value) } @@ -709,12 +704,12 @@ done: * *------------------------------------------------------------------------- */ - static H5Z_node * +static H5Z_node * H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) { H5Z_node *factor=NULL; - H5Z_node *new_node=NULL; - void* ret_value=NULL; + H5Z_node *new_node; + void* ret_value; FUNC_ENTER_NOAPI(H5Z_parse_factor, NULL); @@ -726,118 +721,115 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) if (!factor) HGOTO_DONE(factor) - - sscanf(current->tok_begin, "%ld", &factor->value.int_val); + sscanf(current->tok_begin, "%ld", &factor->value.int_val); break; + case H5Z_XFORM_FLOAT: factor = H5Z_new_node(H5Z_XFORM_FLOAT); if (!factor) HGOTO_DONE(factor) - - sscanf(current->tok_begin, "%lf", &factor->value.float_val); + sscanf(current->tok_begin, "%lf", &factor->value.float_val); break; + case H5Z_XFORM_SYMBOL: factor = H5Z_new_node(H5Z_XFORM_SYMBOL); if (!factor) HGOTO_DONE(factor) - factor->value.dat_val = &(dat_val_pointers->ptr_dat_val[dat_val_pointers->num_ptrs]); + factor->value.dat_val = &(dat_val_pointers->ptr_dat_val[dat_val_pointers->num_ptrs]); dat_val_pointers->num_ptrs++; - break; + case H5Z_XFORM_LPAREN: factor = H5Z_parse_expression(current, dat_val_pointers); if (!factor) HGOTO_DONE(factor) - current = H5Z_get_token(current); + current = H5Z_get_token(current); if (current->tok_type != H5Z_XFORM_RPAREN) { H5Z_xform_destroy_parse_tree(factor); - factor = NULL; HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error in data transform expression") } - break; + case H5Z_XFORM_RPAREN: /* We shouldn't see a ) right now */ H5Z_xform_destroy_parse_tree(factor); - factor = NULL; HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error: unexpected ')' ") + case H5Z_XFORM_PLUS: - /* unary + */ - new_node = H5Z_parse_factor(current, dat_val_pointers); - - if (new_node) { - if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT && - new_node->type != H5Z_XFORM_SYMBOL) { - H5Z_xform_destroy_parse_tree(new_node); - H5Z_xform_destroy_parse_tree(factor); - factor=NULL; - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } - - factor = new_node; - new_node = H5Z_new_node(H5Z_XFORM_PLUS); - - if (!new_node) { - H5Z_xform_destroy_parse_tree(factor); - factor = NULL; - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } - - new_node->rchild = factor; - factor = new_node; - } else { - H5Z_xform_destroy_parse_tree(factor); - factor = NULL; - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } + /* unary + */ + new_node = H5Z_parse_factor(current, dat_val_pointers); + + if (new_node) { + if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT && + new_node->type != H5Z_XFORM_SYMBOL) { + H5Z_xform_destroy_parse_tree(new_node); + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } + + factor = new_node; + new_node = H5Z_new_node(H5Z_XFORM_PLUS); + + if (!new_node) { + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } + + new_node->rchild = factor; + factor = new_node; + } else { + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } + break; - break; case H5Z_XFORM_MINUS: - /* unary - */ - new_node = H5Z_parse_factor(current, dat_val_pointers); - - if (new_node) { - if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT && - new_node->type != H5Z_XFORM_SYMBOL) { - H5Z_xform_destroy_parse_tree(new_node); - H5Z_xform_destroy_parse_tree(factor); - factor = NULL; - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } - - factor = new_node; - new_node = H5Z_new_node(H5Z_XFORM_MINUS); - - if (!new_node) { - H5Z_xform_destroy_parse_tree(factor); - factor = NULL; - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } - - new_node->rchild = factor; - factor = new_node; - } else { - H5Z_xform_destroy_parse_tree(factor); - factor = NULL; - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") - } + /* unary - */ + new_node = H5Z_parse_factor(current, dat_val_pointers); + + if (new_node) { + if (new_node->type != H5Z_XFORM_INTEGER && new_node->type != H5Z_XFORM_FLOAT && + new_node->type != H5Z_XFORM_SYMBOL) { + H5Z_xform_destroy_parse_tree(new_node); + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } + + factor = new_node; + new_node = H5Z_new_node(H5Z_XFORM_MINUS); + + if (!new_node) { + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } + + new_node->rchild = factor; + factor = new_node; + } else { + H5Z_xform_destroy_parse_tree(factor); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + } + break; - break; case H5Z_XFORM_END: - HGOTO_DONE(factor) + break; + default: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Invalid token while parsing data transform expression") } + /* Set return value */ + ret_value=factor; + done: - FUNC_LEAVE_NOAPI(factor); + FUNC_LEAVE_NOAPI(ret_value); } @@ -853,7 +845,7 @@ done: * *------------------------------------------------------------------------- */ - static H5Z_node * +static H5Z_node * H5Z_new_node(H5Z_token_type type) { H5Z_node* new_node; @@ -882,7 +874,7 @@ H5Z_new_node(H5Z_token_type type) *------------------------------------------------------------------------- */ - herr_t +herr_t H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size, const H5T_t *buf_type) { H5Z_node *tree; @@ -1095,7 +1087,8 @@ done: * *------------------------------------------------------------------------- */ -static hid_t H5Z_xform_find_type(const H5T_t* type) +static hid_t +H5Z_xform_find_type(const H5T_t* type) { hid_t ret_value = SUCCEED; @@ -1180,7 +1173,8 @@ done: * *------------------------------------------------------------------------- */ -void* H5Z_xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z_datval_ptrs* new_dat_val_pointers) +void * +H5Z_xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z_datval_ptrs* new_dat_val_pointers) { H5Z_node* ret_value=NULL; @@ -1257,38 +1251,30 @@ void* H5Z_xform_copy_tree(H5Z_node* tree, H5Z_datval_ptrs* dat_val_pointers, H5Z * *------------------------------------------------------------------------- */ -void H5Z_xform_reduce_tree(H5Z_node* tree) +void +H5Z_xform_reduce_tree(H5Z_node* tree) { - hid_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5Z_xform_reduce_tree) - if(!tree) - HGOTO_DONE(SUCCEED) - - if((tree->type == H5Z_XFORM_PLUS) || (tree->type == H5Z_XFORM_DIVIDE) ||(tree->type == H5Z_XFORM_MULT) ||(tree->type == H5Z_XFORM_MINUS)) - { - if(((tree->lchild->type == H5Z_XFORM_INTEGER) || (tree->lchild->type == H5Z_XFORM_FLOAT)) && ((tree->rchild->type == H5Z_XFORM_INTEGER) || (tree->rchild->type == H5Z_XFORM_FLOAT))) - H5Z_do_op(tree); - else + if(tree) { + if((tree->type == H5Z_XFORM_PLUS) || (tree->type == H5Z_XFORM_DIVIDE) ||(tree->type == H5Z_XFORM_MULT) ||(tree->type == H5Z_XFORM_MINUS)) { - H5Z_xform_reduce_tree(tree->lchild); - if(((tree->lchild->type == H5Z_XFORM_INTEGER) || (tree->lchild->type == H5Z_XFORM_FLOAT)) && ((tree->rchild->type == H5Z_XFORM_INTEGER) || (tree->rchild->type == H5Z_XFORM_FLOAT))) - { - H5Z_do_op(tree); - HGOTO_DONE(SUCCEED) - } - - H5Z_xform_reduce_tree(tree->rchild); if(((tree->lchild->type == H5Z_XFORM_INTEGER) || (tree->lchild->type == H5Z_XFORM_FLOAT)) && ((tree->rchild->type == H5Z_XFORM_INTEGER) || (tree->rchild->type == H5Z_XFORM_FLOAT))) - { - H5Z_do_op(tree); - HGOTO_DONE(SUCCEED) - } + H5Z_do_op(tree); + else + { + H5Z_xform_reduce_tree(tree->lchild); + if(((tree->lchild->type == H5Z_XFORM_INTEGER) || (tree->lchild->type == H5Z_XFORM_FLOAT)) && ((tree->rchild->type == H5Z_XFORM_INTEGER) || (tree->rchild->type == H5Z_XFORM_FLOAT))) + H5Z_do_op(tree); + else { + H5Z_xform_reduce_tree(tree->rchild); + if(((tree->lchild->type == H5Z_XFORM_INTEGER) || (tree->lchild->type == H5Z_XFORM_FLOAT)) && ((tree->rchild->type == H5Z_XFORM_INTEGER) || (tree->rchild->type == H5Z_XFORM_FLOAT))) + H5Z_do_op(tree); + } + } } } -done: FUNC_LEAVE_NOAPI_VOID; } @@ -1307,7 +1293,8 @@ done: * *------------------------------------------------------------------------- */ -static void H5Z_do_op(H5Z_node* tree) +static void +H5Z_do_op(H5Z_node* tree) { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5Z_do_op) diff --git a/src/H5config.h.in b/src/H5config.h.in index d884a20..4d95197 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -15,6 +15,9 @@ long long values. */ #undef FP_TO_ULLONG_RIGHT_MAXIMUM +/* Define if gettimeofday() populates the tz pointer passed in */ +#undef GETTIMEOFDAY_GIVES_TZ + /* Define if the __attribute__(()) extension is present */ #undef HAVE_ATTRIBUTE @@ -377,9 +380,6 @@ /* Define if `__tm_gmtoff' is a member of `struct tm' */ #undef HAVE___TM_GMTOFF -/* Define if gettimeofday() populates the tz pointer passed in */ -#undef GETTIMEOFDAY_GIVES_TZ - /* Define if your system's `MPI_File_set_size' function works for files over 2GB. */ #undef MPI_FILE_SET_SIZE_BIG diff --git a/src/H5private.h b/src/H5private.h index 5421b6c..d144a95 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -289,7 +289,7 @@ # define FALSE 0 #endif #ifndef TRUE -# define TRUE (!FALSE) +# define TRUE 1 #endif /* diff --git a/src/H5public.h b/src/H5public.h index dd08099..d3b7589 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -12,9 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - - /* * This file contains public declarations for the HDF5 module. */ diff --git a/src/hdf5.lnt b/src/hdf5.lnt index b3576ce..aa8f241 100755 --- a/src/hdf5.lnt +++ b/src/hdf5.lnt @@ -1,48 +1,21 @@ -// Define the __FUNCTION__ so we don't get warnings about using it. --d__FUNCTION__="NoFunctionName" - -// Turn off warnings about not using the return value from these functions: --esym(534, HDfprintf, HDsnprintf, HDvsnprintf) --esym(534, H5E_clear_stack, H5E_push_stack) --esym(534, H5FL_arr_free, H5FL_blk_free, H5FL_reg_free) --esym(534, H5I_clear_group, H5I_destroy_group) --esym(534, H5MM_xfree) --esym(534, H5TB_dfree) --esym(534, H5V_array_fill) +// Lint options shared by both PC-Lint for Windows and Flexelint for Linux // Turn off warnings about not using the inlined H5V* functions: -esym(528, H5V_vector_reduce_product, H5V_vector_inc) -esym(528, H5V_vector_cmp, H5V_vector_cmp_s, H5V_vector_cmp_u) -esym(528, H5V_vector_zerop_s, H5V_vector_zerop_u) -// Turn off warnings about "Ignoring return value of function" for -// H5open() in public error macros --emacro(534, H5Epush_ret, H5Epush_goto) - -// Turn off warnings about "Expression-like macro not parenthesized" for -// enumerated type increment & decrement macros: --esym(773, H5_INC_ENUM, H5_DEC_ENUM) - -// Turn off warnings about not using PABLO_MASK macro --esym(750, PABLO_MASK) - -// Suppress message about our use of 'goto' in our error macros --emacro(801,HGOTO_DONE, H5Epush_goto) - // Suppress message about using 'goto' in a few functions -efunc(801,H5_term_library,H5_trace) // Suppress message about "boolean test of a paranthesized assignment" --e820 +-efunc(820,H5_term_library) // Suppress message about "Constant value boolean" in FUNC_ENTER* macros -emacro(506,FUNC_ENTER_API,FUNC_ENTER_API_NOCLEAR, FUNC_ENTER_NOAPI) -// Suppress message about "Suspicious cast" in FUNC_ENTER* macros --emacro(611,FUNC_ENTER_API,FUNC_ENTER_NOAPI) - -// Suppress message about "Boolean within 'if' always evaluates false" in FUNC_ENTER* macros --emacro(774,FUNC_ENTER_API,FUNC_ENTER_NOAPI) +// Suppress message about "Constant value boolean" in TRUE macros +-emacro(506,TRUE) // Suppress message about "Constant value boolean" in IS_H5FD_MPI* macros -emacro(506,IS_H5FD_MPI) @@ -50,38 +23,39 @@ // Suppress message about "Boolean within 'if' always evaluates false" in IS_H5FD_MPI* macros -emacro((774),IS_H5FD_MPI) -// Suppress message about "Static variable found within inline function" in FUNC_ENTER* macros --emacro(1534,FUNC_ENTER_NOINIT) - -// Suppress message about "Shift right of signed quantity" in H5I_GRP macro --emacro(702,H5I_GRP) - -// Suppress message about "Constant expression evaluates to 0 in expression" in H5FL_ARR* macros --emacro(778,H5FL_ARR_DEFINE_COMMON) - -// Suppress message about "Union initialization" in H5FL_ARR* macros --emacro(708,H5FL_ARR_DEFINE_COMMON) +// Suppress message about our use of 'goto' in our error macros +-emacro(801,HGOTO_DONE, H5Epush_goto) -// Suppress message about "enum constant not used within defaulted switch" --e788 +// Turn off warnings about not using the return value from these functions: +-esym(534, HDfprintf, HDsnprintf, HDvsnprintf) +-esym(534, H5E_clear_stack, H5E_push_stack) +-esym(534, H5FL_arr_free, H5FL_blk_free, H5FL_reg_free, H5FL_seq_free) +-esym(534, H5FS_push, H5FS_pop) +-esym(534, H5I_clear_type, H5I_dec_type_ref) +-esym(534, H5MM_xfree) +-esym(534, H5RC_decr) +-esym(534, H5TB_dfree) +-esym(534, H5V_array_fill) -// Indicate functions that are like printf() --printf(2,HDfprintf) +// Turn off warnings about not using PABLO_MASK macro +-esym(750, PABLO_MASK) -// Tell lint about additional printf() format codes that HDfprintf understands --printf_code(a,haddr_t) --printf_code(Hu,hsize_t) --printf_code(Hd,hssize_t) --printf_code(Zu,size_t) --printf_code(Zd,ssize_t) +// Turn off warnings about "Expression-like macro not parenthesized" for +// enumerated type increment & decrement macros: +-esym(773, H5_INC_ENUM, H5_DEC_ENUM) /* So far, the following files have been linted with these options: H5.c H5A.c H5AC.c H5B.c + H5D.c + H5Dcompact.c + H5Dcontig.c + H5Defl.c H5Dio.c + H5Distore.c H5E.c H5F.c H5FD.c @@ -94,6 +68,7 @@ H5FL.c H5FO.c + H5Tcommit.c H5Tcompound.c H5Tcset.c @@ -187,7 +187,7 @@ writer (hid_t fapl, int wrt_n) { hsize_t size1[4] = {8, 1024, 1024, 1024}; hsize_t size2[1] = {GB8LL}; - hssize_t hs_start[1]; + hsize_t hs_start[1]; hsize_t hs_size[1]; hid_t file=-1, space1=-1, space2=-1, mem_space=-1, d1=-1, d2=-1; int *buf = malloc (sizeof(int) * WRT_SIZE); @@ -299,7 +299,7 @@ reader (hid_t fapl) FILE *script = NULL; hid_t file=-1, mspace=-1, fspace=-1, d2=-1; char ln[128], *s; - hssize_t hs_offset[1]; + hsize_t hs_offset[1]; hsize_t hs_size[1] = {WRT_SIZE}; int *buf = malloc (sizeof(int) * WRT_SIZE); int i, j, zero, wrong, nerrors=0; diff --git a/test/cache.c b/test/cache.c index 9b01c2e..36dda3b 100644 --- a/test/cache.c +++ b/test/cache.c @@ -315,7 +315,7 @@ const char * entry_type_names[NUMBER_OF_ENTRY_TYPES] = /* call back function declarations: */ -static herr_t check_write_permitted(H5F_t UNUSED * f, +static herr_t check_write_permitted(const H5F_t UNUSED * f, hid_t UNUSED dxpl_id, hbool_t * write_permitted_ptr); @@ -792,7 +792,7 @@ type_and_index_to_addr(int32_t type, */ static herr_t -check_write_permitted(H5F_t UNUSED * f, +check_write_permitted(const H5F_t UNUSED * f, hid_t UNUSED dxpl_id, hbool_t * write_permitted_ptr) { @@ -1931,7 +1931,7 @@ rename_entry(H5C_t * cache_ptr, if ( ! done ) { - result = H5C_rename_entry(NULL, cache_ptr, &(types[type]), + result = H5C_rename_entry(cache_ptr, &(types[type]), old_addr, new_addr); } @@ -5169,7 +5169,7 @@ check_rename_err(void) if ( pass ) { - result = H5C_rename_entry(NULL, cache_ptr, &(types[0]), + result = H5C_rename_entry(cache_ptr, &(types[0]), entry_0_0_ptr->addr, entry_0_1_ptr->addr); if ( result >= 0 ) { @@ -5181,7 +5181,7 @@ check_rename_err(void) if ( pass ) { - result = H5C_rename_entry(NULL, cache_ptr, &(types[0]), + result = H5C_rename_entry(cache_ptr, &(types[0]), entry_0_0_ptr->addr, entry_1_0_ptr->addr); if ( result >= 0 ) { @@ -13203,7 +13203,7 @@ check_auto_cache_resize_input_errs(void) invalid_auto_size_ctl.decr_mode = - (enum H5C_cache_incr_mode) 4; /* INVALID */ + (enum H5C_cache_decr_mode) 4; /* INVALID */ invalid_auto_size_ctl.upper_hr_threshold = 0.999; diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index ddc8a83..c258b96 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -145,7 +145,7 @@ main (int argc, char *argv[]) hid_t file, dataset, space, PRESERVE, fapl; hid_t array_dt; static hsize_t dim[] = {NX, NY}; - hssize_t f_offset[2]; /*offset of hyperslab in file */ + hsize_t f_offset[2]; /*offset of hyperslab in file */ hsize_t h_size[2]; /*size of hyperslab */ hsize_t memb_size[1] = {4}; char filename[256]; @@ -544,10 +544,10 @@ main (int argc, char *argv[]) for (j=0; j<NY; j++) { s1_t *ps1 = s1 + i*NY + j; s2_t *ps2 = s2 + i*NY + j; - if ((hssize_t)i>=f_offset[0] && - (hsize_t)i<f_offset[0]+h_size[0] && - (hssize_t)j>=f_offset[1] && - (hsize_t)j<f_offset[1]+h_size[1]) { + if (i>=f_offset[0] && + i<f_offset[0]+h_size[0] && + j>=f_offset[1] && + j<f_offset[1]+h_size[1]) { if (ps2->a != ps1->a || ps2->b != ps1->b || ps2->c[0] != ps1->c[0] || @@ -602,10 +602,10 @@ main (int argc, char *argv[]) for (j=0; j<NY; j++) { s1_t *ps1 = s1 + i*NY + j; s5_t *ps5 = s5 + i*NY + j; - if ((hssize_t)i>=f_offset[0] && - (hsize_t)i<f_offset[0]+h_size[0] && - (hssize_t)j>=f_offset[1] && - (hsize_t)j<f_offset[1]+h_size[1]) { + if (i>=f_offset[0] && + i<f_offset[0]+h_size[0] && + j>=f_offset[1] && + j<f_offset[1]+h_size[1]) { if (ps5->pre != (unsigned)(-1) || ps5->a != ps1->a || ps5->b != ps1->b || @@ -692,10 +692,10 @@ main (int argc, char *argv[]) goto error; } - if ((hssize_t)i>=f_offset[0] && - (hsize_t)i<f_offset[0]+h_size[0] && - (hssize_t)j>=f_offset[1] && - (hsize_t)j<f_offset[1]+h_size[1]) { + if (i>=f_offset[0] && + i<f_offset[0]+h_size[0] && + j>=f_offset[1] && + j<f_offset[1]+h_size[1]) { if (ps1->b != (unsigned)(-1) || ps1->d != (unsigned)(-1)) { H5_FAILED(); diff --git a/test/dsets.c b/test/dsets.c index 638a865..802fc87 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1,4 +1,4 @@ - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * @@ -23,7 +23,6 @@ #include <time.h> #include "h5test.h" -#include "H5private.h" /* * This file needs to access private datatypes from the H5Z package. @@ -1296,7 +1295,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, hid_t write_dxpl; /* Dataset xfer property list ID for writing */ hid_t sid; /* Dataspace ID */ const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */ - const hssize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */ + const hsize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */ const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */ void *tconv_buf = NULL; /* Temporary conversion buffer */ hsize_t i, j, n; /* Local index variables */ @@ -1634,115 +1633,200 @@ error: * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_FILTER_SZIP static herr_t test_filter_noencoder(const char *dset_name) { - hid_t file_id = -1; - hid_t dset_id = -1; - hid_t test_dset_id = -1; - hid_t dcpl_id = -1; - hid_t space_id = -1; - hsize_t dims = 10; - herr_t err; - int test_ints[10] = { 12 }; - int read_buf[10]; - int i; - char * srcdir = HDgetenv("srcdir"); /* Source directory */ - char testfile[512]=""; /* Buffer to hold name of test file */ - - /* - * Create the name of the file to open (in case we are using the --srcdir - * option and the file is in a different directory from this test). - */ - if (srcdir && ((HDstrlen(srcdir) + HDstrlen(NOENCODER_FILENAME) + 1) < sizeof(testfile)) ) - { - HDstrcpy(testfile, srcdir); - HDstrcat(testfile, "/"); - } - HDstrcat(testfile, NOENCODER_FILENAME); + hid_t file_id = -1; + hid_t dset_id = -1; + hid_t test_dset_id = -1; + hid_t dcpl_id = -1; + hid_t space_id = -1; + hsize_t dims = 10; + herr_t err; + int test_ints[10] = { 12 }; + int read_buf[10]; + int i; + char * srcdir = HDgetenv("srcdir"); /* The source directory */ + char testfile[512]=""; /* Buffer to hold name of test file */ + + /* + * Create the name of the file to open (in case we are using the --srcdir + * option and the file is in a different directory from this test). + */ + if (srcdir && ((HDstrlen(srcdir) + HDstrlen(NOENCODER_FILENAME) + 1) < sizeof(testfile)) ) + { + HDstrcpy(testfile, srcdir); + HDstrcat(testfile, "/"); + } + HDstrcat(testfile, NOENCODER_FILENAME); - file_id = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT); - if (file_id < 0) goto error; + file_id = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT); + if (file_id < 0) goto error; - dset_id = H5Dopen(file_id, dset_name); - if (dset_id < 0) goto error; + dset_id = H5Dopen(file_id, dset_name); + if (dset_id < 0) goto error; - space_id = H5Screate_simple(1, &dims, NULL); - if (space_id < 0) goto error; + space_id = H5Screate_simple(1, &dims, NULL); + if (space_id < 0) goto error; TESTING(" decoding without encoder"); /* Read the dataset and make sure the decoder is working correctly */ - err = H5Dread(dset_id, H5T_NATIVE_INT, space_id, space_id, H5P_DEFAULT, read_buf); - if (err < 0) goto error; + err = H5Dread(dset_id, H5T_NATIVE_INT, space_id, space_id, H5P_DEFAULT, read_buf); + if (err < 0) goto error; - for(i = 0; i < 10; i++) - if ( read_buf[i] != i ) goto error; + for(i = 0; i < 10; i++) + if ( read_buf[i] != i ) goto error; - H5Sclose(space_id); + H5Sclose(space_id); - PASSED(); + PASSED(); - /* Attempt to copy the DCPL and use it to create a new dataset. - * Since the filter does not have an encoder, the creation - * should fail. - */ + /* Attempt to copy the DCPL and use it to create a new dataset. + * Since the filter does not have an encoder, the creation + * should fail. + */ TESTING(" trying to write without encoder"); - dcpl_id = H5Dget_create_plist(dset_id); - if (dcpl_id < 0) goto error; + dcpl_id = H5Dget_create_plist(dset_id); + if (dcpl_id < 0) goto error; - space_id = H5Screate_simple(1, &dims, NULL); - if (space_id < 0) goto error; + space_id = H5Screate_simple(1, &dims, NULL); + if (space_id < 0) goto error; - H5E_BEGIN_TRY{ - test_dset_id = H5Dcreate(file_id, NOENCODER_TEST_DATASET, H5T_NATIVE_INT, space_id , dcpl_id); - }H5E_END_TRY + H5E_BEGIN_TRY{ + test_dset_id = H5Dcreate(file_id, NOENCODER_TEST_DATASET, H5T_NATIVE_INT, space_id , dcpl_id); + }H5E_END_TRY - if (test_dset_id >= 0) goto error; + if (test_dset_id >= 0) goto error; - /* Attempt to extend the dataset. This should fail because - * the dataset has a fill value and is instructed to fill on - * allocation. - */ - dims = 20; /* Dataset is originally of size 10 */ - H5E_BEGIN_TRY{ - err = H5Dextend(dset_id, &dims); - }H5E_END_TRY + /* Attempt to extend the dataset. This should fail because + * the dataset has a fill value and is instructed to fill on + * allocation. + */ + dims = 20; /* Dataset is originally of size 10 */ + H5E_BEGIN_TRY{ + err = H5Dextend(dset_id, &dims); + }H5E_END_TRY - if (err >= 0) goto error; + if (err >= 0) goto error; - /* Attempt to write to the dataset. This should fail because - * the filter does not have an encoder. - */ - H5E_BEGIN_TRY{ - err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, test_ints); - }H5E_END_TRY + /* Attempt to write to the dataset. This should fail because + * the filter does not have an encoder. + */ + H5E_BEGIN_TRY{ + err = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, test_ints); + }H5E_END_TRY - if (err >= 0) goto error; + if (err >= 0) goto error; - H5Fclose(file_id); - H5Dclose(dset_id); - H5Sclose(space_id); - H5Pclose(dcpl_id); + H5Fclose(file_id); + H5Dclose(dset_id); + H5Sclose(space_id); + H5Pclose(dcpl_id); - PASSED(); + PASSED(); - return 0; + return 0; error: - H5_FAILED(); - if (dset_id != -1) - H5Dclose(dset_id); - if (test_dset_id != -1) - H5Dclose(test_dset_id); - if (space_id != -1) - H5Sclose(space_id); - if (dcpl_id != -1) - H5Pclose(dcpl_id); - if (file_id != -1) - H5Fclose(file_id); - return -1; + H5_FAILED(); + if (dset_id != -1) + H5Dclose(dset_id); + if (test_dset_id != -1) + H5Dclose(test_dset_id); + if (space_id != -1) + H5Sclose(space_id); + if (dcpl_id != -1) + H5Pclose(dcpl_id); + if (file_id != -1) + H5Fclose(file_id); + return -1; +} +#endif /* H5_HAVE_FILTER_SZIP */ + +/*------------------------------------------------------------------------- + * Function: test_get_filter_info + * + * Purpose: Tests the H5Zget_filter_info function. + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Nat Furrer and James Laird + * Thursday, June 10, 2004 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_get_filter_info(void) +{ + unsigned int flags; /* flags returned from H5Zget_filter_info */ + herr_t err; + + TESTING("H5Zget_filter_info"); + + /* Verify that each filter is reported as having the right combination + * of encoder and decoder. + */ +#ifdef H5_HAVE_FILTER_FLETCHER32 + if(H5Zget_filter_info(H5Z_FILTER_FLETCHER32, &flags) < 0) TEST_ERROR + + if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) || + ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) + TEST_ERROR +#endif + +#ifdef H5_HAVE_FILTER_SHUFFLE + if(H5Zget_filter_info(H5Z_FILTER_SHUFFLE, &flags) < 0) TEST_ERROR + + if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) || + ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) + TEST_ERROR +#endif + +#ifdef H5_HAVE_FILTER_DEFLATE + if(H5Zget_filter_info(H5Z_FILTER_DEFLATE, &flags) < 0) TEST_ERROR + + if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) || + ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) + TEST_ERROR +#endif + +#ifdef H5_HAVE_FILTER_SZIP + if(H5Zget_filter_info(H5Z_FILTER_SZIP, &flags) < 0) TEST_ERROR + +#ifdef H5_SZIP_CAN_ENCODE + if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) || + ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) + TEST_ERROR +#else + if(((flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED) != 0) || + ((flags & H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) + TEST_ERROR +#endif /* H5_SZIP_CAN_ENCODE */ +#endif /* H5_HAVE_FILTER_SZIP */ + + /* Verify that get_filter_info throws an error when given a bad filter */ + /* (Depends on 1.6 compatibility flag) */ +#ifdef H5_WANT_H5_V1_6_COMPAT + if (H5Zget_filter_info(-1, &flags) < 0) TEST_ERROR + if (flags != 0) TEST_ERROR +#else /* H5_WANT_H5_V1_6_COMPAT */ + H5E_BEGIN_TRY { + err = H5Zget_filter_info(-1, &flags); + } H5E_END_TRY; + if (err >= 0) TEST_ERROR +#endif /* H5_WANT_H5_V1_6_COMPAT */ + + PASSED(); + return 0; + +error: + return -1; } /*------------------------------------------------------------------------- @@ -1782,7 +1866,7 @@ test_filters(hid_t file) hsize_t deflate_size; /* Size of dataset with deflate filter */ #endif /* H5_HAVE_FILTER_DEFLATE */ -#ifdef H5_HAVE_FILTER_SZIP +#ifdef H5_HAVE_FILTER_SZIP hsize_t szip_size; /* Size of dataset with szip filter */ unsigned szip_options_mask=H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block=4; @@ -1795,7 +1879,10 @@ test_filters(hid_t file) #if (defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_SZIP) && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_FLETCHER32 hsize_t combo_size; /* Size of dataset with shuffle+deflate filter */ #endif /* H5_HAVE_FILTER_DEFLATE && H5_HAVE_FILTER_SHUFFLE && H5_HAVE_FILTER_FLETCHER32 */ - + + /* test the H5Zget_filter_info function */ + if(test_get_filter_info() < 0) goto error; + /*---------------------------------------------------------- * STEP 0: Test null I/O filter by itself. *---------------------------------------------------------- @@ -1917,9 +2004,7 @@ test_filters(hid_t file) * STEP 4: Test shuffling by itself. *---------------------------------------------------------- */ - #ifdef H5_HAVE_FILTER_SHUFFLE - puts("Testing shuffle filter"); if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error; @@ -1945,7 +2030,6 @@ test_filters(hid_t file) *---------------------------------------------------------- */ #if defined H5_HAVE_FILTER_DEFLATE && defined H5_HAVE_FILTER_SHUFFLE && defined H5_HAVE_FILTER_FLETCHER32 - puts("Testing shuffle+deflate+checksum filters(checksum first)"); if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; if (H5Pset_chunk (dc, 2, chunk_size)<0) goto error; @@ -2008,9 +2092,9 @@ test_filters(hid_t file) /* Clean up objects used for this test */ if (H5Pclose (dc)<0) goto error; - TESTING("shuffle+szip+checksum filters(checksum last, with encoder)"); - /* Make sure encoding is enabled */ + TESTING("shuffle+szip+checksum filters(checksum last, with encoder)"); + /* Make sure encoding is enabled */ if ( h5_szip_can_encode() == 1) { puts(""); if((dc = H5Pcreate(H5P_DATASET_CREATE))<0) goto error; @@ -2644,7 +2728,7 @@ test_can_apply(hid_t file) } /* end if */ /* Create new dataset */ - /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */ + /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */ H5E_BEGIN_TRY { dsid = H5Dcreate(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_DOUBLE, sid, dcpl); } H5E_END_TRY; @@ -2782,139 +2866,140 @@ file) if (h5_szip_can_encode() == 1) { /* Create the data space */ - if ((sid = H5Screate_simple(2, dims, NULL))<0) { + if ((sid = H5Screate_simple(2, dims, NULL))<0) { H5_FAILED(); printf(" Line %d: Can't open dataspace\n",__LINE__); goto error; - } /* end if */ + } /* end if */ - /* Create dcpl with special filter */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) { + /* Create dcpl with special filter */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) { H5_FAILED(); printf(" Line %d: Can't create dcpl\n",__LINE__); goto error; - } /* end if */ - if(H5Pset_chunk(dcpl, 2, chunk_dims)<0) { + } /* end if */ + if(H5Pset_chunk(dcpl, 2, chunk_dims)<0) { H5_FAILED(); printf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; - } /* end if */ + } /* end if */ - /* Set (invalid at property set time) szip parameters */ - szip_pixels_per_block=3; - H5E_BEGIN_TRY { + /* Set (invalid at property set time) szip parameters */ + szip_pixels_per_block=3; + H5E_BEGIN_TRY { ret=H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block); - } H5E_END_TRY; - if(ret>=0) { + } H5E_END_TRY; + if(ret>=0) { H5_FAILED(); printf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); goto error; - } + } - /* Set (invalid at property set time) szip parameters */ - szip_pixels_per_block=512; - H5E_BEGIN_TRY { + /* Set (invalid at property set time) szip parameters */ + szip_pixels_per_block=512; + H5E_BEGIN_TRY { ret=H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block); - } H5E_END_TRY; - if(ret>=0) { + } H5E_END_TRY; + if(ret>=0) { H5_FAILED(); printf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); goto error; - } + } - /* Set (invalid at dataset creation time) szip parameters */ - szip_pixels_per_block=2; - if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block)<0) { + /* Set (invalid at dataset creation time) szip parameters */ + szip_pixels_per_block=2; + if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block)<0) { H5_FAILED(); printf(" Line %d: Can't set szip filter\n",__LINE__); goto error; - } + } - /* Create new dataset */ - /* (Should succeed; according to the new algorithm, scanline should be reset + /* Create new dataset */ + /* (Should succeed; according to the new algorithm, scanline should be reset to 2*128 satisfying 'maximum blocks per scanline' condition) */ - H5E_BEGIN_TRY { + H5E_BEGIN_TRY { dsid = H5Dcreate(file, DSET_CAN_APPLY_SZIP_NAME, H5T_NATIVE_INT, sid, dcpl); - } H5E_END_TRY; - if (dsid <=0) { + } H5E_END_TRY; + if (dsid <=0) { H5_FAILED(); printf(" Line %d: Should have created dataset!\n",__LINE__); goto error; - } /* end if */ + } /* end if */ - /* Close dataset */ - if(H5Dclose(dsid)<0) { + /* Close dataset */ + if(H5Dclose(dsid)<0) { H5_FAILED(); printf(" Line %d: Can't close dataset\n",__LINE__); goto error; - } /* end if */ + } /* end if */ - /* Close dataspace */ - if(H5Sclose(sid)<0) { + /* Close dataspace */ + if(H5Sclose(sid)<0) { H5_FAILED(); printf(" Line %d: Can't close dataspace\n",__LINE__); goto error; - } /* end if */ + } /* end if */ - /* Close dataset creation property list */ - if(H5Pclose(dcpl)<0) { + /* Close dataset creation property list */ + if(H5Pclose(dcpl)<0) { H5_FAILED(); printf(" Line %d: Can't close dcpl\n",__LINE__); goto error; - } /* end if */ + } /* end if */ - /* Create another data space */ - if ((sid = H5Screate_simple(2, dims2, NULL))<0) { + /* Create another data space */ + if ((sid = H5Screate_simple(2, dims2, NULL))<0) { H5_FAILED(); printf(" Line %d: Can't open dataspace\n",__LINE__); goto error; - } /* end if */ + } /* end if */ - /* Create dcpl with special filter */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) { + /* Create dcpl with special filter */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0) { H5_FAILED(); printf(" Line %d: Can't create dcpl\n",__LINE__); goto error; - } /* end if */ - if(H5Pset_chunk(dcpl, 2, chunk_dims2)<0) { + } /* end if */ + if(H5Pset_chunk(dcpl, 2, chunk_dims2)<0) { H5_FAILED(); printf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; - } /* end if */ + } /* end if */ - /* Set (invalid at dataset creation time) szip parameters */ - szip_pixels_per_block=32; - if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block)<0) { + /* Set (invalid at dataset creation time) szip parameters */ + szip_pixels_per_block=32; + if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block)<0) { H5_FAILED(); printf(" Line %d: Can't set szip filter\n",__LINE__); goto error; - } + } - /* Create new dataset */ - /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */ - H5E_BEGIN_TRY { + /* Create new dataset */ + /* (Should fail because the 'can apply' filter should indicate inappropriate combination) */ + H5E_BEGIN_TRY { dsid = H5Dcreate(file, DSET_CAN_APPLY_SZIP_NAME, H5T_NATIVE_INT, sid, dcpl); - } H5E_END_TRY; - if (dsid >=0) { + } H5E_END_TRY; + if (dsid >=0) { H5_FAILED(); printf(" Line %d: Shouldn't have created dataset!\n",__LINE__); H5Dclose(dsid); goto error; - } /* end if */ + } /* end if */ - /* Close dataspace */ - if(H5Sclose(sid)<0) { + /* Close dataspace */ + if(H5Sclose(sid)<0) { H5_FAILED(); printf(" Line %d: Can't close dataspace\n",__LINE__); goto error; - } /* end if */ + } /* end if */ - /* Close dataset creation property list */ - if(H5Pclose(dcpl)<0) { + /* Close dataset creation property list */ + if(H5Pclose(dcpl)<0) { H5_FAILED(); printf(" Line %d: Can't close dcpl\n",__LINE__); goto error; - } /* end if */ + } /* end if */ + PASSED(); } else { @@ -3701,7 +3786,7 @@ static herr_t test_missing_chunk(hid_t file) { hid_t s=-1, d=-1, dcpl=-1; - hssize_t hs_start[1]; + hsize_t hs_start[1]; hsize_t hs_stride[1], hs_count[1], hs_block[1]; diff --git a/test/dtransform.c b/test/dtransform.c index ebe90bb..6dc5eb2 100644 --- a/test/dtransform.c +++ b/test/dtransform.c @@ -98,22 +98,22 @@ const int transformData[ROWS][COLS] = if(SIGNED) \ { \ if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; \ - if((err= H5Pset_data_transform(dxpl_id_f_to_c, f_to_c))<0) TEST_ERROR; \ - if((err = H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat))<0) TEST_ERROR; \ - if((err = H5Pclose(dxpl_id_f_to_c))<0) TEST_ERROR; \ + if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c)<0) TEST_ERROR; \ + if(H5Dwrite(dset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat)<0) TEST_ERROR; \ + if(H5Pclose(dxpl_id_f_to_c)<0) TEST_ERROR; \ } \ else \ { \ if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; \ - if((err= H5Pset_data_transform(dxpl_id_utrans, utrans))<0) TEST_ERROR; \ - if((err = H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_utrans, transformData))<0) TEST_ERROR; \ - if((err = H5Pclose(dxpl_id_utrans))<0) TEST_ERROR; \ + if(H5Pset_data_transform(dxpl_id_utrans, utrans)<0) TEST_ERROR; \ + if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_utrans, transformData)<0) TEST_ERROR; \ + if(H5Pclose(dxpl_id_utrans)<0) TEST_ERROR; \ } \ \ \ TESTING("contiguous, no data type conversion ("TEST_STR"->"TEST_STR")") \ \ - if((err = H5Dread(dset, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array))<0) TEST_ERROR; \ + if(H5Dread(dset, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array)<0) TEST_ERROR; \ if(SIGNED) \ COMPARE(TYPE, array, COMPARE_DATA, 2) \ else \ @@ -123,15 +123,15 @@ const int transformData[ROWS][COLS] = { \ TESTING("contiguous, with type conversion (float->"TEST_STR")") \ \ - if((err = H5Dread(dset_id_float, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array))<0) TEST_ERROR; \ + if(H5Dread(dset_id_float, HDF_TYPE, H5S_ALL, H5S_ALL, XFORM, array)<0) TEST_ERROR; \ if(SIGNED) \ COMPARE(TYPE, array, COMPARE_DATA, 2) \ else \ UCOMPARE(TYPE, array, COMPARE_DATA, 4) \ } \ \ - if((err = H5Dclose(dset))<0) TEST_ERROR; \ - if((err = H5Sclose(dataspace))<0) TEST_ERROR; \ + if(H5Dclose(dset)<0) TEST_ERROR; \ + if(H5Sclose(dataspace)<0) TEST_ERROR; \ } #define TEST_TYPE_CHUNK(XFORM, TYPE, HDF_TYPE, TEST_STR, COMPARE_DATA, SIGNED) \ @@ -143,38 +143,38 @@ const int transformData[ROWS][COLS] = \ hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, cparms, memspace, dset_chunk, filespace; \ hsize_t dim[2] = {ROWS, COLS}; \ - hssize_t offset[2] = {0, 0}; \ + hsize_t offset[2] = {0, 0}; \ \ \ if((dataspace = H5Screate_simple(2, dim, NULL))<0) TEST_ERROR; \ \ cparms = H5Pcreate(H5P_DATASET_CREATE); \ - if( (err = H5Pset_chunk(cparms, 2, dim)) < 0) TEST_ERROR; \ + if(H5Pset_chunk(cparms, 2, dim) < 0) TEST_ERROR; \ \ if((dset_chunk = H5Dcreate(file_id, "/transformtest_chunk_"TEST_STR, HDF_TYPE, dataspace, cparms))<0) TEST_ERROR; \ filespace = H5Dget_space (dset_chunk); \ memspace = H5Screate_simple(2, dim, NULL); \ - if((err = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL)) < 0) TEST_ERROR; \ + if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0) TEST_ERROR; \ \ if(SIGNED) \ { \ if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; \ - if((err= H5Pset_data_transform(dxpl_id_f_to_c, f_to_c))<0) TEST_ERROR; \ - if((err = H5Dwrite(dset_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat))<0) TEST_ERROR; \ - if((err = H5Pclose(dxpl_id_f_to_c))<0) TEST_ERROR; \ + if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c)<0) TEST_ERROR; \ + if(H5Dwrite(dset_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat)<0) TEST_ERROR; \ + if(H5Pclose(dxpl_id_f_to_c)<0) TEST_ERROR; \ } \ else \ { \ if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; \ - if((err= H5Pset_data_transform(dxpl_id_utrans, utrans))<0) TEST_ERROR; \ - if((err = H5Dwrite(dset_chunk, H5T_NATIVE_INT, dataspace, filespace, dxpl_id_utrans, transformData))<0) TEST_ERROR; \ - if((err = H5Pclose(dxpl_id_utrans))<0) TEST_ERROR; \ + if(H5Pset_data_transform(dxpl_id_utrans, utrans)<0) TEST_ERROR; \ + if(H5Dwrite(dset_chunk, H5T_NATIVE_INT, dataspace, filespace, dxpl_id_utrans, transformData)<0) TEST_ERROR; \ + if(H5Pclose(dxpl_id_utrans)<0) TEST_ERROR; \ } \ \ \ TESTING("chunked, no data type conversion ("TEST_STR"->"TEST_STR")") \ \ - if((err = H5Dread(dset_chunk, HDF_TYPE, memspace, filespace, XFORM, array))<0) TEST_ERROR; \ + if(H5Dread(dset_chunk, HDF_TYPE, memspace, filespace, XFORM, array)<0) TEST_ERROR; \ if(SIGNED) \ COMPARE(TYPE, array, COMPARE_DATA, 2) \ else \ @@ -184,7 +184,7 @@ const int transformData[ROWS][COLS] = { \ TESTING("chunked, with type conversion (float->"TEST_STR")") \ \ - if((err = H5Dread(dset_id_float_chunk, HDF_TYPE, memspace, filespace, XFORM, array))<0) TEST_ERROR; \ + if(H5Dread(dset_id_float_chunk, HDF_TYPE, memspace, filespace, XFORM, array)<0) TEST_ERROR; \ if(SIGNED) \ COMPARE(TYPE, array, COMPARE_DATA, 2) \ else \ @@ -193,13 +193,13 @@ const int transformData[ROWS][COLS] = \ \ \ - if((err = H5Dclose(dset_chunk))<0) TEST_ERROR; \ - if((err = H5Sclose(dataspace))<0) TEST_ERROR; \ + if(H5Dclose(dset_chunk)<0) TEST_ERROR; \ + if(H5Sclose(dataspace)<0) TEST_ERROR; \ } #define INVALID_SET_TEST(TRANSFORM) \ { \ - if((err = H5Pset_data_transform(dxpl_id, TRANSFORM))<0) \ + if(H5Pset_data_transform(dxpl_id, TRANSFORM)<0) \ { \ PASSED(); \ } \ @@ -221,23 +221,21 @@ int main(void) /* inverses the utrans transform in init_test to get back original array */ const char* utrans_inv = "(x/3)*4 - 100"; - herr_t err; - if((dxpl_id_c_to_f = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; if((dxpl_id_simple = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; if((dxpl_id_utrans_inv = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; if((dxpl_id_polynomial = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; - if((err = H5Pset_data_transform(dxpl_id_c_to_f, c_to_f))<0) TEST_ERROR; - if((err = H5Pset_data_transform(dxpl_id_polynomial, polynomial))<0) TEST_ERROR; - if((err = H5Pset_data_transform(dxpl_id_simple, simple))<0) TEST_ERROR; - if((err = H5Pset_data_transform(dxpl_id_utrans_inv, utrans_inv))<0) TEST_ERROR; + if(H5Pset_data_transform(dxpl_id_c_to_f, c_to_f)<0) TEST_ERROR; + if(H5Pset_data_transform(dxpl_id_polynomial, polynomial)<0) TEST_ERROR; + if(H5Pset_data_transform(dxpl_id_simple, simple)<0) TEST_ERROR; + if(H5Pset_data_transform(dxpl_id_utrans_inv, utrans_inv)<0) TEST_ERROR; if((dxpl_id_polynomial_copy = H5Pcopy(dxpl_id_polynomial)) < 0) TEST_ERROR; if((dxpl_id_c_to_f_copy = H5Pcopy(dxpl_id_c_to_f)) < 0) TEST_ERROR; /* Run all the tests */ - if((err = init_test(&file_id)) < 0) TEST_ERROR; - if((err = test_set()) < 0) TEST_ERROR; + if(init_test(&file_id) < 0) TEST_ERROR; + if(test_set() < 0) TEST_ERROR; TEST_TYPE_CONTIG(dxpl_id_utrans_inv, char, H5T_NATIVE_CHAR, "char", transformData, 0); TEST_TYPE_CONTIG(dxpl_id_utrans_inv, unsigned char, H5T_NATIVE_UCHAR, "uchar", transformData, 0); @@ -273,23 +271,23 @@ int main(void) TEST_TYPE_CHUNK(dxpl_id_c_to_f, double, H5T_NATIVE_DOUBLE, "double", windchillFfloat, 1); TEST_TYPE_CHUNK(dxpl_id_c_to_f, long double, H5T_NATIVE_LDOUBLE, "ldouble", windchillFfloat, 1); - if((err = test_copy(dxpl_id_c_to_f_copy, dxpl_id_polynomial_copy)) < 0) TEST_ERROR; - if((err = test_trivial(dxpl_id_simple)) < 0) TEST_ERROR; - if((err = test_poly(dxpl_id_polynomial)) < 0) TEST_ERROR; - if((err = test_getset(dxpl_id_c_to_f)) < 0) TEST_ERROR; + if(test_copy(dxpl_id_c_to_f_copy, dxpl_id_polynomial_copy) < 0) TEST_ERROR; + if(test_trivial(dxpl_id_simple) < 0) TEST_ERROR; + if(test_poly(dxpl_id_polynomial) < 0) TEST_ERROR; + if(test_getset(dxpl_id_c_to_f) < 0) TEST_ERROR; /* Close the objects we opened/created */ - if((err = H5Dclose(dset_id_int))<0) TEST_ERROR; - if((err = H5Dclose(dset_id_int_chunk))<0) TEST_ERROR; - if((err = H5Dclose(dset_id_float))<0) TEST_ERROR; - if((err = H5Dclose(dset_id_float_chunk))<0) TEST_ERROR; - if((err = H5Fclose(file_id))<0) TEST_ERROR; - if((err = H5Pclose(dxpl_id_c_to_f))<0) TEST_ERROR; - if((err = H5Pclose(dxpl_id_c_to_f_copy))<0) TEST_ERROR; - if((err = H5Pclose(dxpl_id_polynomial))<0) TEST_ERROR; - if((err = H5Pclose(dxpl_id_polynomial_copy))<0) TEST_ERROR; - if((err = H5Pclose(dxpl_id_simple))<0) TEST_ERROR; - if((err = H5Pclose(dxpl_id_utrans_inv))<0) TEST_ERROR; + if(H5Dclose(dset_id_int)<0) TEST_ERROR; + if(H5Dclose(dset_id_int_chunk)<0) TEST_ERROR; + if(H5Dclose(dset_id_float)<0) TEST_ERROR; + if(H5Dclose(dset_id_float_chunk)<0) TEST_ERROR; + if(H5Fclose(file_id)<0) TEST_ERROR; + if(H5Pclose(dxpl_id_c_to_f)<0) TEST_ERROR; + if(H5Pclose(dxpl_id_c_to_f_copy)<0) TEST_ERROR; + if(H5Pclose(dxpl_id_polynomial)<0) TEST_ERROR; + if(H5Pclose(dxpl_id_polynomial_copy)<0) TEST_ERROR; + if(H5Pclose(dxpl_id_simple)<0) TEST_ERROR; + if(H5Pclose(dxpl_id_utrans_inv)<0) TEST_ERROR; return 0; @@ -304,50 +302,47 @@ int init_test(hid_t* file_id) /* utrans is a transform for unsigned types: no negative numbers involved and results are < 255 to fit into uchar */ const char* utrans = "((x+100)/4)*3"; - herr_t err; - hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, cparms, filespace, memspace; + hid_t dataspace, dxpl_id_f_to_c, dxpl_id_utrans, cparms, filespace; hsize_t dim[2] = {ROWS, COLS}; - hssize_t offset[2] = {0, 0}; + hsize_t offset[2] = {0, 0}; if((dxpl_id_f_to_c = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; if((dxpl_id_utrans = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR; - if((err= H5Pset_data_transform(dxpl_id_f_to_c, f_to_c))<0) TEST_ERROR; - if((err= H5Pset_data_transform(dxpl_id_utrans, utrans))<0) TEST_ERROR; + if(H5Pset_data_transform(dxpl_id_f_to_c, f_to_c)<0) TEST_ERROR; + if(H5Pset_data_transform(dxpl_id_utrans, utrans)<0) TEST_ERROR; if((*file_id = H5Fcreate("dtransform.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) TEST_ERROR; cparms = H5Pcreate(H5P_DATASET_CREATE); - err = H5Pset_chunk(cparms, 2, dim); + if(H5Pset_chunk(cparms, 2, dim)<0) TEST_ERROR; - memspace = H5Screate_simple(2, dim, NULL); - if((dataspace = H5Screate_simple(2, dim, NULL))<0) TEST_ERROR; TESTING("Intializing test...") if((dset_id_int = H5Dcreate(*file_id, "/default_int", H5T_NATIVE_INT, dataspace, H5P_DEFAULT))<0) TEST_ERROR; - if((err = H5Dwrite(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat))<0) TEST_ERROR; + if(H5Dwrite(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat)<0) TEST_ERROR; if((dset_id_float = H5Dcreate(*file_id, "/default_float", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT))<0) TEST_ERROR; - if((err = H5Dwrite(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat))<0) TEST_ERROR; + if(H5Dwrite(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_f_to_c, windchillFfloat)<0) TEST_ERROR; if((dset_id_int_chunk = H5Dcreate(*file_id, "/default_chunk_int", H5T_NATIVE_INT, dataspace, cparms))<0) TEST_ERROR; filespace = H5Dget_space (dset_id_int_chunk); - if((err = H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL)) < 0) TEST_ERROR; - if((err = H5Dwrite(dset_id_int_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat))<0) TEST_ERROR; + if(H5Sselect_hyperslab(filespace, H5S_SELECT_SET, offset, NULL, dim, NULL) < 0) TEST_ERROR; + if(H5Dwrite(dset_id_int_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat)<0) TEST_ERROR; if((dset_id_float_chunk = H5Dcreate(*file_id, "/default_chunk_float", H5T_NATIVE_FLOAT, dataspace, cparms))<0) TEST_ERROR; - if((err = H5Dwrite(dset_id_float_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat))<0) TEST_ERROR; + if(H5Dwrite(dset_id_float_chunk, H5T_NATIVE_FLOAT, dataspace, filespace, dxpl_id_f_to_c, windchillFfloat)<0) TEST_ERROR; PASSED(); - if((err = H5Pclose(dxpl_id_f_to_c))<0) TEST_ERROR; - if((err = H5Pclose(dxpl_id_utrans))<0) TEST_ERROR; - if((err = H5Sclose(dataspace))<0) TEST_ERROR; + if(H5Pclose(dxpl_id_f_to_c)<0) TEST_ERROR; + if(H5Pclose(dxpl_id_utrans)<0) TEST_ERROR; + if(H5Sclose(dataspace)<0) TEST_ERROR; return 0; error: @@ -360,8 +355,6 @@ int test_poly(const hid_t dxpl_id_polynomial) int polyintread[ROWS][COLS]; float polyflread[ROWS][COLS]; int windchillC; - - herr_t err; int row, col; for(row = 0; row<ROWS; row++) @@ -374,7 +367,7 @@ int test_poly(const hid_t dxpl_id_polynomial) } TESTING("data transform, polynomial transform (int->float)") - if((err = H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyflread))<0) TEST_ERROR; + if(H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyflread)<0) TEST_ERROR; COMPARE(float, polyflread, polyflres, 2.0) @@ -388,7 +381,7 @@ int test_poly(const hid_t dxpl_id_polynomial) } TESTING("data transform, polynomial transform (float->int)") - if((err = H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyintread))<0) TEST_ERROR; + if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyintread)<0) TEST_ERROR; COMPARE(int, polyintread, polyflres, 4) return 0; @@ -403,9 +396,6 @@ int test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_co float polyflres[ROWS][COLS]; int polyintread[ROWS][COLS]; int windchillFintread[ROWS][COLS]; - - herr_t err; - int row, col; for(row = 0; row<ROWS; row++) @@ -419,11 +409,11 @@ int test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_co TESTING("data transform, linear transform w/ copied property") - if((err = H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f_copy, windchillFintread))<0) TEST_ERROR; + if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f_copy, windchillFintread)<0) TEST_ERROR; COMPARE(int, windchillFintread, windchillFfloat, 2) TESTING("data transform, polynomial transform w/ copied property") - if((err = H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial_copy, polyintread))<0) TEST_ERROR; + if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_polynomial_copy, polyintread)<0) TEST_ERROR; COMPARE(int, polyintread, polyflres, 2) return 0; @@ -436,12 +426,10 @@ int test_trivial(const hid_t dxpl_id_simple) { float windchillFfloatread[ROWS][COLS]; int windchillFintread[ROWS][COLS]; - - herr_t err; int row, col; TESTING("data transform, trivial transform, without type conversion") - if((err = H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFfloatread))<0) TEST_ERROR; + if(H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFfloatread)<0) TEST_ERROR; for(row = 0; row<ROWS; row++) { for(col = 0; col<COLS; col++) @@ -457,7 +445,7 @@ int test_trivial(const hid_t dxpl_id_simple) PASSED(); TESTING("data transform, trivial transform, with type conversion") - if((err = H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFintread))<0) TEST_ERROR; + if(H5Dread(dset_id_float, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id_simple, windchillFintread)<0) TEST_ERROR; for(row = 0; row<ROWS; row++) { for(col = 0; col<COLS; col++) @@ -479,10 +467,8 @@ error: int test_getset(const hid_t dxpl_id_c_to_f) { - herr_t err; int row, col; float windchillFfloatread[ROWS][COLS]; - const char* simple = "(4/2) * ( (2 + 4)/(5 - 2.5))"; /* this equals 4.8 */ const char* c_to_f = "(9/5.0)*x + 32"; char* ptrgetTest = HDmalloc(HDstrlen(simple)+1); @@ -498,10 +484,10 @@ int test_getset(const hid_t dxpl_id_c_to_f) else PASSED(); - if((err = H5Pset_data_transform(dxpl_id_c_to_f, simple))<0) TEST_ERROR; + if(H5Pset_data_transform(dxpl_id_c_to_f, simple)<0) TEST_ERROR; TESTING("data transform, read after reseting of transform property") - if((err = H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFfloatread))<0) TEST_ERROR; + if(H5Dread(dset_id_float, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_c_to_f, windchillFfloatread)<0) TEST_ERROR; for(row = 0; row<ROWS; row++) { for(col = 0; col<COLS; col++) @@ -544,7 +530,6 @@ error: int test_set(void) { hid_t dxpl_id; - herr_t err; H5E_auto_stack_t func; const char* str = "(9/5.0)*x + 32"; char* ptrgetTest = malloc(strlen(str)+1); diff --git a/test/dtypes.c b/test/dtypes.c index b27de1d..e21cd23 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1609,8 +1609,8 @@ test_compound_9(void) goto error; if(H5Tclose(cmpd_tid)<0) goto error; - /*if(H5Tclose(dup_tid)<0) - goto error;*/ + if(H5Tclose(dup_tid)<0) + goto error; if(H5Tclose(str_id)<0) goto error; if(H5Sclose(space_id)<0) @@ -1644,7 +1644,7 @@ test_compound_9(void) } /* end if */ rdata.i1 = rdata.i2 = 0; - free(rdata.str); + if(rdata.str) free(rdata.str); if(H5Dread(dset_id,dup_tid,H5S_ALL,H5S_ALL,H5P_DEFAULT,&rdata)<0) { H5_FAILED(); AT(); @@ -1658,6 +1658,8 @@ test_compound_9(void) goto error; } /* end if */ + if(rdata.str) free(rdata.str); + if(H5Dclose(dset_id)<0) goto error; if(H5Tclose(cmpd_tid)<0) @@ -2092,7 +2094,7 @@ test_compound_12(void) { hid_t complex_id; size_t size = 0; - size_t offset, new_size; + size_t offset, new_size, tmp_size; herr_t ret; TESTING("adjust size of compound data types"); @@ -2101,31 +2103,35 @@ test_compound_12(void) if ((complex_id = H5Tcreate(H5T_COMPOUND, 1))<0) goto error; /* Verify the size */ - if((new_size=H5Tget_size(complex_id))<0) goto error; + if((new_size=H5Tget_size(complex_id))==0) goto error; if(new_size!=1) goto error; /* Add a couple fields and adjust the size */ offset = size; - if((size+=H5Tget_size(H5T_NATIVE_DOUBLE))<0) goto error; + if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error; + size+=tmp_size; if (H5Tset_size(complex_id, size)<0) goto error; if (H5Tinsert(complex_id, "real", offset, H5T_NATIVE_DOUBLE)<0) goto error; offset = size; - if((size+=H5Tget_size(H5T_NATIVE_DOUBLE))<0) goto error; + if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error; + size+=tmp_size; if (H5Tset_size(complex_id, size)<0) goto error; if (H5Tinsert(complex_id, "imaginary", offset, H5T_NATIVE_DOUBLE)<0) goto error; /* Increase and decrease the size. */ - if((size+=H5Tget_size(H5T_NATIVE_DOUBLE))<0) goto error; + if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error; + size+=tmp_size; if (H5Tset_size(complex_id, size)<0) goto error; - if((size-=H5Tget_size(H5T_NATIVE_DOUBLE))<0) goto error; + if((tmp_size=H5Tget_size(H5T_NATIVE_DOUBLE))==0) goto error; + size-=tmp_size; if (H5Tset_size(complex_id, size)<0) goto error; /* Verify the size */ - if((new_size=H5Tget_size(complex_id))<0) goto error; + if((new_size=H5Tget_size(complex_id))==0) goto error; if(new_size!=size) goto error; /* Tries to cut last member. Supposed to fail. */ @@ -2149,23 +2155,23 @@ test_compound_12(void) /*------------------------------------------------------------------------- - * Function: test_encode + * Function: test_query * - * Purpose: Tests functions of encoding and decoding data type. + * Purpose: Tests query functions of compound and enumeration types. * * Return: Success: 0 * * Failure: number of errors * * Programmer: Raymond Lu - * July 14, 2004 + * Thursday, April 4, 2002 * * Modifications: * *------------------------------------------------------------------------- */ static int -test_encode(void) +test_query(void) { struct s1 { int a; @@ -2174,26 +2180,17 @@ test_encode(void) double d; }; hid_t file=-1, tid1=-1, tid2=-1; - hid_t decoded_tid1=-1, decoded_tid2=-1; char filename[1024]; char compnd_type[]="Compound_type", enum_type[]="Enum_type"; short enum_val; - size_t cmpd_buf_size = 0; - size_t enum_buf_size = 0; - unsigned char *cmpd_buf=NULL, *enum_buf=NULL; - herr_t ret; - TESTING("functions of encoding and decoding data types"); + TESTING("query functions of compound and enumeration types"); /* Create File */ - h5_fixname(FILENAME[5], H5P_DEFAULT, filename, sizeof filename); + h5_fixname(FILENAME[2], H5P_DEFAULT, filename, sizeof filename); if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) goto error; - /*----------------------------------------------------------------------- - * Create compound and enumerate data types - *----------------------------------------------------------------------- - */ /* Create a compound datatype */ if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1)))<0) { H5_FAILED(); @@ -2252,110 +2249,31 @@ test_encode(void) printf("Can't insert field into enumeration type\n"); goto error; } /* end if */ - - /*----------------------------------------------------------------------- - * Test encoding and decoding compound and enumerate data types - *----------------------------------------------------------------------- - */ - /* Encode compound type in a buffer */ - if(H5Tencode(tid1, NULL, &cmpd_buf_size)<0) { - H5_FAILED(); - printf("Can't encode compound type\n"); - goto error; - } /* end if */ - - if(cmpd_buf_size>0) - cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size); - - /* Try decoding bogus buffer */ - H5E_BEGIN_TRY { - ret = H5Tdecode(cmpd_buf); - } H5E_END_TRY; - if(ret!=FAIL) { - H5_FAILED(); - printf("Decoded bogus buffer!\n"); - goto error; - } - - if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size)<0) { - H5_FAILED(); - printf("Can't encode compound type\n"); - goto error; - } /* end if */ - - /* Decode from the compound buffer and return an object handle */ - if((decoded_tid1=H5Tdecode(cmpd_buf))<0) { - H5_FAILED(); - printf("Can't decode compound type\n"); - goto error; - } /* end if */ - - /* Verify that the datatype was copied exactly */ - if(H5Tequal(decoded_tid1, tid1)<=0) { - H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); - goto error; - } /* end if */ /* Query member number and member index by name, for compound type. */ - if(H5Tget_nmembers(decoded_tid1)!=4) { + if(H5Tget_nmembers(tid1)!=4) { H5_FAILED(); printf("Can't get member number\n"); goto error; } /* end if */ - if(H5Tget_member_index(decoded_tid1, "c")!=2) { + if(H5Tget_member_index(tid1, "c")!=2) { H5_FAILED(); printf("Can't get correct index number\n"); goto error; } /* end if */ - - /* Encode enumerate type in a buffer */ - if(H5Tencode(tid2, NULL, &enum_buf_size)<0) { - H5_FAILED(); - printf("Can't encode enumerate type\n"); - goto error; - } /* end if */ - - if(enum_buf_size>0) - enum_buf = (unsigned char*)calloc(1, enum_buf_size); - - if(H5Tencode(tid2, enum_buf, &enum_buf_size)<0) { - H5_FAILED(); - printf("Can't encode enumerate type\n"); - goto error; - } /* end if */ - - /* Decode from the enumerate buffer and return an object handle */ - if((decoded_tid2=H5Tdecode(enum_buf))<0) { - H5_FAILED(); - printf("Can't decode enumerate type\n"); - goto error; - } /* end if */ - - /* Verify that the datatype was copied exactly */ - if(H5Tequal(decoded_tid2, tid2)<=0) { - H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); - goto error; - } /* end if */ - /* Query member number and member index by name, for enumeration type. */ - if(H5Tget_nmembers(decoded_tid2)!=5) { + if(H5Tget_nmembers(tid2)!=5) { H5_FAILED(); printf("Can't get member number\n"); goto error; } /* end if */ - if(H5Tget_member_index(decoded_tid2, "ORANGE")!=3) { + if(H5Tget_member_index(tid2, "ORANGE")!=3) { H5_FAILED(); printf("Can't get correct index number\n"); goto error; } /* end if */ - /*----------------------------------------------------------------------- - * Commit and reopen the compound and enumerate data types - *----------------------------------------------------------------------- - */ /* Commit compound datatype and close it */ if(H5Tcommit(file, compnd_type, tid1)<0) { H5_FAILED(); @@ -2367,13 +2285,6 @@ test_encode(void) printf("Can't close datatype\n"); goto error; } /* end if */ - if(H5Tclose(decoded_tid1)<0) { - H5_FAILED(); - printf("Can't close datatype\n"); - goto error; - } /* end if */ - free(cmpd_buf); - cmpd_buf_size = 0; /* Commit enumeration datatype and close it */ if(H5Tcommit(file, enum_type, tid2)<0) { @@ -2386,13 +2297,6 @@ test_encode(void) printf("Can't close datatype\n"); goto error; } /* end if */ - if(H5Tclose(decoded_tid2)<0) { - H5_FAILED(); - printf("Can't close datatype\n"); - goto error; - } /* end if */ - free(enum_buf); - enum_buf_size = 0; /* Open the dataytpe for query */ if((tid1=H5Topen(file, compnd_type))<0) { @@ -2406,99 +2310,30 @@ test_encode(void) goto error; } /* end if */ - - /* Encode compound type in a buffer */ - if(H5Tencode(tid1, NULL, &cmpd_buf_size)<0) { - H5_FAILED(); - printf("Can't encode compound type\n"); - goto error; - } /* end if */ - - if(cmpd_buf_size>0) - cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size); - - if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size)<0) { - H5_FAILED(); - printf("Can't encode compound type\n"); - goto error; - } /* end if */ - - /* Decode from the compound buffer and return an object handle */ - if((decoded_tid1=H5Tdecode(cmpd_buf))<0) { - H5_FAILED(); - printf("Can't decode compound type\n"); - goto error; - } /* end if */ - - /* Verify that the datatype was copied exactly */ - if(H5Tequal(decoded_tid1, tid1)<=0) { - H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); - goto error; - } /* end if */ - - /* Query member number and member index by name, for compound type. */ - if(H5Tget_nmembers(decoded_tid1)!=4) { + /* Query member number and member index by name, for compound type */ + if(H5Tget_nmembers(tid1)!=4) { H5_FAILED(); printf("Can't get member number\n"); goto error; } /* end if */ - if(H5Tget_member_index(decoded_tid1, "c")!=2) { + if(H5Tget_member_index(tid1, "c")!=2) { H5_FAILED(); printf("Can't get correct index number\n"); goto error; } /* end if */ - /*----------------------------------------------------------------------- - * Test encoding and decoding compound and enumerate data types - *----------------------------------------------------------------------- - */ - /* Encode enumerate type in a buffer */ - if(H5Tencode(tid2, NULL, &enum_buf_size)<0) { - H5_FAILED(); - printf("Can't encode enumerate type\n"); - goto error; - } /* end if */ - - if(enum_buf_size>0) - enum_buf = (unsigned char*)calloc(1, enum_buf_size); - - if(H5Tencode(tid2, enum_buf, &enum_buf_size)<0) { - H5_FAILED(); - printf("Can't encode enumerate type\n"); - goto error; - } /* end if */ - - /* Decode from the enumerate buffer and return an object handle */ - if((decoded_tid2=H5Tdecode(enum_buf))<0) { - H5_FAILED(); - printf("Can't decode enumerate type\n"); - goto error; - } /* end if */ - - /* Verify that the datatype was copied exactly */ - if(H5Tequal(decoded_tid2, tid2)<=0) { - H5_FAILED(); - printf("Datatype wasn't encoded & decoded identically\n"); - goto error; - } /* end if */ - - /* Query member number and member index by name, for enumeration type. */ - if(H5Tget_nmembers(decoded_tid2)!=5) { + /* Query member number and member index by name, for enumeration type */ + if(H5Tget_nmembers(tid2)!=5) { H5_FAILED(); printf("Can't get member number\n"); goto error; } /* end if */ - if(H5Tget_member_index(decoded_tid2, "ORANGE")!=3) { + if(H5Tget_member_index(tid2, "ORANGE")!=3) { H5_FAILED(); printf("Can't get correct index number\n"); goto error; } /* end if */ - /*----------------------------------------------------------------------- - * Close and release - *----------------------------------------------------------------------- - */ /* Close data type and file */ if(H5Tclose(tid1)<0) { H5_FAILED(); @@ -2511,26 +2346,12 @@ test_encode(void) goto error; } /* end if */ - if(H5Tclose(decoded_tid1)<0) { - H5_FAILED(); - printf("Can't close datatype\n"); - goto error; - } /* end if */ - if(H5Tclose(decoded_tid2)<0) { - H5_FAILED(); - printf("Can't close datatype\n"); - goto error; - } /* end if */ - if(H5Fclose(file)<0) { H5_FAILED(); printf("Can't close file\n"); goto error; } /* end if */ - free(cmpd_buf); - free(enum_buf); - PASSED(); return 0; @@ -2538,8 +2359,6 @@ test_encode(void) H5E_BEGIN_TRY { H5Tclose (tid1); H5Tclose (tid2); - H5Tclose (decoded_tid1); - H5Tclose (decoded_tid2); H5Fclose (file); } H5E_END_TRY; return 1; @@ -3868,8 +3687,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) dst_size = H5Tget_size(dst); src_nbits = H5Tget_precision(src); /* not 8*src_size, esp on J90 - QAK */ dst_nbits = H5Tget_precision(dst); /* not 8*dst_size, esp on J90 - QAK */ - src_sign = H5Tget_sign(src); /* not 8*src_size, esp on J90 - QAK */ - dst_sign = H5Tget_sign(dst); /* not 8*dst_size, esp on J90 - QAK */ + src_sign = H5Tget_sign(src); + dst_sign = H5Tget_sign(dst); buf = aligned_malloc(nelmts*MAX(src_size, dst_size)); saved = aligned_malloc(nelmts*MAX(src_size, dst_size)); aligned = HDmalloc(sizeof(long_long)); @@ -4474,8 +4293,8 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) } } else { if (src_nbits>dst_nbits && - H5T_bit_find(src_bits, dst_nbits, src_nbits-dst_nbits, - H5T_BIT_LSB, 1)>=0) { + H5T_bit_find(src_bits, dst_nbits, src_nbits-dst_nbits, + H5T_BIT_LSB, 1)>=0) { /* * The unsigned source has a value which is too large for * the unsigned destination. The destination should be @@ -4714,6 +4533,578 @@ test_conv_int_2(void) /*------------------------------------------------------------------------- + * Function: my_isnan + * + * Purpose: Determines whether VAL points to NaN. + * + * Return: TRUE or FALSE + * + * Programmer: Robb Matzke + * Monday, July 6, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +my_isnan(dtype_t type, void *val) +{ + int retval; + char s[256]; + + if (FLT_FLOAT==type) { + float x; + HDmemcpy(&x, val, sizeof(float)); + retval = (x!=x); + } else if (FLT_DOUBLE==type) { + double x; + HDmemcpy(&x, val, sizeof(double)); + retval = (x!=x); +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + } else if (FLT_LDOUBLE==type) { + long double x; + HDmemcpy(&x, val, sizeof(long double)); + retval = (x!=x); +#endif + } else { + return 0; + } + + /* + * Sometimes NaN==NaN (e.g., DEC Alpha) so we try to print it and see if + * the result contains a NaN string. + */ + if (!retval) { + if (FLT_FLOAT==type) { + float x; + HDmemcpy(&x, val, sizeof(float)); + sprintf(s, "%g", x); + } else if (FLT_DOUBLE==type) { + double x; + HDmemcpy(&x, val, sizeof(double)); + sprintf(s, "%g", x); +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + } else if (FLT_LDOUBLE==type) { + long double x; + HDmemcpy(&x, val, sizeof(long double)); + sprintf(s, "%Lg", x); +#endif + } else { + return 0; + } + if (HDstrstr(s, "NaN") || HDstrstr(s, "NAN") || HDstrstr(s, "nan")) + retval = 1; + } + + return retval; +} + + +/*------------------------------------------------------------------------- + * Function: test_conv_flt_1 + * + * Purpose: Test conversion of random floating point values from SRC to + * DST. These types should be H5T_NATIVE_FLOAT, + * H5T_NATIVE_DOUBLE, or H5T_NATIVE_LDOUBLE. + * + * Return: Success: 0 + * + * Failure: number of errors + * + * Programmer: Robb Matzke + * Tuesday, June 23, 1998 + * + * Modifications: + * Albert Cheng, Apr 16, 2004 + * Check for underflow condition. If the src number is + * smaller than the dst MIN float number, consider it okay + * if the converted sw and hw dst are both less than or + * equal to the dst MIN float number. + * + *------------------------------------------------------------------------- + */ +static int +test_conv_flt_1 (const char *name, hid_t src, hid_t dst) +{ + dtype_t src_type, dst_type; /*data types */ + const size_t ntests=NTESTS; /*number of tests */ + const size_t nelmts=NTESTELEM; /*num values per test */ + const size_t max_fails=8; /*max number of failures*/ + size_t fails_all_tests=0; /*number of failures */ + size_t fails_this_test; /*fails for this test */ + const char *src_type_name = NULL; /*source type name */ + const char *dst_type_name = NULL; /*destination type name */ + size_t src_size, dst_size; /*type sizes */ + unsigned char *buf = NULL; /*buffer for conversion */ + unsigned char *saved = NULL; /*original values */ + char str[256]; /*hello string */ + float hw_f; /*hardware-converted */ + double hw_d; /*hardware-converted */ + void *aligned=NULL; /*aligned buffer */ +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + long double hw_ld; /*hardware-converted */ +#endif + unsigned char *hw=NULL; /*ptr to hardware-conv'd*/ + int underflow; /*underflow occurred */ + int uflow=0; /*underflow debug counters*/ + size_t i, j, k; /*counters */ + int endian; /*machine endianess */ + size_t dst_ebias; /* Destination type's exponent bias */ + size_t src_epos; /* Source type's exponent position */ + size_t src_esize; /* Source type's exponent size */ + size_t dst_epos; /* Destination type's exponent position */ + size_t dst_esize; /* Destination type's exponent size */ + size_t dst_msize; /* Destination type's mantissa size */ + +#ifdef HANDLE_SIGFPE + pid_t child_pid; /*process ID of child */ + int status; /*child exit status */ + + /* + * Some systems generage SIGFPE during floating point overflow and we + * cannot assume that we can continue from such a signal. Therefore, we + * fork here and let the child run the test and return the number of + * failures with the exit status. + */ + HDfflush(stdout); + HDfflush(stderr); + if ((child_pid=fork())<0) { + HDperror("fork"); + return 1; + } else if (child_pid>0) { + while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/; + if (WIFEXITED(status) && 255==WEXITSTATUS(status)) { + return 0; /*child exit after catching SIGFPE*/ + } else if (WIFEXITED(status)) { + return WEXITSTATUS(status); + } else { + HDputs(" Child didn't exit normally."); + return 1; + } + } +#endif + + /* + * The remainder of this function is executed only by the child if + * HANDLE_SIGFPE is defined. + */ +#ifndef __WATCOMC__ + signal(SIGFPE,fpe_handler); +#endif + + /* What are the names of the source and destination types */ + if (H5Tequal(src, H5T_NATIVE_FLOAT)) { + src_type_name = "float"; + src_type = FLT_FLOAT; + } else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) { + src_type_name = "double"; + src_type = FLT_DOUBLE; +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + } else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) { + src_type_name = "long double"; + src_type = FLT_LDOUBLE; +#endif + } else { + src_type_name = "UNKNOWN"; + src_type = OTHER; + } + + if (H5Tequal(dst, H5T_NATIVE_FLOAT)) { + dst_type_name = "float"; + dst_type = FLT_FLOAT; + } else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) { + dst_type_name = "double"; + dst_type = FLT_DOUBLE; +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + } else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) { + dst_type_name = "long double"; + dst_type = FLT_LDOUBLE; +#endif + } else { + dst_type_name = "UNKNOWN"; + dst_type = OTHER; + } + + /* Sanity checks */ + if(sizeof(float)==sizeof(double)) + HDputs("Sizeof(float)==sizeof(double) - some tests may not be sensible."); + if (OTHER==src_type || OTHER==dst_type) { + sprintf(str, "Testing random %s %s -> %s conversions", + name, src_type_name, dst_type_name); + printf("%-70s", str); + H5_FAILED(); + HDputs(" Unknown data type."); + goto error; + } + + /* Get "interesting" values */ + src_size = H5Tget_size(src); + dst_size = H5Tget_size(dst); + dst_ebias=H5Tget_ebias(dst); + H5Tget_fields(src,NULL,&src_epos,&src_esize,NULL,NULL); + H5Tget_fields(dst,NULL,&dst_epos,&dst_esize,NULL,&dst_msize); + + /* Allocate buffers */ + endian = H5Tget_order(H5T_NATIVE_FLOAT); + buf = aligned_malloc(nelmts*MAX(src_size, dst_size)); + saved = aligned_malloc(nelmts*MAX(src_size, dst_size)); + aligned = HDmalloc(32); /*should be big enough for any type*/ +#ifdef SHOW_OVERFLOWS + noverflows_g = 0; +#endif + + for (i=0; i<ntests; i++) { + + /* + * If it looks like it might take a long time then print a progress + * report between each test. + */ + if (ntests>1) { + sprintf(str, "Testing random %s %s -> %s conversions (test %d/%d)", + name, src_type_name, dst_type_name, (int)i+1, (int)ntests); + } else { + sprintf(str, "Testing random %s %s -> %s conversions", + name, src_type_name, dst_type_name); + } + printf("%-70s", str); + HDfflush(stdout); + fails_this_test = 0; + + /* + * Initialize the source buffers to random bits. The `buf' buffer + * will be used for the conversion while the `saved' buffer will be + * used for the comparison later. + */ + if (!skip_overflow_tests_g) { + for (j=0; j<nelmts*src_size; j++) + buf[j] = saved[j] = HDrand(); + } else { + for (j=0; j<nelmts; j++) { + /* Do it this way for alignment reasons */ +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + long double temp[1]; +#else + double temp[1]; +#endif + if (src_size<=dst_size) { + for (k=0; k<dst_size; k++) buf[j*src_size+k] = HDrand(); + } else { + for (k=0; k<dst_size; k++) + ((unsigned char*)temp)[k] = HDrand(); + if (FLT_DOUBLE==src_type && FLT_FLOAT==dst_type) { + hw_d = *((float*)temp); + HDmemcpy(buf+j*src_size, &hw_d, src_size); +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + } else if (FLT_LDOUBLE==src_type && FLT_FLOAT==dst_type) { + hw_ld = *((float*)temp); + HDmemcpy(buf+j*src_size, &hw_ld, src_size); + } else if (FLT_LDOUBLE==src_type && FLT_DOUBLE==dst_type) { + hw_ld = *((double*)temp); + HDmemcpy(buf+j*src_size, &hw_ld, src_size); +#endif + } + } + HDmemcpy(saved+j*src_size, buf+j*src_size, src_size); + } + } + + /* Perform the conversion in software */ + if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT)<0) + goto error; + + /* Check the software results against the hardware */ + for (j=0; j<nelmts; j++) { + underflow = 0; + hw_f = 911.0; + hw_d = 911.0; +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + hw_ld = 911.0; +#endif + + /* The hardware conversion */ + /* Check for underflow when src is a "larger" float than dst.*/ + if (FLT_FLOAT==src_type) { + HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float)); + if (FLT_FLOAT==dst_type) { + hw_f = *((float*)aligned); + hw = (unsigned char*)&hw_f; + } else if (FLT_DOUBLE==dst_type) { + hw_d = *((float*)aligned); + hw = (unsigned char*)&hw_d; +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + } else { + hw_ld = *((float*)aligned); + hw = (unsigned char*)&hw_ld; +#endif + } + } else if (FLT_DOUBLE==src_type) { + HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double)); + if (FLT_FLOAT==dst_type) { + hw_f = (float)(*((double*)aligned)); + hw = (unsigned char*)&hw_f; + underflow = HDfabs(*((double*)aligned)) < FLT_MIN; + } else if (FLT_DOUBLE==dst_type) { + hw_d = *((double*)aligned); + hw = (unsigned char*)&hw_d; +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + } else { + hw_ld = *((double*)aligned); + hw = (unsigned char*)&hw_ld; +#endif + } +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + } else { + HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double)); + if (FLT_FLOAT==dst_type) { + hw_f = *((long double*)aligned); + hw = (unsigned char*)&hw_f; + underflow = HDfabsl(*((long double*)aligned)) < FLT_MIN; + } else if (FLT_DOUBLE==dst_type) { + hw_d = *((long double*)aligned); + hw = (unsigned char*)&hw_d; + underflow = HDfabsl(*((long double*)aligned)) < DBL_MIN; + } else { + hw_ld = *((long double*)aligned); + hw = (unsigned char*)&hw_ld; + } +#endif + } + if (underflow){ + uflow++; + } + + /* Are the two results the same? */ + for (k=0; k<dst_size; k++) + if (buf[j*dst_size+k]!=hw[k]) + break; + if (k==dst_size) + continue; /*no error*/ + + /* + * Assume same if both results are NaN. There are many NaN bit + * patterns and the software doesn't attemt to emulate the + * hardware in this regard. Instead, software uses a single bit + * pattern for NaN by setting the significand to all ones. + */ + if (FLT_FLOAT==dst_type && + my_isnan(dst_type, buf+j*sizeof(float)) && + my_isnan(dst_type, hw)) { + continue; + } else if (FLT_DOUBLE==dst_type && + my_isnan(dst_type, buf+j*sizeof(double)) && + my_isnan(dst_type, hw)) { + continue; +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + } else if (FLT_LDOUBLE==dst_type && + my_isnan(dst_type, buf+j*sizeof(long double)) && + my_isnan(dst_type, hw)) { + continue; +#endif + } + + /* + * Assume same if hardware result is NaN. This is because the + * hardware conversions on some machines return NaN instead of + * overflowing to +Inf or -Inf or underflowing to +0 or -0. + */ + if (my_isnan(dst_type, hw)) + continue; + + /* + * Instead of matching down to the bit, just make sure the + * exponents are the same and the mantissa is the same to a + * certain precision. This is needed on machines that don't + * round as expected. + * If the src number is smaller than the dst MIN float number, + * consider it okay if the converted sw and hw dst are both + * less than or equal to the dst MIN float number. + */ + { + double check_mant[2]; + int check_expo[2]; + + if (FLT_FLOAT==dst_type) { + float x; + HDmemcpy(&x, &buf[j*dst_size], sizeof(float)); + if (underflow && + HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN) + continue; /* all underflowed, no error */ + check_mant[0] = HDfrexpf(x, check_expo+0); + check_mant[1] = HDfrexpf(hw_f, check_expo+1); + } else if (FLT_DOUBLE==dst_type) { + double x; + HDmemcpy(&x, &buf[j*dst_size], sizeof(double)); + if (underflow && + HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN) + continue; /* all underflowed, no error */ + check_mant[0] = HDfrexp(x, check_expo+0); + check_mant[1] = HDfrexp(hw_d, check_expo+1); +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + } else { + long double x; + HDmemcpy(&x, &buf[j*dst_size], sizeof(long double)); + /* dst is largest float, no need to check underflow. */ + check_mant[0] = HDfrexpl(x, check_expo+0); + check_mant[1] = HDfrexpl(hw_ld, check_expo+1); +#endif + } +#ifdef H5_CONVERT_DENORMAL_FLOAT + /* Special check for denormalized values */ + if(check_expo[0]<(-(int)dst_ebias) || check_expo[1]<(-(int)dst_ebias)) { + int expo_diff=check_expo[0]-check_expo[1]; + int valid_bits=(int)((dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1; + double epsilon=1.0; + + /* Re-scale the mantissas based on any exponent difference */ + if(expo_diff!=0) + check_mant[0] = HDldexp(check_mant[0],expo_diff); + + /* Compute the proper epsilon */ + epsilon=HDldexp(epsilon,-valid_bits); + + /* Check for "close enough" fit with scaled epsilon value */ + if (HDfabs(check_mant[0]-check_mant[1])<=epsilon) + continue; + } /* end if */ + else { + if (check_expo[0]==check_expo[1] && + HDfabs(check_mant[0]-check_mant[1])<FP_EPSILON) + continue; + } /* end else */ +#else /* H5_CONVERT_DENORMAL_FLOAT */ + { + hssize_t expo; /*exponent */ + uint8_t tmp[32]; + + assert(src_size<=sizeof(tmp)); + if(endian==H5T_ORDER_LE) + HDmemcpy(tmp,&saved[j*src_size],src_size); + else + for (k=0; k<src_size; k++) + tmp[k]=saved[j*src_size+(src_size-(k+1))]; + expo = H5T_bit_get_d(tmp, src_epos, src_esize); + if(expo==0) + continue; /* Denormalized floating-point value detected */ + else { + assert(dst_size<=sizeof(tmp)); + if(endian==H5T_ORDER_LE) + HDmemcpy(tmp,&buf[j*dst_size],dst_size); + else + for (k=0; k<dst_size; k++) + tmp[k]=buf[j*dst_size+(dst_size-(k+1))]; + expo = H5T_bit_get_d(tmp, dst_epos, dst_esize); + if(expo==0) + continue; /* Denormalized floating-point value detected */ + else { + if (check_expo[0]==check_expo[1] && + HDfabs(check_mant[0]-check_mant[1])<FP_EPSILON) + continue; + } /* end else */ + } /* end else */ + } +#endif /* H5_CONVERT_DENORMAL_FLOAT */ + } + + if (0==fails_this_test++) + H5_FAILED(); + printf(" test %u, elmt %u\n", (unsigned)i+1, (unsigned)j); + + printf(" src ="); + for (k=0; k<src_size; k++) + printf(" %02x", saved[j*src_size+ENDIAN(src_size,k)]); + printf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), ""); + if (FLT_FLOAT==src_type) { + float x; + HDmemcpy(&x, &saved[j*dst_size], sizeof(float)); + printf(" %29.20e\n", x); + } else if (FLT_DOUBLE==src_type) { + double x; + HDmemcpy(&x, &saved[j*dst_size], sizeof(double)); + printf(" %29.20e\n", x); +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + } else { + long double x; + HDmemcpy(&x, &saved[j*src_size], sizeof(long double)); + HDfprintf(stdout," %29.20Le\n", x); +#endif + } + + printf(" dst ="); + for (k=0; k<dst_size; k++) + printf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k)]); + printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), ""); + if (FLT_FLOAT==dst_type) { + float x; + HDmemcpy(&x, &buf[j*dst_size], sizeof(float)); + printf(" %29.20e\n", x); + } else if (FLT_DOUBLE==dst_type) { + double x; + HDmemcpy(&x, &buf[j*dst_size], sizeof(double)); + printf(" %29.20e\n", x); +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + } else { + long double x; + HDmemcpy(&x, &buf[j*dst_size], sizeof(long double)); + HDfprintf(stdout," %29.20Le\n", x); +#endif + } + + printf(" ans ="); + for (k=0; k<dst_size; k++) + printf(" %02x", hw[ENDIAN(dst_size,k)]); + printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), ""); + if (FLT_FLOAT==dst_type) + printf(" %29.20e\n", hw_f); + else if (FLT_DOUBLE==dst_type) + printf(" %29.20e\n", hw_d); +#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE + else + HDfprintf(stdout," %29.20Le\n", hw_ld); +#endif + + if (++fails_all_tests>=max_fails) { + HDputs(" maximum failures reached, aborting test..."); + goto done; + } + } + PASSED(); + } +#ifdef SHOW_OVERFLOWS + if (noverflows_g>0) + printf(" %d overflow%s in previous test\n", + noverflows_g, 1==noverflows_g?"":"s"); +#endif + + done: +#ifdef AKCDEBUG + printf("uflow=%d, fails_all_tests=%d\n", uflow, fails_all_tests); +#endif + if (buf) aligned_free(buf); + if (saved) aligned_free(saved); + if (aligned) HDfree(aligned); + HDfflush(stdout); +#ifdef HANDLE_SIGFPE + HDexit(MIN((int)fails_all_tests, 254)); +#else + reset_hdf5(); + return (int)fails_all_tests; +#endif + + error: + if (buf) aligned_free(buf); + if (saved) aligned_free(saved); + if (aligned) HDfree(aligned); + HDfflush(stdout); +#ifdef HANDLE_SIGFPE + HDexit(MIN(MAX((int)fails_all_tests, 1), 254)); +#else + reset_hdf5(); + return MAX((int)fails_all_tests, 1); +#endif +} + + +/*------------------------------------------------------------------------- * Function: test_conv_int_float * * Purpose: Test conversion between random integer and float values @@ -5723,578 +6114,6 @@ done: /*------------------------------------------------------------------------- - * Function: my_isnan - * - * Purpose: Determines whether VAL points to NaN. - * - * Return: TRUE or FALSE - * - * Programmer: Robb Matzke - * Monday, July 6, 1998 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static int -my_isnan(dtype_t type, void *val) -{ - int retval; - char s[256]; - - if (FLT_FLOAT==type) { - float x; - HDmemcpy(&x, val, sizeof(float)); - retval = (x!=x); - } else if (FLT_DOUBLE==type) { - double x; - HDmemcpy(&x, val, sizeof(double)); - retval = (x!=x); -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - } else if (FLT_LDOUBLE==type) { - long double x; - HDmemcpy(&x, val, sizeof(long double)); - retval = (x!=x); -#endif - } else { - return 0; - } - - /* - * Sometimes NaN==NaN (e.g., DEC Alpha) so we try to print it and see if - * the result contains a NaN string. - */ - if (!retval) { - if (FLT_FLOAT==type) { - float x; - HDmemcpy(&x, val, sizeof(float)); - sprintf(s, "%g", x); - } else if (FLT_DOUBLE==type) { - double x; - HDmemcpy(&x, val, sizeof(double)); - sprintf(s, "%g", x); -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - } else if (FLT_LDOUBLE==type) { - long double x; - HDmemcpy(&x, val, sizeof(long double)); - sprintf(s, "%Lg", x); -#endif - } else { - return 0; - } - if (HDstrstr(s, "NaN") || HDstrstr(s, "NAN") || HDstrstr(s, "nan")) - retval = 1; - } - - return retval; -} - - -/*------------------------------------------------------------------------- - * Function: test_conv_flt_1 - * - * Purpose: Test conversion of random floating point values from SRC to - * DST. These types should be H5T_NATIVE_FLOAT, - * H5T_NATIVE_DOUBLE, or H5T_NATIVE_LDOUBLE. - * - * Return: Success: 0 - * - * Failure: number of errors - * - * Programmer: Robb Matzke - * Tuesday, June 23, 1998 - * - * Modifications: - * Albert Cheng, Apr 16, 2004 - * Check for underflow condition. If the src number is - * smaller than the dst MIN float number, consider it okay - * if the converted sw and hw dst are both less than or - * equal to the dst MIN float number. - * - *------------------------------------------------------------------------- - */ -static int -test_conv_flt_1 (const char *name, hid_t src, hid_t dst) -{ - dtype_t src_type, dst_type; /*data types */ - const size_t ntests=NTESTS; /*number of tests */ - const size_t nelmts=NTESTELEM; /*num values per test */ - const size_t max_fails=8; /*max number of failures*/ - size_t fails_all_tests=0; /*number of failures */ - size_t fails_this_test; /*fails for this test */ - const char *src_type_name = NULL; /*source type name */ - const char *dst_type_name = NULL; /*destination type name */ - size_t src_size, dst_size; /*type sizes */ - unsigned char *buf = NULL; /*buffer for conversion */ - unsigned char *saved = NULL; /*original values */ - char str[256]; /*hello string */ - float hw_f; /*hardware-converted */ - double hw_d; /*hardware-converted */ - void *aligned=NULL; /*aligned buffer */ -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - long double hw_ld; /*hardware-converted */ -#endif - unsigned char *hw=NULL; /*ptr to hardware-conv'd*/ - int underflow; /*underflow occurred */ - int uflow=0; /*underflow debug counters*/ - size_t i, j, k; /*counters */ - int endian; /*machine endianess */ - size_t dst_ebias; /* Destination type's exponent bias */ - size_t src_epos; /* Source type's exponent position */ - size_t src_esize; /* Source type's exponent size */ - size_t dst_epos; /* Destination type's exponent position */ - size_t dst_esize; /* Destination type's exponent size */ - size_t dst_msize; /* Destination type's mantissa size */ - -#ifdef HANDLE_SIGFPE - pid_t child_pid; /*process ID of child */ - int status; /*child exit status */ - - /* - * Some systems generage SIGFPE during floating point overflow and we - * cannot assume that we can continue from such a signal. Therefore, we - * fork here and let the child run the test and return the number of - * failures with the exit status. - */ - HDfflush(stdout); - HDfflush(stderr); - if ((child_pid=fork())<0) { - HDperror("fork"); - return 1; - } else if (child_pid>0) { - while (child_pid!=waitpid(child_pid, &status, 0)) /*void*/; - if (WIFEXITED(status) && 255==WEXITSTATUS(status)) { - return 0; /*child exit after catching SIGFPE*/ - } else if (WIFEXITED(status)) { - return WEXITSTATUS(status); - } else { - HDputs(" Child didn't exit normally."); - return 1; - } - } -#endif - - /* - * The remainder of this function is executed only by the child if - * HANDLE_SIGFPE is defined. - */ -#ifndef __WATCOMC__ - signal(SIGFPE,fpe_handler); -#endif - - /* What are the names of the source and destination types */ - if (H5Tequal(src, H5T_NATIVE_FLOAT)) { - src_type_name = "float"; - src_type = FLT_FLOAT; - } else if (H5Tequal(src, H5T_NATIVE_DOUBLE)) { - src_type_name = "double"; - src_type = FLT_DOUBLE; -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - } else if (H5Tequal(src, H5T_NATIVE_LDOUBLE)) { - src_type_name = "long double"; - src_type = FLT_LDOUBLE; -#endif - } else { - src_type_name = "UNKNOWN"; - src_type = OTHER; - } - - if (H5Tequal(dst, H5T_NATIVE_FLOAT)) { - dst_type_name = "float"; - dst_type = FLT_FLOAT; - } else if (H5Tequal(dst, H5T_NATIVE_DOUBLE)) { - dst_type_name = "double"; - dst_type = FLT_DOUBLE; -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - } else if (H5Tequal(dst, H5T_NATIVE_LDOUBLE)) { - dst_type_name = "long double"; - dst_type = FLT_LDOUBLE; -#endif - } else { - dst_type_name = "UNKNOWN"; - dst_type = OTHER; - } - - /* Sanity checks */ - if(sizeof(float)==sizeof(double)) - HDputs("Sizeof(float)==sizeof(double) - some tests may not be sensible."); - if (OTHER==src_type || OTHER==dst_type) { - sprintf(str, "Testing random %s %s -> %s conversions", - name, src_type_name, dst_type_name); - printf("%-70s", str); - H5_FAILED(); - HDputs(" Unknown data type."); - goto error; - } - - /* Get "interesting" values */ - src_size = H5Tget_size(src); - dst_size = H5Tget_size(dst); - dst_ebias=H5Tget_ebias(dst); - H5Tget_fields(src,NULL,&src_epos,&src_esize,NULL,NULL); - H5Tget_fields(dst,NULL,&dst_epos,&dst_esize,NULL,&dst_msize); - - /* Allocate buffers */ - endian = H5Tget_order(H5T_NATIVE_FLOAT); - buf = aligned_malloc(nelmts*MAX(src_size, dst_size)); - saved = aligned_malloc(nelmts*MAX(src_size, dst_size)); - aligned = HDmalloc(32); /*should be big enough for any type*/ -#ifdef SHOW_OVERFLOWS - noverflows_g = 0; -#endif - - for (i=0; i<ntests; i++) { - - /* - * If it looks like it might take a long time then print a progress - * report between each test. - */ - if (ntests>1) { - sprintf(str, "Testing random %s %s -> %s conversions (test %d/%d)", - name, src_type_name, dst_type_name, (int)i+1, (int)ntests); - } else { - sprintf(str, "Testing random %s %s -> %s conversions", - name, src_type_name, dst_type_name); - } - printf("%-70s", str); - HDfflush(stdout); - fails_this_test = 0; - - /* - * Initialize the source buffers to random bits. The `buf' buffer - * will be used for the conversion while the `saved' buffer will be - * used for the comparison later. - */ - if (!skip_overflow_tests_g) { - for (j=0; j<nelmts*src_size; j++) - buf[j] = saved[j] = HDrand(); - } else { - for (j=0; j<nelmts; j++) { - /* Do it this way for alignment reasons */ -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - long double temp[1]; -#else - double temp[1]; -#endif - if (src_size<=dst_size) { - for (k=0; k<dst_size; k++) buf[j*src_size+k] = HDrand(); - } else { - for (k=0; k<dst_size; k++) - ((unsigned char*)temp)[k] = HDrand(); - if (FLT_DOUBLE==src_type && FLT_FLOAT==dst_type) { - hw_d = *((float*)temp); - HDmemcpy(buf+j*src_size, &hw_d, src_size); -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - } else if (FLT_LDOUBLE==src_type && FLT_FLOAT==dst_type) { - hw_ld = *((float*)temp); - HDmemcpy(buf+j*src_size, &hw_ld, src_size); - } else if (FLT_LDOUBLE==src_type && FLT_DOUBLE==dst_type) { - hw_ld = *((double*)temp); - HDmemcpy(buf+j*src_size, &hw_ld, src_size); -#endif - } - } - HDmemcpy(saved+j*src_size, buf+j*src_size, src_size); - } - } - - /* Perform the conversion in software */ - if (H5Tconvert(src, dst, nelmts, buf, NULL, H5P_DEFAULT)<0) - goto error; - - /* Check the software results against the hardware */ - for (j=0; j<nelmts; j++) { - underflow = 0; - hw_f = 911.0; - hw_d = 911.0; -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - hw_ld = 911.0; -#endif - - /* The hardware conversion */ - /* Check for underflow when src is a "larger" float than dst.*/ - if (FLT_FLOAT==src_type) { - HDmemcpy(aligned, saved+j*sizeof(float), sizeof(float)); - if (FLT_FLOAT==dst_type) { - hw_f = *((float*)aligned); - hw = (unsigned char*)&hw_f; - } else if (FLT_DOUBLE==dst_type) { - hw_d = *((float*)aligned); - hw = (unsigned char*)&hw_d; -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - } else { - hw_ld = *((float*)aligned); - hw = (unsigned char*)&hw_ld; -#endif - } - } else if (FLT_DOUBLE==src_type) { - HDmemcpy(aligned, saved+j*sizeof(double), sizeof(double)); - if (FLT_FLOAT==dst_type) { - hw_f = (float)(*((double*)aligned)); - hw = (unsigned char*)&hw_f; - underflow = HDfabs(*((double*)aligned)) < FLT_MIN; - } else if (FLT_DOUBLE==dst_type) { - hw_d = *((double*)aligned); - hw = (unsigned char*)&hw_d; -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - } else { - hw_ld = *((double*)aligned); - hw = (unsigned char*)&hw_ld; -#endif - } -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - } else { - HDmemcpy(aligned, saved+j*sizeof(long double), sizeof(long double)); - if (FLT_FLOAT==dst_type) { - hw_f = *((long double*)aligned); - hw = (unsigned char*)&hw_f; - underflow = HDfabsl(*((long double*)aligned)) < FLT_MIN; - } else if (FLT_DOUBLE==dst_type) { - hw_d = *((long double*)aligned); - hw = (unsigned char*)&hw_d; - underflow = HDfabsl(*((long double*)aligned)) < DBL_MIN; - } else { - hw_ld = *((long double*)aligned); - hw = (unsigned char*)&hw_ld; - } -#endif - } - if (underflow){ - uflow++; - } - - /* Are the two results the same? */ - for (k=0; k<dst_size; k++) - if (buf[j*dst_size+k]!=hw[k]) - break; - if (k==dst_size) - continue; /*no error*/ - - /* - * Assume same if both results are NaN. There are many NaN bit - * patterns and the software doesn't attemt to emulate the - * hardware in this regard. Instead, software uses a single bit - * pattern for NaN by setting the significand to all ones. - */ - if (FLT_FLOAT==dst_type && - my_isnan(dst_type, buf+j*sizeof(float)) && - my_isnan(dst_type, hw)) { - continue; - } else if (FLT_DOUBLE==dst_type && - my_isnan(dst_type, buf+j*sizeof(double)) && - my_isnan(dst_type, hw)) { - continue; -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - } else if (FLT_LDOUBLE==dst_type && - my_isnan(dst_type, buf+j*sizeof(long double)) && - my_isnan(dst_type, hw)) { - continue; -#endif - } - - /* - * Assume same if hardware result is NaN. This is because the - * hardware conversions on some machines return NaN instead of - * overflowing to +Inf or -Inf or underflowing to +0 or -0. - */ - if (my_isnan(dst_type, hw)) - continue; - - /* - * Instead of matching down to the bit, just make sure the - * exponents are the same and the mantissa is the same to a - * certain precision. This is needed on machines that don't - * round as expected. - * If the src number is smaller than the dst MIN float number, - * consider it okay if the converted sw and hw dst are both - * less than or equal to the dst MIN float number. - */ - { - double check_mant[2]; - int check_expo[2]; - - if (FLT_FLOAT==dst_type) { - float x; - HDmemcpy(&x, &buf[j*dst_size], sizeof(float)); - if (underflow && - HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN) - continue; /* all underflowed, no error */ - check_mant[0] = HDfrexpf(x, check_expo+0); - check_mant[1] = HDfrexpf(hw_f, check_expo+1); - } else if (FLT_DOUBLE==dst_type) { - double x; - HDmemcpy(&x, &buf[j*dst_size], sizeof(double)); - if (underflow && - HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN) - continue; /* all underflowed, no error */ - check_mant[0] = HDfrexp(x, check_expo+0); - check_mant[1] = HDfrexp(hw_d, check_expo+1); -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - } else { - long double x; - HDmemcpy(&x, &buf[j*dst_size], sizeof(long double)); - /* dst is largest float, no need to check underflow. */ - check_mant[0] = HDfrexpl(x, check_expo+0); - check_mant[1] = HDfrexpl(hw_ld, check_expo+1); -#endif - } -#ifdef H5_CONVERT_DENORMAL_FLOAT - /* Special check for denormalized values */ - if(check_expo[0]<(-(int)dst_ebias) || check_expo[1]<(-(int)dst_ebias)) { - int expo_diff=check_expo[0]-check_expo[1]; - int valid_bits=(int)((dst_ebias+dst_msize)+MIN(check_expo[0],check_expo[1]))-1; - double epsilon=1.0; - - /* Re-scale the mantissas based on any exponent difference */ - if(expo_diff!=0) - check_mant[0] = HDldexp(check_mant[0],expo_diff); - - /* Compute the proper epsilon */ - epsilon=HDldexp(epsilon,-valid_bits); - - /* Check for "close enough" fit with scaled epsilon value */ - if (HDfabs(check_mant[0]-check_mant[1])<=epsilon) - continue; - } /* end if */ - else { - if (check_expo[0]==check_expo[1] && - HDfabs(check_mant[0]-check_mant[1])<FP_EPSILON) - continue; - } /* end else */ -#else /* H5_CONVERT_DENORMAL_FLOAT */ - { - hssize_t expo; /*exponent */ - uint8_t tmp[32]; - - assert(src_size<=sizeof(tmp)); - if(endian==H5T_ORDER_LE) - HDmemcpy(tmp,&saved[j*src_size],src_size); - else - for (k=0; k<src_size; k++) - tmp[k]=saved[j*src_size+(src_size-(k+1))]; - expo = H5T_bit_get_d(tmp, src_epos, src_esize); - if(expo==0) - continue; /* Denormalized floating-point value detected */ - else { - assert(dst_size<=sizeof(tmp)); - if(endian==H5T_ORDER_LE) - HDmemcpy(tmp,&buf[j*dst_size],dst_size); - else - for (k=0; k<dst_size; k++) - tmp[k]=buf[j*dst_size+(dst_size-(k+1))]; - expo = H5T_bit_get_d(tmp, dst_epos, dst_esize); - if(expo==0) - continue; /* Denormalized floating-point value detected */ - else { - if (check_expo[0]==check_expo[1] && - HDfabs(check_mant[0]-check_mant[1])<FP_EPSILON) - continue; - } /* end else */ - } /* end else */ - } -#endif /* H5_CONVERT_DENORMAL_FLOAT */ - } - - if (0==fails_this_test++) - H5_FAILED(); - printf(" test %u, elmt %u\n", (unsigned)i+1, (unsigned)j); - - printf(" src ="); - for (k=0; k<src_size; k++) - printf(" %02x", saved[j*src_size+ENDIAN(src_size,k)]); - printf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), ""); - if (FLT_FLOAT==src_type) { - float x; - HDmemcpy(&x, &saved[j*dst_size], sizeof(float)); - printf(" %29.20e\n", x); - } else if (FLT_DOUBLE==src_type) { - double x; - HDmemcpy(&x, &saved[j*dst_size], sizeof(double)); - printf(" %29.20e\n", x); -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - } else { - long double x; - HDmemcpy(&x, &saved[j*src_size], sizeof(long double)); - HDfprintf(stdout," %29.20Le\n", x); -#endif - } - - printf(" dst ="); - for (k=0; k<dst_size; k++) - printf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k)]); - printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), ""); - if (FLT_FLOAT==dst_type) { - float x; - HDmemcpy(&x, &buf[j*dst_size], sizeof(float)); - printf(" %29.20e\n", x); - } else if (FLT_DOUBLE==dst_type) { - double x; - HDmemcpy(&x, &buf[j*dst_size], sizeof(double)); - printf(" %29.20e\n", x); -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - } else { - long double x; - HDmemcpy(&x, &buf[j*dst_size], sizeof(long double)); - HDfprintf(stdout," %29.20Le\n", x); -#endif - } - - printf(" ans ="); - for (k=0; k<dst_size; k++) - printf(" %02x", hw[ENDIAN(dst_size,k)]); - printf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), ""); - if (FLT_FLOAT==dst_type) - printf(" %29.20e\n", hw_f); - else if (FLT_DOUBLE==dst_type) - printf(" %29.20e\n", hw_d); -#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE - else - HDfprintf(stdout," %29.20Le\n", hw_ld); -#endif - - if (++fails_all_tests>=max_fails) { - HDputs(" maximum failures reached, aborting test..."); - goto done; - } - } - PASSED(); - } -#ifdef SHOW_OVERFLOWS - if (noverflows_g>0) - printf(" %d overflow%s in previous test\n", - noverflows_g, 1==noverflows_g?"":"s"); -#endif - - done: -#ifdef AKCDEBUG - printf("uflow=%d, fails_all_tests=%d\n", uflow, fails_all_tests); -#endif - if (buf) aligned_free(buf); - if (saved) aligned_free(saved); - if (aligned) HDfree(aligned); - HDfflush(stdout); -#ifdef HANDLE_SIGFPE - HDexit(MIN((int)fails_all_tests, 254)); -#else - reset_hdf5(); - return (int)fails_all_tests; -#endif - - error: - if (buf) aligned_free(buf); - if (saved) aligned_free(saved); - if (aligned) HDfree(aligned); - HDfflush(stdout); -#ifdef HANDLE_SIGFPE - HDexit(MIN(MAX((int)fails_all_tests, 1), 254)); -#else - reset_hdf5(); - return MAX((int)fails_all_tests, 1); -#endif -} - - -/*------------------------------------------------------------------------- * Function: run_integer_tests * * Purpose: Runs all integer tests. @@ -6607,6 +6426,404 @@ run_float_int_conv(const char *name) /*------------------------------------------------------------------------- + * Function: test_encode + * + * Purpose: Tests functions of encoding and decoding data type. + * + * Return: Success: 0 + * + * Failure: number of errors + * + * Programmer: Raymond Lu + * July 14, 2004 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static int +test_encode(void) +{ + struct s1 { + int a; + float b; + long c; + double d; + }; + hid_t file=-1, tid1=-1, tid2=-1; + hid_t decoded_tid1=-1, decoded_tid2=-1; + char filename[1024]; + char compnd_type[]="Compound_type", enum_type[]="Enum_type"; + short enum_val; + size_t cmpd_buf_size = 0; + size_t enum_buf_size = 0; + unsigned char *cmpd_buf=NULL, *enum_buf=NULL; + herr_t ret; + + TESTING("functions of encoding and decoding data types"); + + /* Create File */ + h5_fixname(FILENAME[5], H5P_DEFAULT, filename, sizeof filename); + if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) + goto error; + + /*----------------------------------------------------------------------- + * Create compound and enumerate data types + *----------------------------------------------------------------------- + */ + /* Create a compound datatype */ + if((tid1=H5Tcreate(H5T_COMPOUND, sizeof(struct s1)))<0) { + H5_FAILED(); + printf("Can't create datatype!\n"); + goto error; + } /* end if */ + if(H5Tinsert(tid1, "a", HOFFSET(struct s1, a), H5T_NATIVE_INT)<0) { + H5_FAILED(); + printf("Can't insert field 'a'\n"); + goto error; + } /* end if */ + if(H5Tinsert(tid1, "b", HOFFSET(struct s1, b), H5T_NATIVE_FLOAT)<0) { + H5_FAILED(); + printf("Can't insert field 'b'\n"); + goto error; + } /* end if */ + if(H5Tinsert(tid1, "c", HOFFSET(struct s1, c), H5T_NATIVE_LONG)<0) { + H5_FAILED(); + printf("Can't insert field 'c'\n"); + goto error; + } /* end if */ + if(H5Tinsert(tid1, "d", HOFFSET(struct s1, d), H5T_NATIVE_DOUBLE)<0) { + H5_FAILED(); + printf("Can't insert field 'd'\n"); + goto error; + } /* end if */ + + /* Create a enumerate datatype */ + if((tid2=H5Tcreate(H5T_ENUM, sizeof(short)))<0) { + H5_FAILED(); + printf("Can't create enumerate type\n"); + goto error; + } /* end if */ + if(H5Tenum_insert(tid2, "RED", (enum_val=0,&enum_val))<0) { + H5_FAILED(); + printf("Can't insert field into enumeration type\n"); + goto error; + } /* end if */ + if(H5Tenum_insert(tid2, "GREEN", (enum_val=1,&enum_val))<0) { + H5_FAILED(); + printf("Can't insert field into enumeration type\n"); + goto error; + } /* end if */ + if(H5Tenum_insert(tid2, "BLUE", (enum_val=2,&enum_val))<0) { + H5_FAILED(); + printf("Can't insert field into enumeration type\n"); + goto error; + } /* end if */ + if(H5Tenum_insert(tid2, "ORANGE", (enum_val=3,&enum_val))<0) { + H5_FAILED(); + printf("Can't insert field into enumeration type\n"); + goto error; + } /* end if */ + if(H5Tenum_insert(tid2, "YELLOW", (enum_val=4,&enum_val))<0) { + H5_FAILED(); + printf("Can't insert field into enumeration type\n"); + goto error; + } /* end if */ + + /*----------------------------------------------------------------------- + * Test encoding and decoding compound and enumerate data types + *----------------------------------------------------------------------- + */ + /* Encode compound type in a buffer */ + if(H5Tencode(tid1, NULL, &cmpd_buf_size)<0) { + H5_FAILED(); + printf("Can't encode compound type\n"); + goto error; + } /* end if */ + + if(cmpd_buf_size>0) + cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size); + + /* Try decoding bogus buffer */ + H5E_BEGIN_TRY { + ret = H5Tdecode(cmpd_buf); + } H5E_END_TRY; + if(ret!=FAIL) { + H5_FAILED(); + printf("Decoded bogus buffer!\n"); + goto error; + } + + if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size)<0) { + H5_FAILED(); + printf("Can't encode compound type\n"); + goto error; + } /* end if */ + + /* Decode from the compound buffer and return an object handle */ + if((decoded_tid1=H5Tdecode(cmpd_buf))<0) { + H5_FAILED(); + printf("Can't decode compound type\n"); + goto error; + } /* end if */ + + /* Verify that the datatype was copied exactly */ + if(H5Tequal(decoded_tid1, tid1)<=0) { + H5_FAILED(); + printf("Datatype wasn't encoded & decoded identically\n"); + goto error; + } /* end if */ + + /* Query member number and member index by name, for compound type. */ + if(H5Tget_nmembers(decoded_tid1)!=4) { + H5_FAILED(); + printf("Can't get member number\n"); + goto error; + } /* end if */ + if(H5Tget_member_index(decoded_tid1, "c")!=2) { + H5_FAILED(); + printf("Can't get correct index number\n"); + goto error; + } /* end if */ + + + /* Encode enumerate type in a buffer */ + if(H5Tencode(tid2, NULL, &enum_buf_size)<0) { + H5_FAILED(); + printf("Can't encode enumerate type\n"); + goto error; + } /* end if */ + + if(enum_buf_size>0) + enum_buf = (unsigned char*)calloc(1, enum_buf_size); + + if(H5Tencode(tid2, enum_buf, &enum_buf_size)<0) { + H5_FAILED(); + printf("Can't encode enumerate type\n"); + goto error; + } /* end if */ + + /* Decode from the enumerate buffer and return an object handle */ + if((decoded_tid2=H5Tdecode(enum_buf))<0) { + H5_FAILED(); + printf("Can't decode enumerate type\n"); + goto error; + } /* end if */ + + /* Verify that the datatype was copied exactly */ + if(H5Tequal(decoded_tid2, tid2)<=0) { + H5_FAILED(); + printf("Datatype wasn't encoded & decoded identically\n"); + goto error; + } /* end if */ + + /* Query member number and member index by name, for enumeration type. */ + if(H5Tget_nmembers(decoded_tid2)!=5) { + H5_FAILED(); + printf("Can't get member number\n"); + goto error; + } /* end if */ + if(H5Tget_member_index(decoded_tid2, "ORANGE")!=3) { + H5_FAILED(); + printf("Can't get correct index number\n"); + goto error; + } /* end if */ + + /*----------------------------------------------------------------------- + * Commit and reopen the compound and enumerate data types + *----------------------------------------------------------------------- + */ + /* Commit compound datatype and close it */ + if(H5Tcommit(file, compnd_type, tid1)<0) { + H5_FAILED(); + printf("Can't commit compound datatype\n"); + goto error; + } /* end if */ + if(H5Tclose(tid1)<0) { + H5_FAILED(); + printf("Can't close datatype\n"); + goto error; + } /* end if */ + if(H5Tclose(decoded_tid1)<0) { + H5_FAILED(); + printf("Can't close datatype\n"); + goto error; + } /* end if */ + free(cmpd_buf); + cmpd_buf_size = 0; + + /* Commit enumeration datatype and close it */ + if(H5Tcommit(file, enum_type, tid2)<0) { + H5_FAILED(); + printf("Can't commit compound datatype\n"); + goto error; + } /* end if */ + if(H5Tclose(tid2)<0) { + H5_FAILED(); + printf("Can't close datatype\n"); + goto error; + } /* end if */ + if(H5Tclose(decoded_tid2)<0) { + H5_FAILED(); + printf("Can't close datatype\n"); + goto error; + } /* end if */ + free(enum_buf); + enum_buf_size = 0; + + /* Open the dataytpe for query */ + if((tid1=H5Topen(file, compnd_type))<0) { + H5_FAILED(); + printf("Can't open datatype\n"); + goto error; + } /* end if */ + if((tid2=H5Topen(file, enum_type))<0) { + H5_FAILED(); + printf("Can't open datatype\n"); + goto error; + } /* end if */ + + + /* Encode compound type in a buffer */ + if(H5Tencode(tid1, NULL, &cmpd_buf_size)<0) { + H5_FAILED(); + printf("Can't encode compound type\n"); + goto error; + } /* end if */ + + if(cmpd_buf_size>0) + cmpd_buf = (unsigned char*)calloc(1, cmpd_buf_size); + + if(H5Tencode(tid1, cmpd_buf, &cmpd_buf_size)<0) { + H5_FAILED(); + printf("Can't encode compound type\n"); + goto error; + } /* end if */ + + /* Decode from the compound buffer and return an object handle */ + if((decoded_tid1=H5Tdecode(cmpd_buf))<0) { + H5_FAILED(); + printf("Can't decode compound type\n"); + goto error; + } /* end if */ + + /* Verify that the datatype was copied exactly */ + if(H5Tequal(decoded_tid1, tid1)<=0) { + H5_FAILED(); + printf("Datatype wasn't encoded & decoded identically\n"); + goto error; + } /* end if */ + + /* Query member number and member index by name, for compound type. */ + if(H5Tget_nmembers(decoded_tid1)!=4) { + H5_FAILED(); + printf("Can't get member number\n"); + goto error; + } /* end if */ + if(H5Tget_member_index(decoded_tid1, "c")!=2) { + H5_FAILED(); + printf("Can't get correct index number\n"); + goto error; + } /* end if */ + + /*----------------------------------------------------------------------- + * Test encoding and decoding compound and enumerate data types + *----------------------------------------------------------------------- + */ + /* Encode enumerate type in a buffer */ + if(H5Tencode(tid2, NULL, &enum_buf_size)<0) { + H5_FAILED(); + printf("Can't encode enumerate type\n"); + goto error; + } /* end if */ + + if(enum_buf_size>0) + enum_buf = (unsigned char*)calloc(1, enum_buf_size); + + if(H5Tencode(tid2, enum_buf, &enum_buf_size)<0) { + H5_FAILED(); + printf("Can't encode enumerate type\n"); + goto error; + } /* end if */ + + /* Decode from the enumerate buffer and return an object handle */ + if((decoded_tid2=H5Tdecode(enum_buf))<0) { + H5_FAILED(); + printf("Can't decode enumerate type\n"); + goto error; + } /* end if */ + + /* Verify that the datatype was copied exactly */ + if(H5Tequal(decoded_tid2, tid2)<=0) { + H5_FAILED(); + printf("Datatype wasn't encoded & decoded identically\n"); + goto error; + } /* end if */ + + /* Query member number and member index by name, for enumeration type. */ + if(H5Tget_nmembers(decoded_tid2)!=5) { + H5_FAILED(); + printf("Can't get member number\n"); + goto error; + } /* end if */ + if(H5Tget_member_index(decoded_tid2, "ORANGE")!=3) { + H5_FAILED(); + printf("Can't get correct index number\n"); + goto error; + } /* end if */ + + /*----------------------------------------------------------------------- + * Close and release + *----------------------------------------------------------------------- + */ + /* Close data type and file */ + if(H5Tclose(tid1)<0) { + H5_FAILED(); + printf("Can't close datatype\n"); + goto error; + } /* end if */ + if(H5Tclose(tid2)<0) { + H5_FAILED(); + printf("Can't close datatype\n"); + goto error; + } /* end if */ + + if(H5Tclose(decoded_tid1)<0) { + H5_FAILED(); + printf("Can't close datatype\n"); + goto error; + } /* end if */ + if(H5Tclose(decoded_tid2)<0) { + H5_FAILED(); + printf("Can't close datatype\n"); + goto error; + } /* end if */ + + if(H5Fclose(file)<0) { + H5_FAILED(); + printf("Can't close file\n"); + goto error; + } /* end if */ + + free(cmpd_buf); + free(enum_buf); + + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + H5Tclose (tid1); + H5Tclose (tid2); + H5Tclose (decoded_tid1); + H5Tclose (decoded_tid2); + H5Fclose (file); + } H5E_END_TRY; + return 1; +} + + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Test the data type interface. @@ -6642,6 +6859,7 @@ main(void) nerrors += test_copy(); nerrors += test_detect(); nerrors += test_compound_1(); + nerrors += test_query(); nerrors += test_transient (fapl); nerrors += test_named (fapl); nerrors += test_encode(); @@ -6670,7 +6888,6 @@ main(void) /* Does floating point overflow generate a SIGFPE? */ generates_sigfpe(); - /* Test degenerate cases */ nerrors += test_conv_flt_1("noop", H5T_NATIVE_FLOAT, H5T_NATIVE_FLOAT); nerrors += test_conv_flt_1("noop", H5T_NATIVE_DOUBLE, H5T_NATIVE_DOUBLE); diff --git a/test/extend.c b/test/extend.c index 07c8dba..aaac754 100644 --- a/test/extend.c +++ b/test/extend.c @@ -55,7 +55,7 @@ write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t me static const hsize_t dims[2] = {NX, NY}; static const hsize_t half_dims[2] = {NX/2, NY/2}; static hsize_t size[2]; - hssize_t offset[2]; + hsize_t offset[2]; int i, j, k, m; TESTING(msg); diff --git a/test/external.c b/test/external.c index 4dda40c..5921572 100644 --- a/test/external.c +++ b/test/external.c @@ -595,7 +595,7 @@ test_2 (hid_t fapl) int part[25], whole[100]; /*raw data buffers */ hsize_t cur_size; /*current data space size */ hid_t hs_space; /*hyperslab data space */ - hssize_t hs_start = 30; /*hyperslab starting offset */ + hsize_t hs_start = 30; /*hyperslab starting offset */ hsize_t hs_count = 25; /*hyperslab size */ int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f}; @@ -721,7 +721,7 @@ test_3 (hid_t fapl) int part[25],whole[100]; /*raw data buffers */ hsize_t cur_size=100; /*current data space size */ hsize_t max_size=200; /*maximum data space size */ - hssize_t hs_start=100; /*hyperslab starting offset */ + hsize_t hs_start=100; /*hyperslab starting offset */ hsize_t hs_count=100; /*hyperslab size */ char filename[1024]; /*file name */ int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f}; diff --git a/test/file_handle.c b/test/file_handle.c index a9c8155..1db5e14 100644 --- a/test/file_handle.c +++ b/test/file_handle.c @@ -226,7 +226,6 @@ test_family(void) int buf[FAMILY_NUMBER][FAMILY_SIZE]; hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE}; hsize_t file_size; - herr_t ret; TESTING("FAMILY file driver"); @@ -239,7 +238,7 @@ test_family(void) if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) goto error; - if((ret=H5Fclose(file))<0) + if(H5Fclose(file)<0) goto error; /* Tries to reopen the file with member file size smaller than diff --git a/test/filename.c b/test/filename.c index 5439d14..b11e6c7 100644 --- a/test/filename.c +++ b/test/filename.c @@ -19,8 +19,6 @@ * Purpose: Tests the "H5Fget_name" functionality */ -#include "hdf5.h" -#include "h5test.h" #include "testhdf5.h" #define FILENAME "get_file_name" @@ -51,7 +49,6 @@ typedef struct s1_t { "in %s\n", where, val, x, (int)__LINE__, __FILE__); \ H5Eprint_stack(H5E_DEFAULT, stdout); \ } \ - HDstrcmp(x, ""); \ } while(0) int main( void ) diff --git a/test/fillval.c b/test/fillval.c index 8161cd9..a5a2886 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -605,9 +605,10 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, hsize_t cur_size[5] = {2, 8, 8, 4, 2}; hsize_t one[5] = {1, 1, 1, 1, 1}; hsize_t hs_size[5], hs_stride[5]; - hssize_t hs_offset[5], nelmts; + hsize_t hs_offset[5], nelmts; int fillval=(-1), val_rd, should_be; int i, j, *buf=NULL, odd; + unsigned u; comp_datatype rd_c, fill_c, should_be_c; comp_datatype *buf_c=NULL; H5D_space_status_t allocation; @@ -646,11 +647,11 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, if (fill_time!=H5D_FILL_TIME_NEVER && val_rd!=fillval) { H5_FAILED(); puts(" Value read was not a fill value."); - printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " + HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %u, " "Fill value: %u\n", - (long)hs_offset[0], (long)hs_offset[1], - (long)hs_offset[2], (long)hs_offset[3], - (long)hs_offset[4], val_rd, fillval); + hs_offset[0], hs_offset[1], + hs_offset[2], hs_offset[3], + hs_offset[4], val_rd, fillval); goto error; } /* case for compound datatype */ @@ -662,11 +663,11 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, rd_c.z!=fill_c.z)) { H5_FAILED(); puts(" Value read was not a fill value."); - printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f, %d, %f, %c" + HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %f, %d, %f, %c" "Fill value: %f, %d, %f, %c\n", - (long)hs_offset[0], (long)hs_offset[1], - (long)hs_offset[2], (long)hs_offset[3], - (long)hs_offset[4], rd_c.a, rd_c.x, rd_c.y, rd_c.z, + hs_offset[0], hs_offset[1], + hs_offset[2], hs_offset[3], + hs_offset[4], rd_c.a, rd_c.x, rd_c.y, rd_c.z, fill_c.a, fill_c.x, fill_c.y, fill_c.z); goto error; } @@ -688,22 +689,22 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, /* case for atomic datatype */ if(datatype==H5T_INTEGER) { /*check for overflow*/ - assert((nelmts*sizeof(int))==(hssize_t)((size_t)(nelmts*sizeof(int)))); + assert((nelmts*sizeof(int))==(hsize_t)((size_t)(nelmts*sizeof(int)))); buf = malloc((size_t)(nelmts*sizeof(int))); - for (i=0; i<nelmts; i++) buf[i] = 9999; + for (u=0; u<nelmts; u++) buf[u] = 9999; if (H5Dwrite(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf)<0) goto error; } /* case for compound datatype */ else if(datatype==H5T_COMPOUND) { assert((nelmts*sizeof(comp_datatype))== - (hssize_t)((size_t)(nelmts*sizeof(comp_datatype)))); + (hsize_t)((size_t)(nelmts*sizeof(comp_datatype)))); buf_c = (comp_datatype*)calloc((size_t)nelmts,sizeof(comp_datatype)); - for (i=0; i<nelmts; i++) { - buf_c[i].a = (float)1111.11; - buf_c[i].x = 2222; - buf_c[i].y = 3333.3333; - buf_c[i].z = 'd'; + for (u=0; u<nelmts; u++) { + buf_c[u].a = (float)1111.11; + buf_c[u].x = 2222; + buf_c[u].y = 3333.3333; + buf_c[u].z = 'd'; } if (H5Dwrite(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c)<0) goto error; @@ -1030,7 +1031,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) hsize_t ch_size[5] = {1, 16, 8, 4, 2}; hsize_t one[5] = {1, 1, 1, 1, 1}; hsize_t hs_size[5], hs_stride[5]; - hssize_t hs_offset[5], nelmts; + hsize_t hs_offset[5], nelmts; #ifdef NO_FILLING int fillval = 0; #else @@ -1038,6 +1039,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) #endif int val_rd, should_be; int i, j, *buf=NULL, odd, fd; + unsigned u; char filename[1024]; if (H5D_CHUNKED==layout) { @@ -1127,11 +1129,11 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) if (val_rd!=fillval) { H5_FAILED(); puts(" Value read was not a fill value."); - printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " + HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %u, " "Fill value: %u\n", - (long)hs_offset[0], (long)hs_offset[1], - (long)hs_offset[2], (long)hs_offset[3], - (long)hs_offset[4], val_rd, fillval); + hs_offset[0], hs_offset[1], + hs_offset[2], hs_offset[3], + hs_offset[4], val_rd, fillval); goto error; } } @@ -1145,9 +1147,9 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) nelmts *= hs_size[i]; } if ((mspace=H5Screate_simple(5, hs_size, hs_size))<0) goto error; - assert((nelmts*sizeof(int))==(hssize_t)((size_t)(nelmts*sizeof(int)))); /*check for overflow*/ + assert((nelmts*sizeof(int))==(hsize_t)((size_t)(nelmts*sizeof(int)))); /*check for overflow*/ buf = malloc((size_t)(nelmts*sizeof(int))); - for (i=0; i<nelmts; i++) buf[i] = 9999; + for (u=0; u<nelmts; u++) buf[u] = 9999; if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, hs_size, NULL)<0) goto error; if (H5Dwrite(dset, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, @@ -1172,11 +1174,11 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) if (val_rd!=should_be) { H5_FAILED(); puts(" Value read was not correct."); - printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " + HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %u, " "should be: %u\n", - (long)hs_offset[0], (long)hs_offset[1], - (long)hs_offset[2], (long)hs_offset[3], - (long)hs_offset[4], val_rd, should_be); + hs_offset[0], hs_offset[1], + hs_offset[2], hs_offset[3], + hs_offset[4], val_rd, should_be); goto error; } } @@ -1208,11 +1210,11 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) if (val_rd!=should_be) { H5_FAILED(); puts(" Value read was not correct."); - printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, " + HDfprintf(stdout," Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %u, " "should be: %u\n", - (long)hs_offset[0], (long)hs_offset[1], - (long)hs_offset[2], (long)hs_offset[3], - (long)hs_offset[4], val_rd, should_be); + hs_offset[0], hs_offset[1], + hs_offset[2], hs_offset[3], + hs_offset[4], val_rd, should_be); goto error; } } @@ -1270,7 +1272,7 @@ test_compatible(void) hid_t dcpl1=-1, dcpl2=-1, fspace=-1, mspace=-1; int rd_fill=0, fill_val=4444, val_rd=0; hsize_t dims[2], one[2]={1,1}; - hssize_t hs_offset[2]={3,4}; + hsize_t hs_offset[2]={3,4}; H5D_fill_value_t status; char *srcdir = getenv("srcdir"); /*where the src code is located*/ char testfile[512]=""; /* test file name */ diff --git a/test/gen_nullspace.c b/test/gen_nullspace.c new file mode 100644 index 0000000..5892443 --- /dev/null +++ b/test/gen_nullspace.c @@ -0,0 +1,87 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> + * Saturday, April 17, 2004 + * + * Purpose: Create a dataset with a null dataspace and an attribute + * with a null dataspace. + * This program is used to create the test file `tnullspace.h5' which + * has dataspaces stored in the newer (version 2) style in the object headers. + * To build the test file, this program MUST be compiled and linked with + * the hdf5-1.7+ series of libraries and the generated test file must be + * put into the 'test' directory in the 1.6.x branch of the library. + */ + +#include "hdf5.h" +#include <assert.h> + +#define NULLFILE "tnullspace.h5" +#define NULLDATASET "null_dataset" +#define NULLATTR "null_attribute" + +int +main(void) +{ + hid_t fid; /* File ID */ + hid_t gid; /* Group ID */ + hid_t sid; /* Dataspace ID */ + hid_t did; /* Dataset ID */ + hid_t attr; /* Attribute ID */ + herr_t ret; /* Generic return value */ + + /* Create the file */ + fid = H5Fcreate(NULLFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + assert(fid>0); + + sid = H5Screate(H5S_NULL); + assert(sid>0); + + /* Create dataset */ + did = H5Dcreate(fid, NULLDATASET, H5T_NATIVE_UINT, sid, H5P_DEFAULT); + assert(did>0); + + /* Close the dataset */ + ret = H5Dclose(did); + assert(ret>=0); + + /* Open the root group */ + gid = H5Gopen(fid,"/"); + assert(gid>0); + + /* Create an attribute for the group */ + attr=H5Acreate(gid,NULLATTR,H5T_NATIVE_INT,sid,H5P_DEFAULT); + assert(attr>0); + + /* Close attribute */ + ret=H5Aclose(attr); + assert(ret>=0); + + /* Close the group */ + ret = H5Gclose(gid); + assert(ret>=0); + + /* Close the dataspace */ + ret = H5Sclose(sid); + assert(ret>=0); + + /* Close the file */ + ret = H5Fclose(fid); + assert(ret>=0); + + return 0; +} + + diff --git a/test/getname.c b/test/getname.c index 29816f0..33b9141 100644 --- a/test/getname.c +++ b/test/getname.c @@ -1197,7 +1197,6 @@ int main( void ) /* Get datatype*/ if((type_id=H5Dget_type(dataset_id))<0) goto out; - /* Get name */ if (H5Iget_name( type_id, name, size )< 0) goto out; @@ -1212,7 +1211,7 @@ int main( void ) PASSED(); - /*------------------------------------------------------------------------- +/*------------------------------------------------------------------------- * Test H5Iget_name with objects that have two names *------------------------------------------------------------------------- */ @@ -1238,7 +1237,6 @@ if(H5Dclose(dataset2_id)<0) goto out; PASSED(); - /*------------------------------------------------------------------------- * Test H5Iget_name with different files, test1 *------------------------------------------------------------------------- @@ -1390,7 +1388,6 @@ PASSED(); if ( name3 ) free(name3); - /* Close */ H5Gclose( group_id ); @@ -1398,8 +1395,6 @@ PASSED(); PASSED(); - - /*------------------------------------------------------------------------- * Test H5Iget_name with invalid IDs *------------------------------------------------------------------------- @@ -1464,7 +1459,7 @@ PASSED(); if (H5Iget_name( group2_id, name, size )<0) goto out; if (check_name( name, "/g18/g2" )!=0) goto out; - /* Get name for the dataset ID in the first file, should be "/g18/g2/d2" still */ + /* Get name for the dataset ID in the first file, should be "/g18/g2/d2" still */ if (H5Iget_name( dataset_id, name, size )<0) goto out; if (check_name( name, "/g18/d2" )!=0) goto out; @@ -1531,9 +1526,8 @@ PASSED(); H5Gclose( group5_id ); H5Gclose( group6_id ); H5Fclose( file1_id ); - - PASSED(); +PASSED(); /*------------------------------------------------------------------------- diff --git a/test/h5test.c b/test/h5test.c index 5344fe2..c9948c6 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -514,13 +514,13 @@ h5_fileaccess(void) if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) return -1; } else if (!HDstrcmp(name, "log")) { - long log_flags = H5FD_LOG_LOC_IO; + unsigned log_flags = H5FD_LOG_LOC_IO; /* Log file access */ if ((val = HDstrtok(NULL, " \t\n\r"))) - log_flags = HDstrtol(val, NULL, 0); + log_flags = (unsigned)HDstrtol(val, NULL, 0); - if (H5Pset_fapl_log(fapl, NULL, (unsigned)log_flags, 0) < 0) + if (H5Pset_fapl_log(fapl, NULL, log_flags, 0) < 0) return -1; } else { /* Unknown driver */ diff --git a/test/hyperslab.c b/test/hyperslab.c index f28da01..59a9e08 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -160,7 +160,7 @@ test_fill(size_t nx, size_t ny, size_t nz, uint8_t *dst = NULL; /*destination array */ hsize_t hs_size[3]; /*hyperslab size */ hsize_t dst_size[3]; /*destination total size */ - hssize_t dst_offset[3]; /*offset of hyperslab in dest */ + hsize_t dst_offset[3]; /*offset of hyperslab in dest */ unsigned ref_value; /*reference value */ unsigned acc; /*accumulator */ size_t i, j, k, dx, dy, dz; /*counters */ @@ -206,9 +206,9 @@ test_fill(size_t nx, size_t ny, size_t nz, dst_size[0] = nx; dst_size[1] = ny; dst_size[2] = nz; - dst_offset[0] = (hssize_t)i; - dst_offset[1] = (hssize_t)j; - dst_offset[2] = (hssize_t)k; + dst_offset[0] = i; + dst_offset[1] = j; + dst_offset[2] = k; hs_size[0] = dx; hs_size[1] = dy; hs_size[2] = dz; @@ -221,13 +221,13 @@ test_fill(size_t nx, size_t ny, size_t nz, * original * fill values and add the new ones. */ ref_value = init_full(dst, nx, ny, nz); - for (u=(size_t)dst_offset[0]; + for (u=dst_offset[0]; u<dst_offset[0]+dx; u++) { - for (v = (size_t)dst_offset[1]; + for (v = dst_offset[1]; v < dst_offset[1] + dy; v++) { - for (w = (size_t)dst_offset[2]; + for (w = dst_offset[2]; w < dst_offset[2] + dz; w++) { ref_value -= dst[u*ny*nz+v*nz+w]; @@ -333,8 +333,8 @@ test_copy(int mode, hsize_t hs_size[3]; /*hyperslab size */ hsize_t dst_size[3]; /*destination total size */ hsize_t src_size[3]; /*source total size */ - hssize_t dst_offset[3]; /*offset of hyperslab in dest */ - hssize_t src_offset[3]; /*offset of hyperslab in source */ + hsize_t dst_offset[3]; /*offset of hyperslab in dest */ + hsize_t src_offset[3]; /*offset of hyperslab in source */ unsigned ref_value; /*reference value */ unsigned acc; /*accumulator */ hsize_t i, j, k, dx, dy, dz; /*counters */ @@ -422,25 +422,25 @@ test_copy(int mode, dst_offset[0] = 0; dst_offset[1] = 0; dst_offset[2] = 0; - src_offset[0] = (hssize_t)i; - src_offset[1] = (hssize_t)j; - src_offset[2] = (hssize_t)k; + src_offset[0] = i; + src_offset[1] = j; + src_offset[2] = k; break; case VARIABLE_DST: - dst_offset[0] = (hssize_t)i; - dst_offset[1] = (hssize_t)j; - dst_offset[2] = (hssize_t)k; + dst_offset[0] = i; + dst_offset[1] = j; + dst_offset[2] = k; src_offset[0] = 0; src_offset[1] = 0; src_offset[2] = 0; break; case VARIABLE_BOTH: - dst_offset[0] = (hssize_t)i; - dst_offset[1] = (hssize_t)j; - dst_offset[2] = (hssize_t)k; - src_offset[0] = (hssize_t)i; - src_offset[1] = (hssize_t)j; - src_offset[2] = (hssize_t)k; + dst_offset[0] = i; + dst_offset[1] = j; + dst_offset[2] = k; + src_offset[0] = i; + src_offset[1] = j; + src_offset[2] = k; break; default: abort(); @@ -608,8 +608,8 @@ test_multifill(size_t nx) { hsize_t i, j; hsize_t size; - hssize_t src_stride; - hssize_t dst_stride; + hsize_t src_stride; + hsize_t dst_stride; char s[64]; struct a_struct { @@ -743,7 +743,7 @@ test_endian(size_t nx) size[1] = 4; /* Copy the array */ - H5V_stride_copy(2, (hsize_t)1, size, dst_stride, dst + 3, src_stride, src); + H5V_stride_copy_s(2, (hsize_t)1, size, dst_stride, dst + 3, src_stride, src); /* Compare */ for (i = 0; i < nx; i++) { @@ -802,7 +802,7 @@ test_transpose(size_t nx, size_t ny) int *src = NULL; int *dst = NULL; hsize_t i, j; - hssize_t src_stride[2], dst_stride[2]; + hsize_t src_stride[2], dst_stride[2]; hsize_t size[2]; char s[256]; @@ -906,8 +906,8 @@ test_sub_super(size_t nx, size_t ny) uint8_t *full = NULL; /*original image */ uint8_t *half = NULL; /*image at 1/2 resolution */ uint8_t *twice = NULL; /*2x2 pixels */ - hssize_t src_stride[4]; /*source stride info */ - hssize_t dst_stride[4]; /*destination stride info */ + hsize_t src_stride[4]; /*source stride info */ + hsize_t dst_stride[4]; /*destination stride info */ hsize_t size[4]; /*number of sample points */ hsize_t i, j; char s[256]; @@ -1125,8 +1125,8 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z) hsize_t off; /* Offset in array */ size_t u, v, w; /* Local index variables */ hsize_t dims[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of array to check */ - hssize_t coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates to check offset of */ - hssize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */ + hsize_t coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates to check offset of */ + hsize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */ char s[256]; sprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z,(unsigned long)y,(unsigned long)x); diff --git a/test/istore.c b/test/istore.c index f7baf31..2f3f907 100644 --- a/test/istore.c +++ b/test/istore.c @@ -53,7 +53,7 @@ const char *FILENAME[] = { #endif /* H5_HAVE_LARGE_HSIZET */ hsize_t chunk_dims[H5O_LAYOUT_NDIMS]; -hssize_t zero[H5O_LAYOUT_NDIMS]; +hsize_t zero[H5O_LAYOUT_NDIMS]; /*------------------------------------------------------------------------- @@ -228,8 +228,8 @@ test_extend(hid_t f, const char *prefix, int ndims; uint8_t *buf = NULL, *check = NULL, *whole = NULL; char dims[64], s[256], name[256]; - hssize_t offset[3]; - hssize_t max_corner[3]; + hsize_t offset[3]; + hsize_t max_corner[3]; hsize_t size[3]; hsize_t whole_size[3]; hsize_t nelmts; @@ -274,7 +274,7 @@ test_extend(hid_t f, const char *prefix, if((fspace=H5Dget_space(dataset))<0) TEST_ERROR; for (ctr = 0; - H5V_vector_lt_s((unsigned)ndims, max_corner, (hssize_t*)whole_size); + H5V_vector_lt_u((unsigned)ndims, max_corner, whole_size); ctr++) { /* Size and location */ @@ -359,9 +359,8 @@ test_extend(hid_t f, const char *prefix, size, H5V_ZERO, buf); /*src*/ /* Update max corner */ - for (i=0; i<(size_t)ndims; i++) { - max_corner[i] = MAX(max_corner[i], offset[i]+(hssize_t)size[i]); - } + for (i=0; i<(size_t)ndims; i++) + max_corner[i] = MAX(max_corner[i], offset[i]+size[i]); } /* Now read the entire array back out and check it */ @@ -442,7 +441,7 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, int ndims; hsize_t ctr; char dims[64], s[256], name[256]; - hssize_t offset[3]; + hsize_t offset[3]; hsize_t size[3], total = 0; uint8_t *buf = NULL; hsize_t whole_size[3]; /* Size of dataset's dataspace */ @@ -492,9 +491,9 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, if((mspace=H5Screate_simple(ndims,size,NULL))<0) TEST_ERROR; for (ctr=0; ctr<nblocks; ctr++) { - offset[0] = (hssize_t)(HDrandom() % (TEST_SPARSE_SIZE-nx)); - offset[1] = (hssize_t)(HDrandom() % (TEST_SPARSE_SIZE-ny)); - offset[2] = (hssize_t)(HDrandom() % (TEST_SPARSE_SIZE-nz)); + offset[0] = (hsize_t)(HDrandom() % (TEST_SPARSE_SIZE-nx)); + offset[1] = (hsize_t)(HDrandom() % (TEST_SPARSE_SIZE-ny)); + offset[2] = (hsize_t)(HDrandom() % (TEST_SPARSE_SIZE-nz)); /* Select region in file dataspace */ if(H5Sselect_hyperslab(fspace,H5S_SELECT_SET,offset,NULL,size,NULL)<0) TEST_ERROR; diff --git a/test/ntypes.c b/test/ntypes.c index 2cb07e3..83b7c5b 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -2020,7 +2020,7 @@ test_refer_dtype2(hid_t file) hid_t dtype, native_type; hsize_t dims1[] = {1}, dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ @@ -2286,7 +2286,7 @@ test_bitfield_dtype(hid_t file) hid_t type=-1, space=-1, dset=-1; hid_t dataset, dtype, native_type; size_t i; - unsigned char wbuf[32], rbuf[32]; + unsigned char wbuf[32]; hsize_t nelmts; TESTING("bitfield datatype"); @@ -2330,7 +2330,10 @@ test_bitfield_dtype(hid_t file) error: return -1; -} /* test_opaque_dtype */ +} /* test_bitfield_dtype */ + + + /*------------------------------------------------------------------------- @@ -2352,21 +2355,18 @@ error: static herr_t test_ninteger(void) { - hid_t fid1; /* file ID */ - hid_t fid2; /* file ID */ - hid_t did1; /* dataset ID */ - hid_t did2; /* dataset ID */ - hid_t sid1; /* dataspace ID */ - hid_t dcpl1; /* dataset creation property list ID */ - hid_t dcpl2; /* dataset creation property list ID */ - hid_t tid1; /* file datatype */ - hid_t tid2; /* file datatype */ - hid_t nid1; /* native datatype */ - hid_t nid2; /* native datatype */ - size_t prec1; /* precision */ - size_t prec2; /* precision */ + hid_t fid1=(-1); /* file ID */ + hid_t fid2=(-1); /* file ID */ + hid_t did1=(-1); /* dataset ID */ + hid_t did2=(-1); /* dataset ID */ + hid_t sid1=(-1); /* dataspace ID */ + hid_t dcpl1=(-1); /* dataset creation property list ID */ + hid_t dcpl2=(-1); /* dataset creation property list ID */ + hid_t tid1=(-1); /* file datatype */ + hid_t tid2=(-1); /* file datatype */ + hid_t nid1=(-1); /* native datatype */ + hid_t nid2=(-1); /* native datatype */ hsize_t dims[1]={DIM3}; /* dataspace dimensions */ - size_t nsize; /* size of native type */ hsize_t nelmts; /* number of elements in dataset */ int rank=1; /* rank of dataset */ int buf[DIM3]; @@ -2435,7 +2435,7 @@ test_ninteger(void) goto error; /* get size */ - if ((nsize=H5Tget_size(nid1))==0) + if (H5Tget_size(nid1)==0) goto error; /* get rank */ @@ -2478,7 +2478,7 @@ test_ninteger(void) goto error; /* check */ - if ((prec1=H5Tget_precision(nid1))!=(prec2=H5Tget_precision(nid2))) { + if (H5Tget_precision(nid1)!=H5Tget_precision(nid2)) { printf(" Precision differ.\n"); goto error; } diff --git a/test/ohdr.c b/test/ohdr.c index 1036836..cd59a35 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -239,11 +239,7 @@ main(void) } if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, TRUE)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else H5Eprint_stack(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ goto error; } } diff --git a/test/reserved.c b/test/reserved.c index 2a9739a..d08c02d 100755 --- a/test/reserved.c +++ b/test/reserved.c @@ -43,8 +43,8 @@ const char *FILENAME[] = { static herr_t rsrv_heap(void) { - hid_t file_id, dataset_id, dataspace_id; - hid_t fapl, fcpl; + hid_t file_id=(-1), dataset_id=(-1), dataspace_id=(-1); + hid_t fapl=(-1), fcpl=(-1); hsize_t dims[1] = {1}; char filename[1024], dset_name[10]; int i; @@ -54,10 +54,6 @@ rsrv_heap(void) /* Create a new file. */ fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); -/* H5Pset_userblock(fapl, (hsize_t)0); - H5Pset_sym_k(fapl, 1, 1); - H5Pset_istore_k(fapl, 1); -*/ /* Set file address sizes to be very small. */ fcpl = H5Pcreate(H5P_FILE_CREATE); if(fcpl < 0) TEST_ERROR; @@ -160,8 +156,8 @@ rsrv_heap(void) static herr_t rsrv_ohdr(void) { - hid_t file_id, dataset_id, dataspace_id; - hid_t fapl, fcpl, aid, attr_id; + hid_t file_id=(-1), dataset_id=(-1), dataspace_id=(-1); + hid_t fapl=(-1), fcpl=(-1), aid, attr_id; hsize_t dims[2]; herr_t status; int attrval[4][6]; @@ -176,9 +172,6 @@ rsrv_ohdr(void) fcpl = H5Pcreate(H5P_FILE_CREATE); if(fcpl < 0) TEST_ERROR; -/* H5Pset_userblock(pfc_id, (hsize_t)0); - H5Pset_sym_k(pfc_id, 1, 1); - H5Pset_istore_k(pfc_id, 1); */ if( H5Pset_sizes(fcpl, (size_t)2,(size_t)2) < 0) TEST_ERROR; file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); @@ -289,10 +282,10 @@ rsrv_ohdr(void) static herr_t rsrv_vlen(void) { - hid_t file_id, dataset_id, dataspace_id, type_id; - hid_t fapl, fcpl, mem_space_id; + hid_t file_id=(-1), dataset_id=(-1), dataspace_id=(-1), type_id=(-1); + hid_t fapl=(-1), fcpl=(-1), mem_space_id=(-1); hssize_t offset[1]; - hssize_t start[1]; + hsize_t start[1]; hsize_t dims[1], count[1]; herr_t status; int i; @@ -309,11 +302,6 @@ rsrv_vlen(void) /* Make file address space very small */ fcpl = H5Pcreate(H5P_FILE_CREATE); if( fcpl < 0) TEST_ERROR; -/* - H5Pset_userblock(pfc_id, (hsize_t)0); - H5Pset_sym_k(pfc_id, 1, 1); - H5Pset_istore_k(pfc_id, 1); -*/ if( H5Pset_sizes(fcpl, (size_t)2,(size_t)2) < 0) TEST_ERROR; file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl); diff --git a/test/stream_test.c b/test/stream_test.c index aecf656..a69d78e 100644 --- a/test/stream_test.c +++ b/test/stream_test.c @@ -6,8 +6,6 @@ * Author: Thomas Radke <tradke@aei-potsdam.mpg.de> * Tuesday, September 12, 2000 * - * Version: $Id$ - * * Modifications: * Thomas Radke, Thursday, October 26, 2000 * Made it compiling under Windows. diff --git a/test/tarray.c b/test/tarray.c index ba44838..871ff9c 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -1959,7 +1959,7 @@ test_compat(void) /* Check the array's base datatype */ tid2=H5Tget_super(mtid); - CHECK(tid2, FAIL, "H5Tget_member_type"); + CHECK(tid2, FAIL, "H5Tget_super"); if((ret=H5Tequal(tid2,H5T_IEEE_F32LE))<=0) TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); @@ -2004,7 +2004,7 @@ test_compat(void) /* Check the array's base datatype */ tid2=H5Tget_super(mtid); - CHECK(tid2, FAIL, "H5Tget_member_type"); + CHECK(tid2, FAIL, "H5Tget_super"); if((ret=H5Tequal(tid2,H5T_STD_I32LE))<=0) TestErrPrintf("Compound data type is incorrect!, ret=%d\n",(int)ret); diff --git a/test/tfile.c b/test/tfile.c index e2ad1f2..11824b9 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -12,8 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - /*********************************************************** * * Test program: tfile @@ -87,11 +85,7 @@ test_file_create(void) hsize_t ublock; /*sizeof userblock */ size_t parm; /*file-creation parameters */ size_t parm2; /*file-creation parameters */ -#ifdef H5_WANT_H5_V1_6_COMPAT - int iparm; -#else /* H5_WANT_H5_V1_6_COMPAT */ unsigned iparm; -#endif /* H5_WANT_H5_V1_6_COMPAT */ unsigned iparm2; herr_t ret; /*generic return value */ @@ -326,11 +320,7 @@ test_file_open(void) hsize_t ublock; /*sizeof user block */ size_t parm; /*file-creation parameters */ size_t parm2; /*file-creation parameters */ -#ifdef H5_WANT_H5_V1_6_COMPAT - int iparm; -#else /* H5_WANT_H5_V1_6_COMPAT */ unsigned iparm; -#endif /* H5_WANT_H5_V1_6_COMPAT */ unsigned iparm2; herr_t ret; /*generic return value */ @@ -1264,4 +1254,5 @@ cleanup_file(void) remove(FILE1); remove(FILE2); remove(FILE3); + remove(FILE4); } diff --git a/test/th5s.c b/test/th5s.c index 5038aeb..763fc81 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -260,7 +260,7 @@ test_h5s_basic(void) H5E_BEGIN_TRY { ret = H5Dfill(NULL, H5T_NATIVE_INT, &n, H5T_NATIVE_INT, sid1); } H5E_END_TRY - VERIFY(ret, FAIL, "H5Dfill"); + VERIFY(ret, FAIL, "H5Dfill"); /* Now use the bad dataspace as the space for an attribute */ H5E_BEGIN_TRY { @@ -351,7 +351,7 @@ test_h5s_null(void) /* Check to be sure we can't set a hyperslab selection on a null dataspace */ H5E_BEGIN_TRY { - hssize_t start[1]={0}; + hsize_t start[1]={0}; hsize_t count[1]={0}; ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, start, NULL, count, NULL); @@ -360,10 +360,10 @@ test_h5s_null(void) /* Check to be sure we can't set a point selection on a null dataspace */ H5E_BEGIN_TRY { - hssize_t coord[1][1]; /* Coordinates for point selection */ + hsize_t coord[1][1]; /* Coordinates for point selection */ coord[0][0]=0; - ret = H5Sselect_elements(sid, H5S_SELECT_SET, 1, (const hssize_t **)coord); + ret = H5Sselect_elements(sid, H5S_SELECT_SET, 1, (const hsize_t **)coord); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sselect_elements"); @@ -532,7 +532,7 @@ test_h5s_encode(void) unsigned char *sbuf=NULL, *null_sbuf=NULL, *scalar_buf=NULL; hsize_t tdims[4]; /* Dimension array to test with */ hssize_t n; /* Number of dataspace elements */ - hssize_t start[] = {0, 0, 0}; + hsize_t start[] = {0, 0, 0}; hsize_t stride[] = {2, 5, 3}; hsize_t count[] = {2, 2, 2}; hsize_t block[] = {1, 3, 1}; diff --git a/test/tmeta.c b/test/tmeta.c index a78859f..87fd4fd 100644 --- a/test/tmeta.c +++ b/test/tmeta.c @@ -12,8 +12,6 @@ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* $Id$ */ - /*********************************************************** * * Test program: tmeta diff --git a/test/tmisc.c b/test/tmisc.c index 3a9d785..1558639 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -1167,7 +1167,7 @@ test_misc8(void) size_t rdcc_nelmts; /* Raw data number of elements */ size_t rdcc_nbytes; /* Raw data number of bytes */ double rdcc_w0; /* Raw data write percentage */ - hssize_t start[MISC8_RANK]; /* Hyperslab start */ + hsize_t start[MISC8_RANK]; /* Hyperslab start */ hsize_t count[MISC8_RANK]; /* Hyperslab block count */ herr_t ret; @@ -1744,25 +1744,13 @@ test_misc11(void) hsize_t userblock; /* Userblock size retrieved from FCPL */ size_t off_size; /* Size of offsets in the file */ size_t len_size; /* Size of lengths in the file */ -#ifdef H5_WANT_H5_V1_6_COMPAT - int sym_ik; /* Symbol table B-tree initial 'K' value */ - int istore_ik; /* Indexed storage B-tree initial 'K' value */ -#else /* H5_WANT_H5_V1_6_COMPAT */ - unsigned sym_ik; /* Symbol table B-tree internal 'K' value */ - unsigned istore_ik; /* Indexed storage B-tree internal 'K' value */ -#endif /* H5_WANT_H5_V1_6_COMPAT */ + unsigned sym_ik; /* Symbol table B-tree initial 'K' value */ + unsigned istore_ik; /* Indexed storage B-tree initial 'K' value */ unsigned sym_lk; /* Symbol table B-tree leaf 'K' value */ -#ifdef H5_WANT_H5_V1_6_COMPAT - int super; /* Superblock version # */ - int freelist; /* Free list version # */ - int stab; /* Symbol table entry version # */ - int shhdr; /* Shared object header version # */ -#else /* H5_WANT_H5_V1_6_COMPAT */ unsigned super; /* Superblock version # */ unsigned freelist; /* Free list version # */ unsigned stab; /* Symbol table entry version # */ unsigned shhdr; /* Shared object header version # */ -#endif /* H5_WANT_H5_V1_6_COMPAT */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1922,7 +1910,7 @@ test_misc12(void) hsize_t maxdims1[1] = {H5S_UNLIMITED}; hsize_t chkdims1[1] = {MISC12_CHUNK_SIZE}; hsize_t newsize[1] = {MISC12_SPACE1_DIM1+MISC12_APPEND_SIZE}; - hssize_t offset[1] = {MISC12_SPACE1_DIM1}; + hsize_t offset[1] = {MISC12_SPACE1_DIM1}; hsize_t count[1] = {MISC12_APPEND_SIZE}; int i; /* counting variable */ herr_t ret; /* Generic return value */ @@ -3325,7 +3313,7 @@ test_misc19(void) VERIFY(ret, FAIL, "H5Eclose_stack"); } /* end test_misc19() */ - + /**************************************************************** ** ** test_misc20(): Test problems with version 2 of storage layout diff --git a/test/trefer.c b/test/trefer.c index 21877ee..e5d6e9e 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -289,28 +289,28 @@ test_reference_obj(void) static void test_reference_region(void) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dset1, /* Dataset ID */ - dset2; /* Dereferenced dataset ID */ - hid_t sid1, /* Dataspace ID #1 */ - sid2; /* Dataspace ID #2 */ - hsize_t dims1[] = {SPACE1_DIM1}, + hid_t fid1; /* HDF5 File IDs */ + hid_t dset1, /* Dataset ID */ + dset2; /* Dereferenced dataset ID */ + hid_t sid1, /* Dataspace ID #1 */ + sid2; /* Dataspace ID #2 */ + hsize_t dims1[] = {SPACE1_DIM1}, dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ - hssize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ - hsize_t * coords; /* Coordinate buffer */ - hssize_t low[SPACE2_RANK]; /* Selection bounds */ - hssize_t high[SPACE2_RANK]; /* Selection bounds */ - hdset_reg_ref_t *wbuf, /* buffer to write to disk */ + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t * coords; /* Coordinate buffer */ + hsize_t low[SPACE2_RANK]; /* Selection bounds */ + hsize_t high[SPACE2_RANK]; /* Selection bounds */ + hdset_reg_ref_t *wbuf, /* buffer to write to disk */ *rbuf; /* buffer read from disk */ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ *drbuf; /* Buffer for reading numeric data from disk */ uint8_t *tu8; /* Temporary pointer to uint8 data */ - int i; /* counting variables */ - herr_t ret; /* Generic return value */ + int i; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Dataset Region Reference Functions\n")); @@ -382,7 +382,7 @@ test_reference_region(void) coord1[7][0]=9; coord1[7][1]=0; coord1[8][0]=7; coord1[8][1]=1; coord1[9][0]=3; coord1[9][1]=3; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1); + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); ret = (int)H5Sget_select_npoints(sid2); @@ -486,26 +486,26 @@ test_reference_region(void) coords=HDmalloc(ret*SPACE2_RANK*sizeof(hsize_t)); /* allocate space for the element points */ ret = H5Sget_select_elem_pointlist(sid2,(hsize_t)0,(hsize_t)ret,coords); CHECK(ret, FAIL, "H5Sget_select_elem_pointlist"); - VERIFY((hssize_t)coords[0], coord1[0][0], "Element Coordinates"); - VERIFY((hssize_t)coords[1], coord1[0][1], "Element Coordinates"); - VERIFY((hssize_t)coords[2], coord1[1][0], "Element Coordinates"); - VERIFY((hssize_t)coords[3], coord1[1][1], "Element Coordinates"); - VERIFY((hssize_t)coords[4], coord1[2][0], "Element Coordinates"); - VERIFY((hssize_t)coords[5], coord1[2][1], "Element Coordinates"); - VERIFY((hssize_t)coords[6], coord1[3][0], "Element Coordinates"); - VERIFY((hssize_t)coords[7], coord1[3][1], "Element Coordinates"); - VERIFY((hssize_t)coords[8], coord1[4][0], "Element Coordinates"); - VERIFY((hssize_t)coords[9], coord1[4][1], "Element Coordinates"); - VERIFY((hssize_t)coords[10], coord1[5][0], "Element Coordinates"); - VERIFY((hssize_t)coords[11], coord1[5][1], "Element Coordinates"); - VERIFY((hssize_t)coords[12], coord1[6][0], "Element Coordinates"); - VERIFY((hssize_t)coords[13], coord1[6][1], "Element Coordinates"); - VERIFY((hssize_t)coords[14], coord1[7][0], "Element Coordinates"); - VERIFY((hssize_t)coords[15], coord1[7][1], "Element Coordinates"); - VERIFY((hssize_t)coords[16], coord1[8][0], "Element Coordinates"); - VERIFY((hssize_t)coords[17], coord1[8][1], "Element Coordinates"); - VERIFY((hssize_t)coords[18], coord1[9][0], "Element Coordinates"); - VERIFY((hssize_t)coords[19], coord1[9][1], "Element Coordinates"); + VERIFY(coords[0], coord1[0][0], "Element Coordinates"); + VERIFY(coords[1], coord1[0][1], "Element Coordinates"); + VERIFY(coords[2], coord1[1][0], "Element Coordinates"); + VERIFY(coords[3], coord1[1][1], "Element Coordinates"); + VERIFY(coords[4], coord1[2][0], "Element Coordinates"); + VERIFY(coords[5], coord1[2][1], "Element Coordinates"); + VERIFY(coords[6], coord1[3][0], "Element Coordinates"); + VERIFY(coords[7], coord1[3][1], "Element Coordinates"); + VERIFY(coords[8], coord1[4][0], "Element Coordinates"); + VERIFY(coords[9], coord1[4][1], "Element Coordinates"); + VERIFY(coords[10], coord1[5][0], "Element Coordinates"); + VERIFY(coords[11], coord1[5][1], "Element Coordinates"); + VERIFY(coords[12], coord1[6][0], "Element Coordinates"); + VERIFY(coords[13], coord1[6][1], "Element Coordinates"); + VERIFY(coords[14], coord1[7][0], "Element Coordinates"); + VERIFY(coords[15], coord1[7][1], "Element Coordinates"); + VERIFY(coords[16], coord1[8][0], "Element Coordinates"); + VERIFY(coords[17], coord1[8][1], "Element Coordinates"); + VERIFY(coords[18], coord1[9][0], "Element Coordinates"); + VERIFY(coords[19], coord1[9][1], "Element Coordinates"); HDfree(coords); ret = H5Sget_select_bounds(sid2,low,high); CHECK(ret, FAIL, "H5Sget_select_bounds"); @@ -557,14 +557,14 @@ test_reference_region_1D(void) sid3; /* Dataspace ID #3 */ hsize_t dims1[] = {SPACE1_DIM1}, dims3[] = {SPACE3_DIM1}; - hssize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */ - hssize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ hsize_t * coords; /* Coordinate buffer */ - hssize_t low[SPACE3_RANK]; /* Selection bounds */ - hssize_t high[SPACE3_RANK]; /* Selection bounds */ + hsize_t low[SPACE3_RANK]; /* Selection bounds */ + hsize_t high[SPACE3_RANK]; /* Selection bounds */ hdset_reg_ref_t *wbuf, /* buffer to write to disk */ *rbuf; /* buffer read from disk */ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ @@ -643,7 +643,7 @@ test_reference_region_1D(void) coord1[7][0]=89; coord1[8][0]=97; coord1[9][0]=03; - ret = H5Sselect_elements(sid3,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1); + ret = H5Sselect_elements(sid3,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); ret = (int)H5Sget_select_npoints(sid3); @@ -771,16 +771,16 @@ test_reference_region_1D(void) coords=HDmalloc(ret*SPACE3_RANK*sizeof(hsize_t)); /* allocate space for the element points */ ret = H5Sget_select_elem_pointlist(sid3,(hsize_t)0,(hsize_t)ret,coords); CHECK(ret, FAIL, "H5Sget_select_elem_pointlist"); - VERIFY((hssize_t)coords[0], coord1[0][0], "Element Coordinates"); - VERIFY((hssize_t)coords[1], coord1[1][0], "Element Coordinates"); - VERIFY((hssize_t)coords[2], coord1[2][0], "Element Coordinates"); - VERIFY((hssize_t)coords[3], coord1[3][0], "Element Coordinates"); - VERIFY((hssize_t)coords[4], coord1[4][0], "Element Coordinates"); - VERIFY((hssize_t)coords[5], coord1[5][0], "Element Coordinates"); - VERIFY((hssize_t)coords[6], coord1[6][0], "Element Coordinates"); - VERIFY((hssize_t)coords[7], coord1[7][0], "Element Coordinates"); - VERIFY((hssize_t)coords[8], coord1[8][0], "Element Coordinates"); - VERIFY((hssize_t)coords[9], coord1[9][0], "Element Coordinates"); + VERIFY(coords[0], coord1[0][0], "Element Coordinates"); + VERIFY(coords[1], coord1[1][0], "Element Coordinates"); + VERIFY(coords[2], coord1[2][0], "Element Coordinates"); + VERIFY(coords[3], coord1[3][0], "Element Coordinates"); + VERIFY(coords[4], coord1[4][0], "Element Coordinates"); + VERIFY(coords[5], coord1[5][0], "Element Coordinates"); + VERIFY(coords[6], coord1[6][0], "Element Coordinates"); + VERIFY(coords[7], coord1[7][0], "Element Coordinates"); + VERIFY(coords[8], coord1[8][0], "Element Coordinates"); + VERIFY(coords[9], coord1[9][0], "Element Coordinates"); HDfree(coords); ret = H5Sget_select_bounds(sid3,low,high); CHECK(ret, FAIL, "H5Sget_select_bounds"); diff --git a/test/tselect.c b/test/tselect.c index c4090f8..3f2083b 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -127,15 +127,21 @@ #define SPACE10_DIM1 180 #define SPACE10_CHUNK_SIZE 12 +/* Information for bounds checking test */ +#define SPACE11_RANK 2 +#define SPACE11_DIM1 100 +#define SPACE11_DIM2 100 +#define SPACE11_NPOINTS 4 + /* Location comparison function */ int compare_size_t(const void *s1, const void *s2); -herr_t test_select_hyper_iter1(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data); -herr_t test_select_point_iter1(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data); -herr_t test_select_all_iter1(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data); -herr_t test_select_none_iter1(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data); -herr_t test_select_hyper_iter2(void *_elem, hid_t type_id, hsize_t ndim, hssize_t *point, void *_operator_data); -herr_t test_select_hyper_iter3(void *elem,hid_t type_id, hsize_t ndim, hssize_t *point, void *operator_data); +herr_t test_select_hyper_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); +herr_t test_select_point_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); +herr_t test_select_all_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); +herr_t test_select_none_iter1(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); +herr_t test_select_hyper_iter2(void *_elem, hid_t type_id, unsigned ndim, const hsize_t *point, void *_operator_data); +herr_t test_select_hyper_iter3(void *elem,hid_t type_id, unsigned ndim, const hsize_t *point, void *operator_data); /**************************************************************** ** @@ -143,7 +149,7 @@ herr_t test_select_hyper_iter3(void *elem,hid_t type_id, hsize_t ndim, hssize_t ** ****************************************************************/ herr_t -test_select_hyper_iter1(void *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void *_operator_data) +test_select_hyper_iter1(void *_elem, hid_t UNUSED type_id, unsigned UNUSED ndim, const hsize_t UNUSED *point, void *_operator_data) { uint8_t *tbuf=(uint8_t *)_elem, /* temporary buffer pointer */ **tbuf2=(uint8_t **)_operator_data; /* temporary buffer handle */ @@ -165,16 +171,16 @@ test_select_hyper_iter1(void *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, h static void test_select_hyper(hid_t xfer_plist) { - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1,sid2; /* Dataspace ID */ - hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; - hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ - hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ - hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ - hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1,sid2; /* Dataspace ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; + hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temporary buffer pointer */ @@ -312,7 +318,7 @@ test_select_hyper(hid_t xfer_plist) } /* test_select_hyper() */ struct pnt_iter { - hssize_t coord[POINT1_NPOINTS*2][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t coord[POINT1_NPOINTS*2][SPACE2_RANK]; /* Coordinates for point selection */ uint8_t *buf; /* Buffer the points are in */ int offset; /* Which point we are looking at */ }; @@ -324,7 +330,7 @@ struct pnt_iter { ** ****************************************************************/ herr_t -test_select_point_iter1(void *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void *_operator_data) +test_select_point_iter1(void *_elem, hid_t UNUSED type_id, unsigned UNUSED ndim, const hsize_t UNUSED *point, void *_operator_data) { uint8_t *elem=(uint8_t *)_elem; /* Pointer to the element to examine */ uint8_t *tmp; /* temporary ptr to element in operator data */ @@ -337,7 +343,7 @@ test_select_point_iter1(void *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, h pnt_info->offset++; return(0); } -} /* end test_select_hyper_iter1() */ +} /* end test_select_point_iter1() */ /**************************************************************** ** @@ -355,12 +361,12 @@ test_select_point(hid_t xfer_plist) hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hssize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ - hssize_t temp_coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ - hssize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ - hssize_t temp_coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ - hssize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ - hssize_t temp_coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ + hsize_t temp_coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ + hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t temp_coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hsize_t temp_coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ *tbuf; /* temporary buffer pointer */ @@ -403,7 +409,7 @@ test_select_point(hid_t xfer_plist) coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4; coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6; coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8; - ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1); + ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Verify correct elements selected */ @@ -428,7 +434,7 @@ test_select_point(hid_t xfer_plist) coord1[7][0]=1; coord1[7][1]=14; coord1[7][2]= 6; coord1[8][0]=2; coord1[8][1]= 2; coord1[8][2]= 5; coord1[9][0]=0; coord1[9][1]= 6; coord1[9][2]=13; - ret = H5Sselect_elements(sid1,H5S_SELECT_APPEND,POINT1_NPOINTS,(const hssize_t **)coord1); + ret = H5Sselect_elements(sid1,H5S_SELECT_APPEND,POINT1_NPOINTS,(const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Verify correct elements selected */ @@ -453,7 +459,7 @@ test_select_point(hid_t xfer_plist) coord2[7][0]=29; coord2[7][1]= 4; coord2[8][0]= 8; coord2[8][1]= 8; coord2[9][0]=19; coord2[9][1]=17; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord2); + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); /* Verify correct elements selected */ @@ -482,7 +488,7 @@ test_select_point(hid_t xfer_plist) coord2[7][0]=12; coord2[7][1]= 2; coord2[8][0]=21; coord2[8][1]=12; coord2[9][0]= 9; coord2[9][1]=18; - ret = H5Sselect_elements(sid2,H5S_SELECT_PREPEND,POINT1_NPOINTS,(const hssize_t **)coord2); + ret = H5Sselect_elements(sid2,H5S_SELECT_PREPEND,POINT1_NPOINTS,(const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); /* Verify correct elements selected */ @@ -524,7 +530,7 @@ test_select_point(hid_t xfer_plist) coord3[7][0]= 1; coord3[7][1]=22; coord3[8][0]=12; coord3[8][1]=21; coord3[9][0]=11; coord3[9][1]= 6; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord3); + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord3); CHECK(ret, FAIL, "H5Sselect_elements"); /* Verify correct elements selected */ @@ -548,7 +554,7 @@ test_select_point(hid_t xfer_plist) coord3[7][0]= 9; coord3[7][1]=16; coord3[8][0]=12; coord3[8][1]=22; coord3[9][0]=13; coord3[9][1]= 9; - ret = H5Sselect_elements(sid2,H5S_SELECT_APPEND,POINT1_NPOINTS,(const hssize_t **)coord3); + ret = H5Sselect_elements(sid2,H5S_SELECT_APPEND,POINT1_NPOINTS,(const hsize_t **)coord3); CHECK(ret, FAIL, "H5Sselect_elements"); /* Verify correct elements selected */ @@ -598,7 +604,7 @@ test_select_point(hid_t xfer_plist) ** ****************************************************************/ herr_t -test_select_all_iter1(void *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void *_operator_data) +test_select_all_iter1(void *_elem, hid_t UNUSED type_id, unsigned UNUSED ndim, const hsize_t UNUSED *point, void *_operator_data) { uint8_t *tbuf=(uint8_t *)_elem, /* temporary buffer pointer */ **tbuf2=(uint8_t **)_operator_data; /* temporary buffer handle */ @@ -618,7 +624,7 @@ test_select_all_iter1(void *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, hss ** ****************************************************************/ herr_t -test_select_none_iter1(void UNUSED *_elem,hid_t UNUSED type_id, hsize_t UNUSED ndim, hssize_t UNUSED *point, void UNUSED *_operator_data) +test_select_none_iter1(void UNUSED *_elem, hid_t UNUSED type_id, unsigned UNUSED ndim, const hsize_t UNUSED *point, void UNUSED *_operator_data) { return(-1); } /* end test_select_none_iter1() */ @@ -716,7 +722,7 @@ test_select_all_hyper(hid_t xfer_plist) hsize_t dims1[] = {SPACE3_DIM1, SPACE3_DIM2}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ @@ -854,8 +860,8 @@ test_select_combo(void) hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hssize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ - hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ @@ -901,7 +907,7 @@ test_select_combo(void) coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4; coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6; coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8; - ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1); + ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Select 1x10 hyperslab for writing memory dataset */ @@ -995,7 +1001,7 @@ test_select_hyper_stride(hid_t xfer_plist) hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ @@ -1145,7 +1151,7 @@ test_select_hyper_contig(hid_t dset_type, hid_t xfer_plist) hid_t dataset; /* Dataset ID */ hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims2[] = {SPACE2_DIM2, SPACE2_DIM1}; - hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ @@ -1274,7 +1280,7 @@ test_select_hyper_contig2(hid_t dset_type, hid_t xfer_plist) hid_t dataset; /* Dataset ID */ hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims2[] = {SPACE8_DIM4, SPACE8_DIM3, SPACE8_DIM2, SPACE8_DIM1}; - hssize_t start[SPACE8_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE8_RANK]; /* Starting location of hyperslab */ hsize_t count[SPACE8_RANK]; /* Element count of hyperslab */ uint16_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ @@ -1398,12 +1404,12 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) hid_t dataset; /* Dataset ID */ hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims2[] = {SPACE8_DIM4, SPACE8_DIM3, SPACE8_DIM2, SPACE8_DIM1}; - hssize_t start[SPACE8_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE8_RANK]; /* Starting location of hyperslab */ hsize_t count[SPACE8_RANK]; /* Element count of hyperslab */ uint16_t *wbuf, /* Buffer to write to disk */ *rbuf, /* Buffer read from disk */ *tbuf, *tbuf2; /* Temporary buffer pointers */ - int i,j,k,l; /* Counters */ + unsigned i,j,k,l; /* Counters */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1480,19 +1486,19 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist) for(j=0; j<SPACE8_DIM3; j++) for(k=0; k<SPACE8_DIM2; k++) for(l=0; l<SPACE8_DIM1; l++,tbuf++,tbuf2++) - if( (i>=start[0] && i<(int)(start[0]+count[0])) && - (j>=start[1] && j<(int)(start[1]+count[1])) && - (k>=start[2] && k<(int)(start[2]+count[2])) && - (l>=start[3] && l<(int)(start[3]+count[3])) ) { + if( (i>=start[0] && i<(start[0]+count[0])) && + (j>=start[1] && j<(start[1]+count[1])) && + (k>=start[2] && k<(start[2]+count[2])) && + (l>=start[3] && l<(start[3]+count[3])) ) { if(*tbuf!=*tbuf2) { printf("Error: hyperslab values don't match!\n"); - TestErrPrintf("Line: %d, i=%d, j=%d, k=%d, l=%d, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); + TestErrPrintf("Line: %d, i=%u, j=%u, k=%u, l=%u, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end if */ else { if(*tbuf2!=0) { printf("Error: invalid data in read buffer!\n"); - TestErrPrintf("Line: %d, i=%d, j=%d, k=%d, l=%d, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); + TestErrPrintf("Line: %d, i=%u, j=%u, k=%u, l=%u, *tbuf=%u,*tbuf2=%u\n",__LINE__,i,j,k,l,(unsigned)*tbuf,(unsigned)*tbuf2); } /* end if */ } /* end else */ @@ -1532,7 +1538,7 @@ test_select_hyper_copy(void) hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ @@ -1690,9 +1696,9 @@ test_select_point_copy(void) hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hssize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ - hssize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ - hssize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ + hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ uint16_t *wbuf, /* buffer to write to disk */ *rbuf, /* 1st buffer read from disk */ *rbuf2, /* 2nd buffer read from disk */ @@ -1736,7 +1742,7 @@ test_select_point_copy(void) coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4; coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6; coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8; - ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1); + ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Select sequence of ten points for write dataset */ @@ -1750,7 +1756,7 @@ test_select_point_copy(void) coord2[7][0]=29; coord2[7][1]= 4; coord2[8][0]= 8; coord2[8][1]= 8; coord2[9][0]=19; coord2[9][1]=17; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord2); + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); /* Make a copy of the dataspace to write */ @@ -1794,7 +1800,7 @@ test_select_point_copy(void) coord3[7][0]= 1; coord3[7][1]=22; coord3[8][0]=12; coord3[8][1]=21; coord3[9][0]=11; coord3[9][1]= 6; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord3); + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord3); CHECK(ret, FAIL, "H5Sselect_elements"); /* Make a copy of the dataspace to read */ @@ -1859,7 +1865,7 @@ test_select_hyper_offset(void) hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ @@ -2017,7 +2023,7 @@ test_select_hyper_offset2(void) hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2}; hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2}; - hssize_t start[SPACE7_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE7_RANK]; /* Starting location of hyperslab */ hsize_t count[SPACE7_RANK]; /* Element count of hyperslab */ hssize_t offset[SPACE7_RANK]; /* Offset of selection */ uint8_t *wbuf, /* buffer to write to disk */ @@ -2136,9 +2142,9 @@ test_select_point_offset(void) hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hssize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ - hssize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ - hssize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ + hsize_t coord1[POINT1_NPOINTS][SPACE1_RANK]; /* Coordinates for point selection */ + hsize_t coord2[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t coord3[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */ hssize_t offset[SPACE1_RANK]; /* Offset of selection */ uint8_t *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ @@ -2183,7 +2189,7 @@ test_select_point_offset(void) coord1[7][0]=1; coord1[7][1]= 0; coord1[7][2]= 4; coord1[8][0]=2; coord1[8][1]= 1; coord1[8][2]= 6; coord1[9][0]=0; coord1[9][1]= 3; coord1[9][2]= 8; - ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1); + ret = H5Sselect_elements(sid1,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Check a valid offset */ @@ -2218,7 +2224,7 @@ test_select_point_offset(void) coord2[7][0]=23; coord2[7][1]= 4; coord2[8][0]= 8; coord2[8][1]= 8; coord2[9][0]=19; coord2[9][1]=17; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord2); + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); /* Choose a valid offset for the memory dataspace */ @@ -2254,7 +2260,7 @@ test_select_point_offset(void) coord3[7][0]= 1; coord3[7][1]=22; coord3[8][0]=12; coord3[8][1]=21; coord3[9][0]=11; coord3[9][1]= 6; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord3); + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord3); CHECK(ret, FAIL, "H5Sselect_elements"); /* Read selection from disk */ @@ -2306,7 +2312,7 @@ test_select_hyper_union(void) hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ @@ -2969,7 +2975,7 @@ test_select_hyper_union_3d(void) hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {SPACE4_DIM1, SPACE4_DIM2, SPACE4_DIM3}; hsize_t dims3[] = {SPACE3_DIM1, SPACE3_DIM2}; - hssize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ @@ -3171,7 +3177,7 @@ test_select_hyper_and_2d(void) hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims2[] = {SPACE2A_DIM1}; - hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ @@ -3297,7 +3303,7 @@ test_select_hyper_xor_2d(void) hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims2[] = {SPACE2A_DIM1}; - hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ @@ -3425,7 +3431,7 @@ test_select_hyper_notb_2d(void) hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims2[] = {SPACE2A_DIM1}; - hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ @@ -3552,7 +3558,7 @@ test_select_hyper_nota_2d(void) hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims1[] = {SPACE2_DIM1, SPACE2_DIM2}; hsize_t dims2[] = {SPACE2A_DIM1}; - hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ @@ -3671,7 +3677,7 @@ test_select_hyper_nota_2d(void) ** ****************************************************************/ herr_t -test_select_hyper_iter2(void *_elem, hid_t UNUSED type_id, hsize_t ndim, hssize_t *point, void *_operator_data) +test_select_hyper_iter2(void *_elem, hid_t UNUSED type_id, unsigned ndim, const hsize_t *point, void *_operator_data) { int *tbuf=(int *)_elem, /* temporary buffer pointer */ **tbuf2=(int **)_operator_data; /* temporary buffer handle */ @@ -3680,9 +3686,9 @@ test_select_hyper_iter2(void *_elem, hid_t UNUSED type_id, hsize_t ndim, hssize_ if(*tbuf!=**tbuf2) { TestErrPrintf("Error in hyperslab iteration!\n"); printf("location: { "); - for(u=0; u<(unsigned)ndim; u++) { + for(u=0; u<ndim; u++) { printf("%2d",(int)point[u]); - if(u<(unsigned)(ndim-1)) + if(u<(ndim-1)) printf(", "); } /* end for */ printf("}\n"); @@ -3693,7 +3699,7 @@ test_select_hyper_iter2(void *_elem, hid_t UNUSED type_id, hsize_t ndim, hssize_ (*tbuf2)++; return(0); } -} /* end test_select_hyper_iter1() */ +} /* end test_select_hyper_iter2() */ /**************************************************************** ** @@ -3709,7 +3715,7 @@ test_select_hyper_union_random_5d(hid_t read_plist) hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims1[] = {SPACE5_DIM1, SPACE5_DIM2, SPACE5_DIM3, SPACE5_DIM4, SPACE5_DIM5}; hsize_t dims2[] = {SPACE6_DIM1}; - hssize_t start[SPACE5_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE5_RANK]; /* Starting location of hyperslab */ hsize_t count[SPACE5_RANK]; /* Element count of hyperslab */ int *wbuf, /* buffer to write to disk */ *rbuf, /* buffer read from disk */ @@ -3906,9 +3912,9 @@ test_select_hyper_chunk(hid_t fapl_plist, hid_t xfer_plist) short *tmpdata_out; /* output buffer */ hsize_t count[3]; /* size of the hyperslab in the file */ - hssize_t offset[3]; /* hyperslab offset in the file */ + hsize_t offset[3]; /* hyperslab offset in the file */ hsize_t count_out[3]; /* size of the hyperslab in memory */ - hssize_t offset_out[3]; /* hyperslab offset in memory */ + hsize_t offset_out[3]; /* hyperslab offset in memory */ int i, j, k, status_n, rank; /* Output message about test being performed */ @@ -4139,9 +4145,9 @@ test_select_point_chunk(void) unsigned *tmpdata_out; /* output buffer */ #endif /* LATER */ - hssize_t start[SPACE7_RANK]; /* hyperslab offset */ + hsize_t start[SPACE7_RANK]; /* hyperslab offset */ hsize_t count[SPACE7_RANK]; /* size of the hyperslab */ - hssize_t points[SPACE7_NPOINTS][SPACE7_RANK]; /* points for selection */ + hsize_t points[SPACE7_NPOINTS][SPACE7_RANK]; /* points for selection */ unsigned i, j; /* Local index variables */ /* Output message about test being performed */ @@ -4204,7 +4210,7 @@ test_select_point_chunk(void) points[6][1]=1; points[7][0]=6; /* In same chunk as point #3, but "earlier" in chunk */ points[7][1]=6; - ret = H5Sselect_elements(pnt1_space,H5S_SELECT_SET,SPACE7_NPOINTS,(const hssize_t **)points); + ret = H5Sselect_elements(pnt1_space,H5S_SELECT_SET,SPACE7_NPOINTS,(const hsize_t **)points); CHECK(ret, FAIL, "H5Sselect_elements"); /* Create 1st hyperslab selection */ @@ -4240,7 +4246,7 @@ test_select_point_chunk(void) points[6][1]=2; points[7][0]=7; /* In same chunk as point #3, but "earlier" in chunk */ points[7][1]=7; - ret = H5Sselect_elements(pnt2_space,H5S_SELECT_SET,SPACE7_NPOINTS,(const hssize_t **)points); + ret = H5Sselect_elements(pnt2_space,H5S_SELECT_SET,SPACE7_NPOINTS,(const hsize_t **)points); CHECK(ret, FAIL, "H5Sselect_elements"); /* Create 2nd hyperslab selection */ @@ -4318,7 +4324,7 @@ test_select_scalar_chunk(void) hid_t m_sid; /* Memory dataspace */ hsize_t dims[] = {2}; /* Dataset dimensions */ hsize_t maxdims[] = {H5S_UNLIMITED}; /* Dataset maximum dimensions */ - hssize_t offset[] = {0}; /* Hyperslab start */ + hsize_t offset[] = {0}; /* Hyperslab start */ hsize_t count[] = {1}; /* Hyperslab count */ unsigned data = 2; /* Data to write */ herr_t ret; @@ -4380,9 +4386,9 @@ test_select_valid(void) herr_t error; htri_t valid; hid_t main_space, sub_space; - hssize_t safe_start[2]={1,1}; + hsize_t safe_start[2]={1,1}; hsize_t safe_count[2]={1,1}; - hssize_t start[2]; + hsize_t start[2]; hsize_t dims[2],maxdims[2],size[2],count[2]; /* Output message about test being performed */ @@ -4477,7 +4483,7 @@ test_select_combine(void) hid_t all_id; /* Dataspace for "all" selection */ hid_t none_id; /* Dataspace for "none" selection */ hid_t space1; /* Temporary dataspace #1 */ - hssize_t start[SPACE7_RANK]; /* Hyperslab start */ + hsize_t start[SPACE7_RANK]; /* Hyperslab start */ hsize_t stride[SPACE7_RANK]; /* Hyperslab stride */ hsize_t count[SPACE7_RANK]; /* Hyperslab count */ hsize_t block[SPACE7_RANK]; /* Hyperslab block */ @@ -4828,7 +4834,7 @@ test_select_combine(void) typedef struct { unsigned short fill_value; /* The fill value to check */ size_t curr_coord; /* Current coordinate to examine */ - hssize_t *coords; /* Pointer to selection's coordinates */ + hsize_t *coords; /* Pointer to selection's coordinates */ } fill_iter_info; /**************************************************************** @@ -4837,11 +4843,11 @@ typedef struct { ** ****************************************************************/ herr_t -test_select_hyper_iter3(void *_elem,hid_t UNUSED type_id, hsize_t ndim, hssize_t *point, void *_operator_data) +test_select_hyper_iter3(void *_elem, hid_t UNUSED type_id, unsigned ndim, const hsize_t *point, void *_operator_data) { unsigned short *tbuf=(unsigned short *)_elem; /* temporary buffer pointer */ fill_iter_info *iter_info=(fill_iter_info *)_operator_data; /* Get the pointer to the iterator information */ - hssize_t *coord_ptr; /* Pointer to the coordinate information for a point*/ + hsize_t *coord_ptr; /* Pointer to the coordinate information for a point*/ /* Check value in current buffer location */ if(*tbuf!=iter_info->fill_value) @@ -4877,7 +4883,7 @@ test_select_fill_all(void) hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2}; int fill_value; /* Fill value */ fill_iter_info iter_info; /* Iterator information structure */ - hssize_t points[SPACE7_DIM1*SPACE7_DIM2][SPACE7_RANK]; /* Coordinates of selection */ + hsize_t points[SPACE7_DIM1*SPACE7_DIM2][SPACE7_RANK]; /* Coordinates of selection */ unsigned short *wbuf, /* buffer to write to disk */ *tbuf; /* temporary buffer pointer */ int i,j; /* Counters */ @@ -4923,7 +4929,7 @@ test_select_fill_all(void) /* Initialize the iterator structure */ iter_info.fill_value=SPACE7_FILL; iter_info.curr_coord=0; - iter_info.coords=(hssize_t *)points; + iter_info.coords=(hsize_t *)points; /* Iterate through selection, verifying correct data */ ret = H5Diterate(wbuf,H5T_NATIVE_USHORT,sid1,test_select_hyper_iter3,&iter_info); @@ -4949,7 +4955,7 @@ test_select_fill_point(hssize_t *offset) hid_t sid1; /* Dataspace ID */ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2}; hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */ - hssize_t points[5][SPACE7_RANK] = {{2,4}, {3,8}, {8,4}, {7,5}, {7,7}}; + hsize_t points[5][SPACE7_RANK] = {{2,4}, {3,8}, {8,4}, {7,5}, {7,7}}; size_t num_points=5; /* Number of points selected */ int fill_value; /* Fill value */ fill_iter_info iter_info; /* Iterator information structure */ @@ -4974,7 +4980,7 @@ test_select_fill_point(hssize_t *offset) CHECK(sid1, FAIL, "H5Screate_simple"); /* Select "point" selection */ - ret = H5Sselect_elements(sid1, H5S_SELECT_SET,num_points,(const hssize_t **)points); + ret = H5Sselect_elements(sid1, H5S_SELECT_SET,num_points,(const hsize_t **)points); CHECK(ret, FAIL, "H5Sselect_elements"); if(offset!=NULL) { @@ -4998,7 +5004,7 @@ test_select_fill_point(hssize_t *offset) for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) for(j=0; j<SPACE7_DIM2; j++, tbuf++) { for(k=0; k<(int)num_points; k++) { - if(i==(points[k][0]+real_offset[0]) && j==(points[k][1]+real_offset[1])) { + if(i==(int)(points[k][0]+real_offset[0]) && j==(int)(points[k][1]+real_offset[1])) { if(*tbuf!=(unsigned short)fill_value) TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); break; @@ -5011,7 +5017,7 @@ test_select_fill_point(hssize_t *offset) /* Initialize the iterator structure */ iter_info.fill_value=SPACE7_FILL; iter_info.curr_coord=0; - iter_info.coords=(hssize_t *)points; + iter_info.coords=(hsize_t *)points; /* Add in the offset */ for(i=0; i<(int)num_points; i++) { @@ -5043,10 +5049,10 @@ test_select_fill_hyper_simple(hssize_t *offset) hid_t sid1; /* Dataspace ID */ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2}; hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */ - hssize_t start[SPACE7_RANK]; /* Hyperslab start */ + hsize_t start[SPACE7_RANK]; /* Hyperslab start */ hsize_t count[SPACE7_RANK]; /* Hyperslab block size */ size_t num_points; /* Number of points in selection */ - hssize_t points[16][SPACE7_RANK]; /* Coordinates selected */ + hsize_t points[16][SPACE7_RANK]; /* Coordinates selected */ int fill_value; /* Fill value */ fill_iter_info iter_info; /* Iterator information structure */ unsigned short *wbuf, /* buffer to write to disk */ @@ -5109,7 +5115,7 @@ test_select_fill_hyper_simple(hssize_t *offset) /* Initialize the iterator structure */ iter_info.fill_value=SPACE7_FILL; iter_info.curr_coord=0; - iter_info.coords=(hssize_t *)points; + iter_info.coords=(hsize_t *)points; /* Set the coordinates of the selection (with the offset) */ for(i=0, num_points=0; i<(int)count[0]; i++) @@ -5142,11 +5148,11 @@ test_select_fill_hyper_regular(hssize_t *offset) hid_t sid1; /* Dataspace ID */ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2}; hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */ - hssize_t start[SPACE7_RANK]; /* Hyperslab start */ + hsize_t start[SPACE7_RANK]; /* Hyperslab start */ hsize_t stride[SPACE7_RANK]; /* Hyperslab stride size */ hsize_t count[SPACE7_RANK]; /* Hyperslab block count */ hsize_t block[SPACE7_RANK]; /* Hyperslab block size */ - hssize_t points[16][SPACE7_RANK] = { + hsize_t points[16][SPACE7_RANK] = { {2,2}, {2,3}, {2,6}, {2,7}, {3,2}, {3,3}, {3,6}, {3,7}, {6,2}, {6,3}, {6,6}, {6,7}, @@ -5204,7 +5210,7 @@ test_select_fill_hyper_regular(hssize_t *offset) for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) for(j=0; j<SPACE7_DIM2; j++, tbuf++) { for(k=0; k<(int)num_points; k++) { - if(i==(points[k][0]+real_offset[0]) && j==(points[k][1]+real_offset[1])) { + if(i==(int)(points[k][0]+real_offset[0]) && j==(int)(points[k][1]+real_offset[1])) { if(*tbuf!=(unsigned short)fill_value) TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); break; @@ -5217,7 +5223,7 @@ test_select_fill_hyper_regular(hssize_t *offset) /* Initialize the iterator structure */ iter_info.fill_value=SPACE7_FILL; iter_info.curr_coord=0; - iter_info.coords=(hssize_t *)points; + iter_info.coords=(hsize_t *)points; /* Add in the offset */ for(i=0; i<(int)num_points; i++) { @@ -5249,9 +5255,9 @@ test_select_fill_hyper_irregular(hssize_t *offset) hid_t sid1; /* Dataspace ID */ hsize_t dims1[] = {SPACE7_DIM1, SPACE7_DIM2}; hssize_t real_offset[SPACE7_RANK]; /* Actual offset to use */ - hssize_t start[SPACE7_RANK]; /* Hyperslab start */ + hsize_t start[SPACE7_RANK]; /* Hyperslab start */ hsize_t count[SPACE7_RANK]; /* Hyperslab block count */ - hssize_t points[32][SPACE7_RANK] = { /* Yes, some of the are duplicated.. */ + hsize_t points[32][SPACE7_RANK] = { /* Yes, some of the are duplicated.. */ {2,2}, {2,3}, {2,4}, {2,5}, {3,2}, {3,3}, {3,4}, {3,5}, {4,2}, {4,3}, {4,4}, {4,5}, @@ -5261,7 +5267,7 @@ test_select_fill_hyper_irregular(hssize_t *offset) {6,4}, {6,5}, {6,6}, {6,7}, {7,4}, {7,5}, {7,6}, {7,7}, }; - hssize_t iter_points[28][SPACE7_RANK] = { /* Coordinates, as iterated through */ + hsize_t iter_points[28][SPACE7_RANK] = { /* Coordinates, as iterated through */ {2,2}, {2,3}, {2,4}, {2,5}, {3,2}, {3,3}, {3,4}, {3,5}, {4,2}, {4,3}, {4,4}, {4,5}, {4,6}, {4,7}, @@ -5326,7 +5332,7 @@ test_select_fill_hyper_irregular(hssize_t *offset) for(i=0, tbuf=wbuf; i<SPACE7_DIM1; i++) for(j=0; j<SPACE7_DIM2; j++, tbuf++) { for(k=0; k<(int)num_points; k++) { - if(i==(points[k][0]+real_offset[0]) && j==(points[k][1]+real_offset[1])) { + if(i==(int)(points[k][0]+real_offset[0]) && j==(int)(points[k][1]+real_offset[1])) { if(*tbuf!=(unsigned short)fill_value) TestErrPrintf("Error! j=%d, i=%d, *tbuf=%u, fill_value=%u\n",j,i,(unsigned)*tbuf,(unsigned)fill_value); break; @@ -5339,7 +5345,7 @@ test_select_fill_hyper_irregular(hssize_t *offset) /* Initialize the iterator structure */ iter_info.fill_value=SPACE7_FILL; iter_info.curr_coord=0; - iter_info.coords=(hssize_t *)iter_points; + iter_info.coords=(hsize_t *)iter_points; /* Add in the offset */ for(i=0; i<(int)num_iter_points; i++) { @@ -5468,8 +5474,8 @@ test_scalar_select(void) hid_t dataset; /* Dataset ID */ hid_t sid1,sid2; /* Dataspace ID */ hsize_t dims2[] = {SPACE7_DIM1, SPACE7_DIM2}; - hssize_t coord1[SPACE7_RANK]; /* Coordinates for point selection */ - hssize_t start[SPACE7_RANK]; /* Hyperslab start */ + hsize_t coord1[SPACE7_RANK]; /* Coordinates for point selection */ + hsize_t start[SPACE7_RANK]; /* Hyperslab start */ hsize_t count[SPACE7_RANK]; /* Hyperslab block count */ uint8_t *wbuf_uint8, /* buffer to write to disk */ rval_uint8, /* value read back in */ @@ -5512,7 +5518,7 @@ test_scalar_select(void) /* Select one element in memory with a point selection */ coord1[0]=0; coord1[1]= 2; - ret = H5Sselect_elements(sid2,H5S_SELECT_SET,1,(const hssize_t **)&coord1); + ret = H5Sselect_elements(sid2,H5S_SELECT_SET,1,(const hsize_t **)&coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Write single point to disk */ @@ -5616,8 +5622,8 @@ static void test_scalar_select2(void) { hid_t sid; /* Dataspace ID */ - hssize_t coord1[1]; /* Coordinates for point selection */ - hssize_t start[1]; /* Hyperslab start */ + hsize_t coord1[1]; /* Coordinates for point selection */ + hsize_t start[1]; /* Hyperslab start */ hsize_t count[1]; /* Hyperslab block count */ herr_t ret; /* Generic return value */ @@ -5631,7 +5637,7 @@ test_scalar_select2(void) /* Select one element in memory with a point selection */ coord1[0]=0; H5E_BEGIN_TRY { - ret = H5Sselect_elements(sid,H5S_SELECT_SET,1,(const hssize_t **)&coord1); + ret = H5Sselect_elements(sid,H5S_SELECT_SET,1,(const hsize_t **)&coord1); } H5E_END_TRY; VERIFY(ret, FAIL, "H5Sselect_elements"); @@ -5682,9 +5688,9 @@ test_shape_same(void) hid_t none_hyper_sid; /* Dataspace ID with "no hyperslabs" selection */ hid_t tmp_sid; /* Temporary dataspace ID */ hsize_t dims[] = {SPACE9_DIM1, SPACE9_DIM2}; - hssize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */ - hssize_t coord2[SPACE9_DIM2][SPACE9_RANK]; /* Coordinates for multiple point selection */ - hssize_t start[SPACE9_RANK]; /* Hyperslab start */ + hsize_t coord1[1][SPACE2_RANK]; /* Coordinates for single point selection */ + hsize_t coord2[SPACE9_DIM2][SPACE9_RANK]; /* Coordinates for multiple point selection */ + hsize_t start[SPACE9_RANK]; /* Hyperslab start */ hsize_t stride[SPACE9_RANK]; /* Hyperslab stride */ hsize_t count[SPACE9_RANK]; /* Hyperslab block count */ hsize_t block[SPACE9_RANK]; /* Hyperslab block size */ @@ -5718,7 +5724,7 @@ test_shape_same(void) /* Select sequence of ten points for multiple point selection */ coord1[0][0]=2; coord1[0][1]=2; - ret = H5Sselect_elements(single_pt_sid,H5S_SELECT_SET,1,(const hssize_t **)coord1); + ret = H5Sselect_elements(single_pt_sid,H5S_SELECT_SET,1,(const hsize_t **)coord1); CHECK(ret, FAIL, "H5Sselect_elements"); /* Create dataspace for multiple point selection */ @@ -5736,7 +5742,7 @@ test_shape_same(void) coord2[7][0]=1; coord2[7][1]=0; coord2[8][0]=5; coord2[8][1]=1; coord2[9][0]=9; coord2[9][1]=3; - ret = H5Sselect_elements(mult_pt_sid,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord2); + ret = H5Sselect_elements(mult_pt_sid,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); /* Create dataspace for single hyperslab selection */ @@ -6093,7 +6099,7 @@ test_shape_same(void) for(v=1; v<(SPACE9_DIM2-1); v++) { coord2[v-1][0]=u; coord2[v-1][1]=v; } /* end for */ - ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,(SPACE9_DIM2-2),(const hssize_t **)coord2); + ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,(SPACE9_DIM2-2),(const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); } /* end for */ @@ -6199,7 +6205,7 @@ test_shape_same(void) for(v=0; v<SPACE9_DIM2; v++) { coord2[v][0]=u; coord2[v][1]=v; } /* end for */ - ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,SPACE9_DIM2,(const hssize_t **)coord2); + ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,SPACE9_DIM2,(const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); } /* end for */ @@ -6349,7 +6355,7 @@ test_shape_same(void) for(v=0; v<2; v++) { coord2[v][0]=u; coord2[v][1]=(v*2)+2; } /* end for */ - ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,2,(const hssize_t **)coord2); + ret = H5Sselect_elements(tmp_sid,H5S_SELECT_APPEND,2,(const hsize_t **)coord2); CHECK(ret, FAIL, "H5Sselect_elements"); } /* end for */ @@ -6531,7 +6537,7 @@ test_select_hyper_chunk_offset(void) int *rbuf; /* Buffer for reading data */ hid_t dcpl; /* Dataset creation property list ID */ hsize_t chunks[1]={SPACE10_CHUNK_SIZE }; /* Chunk size */ - hssize_t start[1] = { 0 }; /* The start of the hyperslab */ + hsize_t start[1] = { 0 }; /* The start of the hyperslab */ hsize_t count[1] = { SPACE10_CHUNK_SIZE }; /* The size of the hyperslab */ int i,j; /* Local index */ herr_t ret; /* Generic return value */ @@ -6727,6 +6733,210 @@ test_select_hyper_chunk_offset(void) /**************************************************************** ** +** test_select_bounds(): Tests selection bounds on dataspaces, +** both with and without offsets. +** +****************************************************************/ +static void +test_select_bounds(void) +{ + hid_t sid; /* Dataspace ID */ + const hsize_t dims[SPACE11_RANK] = { SPACE11_DIM1, SPACE11_DIM2 }; /* Dataspace dimensions */ + hsize_t coord[SPACE11_NPOINTS][SPACE11_RANK]; /* Coordinates for point selection */ + hsize_t start[SPACE11_RANK]; /* The start of the hyperslab */ + hsize_t stride[SPACE11_RANK]; /* The stride between block starts for the hyperslab */ + hsize_t count[SPACE11_RANK]; /* The number of blocks for the hyperslab */ + hsize_t block[SPACE11_RANK]; /* The size of each block for the hyperslab */ + hssize_t offset[SPACE11_RANK]; /* Offset amount for selection */ + hsize_t low_bounds[SPACE11_RANK]; /* The low bounds for the selection */ + hsize_t high_bounds[SPACE11_RANK]; /* The high bounds for the selection */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(6, ("Testing selection bounds\n")); + + /* Create dataspace */ + sid = H5Screate_simple (SPACE11_RANK, dims, NULL); + CHECK(sid, FAIL, "H5Screate_simple"); + + /* Get bounds for 'all' selection */ + ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); + CHECK(ret, FAIL, "H5Sget_select_bounds"); + VERIFY(low_bounds[0],0,"H5Sget_select_bounds"); + VERIFY(low_bounds[1],0,"H5Sget_select_bounds"); + VERIFY(high_bounds[0],SPACE11_DIM1-1,"H5Sget_select_bounds"); + VERIFY(high_bounds[1],SPACE11_DIM2-1,"H5Sget_select_bounds"); + + /* Set offset for selection */ + offset[0]=1; offset[1]=1; + ret=H5Soffset_simple(sid, offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + + /* Get bounds for 'all' selection with offset (which should be ignored) */ + ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); + CHECK(ret, FAIL, "H5Sget_select_bounds"); + VERIFY(low_bounds[0],0,"H5Sget_select_bounds"); + VERIFY(low_bounds[1],0,"H5Sget_select_bounds"); + VERIFY(high_bounds[0],SPACE11_DIM1-1,"H5Sget_select_bounds"); + VERIFY(high_bounds[1],SPACE11_DIM2-1,"H5Sget_select_bounds"); + + /* Reset offset for selection */ + offset[0]=0; offset[1]=0; + ret=H5Soffset_simple(sid, offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + + /* Set 'none' selection */ + ret=H5Sselect_none(sid); + CHECK(ret, FAIL, "H5Sselect_none"); + + /* Get bounds for 'none' selection */ + H5E_BEGIN_TRY { + ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_select_bounds"); + + /* Set point selection */ + coord[0][0]= 3; coord[0][1]= 3; + coord[1][0]= 3; coord[1][1]= 96; + coord[2][0]= 96; coord[2][1]= 3; + coord[3][0]= 96; coord[3][1]= 96; + ret = H5Sselect_elements(sid,H5S_SELECT_SET,SPACE11_NPOINTS,(const hsize_t **)coord); + CHECK(ret, FAIL, "H5Sselect_elements"); + + /* Get bounds for point selection */ + ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); + CHECK(ret, FAIL, "H5Sget_select_bounds"); + VERIFY(low_bounds[0],3,"H5Sget_select_bounds"); + VERIFY(low_bounds[1],3,"H5Sget_select_bounds"); + VERIFY(high_bounds[0],SPACE11_DIM1-4,"H5Sget_select_bounds"); + VERIFY(high_bounds[1],SPACE11_DIM2-4,"H5Sget_select_bounds"); + + /* Set bad offset for selection */ + offset[0]=5; offset[1]=-5; + ret=H5Soffset_simple(sid, offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + + /* Get bounds for hyperslab selection with negative offset */ + H5E_BEGIN_TRY { + ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_select_bounds"); + + /* Set valid offset for selection */ + offset[0]=2; offset[1]=-2; + ret=H5Soffset_simple(sid, offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + + /* Get bounds for point selection with offset */ + ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); + CHECK(ret, FAIL, "H5Sget_select_bounds"); + VERIFY(low_bounds[0],5,"H5Sget_select_bounds"); + VERIFY(low_bounds[1],1,"H5Sget_select_bounds"); + VERIFY(high_bounds[0],SPACE11_DIM1-2,"H5Sget_select_bounds"); + VERIFY(high_bounds[1],SPACE11_DIM2-6,"H5Sget_select_bounds"); + + /* Reset offset for selection */ + offset[0]=0; offset[1]=0; + ret=H5Soffset_simple(sid, offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + + /* Set "regular" hyperslab selection */ + start[0]= 2; start[1]= 2; + stride[0]= 10; stride[1]= 10; + count[0]= 4; count[1]= 4; + block[0]= 5; block[1]= 5; + ret = H5Sselect_hyperslab(sid,H5S_SELECT_SET,start,stride,count,block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Get bounds for hyperslab selection */ + ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); + CHECK(ret, FAIL, "H5Sget_select_bounds"); + VERIFY(low_bounds[0],2,"H5Sget_select_bounds"); + VERIFY(low_bounds[1],2,"H5Sget_select_bounds"); + VERIFY(high_bounds[0],36,"H5Sget_select_bounds"); + VERIFY(high_bounds[1],36,"H5Sget_select_bounds"); + + /* Set bad offset for selection */ + offset[0]=5; offset[1]=-5; + ret=H5Soffset_simple(sid, offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + + /* Get bounds for hyperslab selection with negative offset */ + H5E_BEGIN_TRY { + ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_select_bounds"); + + /* Set valid offset for selection */ + offset[0]=5; offset[1]=-2; + ret=H5Soffset_simple(sid, offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + + /* Get bounds for hyperslab selection with offset */ + ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); + CHECK(ret, FAIL, "H5Sget_select_bounds"); + VERIFY(low_bounds[0],7,"H5Sget_select_bounds"); + VERIFY(low_bounds[1],0,"H5Sget_select_bounds"); + VERIFY(high_bounds[0],41,"H5Sget_select_bounds"); + VERIFY(high_bounds[1],34,"H5Sget_select_bounds"); + + /* Reset offset for selection */ + offset[0]=0; offset[1]=0; + ret=H5Soffset_simple(sid, offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + + /* Make "irregular" hyperslab selection */ + start[0]= 20; start[1]= 20; + stride[0]= 20; stride[1]= 20; + count[0]= 2; count[1]= 2; + block[0]= 10; block[1]= 10; + ret = H5Sselect_hyperslab(sid,H5S_SELECT_OR,start,stride,count,block); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + /* Get bounds for hyperslab selection */ + ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); + CHECK(ret, FAIL, "H5Sget_select_bounds"); + VERIFY(low_bounds[0],2,"H5Sget_select_bounds"); + VERIFY(low_bounds[1],2,"H5Sget_select_bounds"); + VERIFY(high_bounds[0],49,"H5Sget_select_bounds"); + VERIFY(high_bounds[1],49,"H5Sget_select_bounds"); + + /* Set bad offset for selection */ + offset[0]=5; offset[1]=-5; + ret=H5Soffset_simple(sid, offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + + /* Get bounds for hyperslab selection with negative offset */ + H5E_BEGIN_TRY { + ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Sget_select_bounds"); + + /* Set valid offset for selection */ + offset[0]=5; offset[1]=-2; + ret=H5Soffset_simple(sid, offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + + /* Get bounds for hyperslab selection with offset */ + ret = H5Sget_select_bounds(sid,low_bounds,high_bounds); + CHECK(ret, FAIL, "H5Sget_select_bounds"); + VERIFY(low_bounds[0],7,"H5Sget_select_bounds"); + VERIFY(low_bounds[1],0,"H5Sget_select_bounds"); + VERIFY(high_bounds[0],54,"H5Sget_select_bounds"); + VERIFY(high_bounds[1],47,"H5Sget_select_bounds"); + + /* Reset offset for selection */ + offset[0]=0; offset[1]=0; + ret=H5Soffset_simple(sid, offset); + CHECK(ret, FAIL, "H5Soffset_simple"); + + /* Close the dataspace */ + ret=H5Sclose (sid); + CHECK(ret, FAIL, "H5Sclose"); +} /* test_select_bounds() */ + +/**************************************************************** +** ** test_select(): Main H5S selection testing routine. ** ****************************************************************/ @@ -6866,6 +7076,9 @@ test_select(void) /* Test using selection offset on hyperslab in chunked dataset */ test_select_hyper_chunk_offset(); + /* Test selection bounds with & without offsets */ + test_select_bounds(); + } /* test_select() */ diff --git a/test/tskiplist.c b/test/tskiplist.c index e9d7c48..0a02da3 100644 --- a/test/tskiplist.c +++ b/test/tskiplist.c @@ -143,7 +143,7 @@ test_skiplist_insert(void) item; /* Item to insert */ int search_key; /* Key of item to search for in skip list */ int *found_item; /* Item found in skip list */ - ssize_t num; /* Number of elements in skip list */ + size_t num; /* Number of elements in skip list */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -202,7 +202,7 @@ static void test_skiplist_insert_many(void) { H5SL_t *slist; /* Skip list created */ - ssize_t num; /* Number of elements in skip list */ + size_t num; /* Number of elements in skip list */ size_t u; /* Local index variable */ int *found_item; /* Item found in skip list */ herr_t ret; /* Generic return value */ @@ -278,7 +278,7 @@ test_skiplist_remove(void) key3; /* Key of 3rd item to insert */ int search_key; /* Key of item to search for in skip list */ int *found_item; /* Item found in skip list */ - ssize_t num; /* Number of elements in skip list */ + size_t num; /* Number of elements in skip list */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -355,7 +355,7 @@ static void test_skiplist_remove_many(void) { H5SL_t *slist; /* Skip list created */ - ssize_t num; /* Number of elements in skip list */ + size_t num; /* Number of elements in skip list */ size_t u; /* Local index variable */ int *found_item; /* Item found in skip list */ herr_t ret; /* Generic return value */ @@ -455,7 +455,7 @@ test_skiplist_firstnext(void) { H5SL_t *slist; /* Skip list created */ H5SL_node_t *node; /* Skip list node */ - ssize_t num; /* Number of elements in skip list */ + size_t num; /* Number of elements in skip list */ size_t u; /* Local index variable */ int *found_item; /* Item found in skip list */ herr_t ret; /* Generic return value */ @@ -508,7 +508,7 @@ test_skiplist_string(void) { H5SL_t *slist; /* Skip list created */ H5SL_node_t *node; /* Skip list node */ - ssize_t num; /* Number of elements in skip list */ + size_t num; /* Number of elements in skip list */ size_t u; /* Local index variable */ typedef struct string_node { int i; @@ -597,7 +597,7 @@ static void test_skiplist_iterate(void) { H5SL_t *slist; /* Skip list created */ - ssize_t num; /* Number of elements in skip list */ + size_t num; /* Number of elements in skip list */ size_t u; /* Local index variable */ herr_t ret; /* Generic return value */ diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c index 7a4635b..f535541 100644 --- a/test/ttsafe_acreate.c +++ b/test/ttsafe_acreate.c @@ -145,31 +145,31 @@ void tts_acreate(void) void *tts_acreate_thread(void *client_data) { - hid_t attribute; - char *attribute_name; - int *attribute_data; /* data for attributes */ - - ttsafe_name_data_t *attrib_data; - - attrib_data = (ttsafe_name_data_t *)client_data; - - /* Create attribute */ - attribute_name = gen_name(attrib_data->current_index); - attribute = H5Acreate(attrib_data->dataset, attribute_name, - attrib_data->datatype, attrib_data->dataspace, - H5P_DEFAULT); - - /* Write data to the attribute */ - attribute_data = malloc(sizeof(int)); - *attribute_data = attrib_data->current_index; - H5Awrite(attribute, H5T_NATIVE_INT, attribute_data); - H5Aclose(attribute); - return NULL; + hid_t attribute; + char *attribute_name; + int *attribute_data; /* data for attributes */ + + ttsafe_name_data_t *attrib_data; + + attrib_data = (ttsafe_name_data_t *)client_data; + + /* Create attribute */ + attribute_name = gen_name(attrib_data->current_index); + attribute = H5Acreate(attrib_data->dataset, attribute_name, + attrib_data->datatype, attrib_data->dataspace, + H5P_DEFAULT); + + /* Write data to the attribute */ + attribute_data = malloc(sizeof(int)); + *attribute_data = attrib_data->current_index; + H5Awrite(attribute, H5T_NATIVE_INT, attribute_data); + H5Aclose(attribute); + return NULL; } void cleanup_acreate(void) { - HDunlink(FILENAME); + HDunlink(FILENAME); } #endif /*H5_HAVE_THREADSAFE*/ diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c index 30e9bfb..f9a5047 100644 --- a/test/ttsafe_cancel.c +++ b/test/ttsafe_cancel.c @@ -52,7 +52,7 @@ void *tts_cancel_thread(void *); void tts_cancel_barrier(void); -herr_t tts_cancel_callback(void *, hid_t, hsize_t, hssize_t *, void *); +herr_t tts_cancel_callback(void *, hid_t, unsigned , const hsize_t *, void *); void cancellation_cleanup(void *); hid_t cancel_file; @@ -149,8 +149,8 @@ void *tts_cancel_thread(void UNUSED *arg) return NULL; } -herr_t tts_cancel_callback(void *elem, hid_t UNUSED type_id, hsize_t UNUSED ndim, - hssize_t UNUSED *point, void *operator_data) +herr_t tts_cancel_callback(void *elem, hid_t UNUSED type_id, unsigned UNUSED ndim, + const hsize_t UNUSED *point, void *operator_data) { int value = *(int *)elem; hid_t dataset = *(hid_t *)operator_data; diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c index 22796a8..8a4b38c 100644 --- a/test/ttsafe_dcreate.c +++ b/test/ttsafe_dcreate.c @@ -137,7 +137,7 @@ void tts_dcreate(void) assert(ret>=0); if (datavalue != i) { - TestErrPrintf(stderr, "Wrong value read %d for dataset name %s - test failed\n", + TestErrPrintf("Wrong value read %d for dataset name %s - test failed\n", datavalue, dsetname[i]); H5Dclose(dataset); H5Fclose(file); diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index 62d7277..4e6c516 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -166,7 +166,7 @@ void *tts_error_thread(void UNUSED *arg) /* define datatype for the data using native little endian integers */ datatype = H5Tcopy(H5T_NATIVE_INT); H5Tset_order(datatype, H5T_ORDER_LE); - + /* create a new dataset within the file */ dataset = H5Dcreate(error_file, DATASETNAME, datatype, dataspace, H5P_DEFAULT); if (dataset >= 0) { /* not an error */ diff --git a/test/ttst.c b/test/ttst.c index 10eb017..5663050 100644 --- a/test/ttst.c +++ b/test/ttst.c @@ -60,7 +60,7 @@ char **sort_uniq_words; static int tst_strcmp(const void *_s1, const void *_s2) { - return(HDstrcmp(*(const char **)_s1,*(const char **)_s2)); + return(HDstrcmp(*(const char * const *)_s1,*(const char * const *)_s2)); } /**************************************************************** @@ -73,7 +73,7 @@ static void test_tst_init(void) { time_t curr_time; /* Current time, for seeding random number generator */ - char *tmp_word=NULL;/* Temporary pointer to word in word set */ + char *tmp_word;/* Temporary pointer to word in word set */ size_t u,v,w; /* Local index variables */ /* Compute the number of words in the test set */ @@ -122,7 +122,7 @@ test_tst_init(void) /* Create randomized set of unique words */ for(u=0; u<num_uniq_words; u++) rand_uniq_words[u]=uniq_words[u]; - curr_time=time(NULL); + curr_time=HDtime(NULL); HDsrandom((unsigned long)curr_time); for(u=0; u<num_uniq_words; u++) { v=u+(HDrandom()%(num_uniq_words-u)); diff --git a/test/tvltypes.c b/test/tvltypes.c index af56eef..f510230 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -175,18 +175,18 @@ test_vltypes_vlen_atomic(void) hvl_t wdata2[SPACE1_DIM1]; /* Information to write */ hvl_t rdata[SPACE1_DIM1]; /* Information read in */ hvl_t fill; /* Fill value */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t sid2; /* ID of bad dataspace (no extent set) */ - hid_t tid1; /* Datatype ID */ - hid_t dcpl_pid; /* Dataset creation property list ID */ - hid_t xfer_pid; /* Dataset transfer property list ID */ - hsize_t dims1[] = {SPACE1_DIM1}; - hsize_t size; /* Number of bytes which will be used */ - unsigned i,j; /* counting variables */ - size_t mem_used=0; /* Memory used during allocation */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t sid2; /* ID of bad dataspace (no extent set) */ + hid_t tid1; /* Datatype ID */ + hid_t dcpl_pid; /* Dataset creation property list ID */ + hid_t xfer_pid; /* Dataset transfer property list ID */ + hsize_t dims1[] = {SPACE1_DIM1}; + hsize_t size; /* Number of bytes which will be used */ + unsigned i,j; /* counting variables */ + size_t mem_used=0; /* Memory used during allocation */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Basic Atomic VL Datatype Functionality\n")); @@ -1805,8 +1805,7 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void) TestErrPrintf("%d: VL data length don't match!, wdata[%d].len=%d, rdata[%d].len=%d\n",__LINE__,(int)i,(int)wdata[i].len,(int)i,(int)rdata[i].len); continue; } /* end if */ - for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) -{ + for(t1=wdata[i].p, t2=rdata[i].p, j=0; j<rdata[i].len; j++, t1++, t2++) { if(t1->len!=t2->len) { TestErrPrintf("%d: VL data length don't match!, i=%d, j=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)i,(int)j,(int)t1->len,(int)t2->len); continue; diff --git a/test/unlink.c b/test/unlink.c index 0fa7d4f..137bc88 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -1894,7 +1894,7 @@ error: static int test_resurrect_datatype(void) { - hid_t file=-1, type=-1, fapl=-1, loc_id=-1; + hid_t file=-1, type=-1, fapl=-1; char filename[1024]; TESTING("Resurrecting datatype after deletion"); diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index 1dc3c71..8b9554e 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -23,18 +23,18 @@ */ /* some commonly used routines for collective chunk IO tests*/ -static void ccslab_set(int mpi_rank,int mpi_size,hssize_t start[],hsize_t count[], +static void ccslab_set(int mpi_rank,int mpi_size,hsize_t start[],hsize_t count[], hsize_t stride[],hsize_t block[],int mode); -static void ccdataset_fill(hssize_t start[],hsize_t count[], +static void ccdataset_fill(hsize_t start[],hsize_t count[], hsize_t stride[],hsize_t block[],DATATYPE*dataset); -static void ccdataset_print(hssize_t start[],hsize_t block[],DATATYPE*dataset); +static void ccdataset_print(hsize_t start[],hsize_t block[],DATATYPE*dataset); -static int ccdataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], +static int ccdataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original); -static void coll_chunktest(char* filename,int chunk_factor,int select_factor); +static void coll_chunktest(const char* filename,int chunk_factor,int select_factor); /*------------------------------------------------------------------------- * Function: coll_chunk1 @@ -56,8 +56,8 @@ void coll_chunk1(void) { - char *filename; - filename = (char *) GetTestParameters(); + const char *filename; + filename = GetTestParameters(); coll_chunktest(filename,1,BYROW_CONT); } @@ -66,8 +66,8 @@ void coll_chunk2(void) { - char *filename; - filename = (char *) GetTestParameters(); + const char *filename; + filename = GetTestParameters(); coll_chunktest(filename,1,BYROW_DISCONT); } @@ -77,11 +77,11 @@ void coll_chunk3(void) { - char *filename; + const char *filename; int mpi_size; MPI_Comm comm = MPI_COMM_WORLD; MPI_Comm_size(comm,&mpi_size); - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); coll_chunktest(filename,mpi_size,BYROW_CONT); } @@ -90,17 +90,17 @@ void coll_chunk4(void) { - char *filename; + const char *filename; int mpi_size; MPI_Comm comm = MPI_COMM_WORLD; MPI_Comm_size(comm,&mpi_size); - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); coll_chunktest(filename,mpi_size*2,BYROW_DISCONT); } static void -coll_chunktest(char* filename,int chunk_factor,int select_factor) { +coll_chunktest(const char* filename,int chunk_factor,int select_factor) { hid_t file,dataset, file_dataspace; hid_t acc_plist,xfer_plist,crp_plist; @@ -108,7 +108,7 @@ coll_chunktest(char* filename,int chunk_factor,int select_factor) { int* data_array1 = NULL; int* data_origin1 = NULL; herr_t status; - hssize_t start[RANK]; + hsize_t start[RANK]; hsize_t count[RANK],stride[RANK],block[RANK]; #ifdef H5_HAVE_INSTRUMENTED_LIBRARY unsigned prop_value; @@ -330,7 +330,7 @@ coll_chunktest(char* filename,int chunk_factor,int select_factor) { static void -ccslab_set(int mpi_rank, int mpi_size, hssize_t start[], hsize_t count[], +ccslab_set(int mpi_rank, int mpi_size, hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], int mode) { switch (mode){ @@ -374,8 +374,8 @@ if (VERBOSE_MED) printf("slab_set wholeset\n"); break; } if (VERBOSE_MED){ - printf("start[]=(%ld,%ld), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total datapoints=%lu\n", - (long)start[0], (long)start[1], (unsigned long)count[0], (unsigned long)count[1], + printf("start[]=(%lu,%lu), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1], (unsigned long)(block[0]*block[1]*count[0]*count[1])); } @@ -387,7 +387,7 @@ if (VERBOSE_MED){ * Assume dimension rank is 2 and data is stored contiguous. */ static void -ccdataset_fill(hssize_t start[], hsize_t stride[], hsize_t count[], hsize_t block[], DATATYPE * dataset) +ccdataset_fill(hsize_t start[], hsize_t stride[], hsize_t count[], hsize_t block[], DATATYPE * dataset) { DATATYPE *dataptr = dataset; DATATYPE *tmptr; @@ -418,7 +418,7 @@ ccdataset_fill(hssize_t start[], hsize_t stride[], hsize_t count[], hsize_t bloc * Print the first block of the content of the dataset. */ static void -ccdataset_print(hssize_t start[], hsize_t block[], DATATYPE * dataset) +ccdataset_print(hsize_t start[], hsize_t block[], DATATYPE * dataset) { DATATYPE *dataptr = dataset; hsize_t i, j; @@ -427,13 +427,13 @@ ccdataset_print(hssize_t start[], hsize_t block[], DATATYPE * dataset) printf("Print only the first block of the dataset\n"); printf("%-8s", "Cols:"); for (j=0; j < block[1]; j++){ - printf("%3ld ", (long)(start[1]+j)); + printf("%3lu ", (unsigned long)(start[1]+j)); } printf("\n"); /* print the slab data */ for (i=0; i < block[0]; i++){ - printf("Row %2ld: ", (long)(i+start[0])); + printf("Row %2lu: ", (unsigned long)(i+start[0])); for (j=0; j < block[1]; j++){ printf("%03d ", *dataptr++); } @@ -446,7 +446,7 @@ ccdataset_print(hssize_t start[], hsize_t block[], DATATYPE * dataset) * Print the content of the dataset. */ static int -ccdataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original) +ccdataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original) { hsize_t i, j,k1,k2; int vrfyerrs; @@ -455,8 +455,8 @@ ccdataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t bloc /* print it if VERBOSE_MED */ if (VERBOSE_MED) { printf("dataset_vrfy dumping:::\n"); - printf("start(%ld, %ld), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n", - (long)start[0], (long)start[1], (unsigned long)count[0], (unsigned long)count[1], + printf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1]); printf("original values:\n"); ccdataset_print(start, block, original); @@ -478,8 +478,8 @@ ccdataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t bloc if (*dataptr != *oriptr){ if (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED){ - printf("Dataset Verify failed at [%ld][%ld]: expect %d, got %d\n", - (long)i, (long)j, + printf("Dataset Verify failed at [%lu][%lu]: expect %d, got %d\n", + (unsigned long)i, (unsigned long)j, *(original), *(dataset)); } } diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 77cfdc4..dff3ec3 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -43,7 +43,7 @@ * ZCOL same as BYCOL except process 0 gets 0 columns */ static void -slab_set(int mpi_rank, int mpi_size, hssize_t start[], hsize_t count[], +slab_set(int mpi_rank, int mpi_size, hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], int mode) { switch (mode){ @@ -110,8 +110,8 @@ if (VERBOSE_MED) printf("slab_set wholeset\n"); break; } if (VERBOSE_MED){ - printf("start[]=(%ld,%ld), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total datapoints=%lu\n", - (long)start[0], (long)start[1], (unsigned long)count[0], (unsigned long)count[1], + printf("start[]=(%lu,%lu), count[]=(%lu,%lu), stride[]=(%lu,%lu), block[]=(%lu,%lu), total datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1], (unsigned long)(block[0]*block[1]*count[0]*count[1])); } @@ -123,7 +123,7 @@ if (VERBOSE_MED){ * Assume dimension rank is 2 and data is stored contiguous. */ static void -dataset_fill(hssize_t start[], hsize_t block[], DATATYPE * dataset) +dataset_fill(hsize_t start[], hsize_t block[], DATATYPE * dataset) { DATATYPE *dataptr = dataset; hsize_t i, j; @@ -142,7 +142,7 @@ dataset_fill(hssize_t start[], hsize_t block[], DATATYPE * dataset) * Print the content of the dataset. */ static void -dataset_print(hssize_t start[], hsize_t block[], DATATYPE * dataset) +dataset_print(hsize_t start[], hsize_t block[], DATATYPE * dataset) { DATATYPE *dataptr = dataset; hsize_t i, j; @@ -150,13 +150,13 @@ dataset_print(hssize_t start[], hsize_t block[], DATATYPE * dataset) /* print the column heading */ printf("%-8s", "Cols:"); for (j=0; j < block[1]; j++){ - printf("%3ld ", (long)(start[1]+j)); + printf("%3lu ", (unsigned long)(start[1]+j)); } printf("\n"); /* print the slab data */ for (i=0; i < block[0]; i++){ - printf("Row %2ld: ", (long)(i+start[0])); + printf("Row %2lu: ", (unsigned long)(i+start[0])); for (j=0; j < block[1]; j++){ printf("%03d ", *dataptr++); } @@ -168,7 +168,8 @@ dataset_print(hssize_t start[], hsize_t block[], DATATYPE * dataset) /* * Print the content of the dataset. */ -int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original) +int +dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original) { hsize_t i, j; int vrfyerrs; @@ -176,8 +177,8 @@ int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t bl /* print it if VERBOSE_MED */ if (VERBOSE_MED) { printf("dataset_vrfy dumping:::\n"); - printf("start(%ld, %ld), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n", - (long)start[0], (long)start[1], (unsigned long)count[0], (unsigned long)count[1], + printf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1]); printf("original values:\n"); dataset_print(start, block, original); @@ -190,9 +191,9 @@ int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t bl for (j=0; j < block[1]; j++){ if (*dataset != *original){ if (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED){ - printf("Dataset Verify failed at [%ld][%ld](row %ld, col %ld): expect %d, got %d\n", - (long)i, (long)j, - (long)(i+start[0]), (long)(j+start[1]), + printf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %d, got %d\n", + (unsigned long)i, (unsigned long)j, + (unsigned long)(i+start[0]), (unsigned long)(j+start[1]), *(original), *(dataset)); } dataset++; @@ -234,7 +235,7 @@ dataset_writeInd(void) DATATYPE *data_array1 = NULL; /* data buffer */ const char *filename; - hssize_t start[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ hsize_t block[RANK]; /* for hyperslab setting */ @@ -380,7 +381,7 @@ dataset_readInd(void) DATATYPE *data_origin1 = NULL; /* expected data buffer */ const char *filename; - hssize_t start[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ hsize_t block[RANK]; /* for hyperslab setting */ @@ -506,7 +507,7 @@ dataset_writeAll(void) DATATYPE *data_array1 = NULL; /* data buffer */ const char *filename; - hssize_t start[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ hsize_t block[RANK]; /* for hyperslab setting */ @@ -865,7 +866,7 @@ dataset_readAll(void) DATATYPE *data_origin1 = NULL; /* expected data buffer */ const char *filename; - hssize_t start[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ hsize_t block[RANK]; /* for hyperslab setting */ @@ -1092,7 +1093,7 @@ extend_writeInd(void) hsize_t chunk_dims[RANK]; /* chunk sizes */ hid_t dataset_pl; /* dataset create prop. list */ - hssize_t start[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK]; /* for hyperslab setting */ hsize_t stride[RANK]; /* for hyperslab setting */ hsize_t block[RANK]; /* for hyperslab setting */ @@ -1434,7 +1435,7 @@ extend_writeInd2(void) printf("%s%d", i?", ":"", written[i]); printf("\n"); } - ret = H5Sselect_hyperslab(fs, H5S_SELECT_SET, (hssize_t *)&orig_size, NULL, &one, &orig_size); + ret = H5Sselect_hyperslab(fs, H5S_SELECT_SET, &orig_size, NULL, &one, &orig_size); VRFY((ret >= 0), "H5Sselect_hyperslab succeeded"); ret = H5Dwrite(dataset, H5T_NATIVE_INT, ms, fs, H5P_DEFAULT, written); VRFY((ret >= 0), "H5Dwrite succeeded"); @@ -1483,7 +1484,7 @@ extend_readInd(void) DATATYPE *data_origin1 = NULL; /* expected data buffer */ const char *filename; - hssize_t start[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ hsize_t block[RANK]; /* for hyperslab setting */ @@ -1666,7 +1667,7 @@ extend_writeAll(void) hsize_t chunk_dims[RANK]; /* chunk sizes */ hid_t dataset_pl; /* dataset create prop. list */ - hssize_t start[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK]; /* for hyperslab setting */ hsize_t stride[RANK]; /* for hyperslab setting */ hsize_t block[RANK]; /* for hyperslab setting */ @@ -1905,7 +1906,7 @@ extend_readAll(void) DATATYPE *data_array2 = NULL; /* data buffer */ DATATYPE *data_origin1 = NULL; /* expected data buffer */ - hssize_t start[RANK]; /* for hyperslab setting */ + hsize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ hsize_t block[RANK]; /* for hyperslab setting */ diff --git a/testpar/t_file.c b/testpar/t_file.c index 6fcde32..7f703a5 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -41,9 +41,9 @@ test_split_comm_access(void) hid_t acc_tpl; /* File access properties */ hbool_t use_gpfs = FALSE; /* Use GPFS hints */ herr_t ret; /* generic return value */ - char *filename; + const char *filename; - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); if (VERBOSE_MED) printf("Split Communicator access test on file %s\n", filename); @@ -82,9 +82,9 @@ test_split_comm_access(void) ret=H5Fclose(fid); VRFY((ret >= 0), ""); - /* detele the test file */ + /* delete the test file */ if (sub_mpi_rank == 0){ - mrc = MPI_File_delete(filename, info); + mrc = MPI_File_delete((char *)filename, info); /*VRFY((mrc==MPI_SUCCESS), ""); */ } } diff --git a/testpar/t_fphdf5.c b/testpar/t_fphdf5.c index 403fa70..5dbc41f 100644 --- a/testpar/t_fphdf5.c +++ b/testpar/t_fphdf5.c @@ -39,17 +39,17 @@ static hid_t create_file(const char *filename); static hid_t create_group(hid_t loc, const char *grp_name, size_t size_hint); static hid_t create_dset(hid_t loc, const char *dset_name); static void access_dset(hid_t loc, const char *dset_name); -static void slab_set(hssize_t start[], hsize_t count[], +static void slab_set(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[]); -static void fill_data(hssize_t start[], hsize_t count[]); +static void fill_data(void); static void write_data(hid_t loc, const char *dset_name, - hssize_t start[], hsize_t count[], + hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[]); static void verify_complete_dataset(hid_t loc, const char *dset_name); static void verify_partial_dataset(hid_t loc, const char *dset_name, - hssize_t start[], hsize_t count[], + hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], - int * buf, int buf_len); + int * buf, hsize_t buf_len); static void test_group_creation(hid_t loc); static void test_dataset_creation(hid_t loc); static void test_dataset_access(hid_t loc); @@ -105,7 +105,7 @@ static int *local_orig_data = NULL; /* data that's written to datasets */ static hsize_t dims[RANK] = {0, 0}; /* Hyperslab settings */ -static hssize_t start[RANK]; +static hsize_t start[RANK]; static hsize_t count[RANK]; static hsize_t stride[RANK]; static hsize_t block[RANK]; @@ -137,7 +137,7 @@ static void check_globals(char * location_name) { static hsize_t local_dims[RANK] = {0,0}; - static hssize_t local_start[RANK] = {0,0}; + static hsize_t local_start[RANK] = {0,0}; static hsize_t local_count[RANK] = {0,0}; static hsize_t local_stride[RANK] = {0,0}; static hsize_t local_block[RANK] = {0,0}; @@ -241,12 +241,12 @@ create_file(const char *filename) *------------------------------------------------------------------------- */ static hid_t -create_group(hid_t loc, const char *grp_name, size_t size_hint) +create_group(hid_t loc, const char *group_name, size_t size_hint) { hid_t group; - VRFY(((group = H5Gcreate(loc, grp_name, size_hint)) >= 0), "H5Gcreate"); - printf("%d: Created group \"%s\"\n", mpi_rank, grp_name); + VRFY(((group = H5Gcreate(loc, group_name, size_hint)) >= 0), "H5Gcreate"); + printf("%d: Created group \"%s\"\n", mpi_rank, group_name); return group; } @@ -265,7 +265,7 @@ create_group(hid_t loc, const char *grp_name, size_t size_hint) *------------------------------------------------------------------------- */ static hid_t -create_dset(hid_t loc, const char *dset_name) +create_dset(hid_t loc, const char *dataset_name) { hid_t dset, sid; @@ -274,9 +274,9 @@ create_dset(hid_t loc, const char *dset_name) VRFY(((sid = H5Screate_simple(RANK, dims, NULL)) >= 0), "H5Screate_simple"); printf("%d: Created simple dataspace\n", mpi_rank); - dset = H5Dcreate(loc, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT); + dset = H5Dcreate(loc, dataset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT); VRFY((dset >= 0), "H5Dcreate"); - printf("%d: Created dataset \"%s\"\n", mpi_rank, dset_name); + printf("%d: Created dataset \"%s\"\n", mpi_rank, dataset_name); VRFY((H5Sclose(sid) >= 0), "H5Sclose"); return dset; @@ -292,11 +292,11 @@ create_dset(hid_t loc, const char *dset_name) *------------------------------------------------------------------------- */ static void -access_dset(hid_t loc, const char *dset_name) +access_dset(hid_t loc, const char *dataset_name) { hid_t dataset; - VRFY(((dataset = H5Dopen(loc, dset_name)) >= 0), "H5Dopen"); + VRFY(((dataset = H5Dopen(loc, dataset_name)) >= 0), "H5Dopen"); VRFY((H5Dclose(dataset) >= 0), "H5Dclose"); } @@ -314,24 +314,24 @@ access_dset(hid_t loc, const char *dset_name) *------------------------------------------------------------------------- */ static void -slab_set(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[]) +slab_set(hsize_t my_start[], hsize_t my_count[], hsize_t my_stride[], hsize_t my_block[]) { /* initialize dims according to the number of processes: */ dims[0] = DIM0 * mpi_size; dims[1] = DIM1; /* Each process takes a slab of rows. */ - block[0] = DIM0; - block[1] = DIM1; + my_block[0] = DIM0; + my_block[1] = DIM1; - stride[0] = block[0]; - stride[1] = block[1]; + my_stride[0] = my_block[0]; + my_stride[1] = my_block[1]; - count[0] = 1; - count[1] = 1; + my_count[0] = 1; + my_count[1] = 1; - start[0] = mpi_rank * block[0]; - start[1] = 0; + my_start[0] = mpi_rank * my_block[0]; + my_start[1] = 0; } /*------------------------------------------------------------------------- @@ -356,7 +356,7 @@ slab_set(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[]) *------------------------------------------------------------------------- */ static void -fill_data(hssize_t start[], hsize_t count[]) +fill_data(void) { int col; int row; @@ -406,36 +406,36 @@ fill_data(hssize_t start[], hsize_t count[]) *------------------------------------------------------------------------- */ static void -write_data(hid_t loc, const char *dset_name, hssize_t start[], hsize_t count[], - hsize_t stride[], hsize_t block[]) +write_data(hid_t loc, const char *dataset_name, hsize_t my_start[], hsize_t my_count[], + hsize_t my_stride[], hsize_t my_block[]) { herr_t hrc; hid_t file_dataspace, mem_dataspace; hid_t dataset; /* See if dataset is there */ - VRFY(((dataset = H5Dopen(loc, dset_name)) >= 0), "H5Dopen"); + VRFY(((dataset = H5Dopen(loc, dataset_name)) >= 0), "H5Dopen"); file_dataspace = H5Dget_space(dataset); VRFY((file_dataspace >= 0), "H5Dget_space"); hrc = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, - start, stride, count, block); + my_start, my_stride, my_count, my_block); #if 0 /* some debugging code we may want to keep for a time. JRM - 4/13/04 */ if ( hrc < 0 ) { /* dump the parameters */ printf("%d: start=[%d,%d], count=[%d, %d], stride=[%d,%d], block=[%d,%d]\n", mpi_rank, - (int)(start[0]), (int)(start[1]), - (int)(count[0]), (int)(count[1]), - (int)(stride[0]), (int)(stride[1]), - (int)(block[0]), (int)(block[1])); + (int)(my_start[0]), (int)(my_start[1]), + (int)(my_count[0]), (int)(my_count[1]), + (int)(my_stride[0]), (int)(my_stride[1]), + (int)(my_block[0]), (int)(my_block[1])); } #endif VRFY((hrc >= 0), "H5Sselect_hyperslab in write_data"); /* create a memory dataspace independently */ - mem_dataspace = H5Screate_simple(RANK, block, NULL); + mem_dataspace = H5Screate_simple(RANK, my_block, NULL); VRFY((mem_dataspace >= 0), "H5Screate_simple"); hrc = H5Dwrite(dataset, H5T_NATIVE_INT, mem_dataspace, @@ -460,18 +460,18 @@ write_data(hid_t loc, const char *dset_name, hssize_t start[], hsize_t count[], *------------------------------------------------------------------------- */ static void -verify_complete_dataset(hid_t loc, const char *dset_name) +verify_complete_dataset(hid_t loc, const char *dataset_name) { hid_t dataset; int *data_array = NULL; size_t data_array_len = 0; - int col; - int row; + unsigned col; + unsigned row; int offset = 0; int vrfyerrs = 0; /* Open the dataset */ - VRFY(((dataset = H5Dopen(loc, dset_name)) >= 0), "H5Dopen"); + VRFY(((dataset = H5Dopen(loc, dataset_name)) >= 0), "H5Dopen"); /* allocate a buffer to receive the contents of the file dataset */ VRFY((dims[0] != 0), "dims array initialized."); @@ -490,7 +490,7 @@ verify_complete_dataset(hid_t loc, const char *dset_name) if ( data_array[offset] != orig_data[offset] ) { if ( vrfyerrs++ < MAX_ERR_REPORT ) { fprintf(stdout, "%d: Dataset Verify failed at " - "row %d, col %d: expect %d, got %d\n", mpi_rank, + "row %u, col %u: expect %d, got %d\n", mpi_rank, row, col, orig_data[offset], data_array[offset]); } } @@ -527,30 +527,30 @@ verify_complete_dataset(hid_t loc, const char *dset_name) *------------------------------------------------------------------------- */ static void -verify_partial_dataset(hid_t loc, const char *dset_name, - hssize_t start[], hsize_t count[], - hsize_t stride[], hsize_t block[], - int * buf, int buf_len) +verify_partial_dataset(hid_t loc, const char *dataset_name, + hsize_t my_start[], hsize_t my_count[], + hsize_t my_stride[], hsize_t my_block[], + int * buf, hsize_t buf_len) { hid_t dataset, file_dataspace, mem_dataspace; int *data_array; - int col; - int row; - int offset = 0; + unsigned col; + unsigned row; + hsize_t offset = 0; int vrfyerrs = 0; /* Open the dataset */ - VRFY(((dataset = H5Dopen(loc, dset_name)) >= 0), "H5Dopen"); + VRFY(((dataset = H5Dopen(loc, dataset_name)) >= 0), "H5Dopen"); /* Create a file dataspace */ file_dataspace = H5Dget_space(dataset); VRFY((file_dataspace >= 0), "H5Dget_space"); VRFY((H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, - start, stride, count, block) >= 0), + my_start, my_stride, my_count, my_block) >= 0), "H5Sselect_hyperslab in verify_partial_dataset"); /* Create a memory dataspace */ - mem_dataspace = H5Screate_simple(RANK, block, NULL); + mem_dataspace = H5Screate_simple(RANK, my_block, NULL); VRFY((mem_dataspace >= 0), "H5Screate_simple"); VRFY(((block[0] * block[1]) == buf_len), "buf_len matches."); @@ -568,7 +568,7 @@ verify_partial_dataset(hid_t loc, const char *dset_name, if ( data_array[offset] != buf[offset] ) { if ( vrfyerrs++ < MAX_ERR_REPORT ) { fprintf(stdout, "%d: Dataset Verify failed at " - "row %d, col %d: expected %d, got %d\n", mpi_rank, + "row %u, col %u: expected %d, got %d\n", mpi_rank, row, col, buf[offset], data_array[offset]); } } @@ -837,7 +837,7 @@ usage(const char *prog) int main(int argc, char *argv[]) { - hid_t fid, fapl2; + hid_t fid; herr_t hrc; int nargs; @@ -910,7 +910,7 @@ main(int argc, char *argv[]) sizeof(int)); VRFY((orig_data != NULL), "local_orig_data malloc succeeded"); - fill_data(start, count); + fill_data(); for (i = 0; i < sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; ++i) { if (h5_fixname(FILENAME[i], fapl, filenames[i], sizeof(filenames[i])) == NULL) { @@ -941,7 +941,7 @@ main(int argc, char *argv[]) * Reverify that the data is still "correct" *===------------------------------------------------------------=== */ - for (i = 0; i < mpi_size; ++i) + for (i = 0; i < (unsigned)mpi_size; ++i) if (i != SAP_RANK) { hid_t group; @@ -1009,7 +1009,6 @@ main(int argc, char *argv[]) fprintf(stderr, "===================================\n"); } -done: H5close(); MPI_Finalize(); return nerrors; diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index b23a26e..06aedf3 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -30,7 +30,7 @@ void group_dataset_read(hid_t fid, int mpi_rank, int m); void write_attribute(hid_t, int, int); int read_attribute(hid_t, int, int); int check_value(DATATYPE *, DATATYPE *, int); -void get_slab(hssize_t[], hsize_t[], hsize_t[], hsize_t[], int); +void get_slab(hsize_t[], hsize_t[], hsize_t[], hsize_t[], int); /* @@ -87,18 +87,18 @@ void multiple_dset_write(void) hid_t iof, plist, dataset, memspace, filespace; hid_t dcpl; /* Dataset creation property list */ hbool_t use_gpfs = FALSE; /* Use GPFS hints */ - hssize_t chunk_origin [DIM]; + hsize_t chunk_origin [DIM]; hsize_t chunk_dims [DIM], file_dims [DIM]; hsize_t count[DIM]={1,1}; double * outme = NULL; double fill=1.0; /* Fill value */ char dname [100]; herr_t ret; - H5Ptest_param_t *pt; + const H5Ptest_param_t *pt; char *filename; int ndatasets; - pt = (H5Ptest_param_t *) GetTestParameters(); + pt = GetTestParameters(); filename = pt->name; ndatasets = pt->count; @@ -180,7 +180,7 @@ void compact_dataset(void) double * inme; char dname[]="dataset"; herr_t ret; - char *filename; + const char *filename; size = get_size(); @@ -198,7 +198,7 @@ void compact_dataset(void) inme = HDmalloc((size_t)(size * size * sizeof(double))); VRFY((outme != NULL), "HDmalloc succeeded for inme"); - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); VRFY((mpi_size <= size), "mpi_size <= size"); plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type, use_gpfs); @@ -293,12 +293,12 @@ void null_dataset(void) char dname[]="dataset"; char attr_name[]="attribute"; herr_t ret; - char *filename; + const char *filename; MPI_Comm_rank (MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size (MPI_COMM_WORLD, &mpi_size); - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type, use_gpfs); @@ -398,7 +398,7 @@ void big_dataset(void) char dname[]="dataset"; /* Name of dataset */ MPI_Offset file_size; /* Size of file on disk */ herr_t ret; /* Generic return value */ - char *filename; + const char *filename; MPI_Comm_rank (MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size (MPI_COMM_WORLD, &mpi_size); @@ -406,7 +406,7 @@ void big_dataset(void) /* Verify MPI_Offset can handle larger than 2GB sizes */ VRFY((sizeof(MPI_Offset)>4), "sizeof(MPI_Offset)>4"); - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); fapl = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type, use_gpfs); VRFY((fapl >= 0), "create_faccess_plist succeeded"); @@ -530,19 +530,19 @@ void dataset_fillvalue(void) filespace; /* Dataset's dataspace ID */ char dname[]="dataset"; /* Name of dataset */ hsize_t dset_dims[4] = {0, 6, 7, 8}; - hssize_t req_start[4] = {0, 0, 0, 0}; + hsize_t req_start[4] = {0, 0, 0, 0}; hsize_t req_count[4] = {1, 6, 7, 8}; hsize_t dset_size; /* Dataset size */ int *rdata, *wdata; /* Buffers for data to read and write */ int *twdata, *trdata; /* Temporary pointer into buffer */ int acc, i, j, k, l; /* Local index variables */ herr_t ret; /* Generic return value */ - char *filename; + const char *filename; MPI_Comm_rank (MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size (MPI_COMM_WORLD, &mpi_size); - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); /* Set the dataset dimension to be one row more than number of processes */ /* and calculate the actual dataset size. */ @@ -710,15 +710,15 @@ void collective_group_write(void) char gname[64], dname[32]; hid_t fid, gid, did, plist, dcpl, memspace, filespace; DATATYPE * outme = NULL; - hssize_t chunk_origin[DIM]; + hsize_t chunk_origin[DIM]; hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM]; hsize_t chunk_size[2]; /* Chunk dimensions - computed shortly */ herr_t ret1, ret2; - H5Ptest_param_t *pt; + const H5Ptest_param_t *pt; char *filename; int ngroups; - pt = (H5Ptest_param_t *) GetTestParameters(); + pt = GetTestParameters(); filename = pt->name; ngroups = pt->count; @@ -803,11 +803,11 @@ void independent_group_read(void) int mpi_rank, m; hid_t plist, fid; hbool_t use_gpfs = FALSE; - H5Ptest_param_t *pt; + const H5Ptest_param_t *pt; char *filename; int ngroups; - pt = (H5Ptest_param_t *) GetTestParameters(); + pt = GetTestParameters(); filename = pt->name; ngroups = pt->count; @@ -927,14 +927,14 @@ void multiple_group_write(void) hbool_t use_gpfs = FALSE; char gname[64]; hid_t fid, gid, plist, memspace, filespace; - hssize_t chunk_origin[DIM]; + hsize_t chunk_origin[DIM]; hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM]; herr_t ret; - H5Ptest_param_t *pt; + const H5Ptest_param_t *pt; char *filename; int ngroups; - pt = (H5Ptest_param_t *) GetTestParameters(); + pt = GetTestParameters(); filename = pt->name; ngroups = pt->count; @@ -1098,13 +1098,13 @@ void multiple_group_read(void) hbool_t use_gpfs = FALSE; char gname[64]; hid_t plist, fid, gid, memspace, filespace; - hssize_t chunk_origin[DIM]; + hsize_t chunk_origin[DIM]; hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM]; - H5Ptest_param_t *pt; + const H5Ptest_param_t *pt; char *filename; int ngroups; - pt = (H5Ptest_param_t *) GetTestParameters(); + pt = GetTestParameters(); filename = pt->name; ngroups = pt->count; @@ -1335,7 +1335,7 @@ int check_value(DATATYPE *indata, DATATYPE *outdata, int size) { int mpi_rank, mpi_size, err_num=0; hsize_t i, j; - hssize_t chunk_origin[DIM]; + hsize_t chunk_origin[DIM]; hsize_t chunk_dims[DIM], count[DIM]; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -1349,7 +1349,7 @@ int check_value(DATATYPE *indata, DATATYPE *outdata, int size) for(j=chunk_origin[1]; j<(chunk_origin[1]+chunk_dims[1]); j++) { if( *indata != *outdata ) if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED) - printf("Dataset Verify failed at [%ld][%ld](row %ld, col%ld): expect %d, got %d\n", (long)i, (long)j, (long)i, (long)j, *outdata, *indata); + printf("Dataset Verify failed at [%lu][%lu](row %lu, col%lu): expect %d, got %d\n", (unsigned long)i, (unsigned long)j, (unsigned long)i, (unsigned long)j, *outdata, *indata); } if(err_num > MAX_ERR_REPORT && !VERBOSE_MED) printf("[more errors ...]\n"); @@ -1367,7 +1367,7 @@ int check_value(DATATYPE *indata, DATATYPE *outdata, int size) * JRM - 8/11/04 */ -void get_slab(hssize_t chunk_origin[], +void get_slab(hsize_t chunk_origin[], hsize_t chunk_dims[], hsize_t count[], hsize_t file_dims[], @@ -1429,13 +1429,12 @@ void io_mode_confusion(void) /* identifiers */ hsize_t dimsf[1]; /* dataset dimensions */ int data[N] = {1}; /* pointer to data buffer to write */ - hssize_t select[N] = {0L,1L,2L,3L}; - hssize_t start[1]; - hsize_t stride[1]; - hsize_t count[1]; - hsize_t block[1]; + hsize_t coord[N] = {0L,1L,2L,3L}; + hsize_t start[1]; + hsize_t stride[1]; + hsize_t count[1]; + hsize_t block[1]; hid_t plist_id; /* property list identifier */ - int i; herr_t status; @@ -1450,13 +1449,13 @@ void io_mode_confusion(void) * test bed related variables */ - char * fcn_name = "io_mode_confusion"; + const char * fcn_name = "io_mode_confusion"; const hbool_t verbose = FALSE; - H5Ptest_param_t * pt; + const H5Ptest_param_t * pt; char * filename; - pt = (H5Ptest_param_t *) GetTestParameters(); + pt = GetTestParameters(); filename = pt->name; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -1592,7 +1591,7 @@ void io_mode_confusion(void) mpi_rank, fcn_name); status = H5Sselect_elements(filespace, H5S_SELECT_SET, N, - (const hssize_t **)&select); + (const hsize_t **)&coord); VRFY(( status >= 0 ), "H5Sselect_elements() failed"); diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 71494d4..7b7a96b 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -37,10 +37,11 @@ int nerrors = 0; hid_t fapl; /* file access property list */ /* protocols */ +static int errors_sum(int nerrs); #define MPIO_TEST_WRITE_SIZE 1024*1024 /* 1 MB */ -int +static int test_mpio_overlap_writes(char *filename) { int mpi_size, mpi_rank; @@ -186,7 +187,7 @@ test_mpio_overlap_writes(char *filename) * Then reads the file back in by reverse order, that is process 0 * reads the data of process n-1 and vice versa. */ -int +static int test_mpio_gb_file(char *filename) { int mpi_size, mpi_rank; @@ -407,7 +408,8 @@ finish: #define USEFSYNC 2 /* request file_sync */ -int test_mpio_1wMr(char *filename, int special_request) +static int +test_mpio_1wMr(char *filename, int special_request) { char hostname[128]; int mpi_size, mpi_rank; @@ -593,7 +595,7 @@ if (special_request & USEFSYNC){ /* * parse the command line options */ -int +static int parse_options(int argc, char **argv) { while (--argc){ @@ -655,7 +657,7 @@ parse_options(int argc, char **argv) /* * Show command usage */ -void +static void usage(void) { printf("Usage: t_mpi [-v<verbosity>] [-f <prefix>]\n"); @@ -667,7 +669,8 @@ usage(void) /* * return the sum of all errors. */ -int errors_sum(nerrs) +static int +errors_sum(int nerrs) { int temp; MPI_Allreduce(&nerrs, &temp, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD); diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index 28d95ee..26f25bf 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -203,7 +203,7 @@ coll_irregular_complex_chunk_read(void) void coll_write_test(int chunk_factor) { - char *filename; + const char *filename; hid_t acc_plist,xfer_plist; hid_t file, datasetc,dataseti; /* File and dataset identifiers */ hid_t mspaceid1, mspaceid, fspaceid,fspaceid1; /* Dataspace identifiers */ @@ -219,7 +219,7 @@ void coll_write_test(int chunk_factor) read selection from the dataset on the disk */ - hssize_t start[2]; /* Start of hyperslab */ + hsize_t start[2]; /* Start of hyperslab */ hsize_t stride[2]; /* Stride of hyperslab */ hsize_t count[2]; /* Block count */ hsize_t block[2]; /* Block sizes */ @@ -245,7 +245,7 @@ void coll_write_test(int chunk_factor) /* Obtain file name */ - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); /* * Buffers' initialization. @@ -564,7 +564,7 @@ void coll_write_test(int chunk_factor) void coll_read_test(int chunk_factor) { - char *filename; + const char *filename; hid_t acc_plist,xfer_plist; hid_t file, dataseti; /* File and dataset identifiers */ hid_t mspaceid, fspaceid1; /* Dataspace identifiers */ @@ -575,7 +575,7 @@ void coll_read_test(int chunk_factor) read selection from the dataset on the disk */ - hssize_t start[2]; /* Start of hyperslab */ + hsize_t start[2]; /* Start of hyperslab */ hsize_t stride[2]; /* Stride of hyperslab */ hsize_t count[2]; /* Block count */ hsize_t block[2]; /* Block sizes */ @@ -598,7 +598,7 @@ void coll_read_test(int chunk_factor) /* Obtain file name */ - filename = (char *) GetTestParameters(); + filename = GetTestParameters(); /* * Buffers' initialization. diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index ce1a4cf..f753919 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -434,8 +434,7 @@ int main(int argc, char **argv) "collective to independent chunk io",PARATESTFILE); } - #ifdef KYANG - +#ifdef KYANG AddTest("ccontw",coll_irregular_cont_write,NULL, "collective irregular contiguous write",PARATESTFILE); AddTest("ccontr",coll_irregular_cont_read,NULL, @@ -451,9 +450,8 @@ int main(int argc, char **argv) AddTest("ccchunkr",coll_irregular_complex_chunk_read,NULL, "collective irregular complex chunk read",PARATESTFILE); - #endif - + AddTest("null", null_dataset, NULL, "null dataset test", PARATESTFILE); @@ -463,6 +461,7 @@ int main(int argc, char **argv) AddTest("I/Omodeconf", io_mode_confusion, NULL, "I/O mode confusion test -- hangs quickly on failure", &io_mode_confusion_params); + /* Display testing information */ TestInfo(argv[0]); @@ -473,14 +472,6 @@ int main(int argc, char **argv) /* Parse command line arguments */ TestParseCmdLine(argc, argv); - /* - if (parse_options(argc, argv) != 0){ - if (MAINPROCESS) - usage(); - goto finish; - } - */ - if (facc_type == FACC_MPIPOSIX && MAINPROCESS){ printf("===================================\n" " Using MPIPOSIX driver\n" @@ -490,7 +481,6 @@ int main(int argc, char **argv) /* Perform requested testing */ PerformTests(); -finish: /* make sure all processes are finished before final report, cleanup * and exit. */ diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 96384bf..283f916 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -271,7 +271,7 @@ void compress_readAll(void); /* commonly used prototypes */ hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type, hbool_t use_gpfs); MPI_Offset h5_mpi_get_file_size(const char *filename, MPI_Comm comm, MPI_Info info); -int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], +int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original); #endif /* PHDF5TEST_H */ diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index cbe67a3..4ef6bdf 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -628,7 +628,6 @@ usage(const char *prog) fprintf(stdout, "\n"); } - /*------------------------------------------------------------------------- * Function: print_datatype * @@ -957,7 +956,6 @@ print_datatype(hid_t type,unsigned in_group) } - /*------------------------------------------------------------------------- * Function: dump_datatype * @@ -2036,7 +2034,6 @@ dump_oid(hid_t oid) printf("%s %s %d %s\n", OBJID, BEGIN, oid, END); } - /*------------------------------------------------------------------------- * Function: dump_comment * @@ -2429,7 +2426,6 @@ dump_dcpl(hid_t dcpl_id,hid_t type_id, hid_t obj_id) indent -= COL; indentation(indent + COL); printf("%s\n",END); - } /*------------------------------------------------------------------------- @@ -2453,27 +2449,15 @@ dump_fcpl(hid_t fid) hsize_t userblock; /* userblock size retrieved from FCPL */ size_t off_size; /* size of offsets in the file */ size_t len_size; /* size of lengths in the file */ -#ifdef H5_WANT_H5_V1_6_COMPAT - int super; /* superblock version # */ - int freelist; /* free list version # */ - int stab; /* symbol table entry version # */ - int shhdr; /* shared object header version # */ -#else unsigned super; /* superblock version # */ unsigned freelist; /* free list version # */ unsigned stab; /* symbol table entry version # */ unsigned shhdr; /* shared object header version # */ -#endif hid_t fdriver; /* file driver */ char dname[15]; /* buffer to store driver name */ unsigned sym_lk; /* symbol table B-tree leaf 'K' value */ -#ifdef H5_WANT_H5_V1_6_COMPAT - int sym_ik; /* symbol table B-tree initial 'K' value */ - int istore_ik; /* indexed storage B-tree initial 'K' value */ -#else - unsigned sym_ik; /* symbol table B-tree initial 'K' value */ - unsigned istore_ik; /* indexed storage B-tree initial 'K' value */ -#endif + unsigned sym_ik; /* symbol table B-tree internal 'K' value */ + unsigned istore_ik; /* indexed storage B-tree internal 'K' value */ fcpl=H5Fget_create_plist(fid); H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr); @@ -2492,19 +2476,19 @@ dump_fcpl(hid_t fid) */ printf("%s %s\n",SUPER_BLOCK, BEGIN); indentation(indent + COL); - printf("%s %d\n","SUPERBLOCK_VERSION", super); + printf("%s %u\n","SUPERBLOCK_VERSION", super); indentation(indent + COL); - printf("%s %d\n","FREELIST_VERSION", freelist); + printf("%s %u\n","FREELIST_VERSION", freelist); indentation(indent + COL); - printf("%s %d\n","SYMBOLTABLE_VERSION", stab); + printf("%s %u\n","SYMBOLTABLE_VERSION", stab); indentation(indent + COL); - printf("%s %d\n","OBJECTHEADER_VERSION", (int)shhdr); + printf("%s %u\n","OBJECTHEADER_VERSION", shhdr); indentation(indent + COL); HDfprintf(stdout,"%s %Hd\n","OFFSET_SIZE", (long_long)off_size); indentation(indent + COL); HDfprintf(stdout,"%s %Hd\n","LENGTH_SIZE", (long_long)len_size); indentation(indent + COL); - printf("%s %d\n","BTREE_RANK", sym_ik); + printf("%s %u\n","BTREE_RANK", sym_ik); indentation(indent + COL); printf("%s %d\n","BTREE_LEAF", sym_lk); @@ -2550,7 +2534,7 @@ dump_fcpl(hid_t fid) indentation(indent + COL); printf("%s %s\n","FILE_DRIVER", dname); indentation(indent + COL); - printf("%s %d\n","ISTORE_K", istore_ik); + printf("%s %u\n","ISTORE_K", istore_ik); printf("%s\n",END); /*------------------------------------------------------------------------- @@ -2609,10 +2593,6 @@ static void dump_fcontents(hid_t fid) } - - - - /*------------------------------------------------------------------------- * Function: set_output_file * @@ -2756,7 +2736,7 @@ parse_subset_params(char *dset) *brace++ = '\0'; s = calloc(1, sizeof(struct subset_t)); - s->start = (hssize_t *)parse_hsize_list(brace); + s->start = parse_hsize_list(brace); while (*brace && *brace != ';') brace++; @@ -3285,7 +3265,7 @@ parse_start: */ do { switch ((char)opt) { - case 's': free(s->start); s->start = (hssize_t *)parse_hsize_list(opt_arg); break; + case 's': free(s->start); s->start = parse_hsize_list(opt_arg); break; case 'S': free(s->stride); s->stride = parse_hsize_list(opt_arg); break; case 'c': free(s->count); s->count = parse_hsize_list(opt_arg); break; case 'k': free(s->block); s->block = parse_hsize_list(opt_arg); break; @@ -3487,11 +3467,9 @@ main(int argc, const char *argv[]) H5Giterate(fid, "/", NULL, fill_ref_path_table, NULL); H5Gclose(gid); - if (doxml) { /* initialize XML */ - /* reset prefix! */ strcpy(prefix, ""); @@ -3743,290 +3721,6 @@ print_enum(hid_t type) printf("\n%*s <empty>", indent + 4, ""); } -#if 0 - -/* - * XML support - */ - -/* - * XML needs a table to look up a path name for an object - * reference. - * - * This table stores mappings of reference -> path - * for all objects in the file that may be the target of - * an object reference. - * - * The 'path' is an absolute path by which the object - * can be accessed. When an object has > 1 such path, - * only one will be used in the table, with no particular - * method of selecting which one. - */ - - -ref_path_table_entry_t *ref_path_table = NULL; /* the table */ - -/*------------------------------------------------------------------------- - * Function: ref_path_table_lookup - * - * Purpose: Looks up a table entry given a path name. - * Used during construction of the table. - * - * Return: The table entre (pte) or NULL if not in the - * table. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static ref_path_table_entry_t * -ref_path_table_lookup(const char *thepath) -{ - H5G_stat_t sb; - ref_path_table_entry_t *pte = ref_path_table; - - if(H5Gget_objinfo(thefile, thepath, TRUE, &sb)<0) { - /* fatal error ? */ - return NULL; - } - - while(pte!=NULL) { - if (sb.objno==pte->statbuf.objno) - return pte; - pte = pte->next; - } - - return NULL; -} - -/*------------------------------------------------------------------------- - * Function: ref_path_table_put - * - * Purpose: Enter the 'obj' with 'path' in the table if - * not already there. - * Create an object reference, pte, and store them - * in the table. - * - * Return: The object reference for the object. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static ref_path_table_entry_t * -ref_path_table_put(hid_t obj, const char *path) -{ - ref_path_table_entry_t *pte; - - /* look up 'obj'. If already in table, return */ - pte = ref_path_table_lookup(path); - if (pte != NULL) - return pte; - - /* if not found, then make new entry */ - - pte = (ref_path_table_entry_t *) malloc(sizeof(ref_path_table_entry_t)); - if (pte == NULL) { - /* fatal error? */ - return NULL; - } - - pte->obj = obj; - - pte->apath = HDstrdup(path); - - if(H5Gget_objinfo(thefile, path, TRUE, &pte->statbuf)<0) { - /* fatal error? */ - free(pte); - return NULL; - } - - pte->next = ref_path_table; - ref_path_table = pte; - - return pte; -} - -/* - * counter used to disambiguate multiple instances of same object. - */ -static int xid = 1; - -static int get_next_xid() { - return xid++; -} - -/* - * This counter is used to create fake object ID's - * The idea is to set it to the largest possible offest, which - * minimizes the chance of collision with a real object id. - * - */ -haddr_t fake_xid = HADDR_MAX; -static haddr_t -get_fake_xid () { - return (fake_xid--); -} - -/* - * for an object that does not have an object id (e.g., soft link), - * create a table entry with a fake object id as the key. - */ - -static ref_path_table_entry_t * -ref_path_table_gen_fake(const char *path) -{ - ref_path_table_entry_t *pte; - - /* look up 'obj'. If already in table, return */ - pte = ref_path_table_lookup(path); - if (pte != NULL) { - return pte; - } - - /* if not found, then make new entry */ - - pte = (ref_path_table_entry_t *) malloc(sizeof(ref_path_table_entry_t)); - if (pte == NULL) { - /* fatal error? */ - return NULL; - } - - pte->obj = (hid_t)-1; - - memset(&pte->statbuf,0,sizeof(H5G_stat_t)); - pte->statbuf.objno = get_fake_xid(); - - pte->apath = HDstrdup(path); - - pte->next = ref_path_table; - ref_path_table = pte; - - return pte; -} - -/*------------------------------------------------------------------------- - * Function: lookup_ref_path - * - * Purpose: Lookup the path to the object with refernce 'ref'. - * - * Return: Return a path to the object, or NULL if not found. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -char * -lookup_ref_path(hobj_ref_t ref) -{ - ref_path_table_entry_t *pte = ref_path_table; - - while(pte!=NULL) { - if (ref==pte->statbuf.objno) - return pte->apath; - pte = pte->next; - } - return NULL; -} - -/*------------------------------------------------------------------------- - * Function: fill_ref_path_table - * - * Purpose: Called by interator to create references for - * all objects and enter them in the table. - * - * Return: Error status. - * - * Programmer: REMcG - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -static herr_t -fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data) -{ - hid_t obj; - char *tmp; - H5G_stat_t statbuf; - ref_path_table_entry_t *pte; - char *thepath; - - H5Gget_objinfo(group, name, FALSE, &statbuf); - tmp = (char *) malloc(strlen(prefix) + strlen(name) + 2); - - if (tmp == NULL) - return FAIL; - - thepath = (char *) malloc(strlen(prefix) + strlen(name) + 2); - - if (thepath == NULL) { - free(tmp); - return FAIL; - } - - strcpy(tmp, prefix); - - strcpy(thepath, prefix); - strcat(thepath, "/"); - strcat(thepath, name); - - switch (statbuf.type) { - case H5G_DATASET: - if ((obj = H5Dopen(group, name)) >= 0) { - pte = ref_path_table_lookup(thepath); - if (pte == NULL) { - ref_path_table_put(obj, thepath); - } - H5Dclose(obj); - } else { - error_msg(progname, "unable to get dataset \"%s\"\n", name); - d_status = EXIT_FAILURE; - } - break; - case H5G_GROUP: - if ((obj = H5Gopen(group, name)) >= 0) { - strcat(strcat(prefix, "/"), name); - pte = ref_path_table_lookup(thepath); - if (pte == NULL) { - ref_path_table_put(obj, thepath); - H5Giterate(obj, ".", NULL, fill_ref_path_table, NULL); - strcpy(prefix, tmp); - } - H5Gclose(obj); - } else { - error_msg(progname, "unable to dump group \"%s\"\n", name); - d_status = EXIT_FAILURE; - } - break; - case H5G_TYPE: - if ((obj = H5Topen(group, name)) >= 0) { - pte = ref_path_table_lookup(thepath); - if (pte == NULL) { - ref_path_table_put(obj, thepath); - } - H5Tclose(obj); - } else { - error_msg(progname, "unable to get dataset \"%s\"\n", name); - d_status = EXIT_FAILURE; - } - break; - default: - break; - } - - free(tmp); - free(thepath); - return 0; -} - -#endif /* * create a string suitable for and XML NCNAME. Uses the @@ -4040,21 +3734,17 @@ int xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) { ref_path_table_entry_t *r; - char *os; if (outlen < 22) return 1; - os = outstr; - r = ref_path_table_lookup(str); if (r == NULL) { if (strlen(str) == 0) { r = ref_path_table_lookup("/"); if (r == NULL) { if (gen) { - sprintf(os," "); /* ?? */ r = ref_path_table_gen_fake(str); - sprintf(os, "xid_"H5_PRINTF_HADDR_FMT, r->statbuf.objno); + sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, r->statbuf.objno); return 0; } else { return 1; @@ -4062,9 +3752,8 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) } } else { if (gen) { - sprintf(os," "); /* ?? */ r = ref_path_table_gen_fake(str); - sprintf(os, "xid_"H5_PRINTF_HADDR_FMT, r->statbuf.objno); + sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, r->statbuf.objno); return 0; } else { return 1; @@ -4072,7 +3761,7 @@ xml_name_to_XID(const char *str , char *outstr, int outlen, int gen) } } - sprintf(os, "xid_"H5_PRINTF_HADDR_FMT, r->statbuf.objno); + sprintf(outstr, "xid_"H5_PRINTF_HADDR_FMT, r->statbuf.objno); return(0); } @@ -4793,7 +4482,7 @@ xml_dump_dataspace(hid_t space) default: printf("<!-- unknown dataspace -->\n"); } - + indentation(indent + COL); printf("</%sDataspace>\n", xmlnsprefix); } diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index b2a5208..26521c6 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -272,9 +272,9 @@ static void gent_dataset(void) dset2[i][j] = 0.0001*j+i; H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset2); + H5Sclose(space); H5Dclose(dataset); - H5Fclose(fid); } @@ -382,10 +382,10 @@ static void gent_attribute(void) H5Tset_size(type, 17); attr = H5Acreate (root, "attr5", type, space, H5P_DEFAULT); H5Awrite(attr, type, string); + + H5Tclose(type); H5Sclose(space); H5Aclose(attr); - - H5Tclose(type); H5Gclose(root); H5Fclose(fid); } @@ -1358,7 +1358,7 @@ static void gent_str2(void) hid_t fid, group, attr, dataset, space, space2, mem_space, hyper_space; hid_t fxdlenstr, fxdlenstr2, memtype; hsize_t dims[1], size[1], stride[1], count[1], block[1]; -hssize_t start[1]; +hsize_t start[1]; int i; @@ -1657,11 +1657,11 @@ static void gent_datareg(void) sid2; /* Dataspace ID #2 */ hsize_t dims1[] = {SPACE1_DIM1}, dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ - hssize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ + hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */ hdset_reg_ref_t *wbuf, /* buffer to write to disk */ *rbuf; /* buffer read from disk */ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */ @@ -1724,7 +1724,7 @@ static void gent_datareg(void) coord1[7][0]=9; coord1[7][1]=0; coord1[8][0]=7; coord1[8][1]=1; coord1[9][0]=3; coord1[9][1]=3; - H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hssize_t **)coord1); + H5Sselect_elements(sid2,H5S_SELECT_SET,POINT1_NPOINTS,(const hsize_t **)coord1); H5Sget_select_npoints(sid2); @@ -3077,7 +3077,7 @@ static void gent_char(void) * * Purpose: write attributes in LOC_ID (dataset, group, named datatype) * - * Return: + * Return: void * * Programmer: pvn@ncsa.uiuc.edu * @@ -3517,7 +3517,7 @@ static void write_attr_in(hid_t loc_id, * * Purpose: write datasets in LOC_ID * - * Return: + * Return: void * * Programmer: pvn@ncsa.uiuc.edu * @@ -3984,8 +3984,8 @@ static void write_dset_in(hid_t loc_id, static void gent_attr_all(void) { - hid_t file_id; - hid_t dset_id; + hid_t file_id; + hid_t dset_id; hid_t group_id; hid_t group2_id; hid_t root_id; @@ -4432,8 +4432,6 @@ int make_dset(hid_t loc_id, - - /*------------------------------------------------------------------------- * Function: make_external * @@ -4806,7 +4804,6 @@ set_local_myfilter(hid_t dcpl_id, hid_t UNUSED type_id, hid_t UNUSED space_id) return(SUCCEED); } - /*------------------------------------------------------------------------- * Function: gent_fcontents * @@ -5258,8 +5255,6 @@ static void gent_aindices(void) } - - /*------------------------------------------------------------------------- * Function: main * @@ -5322,3 +5317,4 @@ int main(void) return 0; } + diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 24fa908..6efc47c 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -112,7 +112,7 @@ TOOLTEST tgroup-2.ddl --group=/g2 --group / -g /y tgroup.h5 # test for displaying simple space datasets TOOLTEST tdset-1.ddl tdset.h5 # test for displaying selected datasets -TOOLTEST tdset-2.ddl -H -d dset1 -d /dset2 tdset.h5 +TOOLTEST tdset-2.ddl -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5 # test for displaying attributes TOOLTEST tattr-1.ddl tattr.h5 diff --git a/tools/h5dump/testh5dumpxml.sh b/tools/h5dump/testh5dumpxml.sh index 6af3836..c2fa23f 100755 --- a/tools/h5dump/testh5dumpxml.sh +++ b/tools/h5dump/testh5dumpxml.sh @@ -62,8 +62,13 @@ TOOLTEST() { $RUNSERIAL $DUMPER_BIN $@ ) >$actual 2>$actual_err cat $actual_err >> $actual - - if $CMP $expect $actual; then + + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual; then echo " PASSED" else echo "*FAILED*" diff --git a/tools/h5jam/getub.c b/tools/h5jam/getub.c index 58e9fe8..01756a5 100644 --- a/tools/h5jam/getub.c +++ b/tools/h5jam/getub.c @@ -27,7 +27,7 @@ void parse_command_line (int argc, const char *argv[]); #define TRUE 1 #define FALSE 0 -static char *progname="getub"; +static const char *progname="getub"; char *nbytes = NULL; static const char *s_opts = "c:"; /* add more later ? */ @@ -153,7 +153,7 @@ main (int argc, const char *argv[]) res = HDread (fd, buf, (unsigned)size); - if (res < size) + if (res < (long)size) { if (buf) free (buf); diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index d78e28c..7d3301b 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -442,7 +442,7 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout, } else { - nchars = HDread (infid, buf, howmuch); + nchars = HDread (infid, buf, (unsigned)howmuch); } if (nchars <= 0) @@ -498,7 +498,7 @@ copy_some_to_file (int infid, int outfid, hsize_t startin, hsize_t startout, hsize_t compute_user_block_size (hsize_t ublock_size) { - ssize_t where = 512; + hsize_t where = 512; if (ublock_size == 0) return 0; diff --git a/tools/h5jam/h5jamgentest.c b/tools/h5jam/h5jamgentest.c index 7f6342f..2d5f253 100644 --- a/tools/h5jam/h5jamgentest.c +++ b/tools/h5jam/h5jamgentest.c @@ -262,12 +262,13 @@ hsize_t dims[2]; int data[2][2], dset1[10][10], dset2[20]; char buf[512]; int i, j; +unsigned u; float dset2_1[10], dset2_2[3][5]; int fd; char *bp; create_plist = H5Pcreate(H5P_FILE_CREATE); - H5Pset_userblock(create_plist,512); + H5Pset_userblock(create_plist,(hsize_t)512); fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, create_plist, H5P_DEFAULT); /* create groups */ @@ -390,8 +391,8 @@ char *bp; /* fill buf with pattern */ memset(buf,'\0',512); bp = buf; - for (i = 0; i < strlen(pattern); i++) { - *bp++ = pattern[i%10]; + for (u = 0; u < strlen(pattern); u++) { + *bp++ = pattern[u%10]; } HDwrite(fd,buf,512); @@ -411,7 +412,7 @@ int fd; char *bp; create_plist = H5Pcreate(H5P_FILE_CREATE); - H5Pset_userblock(create_plist,1024); + H5Pset_userblock(create_plist,(hsize_t)1024); fid = H5Fcreate(FILE9, H5F_ACC_TRUNC, create_plist, H5P_DEFAULT); /* create groups */ @@ -543,14 +544,14 @@ char *bp; close(fd); } -void -create_textfile(char *name, off_t size) { +static void +create_textfile(const char *name, size_t size) { char *buf; int fd; -int i; +size_t i; char *bp; - fd = creat(name,0777); + fd = creat(name,(mode_t)0777); if (fd < 0) { /* panic */ } diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index 20378e5..ad54e5e 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -100,7 +100,7 @@ usage(const char *prog) *------------------------------------------------------------------------- */ -void +static void parse_command_line(int argc, const char *argv[]) { int opt = FALSE; @@ -268,7 +268,7 @@ main(int argc, const char *argv[]) /* copy from usize to end of file into h5fid, * starting at end of user block if present */ - copy_to_file( ifid, h5fid, (ssize_t) usize, (fsize - (ssize_t)usize) ); + copy_to_file( ifid, h5fid, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize) ); close(ufid); diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c index ab88f4d..75f4a64 100644 --- a/tools/h5jam/tellub.c +++ b/tools/h5jam/tellub.c @@ -79,7 +79,7 @@ usage (const char *prog) *------------------------------------------------------------------------- */ -void +static void parse_command_line (int argc, const char *argv[]) { int opt = FALSE; @@ -122,7 +122,7 @@ parse_command_line (int argc, const char *argv[]) * *------------------------------------------------------------------------- */ -void +int main (int argc, const char *argv[]) { char *ifname; @@ -144,7 +144,7 @@ main (int argc, const char *argv[]) { error_msg (progname, "missing file name\n"); usage (progname); - exit (EXIT_FAILURE); + return (EXIT_FAILURE); } ifname = strdup (argv[opt_ind]); @@ -154,7 +154,7 @@ main (int argc, const char *argv[]) if (testval <= 0) { error_msg (progname, "Input HDF5 file is not HDF \"%s\"\n", ifname); - exit (EXIT_FAILURE); + return (EXIT_FAILURE); } ifile = H5Fopen (ifname, H5F_ACC_RDONLY, H5P_DEFAULT); @@ -162,7 +162,7 @@ main (int argc, const char *argv[]) if (ifile < 0) { error_msg (progname, "Can't open input HDF5 file \"%s\"\n", ifname); - exit (EXIT_FAILURE); + return (EXIT_FAILURE); } plist = H5Fget_create_plist (ifile); @@ -170,14 +170,14 @@ main (int argc, const char *argv[]) { error_msg (progname, "Can't get file creation plist for file \"%s\"\n", ifname); - exit (EXIT_FAILURE); + return (EXIT_FAILURE); } status = H5Pget_userblock (plist, &usize); if (status < 0) { error_msg (progname, "Can't get user block for file \"%s\"\n", ifname); - exit (EXIT_FAILURE); + return (EXIT_FAILURE); } printf ("%ld\n", (long) usize); @@ -185,5 +185,5 @@ main (int argc, const char *argv[]) H5Pclose (plist); H5Fclose (ifile); - exit (EXIT_SUCCESS); + return (EXIT_SUCCESS); } diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index 1514ca6..9ddabab 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -80,7 +80,7 @@ static char *fix_name(const char *path, const char *base); hid_t thefile; char *prefix; -char *progname; +const char *progname="h5ls"; int d_status; @@ -99,7 +99,7 @@ int d_status; *------------------------------------------------------------------------- */ static void -usage (const char *progname) +usage (void) { fprintf(stderr, "\ usage: %s [OPTIONS] [OBJECTS...]\n\ @@ -1356,6 +1356,10 @@ list_attr (hid_t obj, const char *attr_name, void UNUSED *op_data) /* null dataspace */ puts(" null"); break; + default: + /* Unknown dataspace type */ + puts(" unknown"); + break; } /* Data type */ @@ -2022,7 +2026,6 @@ main (int argc, const char *argv[]) { hid_t file=-1, root=-1; char *fname=NULL, *oname=NULL, *x; - const char *progname="h5ls"; const char *s = NULL; char *rest, *container=NULL; int argno; @@ -2061,7 +2064,7 @@ main (int argc, const char *argv[]) argno++; break; } else if (!strcmp(argv[argno], "--help")) { - usage(progname); + usage(); leave(0); } else if (!strcmp(argv[argno], "--address")) { address_g = TRUE; @@ -2087,19 +2090,19 @@ main (int argc, const char *argv[]) } else if (!strncmp(argv[argno], "--width=", 8)) { width_g = (int)strtol(argv[argno]+8, &rest, 0); if (width_g<=0 || *rest) { - usage(progname); + usage(); leave(1); } } else if (!strcmp(argv[argno], "--width")) { if (argno+1>=argc) { - usage(progname); + usage(); leave(1); } else { s = argv[++argno]; } width_g = (int)strtol(s, &rest, 0); if (width_g<=0 || *rest) { - usage(progname); + usage(); leave(1); } } else if (!strcmp(argv[argno], "--verbose")) { @@ -2113,14 +2116,14 @@ main (int argc, const char *argv[]) if (argv[argno][2]) { s = argv[argno]+2; } else if (argno+1>=argc) { - usage(progname); + usage(); leave(1); } else { s = argv[++argno]; } width_g = (int)strtol(s, &rest, 0); if (width_g<=0 || *rest) { - usage(progname); + usage(); leave(1); } } else if ('-'!=argv[argno][1]) { @@ -2129,7 +2132,7 @@ main (int argc, const char *argv[]) switch (*s) { case '?': case 'h': /* --help */ - usage(progname); + usage(); leave(0); case 'a': /* --address */ address_g = TRUE; @@ -2169,12 +2172,12 @@ main (int argc, const char *argv[]) hexdump_g = TRUE; break; default: - usage(progname); + usage(); leave(1); } } } else { - usage(progname); + usage(); leave(1); } } @@ -2182,7 +2185,7 @@ main (int argc, const char *argv[]) /* If no arguments remain then print a usage message (instead of doing * absolutely nothing ;-) */ if (argno>=argc) { - usage(progname); + usage(); leave(1); } diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index 4120b4d..5d6a9c3 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -27,7 +27,7 @@ CPPFLAGS=-I. -I$(srcdir) -I$(top_builddir)/src -I$(top_srcdir)/src \ ## Test programs and scripts. ## -TEST_PROGS=h5repacktst +TEST_PROGS=h5repacktst TEST_SCRIPTS=./h5repack.sh PRIV_PROGS=testh5repack_detect_szip diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index 14779c5..09d83b9 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -243,6 +243,7 @@ int h5repack_addlayout(const char* str, static int check_options(pack_opt_t *options) { int i, k, j, has_cp=0, has_ck=0; + char slayout[30]; /*------------------------------------------------------------------------- * objects to layout @@ -252,7 +253,22 @@ static int check_options(pack_opt_t *options) { printf("Objects to modify layout are...\n"); if (options->all_layout==1) { - printf(" Apply layout to all\n "); + switch (options->layout_g) + { + case H5D_COMPACT: + strcpy(slayout,"compact"); + break; + case H5D_CONTIGUOUS: + strcpy(slayout,"contiguous"); + break; + case H5D_CHUNKED: + strcpy(slayout,"chunked"); + break; + default: + strcpy(slayout,"unknown"); + break; + } + printf(" Apply %s layout to all\n", slayout); if (H5D_CHUNKED==options->layout_g) { printf("with dimension ["); for ( j = 0; j < options->chunk_g.rank; j++) @@ -336,7 +352,6 @@ static int check_options(pack_opt_t *options) has_cp=1; - } /* j */ } /* i */ @@ -345,6 +360,8 @@ static int check_options(pack_opt_t *options) is present with other objects\n"); return -1; } + + return 0; } diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c index 9a73919..42b6701 100644 --- a/tools/h5repack/h5repack_copy.c +++ b/tools/h5repack/h5repack_copy.c @@ -142,7 +142,7 @@ int copy_objects(const char* fnamein, pack_opt_t *options) { hid_t fidin; - hid_t fidout; + hid_t fidout=(-1); trav_table_t *travt=NULL; /*------------------------------------------------------------------------- @@ -215,9 +215,6 @@ out: return -1; } - - - /*------------------------------------------------------------------------- * Function: do_copy_objects * @@ -239,17 +236,17 @@ int do_copy_objects(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in; /* group ID */ - hid_t grp_out; /* group ID */ - hid_t dset_in; /* read dataset ID */ - hid_t dset_out; /* write dataset ID */ - hid_t type_in; /* named type ID */ - hid_t type_out; /* named type ID */ - hid_t dcpl_id; /* dataset creation property list ID */ - hid_t dcpl_out; /* dataset creation property list ID */ - hid_t space_id; /* space ID */ - hid_t ftype_id; /* file data type ID */ - hid_t mtype_id; /* memory data type ID */ + hid_t grp_in=(-1); /* group ID */ + hid_t grp_out=(-1); /* group ID */ + hid_t dset_in=(-1); /* read dataset ID */ + hid_t dset_out=(-1); /* write dataset ID */ + hid_t type_in=(-1); /* named type ID */ + hid_t type_out=(-1); /* named type ID */ + hid_t dcpl_id=(-1); /* dataset creation property list ID */ + hid_t dcpl_out=(-1); /* dataset creation property list ID */ + hid_t space_id=(-1); /* space ID */ + hid_t ftype_id=(-1); /* file data type ID */ + hid_t mtype_id=(-1); /* memory data type ID */ size_t msize; /* memory size of memory type */ void *buf=NULL; /* data buffer */ hsize_t nelmts; /* number of elements in dataset */ @@ -258,7 +255,6 @@ int do_copy_objects(hid_t fidin, hsize_t dsize_in; /* input dataset size before filter */ int next; /* external files */ int i, j; - int wrote=0; /*------------------------------------------------------------------------- * copy the suppplied object list @@ -418,7 +414,6 @@ int do_copy_objects(hid_t fidin, if (dsize_in && nelmts) { if (H5Dwrite(dset_out,mtype_id,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf)<0) goto error; - wrote=1; } /*------------------------------------------------------------------------- * copy attrs diff --git a/tools/h5repack/h5repack_filters.c b/tools/h5repack/h5repack_filters.c index f594763..43b7dcc 100644 --- a/tools/h5repack/h5repack_filters.c +++ b/tools/h5repack/h5repack_filters.c @@ -73,15 +73,15 @@ int aux_assign_obj(const char* name, /* object name from traverse lis pack_info_t *obj /*OUT*/) /* info about object to filter */ { - int index, i; + int idx, i; pack_info_t tmp; init_packobject(&tmp); - index = aux_find_obj(name,options,&tmp); + idx = aux_find_obj(name,options,&tmp); /* name was on input */ - if (index>=0) + if (idx>=0) { /* applying to all objects */ @@ -102,13 +102,13 @@ int aux_assign_obj(const char* name, /* object name from traverse lis } else { - tmp.layout = options->op_tbl->objs[index].layout; + tmp.layout = options->op_tbl->objs[idx].layout; switch (tmp.layout) { case H5D_CHUNKED: - tmp.chunk.rank = options->op_tbl->objs[index].chunk.rank; + tmp.chunk.rank = options->op_tbl->objs[idx].chunk.rank; for ( i=0; i<tmp.chunk.rank; i++) - tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[index].chunk.chunk_lengths[i]; + tmp.chunk.chunk_lengths[i]=options->op_tbl->objs[idx].chunk.chunk_lengths[i]; break; default: break; @@ -125,15 +125,15 @@ int aux_assign_obj(const char* name, /* object name from traverse lis } /* if all */ else { - tmp.nfilters=options->op_tbl->objs[index].nfilters; + tmp.nfilters=options->op_tbl->objs[idx].nfilters; for ( i=0; i<tmp.nfilters; i++) { - tmp.filter[i] = options->op_tbl->objs[index].filter[i]; + tmp.filter[i] = options->op_tbl->objs[idx].filter[i]; } } - } /* if index */ + } /* if idx */ /* no input name */ diff --git a/tools/h5repack/h5repack_list.c b/tools/h5repack/h5repack_list.c index 38b8bc0..3f65e63 100644 --- a/tools/h5repack/h5repack_list.c +++ b/tools/h5repack/h5repack_list.c @@ -168,7 +168,6 @@ out: - /*------------------------------------------------------------------------- * Function: print_objlist * diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 6bca10e..d9c5e3a 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -187,4 +187,3 @@ void usage(void) } - diff --git a/tools/h5repack/h5repack_refs.c b/tools/h5repack/h5repack_refs.c index f093d12..28c6c0b 100644 --- a/tools/h5repack/h5repack_refs.c +++ b/tools/h5repack/h5repack_refs.c @@ -52,15 +52,15 @@ int do_copy_refobjs(hid_t fidin, trav_table_t *travt, pack_opt_t *options) /* repack options */ { - hid_t grp_in; /* read group ID */ - hid_t grp_out; /* write group ID */ - hid_t dset_in; /* read dataset ID */ - hid_t dset_out; /* write dataset ID */ - hid_t type_in; /* named type ID */ - hid_t dcpl_id; /* dataset creation property list ID */ - hid_t space_id; /* space ID */ - hid_t ftype_id; /* file data type ID */ - hid_t mtype_id; /* memory data type ID */ + hid_t grp_in=(-1); /* read group ID */ + hid_t grp_out=(-1); /* write group ID */ + hid_t dset_in=(-1); /* read dataset ID */ + hid_t dset_out=(-1); /* write dataset ID */ + hid_t type_in=(-1); /* named type ID */ + hid_t dcpl_id=(-1); /* dataset creation property list ID */ + hid_t space_id=(-1); /* space ID */ + hid_t ftype_id=(-1); /* file data type ID */ + hid_t mtype_id=(-1); /* memory data type ID */ size_t msize; /* memory size of memory type */ hsize_t nelmts; /* number of elements in dataset */ int rank; /* rank of dataset */ diff --git a/tools/h5repack/testh5repack_detect_szip.c b/tools/h5repack/testh5repack_detect_szip.c index 9e6514f..4f12c40 100644 --- a/tools/h5repack/testh5repack_detect_szip.c +++ b/tools/h5repack/testh5repack_detect_szip.c @@ -38,14 +38,14 @@ */ -void main(void) +int main(void) { #ifdef H5_HAVE_FILTER_SZIP - if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { - printf("yes\n"); - exit(1); - } + if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { + printf("yes\n"); + return(1); + } #endif /* H5_HAVE_FILTER_SZIP */ - printf("no\n"); - exit(0); + printf("no\n"); + return(0); } diff --git a/tools/h5repack/testh5repack_dset.c b/tools/h5repack/testh5repack_dset.c index 4666753..299c044 100644 --- a/tools/h5repack/testh5repack_dset.c +++ b/tools/h5repack/testh5repack_dset.c @@ -638,7 +638,7 @@ static void make_dset_reg_ref(hid_t loc_id) hid_t sid2; /* Dataspace ID #2 */ hsize_t dims1[] = {SPACE1_DIM1}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2}; - hssize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ + hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */ diff --git a/tools/h5repack/testh5repack_make.c b/tools/h5repack/testh5repack_make.c index 6149bd9..65a1c4a 100644 --- a/tools/h5repack/testh5repack_make.c +++ b/tools/h5repack/testh5repack_make.c @@ -27,7 +27,9 @@ int make_attributes(hid_t loc_id); int make_hlinks(hid_t loc_id); int make_early(void); int make_layout(hid_t loc_id); +#ifdef H5_HAVE_FILTER_SZIP int make_szip(hid_t loc_id); +#endif /* H5_HAVE_FILTER_SZIP */ int make_deflate(hid_t loc_id); int make_shuffle(hid_t loc_id); int make_fletcher32(hid_t loc_id); @@ -113,12 +115,14 @@ int make_testfiles(void) * create a file with the SZIP filter *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_FILTER_SZIP if((loc_id = H5Fcreate(FNAME7,H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT))<0) return -1; if (make_szip(loc_id)<0) goto out; if(H5Fclose(loc_id)<0) return -1; +#endif /* H5_HAVE_FILTER_SZIP */ /*------------------------------------------------------------------------- * create a file with the deflate filter @@ -362,6 +366,7 @@ int make_hlinks(hid_t loc_id) * *------------------------------------------------------------------------- */ +#ifdef H5_HAVE_FILTER_SZIP int make_szip(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ @@ -372,9 +377,7 @@ int make_szip(hid_t loc_id) hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; int i, j, n; -#if defined (H5_HAVE_FILTER_SZIP) int szip_can_encode = 0; -#endif for (i=n=0; i<DIM1; i++){ for (j=0; j<DIM2; j++){ @@ -396,7 +399,6 @@ int make_szip(hid_t loc_id) *------------------------------------------------------------------------- */ /* Make sure encoding is enabled */ -#if defined (H5_HAVE_FILTER_SZIP) if (h5tools_can_encode(H5Z_FILTER_SZIP) == 1) { szip_can_encode = 1; } @@ -409,7 +411,6 @@ if (szip_can_encode) { } else { /* WARNING? SZIP is decoder only, can't generate test files */ } -#endif if(H5Sclose(sid)<0) goto out; @@ -425,6 +426,7 @@ out: } H5E_END_TRY; return -1; } +#endif /* H5_HAVE_FILTER_SZIP */ @@ -633,8 +635,10 @@ int make_all(hid_t loc_id) { hid_t dcpl; /* dataset creation property list */ hid_t sid; /* dataspace ID */ +#if defined (H5_HAVE_FILTER_SZIP) unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block=8; +#endif /* H5_HAVE_FILTER_SZIP */ hsize_t dims[RANK]={DIM1,DIM2}; hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index c271f21..592b016 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -55,7 +55,7 @@ hsize_t h5diff(const char *fname1, int nobjects1, nobjects2; trav_info_t *info1=NULL; trav_info_t *info2=NULL; - hid_t file1_id, file2_id; + hid_t file1_id=(-1), file2_id=(-1); hsize_t nfound=0; if (options->m_quiet && @@ -414,10 +414,10 @@ hsize_t diff( hid_t file1_id, diff_opt_t *options, H5G_obj_t type ) { - hid_t type1_id; - hid_t type2_id; - hid_t grp1_id; - hid_t grp2_id; + hid_t type1_id=(-1); + hid_t type2_id=(-1); + hid_t grp1_id=(-1); + hid_t grp2_id=(-1); int ret; H5G_stat_t sb1; H5G_stat_t sb2; @@ -436,7 +436,7 @@ hsize_t diff( hid_t file1_id, /* always print name */ if (options->m_verbose) { - if (print_objname(options,1)) + if (print_objname(options,(hsize_t)1)) printf( "Dataset: <%s> and <%s>\n",path1,path2); nfound=diff_dataset(file1_id,file2_id,path1,path2,options); diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h index b4ec0b5..4a29259 100644 --- a/tools/lib/h5diff.h +++ b/tools/lib/h5diff.h @@ -238,7 +238,6 @@ hsize_t diff_datum(void *_mem1, - hsize_t diff_float(unsigned char *mem1, unsigned char *mem2, hsize_t nelmts, @@ -373,5 +372,4 @@ hsize_t diff_ullong(unsigned char *mem1, - #endif /* H5DIFF_H__ */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 6008278..f1c4a74 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -3027,7 +3027,7 @@ hsize_t diff_long(unsigned char *mem1, memcpy(&temp1_long, mem1, sizeof(long)); memcpy(&temp2_long, mem2, sizeof(long)); - if (labs(temp1_long-temp2_long) > options->delta) + if (labs(temp1_long-temp2_long) > (long)options->delta) { if ( print_data(options) ) { @@ -3084,7 +3084,7 @@ hsize_t diff_long(unsigned char *mem1, memcpy(&temp2_long, mem2, sizeof(long)); if ( temp1_long!=0 && labs(1-temp2_long/temp1_long) > options->percent && - labs(temp1_long-temp2_long) > options->delta ) + labs(temp1_long-temp2_long) > (long)options->delta ) { if ( print_data(options) ) { @@ -3170,7 +3170,7 @@ hsize_t diff_ulong(unsigned char *mem1, memcpy(&temp1_ulong, mem1, sizeof(unsigned long)); memcpy(&temp2_ulong, mem2, sizeof(unsigned long)); - if (labs(temp1_ulong-temp2_ulong) > options->delta) + if (labs((long)(temp1_ulong-temp2_ulong)) > (long)options->delta) { if ( print_data(options) ) { diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 801f83c..60377c0 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -168,7 +168,13 @@ h5tools_close(void) *------------------------------------------------------------------------- */ static hid_t -h5tools_get_fapl(const char *driver, unsigned *drivernum, int argc, const char *argv[]) +h5tools_get_fapl(const char *driver, unsigned *drivernum, +#ifdef H5_HAVE_PARALLEL +int argc, const char *argv[] +#else /* H5_HAVE_PARALLEL */ +int UNUSED argc, const char UNUSED *argv[] +#endif /* H5_HAVE_PARALLEL */ +) { hid_t fapl = H5P_DEFAULT; @@ -692,7 +698,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset, herr_t ret; /*the value to return */ hid_t f_space; /*file data space */ int i; /*counters */ - hssize_t zero = 0; /*vector of zeros */ + hsize_t zero = 0; /*vector of zeros */ unsigned int flags; /*buffer extent flags */ hsize_t total_size[H5S_MAX_RANK];/*total size of dataset*/ @@ -744,10 +750,10 @@ h5tools_dump_simple_subset(FILE *stream, const h5dump_t *info, hid_t dset, count--) { /* calculate the potential number of elements we're going to print */ H5Sselect_hyperslab(f_space, H5S_SELECT_SET, - (hssize_t*)sset->start, - (hsize_t*)sset->stride, - (hsize_t*)sset->count, - (hsize_t*)sset->block); + sset->start, + sset->stride, + sset->count, + sset->block); sm_nelmts = H5Sget_select_npoints(f_space); /* @@ -856,7 +862,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, hsize_t elmtno; /*counter */ int i; /*counter */ int carry; /*counter carry value */ - hssize_t zero[8]; /*vector of zeros */ + hsize_t zero[8]; /*vector of zeros */ unsigned int flags; /*buffer extent flags */ hsize_t total_size[H5S_MAX_RANK];/*total size of dataset*/ @@ -873,7 +879,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, hid_t sm_space; /*stripmine data space */ /* Hyperslab info */ - hssize_t hs_offset[H5S_MAX_RANK];/*starting offset */ + hsize_t hs_offset[H5S_MAX_RANK];/*starting offset */ hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */ hsize_t hs_nelmts; /*elements in request */ @@ -994,7 +1000,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5dump_t *info, hid_t dset, ctx.p_min_idx[i - 1] = ctx.p_max_idx[i - 1]; hs_offset[i - 1] += hs_size[i - 1]; - if (hs_offset[i - 1] == (hssize_t)total_size[i - 1]) + if (hs_offset[i - 1] == total_size[i - 1]) hs_offset[i - 1] = 0; else carry = 0; diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index 93f926e..9254359 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -419,7 +419,7 @@ typedef struct h5tools_context_t { /* a structure to hold the subsetting particulars for a dataset */ struct subset_t { - hssize_t *start; + hsize_t *start; hsize_t *stride; hsize_t *count; hsize_t *block; diff --git a/tools/lib/h5tools_filters.c b/tools/lib/h5tools_filters.c index 3370409..9c816cd 100644 --- a/tools/lib/h5tools_filters.c +++ b/tools/lib/h5tools_filters.c @@ -94,7 +94,7 @@ int h5tools_canreadf(const char* name, /* object name, serves also as boolean pr if (name) print_warning(name,"user defined"); return 0; - break; + /*------------------------------------------------------------------------- * H5Z_FILTER_DEFLATE 1 , deflation like gzip *------------------------------------------------------------------------- @@ -172,7 +172,6 @@ int h5tools_can_encode( H5Z_filter_t filtn) int have_szip=0; int have_shuffle=0; int have_fletcher=0; - herr_t status; unsigned int filter_config_flags; #ifdef H5_HAVE_FILTER_DEFLATE @@ -193,7 +192,7 @@ int h5tools_can_encode( H5Z_filter_t filtn) /* user defined filter */ default: return 0; - break; + case H5Z_FILTER_DEFLATE: if (!have_deflate) { @@ -205,7 +204,8 @@ int h5tools_can_encode( H5Z_filter_t filtn) { return 0; } - status =H5Zget_filter_info(filtn, &filter_config_flags); + if(H5Zget_filter_info(filtn, &filter_config_flags)<0) + return -1; if ((filter_config_flags & (H5Z_FILTER_CONFIG_ENCODE_ENABLED|H5Z_FILTER_CONFIG_DECODE_ENABLED)) == 0) { /* filter present but neither encode nor decode is supported (???) */ diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c index 7dcccad..b607d7d 100644 --- a/tools/lib/h5tools_ref.c +++ b/tools/lib/h5tools_ref.c @@ -41,7 +41,6 @@ extern char *progname; extern int d_status; - ref_path_table_entry_t *ref_path_table = NULL; /* the table */ /*------------------------------------------------------------------------- @@ -65,10 +64,9 @@ ref_path_table_lookup(const char *thepath) H5G_stat_t sb; ref_path_table_entry_t *pte = ref_path_table; - if(H5Gget_objinfo(thefile, thepath, TRUE, &sb)<0) { + if(H5Gget_objinfo(thefile, thepath, TRUE, &sb)<0) /* fatal error ? */ return NULL; - } while(pte!=NULL) { if (sb.objno==pte->statbuf.objno) @@ -108,10 +106,9 @@ ref_path_table_put(hid_t obj, const char *path) /* if not found, then make new entry */ pte = (ref_path_table_entry_t *) malloc(sizeof(ref_path_table_entry_t)); - if (pte == NULL) { + if (pte == NULL) /* fatal error? */ return NULL; - } pte->obj = obj; @@ -158,21 +155,19 @@ get_fake_xid () { ref_path_table_entry_t * ref_path_table_gen_fake(const char *path) { - ref_path_table_entry_t *pte; + ref_path_table_entry_t *pte; /* look up 'obj'. If already in table, return */ pte = ref_path_table_lookup(path); - if (pte != NULL) { + if (pte != NULL) return pte; - } /* if not found, then make new entry */ pte = (ref_path_table_entry_t *) malloc(sizeof(ref_path_table_entry_t)); - if (pte == NULL) { + if (pte == NULL) /* fatal error? */ return NULL; - } pte->obj = (hid_t)-1; @@ -259,9 +254,8 @@ fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data) case H5G_DATASET: if ((obj = H5Dopen(group, name)) >= 0) { pte = ref_path_table_lookup(thepath); - if (pte == NULL) { + if (pte == NULL) ref_path_table_put(obj, thepath); - } H5Dclose(obj); } else { error_msg(progname, "unable to get dataset \"%s\"\n", name); @@ -286,9 +280,8 @@ fill_ref_path_table(hid_t group, const char *name, void UNUSED * op_data) case H5G_TYPE: if ((obj = H5Topen(group, name)) >= 0) { pte = ref_path_table_lookup(thepath); - if (pte == NULL) { + if (pte == NULL) ref_path_table_put(obj, thepath); - } H5Tclose(obj); } else { error_msg(progname, "unable to get dataset \"%s\"\n", name); diff --git a/tools/lib/h5tools_ref.h b/tools/lib/h5tools_ref.h index 2f5fa83..f4a5941 100644 --- a/tools/lib/h5tools_ref.h +++ b/tools/lib/h5tools_ref.h @@ -19,7 +19,6 @@ typedef struct ref_path_table_entry_t { hid_t obj; - hobj_ref_t *obj_ref; char *apath; H5G_stat_t statbuf; struct ref_path_table_entry_t *next; @@ -29,7 +28,6 @@ typedef struct ref_path_table_entry_t { extern "C" { #endif - char* lookup_ref_path(hobj_ref_t ref); herr_t fill_ref_path_table(hid_t, const char *, void *); int get_next_xid(void); diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c index 53a3505..1ef2579 100644 --- a/tools/lib/h5tools_type.c +++ b/tools/lib/h5tools_type.c @@ -45,3 +45,4 @@ h5tools_get_native_type(hid_t type) return(p_type); } + diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in index e2e6364..9257bb3 100755 --- a/tools/misc/h5cc.in +++ b/tools/misc/h5cc.in @@ -247,14 +247,13 @@ if test "x$do_compile" = "xyes"; then fi fi - if test "x$do_link" = "xyes"; then shared_link="" # conditionnaly link with the hl library if test "X$HL" = "Xhl"; then libraries=" $libraries -lhdf5_hl -lhdf5 " else - libraries=" $libraries -lhdf5 " + libraries=" $libraries -lhdf5 " fi link_args="$link_args -L${libdir}" diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index 487d1e9..466279c 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -69,7 +69,8 @@ main(int argc, char *argv[]) H5F_t *f; haddr_t addr=0, extra=0; uint8_t sig[16]; - int i, ndims; + int i; + unsigned ndims; herr_t status = SUCCEED; if (argc == 1) { @@ -163,7 +164,7 @@ main(int argc, char *argv[]) break; case H5B_ISTORE_ID: - ndims = (int)extra; + ndims = (unsigned)extra; status = H5D_istore_debug (f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, ndims); break; diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c index 2c72852..0518a76 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -208,8 +208,7 @@ main (int argc, char *argv[]) int dst_is_family; /*is dst name a family name? */ int dst_membno=0; /*destination member number */ -#ifdef WIN32 - +#if defined(WIN32) && ! defined (__MWERKS__) _int64 left_overs=0; /*amount of zeros left over */ _int64 src_offset=0; /*offset in source member */ _int64 dst_offset=0; /*offset in destination member */ diff --git a/tools/testfiles/tdset-2.ddl b/tools/testfiles/tdset-2.ddl index 8bb18f2..93c961c 100644 --- a/tools/testfiles/tdset-2.ddl +++ b/tools/testfiles/tdset-2.ddl @@ -1,5 +1,5 @@ ############################# -Expected output for 'h5dump -H -d dset1 -d /dset2 tdset.h5' +Expected output for 'h5dump -H -d dset1 -d /dset2 --dataset=dset3 tdset.h5' ############################# HDF5 "tdset.h5" { DATASET "dset1" { @@ -10,4 +10,7 @@ DATASET "/dset2" { DATATYPE H5T_IEEE_F64BE DATASPACE SIMPLE { ( 30, 20 ) / ( 30, 20 ) } } +DATASET "dset3" { + } } +h5dump error: unable to open dataset "dset3" |