Skip to content

Commit 7b35bbf

Browse files
authored
Merge branch 'master' into jwi-ACE_HAS_TIME_T_LONG_MISMATCH
2 parents fc9a572 + 780c0e9 commit 7b35bbf

2 files changed

Lines changed: 37 additions & 5 deletions

File tree

ACE/ace/OS_NS_sys_select.inl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@ ACE_OS::select (int width,
1616
#if defined (ACE_HAS_NONCONST_SELECT_TIMEVAL)
1717
// We must defend against non-conformity!
1818
timeval copy;
19-
timeval *timep = 0;
19+
timeval *timep = nullptr;
2020

21-
if (timeout != 0)
21+
if (timeout != nullptr)
2222
{
2323
copy = *timeout;
24-
timep = ©
24+
timep = std::addressof(copy);
2525
}
26-
else
27-
timep = 0;
2826
#else
2927
const timeval *timep = (timeout == 0 ? (const timeval *)0 : *timeout);
3028
#endif /* ACE_HAS_NONCONST_SELECT_TIMEVAL */

ACE/tests/Time_Value_Test.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,38 @@
2020
#include <sstream>
2121
#include <type_traits>
2222

23+
int timeval_test_func (const ACE_Time_Value* timeout)
24+
{
25+
int ret = 0;
26+
timeval timeval_test;
27+
28+
ACE_DEBUG ((LM_DEBUG,
29+
ACE_TEXT ("Start test ACE_Time_Value to timeval conversion\n")));
30+
31+
if (timeout)
32+
{
33+
timeval_test = *timeout;
34+
}
35+
36+
if (timeval_test.tv_sec != 0)
37+
{
38+
ACE_ERROR ((LM_ERROR,
39+
ACE_TEXT ("timeval.tv_sec should be zero not %d\n"), timeval_test.tv_sec));
40+
++ret;
41+
}
42+
if (timeval_test.tv_usec != 0)
43+
{
44+
ACE_ERROR ((LM_ERROR,
45+
ACE_TEXT ("timeval.tv_usec should be zero not %d\n"), timeval_test.tv_usec));
46+
++ret;
47+
}
48+
49+
ACE_DEBUG ((LM_DEBUG,
50+
ACE_TEXT ("Finished test ACE_Time_Value to timeval conversion\n")));
51+
52+
return ret;
53+
}
54+
2355
int
2456
run_main (int, ACE_TCHAR *[])
2557
{
@@ -227,6 +259,8 @@ run_main (int, ACE_TCHAR *[])
227259
ACE_TEXT ("time_t is at least 64bit, this platform will not have problems after 2038\n")));
228260
}
229261

262+
ret += timeval_test_func ((ACE_Time_Value *) &ACE_Time_Value::zero);
263+
230264
ACE_END_TEST;
231265

232266
return ret;

0 commit comments

Comments
 (0)