Changes to reduce the number of warnings with Visual C++2008 warning level 4 to a minimum.
This commit is contained in:
@@ -90,7 +90,7 @@ void dlenv_init(
|
||||
#endif
|
||||
pEnv = getenv("BACNET_IP_PORT");
|
||||
if (pEnv) {
|
||||
bip_set_port(strtol(pEnv, NULL, 0));
|
||||
bip_set_port((uint16_t)strtol(pEnv, NULL, 0));
|
||||
} else {
|
||||
bip_set_port(0xBAC0);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ void dlenv_init(
|
||||
#endif
|
||||
pEnv = getenv("BACNET_APDU_TIMEOUT");
|
||||
if (pEnv) {
|
||||
apdu_timeout_set(strtol(pEnv, NULL, 0));
|
||||
apdu_timeout_set((uint16_t)strtol(pEnv, NULL, 0));
|
||||
fprintf(stderr, "BACNET_APDU_TIMEOUT=%s\r\n", pEnv);
|
||||
} else {
|
||||
#if defined(BACDL_MSTP)
|
||||
@@ -160,8 +160,8 @@ void dlenv_init(
|
||||
fprintf(stderr,
|
||||
"Registering with BBMD at %s:%ld for %ld seconds\n",
|
||||
inet_ntoa(addr), bbmd_port, bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(bbmd_address, bbmd_port,
|
||||
bbmd_timetolive_seconds);
|
||||
bvlc_register_with_bbmd(bbmd_address, (uint16_t)bbmd_port,
|
||||
(uint16_t)bbmd_timetolive_seconds);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -222,7 +222,7 @@ void handler_read_property_multiple(
|
||||
apdu_len =
|
||||
rpm_ack_encode_apdu_init(&Handler_Transmit_Buffer[npdu_len],
|
||||
service_data->invoke_id);
|
||||
do {
|
||||
for(;;) {
|
||||
len =
|
||||
rpm_decode_object_id(&service_request[decode_len],
|
||||
service_len - decode_len, &object_type, &object_instance);
|
||||
@@ -272,7 +272,7 @@ void handler_read_property_multiple(
|
||||
apdu_len += copy_len;
|
||||
}
|
||||
/* do each property of this object of the RPM request */
|
||||
do {
|
||||
for(;;) {
|
||||
len =
|
||||
rpm_decode_object_property(&service_request[decode_len],
|
||||
service_len - decode_len, &object_property, &array_index);
|
||||
@@ -326,7 +326,7 @@ void handler_read_property_multiple(
|
||||
/* handle the error code - but use the special property */
|
||||
len =
|
||||
RPM_Encode_Property(&Handler_Transmit_Buffer[0],
|
||||
npdu_len + apdu_len, MAX_APDU, object_type,
|
||||
(uint16_t)(npdu_len + apdu_len), MAX_APDU, object_type,
|
||||
object_instance, object_property, array_index);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
@@ -344,7 +344,7 @@ void handler_read_property_multiple(
|
||||
special_object_property, index);
|
||||
len =
|
||||
RPM_Encode_Property(&Handler_Transmit_Buffer[0],
|
||||
npdu_len + apdu_len, MAX_APDU, object_type,
|
||||
(uint16_t)(npdu_len + apdu_len), MAX_APDU, object_type,
|
||||
object_instance, object_property, array_index);
|
||||
if (len > 0) {
|
||||
apdu_len += len;
|
||||
@@ -361,7 +361,7 @@ void handler_read_property_multiple(
|
||||
/* handle an individual property */
|
||||
len =
|
||||
RPM_Encode_Property(&Handler_Transmit_Buffer[0],
|
||||
npdu_len + apdu_len, sizeof(Handler_Transmit_Buffer),
|
||||
(uint16_t)(npdu_len + apdu_len), sizeof(Handler_Transmit_Buffer),
|
||||
object_type, object_instance, object_property,
|
||||
array_index);
|
||||
if (len > 0) {
|
||||
@@ -374,11 +374,11 @@ void handler_read_property_multiple(
|
||||
goto RPM_ABORT;
|
||||
}
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
if (decode_len >= service_len) {
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
if (apdu_len > service_data->max_resp) {
|
||||
/* too big for the sender - send an abort */
|
||||
apdu_len =
|
||||
|
||||
@@ -95,7 +95,7 @@ uint8_t Send_Atomic_Read_File_Stream(
|
||||
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);
|
||||
|
||||
@@ -97,7 +97,7 @@ uint8_t Send_Atomic_Write_File_Stream(
|
||||
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);
|
||||
|
||||
@@ -101,7 +101,7 @@ uint8_t Send_Device_Communication_Control_Request(
|
||||
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);
|
||||
|
||||
@@ -118,7 +118,7 @@ uint8_t Send_Private_Transfer_Request(
|
||||
|
||||
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);
|
||||
|
||||
@@ -98,7 +98,7 @@ uint8_t Send_Reinitialize_Device_Request(
|
||||
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);
|
||||
|
||||
@@ -78,7 +78,7 @@ void Send_Who_Is_Router_To_Network(
|
||||
npdu_encode_pdu(&Handler_Transmit_Buffer[0], NULL, NULL, &npdu_data);
|
||||
/* encode the optional DNET portion of the packet */
|
||||
if (dnet >= 0) {
|
||||
len = encode_unsigned16(&Handler_Transmit_Buffer[pdu_len], dnet);
|
||||
len = encode_unsigned16(&Handler_Transmit_Buffer[pdu_len], (uint16_t)dnet);
|
||||
pdu_len += len;
|
||||
#if PRINT_ENABLED
|
||||
fprintf(stderr, "Send Who-Is-Router-To-Network message to %u\n", dnet);
|
||||
@@ -122,7 +122,7 @@ void Send_I_Am_Router_To_Network(
|
||||
fprintf(stderr, "Send I-Am-Router-To-Network message to:\n");
|
||||
#endif
|
||||
while (DNET_list[index] != -1) {
|
||||
dnet = DNET_list[index];
|
||||
dnet = (uint16_t)DNET_list[index];
|
||||
len = encode_unsigned16(&Handler_Transmit_Buffer[pdu_len], dnet);
|
||||
pdu_len += len;
|
||||
index++;
|
||||
|
||||
Reference in New Issue
Block a user