Fixed compiler warning messages.

This commit is contained in:
skarg
2010-12-12 05:42:42 +00:00
parent d5b8dee34e
commit 20ca252a8d
3 changed files with 38 additions and 26 deletions
+30 -20
View File
@@ -64,8 +64,8 @@
/* All included BACnet objects */ /* All included BACnet objects */
object_functions_t Object_Table[] = { object_functions_t Object_Table[] = {
{DEVICE_OBJ_FUNCTIONS}, {DEVICE_OBJ_FUNCTIONS},
{MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, {MAX_BACNET_OBJECT_TYPE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
}; };
/* buffer used for receive */ /* buffer used for receive */
@@ -270,15 +270,16 @@ void MyReadPropertyMultipleAckHandler(
static void Init_Service_Handlers( static void Init_Service_Handlers(
void) void)
{ {
uint32_t Object_Instance;
Device_Init(); Device_Init();
#if BAC_ROUTING #if BAC_ROUTING
uint32_t Object_Instance;
/* Put this client Device into the Routing table (first entry) */ /* Put this client Device into the Routing table (first entry) */
Object_Instance = Device_Object_Instance_Number(); Object_Instance = Device_Object_Instance_Number();
Add_Routed_Device( Object_Instance, Device_Object_Name(), Add_Routed_Device( Object_Instance, Device_Object_Name(),
Device_Description() ); Device_Description() );
#endif #endif
/* we need to handle who-is /* we need to handle who-is
to support dynamic device binding to us */ to support dynamic device binding to us */
apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is); apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is);
@@ -786,7 +787,7 @@ void PrintUsage(
printf("bacepics -- Generates Object and Property List for EPICS \r\n"); printf("bacepics -- Generates Object and Property List for EPICS \r\n");
printf("Usage: \r\n"); printf("Usage: \r\n");
printf printf
(" bacepics [-v] [-p sport] [-t target_mac [-n dnet]] device-instance \r\n"); (" bacepics [-v] [-p sport] [-t target_mac [-n dnet]] device-instance \r\n");
printf(" -v: show values instead of '?' \r\n"); printf(" -v: show values instead of '?' \r\n");
printf printf
(" -p: Use sport for \"my\" port, instead of 0xBAC0 (BACnet/IP only) \r\n"); (" -p: Use sport for \"my\" port, instead of 0xBAC0 (BACnet/IP only) \r\n");
@@ -835,22 +836,31 @@ int CheckCommandLineArgs(
My_BIP_Port = (uint16_t) strtol(argv[i], NULL, 0); My_BIP_Port = (uint16_t) strtol(argv[i], NULL, 0);
/* Used strtol so sport can be either 0xBAC0 or 47808 */ /* Used strtol so sport can be either 0xBAC0 or 47808 */
break; break;
case 'n': /* Destination Network Number */ case 'n':
if ( Target_Address.mac_len == 0 ) /* Destination Network Number */
if ( Target_Address.mac_len == 0 )
fprintf(stderr, "Must provide a Target MAC before DNET \r\n"); fprintf(stderr, "Must provide a Target MAC before DNET \r\n");
if (++i < argc) if (++i < argc)
Target_Address.net = (uint16_t) strtol(argv[i], NULL, 0); Target_Address.net = (uint16_t) strtol(argv[i], NULL, 0);
/* Used strtol so dest.net can be either 0x1234 or 4660 */ /* Used strtol so dest.net can be either 0x1234 or 4660 */
break; break;
case 't': case 't':
if (++i < argc) { if (++i < argc) {
uint8_t *mac = Target_Address.mac; /* decoded MAC addresses */
/* The %hhx specifies unsigned char */ unsigned mac[6];
Target_Address.mac_len = /* number of successful decodes */
sscanf(argv[i], "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", int count;
/* loop counter */
unsigned j;
count =
sscanf(argv[i], "%x:%x:%x:%x:%x:%x",
&mac[0], &mac[1], &mac[2], &mac[3], &mac[4], &mac[0], &mac[1], &mac[2], &mac[3], &mac[4],
&mac[5]); &mac[5]);
if (Target_Address.mac_len == 6) { /* success */ if (count == 6) { /* success */
Target_Address.mac_len = count;
for (j = 0; j < 6; j++) {
Target_Address.mac[j] = (uint8_t) mac[j];
}
Target_Address.net = 0; Target_Address.net = 0;
Target_Address.len = 0; /* No src address */ Target_Address.len = 0; /* No src address */
Provided_Targ_MAC = true; Provided_Targ_MAC = true;
@@ -1023,9 +1033,9 @@ int main(
/* else, loop back and try again */ /* else, loop back and try again */
continue; continue;
} else { } else {
/* Print out the header information */ /* Print out the header information */
printf("List of Objects in device %u: \r\n", printf("List of Objects in device %u: \r\n",
Target_Device_Object_Instance); Target_Device_Object_Instance);
/* Print Opening brace, then kick off the Device Object */ /* Print Opening brace, then kick off the Device Object */
printf("{ \r\n"); printf("{ \r\n");
printf(" { \r\n"); /* And opening brace for the first object */ printf(" { \r\n"); /* And opening brace for the first object */
@@ -1230,7 +1240,7 @@ int main(
myObject.instance = KEY_DECODE_ID(nextKey); myObject.instance = KEY_DECODE_ID(nextKey);
/* Don't re-list the Device Object among its objects */ /* Don't re-list the Device Object among its objects */
if (myObject.type == OBJECT_DEVICE) if (myObject.type == OBJECT_DEVICE)
continue; continue;
/* Closing brace for the previous Object */ /* Closing brace for the previous Object */
printf(" }, \r\n"); printf(" }, \r\n");
/* Opening brace for the new Object */ /* Opening brace for the new Object */
@@ -1279,7 +1289,7 @@ int main(
/* Closing brace for all Objects, if we got any */ /* Closing brace for all Objects, if we got any */
if (myState != INITIAL_BINDING) if (myState != INITIAL_BINDING)
printf("} \r\n"); printf("} \r\n");
return 0; return 0;
} }
+1 -1
View File
@@ -182,7 +182,7 @@ int Analog_Input_Read_Property(
return 0; return 0;
} }
apdu = rpdata->application_data; apdu = rpdata->application_data;
switch (rpdata->object_property) { switch ((int)rpdata->object_property) {
case PROP_OBJECT_IDENTIFIER: case PROP_OBJECT_IDENTIFIER:
apdu_len = apdu_len =
encode_application_object_id(&apdu[0], OBJECT_ANALOG_INPUT, encode_application_object_id(&apdu[0], OBJECT_ANALOG_INPUT,
+7 -5
View File
@@ -3,6 +3,8 @@
/** @file bigend.c Determination of Endianess */ /** @file bigend.c Determination of Endianess */
#include "bigend.h"
/* Big-Endian systems save the most significant byte first. */ /* Big-Endian systems save the most significant byte first. */
/* Sun and Motorola processors, IBM-370s and PDP-10s are big-endian. */ /* Sun and Motorola processors, IBM-370s and PDP-10s are big-endian. */
/* "Network Byte Order" is also know as "Big-Endian Byte Order" */ /* "Network Byte Order" is also know as "Big-Endian Byte Order" */
@@ -24,11 +26,11 @@
If you use bitwise or bitshift operations on integers, If you use bitwise or bitshift operations on integers,
you can avoid having to check for endianness. */ you can avoid having to check for endianness. */
/* The names are derived from Jonathon Swift's book Gulliver's Travels, /* The names are derived from Jonathon Swift's book Gulliver's Travels,
where they describe Lilliputian political parties who disagree where they describe Lilliputian political parties who disagree
vehemently over which end to start eating an egg from. vehemently over which end to start eating an egg from.
This terminology was popularized for byte order by a less than This terminology was popularized for byte order by a less than
completely serious paper authored by Danny Cohen which appeared completely serious paper authored by Danny Cohen which appeared
on April 1, 1980 and was entitled "On Holy Wars and a Plea for Peace" */ on April 1, 1980 and was entitled "On Holy Wars and a Plea for Peace" */
/* function to return true on Big-Endian architectures */ /* function to return true on Big-Endian architectures */