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

pengzheng pushed a commit to branch feature/527-manifest-improvement
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/527-manifest-improvement by this push:
     new 6dfef569 Fix crash caused by wrong error injector signature 
specification.
6dfef569 is described below

commit 6dfef5691ae1589509ca2e9883a898e1aba17843
Author: PengZheng <[email protected]>
AuthorDate: Tue Aug 15 09:24:18 2023 +0800

    Fix crash caused by wrong error injector signature specification.
---
 libs/framework/gtest/src/ManifestErrorInjectionTestSuite.cc |  4 ++--
 libs/utils/error_injector/hash_map/include/hmap_ei.h        |  2 +-
 libs/utils/error_injector/hash_map/src/hmap_ei.cc           | 12 +++++++-----
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/libs/framework/gtest/src/ManifestErrorInjectionTestSuite.cc 
b/libs/framework/gtest/src/ManifestErrorInjectionTestSuite.cc
index 62a18e19..a257bdc6 100644
--- a/libs/framework/gtest/src/ManifestErrorInjectionTestSuite.cc
+++ b/libs/framework/gtest/src/ManifestErrorInjectionTestSuite.cc
@@ -40,7 +40,7 @@ public:
         celix_ei_expect_malloc(nullptr, 0, nullptr);
         celix_ei_expect_celix_properties_create(nullptr, 0, nullptr);
         celix_ei_expect_celix_properties_copy(nullptr, 0, nullptr);
-        celix_ei_expect_hash_map_create(nullptr, 0, nullptr);
+        celix_ei_expect_hashMap_create(nullptr, 0, nullptr);
     }
 };
 
@@ -62,7 +62,7 @@ TEST_F(ManifestErrorInjectionTestSuite, 
NoMemoryForManifestCreateTest) {
     teardownErrorInjectors();
 
     manifest = nullptr;
-    celix_ei_expect_hash_map_create((void*)manifest_create, 0, nullptr);
+    celix_ei_expect_hashMap_create((void*)manifest_create, 0, nullptr);
     status = manifest_create(&manifest);
     EXPECT_EQ(CELIX_ENOMEM, status);
     EXPECT_EQ(nullptr, manifest);
diff --git a/libs/utils/error_injector/hash_map/include/hmap_ei.h 
b/libs/utils/error_injector/hash_map/include/hmap_ei.h
index 78904dfc..a93b2ceb 100644
--- a/libs/utils/error_injector/hash_map/include/hmap_ei.h
+++ b/libs/utils/error_injector/hash_map/include/hmap_ei.h
@@ -27,7 +27,7 @@ extern "C" {
 #include "celix_error_injector.h"
 #include "hash_map.h"
 
-CELIX_EI_DECLARE(hash_map_create, hash_map_pt);
+CELIX_EI_DECLARE(hashMap_create, hash_map_pt);
 
 #ifdef __cplusplus
 }
diff --git a/libs/utils/error_injector/hash_map/src/hmap_ei.cc 
b/libs/utils/error_injector/hash_map/src/hmap_ei.cc
index 4b398a09..92e5d0dc 100644
--- a/libs/utils/error_injector/hash_map/src/hmap_ei.cc
+++ b/libs/utils/error_injector/hash_map/src/hmap_ei.cc
@@ -21,10 +21,12 @@
 #include "hmap_ei.h"
 
 extern "C" {
-hash_map_pt __real_hashMap_create();
-CELIX_EI_DEFINE(hash_map_create, hash_map_pt);
-hash_map_pt __wrap_hashMap_create() {
-    CELIX_EI_IMPL(hash_map_create);
-    return __real_hashMap_create();
+hash_map_pt __real_hashMap_create(unsigned int (*keyHash)(const void *), 
unsigned int (*valueHash)(const void *),
+        int (*keyEquals)(const void *, const void *), int (*valueEquals)(const 
void *, const void *));
+CELIX_EI_DEFINE(hashMap_create, hash_map_pt);
+hash_map_pt __wrap_hashMap_create(unsigned int (*keyHash)(const void *), 
unsigned int (*valueHash)(const void *),
+        int (*keyEquals)(const void *, const void *), int (*valueEquals)(const 
void *, const void *)) {
+    CELIX_EI_IMPL(hashMap_create);
+    return __real_hashMap_create(keyHash, valueHash, keyEquals, valueEquals);
 }
 }
\ No newline at end of file

Reply via email to