Skip to content

Commit 75b9014

Browse files
committed
MDEV-26136: Correct AIX/macOS cast warning (my_time.h)
tv_usec is a (suseconds_t) so we cast to it. Prevents the AIX(gcc-10) warning: include/my_time.h: In function 'void my_timeval_trunc(timeval*, uint)': include/my_time.h:249:65: warning: conversion from 'long int' to 'suseconds_t' {aka 'int'} may change value [-Wconversion] 249 | tv->tv_usec-= my_time_fraction_remainder(tv->tv_usec, decimals); | macOS is: conversion from 'long int' to '__darwin_suseconds_t' {aka 'int'} may change value On Windows suseconds_t isn't defined so we use the existing long return type of my_time_fraction_remainder. Reviewed by Marko Mäkelä Closes: #2079
1 parent c1ab0e6 commit 75b9014

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

include/my_time.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,12 @@ static inline void my_time_trunc(MYSQL_TIME *ltime, uint decimals)
220220
{
221221
ltime->second_part-= my_time_fraction_remainder(ltime->second_part, decimals);
222222
}
223+
#ifdef _WIN32
224+
#define suseconds_t long
225+
#endif
223226
static inline void my_timeval_trunc(struct timeval *tv, uint decimals)
224227
{
225-
tv->tv_usec-= my_time_fraction_remainder(tv->tv_usec, decimals);
228+
tv->tv_usec-= (suseconds_t) my_time_fraction_remainder(tv->tv_usec, decimals);
226229
}
227230

228231

0 commit comments

Comments
 (0)