[Core, mod_sofia] Add switch_uint31_t type. Fix CSeq bigger than 2^31-1.

This commit is contained in:
Andrey Volk
2024-04-30 21:14:29 +03:00
parent da93927c01
commit 5b1c2688da
4 changed files with 34 additions and 11 deletions

View File

@@ -53,6 +53,26 @@ FST_CORE_BEGIN("./conf")
}
FST_TEARDOWN_END()
FST_TEST_BEGIN(test_switch_uint31_t_overflow)
{
switch_uint31_t x;
uint32_t overflow;
x.value = 0x7fffffff;
x.value++;
fst_check_int_equals(x.value, 0);
x.value++;
fst_check_int_equals(x.value, 1);
x.value -= 2;
fst_check_int_equals(x.value, 0x7fffffff);
overflow = (uint32_t)0x7fffffff + 1;
x.value = overflow;
fst_check_int_equals(x.value, 0);
}
FST_TEST_END()
FST_TEST_BEGIN(test_switch_parse_cidr_v6)
{
ip_t ip, mask;