summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-08-29 23:37:41 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-08-29 23:37:41 (GMT)
commit71d6bffdd745c865e988b29fac8d0173d7fa0131 (patch)
tree30e3ef0aece889d65fac25b0b038f6b7cc965497
parentdb3c155bf296fa06ab0df56bb7307f2ba19613e5 (diff)
downloadhdf5-71d6bffdd745c865e988b29fac8d0173d7fa0131.zip
hdf5-71d6bffdd745c865e988b29fac8d0173d7fa0131.tar.gz
hdf5-71d6bffdd745c865e988b29fac8d0173d7fa0131.tar.bz2
[svn-r14127] Description:
Move H5Gget_linkval to deprecated symbol section and replace with H5Lget_val for internal calls. Tested on: FreeBSD/32 6.2 (duty) FreeBSD/64 6.2 (liberty) Linux/32 2.6 (kagiso) Linux/64 2.6 (smirom) Solaris/32 5.10 (linew) Mac OS X/32 10.4.10 (amazon)
-rw-r--r--c++/src/H5CommonFG.cpp4
-rw-r--r--fortran/src/H5Gf.c71
-rw-r--r--src/H5Gdeprec.c2
-rw-r--r--src/H5Gpublic.h4
-rw-r--r--test/links.c83
-rw-r--r--test/unlink.c16
-rw-r--r--tools/lib/h5diff.c24
-rw-r--r--tools/lib/h5trav.c153
8 files changed, 174 insertions, 183 deletions
diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp
index 34398e7..5904f67 100644
--- a/c++/src/H5CommonFG.cpp
+++ b/c++/src/H5CommonFG.cpp
@@ -416,10 +416,10 @@ H5std_string CommonFG::getLinkval( const char* name, size_t size ) const
{
char* value_C = new char[size+1]; // temporary C-string for C API
- herr_t ret_value = H5Gget_linkval( getLocId(), name, size, value_C );
+ herr_t ret_value = H5Lget_val( getLocId(), name, value_C, size, H5P_DEFAULT );
if( ret_value < 0 )
{
- throwException("getLinkval", "H5Gget_linkval failed");
+ throwException("getLinkval", "H5Lget_val failed");
}
H5std_string value = H5std_string( value_C );
delete []value_C;
diff --git a/fortran/src/H5Gf.c b/fortran/src/H5Gf.c
index 5dd00b0..3b25a79 100644
--- a/fortran/src/H5Gf.c
+++ b/fortran/src/H5Gf.c
@@ -523,51 +523,46 @@ DONE:
*---------------------------------------------------------------------------*/
int_f
-nh5gget_linkval_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size, _fcd value )
+nh5gget_linkval_c(hid_t_f *loc_id, _fcd name, int_f *namelen, size_t_f *size,
+ _fcd value)
{
- int ret_value = -1;
- hid_t c_loc_id;
- char *c_name;
- size_t c_namelen;
- char *c_value = NULL;
- size_t c_size;
- herr_t c_ret_value;
- /*
- * Convert Fortran name to C name
- */
- c_namelen = *namelen;
- c_name = (char *)HD5f2cstring(name, c_namelen);
- if(c_name == NULL) return ret_value;
-
- /*
- * Allocate buffer to hold name of the value
- */
- if(*size) c_value = (char *)HDmalloc((size_t)*size);
- if(c_value == NULL) {
- HDfree(c_name);
- return ret_value;
- }
+ char *c_name = NULL;
+ char *c_value = NULL;
+ int ret_value = -1;
- /*
- * Call H5Gget_linkval function
- */
+ /*
+ * Convert Fortran name to C name
+ */
+ if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen)))
+ goto DONE;
- c_size = (size_t)*size;
- c_loc_id = (hid_t)*loc_id;
- c_ret_value = H5Gget_linkval(c_loc_id, c_name, c_size, c_value);
- if(c_ret_value < 0) goto DONE;
+ /*
+ * Allocate buffer to hold name of the value
+ */
+ if(*size) c_value = (char *)HDmalloc((size_t)*size);
+ if(c_value == NULL) {
+ HDfree(c_name);
+ return ret_value;
+ }
+ /*
+ * Call H5Lget_val function
+ */
+ if(H5Lget_val((hid_t)*loc_id, c_name, c_value, (size_t)*size, H5P_DEFAULT) < 0)
+ goto DONE;
- /*
- * Convert C name to FORTRAN and place it in the given buffer
- */
- HD5packFstring(c_value, _fcdtocp(value), (size_t)*size);
- ret_value = 0;
+ /*
+ * Convert C name to FORTRAN and place it in the given buffer
+ */
+ HD5packFstring(c_value, _fcdtocp(value), (size_t)*size);
+ ret_value = 0;
DONE:
- HDfree(c_value);
- HDfree(c_name);
- return ret_value ;
+ if(c_value)
+ HDfree(c_value);
+ if(c_name)
+ HDfree(c_name);
+ return ret_value;
}
/*----------------------------------------------------------------------------
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index 4e16430..2662778 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -553,7 +553,6 @@ H5Gunlink(hid_t loc_id, const char *name)
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gunlink() */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
/*-------------------------------------------------------------------------
@@ -586,6 +585,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gget_linkval() */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
/*-------------------------------------------------------------------------
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index 4e2e262..e0133c5 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -137,8 +137,6 @@ H5_DLL herr_t H5Gclose(hid_t group_id);
*
* Use of these functions and variables is deprecated.
*/
-H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size,
- char *buf/*out*/);
H5_DLL ssize_t H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char* name,
size_t size);
H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment);
@@ -170,6 +168,8 @@ H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name,
H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
const char *dst_name);
H5_DLL herr_t H5Gunlink(hid_t loc_id, const char *name);
+H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size,
+ char *buf/*out*/);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/test/links.c b/test/links.c
index 02ef664..8e87ecc 100644
--- a/test/links.c
+++ b/test/links.c
@@ -294,108 +294,109 @@ cklinks(hid_t fapl, hbool_t new_format)
/* Open the file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
/* Hard link */
- if (H5Gget_objinfo(file, "d1", TRUE, &sb1) < 0) TEST_ERROR
- if (H5Gget_objinfo(file, "grp1/hard", TRUE, &sb2) < 0) TEST_ERROR
- if (H5G_DATASET!=sb2.type) {
+ if(H5Gget_objinfo(file, "d1", TRUE, &sb1) < 0) FAIL_STACK_ERROR
+ if(H5Gget_objinfo(file, "grp1/hard", TRUE, &sb2) < 0) FAIL_STACK_ERROR
+ if(H5G_DATASET != sb2.type) {
H5_FAILED();
printf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
TEST_ERROR
- }
- if (HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) {
+ } /* end if */
+ if(HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) {
H5_FAILED();
puts(" Hard link test failed. Link seems not to point to the ");
puts(" expected file location.");
TEST_ERROR
- }
- if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) TEST_ERROR
- if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) TEST_ERROR
+ } /* end if */
+ if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
/* Symbolic link */
- if (H5Gget_objinfo(file, "grp1/soft", TRUE, &sb2) < 0) TEST_ERROR
- if (H5G_DATASET!=sb2.type) {
+ if(H5Gget_objinfo(file, "grp1/soft", TRUE, &sb2) < 0) FAIL_STACK_ERROR
+ if(H5G_DATASET != sb2.type) {
H5_FAILED();
printf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
TEST_ERROR
- }
- if (HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) {
+ } /* end if */
+ if(HDmemcmp(&sb1.objno, &sb2.objno, sizeof(sb1.objno))) {
H5_FAILED();
puts(" Soft link test failed. Link seems not to point to the ");
puts(" expected file location.");
TEST_ERROR
- }
- if (H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) TEST_ERROR
- if (HDstrcmp(linkval, "/d1")) {
+ } /* end if */
+ if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(HDstrcmp(linkval, "/d1")) {
H5_FAILED();
puts(" Soft link test failed. Wrong link value");
TEST_ERROR
- }
- if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) TEST_ERROR
+ } /* end if */
+ if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
/* Dangling link */
H5E_BEGIN_TRY {
status = H5Gget_objinfo(file, "grp1/dangle", TRUE, &sb2);
} H5E_END_TRY;
- if (status>=0) {
+ if(status >= 0) {
H5_FAILED();
puts(" H5Gget_objinfo() should have failed for a dangling link.");
TEST_ERROR
- }
- if (H5Gget_objinfo(file, "grp1/dangle", FALSE, &sb2) < 0) TEST_ERROR
- if (H5G_LINK!=sb2.type) {
+ } /* end if */
+ if(H5Gget_objinfo(file, "grp1/dangle", FALSE, &sb2) < 0) FAIL_STACK_ERROR
+ if(H5G_LINK != sb2.type) {
H5_FAILED();
printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
TEST_ERROR
- }
- if (H5Gget_linkval(file, "grp1/dangle", sizeof linkval, linkval) < 0) {
+ } /* end if */
+ if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
H5_FAILED();
printf(" %d: Can't retrieve link value\n", __LINE__);
TEST_ERROR
- }
- if (HDstrcmp(linkval, "foobar")) {
+ } /* end if */
+ if(HDstrcmp(linkval, "foobar")) {
H5_FAILED();
puts(" Dangling link test failed. Wrong link value");
TEST_ERROR
- }
- if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) TEST_ERROR
+ } /* end if */
+ if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
/* Recursive link */
H5E_BEGIN_TRY {
status = H5Gget_objinfo(file, "grp1/recursive", TRUE, &sb2);
} H5E_END_TRY;
- if (status>=0) {
+ if(status >= 0) {
H5_FAILED();
puts(" H5Gget_objinfo() should have failed for a recursive link.");
TEST_ERROR
- }
- if (H5Gget_objinfo(file, "grp1/recursive", FALSE, &sb2) < 0) TEST_ERROR
- if (H5G_LINK!=sb2.type) {
+ } /* end if */
+ if(H5Gget_objinfo(file, "grp1/recursive", FALSE, &sb2) < 0) FAIL_STACK_ERROR
+ if(H5G_LINK != sb2.type) {
H5_FAILED();
printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
TEST_ERROR
- }
- if (H5Gget_linkval(file, "grp1/recursive", sizeof linkval, linkval) < 0) {
+ } /* end if */
+ if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
H5_FAILED();
printf(" %d: Can't retrieve link value\n", __LINE__);
TEST_ERROR
- }
- if (HDstrcmp(linkval, "/grp1/recursive")) {
+ } /* end if */
+ if(HDstrcmp(linkval, "/grp1/recursive")) {
H5_FAILED();
puts(" Recursive link test failed. Wrong link value");
TEST_ERROR
- }
+ } /* end if */
/* Non-existant link */
- if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) TEST_ERROR
+ if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) FAIL_STACK_ERROR
/* Cleanup */
- if (H5Fclose(file) < 0) TEST_ERROR
+ if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+
PASSED();
return 0;
- error:
+error:
return -1;
}
@@ -4365,7 +4366,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format)
}
/* Fill the query buffer */
- if(H5Gget_linkval(fid, UD_CB_LINK_NAME, (size_t)NAME_BUF_SIZE, query_buf) < 0) FAIL_STACK_ERROR
+ if(H5Lget_val(fid, UD_CB_LINK_NAME, query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(HDstrcmp(query_buf, "query succeeded") != 0) TEST_ERROR
/* Move the link */
diff --git a/test/unlink.c b/test/unlink.c
index 106da0d..170c87d 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -447,32 +447,32 @@ check_new_move(hid_t fapl)
/* Open file */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
- if((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
/* Get hard link info */
- if(H5Gget_objinfo(file, "/group2/group_new_name", TRUE, &sb_hard1) < 0) TEST_ERROR
- if(H5Gget_objinfo(file, "/group1/hard", TRUE, &sb_hard2) < 0) TEST_ERROR
+ if(H5Gget_objinfo(file, "/group2/group_new_name", TRUE, &sb_hard1) < 0) FAIL_STACK_ERROR
+ if(H5Gget_objinfo(file, "/group1/hard", TRUE, &sb_hard2) < 0) FAIL_STACK_ERROR
/* Check hard links */
- if(H5G_GROUP!=sb_hard1.type || H5G_GROUP!=sb_hard2.type)
+ if(H5G_GROUP != sb_hard1.type || H5G_GROUP != sb_hard2.type)
FAIL_PUTS_ERROR(" Unexpected object type, should have been a group")
if(HDmemcmp(&sb_hard1.objno, &sb_hard2.objno, sizeof(sb_hard1.objno)))
FAIL_PUTS_ERROR(" Hard link test failed. Link seems not to point to the expected file location.")
/* Check soft links */
- if(H5Gget_linkval(file, "group2/soft", sizeof linkval, linkval) < 0) TEST_ERROR
+ if(H5Lget_val(file, "group2/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(HDstrcmp(linkval, "/group1/group_move"))
FAIL_PUTS_ERROR(" Soft link test failed. Wrong link value")
/* Cleanup */
- if(H5Fclose(file) < 0) TEST_ERROR
+ if(H5Fclose(file) < 0) FAIL_STACK_ERROR
PASSED();
return 0;
- error:
+error:
return 1;
-}
+} /* end check_new_move() */
/*-------------------------------------------------------------------------
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index dc32b9e..38bbcf55 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -1052,33 +1052,33 @@ hsize_t diff (hid_t file1_id,
char *buf1 = NULL;
char *buf2 = NULL;
- if (H5Gget_objinfo (file1_id, path1, FALSE, &sb1) < 0)
+ if(H5Gget_objinfo(file1_id, path1, FALSE, &sb1) < 0)
goto out;
- if (H5Gget_objinfo (file1_id, path1, FALSE, &sb2) < 0)
+ if(H5Gget_objinfo(file1_id, path1, FALSE, &sb2) < 0)
goto out;
- buf1 = HDmalloc (sb1.linklen);
- buf2 = HDmalloc (sb2.linklen);
+ buf1 = HDmalloc(sb1.linklen);
+ buf2 = HDmalloc(sb2.linklen);
- if (H5Gget_linkval (file1_id, path1, sb1.linklen, buf1) < 0)
+ if(H5Lget_val(file1_id, path1, buf1, sb1.linklen, H5P_DEFAULT) < 0)
goto out;
- if (H5Gget_linkval (file2_id, path2, sb1.linklen, buf2) < 0)
+ if(H5Lget_val(file2_id, path2, buf2, sb2.linklen, H5P_DEFAULT) < 0)
goto out;
- ret = HDstrcmp (buf1, buf2);
+ ret = HDstrcmp(buf1, buf2);
/* if "buf1" != "buf2" then the links are "different" */
nfound = (ret != 0) ? 1 : 0;
- if (print_objname (options, nfound))
- do_print_objname ("link", path1, path2);
+ if(print_objname(options, nfound))
+ do_print_objname("link", path1, path2);
/* always print the number of differences found in verbose mode */
- if (options->m_verbose)
+ if(options->m_verbose)
print_found(nfound);
- HDfree (buf1);
- HDfree (buf2);
+ HDfree(buf1);
+ HDfree(buf2);
}
break;
diff --git a/tools/lib/h5trav.c b/tools/lib/h5trav.c
index c824b3d..7ba2cc3 100644
--- a/tools/lib/h5trav.c
+++ b/tools/lib/h5trav.c
@@ -611,85 +611,80 @@ static int traverse( hid_t loc_id,
break;
- /*-------------------------------------------------------------------------
- * H5G_LINK
- *-------------------------------------------------------------------------
- */
-
- case H5G_LINK:
- {
- /* increment */
- inserted_objs++;
-
- /* add object to table */
- trav_table_add(HADDR_UNDEF, path, H5G_LINK, table );
-
- if (statbuf.linklen>0)
- {
- char *targbuf;
-
- targbuf = HDmalloc(statbuf.linklen);
- assert(targbuf);
- H5Gget_linkval(loc_id,path,statbuf.linklen,targbuf);
- if (print)
- printf(" %-10s %s -> %s\n", "link", path, targbuf);
- free(targbuf);
- }
- else
- {
- if (print)
- printf(" %-10s %s ->\n", "link", path);
- }
- }
-
- break;
-
- /*-------------------------------------------------------------------------
- * H5G_UDLINK
- *-------------------------------------------------------------------------
- */
-
- case H5G_UDLINK:
- {
- H5L_info_t linkbuf;
-
- /* increment */
- inserted_objs++;
-
- /* add object to table */
- trav_table_add(HADDR_UNDEF, path, H5G_UDLINK, table );
-
- /* Get type of link */
- H5E_BEGIN_TRY {
- /* get link class info */
- H5Lget_info( loc_id, path, &linkbuf, H5P_DEFAULT);
- } H5E_END_TRY;
-
- if(linkbuf.type == H5L_TYPE_EXTERNAL) {
- if(statbuf.linklen > 0) {
- char *targbuf;
- const char *filename;
- const char *objname;
-
- targbuf = HDmalloc(statbuf.linklen);
- assert(targbuf);
- H5Gget_linkval(loc_id, path, statbuf.linklen, targbuf);
- H5Lunpack_elink_val(targbuf, statbuf.linklen, NULL, &filename, &objname);
- if(print)
- printf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname);
- free(targbuf);
- } /* end if */
- else {
- if(print)
- printf(" %-10s %s ->\n", "udlink", path);
- } /* end else */
- } /* end if */
- else { /* Unknown user-defined type */
- if(print)
- printf(" %-10s %s ->\n", "UD link type", path);
- } /* end else */
- }
- break;
+ /*-------------------------------------------------------------------------
+ * H5G_LINK
+ *-------------------------------------------------------------------------
+ */
+
+ case H5G_LINK:
+ /* increment */
+ inserted_objs++;
+
+ /* add object to table */
+ trav_table_add(HADDR_UNDEF, path, H5G_LINK, table);
+
+ if(statbuf.linklen > 0) {
+ char *targbuf;
+
+ targbuf = HDmalloc(statbuf.linklen);
+ assert(targbuf);
+ H5Lget_val(loc_id, path, targbuf, statbuf.linklen, H5P_DEFAULT);
+ if(print)
+ printf(" %-10s %s -> %s\n", "link", path, targbuf);
+ free(targbuf);
+ }
+ else {
+ if(print)
+ printf(" %-10s %s ->\n", "link", path);
+ }
+ break;
+
+ /*-------------------------------------------------------------------------
+ * H5G_UDLINK
+ *-------------------------------------------------------------------------
+ */
+
+ case H5G_UDLINK:
+ {
+ H5L_info_t linkbuf;
+
+ /* increment */
+ inserted_objs++;
+
+ /* add object to table */
+ trav_table_add(HADDR_UNDEF, path, H5G_UDLINK, table );
+
+ /* Get type of link */
+ H5E_BEGIN_TRY {
+ /* get link class info */
+ H5Lget_info( loc_id, path, &linkbuf, H5P_DEFAULT);
+ } H5E_END_TRY;
+
+ if(linkbuf.type == H5L_TYPE_EXTERNAL) {
+ if(statbuf.linklen > 0) {
+ char *targbuf;
+ const char *filename;
+ const char *objname;
+
+ targbuf = HDmalloc(statbuf.linklen);
+ assert(targbuf);
+ H5Lget_val(loc_id, path, targbuf, statbuf.linklen, H5P_DEFAULT);
+ H5Lunpack_elink_val(targbuf, statbuf.linklen, NULL, &filename, &objname);
+ if(print)
+ printf(" %-10s %s -> %s %s\n", "ext link", path, filename, objname);
+ free(targbuf);
+ } /* end if */
+ else {
+ if(print)
+ printf(" %-10s %s ->\n", "udlink", path);
+ } /* end else */
+ } /* end if */
+ else { /* Unknown user-defined type */
+ if(print)
+ printf(" %-10s %s ->\n", "UD link type", path);
+ } /* end else */
+ }
+ break;
default: