Cleaned up warnings from Visual C++ 6.0 compile by adding casts.
This commit is contained in:
@@ -348,7 +348,7 @@ bool bacapp_print_value(FILE * stream,
|
||||
for (i = 0; i < len; i++) {
|
||||
fprintf(stream, "%s",
|
||||
bitstring_bit(&value->type.Bit_String,
|
||||
i) ? "true" : "false");
|
||||
(uint8_t)i) ? "true" : "false");
|
||||
if (i < len - 1)
|
||||
fprintf(stream, ",");
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
/* This is used in constructing messages and to tell others our limits */
|
||||
/* 50 is the minimum; adjust to your memory and physical layer constraints */
|
||||
/* Lon=206, MS/TP=480, ARCNET=480, Ethernet=1476 */
|
||||
/* #define MAX_APDU 50 */
|
||||
#define MAX_APDU 480
|
||||
#define MAX_APDU 50
|
||||
/* #define MAX_APDU 480 */
|
||||
/* #define MAX_APDU 1476 */
|
||||
|
||||
/* for confirmed messages, this is the number of transactions */
|
||||
|
||||
@@ -67,10 +67,11 @@ static void PrintReadPropertyData(BACNET_READ_PROPERTY_DATA * data)
|
||||
#endif
|
||||
application_data = data->application_data;
|
||||
application_data_len = data->application_data_len;
|
||||
/* FIXME: what if application_data_len is bigger than 255? */
|
||||
/* value? need to loop until all of the len is gone... */
|
||||
for (;;) {
|
||||
len = bacapp_decode_application_data(application_data,
|
||||
application_data_len, &value);
|
||||
(uint8_t)application_data_len, &value);
|
||||
if (first_value && (len < application_data_len)) {
|
||||
first_value = false;
|
||||
fprintf(stdout, "{");
|
||||
|
||||
@@ -89,7 +89,7 @@ uint8_t Send_Read_Property_Request(uint32_t device_id, /* destination device */
|
||||
max_apdu in the address binding table. */
|
||||
if ((unsigned) pdu_len < max_apdu) {
|
||||
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
|
||||
&npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
|
||||
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
|
||||
bytes_sent =
|
||||
datalink_send_pdu(&dest, &npdu_data,
|
||||
&Handler_Transmit_Buffer[0], pdu_len);
|
||||
|
||||
@@ -92,7 +92,7 @@ uint8_t Send_Write_Property_Request(uint32_t device_id, /* destination device */
|
||||
max_apdu in the address binding table. */
|
||||
if ((unsigned) pdu_len < max_apdu) {
|
||||
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
|
||||
&npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
|
||||
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
|
||||
bytes_sent =
|
||||
datalink_send_pdu(&dest, &npdu_data,
|
||||
&Handler_Transmit_Buffer[0], pdu_len);
|
||||
|
||||
@@ -84,7 +84,7 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
|
||||
int apdu_len = 0; /* return value */
|
||||
BACNET_BIT_STRING bit_string;
|
||||
BACNET_CHARACTER_STRING char_string;
|
||||
float value = 3.14;
|
||||
float value = (float)3.14;
|
||||
|
||||
(void) array_index;
|
||||
switch (property) {
|
||||
@@ -122,7 +122,7 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
|
||||
apdu_len = encode_tagged_enumerated(&apdu[0], UNITS_PERCENT);
|
||||
break;
|
||||
case 9997:
|
||||
apdu_len = encode_tagged_real(&apdu[0], 90.510);
|
||||
apdu_len = encode_tagged_real(&apdu[0], (float)90.510);
|
||||
break;
|
||||
case 9998:
|
||||
apdu_len = encode_tagged_unsigned(&apdu[0], 90);
|
||||
|
||||
@@ -160,7 +160,7 @@ int Analog_Output_Encode_Property_APDU(uint8_t * apdu,
|
||||
int apdu_len = 0; /* return value */
|
||||
BACNET_BIT_STRING bit_string;
|
||||
BACNET_CHARACTER_STRING char_string;
|
||||
float real_value = 1.414;
|
||||
float real_value = (float)1.414;
|
||||
unsigned object_index = 0;
|
||||
unsigned i = 0;
|
||||
bool state = false;
|
||||
|
||||
@@ -159,7 +159,7 @@ int Analog_Value_Encode_Property_APDU(uint8_t * apdu,
|
||||
int apdu_len = 0; /* return value */
|
||||
BACNET_BIT_STRING bit_string;
|
||||
BACNET_CHARACTER_STRING char_string;
|
||||
float real_value = 1.414;
|
||||
float real_value = (float)1.414;
|
||||
unsigned object_index = 0;
|
||||
unsigned i = 0;
|
||||
bool state = false;
|
||||
|
||||
@@ -308,7 +308,6 @@ uint32_t bacfile_instance_from_tsm(uint8_t invokeID)
|
||||
BACNET_ATOMIC_READ_FILE_DATA data = { 0 };
|
||||
uint32_t object_instance = BACNET_MAX_INSTANCE + 1; /* return value */
|
||||
bool found = false;
|
||||
int apdu_offset = 0;
|
||||
|
||||
found = tsm_get_transaction_pdu(invokeID, &dest, &npdu_data, &apdu[0],
|
||||
&apdu_len);
|
||||
@@ -318,7 +317,7 @@ uint32_t bacfile_instance_from_tsm(uint8_t invokeID)
|
||||
&& (apdu[0] == PDU_TYPE_CONFIRMED_SERVICE_REQUEST)) {
|
||||
len =
|
||||
apdu_decode_confirmed_service_request(&apdu[0],
|
||||
apdu_len - apdu_offset, &service_data, &service_choice,
|
||||
apdu_len, &service_data, &service_choice,
|
||||
&service_request, &service_request_len);
|
||||
if (service_choice == SERVICE_CONFIRMED_ATOMIC_READ_FILE) {
|
||||
len = arf_decode_service_request(service_request,
|
||||
|
||||
@@ -305,7 +305,7 @@ bool Multistate_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
Multistate_Output_Instance_To_Index(wp_data->
|
||||
object_instance);
|
||||
priority--;
|
||||
Multistate_Output_Level[object_index][priority] = level;
|
||||
Multistate_Output_Level[object_index][priority] = (uint8_t)level;
|
||||
/* Note: you could set the physical output here if we
|
||||
are the highest priority.
|
||||
However, if Out of Service is TRUE, then don't set the
|
||||
@@ -330,7 +330,7 @@ bool Multistate_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
priority = wp_data->priority;
|
||||
if (priority && (priority <= BACNET_MAX_PRIORITY)) {
|
||||
priority--;
|
||||
Multistate_Output_Level[object_index][priority] = level;
|
||||
Multistate_Output_Level[object_index][priority] = (uint8_t)level;
|
||||
/* Note: you could set the physical output here to the next
|
||||
highest priority, or to the relinquish default if no
|
||||
priorities are set.
|
||||
|
||||
+2
-2
@@ -334,10 +334,10 @@ void npdu_handler(BACNET_ADDRESS * src, /* source address */
|
||||
apdu_offset = npdu_decode(&pdu[0], &dest, src, &npdu_data);
|
||||
if (npdu_data.network_layer_message) {
|
||||
/*FIXME: network layer message received! Handle it! */
|
||||
} else {
|
||||
} else if ((apdu_offset > 0) && (apdu_offset <= pdu_len)) {
|
||||
/* only handle the version that we know how to handle */
|
||||
if (npdu_data.protocol_version == BACNET_PROTOCOL_VERSION)
|
||||
apdu_handler(src, &pdu[apdu_offset], pdu_len - apdu_offset);
|
||||
apdu_handler(src, &pdu[apdu_offset], (uint16_t)(pdu_len - apdu_offset));
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
+2
-1
@@ -130,8 +130,9 @@ int wp_decode_service_request(uint8_t * apdu,
|
||||
/* FIXME: decode the length of the context specific tag value */
|
||||
if (decode_is_context_specific(&apdu[len]))
|
||||
return -2;
|
||||
/* FIXME: what if the length is more than 255 */
|
||||
len += bacapp_decode_application_data(&apdu[len],
|
||||
apdu_len - len, &data->value);
|
||||
(uint8_t)(apdu_len - len), &data->value);
|
||||
/* FIXME: check the return value; abort if no valid data? */
|
||||
/* FIXME: there might be more than one data element in here! */
|
||||
if (!decode_is_closing_tag_number(&apdu[len], 3))
|
||||
|
||||
Reference in New Issue
Block a user