summaryrefslogtreecommitdiff
path: root/test_mkgmtime.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-09-11 12:16:01 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-09-11 12:16:01 +0000
commita33bf0d006a97e4fe34f218d6aeb34c66baaa869 (patch)
treeab530a3ba5bc5cbc1114bf6a7d8180c5626a5a27 /test_mkgmtime.c
parentb87239ee912addfe67d16dc3309d4f1acb38ed75 (diff)
downloadgpsd-a33bf0d006a97e4fe34f218d6aeb34c66baaa869.tar.gz
Add and annotate more stuff to be splint-audited.
All regression tests pass. Everything splints clean.
Diffstat (limited to 'test_mkgmtime.c')
-rw-r--r--test_mkgmtime.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/test_mkgmtime.c b/test_mkgmtime.c
index 5a8dc638..fb23e4e6 100644
--- a/test_mkgmtime.c
+++ b/test_mkgmtime.c
@@ -6,7 +6,8 @@
#include "gps.h"
-struct {
+/*@-type@*/
+static struct {
struct tm t;
time_t result;
} tests[] = {
@@ -73,7 +74,9 @@ struct {
{{ 59, 59, 23, 31, 11, 115, 0, 0, 0, 0, 0, }, 1451606399 }, /* month wrap */
{{ 0, 0, 0, 1, 0, 116, 0, 0, 0, 0, 0, }, 1451606400 }, /* month wrap */
};
+/*@-type@*/
+/*@+longunsignedintegral*/
int main(int argc, char *argv[])
{
int i;
@@ -81,7 +84,7 @@ int main(int argc, char *argv[])
time_t ts;
bool failed = false;
- setenv("TZ", "GMT", 1);
+ (void)setenv("TZ", "GMT", 1);
for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
#if 0 /* use this to calculate with glibc */
@@ -91,12 +94,13 @@ int main(int argc, char *argv[])
#endif
if (ts != tests[i].result) {
failed = true;
- strftime(tbuf, sizeof(tbuf), "%F %T", &tests[i].t);
- printf("test %2d failed. " \
+ (void)strftime(tbuf, sizeof(tbuf), "%F %T", &tests[i].t);
+ (void)printf("test %2d failed. " \
"Time returned from: %s should be %lu (but was: %lu)\n",
i, tbuf, tests[i].result, ts);
}
}
return (int)failed;
}
+/*@-longunsignedintegral*/