mirror of
https://github.com/MariaDB/server.git
synced 2026-05-06 07:05:33 +02:00
MDEV-24115 Fix -Wconversion in Timeval::Timeval() on Mac OS X
The data member tv_usec of the struct timeval is declared as suseconds_t on MacOS. Size of suseconds_t is 4 bytes. On the other hand, size of ulong is 8 bytes on 64-bit MacOS, so attempt to assign a value of wider type (usec) to a value (tv_usec) of narrower type leads to error.
This commit is contained in:
parent
f0c9903795
commit
796f708f85
1 changed files with 7 additions and 1 deletions
|
|
@ -871,7 +871,13 @@ public:
|
|||
Timeval(my_time_t sec, ulong usec)
|
||||
{
|
||||
tv_sec= sec;
|
||||
tv_usec= usec;
|
||||
/*
|
||||
Since tv_usec is not always of type ulong, cast usec parameter
|
||||
explicitly to uint to avoid compiler warnings about losing
|
||||
integer precision.
|
||||
*/
|
||||
DBUG_ASSERT(usec < 1000000);
|
||||
tv_usec= (uint)usec;
|
||||
}
|
||||
explicit Timeval(const timeval &tv)
|
||||
:timeval(tv)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue