Added casts to remove warnings on IAR compiler.

This commit is contained in:
skarg
2007-06-20 21:21:26 +00:00
parent 9db08e316b
commit b3f0ef2d74
9 changed files with 35 additions and 31 deletions
+2 -1
View File
@@ -1034,9 +1034,10 @@ typedef enum {
NETWORK_MESSAGE_INITIALIZE_ROUTING_TABLE = 6, NETWORK_MESSAGE_INITIALIZE_ROUTING_TABLE = 6,
NETWORK_MESSAGE_INITIALIZE_ROUTING_TABLE_ACK = 7, NETWORK_MESSAGE_INITIALIZE_ROUTING_TABLE_ACK = 7,
NETWORK_MESSAGE_ESTABLISH_CONNECTION_TO_NETWORK = 8, NETWORK_MESSAGE_ESTABLISH_CONNECTION_TO_NETWORK = 8,
NETWORK_MESSAGE_DISCONNECT_CONNECTION_TO_NETWORK = 9 NETWORK_MESSAGE_DISCONNECT_CONNECTION_TO_NETWORK = 9,
/* X'0A' to X'7F': Reserved for use by ASHRAE, */ /* X'0A' to X'7F': Reserved for use by ASHRAE, */
/* X'80' to X'FF': Available for vendor proprietary messages */ /* X'80' to X'FF': Available for vendor proprietary messages */
NETWORK_MESSAGE_INVALID = 0x100
} BACNET_NETWORK_MESSAGE_TYPE; } BACNET_NETWORK_MESSAGE_TYPE;
+1 -1
View File
@@ -184,7 +184,7 @@ int dcc_decode_service_request(uint8_t * apdu,
&tag_number, &len_value_type); &tag_number, &len_value_type);
len += decode_enumerated(&apdu[len], len_value_type, &value); len += decode_enumerated(&apdu[len], len_value_type, &value);
if (enable_disable) if (enable_disable)
*enable_disable = value; *enable_disable = (BACNET_COMMUNICATION_ENABLE_DISABLE)value;
/* Tag 2: password --optional-- */ /* Tag 2: password --optional-- */
if (len < apdu_len) { if (len < apdu_len) {
if (!decode_is_context_tag(&apdu[len], 2)) if (!decode_is_context_tag(&apdu[len], 2))
+1 -1
View File
@@ -298,7 +298,7 @@ bool Binary_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
(priority != 6 /* reserved */ ) && (priority != 6 /* reserved */ ) &&
(value.type.Enumerated >= MIN_BINARY_PV) && (value.type.Enumerated >= MIN_BINARY_PV) &&
(value.type.Enumerated <= MAX_BINARY_PV)) { (value.type.Enumerated <= MAX_BINARY_PV)) {
level = value.type.Enumerated; level = (BACNET_BINARY_PV)value.type.Enumerated;
object_index = object_index =
Binary_Output_Instance_To_Index(wp_data-> Binary_Output_Instance_To_Index(wp_data->
object_instance); object_instance);
+1 -1
View File
@@ -295,7 +295,7 @@ bool Binary_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
(priority != 6 /* reserved */ ) && (priority != 6 /* reserved */ ) &&
(value.type.Enumerated >= MIN_BINARY_PV) && (value.type.Enumerated >= MIN_BINARY_PV) &&
(value.type.Enumerated <= MAX_BINARY_PV)) { (value.type.Enumerated <= MAX_BINARY_PV)) {
level = value.type.Enumerated; level = (BACNET_BINARY_PV)value.type.Enumerated;
object_index = object_index =
Binary_Value_Instance_To_Index(wp_data-> Binary_Value_Instance_To_Index(wp_data->
object_instance); object_instance);
+3 -2
View File
@@ -670,7 +670,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
for (i = 0; i < MAX_BACNET_SERVICES_SUPPORTED; i++) { for (i = 0; i < MAX_BACNET_SERVICES_SUPPORTED; i++) {
/* automatic lookup based on handlers set */ /* automatic lookup based on handlers set */
bitstring_set_bit(&bit_string, (uint8_t) i, bitstring_set_bit(&bit_string, (uint8_t) i,
apdu_service_supported(i)); apdu_service_supported((BACNET_SERVICES_SUPPORTED)i));
} }
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string); apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
break; break;
@@ -858,7 +858,8 @@ bool Device_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
case PROP_SYSTEM_STATUS: case PROP_SYSTEM_STATUS:
if (value.tag == BACNET_APPLICATION_TAG_ENUMERATED) { if (value.tag == BACNET_APPLICATION_TAG_ENUMERATED) {
Device_Set_System_Status(value.type.Enumerated); /* FIXME: bounds check? */
Device_Set_System_Status((BACNET_DEVICE_STATUS)value.type.Enumerated);
status = true; status = true;
} else { } else {
*error_class = ERROR_CLASS_PROPERTY; *error_class = ERROR_CLASS_PROPERTY;
+7 -5
View File
@@ -196,7 +196,7 @@ void npdu_encode_npdu_data(BACNET_NPDU_DATA * npdu_data,
npdu_data->data_expecting_reply = data_expecting_reply; npdu_data->data_expecting_reply = data_expecting_reply;
npdu_data->protocol_version = BACNET_PROTOCOL_VERSION; npdu_data->protocol_version = BACNET_PROTOCOL_VERSION;
npdu_data->network_layer_message = false; /* false if APDU */ npdu_data->network_layer_message = false; /* false if APDU */
npdu_data->network_message_type = 0; /* optional */ npdu_data->network_message_type = NETWORK_MESSAGE_INVALID; /* optional */
npdu_data->vendor_id = 0; /* optional, if net message type is > 0x80 */ npdu_data->vendor_id = 0; /* optional, if net message type is > 0x80 */
npdu_data->priority = priority; npdu_data->priority = priority;
npdu_data->hop_count = 0; npdu_data->hop_count = 0;
@@ -239,7 +239,7 @@ int npdu_decode(uint8_t * npdu,
/* B'10' = Critical Equipment message */ /* B'10' = Critical Equipment message */
/* B'01' = Urgent message */ /* B'01' = Urgent message */
/* B'00' = Normal message */ /* B'00' = Normal message */
npdu_data->priority = npdu[1] & 0x03; npdu_data->priority = (BACNET_MESSAGE_PRIORITY)(npdu[1] & 0x03);
/* set the offset to where the optional stuff starts */ /* set the offset to where the optional stuff starts */
len = 2; len = 2;
/*Bit 5: Destination specifier where: */ /*Bit 5: Destination specifier where: */
@@ -310,14 +310,16 @@ int npdu_decode(uint8_t * npdu,
/* Indicates that the NSDU conveys a network layer message. */ /* Indicates that the NSDU conveys a network layer message. */
/* Message Type field is present. */ /* Message Type field is present. */
if (npdu_data->network_layer_message) { if (npdu_data->network_layer_message) {
npdu_data->network_message_type = npdu[len++]; npdu_data->network_message_type = (BACNET_NETWORK_MESSAGE_TYPE)npdu[len++];
/* Message Type field contains a value in the range 0x80 - 0xFF, */ /* Message Type field contains a value in the range 0x80 - 0xFF, */
/* then a Vendor ID field shall be present */ /* then a Vendor ID field shall be present */
if (npdu_data->network_message_type >= 0x80) if (npdu_data->network_message_type >= 0x80)
len += len +=
decode_unsigned16(&npdu[len], &npdu_data->vendor_id); decode_unsigned16(&npdu[len], &npdu_data->vendor_id);
} else } else {
npdu_data->network_message_type = 0; /* FIXME: another value for this? */
npdu_data->network_message_type = NETWORK_MESSAGE_INVALID;
}
} }
return len; return len;
+1 -1
View File
@@ -84,7 +84,7 @@ int rd_decode_service_request(uint8_t * apdu,
&tag_number, &len_value_type); &tag_number, &len_value_type);
len += decode_enumerated(&apdu[len], len_value_type, &value); len += decode_enumerated(&apdu[len], len_value_type, &value);
if (state) if (state)
*state = value; *state = (BACNET_REINITIALIZED_STATE)value;
/* Tag 1: password - optional */ /* Tag 1: password - optional */
if (len < apdu_len) { if (len < apdu_len) {
if (!decode_is_context_tag(&apdu[len], 1)) if (!decode_is_context_tag(&apdu[len], 1))
+4 -4
View File
@@ -84,14 +84,14 @@ int rp_decode_service_request(uint8_t * apdu,
if (!decode_is_context_tag(&apdu[len++], 0)) if (!decode_is_context_tag(&apdu[len++], 0))
return -1; return -1;
len += decode_object_id(&apdu[len], &type, &data->object_instance); len += decode_object_id(&apdu[len], &type, &data->object_instance);
data->object_type = type; data->object_type = (BACNET_OBJECT_TYPE)type;
/* Tag 1: Property ID */ /* Tag 1: Property ID */
len += decode_tag_number_and_value(&apdu[len], len += decode_tag_number_and_value(&apdu[len],
&tag_number, &len_value_type); &tag_number, &len_value_type);
if (tag_number != 1) if (tag_number != 1)
return -1; return -1;
len += decode_enumerated(&apdu[len], len_value_type, &property); len += decode_enumerated(&apdu[len], len_value_type, &property);
data->object_property = property; data->object_property = (BACNET_PROPERTY_ID)property;
/* Tag 2: Optional Array Index */ /* Tag 2: Optional Array Index */
if (len < apdu_len) { if (len < apdu_len) {
len += decode_tag_number_and_value(&apdu[len], &tag_number, len += decode_tag_number_and_value(&apdu[len], &tag_number,
@@ -157,14 +157,14 @@ int rp_ack_decode_service_request(uint8_t * apdu, int apdu_len, /* total length
return -1; return -1;
len = 1; len = 1;
len += decode_object_id(&apdu[len], &object, &data->object_instance); len += decode_object_id(&apdu[len], &object, &data->object_instance);
data->object_type = object; data->object_type = (BACNET_OBJECT_TYPE)object;
/* Tag 1: Property ID */ /* Tag 1: Property ID */
len += decode_tag_number_and_value(&apdu[len], len += decode_tag_number_and_value(&apdu[len],
&tag_number, &len_value_type); &tag_number, &len_value_type);
if (tag_number != 1) if (tag_number != 1)
return -1; return -1;
len += decode_enumerated(&apdu[len], len_value_type, &property); len += decode_enumerated(&apdu[len], len_value_type, &property);
data->object_property = property; data->object_property = (BACNET_PROPERTY_ID)property;
/* Tag 2: Optional Array Index */ /* Tag 2: Optional Array Index */
tag_len = decode_tag_number_and_value(&apdu[len], tag_len = decode_tag_number_and_value(&apdu[len],
&tag_number, &len_value_type); &tag_number, &len_value_type);
+3 -3
View File
@@ -105,14 +105,14 @@ int wp_decode_service_request(uint8_t * apdu,
if (!decode_is_context_tag(&apdu[len++], 0)) if (!decode_is_context_tag(&apdu[len++], 0))
return -1; return -1;
len += decode_object_id(&apdu[len], &type, &data->object_instance); len += decode_object_id(&apdu[len], &type, &data->object_instance);
data->object_type = type; data->object_type = (BACNET_OBJECT_TYPE)type;
/* Tag 1: Property ID */ /* Tag 1: Property ID */
len += decode_tag_number_and_value(&apdu[len], len += decode_tag_number_and_value(&apdu[len],
&tag_number, &len_value_type); &tag_number, &len_value_type);
if (tag_number != 1) if (tag_number != 1)
return -1; return -1;
len += decode_enumerated(&apdu[len], len_value_type, &property); len += decode_enumerated(&apdu[len], len_value_type, &property);
data->object_property = property; data->object_property = (BACNET_PROPERTY_ID)property;
/* Tag 2: Optional Array Index */ /* Tag 2: Optional Array Index */
/* note: decode without incrementing len so we can check for opening tag */ /* note: decode without incrementing len so we can check for opening tag */
tag_len = decode_tag_number_and_value(&apdu[len], tag_len = decode_tag_number_and_value(&apdu[len],
@@ -129,7 +129,7 @@ int wp_decode_service_request(uint8_t * apdu,
return -1; return -1;
/* determine the length of the data blob */ /* determine the length of the data blob */
data->application_data_len = bacapp_data_len(&apdu[len], data->application_data_len = bacapp_data_len(&apdu[len],
apdu_len - len, property); apdu_len - len, (BACNET_PROPERTY_ID)property);
/* a tag number of 3 is not extended so only one octet */ /* a tag number of 3 is not extended so only one octet */
len++; len++;
/* copy the data from the APDU */ /* copy the data from the APDU */