Corrected some warnings generated from Borland compile.

This commit is contained in:
skarg
2010-02-10 17:43:11 +00:00
parent f0863c0238
commit e4080f41da
5 changed files with 93 additions and 85 deletions
+1
View File
@@ -41,6 +41,7 @@
#include "awf.h" #include "awf.h"
#include "rp.h" #include "rp.h"
#include "wp.h" #include "wp.h"
#include "handlers.h"
typedef struct { typedef struct {
uint32_t instance; uint32_t instance;
+67 -66
View File
@@ -447,14 +447,14 @@ int Trend_Log_Read_Property(
case PROP_LOG_DEVICE_OBJECT_PROPERTY: case PROP_LOG_DEVICE_OBJECT_PROPERTY:
/* /*
* BACnetDeviceObjectPropertyReference ::= SEQUENCE { * BACnetDeviceObjectPropertyReference ::= SEQUENCE {
* objectIdentifier [0] BACnetObjectIdentifier, * objectIdentifier [0] BACnetObjectIdentifier,
* propertyIdentifier [1] BACnetPropertyIdentifier, * propertyIdentifier [1] BACnetPropertyIdentifier,
* propertyArrayIndex [2] Unsigned OPTIONAL, -- used only with array datatype * propertyArrayIndex [2] Unsigned OPTIONAL, -- used only with array datatype
* -- if omitted with an array then * -- if omitted with an array then
* -- the entire array is referenced * -- the entire array is referenced
* deviceIdentifier [3] BACnetObjectIdentifier OPTIONAL * deviceIdentifier [3] BACnetObjectIdentifier OPTIONAL
* } * }
*/ */
apdu_len += bacapp_encode_device_obj_property_ref(&apdu[0], &CurrentLog->Source); apdu_len += bacapp_encode_device_obj_property_ref(&apdu[0], &CurrentLog->Source);
break; break;
@@ -1111,11 +1111,8 @@ int rr_trend_log_encode(
return(TL_encode_by_position(apdu, pRequest, error_class, error_code)); return(TL_encode_by_position(apdu, pRequest, error_class, error_code));
else if(pRequest->RequestType == RR_BY_SEQUENCE) else if(pRequest->RequestType == RR_BY_SEQUENCE)
return(TL_encode_by_sequence(apdu, pRequest, error_class, error_code)); return(TL_encode_by_sequence(apdu, pRequest, error_class, error_code));
else {
return(TL_encode_by_time(apdu, pRequest, error_class, error_code));
}
return(-1); return(TL_encode_by_time(apdu, pRequest, error_class, error_code));
} }
/**************************************************************************** /****************************************************************************
@@ -1130,23 +1127,22 @@ int TL_encode_by_position(
BACNET_ERROR_CLASS *error_class, BACNET_ERROR_CLASS *error_class,
BACNET_ERROR_CODE *error_code) BACNET_ERROR_CODE *error_code)
{ {
int iLen; int iLen = 0;
int32_t iTemp; int32_t iTemp = 0;
TL_LOG_INFO *CurrentLog; TL_LOG_INFO *CurrentLog = NULL;
uint32_t uiIndex; /* Current entry number */ uint32_t uiIndex = 0; /* Current entry number */
uint32_t uiFirst; /* Entry number we started encoding from */ uint32_t uiFirst = 0; /* Entry number we started encoding from */
uint32_t uiLast; /* Entry number we finished encoding on */ uint32_t uiLast = 0; /* Entry number we finished encoding on */
uint32_t uiTarget; /* Last entry we are required to encode */ uint32_t uiTarget = 0; /* Last entry we are required to encode */
uint32_t uiRemaining; /* Amount of unused space in packet */ uint32_t uiRemaining = 0; /* Amount of unused space in packet */
uiFirst = 0;
uiLast = 0;
iLen = 0;
uiRemaining = MAX_APDU - pRequest->Overhead; /* See how much space we have */
/* unused parameters */
error_class = error_class;
error_code = error_code;
/* See how much space we have */
uiRemaining = MAX_APDU - pRequest->Overhead;
CurrentLog = &LogInfo[pRequest->object_instance]; CurrentLog = &LogInfo[pRequest->object_instance];
if(pRequest->RequestType == RR_READ_ALL) { if(pRequest->RequestType == RR_READ_ALL) {
/* /*
* Read all the list or as much as will fit in the buffer by selecting * Read all the list or as much as will fit in the buffer by selecting
@@ -1155,7 +1151,7 @@ int TL_encode_by_position(
*/ */
pRequest->Count = CurrentLog->ulRecordCount; /* Full list */ pRequest->Count = CurrentLog->ulRecordCount; /* Full list */
pRequest->Range.RefIndex = 1; /* Starting at the beginning */ pRequest->Range.RefIndex = 1; /* Starting at the beginning */
} }
if(pRequest->Count < 0) { /* negative count means work from index backwards */ if(pRequest->Count < 0) { /* negative count means work from index backwards */
/* /*
@@ -1237,29 +1233,30 @@ int TL_encode_by_sequence(
BACNET_ERROR_CLASS *error_class, BACNET_ERROR_CLASS *error_class,
BACNET_ERROR_CODE *error_code) BACNET_ERROR_CODE *error_code)
{ {
int iLen; int iLen = 0;
int32_t iTemp; int32_t iTemp = 0;
TL_LOG_INFO *CurrentLog; TL_LOG_INFO *CurrentLog = NULL;
uint32_t uiIndex; /* Current entry number */ uint32_t uiIndex = 0; /* Current entry number */
uint32_t uiFirst; /* Entry number we started encoding from */ uint32_t uiFirst = 0; /* Entry number we started encoding from */
uint32_t uiLast; /* Entry number we finished encoding on */ uint32_t uiLast = 0; /* Entry number we finished encoding on */
uint32_t uiSequence; /* Tracking sequenc number when encoding */ uint32_t uiSequence = 0; /* Tracking sequenc number when encoding */
uint32_t uiRemaining; /* Amount of unused space in packet */ uint32_t uiRemaining = 0; /* Amount of unused space in packet */
uint32_t uiFirstSeq; /* Sequence number for 1st record in log */ uint32_t uiFirstSeq = 0; /* Sequence number for 1st record in log */
uint32_t uiBegin; /* Starting Sequence number for request */ uint32_t uiBegin = 0; /* Starting Sequence number for request */
uint32_t uiEnd; /* Ending Sequence number for request */ uint32_t uiEnd = 0; /* Ending Sequence number for request */
bool bWrapReq = false; /* Has request sequence range spanned the max for uint32_t? */ bool bWrapReq = false; /* Has request sequence range spanned the max for uint32_t? */
bool bWrapLog = false; /* Has log sequence range spanned the max for uint32_t? */ bool bWrapLog = false; /* Has log sequence range spanned the max for uint32_t? */
uiFirst = 0; /* unused parameters */
uiLast = 0; error_class = error_class;
iLen = 0; error_code = error_code;
uiRemaining = MAX_APDU - pRequest->Overhead; /* See how much space we have */ /* See how much space we have */
uiRemaining = MAX_APDU - pRequest->Overhead;
CurrentLog = &LogInfo[pRequest->object_instance]; CurrentLog = &LogInfo[pRequest->object_instance];
/* Figure out the sequence number for the first record, last is ulTotalRecordCount */ /* Figure out the sequence number for the first record, last is ulTotalRecordCount */
uiFirstSeq = CurrentLog->ulTotalRecordCount - (CurrentLog->ulRecordCount - 1); uiFirstSeq = CurrentLog->ulTotalRecordCount - (CurrentLog->ulRecordCount - 1);
/* Calculate start and end sequence numbers from request */ /* Calculate start and end sequence numbers from request */
if(pRequest->Count < 0) { if(pRequest->Count < 0) {
@@ -1356,7 +1353,7 @@ int TL_encode_by_sequence(
pRequest->FirstSequence = uiBegin; pRequest->FirstSequence = uiBegin;
return(iLen); return(iLen);
} }
/**************************************************************************** /****************************************************************************
@@ -1372,22 +1369,23 @@ int TL_encode_by_time(
BACNET_ERROR_CLASS *error_class, BACNET_ERROR_CLASS *error_class,
BACNET_ERROR_CODE *error_code) BACNET_ERROR_CODE *error_code)
{ {
int iLen; int iLen = 0;
int32_t iTemp; int32_t iTemp = 0;
int iCount; int iCount = 0;
TL_LOG_INFO *CurrentLog; TL_LOG_INFO *CurrentLog = NULL;
uint32_t uiIndex; /* Current entry number */ uint32_t uiIndex = 0; /* Current entry number */
uint32_t uiFirst; /* Entry number we started encoding from */ uint32_t uiFirst = 0; /* Entry number we started encoding from */
uint32_t uiLast; /* Entry number we finished encoding on */ uint32_t uiLast = 0; /* Entry number we finished encoding on */
uint32_t uiRemaining; /* Amount of unused space in packet */ uint32_t uiRemaining = 0; /* Amount of unused space in packet */
uint32_t uiFirstSeq; /* Sequence number for 1st record in log */ uint32_t uiFirstSeq = 0; /* Sequence number for 1st record in log */
time_t tRefTime; /* The time from the request in local format */ time_t tRefTime = 0; /* The time from the request in local format */
uiFirst = 0; /* unused parameters */
uiLast = 0; error_class = error_class;
iLen = 0; error_code = error_code;
uiRemaining = MAX_APDU - pRequest->Overhead; /* See how much space we have */ /* See how much space we have */
uiRemaining = MAX_APDU - pRequest->Overhead;
CurrentLog = &LogInfo[pRequest->object_instance]; CurrentLog = &LogInfo[pRequest->object_instance];
tRefTime = TL_BAC_Time_To_Local(&pRequest->Range.RefTime); tRefTime = TL_BAC_Time_To_Local(&pRequest->Range.RefTime);
@@ -1402,8 +1400,8 @@ int TL_encode_by_time(
* timestamp greater than or equal to the reference. * timestamp greater than or equal to the reference.
*/ */
iCount = CurrentLog->ulRecordCount - 1; iCount = CurrentLog->ulRecordCount - 1;
/* Start out with the sequence number for the last record */ /* Start out with the sequence number for the last record */
uiFirstSeq = CurrentLog->ulTotalRecordCount; uiFirstSeq = CurrentLog->ulTotalRecordCount;
for(;;) { for(;;) {
if(Logs[pRequest->object_instance][(uiIndex + iCount) % TL_MAX_ENTRIES].tTimeStamp < tRefTime) if(Logs[pRequest->object_instance][(uiIndex + iCount) % TL_MAX_ENTRIES].tTimeStamp < tRefTime)
break; break;
@@ -1438,15 +1436,15 @@ int TL_encode_by_time(
* timestamp greater than the reference time. * timestamp greater than the reference time.
*/ */
iCount = 0; iCount = 0;
/* Figure out the sequence number for the first record, last is ulTotalRecordCount */ /* Figure out the sequence number for the first record, last is ulTotalRecordCount */
uiFirstSeq = CurrentLog->ulTotalRecordCount - (CurrentLog->ulRecordCount - 1); uiFirstSeq = CurrentLog->ulTotalRecordCount - (CurrentLog->ulRecordCount - 1);
for(;;) { for(;;) {
if(Logs[pRequest->object_instance][(uiIndex + iCount) % TL_MAX_ENTRIES].tTimeStamp > tRefTime) if(Logs[pRequest->object_instance][(uiIndex + iCount) % TL_MAX_ENTRIES].tTimeStamp > tRefTime)
break; break;
uiFirstSeq++; uiFirstSeq++;
iCount++; iCount++;
if(iCount == CurrentLog->ulRecordCount) if((uint32_t)iCount == CurrentLog->ulRecordCount)
return(0); return(0);
} }
} }
@@ -1488,16 +1486,16 @@ int TL_encode_by_time(
pRequest->FirstSequence = uiFirstSeq; pRequest->FirstSequence = uiFirstSeq;
return(iLen); return(iLen);
} }
int TL_encode_entry(uint8_t *apdu, int iLog, int iEntry) int TL_encode_entry(uint8_t *apdu, int iLog, int iEntry)
{ {
int iLen; int iLen = 0;
TL_DATA_REC *pSource; TL_DATA_REC *pSource = NULL;
BACNET_BIT_STRING TempBits; BACNET_BIT_STRING TempBits;
int iCount; int iCount = 0;
BACNET_DATE_TIME TempTime; BACNET_DATE_TIME TempTime;
/* Convert from BACnet 1 based to 0 based array index and then /* Convert from BACnet 1 based to 0 based array index and then
@@ -1750,10 +1748,13 @@ void TL_fetch_property(int iLog)
void trend_log_timer( void trend_log_timer(
uint16_t uSeconds) uint16_t uSeconds)
{ {
TL_LOG_INFO *CurrentLog; TL_LOG_INFO *CurrentLog = NULL;
int iCount; int iCount = 0;
time_t tNow; time_t tNow = 0;
/* unused parameter */
uSeconds = uSeconds;
/* use OS to get the current time */
tNow = time(NULL); tNow = time(NULL);
for(iCount = 0; iCount < MAX_TREND_LOGS; iCount++) { for(iCount = 0; iCount < MAX_TREND_LOGS; iCount++) {
CurrentLog = &LogInfo[iCount]; CurrentLog = &LogInfo[iCount];
+16 -17
View File
@@ -603,7 +603,8 @@ int address_list_encode(
/* FIXME: I really shouild check the length remaining here but it is /* FIXME: I really shouild check the length remaining here but it is
fairly pointless until we have the true length remaining in fairly pointless until we have the true length remaining in
the packet to work with as at the moment it is just MAX_APDU */ the packet to work with as at the moment it is just MAX_APDU */
apdu_len = apdu_len;
/* look for matching address */
pMatch = Address_Cache; pMatch = Address_Cache;
while (pMatch <= &Address_Cache[MAX_ADDRESS_CACHE - 1]) { while (pMatch <= &Address_Cache[MAX_ADDRESS_CACHE - 1]) {
if ((pMatch->Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ)) == if ((pMatch->Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ)) ==
@@ -665,27 +666,25 @@ int rr_address_list_encode(
BACNET_ERROR_CLASS *error_class, BACNET_ERROR_CLASS *error_class,
BACNET_ERROR_CODE *error_code) BACNET_ERROR_CODE *error_code)
{ {
int iLen; int iLen = 0;
int32_t iTemp; int32_t iTemp = 0;
struct Address_Cache_Entry *pMatch; struct Address_Cache_Entry *pMatch = NULL;
BACNET_OCTET_STRING MAC_Address; BACNET_OCTET_STRING MAC_Address;
uint32_t uiTotal; /* Number of bound entries in the cache */ uint32_t uiTotal = 0; /* Number of bound entries in the cache */
uint32_t uiIndex; /* Current entry number */ uint32_t uiIndex = 0; /* Current entry number */
uint32_t uiFirst; /* Entry number we started encoding from */ uint32_t uiFirst = 0; /* Entry number we started encoding from */
uint32_t uiLast; /* Entry number we finished encoding on */ uint32_t uiLast = 0; /* Entry number we finished encoding on */
uint32_t uiTarget; /* Last entry we are required to encode */ uint32_t uiTarget = 0; /* Last entry we are required to encode */
uint32_t uiRemaining; /* Amount of unused space in packet */ uint32_t uiRemaining = 0; /* Amount of unused space in packet */
/* unused parameters */
error_class = error_class;
error_code = error_code;
/* Initialise result flags to all false */ /* Initialise result flags to all false */
bitstring_init(&pRequest->ResultFlags);
bitstring_init(&pRequest->ResultFlags);
bitstring_set_bit(&pRequest->ResultFlags, RESULT_FLAG_FIRST_ITEM, false); bitstring_set_bit(&pRequest->ResultFlags, RESULT_FLAG_FIRST_ITEM, false);
bitstring_set_bit(&pRequest->ResultFlags, RESULT_FLAG_LAST_ITEM, false); bitstring_set_bit(&pRequest->ResultFlags, RESULT_FLAG_LAST_ITEM, false);
bitstring_set_bit(&pRequest->ResultFlags, RESULT_FLAG_MORE_ITEMS, false); bitstring_set_bit(&pRequest->ResultFlags, RESULT_FLAG_MORE_ITEMS, false);
uiFirst = 0;
uiLast = 0;
iLen = 0;
/* See how much space we have */ /* See how much space we have */
uiRemaining = (uint32_t)(MAX_APDU - pRequest->Overhead); uiRemaining = (uint32_t)(MAX_APDU - pRequest->Overhead);
@@ -801,7 +800,7 @@ int rr_address_list_encode(
if(uiLast == uiTotal) if(uiLast == uiTotal)
bitstring_set_bit(&pRequest->ResultFlags, RESULT_FLAG_LAST_ITEM, true); bitstring_set_bit(&pRequest->ResultFlags, RESULT_FLAG_LAST_ITEM, true);
return(iLen); return(iLen);
} }
/**************************************************************************** /****************************************************************************
+3
View File
@@ -125,6 +125,9 @@ int alarm_ack_decode_service_request(
int section_len; int section_len;
uint32_t enumValue; uint32_t enumValue;
/* unused parameter */
apdu_len = apdu_len;
if (-1 == (section_len = if (-1 == (section_len =
decode_context_unsigned(&apdu[len], 0, decode_context_unsigned(&apdu[len], 0,
&data->ackProcessIdentifier))) { &data->ackProcessIdentifier))) {
+4
View File
@@ -115,6 +115,8 @@ int getevent_ack_encode_apdu_data(
BACNET_GET_EVENT_INFORMATION_DATA *event_data; BACNET_GET_EVENT_INFORMATION_DATA *event_data;
unsigned i = 0; /* counter */ unsigned i = 0; /* counter */
/* unused parameter */
max_apdu = max_apdu;
if (apdu) { if (apdu) {
event_data = get_event_data; event_data = get_event_data;
while (event_data) { while (event_data) {
@@ -169,6 +171,8 @@ int getevent_ack_encode_apdu_end(
{ {
int apdu_len = 0; /* total length of the apdu, return value */ int apdu_len = 0; /* total length of the apdu, return value */
/* unused parameter */
max_apdu = max_apdu;
if (apdu) { if (apdu) {
apdu_len += encode_closing_tag(&apdu[apdu_len], 0); apdu_len += encode_closing_tag(&apdu[apdu_len], 0);
apdu_len += encode_context_boolean(&apdu[apdu_len], 1, moreEvents); apdu_len += encode_context_boolean(&apdu[apdu_len], 1, moreEvents);