File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -452,7 +452,10 @@ class ACE_Export ACE_Time_Value
452452 time_t tv_sec;
453453 suseconds_t tv_usec;
454454 } tv_;
455- timeval ext_tv_;
455+ // Must be mutable as the zero and max static members are const, but are modified
456+ // in the timeval operations, having it not mutable will cause an access violation
457+ // with some compilers as they put these in the const section.
458+ mutable timeval ext_tv_;
456459#else
457460 timeval tv_;
458461#endif /* ACE_HAS_TIME_T_LONG_MISMATCH */
Original file line number Diff line number Diff line change @@ -10,9 +10,8 @@ ACE_Time_Value::operator timeval () const
1010 // ACE_OS_TRACE ("ACE_Time_Value::operator timeval");
1111#if defined (ACE_HAS_TIME_T_LONG_MISMATCH)
1212 // Recall that on some Windows we substitute another type for timeval in tv_
13- ACE_Time_Value *me = const_cast <ACE_Time_Value*> (this );
14- me->ext_tv_ .tv_sec = ACE_Utils::truncate_cast<long > (this ->tv_ .tv_sec );
15- me->ext_tv_ .tv_usec = ACE_Utils::truncate_cast<long > (this ->tv_ .tv_usec );
13+ this ->ext_tv_ .tv_sec = this ->tv_ .tv_sec ;
14+ this ->ext_tv_ .tv_usec = this ->tv_ .tv_usec ;
1615 return this ->ext_tv_ ;
1716#else
1817 return this ->tv_ ;
@@ -42,9 +41,8 @@ ACE_Time_Value::operator const timeval * () const
4241 // ACE_OS_TRACE ("ACE_Time_Value::operator const timeval *");
4342#if defined (ACE_HAS_TIME_T_LONG_MISMATCH)
4443 // Recall that on some Windows we substitute another type for timeval in tv_
45- ACE_Time_Value *me = const_cast <ACE_Time_Value*> (this );
46- me->ext_tv_ .tv_sec = ACE_Utils::truncate_cast<long > (this ->tv_ .tv_sec );
47- me->ext_tv_ .tv_usec = ACE_Utils::truncate_cast<long > (this ->tv_ .tv_usec );
44+ this ->ext_tv_ .tv_sec = this ->tv_ .tv_sec ;
45+ this ->ext_tv_ .tv_usec = this ->tv_ .tv_usec ;
4846 return (const timeval *) &this ->ext_tv_ ;
4947#else
5048 return (const timeval *) &this ->tv_ ;
Original file line number Diff line number Diff line change 5555#define ACE_HAS_DIRENT
5656
5757#define ACE_HAS_WIN32_STRUCTURED_EXCEPTIONS
58+ #define ACE_HAS_TIME_T_LONG_MISMATCH
5859
5960#define ACE_LACKS_TERMIOS_H
6061#define ACE_LACKS_NETINET_TCP_H
You can’t perform that action at this time.
0 commit comments