Changed Device_Object_List_Identifier() to use uint32_t for array_index since that is the size decoded in a ReadProperty request, and unsigned is not always 32-bit.

This commit is contained in:
skarg
2016-10-25 13:10:28 +00:00
parent ec2b585e18
commit b2938bb68a
15 changed files with 71 additions and 71 deletions
+4 -4
View File
@@ -512,7 +512,7 @@ unsigned Device_Object_List_Count(
* @return True if found, else false.
*/
bool Device_Object_List_Identifier(
unsigned array_index,
uint32_t array_index,
int *object_type,
uint32_t * instance)
{
@@ -578,7 +578,7 @@ bool Device_Valid_Object_Name(
bool found = false;
int type = 0;
uint32_t instance;
unsigned max_objects = 0, i = 0;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
BACNET_CHARACTER_STRING object_name2;
struct object_functions *pObject = NULL;
@@ -808,10 +808,10 @@ int Device_Read_Property_Local(
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
unsigned i = 0;
uint32_t i = 0;
int object_type = 0;
uint32_t instance = 0;
unsigned count = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
struct object_functions *pObject = NULL;
bool found = false;
+7 -7
View File
@@ -1068,14 +1068,14 @@ unsigned Device_Object_List_Count(
* @return True if found, else false.
*/
bool Device_Object_List_Identifier(
unsigned array_index,
uint32_t array_index,
int *object_type,
uint32_t * instance)
{
bool status = false;
unsigned count = 0;
unsigned object_index = 0;
unsigned temp_index = 0;
uint32_t count = 0;
uint32_t object_index = 0;
uint32_t temp_index = 0;
struct object_functions *pObject = NULL;
/* array index zero is length - so invalid */
@@ -1134,7 +1134,7 @@ bool Device_Valid_Object_Name(
bool found = false;
int type = 0;
uint32_t instance;
unsigned max_objects = 0, i = 0;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
BACNET_CHARACTER_STRING object_name2;
struct object_functions *pObject = NULL;
@@ -1369,10 +1369,10 @@ int Device_Read_Property_Local(
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string = { 0 };
BACNET_CHARACTER_STRING char_string = { 0 };
unsigned i = 0;
uint32_t i = 0;
int object_type = 0;
uint32_t instance = 0;
unsigned count = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
struct object_functions *pObject = NULL;
bool found = false;
+1 -1
View File
@@ -275,7 +275,7 @@ extern "C" {
unsigned Device_Object_List_Count(
void);
bool Device_Object_List_Identifier(
unsigned array_index,
uint32_t array_index,
int *object_type,
uint32_t * instance);
+7 -7
View File
@@ -709,14 +709,14 @@ unsigned Device_Object_List_Count(
* @return True if found, else false.
*/
bool Device_Object_List_Identifier(
unsigned array_index,
uint32_t array_index,
int *object_type,
uint32_t * instance)
{
bool status = false;
unsigned count = 0;
unsigned object_index = 0;
unsigned temp_index = 0;
uint32_t count = 0;
uint32_t object_index = 0;
uint32_t temp_index = 0;
struct object_functions *pObject = NULL;
/* array index zero is length - so invalid */
@@ -775,7 +775,7 @@ bool Device_Valid_Object_Name(
bool found = false;
int type = 0;
uint32_t instance;
unsigned max_objects = 0, i = 0;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
BACNET_CHARACTER_STRING object_name2;
struct object_functions *pObject = NULL;
@@ -931,10 +931,10 @@ int Device_Read_Property_Local(
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string = { 0 };
BACNET_CHARACTER_STRING char_string = { 0 };
unsigned i = 0;
uint32_t i = 0;
int object_type = 0;
uint32_t instance = 0;
unsigned count = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
struct object_functions *pObject = NULL;
bool found = false;
+1 -1
View File
@@ -66,7 +66,7 @@ extern "C" {
bool Device_Set_Object_Instance_Number(uint32_t object_id);
bool Device_Valid_Object_Instance_Number(uint32_t object_id);
unsigned Device_Object_List_Count(void);
bool Device_Object_List_Identifier(unsigned array_index,
bool Device_Object_List_Identifier(uint32_t array_index,
int *object_type,
uint32_t * instance);
+6 -6
View File
@@ -515,13 +515,13 @@ unsigned Device_Object_List_Count(
}
bool Device_Object_List_Identifier(
unsigned array_index,
uint32_t array_index,
int *object_type,
uint32_t * instance)
{
bool status = false;
unsigned count = 0;
unsigned object_index = 0;
uint32_t count = 0;
uint32_t object_index = 0;
struct my_object_functions *pObject = NULL;
/* array index zero is length - so invalid */
@@ -556,7 +556,7 @@ bool Device_Valid_Object_Name(
bool found = false;
int type = 0;
uint32_t instance;
unsigned max_objects = 0, i = 0;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
BACNET_CHARACTER_STRING object_name2;
struct my_object_functions *pObject = NULL;
@@ -623,10 +623,10 @@ int Device_Read_Property_Local(
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
unsigned i = 0;
uint32_t i = 0;
int object_type = 0;
uint32_t instance = 0;
unsigned count = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
struct my_object_functions *pObject = NULL;
+5 -5
View File
@@ -113,13 +113,13 @@ unsigned Device_Object_List_Count(
}
bool Device_Object_List_Identifier(
unsigned array_index,
uint32_t array_index,
int *object_type,
uint32_t * instance)
{
bool status = false;
unsigned object_index = 0;
unsigned object_count = 0;
uint32_t object_index = 0;
uint32_t object_count = 0;
/* device object */
if (array_index == 1) {
@@ -173,10 +173,10 @@ int Device_Encode_Property_APDU(
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
unsigned i = 0;
uint32_t i = 0;
int object_type = 0;
uint32_t instance = 0;
unsigned count = 0;
uint32_t count = 0;
object_instance = object_instance;
/* FIXME: change the hardcoded names to suit your application */
+1 -1
View File
@@ -80,7 +80,7 @@ extern "C" {
unsigned Device_Object_List_Count(
void);
bool Device_Object_List_Identifier(
unsigned array_index,
uint32_t array_index,
int *object_type,
uint32_t * instance);
+5 -5
View File
@@ -117,13 +117,13 @@ unsigned Device_Object_List_Count(
}
bool Device_Object_List_Identifier(
unsigned array_index,
uint32_t array_index,
int *object_type,
uint32_t * instance)
{
bool status = false;
unsigned object_index = 0;
unsigned object_count = 0;
uint32_t object_index = 0;
uint32_t object_count = 0;
/* device object */
if (array_index == 1) {
@@ -176,10 +176,10 @@ int Device_Read_Property(
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
unsigned i = 0;
uint32_t i = 0;
int object_type = 0;
uint32_t instance = 0;
unsigned count = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
if ((rpdata->application_data == NULL) ||
+6 -6
View File
@@ -457,13 +457,13 @@ unsigned Device_Object_List_Count(
}
bool Device_Object_List_Identifier(
unsigned array_index,
uint32_t array_index,
int *object_type,
uint32_t * instance)
{
bool status = false;
unsigned count = 0;
unsigned object_index = 0;
uint32_t count = 0;
uint32_t object_index = 0;
struct my_object_functions *pObject = NULL;
/* array index zero is length - so invalid */
@@ -498,7 +498,7 @@ bool Device_Valid_Object_Name(
bool found = false;
int type = 0;
uint32_t instance;
unsigned max_objects = 0, i = 0;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
BACNET_CHARACTER_STRING object_name2;
struct my_object_functions *pObject = NULL;
@@ -565,10 +565,10 @@ int Device_Read_Property_Local(
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string = { 0 };
BACNET_CHARACTER_STRING char_string = { 0 };
unsigned i = 0;
uint32_t i = 0;
int object_type = 0;
uint32_t instance = 0;
unsigned count = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
struct my_object_functions *pObject = NULL;
+5 -5
View File
@@ -193,13 +193,13 @@ unsigned Device_Object_List_Count(
/* Since many network clients depend on the object list */
/* for discovery, it must be consistent! */
bool Device_Object_List_Identifier(
unsigned array_index,
uint32_t array_index,
int *object_type,
uint32_t * instance)
{
bool status = false;
unsigned object_index = 0;
unsigned object_count = 0;
uint32_t object_index = 0;
uint32_t object_count = 0;
/* device object */
if (array_index == 1) {
@@ -272,10 +272,10 @@ int Device_Read_Property_Local(
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
unsigned i = 0;
uint32_t i = 0;
int object_type = 0;
uint32_t instance = 0;
unsigned count = 0;
uint32_t count = 0;
BACNET_TIME local_time;
BACNET_DATE local_date;
uint8_t year = 0;
+5 -5
View File
@@ -193,13 +193,13 @@ unsigned Device_Object_List_Count(
/* Since many network clients depend on the object list */
/* for discovery, it must be consistent! */
bool Device_Object_List_Identifier(
unsigned array_index,
uint32_t array_index,
int *object_type,
uint32_t * instance)
{
bool status = false;
unsigned object_index = 0;
unsigned object_count = 0;
uint32_t object_index = 0;
uint32_t object_count = 0;
/* device object */
if (array_index == 1) {
@@ -272,10 +272,10 @@ int Device_Read_Property_Local(
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
unsigned i = 0;
uint32_t i = 0;
int object_type = 0;
uint32_t instance = 0;
unsigned count = 0;
uint32_t count = 0;
BACNET_TIME local_time;
BACNET_DATE local_date;
uint8_t year = 0;
+6 -6
View File
@@ -495,13 +495,13 @@ unsigned Device_Object_List_Count(
}
bool Device_Object_List_Identifier(
unsigned array_index,
uint32_t array_index,
int *object_type,
uint32_t * instance)
{
bool status = false;
unsigned count = 0;
unsigned object_index = 0;
uint32_t count = 0;
uint32_t object_index = 0;
struct my_object_functions *pObject = NULL;
/* array index zero is length - so invalid */
@@ -544,7 +544,7 @@ bool Device_Valid_Object_Name(
bool found = false;
int type = 0;
uint32_t instance;
unsigned max_objects = 0, i = 0;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
char *name = NULL;
@@ -593,10 +593,10 @@ int Device_Read_Property_Local(
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
unsigned i = 0;
uint32_t i = 0;
int object_type = 0;
uint32_t instance = 0;
unsigned count = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
struct my_object_functions *pObject = NULL;
bool found = false;
+6 -6
View File
@@ -516,13 +516,13 @@ unsigned Device_Object_List_Count(
}
bool Device_Object_List_Identifier(
unsigned array_index,
uint32_t array_index,
int *object_type,
uint32_t * instance)
{
bool status = false;
unsigned count = 0;
unsigned object_index = 0;
uint32_t count = 0;
uint32_t object_index = 0;
struct my_object_functions *pObject = NULL;
/* array index zero is length - so invalid */
@@ -557,7 +557,7 @@ bool Device_Valid_Object_Name(
bool found = false;
int type = 0;
uint32_t instance;
unsigned max_objects = 0, i = 0;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
BACNET_CHARACTER_STRING object_name2;
struct my_object_functions *pObject = NULL;
@@ -624,10 +624,10 @@ int Device_Read_Property_Local(
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
unsigned i = 0;
uint32_t i = 0;
int object_type = 0;
uint32_t instance = 0;
unsigned count = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
struct my_object_functions *pObject = NULL;
+6 -6
View File
@@ -505,13 +505,13 @@ unsigned Device_Object_List_Count(void)
return count;
}
bool Device_Object_List_Identifier(unsigned array_index,
bool Device_Object_List_Identifier(uint32_t array_index,
int *object_type,
uint32_t * instance)
{
bool status = false;
unsigned count = 0;
unsigned object_index = 0;
uint32_t count = 0;
uint32_t object_index = 0;
struct my_object_functions *pObject = NULL;
/* array index zero is length - so invalid */
@@ -545,7 +545,7 @@ bool Device_Valid_Object_Name(BACNET_CHARACTER_STRING * object_name1,
bool found = false;
int type = 0;
uint32_t instance;
unsigned max_objects = 0, i = 0;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
BACNET_CHARACTER_STRING object_name2;
struct my_object_functions *pObject = NULL;
@@ -609,10 +609,10 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA * rpdata)
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string = { 0 };
BACNET_CHARACTER_STRING char_string = { 0 };
unsigned i = 0;
uint32_t i = 0;
int object_type = 0;
uint32_t instance = 0;
unsigned count = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
struct my_object_functions *pObject = NULL;