diff options
author | Robb Matzke <matzke@llnl.gov> | 1999-03-12 18:35:04 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1999-03-12 18:35:04 (GMT) |
commit | b8ef51ee7a0cf3fd27ccedac81f637ac10c75942 (patch) | |
tree | ef99f4a38d89b682fa065ffb45c83ce0f2574aac /src/H5A.c | |
parent | d6cc19e3f2f84d50e1a62b004a34d6c2a9734a10 (diff) | |
download | hdf5-b8ef51ee7a0cf3fd27ccedac81f637ac10c75942.zip hdf5-b8ef51ee7a0cf3fd27ccedac81f637ac10c75942.tar.gz hdf5-b8ef51ee7a0cf3fd27ccedac81f637ac10c75942.tar.bz2 |
[svn-r1138] Changes since 19990304
----------------------
./config/*-aix4.* [REMOVED]
./config/*-aix4.x [NEW]
./config/solaris2.5 [REMOVED]
./config/solaris2.x [NEW]
./configure.in
./configure [REGENERATED]
./MANIFEST
Changed the names of the IBM-SP2 config files by replacing the
minor version numbers with an `x'. The solaris config warns
about old versions of gcc.
The RUNSERIAL value is set to the empty string by default. The
config/* file (or user) can override it by setting it to some
other value.
The `--enable-parallel' with no flags turns on the
HAVE_PARALLEL constant in the source code but doesn't add any
MPI or MPI-IO libraries to the link line.
If we are compiling for parallel then configure checks that we
can actually link a very simple program. This has the benefit
of detecting config errors before we waste time compiling the
entire library.
Configure recognizes `mpcc_r' as a parallel compiler.
./src/H5A.c
./src/H5Apublic.c
Fixed some compiler warnings. Changed the return type of
H5Aget_name() from hssize_t to ssize_t because the name can
never be larger then memory.
Diffstat (limited to 'src/H5A.c')
-rw-r--r-- | src/H5A.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -970,37 +970,39 @@ H5Aget_type(hid_t attr_id) the string terminator is stored in the last position of the buffer to properly terminate the string. --------------------------------------------------------------------------*/ -hssize_t +ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) { H5A_t *attr = NULL; - size_t copy_len=0; - hssize_t ret_value = FAIL; + size_t copy_len, nbytes; + ssize_t ret_value = FAIL; FUNC_ENTER(H5Aget_name, FAIL); - H5TRACE3("Hs","izs",attr_id,buf_size,buf); + H5TRACE3("Zs","izs",attr_id,buf_size,buf); /* check arguments */ if (H5I_ATTR != H5I_get_type(attr_id) || (NULL == (attr = H5I_object(attr_id)))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute"); } - if (!buf || buf_size==0) { + if (!buf || buf_size<1) { HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer"); } /* get the real attribute length */ - ret_value=(hssize_t)HDstrlen(attr->name); + nbytes = HDstrlen(attr->name); + assert((ssize_t)nbytes>=0); /*overflow, pretty unlikey --rpm*/ /* compute the string length which will fit into the user's buffer */ - copy_len=MIN(buf_size-1,ret_value); + copy_len = MIN(buf_size-1, nbytes); /* Copy all/some of the name */ - HDmemcpy(buf,attr->name,copy_len); + HDmemcpy(buf, attr->name, copy_len); /* Terminate the string */ buf[copy_len]='\0'; + ret_value = (ssize_t)nbytes; FUNC_LEAVE(ret_value); } /* H5Aget_type() */ |