Changes to reduce the number of warnings with Visual C++2008 warning level 4 to a minimum.
This commit is contained in:
@@ -369,7 +369,7 @@ uint32_t bacfile_instance_from_tsm(
|
||||
BACNET_ADDRESS dest; /* where the original packet was destined */
|
||||
uint8_t apdu[MAX_PDU] = { 0 }; /* original APDU packet */
|
||||
uint16_t apdu_len = 0; /* original APDU packet length */
|
||||
uint16_t len = 0; /* apdu header length */
|
||||
int len = 0; /* apdu header length */
|
||||
BACNET_ATOMIC_READ_FILE_DATA data = { 0 };
|
||||
uint32_t object_instance = BACNET_MAX_INSTANCE + 1; /* return value */
|
||||
bool found = false;
|
||||
|
||||
@@ -448,6 +448,7 @@ unsigned Device_Count(
|
||||
uint32_t Device_Index_To_Instance(
|
||||
unsigned index)
|
||||
{
|
||||
index = index;
|
||||
return Object_Instance_Number;
|
||||
}
|
||||
|
||||
@@ -808,7 +809,7 @@ bool Device_Object_List_Identifier(
|
||||
* look for the index to instance to get the ID */
|
||||
if (pObject->Object_Iterator) {
|
||||
/* First find the first object */
|
||||
temp_index = pObject->Object_Iterator(~0);
|
||||
temp_index = pObject->Object_Iterator(~(unsigned)0);
|
||||
/* Then step through the objects to find the nth */
|
||||
while (object_index != 0) {
|
||||
temp_index = pObject->Object_Iterator(temp_index);
|
||||
|
||||
@@ -141,6 +141,8 @@ int Lighting_Output_Decode_Lighting_Command(
|
||||
uint32_t len_value_type = 0;
|
||||
float real_value = 0.0;
|
||||
|
||||
apdu_max_len = apdu_max_len;
|
||||
|
||||
/* check for value pointers */
|
||||
if (apdu_len && data) {
|
||||
/* Tag 0: operation */
|
||||
|
||||
@@ -174,7 +174,7 @@ bool Multistate_Input_Present_Value_Set(
|
||||
index = Multistate_Input_Instance_To_Index(object_instance);
|
||||
if (index < MAX_MULTISTATE_INPUTS) {
|
||||
if (value < MULTISTATE_NUMBER_OF_STATES) {
|
||||
Present_Value[index] = value;
|
||||
Present_Value[index] = (uint8_t)value;
|
||||
status = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1043,20 +1043,20 @@ void TL_Local_Time_To_BAC(
|
||||
struct tm *TempTime;
|
||||
|
||||
TempTime = localtime(&SourceTime);
|
||||
|
||||
DestTime->date.year = TempTime->tm_year + 1900;
|
||||
DestTime->date.month = TempTime->tm_mon + 1;
|
||||
DestTime->date.day = TempTime->tm_mday;
|
||||
|
||||
DestTime->date.year = (uint16_t)(TempTime->tm_year + 1900);
|
||||
DestTime->date.month = (uint8_t)(TempTime->tm_mon + 1);
|
||||
DestTime->date.day = (uint8_t)TempTime->tm_mday;
|
||||
/* BACnet is 1 to 7 = Monday to Sunday
|
||||
* Windows is days from Sunday 0 - 6 so we
|
||||
* have to adjust */
|
||||
if (TempTime->tm_wday == 0)
|
||||
DestTime->date.wday = 7;
|
||||
else
|
||||
DestTime->date.wday = TempTime->tm_wday;
|
||||
DestTime->time.hour = TempTime->tm_hour;
|
||||
DestTime->time.min = TempTime->tm_min;
|
||||
DestTime->time.sec = TempTime->tm_sec;
|
||||
DestTime->date.wday = (uint8_t)TempTime->tm_wday;
|
||||
DestTime->time.hour = (uint8_t)TempTime->tm_hour;
|
||||
DestTime->time.min = (uint8_t)TempTime->tm_min;
|
||||
DestTime->time.sec = (uint8_t)TempTime->tm_sec;
|
||||
DestTime->time.hundredths = 0;
|
||||
}
|
||||
|
||||
@@ -1489,7 +1489,7 @@ int TL_encode_entry(
|
||||
int iLen = 0;
|
||||
TL_DATA_REC *pSource = NULL;
|
||||
BACNET_BIT_STRING TempBits;
|
||||
int iCount = 0;
|
||||
uint8_t ucCount = 0;
|
||||
BACNET_DATE_TIME TempTime;
|
||||
|
||||
/* Convert from BACnet 1 based to 0 based array index and then
|
||||
@@ -1555,16 +1555,11 @@ int TL_encode_entry(
|
||||
* have limited to 32 bits maximum as allowed by the standard
|
||||
*/
|
||||
bitstring_init(&TempBits);
|
||||
bitstring_set_bits_used(&TempBits,
|
||||
(pSource->Datum.Bits.ucLen >> 4) & 0x0F,
|
||||
pSource->Datum.Bits.ucLen & 0x0F);
|
||||
for (iCount = pSource->Datum.Bits.ucLen >> 4; iCount > 0; iCount--)
|
||||
bitstring_set_octet(&TempBits, iCount - 1,
|
||||
pSource->Datum.Bits.ucStore[iCount - 1]);
|
||||
|
||||
iLen +=
|
||||
encode_context_bitstring(&apdu[iLen], pSource->ucRecType,
|
||||
&TempBits);
|
||||
bitstring_set_bits_used(&TempBits, (pSource->Datum.Bits.ucLen >> 4) & 0x0F, pSource->Datum.Bits.ucLen & 0x0F);
|
||||
for(ucCount = pSource->Datum.Bits.ucLen >> 4; ucCount > 0; ucCount--)
|
||||
bitstring_set_octet(&TempBits, ucCount - 1, pSource->Datum.Bits.ucStore[ucCount-1]);
|
||||
|
||||
iLen += encode_context_bitstring(&apdu[iLen], pSource->ucRecType, &TempBits);
|
||||
break;
|
||||
|
||||
case TL_TYPE_NULL:
|
||||
@@ -1631,7 +1626,8 @@ static int local_read_property(
|
||||
*error_code = rpdata.error_code;
|
||||
}
|
||||
}
|
||||
if ((len >= 0) && (status != NULL)) {
|
||||
|
||||
if((len >= 0) && (status != NULL)){
|
||||
/* Fetch the status flags if required */
|
||||
rpdata.application_data = status;
|
||||
rpdata.application_data_len = MAX_APDU;
|
||||
@@ -1642,9 +1638,6 @@ static int local_read_property(
|
||||
*error_class = rpdata.error_class;
|
||||
*error_code = rpdata.error_code;
|
||||
}
|
||||
} else {
|
||||
*error_class = rpdata.error_class;
|
||||
*error_code = rpdata.error_code;
|
||||
}
|
||||
|
||||
return (len);
|
||||
@@ -1662,7 +1655,7 @@ void TL_fetch_property(
|
||||
BACNET_ERROR_CLASS error_class;
|
||||
BACNET_ERROR_CODE error_code;
|
||||
int iLen;
|
||||
int iCount;
|
||||
uint8_t ucCount;
|
||||
TL_LOG_INFO *CurrentLog;
|
||||
TL_DATA_REC TempRec;
|
||||
uint8_t tag_number = 0;
|
||||
@@ -1729,16 +1722,13 @@ void TL_fetch_property(
|
||||
TempRec.Datum.Bits.ucLen |=
|
||||
(8 - (bitstring_bits_used(&TempBits) % 8)) & 7;
|
||||
/* Fetch the octets with the bits directly */
|
||||
for (iCount = 0; iCount < bitstring_bytes_used(&TempBits);
|
||||
iCount++)
|
||||
TempRec.Datum.Bits.ucStore[iCount] =
|
||||
bitstring_octet(&TempBits, iCount);
|
||||
for(ucCount = 0; ucCount < bitstring_bytes_used(&TempBits); ucCount++)
|
||||
TempRec.Datum.Bits.ucStore[ucCount] = bitstring_octet(&TempBits, ucCount);
|
||||
} else {
|
||||
/* We will only use the first 4 octets to save space */
|
||||
TempRec.Datum.Bits.ucLen = 4 << 4;
|
||||
for (iCount = 0; iCount < 4; iCount++)
|
||||
TempRec.Datum.Bits.ucStore[iCount] =
|
||||
bitstring_octet(&TempBits, iCount);
|
||||
for(ucCount = 0; ucCount < 4; ucCount++)
|
||||
TempRec.Datum.Bits.ucStore[ucCount] = bitstring_octet(&TempBits, ucCount);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user