Changed a bunch of debug and information printfs so that they have a better chance of working on systems where int is smaller than 32 bits also fixed the signed/unsigned type of some to match the type of the arguments.
This commit is contained in:
+17
-17
@@ -822,10 +822,10 @@ bool bacapp_print_value(
|
||||
fprintf(stream, "%s", value->type.Boolean ? "TRUE" : "FALSE");
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
|
||||
fprintf(stream, "%u", value->type.Unsigned_Int);
|
||||
fprintf(stream, "%lu", (unsigned long)value->type.Unsigned_Int);
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_SIGNED_INT:
|
||||
fprintf(stream, "%d", value->type.Signed_Int);
|
||||
fprintf(stream, "%ld", (long)value->type.Signed_Int);
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_REAL:
|
||||
fprintf(stream, "%f", (double) value->type.Real);
|
||||
@@ -878,11 +878,11 @@ bool bacapp_print_value(
|
||||
bactext_object_type_name(value->type.
|
||||
Enumerated));
|
||||
} else if (value->type.Enumerated < 128) {
|
||||
fprintf(stream, "reserved %u",
|
||||
value->type.Enumerated);
|
||||
fprintf(stream, "reserved %lu",
|
||||
(unsigned long)value->type.Enumerated);
|
||||
} else {
|
||||
fprintf(stream, "proprietary %u",
|
||||
value->type.Enumerated);
|
||||
fprintf(stream, "proprietary %lu",
|
||||
(unsigned long)value->type.Enumerated);
|
||||
}
|
||||
break;
|
||||
case PROP_EVENT_STATE:
|
||||
@@ -895,8 +895,8 @@ bool bacapp_print_value(
|
||||
bactext_engineering_unit_name(value->
|
||||
type.Enumerated));
|
||||
} else {
|
||||
fprintf(stream, "proprietary %u",
|
||||
value->type.Enumerated);
|
||||
fprintf(stream, "proprietary %lu",
|
||||
(unsigned long)value->type.Enumerated);
|
||||
}
|
||||
break;
|
||||
case PROP_PRESENT_VALUE:
|
||||
@@ -918,7 +918,7 @@ bool bacapp_print_value(
|
||||
bactext_segmentation_name(value->type.Enumerated));
|
||||
break;
|
||||
default:
|
||||
fprintf(stream, "%u", value->type.Enumerated);
|
||||
fprintf(stream, "%lu", (unsigned long)value->type.Enumerated);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -962,17 +962,17 @@ bool bacapp_print_value(
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_OBJECT_ID:
|
||||
if (value->type.Object_Id.type < MAX_ASHRAE_OBJECT_TYPE) {
|
||||
fprintf(stream, "(%s, %u)",
|
||||
fprintf(stream, "(%s, %lu)",
|
||||
bactext_object_type_name(value->type.Object_Id.type),
|
||||
value->type.Object_Id.instance);
|
||||
(unsigned long)value->type.Object_Id.instance);
|
||||
} else if (value->type.Object_Id.type < 128) {
|
||||
fprintf(stream, "(reserved %u, %u)",
|
||||
value->type.Object_Id.type,
|
||||
value->type.Object_Id.instance);
|
||||
fprintf(stream, "(reserved %u, %lu)",
|
||||
(unsigned)value->type.Object_Id.type,
|
||||
(unsigned long)value->type.Object_Id.instance);
|
||||
} else {
|
||||
fprintf(stream, "(proprietary %u, %u)",
|
||||
value->type.Object_Id.type,
|
||||
value->type.Object_Id.instance);
|
||||
fprintf(stream, "(proprietary %u, %lu)",
|
||||
(unsigned)value->type.Object_Id.type,
|
||||
(unsigned long)value->type.Object_Id.instance);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -2007,7 +2007,7 @@ void testBACDCodeUnsignedValue(
|
||||
len = decode_unsigned(&array[len], len_value, &decoded_value);
|
||||
ct_test(pTest, decoded_value == value);
|
||||
if (decoded_value != value) {
|
||||
printf("value=%u decoded_value=%u\n", value, decoded_value);
|
||||
printf("value=%lu decoded_value=%lu\n", (unsigned long)value, (unsigned long)decoded_value);
|
||||
print_apdu(&array[0], sizeof(array));
|
||||
}
|
||||
encode_application_unsigned(&encoded_array[0], decoded_value);
|
||||
@@ -2075,14 +2075,14 @@ void testBACDCodeSignedValue(
|
||||
ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_SIGNED_INT);
|
||||
ct_test(pTest, decoded_value == value);
|
||||
if (decoded_value != value) {
|
||||
printf("value=%d decoded_value=%d\n", value, decoded_value);
|
||||
printf("value=%ld decoded_value=%ld\n", (long)value, (long)decoded_value);
|
||||
print_apdu(&array[0], sizeof(array));
|
||||
}
|
||||
encode_application_signed(&encoded_array[0], decoded_value);
|
||||
diff = memcmp(&array[0], &encoded_array[0], sizeof(array));
|
||||
ct_test(pTest, diff == 0);
|
||||
if (diff) {
|
||||
printf("value=%d decoded_value=%d\n", value, decoded_value);
|
||||
printf("value=%ld decoded_value=%ld\n", (long)value, (long)decoded_value);
|
||||
print_apdu(&array[0], sizeof(array));
|
||||
print_apdu(&encoded_array[0], sizeof(array));
|
||||
}
|
||||
|
||||
@@ -348,8 +348,8 @@ void MSTP_Receive_Frame_FSM(
|
||||
mstp_port->ReceivedInvalidFrame = true;
|
||||
/* wait for the start of a frame. */
|
||||
mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE;
|
||||
printf_receive_error("MSTP: Rx Header: SilenceTimer %d > %d\n",
|
||||
mstp_port->SilenceTimer(), Tframe_abort);
|
||||
printf_receive_error("MSTP: Rx Header: SilenceTimer %u > %d\n",
|
||||
(unsigned)mstp_port->SilenceTimer(), Tframe_abort);
|
||||
}
|
||||
/* Error */
|
||||
else if (mstp_port->ReceiveError == true) {
|
||||
@@ -438,8 +438,8 @@ void MSTP_Receive_Frame_FSM(
|
||||
/* FrameTooLong */
|
||||
if (mstp_port->DataLength) {
|
||||
printf_receive_error
|
||||
("MSTP: Rx Header: FrameTooLong %d\n",
|
||||
mstp_port->DataLength);
|
||||
("MSTP: Rx Header: FrameTooLong %u\n",
|
||||
(unsigned)mstp_port->DataLength);
|
||||
/* indicate that a frame with an illegal or */
|
||||
/* unacceptable data length has been received */
|
||||
mstp_port->ReceivedInvalidFrame = true;
|
||||
@@ -471,8 +471,8 @@ void MSTP_Receive_Frame_FSM(
|
||||
/* indicate that an error has occurred during */
|
||||
/* the reception of a frame */
|
||||
mstp_port->ReceivedInvalidFrame = true;
|
||||
printf_receive_error("MSTP: Rx Data: BadIndex %d\n",
|
||||
mstp_port->Index);
|
||||
printf_receive_error("MSTP: Rx Data: BadIndex %u\n",
|
||||
(unsigned)mstp_port->Index);
|
||||
/* wait for the start of a frame. */
|
||||
mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE;
|
||||
}
|
||||
@@ -488,8 +488,8 @@ void MSTP_Receive_Frame_FSM(
|
||||
/* indicate that an error has occurred during the reception of a frame */
|
||||
mstp_port->ReceivedInvalidFrame = true;
|
||||
printf_receive_error
|
||||
("MSTP: Rx Data: SilenceTimer %dms > %dms\n",
|
||||
mstp_port->SilenceTimer(), Tframe_abort);
|
||||
("MSTP: Rx Data: SilenceTimer %ums > %dms\n",
|
||||
(unsigned)mstp_port->SilenceTimer(), Tframe_abort);
|
||||
/* wait for the start of the next frame. */
|
||||
mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user