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:
@@ -22,6 +22,7 @@ The git repositories are hosted at the following sites:
|
||||
|
||||
### Added
|
||||
|
||||
* Added MS/TP statistics counters for BadCRC and Poll-For-Master. (#1081)
|
||||
* Added Lighting Output API to implement override for HOA control.
|
||||
Integrated lighting command overridden behavior into the lighting
|
||||
output object and added Overridden status flags API.
|
||||
@@ -99,6 +100,9 @@ The git repositories are hosted at the following sites:
|
||||
|
||||
### Changed
|
||||
|
||||
* Changed Who-Am-I and You-Are JSON handlers to eliminate dynamic
|
||||
memory allocation for model and serial number strings,
|
||||
improving memory management and simplifying code. (#1089)
|
||||
* Change stm32f4xx example to use static RAM file system. (#1058)
|
||||
* Changed the bacnet file object to be storage agnostic by refactoring
|
||||
and using callbacks. (#1056)
|
||||
@@ -110,6 +114,12 @@ The git repositories are hosted at the following sites:
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed copied code that no longer needs static function scope variables
|
||||
for text names. (#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. (#1092)
|
||||
* Fixed Lighting_Command to ignore write priority and use its own. (#1086)
|
||||
* Fixed BACnetLightingOperation reserved range. (#1086)
|
||||
* Fixed missing prototype warning in lighting.c module.
|
||||
|
||||
+2
-1
@@ -683,7 +683,8 @@ static void PrintReadPropertyData(
|
||||
static void Print_Property_Identifier(unsigned propertyIdentifier)
|
||||
{
|
||||
if (bactext_property_name_proprietary(propertyIdentifier)) {
|
||||
fprintf(stdout, "-- proprietary %u", propertyIdentifier);
|
||||
fprintf(
|
||||
stdout, "-- proprietary %lu", (unsigned long)propertyIdentifier);
|
||||
} else {
|
||||
fprintf(stdout, "%s", bactext_property_name(propertyIdentifier));
|
||||
}
|
||||
|
||||
@@ -274,7 +274,9 @@ static void add_discovered_properties_to_gui(
|
||||
bacnet_discover_object_property_identifier(
|
||||
device_id, object_type, object_instance, index, &property_id);
|
||||
if (bactext_property_name_proprietary(property_id)) {
|
||||
asprintfa(&property_string, "proprietary-%u", property_id);
|
||||
asprintfa(
|
||||
&property_string, "proprietary-%lu",
|
||||
(unsigned long)property_id);
|
||||
} else {
|
||||
asprintfa(
|
||||
&property_string, "%s", bactext_property_name(property_id));
|
||||
|
||||
@@ -75,7 +75,7 @@ uint32_t Analog_Input_Index_To_Instance(unsigned index)
|
||||
bool Analog_Input_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text_string[16] = "AI-0"; /* okay for single thread */
|
||||
char text_string[16] = "AI-0";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ANALOG_INPUTS) {
|
||||
|
||||
@@ -131,7 +131,7 @@ float Analog_Value_Present_Value(uint32_t object_instance)
|
||||
bool Analog_Value_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text_string[16] = "AV-0"; /* okay for single thread */
|
||||
char text_string[16] = "AV-0";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ANALOG_VALUES) {
|
||||
|
||||
@@ -110,7 +110,7 @@ BACNET_BINARY_PV Binary_Input_Present_Value(uint32_t object_instance)
|
||||
bool Binary_Input_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text_string[16] = "BI-0"; /* okay for single thread */
|
||||
char text_string[16] = "BI-0";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_BINARY_INPUTS) {
|
||||
|
||||
@@ -105,7 +105,7 @@ BACNET_BINARY_PV Binary_Value_Present_Value(uint32_t object_instance)
|
||||
bool Binary_Value_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text_string[16] = "BV-0"; /* okay for single thread */
|
||||
char text_string[16] = "BV-0";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_BINARY_VALUES) {
|
||||
|
||||
@@ -77,7 +77,7 @@ uint32_t Analog_Input_Index_To_Instance(unsigned index)
|
||||
bool Analog_Input_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32]; /* okay for single thread */
|
||||
char text[32];
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ANALOG_INPUTS) {
|
||||
|
||||
@@ -141,7 +141,7 @@ bool Analog_Value_Present_Value_Set(
|
||||
bool Analog_Value_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
unsigned index = 0;
|
||||
bool status = false;
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ bool Binary_Input_Present_Value_Set(
|
||||
bool Binary_Input_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32]; /* okay for single thread */
|
||||
char text[32];
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_BINARY_INPUTS) {
|
||||
|
||||
@@ -192,7 +192,7 @@ bool Binary_Output_Out_Of_Service(uint32_t instance)
|
||||
bool Binary_Output_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32]; /* okay for single thread */
|
||||
char text[32];
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_BINARY_OUTPUTS) {
|
||||
|
||||
@@ -181,7 +181,7 @@ bool Binary_Output_Out_Of_Service(uint32_t instance)
|
||||
bool Binary_Output_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text_string[16] = "BO-0"; /* okay for single thread */
|
||||
char text_string[16] = "BO-0";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_BINARY_OUTPUTS) {
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ void bip6_set_interface(char *ifname)
|
||||
Hints.ai_socktype = SOCK_DGRAM;
|
||||
Hints.ai_protocol = IPPROTO_UDP;
|
||||
Hints.ai_flags = AI_NUMERICHOST | AI_PASSIVE;
|
||||
snprintf(port, sizeof(port), "%u", BIP6_Addr.port);
|
||||
snprintf(port, sizeof(port), "%u", (unsigned)BIP6_Addr.port);
|
||||
if (BIP6_Debug) {
|
||||
debug_fprintf(
|
||||
stderr, "BIP6: seeking IPv6 address %s port %s...\n", ifname, port);
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ unsigned Analog_Input_Count(void)
|
||||
bool Analog_Input_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32]; /* okay for single thread */
|
||||
char text[32];
|
||||
bool status = false;
|
||||
unsigned index = 0;
|
||||
|
||||
|
||||
@@ -495,8 +495,8 @@ bool BitString_Value_Object_Name(
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "BITSTRING_VALUE-%u",
|
||||
object_instance);
|
||||
name_text, sizeof(name_text), "BITSTRING_VALUE-%lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -773,7 +773,7 @@ bool Binary_Lighting_Output_Object_Name(
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
char name_text[32] = "BINARY-LIGHTING-OUTPUT-4194303";
|
||||
char name_text[48] = "BINARY-LIGHTING-OUTPUT-4194303";
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
@@ -782,8 +782,8 @@ bool Binary_Lighting_Output_Object_Name(
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "BINARY-LIGHTING-OUTPUT-%u",
|
||||
object_instance);
|
||||
name_text, sizeof(name_text), "BINARY-LIGHTING-OUTPUT-%lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,7 +384,8 @@ bool Calendar_Object_Name(
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "CALENDAR-%u", object_instance);
|
||||
name_text, sizeof(name_text), "CALENDAR-%lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -847,7 +847,7 @@ bool Channel_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
bool status = false;
|
||||
char name_text[24] = "CHANNEL-4194303";
|
||||
char name_text[32] = "CHANNEL-4194303";
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Object_Data(object_instance);
|
||||
|
||||
@@ -696,7 +696,7 @@ bool Color_Object_Name(
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
char name_text[24] = "COLOR-4194303";
|
||||
char name_text[32] = "COLOR-4194303";
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
@@ -704,7 +704,9 @@ bool Color_Object_Name(
|
||||
status =
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(name_text, sizeof(name_text), "COLOR-%u", object_instance);
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "COLOR-%lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -935,7 +935,7 @@ bool Color_Temperature_Object_Name(
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
char name_text[26] = "COLOR-TEMPERATURE-4194303";
|
||||
char name_text[48] = "COLOR-TEMPERATURE-4194303";
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
@@ -944,8 +944,8 @@ bool Color_Temperature_Object_Name(
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "COLOR-TEMPERATURE-%u",
|
||||
object_instance);
|
||||
name_text, sizeof(name_text), "COLOR-TEMPERATURE-%lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,8 +244,8 @@ bool Load_Control_Object_Name(
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "LOAD_CONTROL-%u",
|
||||
object_instance);
|
||||
name_text, sizeof(name_text), "LOAD_CONTROL-%lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -974,7 +974,7 @@ bool Lighting_Output_Object_Name(
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
char name_text[24] = "LIGHTING-OUTPUT-4194303";
|
||||
char name_text[48] = "LIGHTING-OUTPUT-4194303";
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
@@ -983,8 +983,8 @@ bool Lighting_Output_Object_Name(
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "LIGHTING-OUTPUT-%u",
|
||||
object_instance);
|
||||
name_text, sizeof(name_text), "LIGHTING-OUTPUT-%lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,8 +198,8 @@ bool Life_Safety_Point_Object_Name(
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "LIFE-SAFETY-POINT-%u",
|
||||
object_instance);
|
||||
name_text, sizeof(name_text), "LIFE-SAFETY-POINT-%lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,8 +209,8 @@ bool Life_Safety_Zone_Object_Name(
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(
|
||||
name_text, sizeof(name_text), "LIFE-SAFETY-ZONE-%u",
|
||||
object_instance);
|
||||
name_text, sizeof(name_text), "LIFE-SAFETY-ZONE-%lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, name_text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ static void PrintReadRangeData(BACNET_READ_RANGE_DATA *data)
|
||||
by others subject to the procedures and
|
||||
constraints described in Clause 23. */
|
||||
debug_printf_stdout(
|
||||
" proprietary %u", (unsigned)data->object_property);
|
||||
" proprietary %lu", (unsigned long)data->object_property);
|
||||
}
|
||||
if (data->array_index == BACNET_ARRAY_ALL) {
|
||||
debug_printf_stdout(": ");
|
||||
|
||||
+27
-25
@@ -949,42 +949,44 @@ int bacnet_bdt_entry_to_ascii(
|
||||
if (ip_len == 4) {
|
||||
len = snprintf(
|
||||
str, str_size, "%u.%u.%u.%u:%u,%u.%u.%u.%u",
|
||||
value->bbmd_address.host.ip_address.value[0],
|
||||
value->bbmd_address.host.ip_address.value[1],
|
||||
value->bbmd_address.host.ip_address.value[2],
|
||||
value->bbmd_address.host.ip_address.value[3],
|
||||
value->bbmd_address.port, value->broadcast_mask.value[0],
|
||||
value->broadcast_mask.value[1], value->broadcast_mask.value[2],
|
||||
value->broadcast_mask.value[3]);
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[0],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[1],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[2],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[3],
|
||||
(unsigned)value->bbmd_address.port,
|
||||
(unsigned)value->broadcast_mask.value[0],
|
||||
(unsigned)value->broadcast_mask.value[1],
|
||||
(unsigned)value->broadcast_mask.value[2],
|
||||
(unsigned)value->broadcast_mask.value[3]);
|
||||
} else if (ip_len == 16) {
|
||||
len = snprintf(
|
||||
str, str_size,
|
||||
"%02x%02x:%02x%02x:%02x%02x:%02x%02x:"
|
||||
"%02x%02x:%02x%02x:%02x%02x:%02x%02x:%u",
|
||||
value->bbmd_address.host.ip_address.value[0],
|
||||
value->bbmd_address.host.ip_address.value[1],
|
||||
value->bbmd_address.host.ip_address.value[2],
|
||||
value->bbmd_address.host.ip_address.value[3],
|
||||
value->bbmd_address.host.ip_address.value[4],
|
||||
value->bbmd_address.host.ip_address.value[5],
|
||||
value->bbmd_address.host.ip_address.value[6],
|
||||
value->bbmd_address.host.ip_address.value[7],
|
||||
value->bbmd_address.host.ip_address.value[8],
|
||||
value->bbmd_address.host.ip_address.value[9],
|
||||
value->bbmd_address.host.ip_address.value[10],
|
||||
value->bbmd_address.host.ip_address.value[11],
|
||||
value->bbmd_address.host.ip_address.value[12],
|
||||
value->bbmd_address.host.ip_address.value[13],
|
||||
value->bbmd_address.host.ip_address.value[14],
|
||||
value->bbmd_address.host.ip_address.value[15],
|
||||
value->bbmd_address.port);
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[0],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[1],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[2],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[3],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[4],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[5],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[6],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[7],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[8],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[9],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[10],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[11],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[12],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[13],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[14],
|
||||
(unsigned)value->bbmd_address.host.ip_address.value[15],
|
||||
(unsigned)value->bbmd_address.port);
|
||||
}
|
||||
} else if (value->bbmd_address.host_name) {
|
||||
len = snprintf(
|
||||
str, str_size, "%*s:%u",
|
||||
(int)characterstring_length(&value->bbmd_address.host.name),
|
||||
characterstring_value(&value->bbmd_address.host.name),
|
||||
value->bbmd_address.port);
|
||||
(unsigned)value->bbmd_address.port);
|
||||
}
|
||||
|
||||
return len;
|
||||
|
||||
@@ -440,7 +440,7 @@ int lighting_command_to_ascii(
|
||||
priority = value->priority;
|
||||
}
|
||||
len = snprintf(
|
||||
buf, buf_size, "%u,%f,%lu,%u", value->operation,
|
||||
buf, buf_size, "%u,%f,%lu,%u", (unsigned)value->operation,
|
||||
(double)target_level, (unsigned long)fade_time,
|
||||
(unsigned)priority);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user