From 09485a4eb3968050e1335ecf224967ac5b67c4a1 Mon Sep 17 00:00:00 2001 From: Kai-Uwe Hermann Date: Fri, 15 Nov 2024 15:56:34 +0100 Subject: [PATCH 1/3] Turn switch-case info if-else to prevent duplicate switch compiler error This can happen on 32bit targets where int == long Signed-off-by: Kai-Uwe Hermann --- src/nxp_nci_hal_libnfc-nci/utils/config.cc | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/nxp_nci_hal_libnfc-nci/utils/config.cc b/src/nxp_nci_hal_libnfc-nci/utils/config.cc index 9029273..2b03a10 100644 --- a/src/nxp_nci_hal_libnfc-nci/utils/config.cc +++ b/src/nxp_nci_hal_libnfc-nci/utils/config.cc @@ -865,21 +865,15 @@ extern "C" int GetStrValue(const char* name, char* pValue, unsigned long l) // printf("%s: NCI Config Parameter :%s = (0x%x)\n", __FUNCTION__, name, v); } - switch (len) - { - case sizeof(unsigned int): + if (len == sizeof(unsigned int)) { *(static_cast(pValue)) = (unsigned int)v; - break; - case sizeof(unsigned long): + } else if (len == sizeof(unsigned long)) { *(static_cast(pValue)) = (unsigned long)v; - break; - case sizeof(unsigned short): + } else if (len == sizeof(unsigned short)) { *(static_cast(pValue)) = (unsigned short)v; - break; - case sizeof(unsigned char): + } else if (len == sizeof(unsigned char)) { *(static_cast (pValue)) = (unsigned char)v; - break; - default: + } else { return false; } return true; From d7eef2b5abf91c7bd3506fb08795770fc4125041 Mon Sep 17 00:00:00 2001 From: Kai-Uwe Hermann Date: Fri, 15 Nov 2024 15:56:59 +0100 Subject: [PATCH 2/3] Rename package to libnfc-nci Signed-off-by: Kai-Uwe Hermann --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 507628e..ca5c2f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -312,7 +312,7 @@ if (LIBNFCNCI_INSTALL) ) evc_setup_package( - NAME libnfc_nci + NAME libnfc-nci EXPORT libnfc_nci-targets NAMESPACE libnfc_nci PATH_VARS From 6da79314e07109cb15f1cbd355fe43b267b7f4e9 Mon Sep 17 00:00:00 2001 From: Kai-Uwe Hermann Date: Fri, 15 Nov 2024 15:57:50 +0100 Subject: [PATCH 3/3] Allow LIBNFCNCI_CONFIG_INSTALL_PATH to be set from the outside Switch its default to sysconfdir/everest/libnfc_config Signed-off-by: Kai-Uwe Hermann --- CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca5c2f1..ff9f2cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,9 @@ find_library(LIBRT rt) option(LIBNFCNCI_BUILD_EXAMPLES "enable building of examples" OFF) option(LIBNFCNCI_INSTALL "Install the library (shared data might be installed anyway)" ${EVC_MAIN_PROJECT}) -set (VAR_LIBNFCNCI_CONFIG_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/etc/libnfc_config/") +if (NOT LIBNFCNCI_CONFIG_INSTALL_PATH) + set (LIBNFCNCI_CONFIG_INSTALL_PATH "${CMAKE_INSTALL_SYSCONFDIR}/everest/libnfc_config/") +endif() set (LIBNFCNCI_CONFIG_FILES conf/libnfc-nci.conf @@ -211,7 +213,7 @@ set (LIBNFCNCI_INCLUDE_DIRS ) set (COMPILE_DEFINITIONS - -DCONFIG_PATH="${VAR_LIBNFCNCI_CONFIG_INSTALL_PATH}" + -DCONFIG_PATH="${LIBNFCNCI_CONFIG_INSTALL_PATH}" -DNFC_CFG_DEBUG=FALSE -DNFC_NXP_NOT_OPEN_INCLUDED=TRUE -DNXP_HW_SELF_TEST @@ -244,7 +246,7 @@ target_compile_definitions(libnfc_nci set_target_properties(libnfc_nci PROPERTIES - LIBNFCNCI_CONFIG_INSTALL_PATH "${VAR_LIBNFCNCI_CONFIG_INSTALL_PATH}" + LIBNFCNCI_CONFIG_INSTALL_PATH "${LIBNFCNCI_CONFIG_INSTALL_PATH}" ) # NOTE (aw): this is dangerous @@ -308,7 +310,7 @@ if (LIBNFCNCI_INSTALL) ) install(FILES ${LIBNFCNCI_CONFIG_FILES} - DESTINATION "${VAR_LIBNFCNCI_CONFIG_INSTALL_PATH}" + DESTINATION "${LIBNFCNCI_CONFIG_INSTALL_PATH}" ) evc_setup_package( @@ -316,7 +318,7 @@ if (LIBNFCNCI_INSTALL) EXPORT libnfc_nci-targets NAMESPACE libnfc_nci PATH_VARS - LIBNFCNCI_CONFIG_INSTALL_PATH "${VAR_LIBNFCNCI_CONFIG_INSTALL_PATH}" + LIBNFCNCI_CONFIG_INSTALL_PATH "${LIBNFCNCI_CONFIG_INSTALL_PATH}" ADDITIONAL_CONTENT "find_dependency(Threads)" "set_target_properties(libnfc_nci::libnfc_nci PROPERTIES LIBNFCNCI_CONFIG_INSTALL_PATH \"@PACKAGE_LIBNFCNCI_CONFIG_INSTALL_PATH@\")"