From 84fadb9f74741dc53a07a8780d6d1f03c728e213 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 11 Dec 2000 23:40:09 -0500 Subject: [svn-r3114] Purpose: Fix Description: Dec CC compiler doesn't support some new c++ features. Some typos caused compilation erros on Dec Alpha. Solution: - Added macro BOOL_NOTDEFINED to define bool type on Dec Alpha (gondolin) since its compiler doesn't support bool. - Added macro NO_STATIC_CAST to prevent the use of the new c++ feature static_cast since Dec CC compiler doesn't support. - Added const to parameters of some functions to match the functions' declaration and definition. Typos errors and Dec CC complained. Platform: Solaris (arabica). Also tried to build on Dec Alpha but still not linked due to some missing compiler flags; its compilation went fine though. --- c++/src/H5CompType.cpp | 1 + c++/src/H5CompType.h | 2 +- c++/src/H5DataSet.cpp | 1 + c++/src/H5EnumType.h | 2 +- c++/src/H5FloatType.h | 2 +- c++/src/H5IdComponent.cpp | 4 ++-- c++/src/H5IdComponent.h | 4 ++-- c++/src/H5IntType.h | 2 +- c++/src/H5Object.cpp | 8 ++++++-- c++/src/H5PredType.cpp | 3 ++- c++/src/H5RefCounter.h | 22 ++++++++++++++++++++-- c++/src/H5StrType.h | 2 +- 12 files changed, 39 insertions(+), 14 deletions(-) diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp index 634d817..7bb66ea 100644 --- a/c++/src/H5CompType.cpp +++ b/c++/src/H5CompType.cpp @@ -80,6 +80,7 @@ size_t CompType::getMemberOffset( int member_num ) const int CompType::getMemberDims( int member_num, size_t* dims, int* perm ) const { throw DataTypeIException( "Error: getMemberDims is no longer supported." ); + return (-1); } // Gets the type class of the specified member. diff --git a/c++/src/H5CompType.h b/c++/src/H5CompType.h index 9b2c983..976cb17 100644 --- a/c++/src/H5CompType.h +++ b/c++/src/H5CompType.h @@ -14,7 +14,7 @@ class CompType : public DataType { CompType(); // Creates a compound datatype using an existing id - CompType( hid_t existing_id ); + CompType( const hid_t existing_id ); // Copy constructor - makes a copy of original object CompType( const CompType& original ); diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 1cc66a2..efdf8a2 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -102,6 +102,7 @@ hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const //{ //throw DataSetIException(); //} + return(-1); } // Reclaims VL datatype memory buffers. diff --git a/c++/src/H5EnumType.h b/c++/src/H5EnumType.h index 92583aa..d74ca58 100644 --- a/c++/src/H5EnumType.h +++ b/c++/src/H5EnumType.h @@ -16,7 +16,7 @@ class EnumType : public DataType { EnumType(); // Creates an enumeration datatype using an existing id - EnumType( hid_t existing_id ); + EnumType( const hid_t existing_id ); // Copy constructor: makes a copy of the original EnumType object. EnumType( const EnumType& original ); diff --git a/c++/src/H5FloatType.h b/c++/src/H5FloatType.h index cc9efec..865d384 100644 --- a/c++/src/H5FloatType.h +++ b/c++/src/H5FloatType.h @@ -11,7 +11,7 @@ class FloatType : public AtomType { FloatType(); // Creates a floating-point datatype using an existing id - FloatType( hid_t existing_id ); + FloatType( const hid_t existing_id ); // Creates a floating-point type using a predefined type FloatType( const PredType& pred_type ); diff --git a/c++/src/H5IdComponent.cpp b/c++/src/H5IdComponent.cpp index 2b7bff8..fbbd80e 100644 --- a/c++/src/H5IdComponent.cpp +++ b/c++/src/H5IdComponent.cpp @@ -20,7 +20,7 @@ IdComponent::IdComponent() : id( 0 ) // Constructor that takes an HDF5 object id. It creates an instance // of IdComponent to hold the HDF5 id -IdComponent::IdComponent( hid_t h5_id ) : id( h5_id ) +IdComponent::IdComponent( const hid_t h5_id ) : id( h5_id ) { // starts counting object references ref_count = new RefCounter; @@ -82,7 +82,7 @@ IdComponent& IdComponent::operator=( const IdComponent& rhs ) its identifier, its reference counter will be deleted. A new reference counter is created for the new HDF5 object id. */ -void IdComponent::setId( hid_t new_id ) +void IdComponent::setId( const hid_t new_id ) { // reset the identifier of this object, call appropriate H5Xclose resetIdComponent( this ); diff --git a/c++/src/H5IdComponent.h b/c++/src/H5IdComponent.h index 0ac9996..2c8b88f 100644 --- a/c++/src/H5IdComponent.h +++ b/c++/src/H5IdComponent.h @@ -12,14 +12,14 @@ class IdComponent { public: // Parent classes must reset the current IdComponent copy // before setting new id to control reference count - void setId( hid_t new_id ); + void setId( const hid_t new_id ); // Pure virtual function so appropriate close function can // be called by subclasses' for the corresponding object virtual void p_close() const = 0; // Creates an object to hold an HDF5 identifier - IdComponent( hid_t h5_id ); + IdComponent( const hid_t h5_id ); // Copy constructor: makes copy of the original IdComponent object. IdComponent( const IdComponent& original ); diff --git a/c++/src/H5IntType.h b/c++/src/H5IntType.h index 56c4792..224a2cc 100644 --- a/c++/src/H5IntType.h +++ b/c++/src/H5IntType.h @@ -11,7 +11,7 @@ class IntType : public AtomType { IntType(); // Creates a integer datatype using an existing id - IntType( hid_t existing_id ); + IntType( const hid_t existing_id ); // Creates a integer type using a predefined type IntType( const PredType& pred_type ); diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 82f7849..a692d0d 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -22,7 +22,11 @@ namespace H5 { extern "C" herr_t userAttrOpWrpr( hid_t loc_id, const char* attr_name, void* op_data ) { string s_attr_name = string( attr_name ); +#ifdef NO_STATIC_CAST + UserData4Aiterate* myData = (UserData4Aiterate *) op_data; +#else UserData4Aiterate* myData = static_cast (op_data); +#endif myData->op( *myData->object, s_attr_name, myData->opData ); return 0; } @@ -32,7 +36,7 @@ extern "C" herr_t userAttrOpWrpr( hid_t loc_id, const char* attr_name, void* op_ H5Object::H5Object() : IdComponent() {} // Constructs an object from an existing HDF5 id -H5Object::H5Object( hid_t object_id ) : IdComponent( object_id ) {} +H5Object::H5Object( const hid_t object_id ) : IdComponent( object_id ) {} // Copy constructor: makes a copy of the original H5Object instance H5Object::H5Object( const H5Object& original ) : IdComponent( original ) {} @@ -85,7 +89,7 @@ Attribute H5Object::openAttribute( const string& name ) const } // Opens an attribute given its index. -Attribute H5Object::openAttribute( unsigned int idx ) const +Attribute H5Object::openAttribute( const unsigned int idx ) const { hid_t attr_id = H5Aopen_idx( id, idx ); if( attr_id > 0 ) diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index deada00..a209b97 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -181,7 +181,8 @@ void PredType::commit( H5Object& loc, const string& name ) bool PredType::committed() { - throw DataTypeIException( "Attempting to check for commit status on a predefined datatype. This operation is invalid" ); + throw DataTypeIException( "Error: Attempting to check for commit status on a predefined datatype." ); + return (-1); } // Destructor: calls ~AtomType immediately diff --git a/c++/src/H5RefCounter.h b/c++/src/H5RefCounter.h index dec1b3c..17c00d4 100644 --- a/c++/src/H5RefCounter.h +++ b/c++/src/H5RefCounter.h @@ -1,10 +1,28 @@ -#ifndef _H5RefCounter_H -#define _H5RefCounter_H +//#ifndef _H5RefCounter_H +//#define _H5RefCounter_H +#ifndef _MY_RefCounter +#define _MY_RefCounter #ifndef H5_NO_NAMESPACE namespace H5 { #endif +// define bool type for platforms that don't support bool yet +// Note: it is added here because most of the C++ library source +// files include this header file +#ifdef BOOL_NOTDEFINED +#ifdef false +#undef false +#endif +#ifdef true +#undef true +#endif +typedef int bool; +const bool false = 0; +const bool true = 1; + +#endif + class RefCounter { public: // Creates a reference counter to be used by an HDF5 object diff --git a/c++/src/H5StrType.h b/c++/src/H5StrType.h index 2ba6779..9b504f4 100644 --- a/c++/src/H5StrType.h +++ b/c++/src/H5StrType.h @@ -14,7 +14,7 @@ class StrType : public AtomType { StrType( const PredType& pred_type ); // Creates a string datatype using an existing id - StrType( hid_t existing_id ); + StrType( const hid_t existing_id ); // Copy constructor - makes a copy of the original object StrType( const StrType& original ); -- cgit v0.12