From 54b4dd0b245e61ed9a03ed64793ab58c1e8cf91d Mon Sep 17 00:00:00 2001 From: David Hampton Date: Fri, 24 Apr 2020 12:58:11 -0400 Subject: [PATCH] Convert to std::array and std::string. (misc polling) This load average case wasn't consolidated with the others because the file it is in doesn't include any myth specific headers. --- mythtv/programs/mythexternrecorder/MythExternControl.cpp | 5 ++--- mythtv/programs/mythfilerecorder/mythfilerecorder.cpp | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/mythtv/programs/mythexternrecorder/MythExternControl.cpp b/mythtv/programs/mythexternrecorder/MythExternControl.cpp index 74c726926bc..01d9cae50b7 100644 --- a/mythtv/programs/mythexternrecorder/MythExternControl.cpp +++ b/mythtv/programs/mythexternrecorder/MythExternControl.cpp @@ -440,8 +440,7 @@ void Commands::Run(void) QString cmd; - struct pollfd polls[2]; - memset(polls, 0, sizeof(polls)); + std::array polls {}; polls[0].fd = 0; polls[0].events = POLLIN | POLLPRI; @@ -457,7 +456,7 @@ void Commands::Run(void) { int timeout = 250; int poll_cnt = 1; - int ret = poll(polls, poll_cnt, timeout); + int ret = poll(polls.data(), poll_cnt, timeout); if (polls[0].revents & POLLHUP) { diff --git a/mythtv/programs/mythfilerecorder/mythfilerecorder.cpp b/mythtv/programs/mythfilerecorder/mythfilerecorder.cpp index 748200b4422..5e4ebc1fa8e 100644 --- a/mythtv/programs/mythfilerecorder/mythfilerecorder.cpp +++ b/mythtv/programs/mythfilerecorder/mythfilerecorder.cpp @@ -313,8 +313,7 @@ bool Commands::Run(const QString & filename, int data_rate, bool loopinput) QString cmd; int poll_cnt = 1; - struct pollfd polls[2]; - memset(polls, 0, sizeof(polls)); + std::array polls {}; polls[0].fd = 0; polls[0].events = POLLIN | POLLPRI; @@ -342,7 +341,7 @@ bool Commands::Run(const QString & filename, int data_rate, bool loopinput) while (m_run) { - int ret = poll(polls, poll_cnt, m_timeout); + int ret = poll(polls.data(), poll_cnt, m_timeout); if (polls[0].revents & POLLHUP) {