diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2007-09-13 15:44:56 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2007-09-13 15:44:56 (GMT) |
commit | 579284f422b6ed25b7a5f4a518c19740fff297c8 (patch) | |
tree | 564b2a7b4c13854a19ffaf465f94e6abd52d6340 /src | |
parent | 15d118faedd8e61e8ec2a715cf8fcea5b1afab35 (diff) | |
download | hdf5-579284f422b6ed25b7a5f4a518c19740fff297c8.zip hdf5-579284f422b6ed25b7a5f4a518c19740fff297c8.tar.gz hdf5-579284f422b6ed25b7a5f4a518c19740fff297c8.tar.bz2 |
[svn-r14144] Description:
Move H5Gget_objinfo() to deprecated symbols section and retarget
internal usage to H5Lget_info()/H5Oget_info().
Misc. other code cleanups...
Tested on:
FreeBSD/32 6.2 (duty)
FreeBSD/64 6.2 (liberty)
Linux/32 2.6 (kagiso)
Linux/64 2.6 (smirom)
AIX/32 5.3 (copper)
Solaris/32 2.10 (linew)
Mac OS X/32 10.4.10 (amazon)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Epublic.h | 8 | ||||
-rw-r--r-- | src/H5FD.c | 2 | ||||
-rw-r--r-- | src/H5Gdeprec.c | 92 | ||||
-rw-r--r-- | src/H5Gpublic.h | 80 | ||||
-rw-r--r-- | src/H5Opublic.h | 32 | ||||
-rw-r--r-- | src/H5Osdspace.c | 3 | ||||
-rw-r--r-- | src/H5Tconv.c | 2 | ||||
-rw-r--r-- | src/H5private.h | 9 | ||||
-rw-r--r-- | src/H5public.h | 18 | ||||
-rw-r--r-- | src/H5trace.c | 2 |
10 files changed, 126 insertions, 122 deletions
diff --git a/src/H5Epublic.h b/src/H5Epublic.h index e690eaa..7b716ef 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -63,11 +63,9 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; /* * One often needs to temporarily disable automatic error reporting when - * trying something that's likely or expected to fail. For instance, to - * determine if an object exists one can call H5Gget_objinfo() which will fail if - * the object doesn't exist. The code to try can be nested between calls to - * H5Eget_auto() and H5Eset_auto(), but it's easier just to use this macro - * like: + * trying something that's likely or expected to fail. The code to try can + * be nested between calls to H5Eget_auto() and H5Eset_auto(), but it's + * easier just to use this macro like: * H5E_BEGIN_TRY { * ...stuff here that's likely to fail... * } H5E_END_TRY; @@ -87,7 +87,7 @@ H5FL_BLK_DEFINE_STATIC(meta_accum); /* * Global count of the number of H5FD_t's handed out. This is used as a * "serial number" for files that are currently open and is used for the - * 'fileno' field in H5G_stat_t. However, if a VFL driver is not able + * 'fileno' field in H5O_info_t. However, if a VFL driver is not able * to detect whether two files are the same, a file that has been opened * by H5Fopen more than once with that VFL driver will have two different * serial numbers. :-/ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index bf90f1e..54e2cd3 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -57,6 +57,7 @@ /* Local Typedefs */ /******************/ +#ifndef H5_NO_DEPRECATED_SYMBOLS /* User data for path traversal routine for getting object info */ typedef struct { H5G_stat_t *statbuf; /* Stat buffer about object */ @@ -75,17 +76,16 @@ typedef struct { /* Local Prototypes */ /********************/ -#ifndef H5_NO_DEPRECATED_SYMBOLS static herr_t H5G_link_hard(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, const char *new_name); static herr_t H5G_move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name); -#endif /* H5_NO_DEPRECATED_SYMBOLS */ static herr_t H5G_get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); static herr_t H5G_get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5G_stat_t *statbuf/*out*/, hid_t dxpl_id); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ /*********************/ @@ -837,50 +837,6 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Gget_num_objs() */ -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - - -/*------------------------------------------------------------------------- - * Function: H5Gget_objtype_by_idx - * - * Purpose: Returns the type of objects in the group by giving index. - * - * Note: Deprecated in favor of H5Lget_info/H5Oget_info - * - * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3) - * Failure: H5G_UNKNOWN - * - * Programmer: Raymond Lu - * Nov 20, 2002 - * - *------------------------------------------------------------------------- - */ -H5G_obj_t -H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) -{ - H5G_loc_t loc; /* Object location */ - H5O_type_t obj_type; /* Type of object at location */ - H5G_obj_t ret_value; - - FUNC_ENTER_API(H5Gget_objtype_by_idx, H5G_UNKNOWN) - H5TRACE2("Go", "ih", loc_id, idx); - - /* Check args */ - if(H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID") - if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") - if(obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") - - /* Call internal function*/ - if((ret_value = H5G_obj_get_type_by_idx(loc.oloc, idx, H5AC_ind_dxpl_id)) == H5G_UNKNOWN) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object type") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Gget_objtype_by_idx() */ - /*------------------------------------------------------------------------- * Function: H5Gget_objinfo @@ -1072,3 +1028,47 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_get_objinfo() */ +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + +/*------------------------------------------------------------------------- + * Function: H5Gget_objtype_by_idx + * + * Purpose: Returns the type of objects in the group by giving index. + * + * Note: Deprecated in favor of H5Lget_info/H5Oget_info + * + * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3) + * Failure: H5G_UNKNOWN + * + * Programmer: Raymond Lu + * Nov 20, 2002 + * + *------------------------------------------------------------------------- + */ +H5G_obj_t +H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) +{ + H5G_loc_t loc; /* Object location */ + H5O_type_t obj_type; /* Type of object at location */ + H5G_obj_t ret_value; + + FUNC_ENTER_API(H5Gget_objtype_by_idx, H5G_UNKNOWN) + H5TRACE2("Go", "ih", loc_id, idx); + + /* Check args */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID") + if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") + if(obj_type != H5O_TYPE_GROUP) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group") + + /* Call internal function*/ + if((ret_value = H5G_obj_get_type_by_idx(loc.oloc, idx, H5AC_ind_dxpl_id)) == H5G_UNKNOWN) + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object type") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Gget_objtype_by_idx() */ + diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 6f4bc00..510c920 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -39,14 +39,6 @@ /* Public Macros */ /*****************/ -/* Deprecated macros, for backward compatibility */ - -/* Macros for types of objects in a group (see H5G_obj_t definition) */ -#define H5G_NTYPES 256 /* Max possible number of types */ -#define H5G_NLIBTYPES 8 /* Number of internal types */ -#define H5G_NUSERTYPES (H5G_NTYPES-H5G_NLIBTYPES) -#define H5G_USERTYPE(X) (8+(X)) /* User defined types */ - #ifdef __cplusplus extern "C" { #endif @@ -71,38 +63,6 @@ typedef struct H5G_info_t { int64_t max_corder; /* Current max. creation order value for group */ } H5G_info_t; -/* Deprecated typedefs, for backward compatibility */ - -/* - * An object has a certain type. The first few numbers are reserved for use - * internally by HDF5. Users may add their own types with higher values. The - * values are never stored in the file -- they only exist while an - * application is running. An object may satisfy the `isa' function for more - * than one type. - */ -typedef enum H5G_obj_t { - H5G_UNKNOWN = -1, /* Unknown object type */ - H5G_GROUP, /* Object is a group */ - H5G_DATASET, /* Object is a dataset */ - H5G_TYPE, /* Object is a named data type */ - H5G_LINK, /* Object is a symbolic link */ - H5G_UDLINK, /* Object is a user-defined link */ - H5G_RESERVED_5, /* Reserved for future use */ - H5G_RESERVED_6, /* Reserved for future use */ - H5G_RESERVED_7 /* Reserved for future use */ -} H5G_obj_t; - -/* Information about an object */ -typedef struct H5G_stat_t { - unsigned long fileno[2]; /*file number */ - unsigned long objno[2]; /*object number */ - unsigned nlink; /*number of hard links to object*/ - H5G_obj_t type; /*basic object type */ - time_t mtime; /*modification time */ - size_t linklen; /*symbolic link value length */ - H5O_stat_t ohdr; /* Object header information */ -} H5G_stat_t; - /********************/ /* Public Variables */ /********************/ @@ -128,11 +88,28 @@ H5_DLL herr_t H5Gclose(hid_t group_id); * * Use of these functions and variables is deprecated. */ +/* + * An object has a certain type. The first few numbers are reserved for use + * internally by HDF5. Users may add their own types with higher values. The + * values are never stored in the file -- they only exist while an + * application is running. An object may satisfy the `isa' function for more + * than one type. + */ +typedef enum H5G_obj_t { + H5G_UNKNOWN = -1, /* Unknown object type */ + H5G_GROUP, /* Object is a group */ + H5G_DATASET, /* Object is a dataset */ + H5G_TYPE, /* Object is a named data type */ + H5G_LINK, /* Object is a symbolic link */ + H5G_UDLINK, /* Object is a user-defined link */ + H5G_RESERVED_5, /* Reserved for future use */ + H5G_RESERVED_6, /* Reserved for future use */ + H5G_RESERVED_7 /* Reserved for future use */ +} H5G_obj_t; + H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char* name, size_t size); H5_DLL H5G_obj_t H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx); -H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, - hbool_t follow_link, H5G_stat_t *statbuf/*out*/); /* Symbols defined for compatibility with previous versions of the HDF5 API. * * Use of these symbols is deprecated. @@ -148,12 +125,29 @@ H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, #define H5G_LINK_SOFT H5L_TYPE_SOFT #define H5G_link_t H5L_type_t +/* Macros for types of objects in a group (see H5G_obj_t definition) */ +#define H5G_NTYPES 256 /* Max possible number of types */ +#define H5G_NLIBTYPES 8 /* Number of internal types */ +#define H5G_NUSERTYPES (H5G_NTYPES - H5G_NLIBTYPES) +#define H5G_USERTYPE(X) (8 + (X)) /* User defined types */ + /* Typedefs */ /* Prototype for H5Giterate() operator */ typedef herr_t (*H5G_iterate_t)(hid_t group, const char *name, void *op_data); +/* Information about an object */ +typedef struct H5G_stat_t { + unsigned long fileno[2]; /*file number */ + unsigned long objno[2]; /*object number */ + unsigned nlink; /*number of hard links to object*/ + H5G_obj_t type; /*basic object type */ + time_t mtime; /*modification time */ + size_t linklen; /*symbolic link value length */ + H5O_stat_t ohdr; /* Object header information */ +} H5G_stat_t; + /* Function prototypes */ H5_DLL hid_t H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint); @@ -175,6 +169,8 @@ H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, H5_DLL herr_t H5Giterate(hid_t loc_id, const char *name, int *idx, H5G_iterate_t op, void *op_data); H5_DLL herr_t H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs); +H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, + hbool_t follow_link, H5G_stat_t *statbuf/*out*/); #endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/src/H5Opublic.h b/src/H5Opublic.h index 17fe139..41e9f18 100644 --- a/src/H5Opublic.h +++ b/src/H5Opublic.h @@ -77,20 +77,14 @@ /*******************/ /* Public Typedefs */ /*******************/ -/* A struct that's part of the H5G_stat_t routine (deprecated) */ -typedef struct H5O_stat_t { - hsize_t size; /* Total size of object header in file */ - hsize_t free; /* Free space within object header */ - unsigned nmesgs; /* Number of object header messages */ - unsigned nchunks; /* Number of object header chunks */ -} H5O_stat_t; /* Types of objects in file */ typedef enum H5O_type_t { H5O_TYPE_UNKNOWN = -1, /* Unknown object type */ H5O_TYPE_GROUP, /* Object is a group */ H5O_TYPE_DATASET, /* Object is a dataset */ - H5O_TYPE_NAMED_DATATYPE /* Object is a named data type */ + H5O_TYPE_NAMED_DATATYPE, /* Object is a named data type */ + H5O_TYPE_NTYPES /* Number of different object types (must be last!) */ } H5O_type_t; /* Information struct for object (for H5Oget_info/H5Oget_info_by_idx) */ @@ -162,6 +156,28 @@ H5_DLL ssize_t H5Oget_comment(hid_t loc_id, const char *name, char *comment, size_t bufsize, hid_t lapl_id); H5_DLL herr_t H5Oclose(hid_t object_id); +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/* Macros */ + +/* Typedefs */ + +/* A struct that's part of the H5G_stat_t routine (deprecated) */ +typedef struct H5O_stat_t { + hsize_t size; /* Total size of object header in file */ + hsize_t free; /* Free space within object header */ + unsigned nmesgs; /* Number of object header messages */ + unsigned nchunks; /* Number of object header chunks */ +} H5O_stat_t; + +/* Function prototypes */ + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + #ifdef __cplusplus } #endif diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 3581863..5e8a7a4 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -165,11 +165,10 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, unsigned UNUSED mesg_flags, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") for(i = 0; i < sdim->rank; i++) { H5F_DECODE_LENGTH(f, p, sdim->size[i]); -#ifndef H5_HAVE_LARGE_HSIZET + /* Rudimentary check for overflow of the dimension size */ if(sdim->size[i] == 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, NULL, "invalid size detected") -#endif /* H5_HAVE_LARGE_HSIZET */ } /* end for */ if(flags & H5S_VALID_MAX) { diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 92dfdfc..7094fe0 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -1026,7 +1026,7 @@ H5T_conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, * the addresses in the file must be) and just get out now, there * is no need to convert the object reference. Yes, this is * icky and non-portable, but I can't think of a better way to - * support allowing the objno in the H5G_stat_t struct and the + * support allowing the objno in the H5O_info_t struct and the * hobj_ref_t type to be compared directly without introducing a * "native" hobj_ref_t datatype and I think that would break a * lot of existing programs. -QAK diff --git a/src/H5private.h b/src/H5private.h index 184ef7c..dad4e13 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -412,13 +412,12 @@ # define SIZET_MAX ((size_t)(ssize_t)(-1)) # define SSIZET_MAX ((ssize_t)(((size_t)1<<(8*sizeof(ssize_t)-1))-1)) #endif -#ifdef H5_HAVE_LARGE_HSIZET + +/* + * Maximum & minimum values for our typedefs. + */ #define HSIZET_MAX ((hsize_t)ULLONG_MAX) #define HSSIZET_MAX ((hssize_t)LLONG_MAX) -#else /* H5_HAVE_LARGE_HSIZET */ -#define HSIZET_MAX ((hsize_t)SIZET_MAX) -#define HSSIZET_MAX ((hssize_t)SSIZET_MAX) -#endif /* H5_HAVE_LARGE_HSIZET */ #define HSSIZET_MIN (~(HSSIZET_MAX)) /* diff --git a/src/H5public.h b/src/H5public.h index 6b66d7a..00ca6ab 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -148,23 +148,17 @@ typedef long_long ssize_t; #endif /* - * The sizes of file objects have their own types defined here. If large - * sizes are enabled then use a 64-bit data type, otherwise use the size of - * memory objects. + * The sizes of file objects have their own types defined here, use a 64-bit + * type. */ -#ifdef H5_HAVE_LARGE_HSIZET -# if H5_SIZEOF_LONG_LONG>=8 +#if H5_SIZEOF_LONG_LONG >= 8 typedef unsigned long_long hsize_t; typedef signed long_long hssize_t; # define H5_SIZEOF_HSIZE_T H5_SIZEOF_LONG_LONG # define H5_SIZEOF_HSSIZE_T H5_SIZEOF_LONG_LONG -# endif -#else /* H5_HAVE_LARGE_HSIZET */ -typedef size_t hsize_t; -typedef ssize_t hssize_t; -# define H5_SIZEOF_HSIZE_T H5_SIZEOF_SIZE_T -# define H5_SIZEOF_HSSIZE_T H5_SIZEOF_SIZE_T -#endif /* H5_HAVE_LARGE_HSIZET */ +#else +# error "nothing appropriate for hsize_t" +#endif /* * File addresses have their own types. diff --git a/src/H5trace.c b/src/H5trace.c index 77e1984..7c2587d 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -695,6 +695,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) } break; +#ifndef H5_NO_DEPRECATED_SYMBOLS case 's': if(ptr) { if(vp) @@ -707,6 +708,7 @@ H5_trace (const double *returning, const char *func, const char *type, ...) fprintf(out, "0x%lx", (unsigned long)statbuf); } break; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ default: fprintf(out, "BADTYPE(G%c)", type[1]); |