summaryrefslogtreecommitdiffstats
path: root/src/H5.c
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2001-05-12 17:33:27 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2001-05-12 17:33:27 (GMT)
commitd3764cd73dd71a785c9c6fab7dff01ab91bcd38c (patch)
tree0acba2c2c6d4608c6ce52b98686d20870f8639e7 /src/H5.c
parent09d2a0e719fd3b41bbecf38768e7b70b623bda08 (diff)
downloadhdf5-d3764cd73dd71a785c9c6fab7dff01ab91bcd38c.zip
hdf5-d3764cd73dd71a785c9c6fab7dff01ab91bcd38c.tar.gz
hdf5-d3764cd73dd71a785c9c6fab7dff01ab91bcd38c.tar.bz2
[svn-r3916] Purpose:
New feature Description: Added verification of H5_VERS_INFO in H5check_version(). Platforms tested: Eirene (linux).
Diffstat (limited to 'src/H5.c')
-rw-r--r--src/H5.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/H5.c b/src/H5.c
index 7fe293d..8a89604 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -48,6 +48,7 @@ H5_api_t H5_g;
hbool_t H5_libinit_g = FALSE;
#endif
+char H5_lib_vers_info_g[] = H5_VERS_INFO;
hbool_t dont_atexit_g = FALSE;
H5_debug_t H5_debug_g; /*debugging info */
static void H5_debug_mask(const char*);
@@ -495,12 +496,18 @@ H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum)
* Tuesday, April 21, 1998
*
* Modifications:
+ * Albert Cheng, May 12, 2001
+ * Added verification of H5_VERS_INFO.
*
*-------------------------------------------------------------------------
*/
herr_t
H5check_version (unsigned majnum, unsigned minnum, unsigned relnum)
{
+ char lib_str[256];
+ char substr[] = H5_VERS_SUBRELEASE;
+ static int checked = 0;
+
/* Don't initialize the library quite yet */
if (H5_VERS_MAJOR!=majnum || H5_VERS_MINOR!=minnum ||
@@ -516,6 +523,34 @@ H5check_version (unsigned majnum, unsigned minnum, unsigned relnum)
HDfputs ("Bye...\n", stderr);
HDabort ();
}
+
+ if (checked)
+ return SUCCEED;
+
+ checked = 1;
+ /*
+ *verify if H5_VERS_INFO is consistent with the other version information.
+ *Check only the first sizeof(lib_str) char. Assume the information
+ *will fit within this size or enough significance.
+ */
+ sprintf(lib_str, "HDF5 library version: %d.%d.%d",
+ H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE);
+ if (*substr){
+ HDstrcat(lib_str, "-");
+ HDstrncat(lib_str, substr, sizeof(lib_str) - HDstrlen(lib_str) - 1);
+ }
+ if (HDstrcmp(lib_str, H5_lib_vers_info_g)){
+ HDfputs ("Warning! Library version information error.\n"
+ "The HDF5 library version information are not "
+ "consistent in its source code.\nThis is NOT a fatal error "
+ "but should be corrected.\n", stderr);
+ fprintf (stderr, "Library version information are:\n"
+ "H5_VERS_MAJOR=%d, H5_VERS_MINOR=%d, H5_VERS_RELEASE=%d, "
+ "H5_VERS_SUBRELEASE=%s,\nH5_VERS_INFO=%s\n",
+ H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
+ H5_VERS_SUBRELEASE, H5_VERS_INFO);
+ }
+
return SUCCEED;
}