Fixed compiler warning format '%u' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] by casting or increasing format specifier size and casting. (#1092)

* Fixed compiler warning format '%u' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=] by casting or increasing format specifier size and casting. Increased the size of the name string to handle larger possible integers.

* Fixed copied code that no longer needs static function scope variables for text names.
This commit is contained in:
Steve Karg
2025-09-12 15:08:47 -05:00
committed by GitHub
parent 0da61e52bb
commit 9b6173995c
28 changed files with 82 additions and 64 deletions
+3 -3
View File
@@ -168,7 +168,7 @@ bool Structured_View_Object_Name(
{
bool status = false;
struct object_data *pObject;
char name_text[24] = "Structured-View-4194303";
char name_text[48] = "Structured-View-4194303";
pObject = Keylist_Data(Object_List, object_instance);
if (pObject) {
@@ -177,8 +177,8 @@ bool Structured_View_Object_Name(
characterstring_init_ansi(object_name, pObject->Object_Name);
} else {
snprintf(
name_text, sizeof(name_text), "Structured-View-%u",
object_instance);
name_text, sizeof(name_text), "Structured-View-%lu",
(unsigned long)object_instance);
status = characterstring_init_ansi(object_name, name_text);
}
}