summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlexandros Frantzis <alexandros.frantzis@collabora.com>2017-12-01 19:28:52 +0200
committerDaniel Stone <daniels@collabora.com>2017-12-04 19:06:02 +0000
commit8c919b488c7dac95e5fe1e81c0be28634e8291d7 (patch)
treeff1614e4ddc6478a6361ae9b57ebdad04abb1e13 /tests
parentbd9069ffadbac80d36a442dd903492501c0c8f63 (diff)
tests: Fix integer overflows on 32-bit systems
Ensure that the integer type used in expressions involving multiplication with NSEC_PER_SEC is large enough to avoid overflows on 32-bit systems. In the expressions fixed by this patch a 64-bit type (long long) is required. Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/timespec-test.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/timespec-test.c b/tests/timespec-test.c
index f127bcee..31a6f146 100644
--- a/tests/timespec-test.c
+++ b/tests/timespec-test.c
@@ -160,7 +160,7 @@ ZUC_TEST(timespec_test, timespec_sub_to_nsec)
a.tv_nsec = 1;
b.tv_sec = 1;
b.tv_nsec = 2;
- ZUC_ASSERT_EQ((999L * NSEC_PER_SEC) - 1, timespec_sub_to_nsec(&a, &b));
+ ZUC_ASSERT_EQ((999LL * NSEC_PER_SEC) - 1, timespec_sub_to_nsec(&a, &b));
}
ZUC_TEST(timespec_test, timespec_sub_to_msec)
@@ -190,7 +190,7 @@ ZUC_TEST(timespec_test, timespec_from_nsec)
ZUC_ASSERT_EQ(1, a.tv_sec);
ZUC_ASSERT_EQ(0, a.tv_nsec);
- timespec_from_nsec(&a, (5L * NSEC_PER_SEC) + 1);
+ timespec_from_nsec(&a, (5LL * NSEC_PER_SEC) + 1);
ZUC_ASSERT_EQ(5, a.tv_sec);
ZUC_ASSERT_EQ(1, a.tv_nsec);
}