Fix duplicate variable name(local vs global) with -Werror=shadow build option 04/325004/3 accepted/tizen_unified accepted/tizen_unified_x accepted/tizen/unified/20250604.163030 accepted/tizen/unified/x/20250604.211409
authorDongik Lee <dongik.lee@samsung.com>
Fri, 30 May 2025 04:57:04 +0000 (13:57 +0900)
committerDongik Lee <dongik.lee@samsung.com>
Fri, 30 May 2025 05:13:58 +0000 (14:13 +0900)
Change-Id: I908bf8db2819da9e458884d947dacb27a0884977

CMakeLists.txt
haltest/CMakeLists.txt
haltest/security-keys.cpp

index 3ed8757ffaf061073b985787b52dc57857c9c7d7..2d2626b1bd949b1a4ff63a5b221b9c8a4f46c6c8 100644 (file)
@@ -13,7 +13,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
 INCLUDE(FindPkgConfig)
 PKG_CHECK_MODULES(SECURITY_DEPS REQUIRED hal-api-common)
 
-SET(EXTRA_CFLAGS "-Wall -Wextra -Werror -fvisibility=hidden -fPIC")
+SET(EXTRA_CFLAGS "-Wall -Wextra -Werror -Werror=shadow -fvisibility=hidden -fPIC")
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SECURITY_DEPS_CFLAGS} ${EXTRA_CFLAGS}")
 
 SET(
index 7c465d26888475369b6182445e8a8805fea26e71..1dcf5af0f11d69053c1aff74117ceb8cfbd74896 100644 (file)
@@ -16,7 +16,7 @@ INCLUDE_DIRECTORIES(SYSTEM ${TEST_DEPS_INCLUDE_DIRS})
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
 LINK_DIRECTORIES(${TEST_DEPS_LIBRARY_DIRS})
 
-SET(EXTRA_CFLAGS "-Wall -Wextra -Werror -fPIC")
+SET(EXTRA_CFLAGS "-Wall -Wextra -Werror -Werror=shadow -fPIC")
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
 
index c90ac47b330b29af7ac2cc1c6a76362bff4cdba6..07083b12f44dc86ab9d7fc601afe406b1864c5fc 100644 (file)
@@ -81,8 +81,8 @@ hal_security_keys_hash_algorithm_e sha256_hash = HAL_SECURITY_KEYS_HASH_ALGORITH
 
 void initialize_key_variables(
     const hal_security_keys_context_s context,
-    const std::string& alias,
-    const std::string& pwd,
+    const std::string& alias_data,
+    const std::string& password,
     hal_security_keys_data_s& iv,
     hal_security_keys_data_s& key_id,
     hal_security_keys_data_s& key_pwd,
@@ -91,17 +91,17 @@ void initialize_key_variables(
     int ret;
 
     key_id = {
-        reinterpret_cast<unsigned char*>(const_cast<char*>(alias.c_str())),
-        alias.size()
+        reinterpret_cast<unsigned char*>(const_cast<char*>(alias_data.c_str())),
+        alias_data.size()
     };
 
     ret = hal_security_keys_create_iv(context, &iv);
     EXPECT_EQ(ret, 0) << "Failed to create iv (" << ret << ")";
 
-    if(!pwd.empty()) {
+    if(!password.empty()) {
         key_pwd = {
-            reinterpret_cast<unsigned char*>(const_cast<char*>(pwd.c_str())),
-            pwd.size()
+            reinterpret_cast<unsigned char*>(const_cast<char*>(password.c_str())),
+            password.size()
         };
     } else {
         key_pwd = { NULL, 0 };