1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-12-22 20:35:44 +01:00

Fix bug due to PACKAGE_VERSION definition in trexio.h

This commit is contained in:
q-posev 2021-10-07 09:54:19 +02:00
parent 0cba81fc38
commit 947a8a12f8
3 changed files with 9 additions and 5 deletions

View File

@ -14,6 +14,7 @@ AC_CONFIG_MACRO_DIR([m4])
VERSION_MAJOR=`echo ${PACKAGE_VERSION} | cut -d. -f1` VERSION_MAJOR=`echo ${PACKAGE_VERSION} | cut -d. -f1`
VERSION_MINOR=`echo ${PACKAGE_VERSION} | cut -d. -f2` VERSION_MINOR=`echo ${PACKAGE_VERSION} | cut -d. -f2`
VERSION_PATCH=`echo ${PACKAGE_VERSION} | cut -d. -f3 | cut -d- -f1` VERSION_PATCH=`echo ${PACKAGE_VERSION} | cut -d. -f3 | cut -d- -f1`
AC_DEFINE_UNQUOTED(TREXIO_PACKAGE_VERSION, ["${PACKAGE_VERSION}"], [full version])
AC_DEFINE_UNQUOTED(TREXIO_VERSION_MAJOR, [$VERSION_MAJOR], [major version]) AC_DEFINE_UNQUOTED(TREXIO_VERSION_MAJOR, [$VERSION_MAJOR], [major version])
AC_DEFINE_UNQUOTED(TREXIO_VERSION_MINOR, [$VERSION_MINOR], [minor version]) AC_DEFINE_UNQUOTED(TREXIO_VERSION_MINOR, [$VERSION_MINOR], [minor version])
AC_DEFINE_UNQUOTED(TREXIO_VERSION_PATCH, [$VERSION_PATCH], [patch version]) AC_DEFINE_UNQUOTED(TREXIO_VERSION_PATCH, [$VERSION_PATCH], [patch version])

View File

@ -5,7 +5,10 @@ cat prefix_front.c > trexio.c
cat prefix_front.h > trexio.h cat prefix_front.h > trexio.h
# grep some usefull constants from the config.h # grep some usefull constants from the config.h
echo "" >> trexio.h echo "" >> trexio.h
grep "_VERSION" ../../include/config.h >> trexio.h grep "TREXIO_PACKAGE_VERSION" ../../include/config.h >> trexio.h
grep "TREXIO_VERSION_MAJOR" ../../include/config.h >> trexio.h
grep "TREXIO_VERSION_MINOR" ../../include/config.h >> trexio.h
grep "TREXIO_VERSION_PATCH" ../../include/config.h >> trexio.h
echo "" >> trexio.h echo "" >> trexio.h
cat prefix_s_front.h > trexio_s.h cat prefix_s_front.h > trexio_s.h

View File

@ -761,7 +761,7 @@ trexio_open(const char* file_name, const char mode,
return NULL; return NULL;
} }
strncpy(result->version, PACKAGE_VERSION, 16); strncpy(result->version, TREXIO_PACKAGE_VERSION, 16);
if (result->version[15] != '\0') { if (result->version[15] != '\0') {
if (rc_open != NULL) *rc_open = TREXIO_FAILURE; if (rc_open != NULL) *rc_open = TREXIO_FAILURE;
free(result); free(result);
@ -817,15 +817,15 @@ trexio_open(const char* file_name, const char mode,
switch (back_end) { switch (back_end) {
case TREXIO_TEXT: case TREXIO_TEXT:
rc = trexio_text_write_metadata_package_version(result, PACKAGE_VERSION); rc = trexio_text_write_metadata_package_version(result, TREXIO_PACKAGE_VERSION);
break; break;
case TREXIO_HDF5: case TREXIO_HDF5:
rc = trexio_hdf5_write_metadata_package_version(result, PACKAGE_VERSION); rc = trexio_hdf5_write_metadata_package_version(result, TREXIO_PACKAGE_VERSION);
break; break;
/* /*
case TREXIO_JSON: case TREXIO_JSON:
rc = trexio_json_write_metadata_package_version(result, PACKAGE_VERSION); rc = trexio_json_write_metadata_package_version(result, TREXIO_PACKAGE_VERSION);
break; break;
,*/ ,*/
} }