This is an automated email from the ASF dual-hosted git repository.

pengzheng pushed a commit to branch hotfix/gcc_warning_fix
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 52a3044fcff7937df55c6ec0cf49546b0e98b846
Author: PengZheng <[email protected]>
AuthorDate: Wed Jan 11 15:30:09 2023 +0800

    Eliminate gcc warnings leading to compilation errors.
    
    *  error: ā€˜%s’ directive argument is null [-Werror=format-overflow=]
    * duplicated typedef
    * add rsa_shm to CI
---
 .../remote_service_admin_shm_v2/CMakeLists.txt               |  2 +-
 .../rsa_shm/src/rsa_shm_export_registration.h                |  4 +---
 .../rsa_shm/src/rsa_shm_import_registration.h                |  4 +---
 bundles/remote_services/rsa_rpc_json/CMakeLists.txt          |  2 +-
 libs/framework/src/framework.c                               | 12 +++++++-----
 5 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/bundles/remote_services/remote_service_admin_shm_v2/CMakeLists.txt 
b/bundles/remote_services/remote_service_admin_shm_v2/CMakeLists.txt
index 77025a57..e62a07df 100644
--- a/bundles/remote_services/remote_service_admin_shm_v2/CMakeLists.txt
+++ b/bundles/remote_services/remote_service_admin_shm_v2/CMakeLists.txt
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-celix_subproject(RSA_REMOTE_SERVICE_ADMIN_SHM_V2 "Option to enable building 
the Remote Service Admin Service SHM V2 bundle" OFF)
+celix_subproject(RSA_REMOTE_SERVICE_ADMIN_SHM_V2 "Option to enable building 
the Remote Service Admin Service SHM V2 bundle" ON)
 if (RSA_REMOTE_SERVICE_ADMIN_SHM_V2 AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
 
     add_subdirectory(shm_pool)
diff --git 
a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_export_registration.h
 
b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_export_registration.h
index 4d7bf489..4a479fdb 100644
--- 
a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_export_registration.h
+++ 
b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_export_registration.h
@@ -23,15 +23,13 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
+#include <export_registration.h>
 #include <endpoint_description.h>
 #include <celix_log_helper.h>
 #include <celix_api.h>
 #include <sys/uio.h>
 
 
-typedef struct export_registration export_registration_t;
-typedef struct export_reference export_reference_t;
-
 celix_status_t exportRegistration_create(celix_bundle_context_t *context,
         celix_log_helper_t *logHelper, service_reference_pt reference,
         endpoint_description_t *endpointDesc, export_registration_t 
**exportOut);
diff --git 
a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_import_registration.h
 
b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_import_registration.h
index 42dd3270..9d20eefe 100644
--- 
a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_import_registration.h
+++ 
b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_import_registration.h
@@ -23,15 +23,13 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
+#include <import_registration.h>
 #include <endpoint_description.h>
 #include <rsa_rpc_factory.h>
 #include <celix_log_helper.h>
 #include <celix_api.h>
 
 
-typedef struct import_registration import_registration_t;
-typedef struct import_reference import_reference_t;
-
 celix_status_t importRegistration_create(celix_bundle_context_t *context,
         celix_log_helper_t *logHelper, endpoint_description_t *endpointDesc,
         long reqSenderSvcId, import_registration_t **importRegOut);
diff --git a/bundles/remote_services/rsa_rpc_json/CMakeLists.txt 
b/bundles/remote_services/rsa_rpc_json/CMakeLists.txt
index 33912b21..824ac514 100644
--- a/bundles/remote_services/rsa_rpc_json/CMakeLists.txt
+++ b/bundles/remote_services/rsa_rpc_json/CMakeLists.txt
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-celix_subproject(RSA_JSON_RPC "Option to enable building the Remote Service 
Admin JSON RPC bundle" OFF)
+celix_subproject(RSA_JSON_RPC "Option to enable building the Remote Service 
Admin JSON RPC bundle" ON)
 if (RSA_JSON_RPC)
 
     find_package(jansson REQUIRED)
diff --git a/libs/framework/src/framework.c b/libs/framework/src/framework.c
index b26c8b79..20e54d34 100644
--- a/libs/framework/src/framework.c
+++ b/libs/framework/src/framework.c
@@ -1893,17 +1893,19 @@ long celix_framework_registerService(framework_t *fw, 
celix_bundle_t *bnd, const
     celix_status_t status;
     service_registration_t *reg = NULL;
 
+    if (serviceName == NULL) {
+        fw_log(fw->logger, CELIX_LOG_LEVEL_ERROR, "Null serviceName");
+        return CELIX_ILLEGAL_ARGUMENT;
+    }
+
     long bndId = celix_bundle_getId(bnd);
     celix_framework_bundle_entry_t *entry = 
celix_framework_bundleEntry_getBundleEntryAndIncreaseUseCount(fw, bndId);
 
 
-    if (serviceName != NULL && factory != NULL) {
+    if (factory != NULL) {
         status = celix_serviceRegistry_registerServiceFactory(fw->registry, 
bnd, serviceName, factory, properties, 0, &reg);
-    } else if (serviceName != NULL) {
-        status = celix_serviceRegistry_registerService(fw->registry, bnd, 
serviceName, svc, properties, 0, &reg);
     } else {
-        fw_log(fw->logger, CELIX_LOG_LEVEL_ERROR, "Invalid arguments 
serviceName: %s", serviceName);
-        status = CELIX_ILLEGAL_ARGUMENT;
+        status = celix_serviceRegistry_registerService(fw->registry, bnd, 
serviceName, svc, properties, 0, &reg);
     }
 
     celix_framework_bundleEntry_decreaseUseCount(entry);

Reply via email to