Ran the indent and comment script to standardize the source files.

This commit is contained in:
skarg
2007-02-23 02:14:50 +00:00
parent ada921d5f3
commit 1386b41f2d
21 changed files with 983 additions and 987 deletions
+40 -40
View File
@@ -43,13 +43,13 @@
/* year = years since 1900 */
/* month 1=Jan */
/* day = day of month 1..31 */
/* wday 1=Monday...7=Sunday */
/* Wildcards:
A value of X'FF' in any of the four octets
shall indicate that the value is unspecified.
If all four octets = X'FF', the corresponding
time or date may be interpreted as "any" or "don't care"
/* wday 1=Monday...7=Sunday */
/* Wildcards:
A value of X'FF' in any of the four octets
shall indicate that the value is unspecified.
If all four octets = X'FF', the corresponding
time or date may be interpreted as "any" or "don't care"
*/
static bool is_leap_year(uint16_t year)
@@ -115,12 +115,12 @@ static void days_since_epoch_into_ymd(uint32_t days,
year++;
}
while (days >= (uint32_t)month_days(year, month)) {
while (days >= (uint32_t) month_days(year, month)) {
days -= month_days(year, month);
month++;
}
day += ((uint8_t)days);
day += ((uint8_t) days);
if (pYear)
*pYear = year;
@@ -137,7 +137,7 @@ static void days_since_epoch_into_ymd(uint32_t days,
/* wday 1=Monday...7=Sunday */
static uint8_t day_of_week(uint16_t year, uint8_t month, uint8_t day)
{
return ((uint8_t)(days_since_epoch(year, month, day) % 7) + 1);
return ((uint8_t) (days_since_epoch(year, month, day) % 7) + 1);
}
/* if the date1 is the same as date2, return is 0
@@ -292,9 +292,9 @@ static void seconds_since_midnight_into_hms(uint32_t seconds,
uint8_t hour = 0;
uint8_t minute = 0;
hour = (uint8_t)(seconds / (60 * 60));
hour = (uint8_t) (seconds / (60 * 60));
seconds -= (hour * 60 * 60);
minute = (uint8_t)(seconds / 60);
minute = (uint8_t) (seconds / 60);
seconds -= (minute * 60);
if (pHours)
@@ -302,7 +302,7 @@ static void seconds_since_midnight_into_hms(uint32_t seconds,
if (pMinutes)
*pMinutes = minute;
if (pSeconds)
*pSeconds = (uint8_t)seconds;
*pSeconds = (uint8_t) seconds;
}
void datetime_add_minutes(BACNET_DATE_TIME * bdatetime, uint32_t minutes)
@@ -334,29 +334,29 @@ void datetime_add_minutes(BACNET_DATE_TIME * bdatetime, uint32_t minutes)
bdatetime->date.wday = day_of_week(bdatetime->date.year,
bdatetime->date.month, bdatetime->date.day);
}
bool datetime_wildcard(BACNET_DATE_TIME * bdatetime)
{
bool wildcard_present = false;
bool datetime_wildcard(BACNET_DATE_TIME * bdatetime)
{
bool wildcard_present = false;
if (bdatetime) {
if ((bdatetime->date.year == (1900 + 0xFF)) &&
(bdatetime->date.month == 0xFF) &&
(bdatetime->date.day == 0xFF) &&
(bdatetime->date.wday == 0xFF) &&
(bdatetime->date.wday == 0xFF) &&
(bdatetime->time.hour == 0xFF) &&
(bdatetime->time.min == 0xFF) &&
(bdatetime->time.sec == 0xFF) &&
(bdatetime->time.hundredths == 0xFF)) {
wildcard_present = true;
}
(bdatetime->time.hundredths == 0xFF)) {
wildcard_present = true;
}
}
return wildcard_present;
}
void datetime_wildcard_set(BACNET_DATE_TIME * bdatetime)
{
return wildcard_present;
}
void datetime_wildcard_set(BACNET_DATE_TIME * bdatetime)
{
if (bdatetime) {
bdatetime->date.year = 1900 + 0xFF;
bdatetime->date.month = 0xFF;
@@ -367,8 +367,8 @@ void datetime_wildcard_set(BACNET_DATE_TIME * bdatetime)
bdatetime->time.sec = 0xFF;
bdatetime->time.hundredths = 0xFF;
}
}
}
#ifdef TEST
#include <assert.h>
@@ -376,19 +376,19 @@ void datetime_wildcard_set(BACNET_DATE_TIME * bdatetime)
#include "ctest.h"
void testBACnetDateTimeWildcard(Test * pTest)
{
BACNET_DATE_TIME bdatetime;
bool status = false;
datetime_set_values(&bdatetime, 1900, 1, 1, 0, 0, 0, 0);
{
BACNET_DATE_TIME bdatetime;
bool status = false;
datetime_set_values(&bdatetime, 1900, 1, 1, 0, 0, 0, 0);
status = datetime_wildcard(&bdatetime);
ct_test(pTest, status == false);
ct_test(pTest, status == false);
datetime_wildcard_set(&bdatetime);
status = datetime_wildcard(&bdatetime);
ct_test(pTest, status == true);
}
void testBACnetDateTimeAdd(Test * pTest)
{
BACNET_DATE_TIME bdatetime, test_bdatetime;
@@ -698,9 +698,9 @@ int main(void)
rc = ct_addTestFunction(pTest, testBACnetDateTimeSeconds);
assert(rc);
rc = ct_addTestFunction(pTest, testBACnetDateTimeAdd);
assert(rc);
assert(rc);
rc = ct_addTestFunction(pTest, testBACnetDateTimeWildcard);
assert(rc);
assert(rc);
ct_setStream(pTest, stdout);
ct_run(pTest);