Skip to content

Commit

Permalink
Better solution for 64->32 bit narrowing.
Browse files Browse the repository at this point in the history
kmdewaal suggested a better solution for this cast that doesn't
require any conditional compilation.
  • Loading branch information
linuxdude42 committed Jan 23, 2024
1 parent 859a5bf commit 6b2574b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions mythtv/libs/libmythtv/recorders/dvbchannel.cpp
Expand Up @@ -1589,12 +1589,9 @@ bool DVBChannel::WaitForBackend(std::chrono::milliseconds timeout_ms)
const int fd = m_fdFrontend;
auto seconds = duration_cast<std::chrono::seconds>(timeout_ms);
auto usecs = duration_cast<std::chrono::microseconds>(timeout_ms) - seconds;
#if defined(__x86_64__)
struct timeval select_timeout = { seconds.count(), usecs.count()};
#else
struct timeval select_timeout = { static_cast<int32_t>(seconds.count()),
static_cast<int32_t>(usecs.count()) };
#endif
struct timeval select_timeout = {
static_cast<typeof(select_timeout.tv_sec)>(seconds.count()),
static_cast<typeof(select_timeout.tv_usec)>(usecs.count())};
fd_set fd_select_set;
FD_ZERO( &fd_select_set); // NOLINT(readability-isolate-declaration)
FD_SET (fd, &fd_select_set);
Expand Down

0 comments on commit 6b2574b

Please sign in to comment.