Fix warnings

This commit is contained in:
Maschell
2026-01-15 16:50:01 +01:00
parent 58a3963ce8
commit 3d4f22ec00
11 changed files with 35 additions and 34 deletions

View File

@@ -22,13 +22,13 @@
namespace WUPSConfigAPIBackend {
std::vector<std::unique_ptr<WUPSConfig>> sConfigs;
std::mutex sConfigsMutex;
std::recursive_mutex sConfigsMutex;
std::vector<std::unique_ptr<WUPSConfigCategory>> sConfigCategories;
std::mutex sConfigCategoryMutex;
std::recursive_mutex sConfigCategoryMutex;
std::vector<std::unique_ptr<WUPSConfigItem>> sConfigItems;
std::mutex sConfigItemsMutex;
std::recursive_mutex sConfigItemsMutex;
namespace Intern {
WUPSConfig *GetConfigByHandle(WUPSConfigHandle handle) {
@@ -201,7 +201,7 @@ namespace WUPSConfigAPIBackend {
return WUPSCONFIG_API_RESULT_SUCCESS;
}
}
DEBUG_FUNCTION_LINE_WARN("Failed to destroy WUPSConfigCategory (for handle: \"%08X\")", handle.handle);
DEBUG_FUNCTION_LINE_WARN("Failed to destroy WUPSConfigCategory (for handle: \"%p\")", handle.handle);
return WUPSCONFIG_API_RESULT_NOT_FOUND;
}
return WUPSCONFIG_API_RESULT_SUCCESS;
@@ -218,20 +218,20 @@ namespace WUPSConfigAPIBackend {
if (!parentCat) {
parentCat = Intern::GetCategoryByHandle(parentHandle);
if (!parentCat) {
DEBUG_FUNCTION_LINE_WARN("Failed to find parent for handle %08X", parentHandle.handle);
DEBUG_FUNCTION_LINE_WARN("Failed to find parent for handle %p", parentHandle.handle);
return WUPSCONFIG_API_RESULT_NOT_FOUND;
}
}
auto category = Intern::PopCategoryByHandle(categoryHandle);
if (!category) {
DEBUG_FUNCTION_LINE_WARN("Failed to find category. parentHandle: %08X categoryHandle: %08X", parentHandle.handle, categoryHandle.handle);
DEBUG_FUNCTION_LINE_WARN("Failed to find category. parentHandle: %p categoryHandle: %p", parentHandle.handle, categoryHandle.handle);
return WUPSCONFIG_API_RESULT_NOT_FOUND;
}
if (!parentCat->addCategory(category)) {
sConfigCategories.push_back(std::move(category));
DEBUG_FUNCTION_LINE_WARN("Failed to add category to parent. parentHandle: %08X categoryHandle: %08X", parentHandle.handle, categoryHandle.handle);
DEBUG_FUNCTION_LINE_WARN("Failed to add category to parent. parentHandle: %p categoryHandle: %p", parentHandle.handle, categoryHandle.handle);
return WUPSCONFIG_API_RESULT_UNKNOWN_ERROR; // TODO!!!
}
return WUPSCONFIG_API_RESULT_SUCCESS;
@@ -249,21 +249,21 @@ namespace WUPSConfigAPIBackend {
if (!parentCat) {
parentCat = Intern::GetCategoryByHandle(parentHandle, true);
if (!parentCat) {
DEBUG_FUNCTION_LINE_WARN("Failed to find parent for handle %08X", parentHandle.handle);
DEBUG_FUNCTION_LINE_WARN("Failed to find parent for handle %p", parentHandle.handle);
return WUPSCONFIG_API_RESULT_NOT_FOUND;
}
}
auto item = Intern::PopItemByHandle(itemHandle);
if (!item) {
DEBUG_FUNCTION_LINE_ERR("Failed to get item for handle %08X", itemHandle.handle);
DEBUG_FUNCTION_LINE_ERR("Failed to get item for handle %p", itemHandle.handle);
return WUPSCONFIG_API_RESULT_NOT_FOUND;
}
if (!parentCat->addItem(item)) {
std::lock_guard lockItems(sConfigItemsMutex);
sConfigItems.push_back(std::move(item));
DEBUG_FUNCTION_LINE_ERR("Failed to add item %08X to category %08X", itemHandle.handle, parentHandle.handle);
DEBUG_FUNCTION_LINE_ERR("Failed to add item %p to category %p", itemHandle.handle, parentHandle.handle);
return WUPSCONFIG_API_RESULT_UNKNOWN_ERROR; // TODO
}
@@ -305,7 +305,7 @@ namespace WUPSConfigAPIBackend {
}
if (!remove_locked_first_if(sConfigItemsMutex, sConfigItems, [&handle](auto &cur) { return cur.get() == handle; })) {
DEBUG_FUNCTION_LINE_WARN("Failed to destroy WUPSConfigItem (handle: \"%08X\")", handle);
DEBUG_FUNCTION_LINE_WARN("Failed to destroy WUPSConfigItem (handle: \"%p\")", handle.handle);
return WUPSCONFIG_API_RESULT_NOT_FOUND;
}
return WUPSCONFIG_API_RESULT_SUCCESS;

View File

@@ -31,7 +31,7 @@ int32_t WUPSConfig_GetName(void *handle, char *out_buf, int32_t out_len) {
}
auto config = WUPSConfigAPIBackend::Intern::GetConfigByHandle(WUPSConfigHandle(handle));
if (!config) {
DEBUG_FUNCTION_LINE_WARN("Failed to find WUPSConfig by handle %08X", handle);
DEBUG_FUNCTION_LINE_WARN("Failed to find WUPSConfig by handle %p", handle);
return -1;
}
snprintf(out_buf, out_len, "%s", config->getName().c_str());
@@ -117,7 +117,7 @@ int32_t WUPSConfigCategory_GetName(void *handle, char *out_buf, int32_t out_len)
auto *category = WUPSConfigAPIBackend::Intern::GetCategoryByHandle(WUPSConfigCategoryHandle(handle), true);
if (!category) {
DEBUG_FUNCTION_LINE_WARN("Failed to find existing category for handle %08X", handle);
DEBUG_FUNCTION_LINE_WARN("Failed to find existing category for handle %p", handle);
return -2;
}
snprintf(out_buf, out_len, "%s", category->getName().c_str());
@@ -176,7 +176,7 @@ int32_t WUPSConfigItem_SetDisplayName(void *handle, const char *displayName) {
auto *config = WUPSConfigAPIBackend::Intern::GetItemByHandle(WUPSConfigItemHandle(handle));
if (!config) {
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %08X", handle);
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %p", handle);
return -2;
}
config->setDisplayName(displayName);
@@ -190,7 +190,7 @@ int32_t WUPSConfigItem_GetDisplayName(void *handle, char *out_buf, int32_t out_l
}
auto *config = WUPSConfigAPIBackend::Intern::GetItemByHandle(WUPSConfigItemHandle(handle));
if (!config) {
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %08X", handle);
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %p", handle);
return -2;
}
snprintf(out_buf, out_len, "%s", config->getDisplayName().c_str());
@@ -205,7 +205,7 @@ int32_t WUPSConfigItem_SetConfigID(void *handle, const char *configId) {
auto *config = WUPSConfigAPIBackend::Intern::GetItemByHandle(WUPSConfigItemHandle(handle));
if (!config) {
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %08X", handle);
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %p", handle);
return -2;
}
config->setConfigId(configId);
@@ -219,7 +219,7 @@ int32_t WUPSConfigItem_GetConfigID(void *handle, char *out_buf, int32_t out_len)
}
auto *config = WUPSConfigAPIBackend::Intern::GetItemByHandle(WUPSConfigItemHandle(handle));
if (!config) {
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %08X", handle);
DEBUG_FUNCTION_LINE_ERR("Failed to find item for handle %p", handle);
return -2;
}
snprintf(out_buf, out_len, "%s", config->getConfigId().c_str());