diff --git a/mythtv/libs/libmyth/audio/audiooutput.cpp b/mythtv/libs/libmyth/audio/audiooutput.cpp index d40a8fa761e..2e4934331a6 100644 --- a/mythtv/libs/libmyth/audio/audiooutput.cpp +++ b/mythtv/libs/libmyth/audio/audiooutput.cpp @@ -369,7 +369,7 @@ AudioOutput::AudioDeviceConfig* AudioOutput::GetAudioDeviceConfig( (aosettings.canAC3() << 1) | (aosettings.canDTS() << 2); // cppcheck-suppress variableScope - static const char *type_names[] = { "LPCM", "AC3", "DTS" }; + static const char *s_typeNames[] = { "LPCM", "AC3", "DTS" }; if (mask != 0) { @@ -381,7 +381,7 @@ AudioOutput::AudioDeviceConfig* AudioOutput::GetAudioDeviceConfig( { if (found_one) capabilities += ", "; - capabilities += type_names[i]; + capabilities += s_typeNames[i]; found_one = true; } } diff --git a/mythtv/libs/libmyth/audio/audiooutputgraph.cpp b/mythtv/libs/libmyth/audio/audiooutputgraph.cpp index 11b1484ec7c..627690c4253 100644 --- a/mythtv/libs/libmyth/audio/audiooutputgraph.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputgraph.cpp @@ -29,7 +29,7 @@ class AudioOutputGraph::Buffer : protected QByteArray // Properties void SetMaxSamples(unsigned samples) { m_maxSamples = samples; } - void SetSampleRate(unsigned sample_rate) { m_sample_rate = sample_rate; } + void SetSampleRate(unsigned sample_rate) { m_sampleRate = sample_rate; } static inline int BitsPerChannel() { return sizeof(short) * CHAR_BIT; } inline int Channels() const { return m_channels; } @@ -136,12 +136,12 @@ class AudioOutputGraph::Buffer : protected QByteArray inline unsigned long Samples2MS(unsigned samples) const { - return m_sample_rate ? (samples * 1000UL + m_sample_rate - 1) / m_sample_rate : 0; // round up + return m_sampleRate ? (samples * 1000UL + m_sampleRate - 1) / m_sampleRate : 0; // round up } inline unsigned MS2Samples(int64_t ms) const { - return ms > 0 ? (ms * m_sample_rate) / 1000 : 0; // NB round down + return ms > 0 ? (ms * m_sampleRate) / 1000 : 0; // NB round down } void Append(const void *b, unsigned long len, int bits) @@ -190,13 +190,13 @@ class AudioOutputGraph::Buffer : protected QByteArray { m_bits = bits; m_channels = channels; - m_sizeMax = ((m_sample_rate * kBufferMilliSecs) / 1000) * BytesPerSample(); + m_sizeMax = ((m_sampleRate * kBufferMilliSecs) / 1000) * BytesPerSample(); resize(0); } private: unsigned m_maxSamples {0}; - unsigned m_sample_rate {44100}; + unsigned m_sampleRate {44100}; unsigned long m_tcFirst {0}, m_tcNext {0}; int m_bits {0}; int m_channels {0}; diff --git a/mythtv/libs/libmyth/audio/audiopulsehandler.cpp b/mythtv/libs/libmyth/audio/audiopulsehandler.cpp index 007223fcf3b..199a0926baa 100644 --- a/mythtv/libs/libmyth/audio/audiopulsehandler.cpp +++ b/mythtv/libs/libmyth/audio/audiopulsehandler.cpp @@ -38,8 +38,8 @@ bool PulseHandler::g_pulseHandlerActive = false; bool PulseHandler::Suspend(enum PulseAction action) { // global lock around all access to our global singleton - static QMutex global_lock; - QMutexLocker locker(&global_lock); + static QMutex s_globalLock; + QMutexLocker locker(&s_globalLock); // cleanup the PulseAudio server connection if requested if (kPulseCleanup == action) diff --git a/mythtv/libs/libmyth/audio/pink.c b/mythtv/libs/libmyth/audio/pink.c index d9ac2d28900..229879c92af 100644 --- a/mythtv/libs/libmyth/audio/pink.c +++ b/mythtv/libs/libmyth/audio/pink.c @@ -32,9 +32,9 @@ /* Calculate pseudo-random 32 bit number based on linear congruential method. */ static unsigned long generate_random_number( void ) { - static unsigned long rand_seed = 22222; /* Change this for different random sequences. */ - rand_seed = (rand_seed * 196314165) + 907633515; - return rand_seed; + static unsigned long s_randSeed = 22222; /* Change this for different random sequences. */ + s_randSeed = (s_randSeed * 196314165) + 907633515; + return s_randSeed; } /* Setup PinkNoise structure for N rows of generators. */ diff --git a/mythtv/libs/libmyth/audio/spdifencoder.cpp b/mythtv/libs/libmyth/audio/spdifencoder.cpp index a1a0b161367..43d77ddadd2 100644 --- a/mythtv/libs/libmyth/audio/spdifencoder.cpp +++ b/mythtv/libs/libmyth/audio/spdifencoder.cpp @@ -100,8 +100,8 @@ void SPDIFEncoder::WriteFrame(unsigned char *data, int size) { AVPacket packet; av_init_packet(&packet); - static int pts = 1; // to avoid warning "Encoder did not produce proper pts" - packet.pts = pts++; + static int s_pts = 1; // to avoid warning "Encoder did not produce proper pts" + packet.pts = s_pts++; packet.data = data; packet.size = size; diff --git a/mythtv/libs/libmyth/mythcontext.cpp b/mythtv/libs/libmyth/mythcontext.cpp index de0180c0355..d2d7a621dca 100644 --- a/mythtv/libs/libmyth/mythcontext.cpp +++ b/mythtv/libs/libmyth/mythcontext.cpp @@ -120,8 +120,8 @@ class MythContextPrivate : public QObject QString m_masterhostname; ///< master backend hostname - DatabaseParams m_DBparams; ///< Current database host & WOL details - QString m_DBhostCp; ///< dbHostName backup + DatabaseParams m_dbParams; ///< Current database host & WOL details + QString m_dbHostCp; ///< dbHostName backup Configuration *m_pConfig {nullptr}; @@ -135,7 +135,7 @@ class MythContextPrivate : public QObject bool m_settingsCacheDirty {false}; private: - MythConfirmationDialog *m_MBEversionPopup {nullptr}; + MythConfirmationDialog *m_mbeVersionPopup {nullptr}; int m_registration {-1}; QDateTime m_lastCheck; QTcpSocket *m_socket {nullptr}; @@ -416,7 +416,7 @@ bool MythContextPrivate::FindDatabase(bool prompt, bool noAutodetect) // 1. Either load config.xml or use sensible "localhost" defaults: bool loaded = LoadDatabaseSettings(); - DatabaseParams dbParamsFromFile = m_DBparams; + DatabaseParams dbParamsFromFile = m_dbParams; // In addition to the UI chooser, we can also try to autoSelect later, // but only if we're not doing manualSelect and there was no @@ -512,14 +512,14 @@ bool MythContextPrivate::FindDatabase(bool prompt, bool noAutodetect) LOG(VB_GENERAL, LOG_DEBUG, "FindDatabase() - Success!"); // If we got the database from UPNP then the wakeup settings are lost. // Restore them. - m_DBparams.wolEnabled = dbParamsFromFile.wolEnabled; - m_DBparams.wolReconnect = dbParamsFromFile.wolReconnect; - m_DBparams.wolRetry = dbParamsFromFile.wolRetry; - m_DBparams.wolCommand = dbParamsFromFile.wolCommand; - - SaveDatabaseParams(m_DBparams, - !loaded || m_DBparams.forceSave || - dbParamsFromFile != m_DBparams); + m_dbParams.wolEnabled = dbParamsFromFile.wolEnabled; + m_dbParams.wolReconnect = dbParamsFromFile.wolReconnect; + m_dbParams.wolRetry = dbParamsFromFile.wolRetry; + m_dbParams.wolCommand = dbParamsFromFile.wolCommand; + + SaveDatabaseParams(m_dbParams, + !loaded || m_dbParams.forceSave || + dbParamsFromFile != m_dbParams); EnableDBerrors(); ResetDatabase(); return true; @@ -535,48 +535,48 @@ bool MythContextPrivate::FindDatabase(bool prompt, bool noAutodetect) bool MythContextPrivate::LoadDatabaseSettings(void) { // try new format first - m_DBparams.LoadDefaults(); + m_dbParams.LoadDefaults(); - m_DBparams.localHostName = m_pConfig->GetValue("LocalHostName", ""); - m_DBparams.dbHostPing = m_pConfig->GetBoolValue(kDefaultDB + "PingHost", true); - m_DBparams.dbHostName = m_pConfig->GetValue(kDefaultDB + "Host", ""); - m_DBparams.dbUserName = m_pConfig->GetValue(kDefaultDB + "UserName", ""); - m_DBparams.dbPassword = m_pConfig->GetValue(kDefaultDB + "Password", ""); - m_DBparams.dbName = m_pConfig->GetValue(kDefaultDB + "DatabaseName", ""); - m_DBparams.dbPort = m_pConfig->GetValue(kDefaultDB + "Port", 0); + m_dbParams.localHostName = m_pConfig->GetValue("LocalHostName", ""); + m_dbParams.dbHostPing = m_pConfig->GetBoolValue(kDefaultDB + "PingHost", true); + m_dbParams.dbHostName = m_pConfig->GetValue(kDefaultDB + "Host", ""); + m_dbParams.dbUserName = m_pConfig->GetValue(kDefaultDB + "UserName", ""); + m_dbParams.dbPassword = m_pConfig->GetValue(kDefaultDB + "Password", ""); + m_dbParams.dbName = m_pConfig->GetValue(kDefaultDB + "DatabaseName", ""); + m_dbParams.dbPort = m_pConfig->GetValue(kDefaultDB + "Port", 0); - m_DBparams.wolEnabled = + m_dbParams.wolEnabled = m_pConfig->GetBoolValue(kDefaultWOL + "Enabled", false); - m_DBparams.wolReconnect = + m_dbParams.wolReconnect = m_pConfig->GetValue(kDefaultWOL + "SQLReconnectWaitTime", 0); - m_DBparams.wolRetry = + m_dbParams.wolRetry = m_pConfig->GetValue(kDefaultWOL + "SQLConnectRetry", 5); - m_DBparams.wolCommand = + m_dbParams.wolCommand = m_pConfig->GetValue(kDefaultWOL + "Command", ""); - bool ok = m_DBparams.IsValid("config.xml"); + bool ok = m_dbParams.IsValid("config.xml"); if (!ok) // if new format fails, try legacy format { - m_DBparams.LoadDefaults(); - m_DBparams.dbHostName = m_pConfig->GetValue( + m_dbParams.LoadDefaults(); + m_dbParams.dbHostName = m_pConfig->GetValue( kDefaultMFE + "DBHostName", ""); - m_DBparams.dbUserName = m_pConfig->GetValue( + m_dbParams.dbUserName = m_pConfig->GetValue( kDefaultMFE + "DBUserName", ""); - m_DBparams.dbPassword = m_pConfig->GetValue( + m_dbParams.dbPassword = m_pConfig->GetValue( kDefaultMFE + "DBPassword", ""); - m_DBparams.dbName = m_pConfig->GetValue( + m_dbParams.dbName = m_pConfig->GetValue( kDefaultMFE + "DBName", ""); - m_DBparams.dbPort = m_pConfig->GetValue( + m_dbParams.dbPort = m_pConfig->GetValue( kDefaultMFE + "DBPort", 0); - m_DBparams.forceSave = true; - ok = m_DBparams.IsValid("config.xml"); + m_dbParams.forceSave = true; + ok = m_dbParams.IsValid("config.xml"); } if (!ok) - m_DBparams.LoadDefaults(); + m_dbParams.LoadDefaults(); - gCoreContext->GetDB()->SetDatabaseParams(m_DBparams); + gCoreContext->GetDB()->SetDatabaseParams(m_dbParams); - QString hostname = m_DBparams.localHostName; + QString hostname = m_dbParams.localHostName; if (hostname.isEmpty() || hostname == "my-unique-identifier-goes-here") { @@ -629,7 +629,7 @@ bool MythContextPrivate::LoadDatabaseSettings(void) } else { - m_DBparams.localEnabled = true; + m_dbParams.localEnabled = true; } LOG(VB_GENERAL, LOG_INFO, QString("Using a profile name of: '%1' (Usually the " @@ -646,7 +646,7 @@ bool MythContextPrivate::SaveDatabaseParams( bool ret = true; // only rewrite file if it has changed - if (params != m_DBparams || force) + if (params != m_dbParams || force) { m_pConfig->SetValue( "LocalHostName", params.localHostName); @@ -696,8 +696,8 @@ bool MythContextPrivate::SaveDatabaseParams( m_pConfig->Save(); // Save the new settings: - m_DBparams = params; - gCoreContext->GetDB()->SetDatabaseParams(m_DBparams); + m_dbParams = params; + gCoreContext->GetDB()->SetDatabaseParams(m_dbParams); // If database has changed, force its use: ResetDatabase(); @@ -830,7 +830,7 @@ QString MythContextPrivate::TestDBconnection(bool prompt) st_success = 6 } startupState = st_start; - static const QString guiStatuses[7] = + static const QString kGuiStatuses[7] = {"start","dbAwake","dbStarted","dbConnects","beWOL","beAwake", "success" }; @@ -841,18 +841,18 @@ QString MythContextPrivate::TestDBconnection(bool prompt) { QElapsedTimer timer; timer.start(); - if (m_DBparams.dbHostName.isNull() && m_DBhostCp.length()) - host = m_DBhostCp; + if (m_dbParams.dbHostName.isNull() && m_dbHostCp.length()) + host = m_dbHostCp; else - host = m_DBparams.dbHostName; - port = m_DBparams.dbPort; + host = m_dbParams.dbHostName; + port = m_dbParams.dbPort; if (port == 0) port = 3306; int wakeupTime = 3; int attempts = 11; - if (m_DBparams.wolEnabled) { - wakeupTime = m_DBparams.wolReconnect; - attempts = m_DBparams.wolRetry + 1; + if (m_dbParams.wolEnabled) { + wakeupTime = m_dbParams.wolReconnect; + attempts = m_dbParams.wolRetry + 1; startupState = st_start; } else @@ -884,7 +884,7 @@ QString MythContextPrivate::TestDBconnection(bool prompt) LOG(VB_GENERAL, LOG_INFO, QString("Start up testing connections. DB %1, BE %2, attempt %3, status %4, Delay: %5") - .arg(host).arg(backendIP).arg(attempt).arg(guiStatuses[startupState]).arg(msStartupScreenDelay) ); + .arg(host).arg(backendIP).arg(attempt).arg(kGuiStatuses[startupState]).arg(msStartupScreenDelay) ); int useTimeout = wakeupTime; if (attempt == 0) @@ -902,16 +902,16 @@ QString MythContextPrivate::TestDBconnection(bool prompt) if (m_guiStartup && !m_guiStartup->m_Exit) { if (attempt > 0) - m_guiStartup->setStatusState(guiStatuses[startupState]); + m_guiStartup->setStatusState(kGuiStatuses[startupState]); m_guiStartup->setMessageState("empty"); processEvents(); } switch (startupState) { case st_start: - if (m_DBparams.wolEnabled) + if (m_dbParams.wolEnabled) { if (attempt > 0) - MythWakeup(m_DBparams.wolCommand); + MythWakeup(m_dbParams.wolCommand); if (!checkPort(host, port, useTimeout)) break; } @@ -925,10 +925,10 @@ QString MythContextPrivate::TestDBconnection(bool prompt) case st_dbStarted: // If the database is connecting with link-local // address, it may have changed - if (m_DBparams.dbHostName != host) + if (m_dbParams.dbHostName != host) { - m_DBparams.dbHostName = host; - gCoreContext->GetDB()->SetDatabaseParams(m_DBparams); + m_dbParams.dbHostName = host; + gCoreContext->GetDB()->SetDatabaseParams(m_dbParams); } EnableDBerrors(); ResetDatabase(); @@ -1003,7 +1003,7 @@ QString MythContextPrivate::TestDBconnection(bool prompt) if (startupState == st_success) break; - QString stateMsg = guiStatuses[startupState]; + QString stateMsg = kGuiStatuses[startupState]; stateMsg.append("Fail"); LOG(VB_GENERAL, LOG_INFO, QString("Start up failure. host %1, status %2") @@ -1099,20 +1099,20 @@ void MythContextPrivate::SilenceDBerrors(void) // Save the configured hostname, so that we can // still display it in the DatabaseSettings screens - if (m_DBparams.dbHostName.length()) - m_DBhostCp = m_DBparams.dbHostName; + if (m_dbParams.dbHostName.length()) + m_dbHostCp = m_dbParams.dbHostName; - m_DBparams.dbHostName.clear(); - gCoreContext->GetDB()->SetDatabaseParams(m_DBparams); + m_dbParams.dbHostName.clear(); + gCoreContext->GetDB()->SetDatabaseParams(m_dbParams); } void MythContextPrivate::EnableDBerrors(void) { // Restore (possibly) blanked hostname - if (m_DBparams.dbHostName.isNull() && m_DBhostCp.length()) + if (m_dbParams.dbHostName.isNull() && m_dbHostCp.length()) { - m_DBparams.dbHostName = m_DBhostCp; - gCoreContext->GetDB()->SetDatabaseParams(m_DBparams); + m_dbParams.dbHostName = m_dbHostCp; + gCoreContext->GetDB()->SetDatabaseParams(m_dbParams); } gCoreContext->GetDB()->SetSuppressDBMessages(false); @@ -1133,7 +1133,7 @@ void MythContextPrivate::EnableDBerrors(void) void MythContextPrivate::ResetDatabase(void) { gCoreContext->GetDBManager()->CloseDatabases(); - gCoreContext->GetDB()->SetDatabaseParams(m_DBparams); + gCoreContext->GetDB()->SetDatabaseParams(m_dbParams); gCoreContext->ClearSettingsCache(); } @@ -1154,7 +1154,7 @@ int MythContextPrivate::ChooseBackend(const QString &error) LOG(VB_GENERAL, LOG_INFO, "Putting up the UPnP backend chooser"); BackendSelection::Decision ret = - BackendSelection::Prompt(&m_DBparams, m_pConfig); + BackendSelection::Prompt(&m_dbParams, m_pConfig); EndTempWindow(); @@ -1316,12 +1316,12 @@ bool MythContextPrivate::UPnPconnect(const DeviceLocation *backend, MythXMLClient client(URL); LOG(VB_UPNP, LOG_INFO, loc + QString("Trying host at %1").arg(URL)); - switch (client.GetConnectionInfo(PIN, &m_DBparams, error)) + switch (client.GetConnectionInfo(PIN, &m_dbParams, error)) { case UPnPResult_Success: - gCoreContext->GetDB()->SetDatabaseParams(m_DBparams); + gCoreContext->GetDB()->SetDatabaseParams(m_dbParams); LOG(VB_UPNP, LOG_INFO, loc + - "Got database hostname: " + m_DBparams.dbHostName); + "Got database hostname: " + m_dbParams.dbHostName); return true; case UPnPResult_ActionNotAuthorized: @@ -1345,7 +1345,7 @@ bool MythContextPrivate::UPnPconnect(const DeviceLocation *backend, return false; LOG(VB_UPNP, LOG_INFO, "Trying default DB credentials at " + URL); - m_DBparams.dbHostName = URL; + m_dbParams.dbHostName = URL; return true; } @@ -1432,7 +1432,7 @@ void MythContextPrivate::HideConnectionFailurePopup(void) void MythContextPrivate::ShowVersionMismatchPopup(uint remote_version) { - if (m_MBEversionPopup) + if (m_mbeVersionPopup) return; QString message = @@ -1445,7 +1445,7 @@ void MythContextPrivate::ShowVersionMismatchPopup(uint remote_version) if (HasMythMainWindow() && m_ui && m_ui->IsScreenSetup()) { - m_MBEversionPopup = ShowOkPopup( + m_mbeVersionPopup = ShowOkPopup( message, m_sh, SLOT(VersionMismatchPopupClosed())); } else @@ -1485,8 +1485,8 @@ bool MythContextPrivate::saveSettingsCache(void) QDir dir(cacheDirName); dir.mkpath(cacheDirName); XmlConfiguration config = XmlConfiguration("cache/contextcache.xml"); - static const int arraySize = sizeof(s_settingsToSave)/sizeof(s_settingsToSave[0]); - for (int ix = 0; ix < arraySize; ix++) + static constexpr int kArraySize = sizeof(s_settingsToSave)/sizeof(s_settingsToSave[0]); + for (int ix = 0; ix < kArraySize; ix++) { QString cacheValue = config.GetValue("Settings/"+s_settingsToSave[ix],QString()); gCoreContext->ClearOverrideSettingForSession(s_settingsToSave[ix]); @@ -1506,8 +1506,8 @@ void MythContextPrivate::loadSettingsCacheOverride(void) if (!m_gui) return; XmlConfiguration config = XmlConfiguration("cache/contextcache.xml"); - static const int arraySize = sizeof(s_settingsToSave)/sizeof(s_settingsToSave[0]); - for (int ix = 0; ix < arraySize; ix++) + static constexpr int kArraySize = sizeof(s_settingsToSave)/sizeof(s_settingsToSave[0]); + for (int ix = 0; ix < kArraySize; ix++) { if (!gCoreContext->GetSetting(s_settingsToSave[ix],QString()).isEmpty()) continue; @@ -1525,8 +1525,8 @@ void MythContextPrivate::loadSettingsCacheOverride(void) void MythContextPrivate::clearSettingsCacheOverride(void) { QString language = gCoreContext->GetSetting("Language",QString()); - static const int arraySize = sizeof(s_settingsToSave)/sizeof(s_settingsToSave[0]); - for (int ix = 0; ix < arraySize; ix++) + static constexpr int kArraySize = sizeof(s_settingsToSave)/sizeof(s_settingsToSave[0]); + for (int ix = 0; ix < kArraySize; ix++) { gCoreContext->ClearOverrideSettingForSession(s_settingsToSave[ix]); } @@ -1540,7 +1540,7 @@ void MythContextPrivate::clearSettingsCacheOverride(void) void MythContextSlotHandler::VersionMismatchPopupClosed(void) { - d->m_MBEversionPopup = nullptr; + d->m_mbeVersionPopup = nullptr; qApp->exit(GENERIC_EXIT_SOCKET_ERROR); } @@ -1680,7 +1680,7 @@ void MythContext::SetDisableEventPopup(bool check) DatabaseParams MythContext::GetDatabaseParams(void) { - return d->m_DBparams; + return d->m_dbParams; } bool MythContext::SaveDatabaseParams(const DatabaseParams ¶ms) diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp index c623042a262..c1785081583 100644 --- a/mythtv/libs/libmyth/programinfo.cpp +++ b/mythtv/libs/libmyth/programinfo.cpp @@ -125,25 +125,25 @@ static QString determineURLType(const QString& url) QString myth_category_type_to_string(ProgramInfo::CategoryType category_type) { - static int NUM_CAT_TYPES = 5; - static const char *cattype[] = + static constexpr int kNumCatTypes = 5; + static const char *s_cattype[] = { "", "movie", "series", "sports", "tvshow", }; if ((category_type > ProgramInfo::kCategoryNone) && - ((int)category_type < NUM_CAT_TYPES)) - return QString(cattype[category_type]); + ((int)category_type < kNumCatTypes)) + return QString(s_cattype[category_type]); return ""; } ProgramInfo::CategoryType string_to_myth_category_type(const QString &category_type) { - static int NUM_CAT_TYPES = 5; - static const char *cattype[] = + static constexpr int kNumCatTypes = 5; + static const char *s_cattype[] = { "", "movie", "series", "sports", "tvshow", }; - for (int i = 1; i < NUM_CAT_TYPES; i++) - if (category_type == cattype[i]) + for (int i = 1; i < kNumCatTypes; i++) + if (category_type == s_cattype[i]) return (ProgramInfo::CategoryType) i; return ProgramInfo::kCategoryNone; } @@ -5090,10 +5090,10 @@ bool ProgramInfo::QueryTuningInfo(QString &channum, QString &input) const static int init_tr(void) { - static bool done = false; - static QMutex init_tr_lock; - QMutexLocker locker(&init_tr_lock); - if (done) + static bool s_done = false; + static QMutex s_initTrLock; + QMutexLocker locker(&s_initTrLock); + if (s_done) return 1; QString rec_profile_names = @@ -5154,7 +5154,7 @@ static int init_tr(void) QString play_groups = QObject::tr("Default", "Playback Group Name"); - done = true; + s_done = true; return (rec_profile_names.length() + rec_profile_groups.length() + display_rec_groups.length() + @@ -5218,19 +5218,19 @@ void ProgramInfo::SubstituteMatches(QString &str) str.replace(QString("%PARTTOTAL%"), QString::number(m_parttotal)); str.replace(QString("%ORIGINALAIRDATE%"), m_originalAirDate.toString(Qt::ISODate)); - static const char *time_str[] = + static const char *s_timeStr[] = { "STARTTIME", "ENDTIME", "PROGSTART", "PROGEND", }; const QDateTime *time_dtr[] = { &m_recstartts, &m_recendts, &m_startts, &m_endts, }; - for (size_t i = 0; i < sizeof(time_str)/sizeof(char*); i++) + for (size_t i = 0; i < sizeof(s_timeStr)/sizeof(char*); i++) { - str.replace(QString("%%1%").arg(time_str[i]), + str.replace(QString("%%1%").arg(s_timeStr[i]), (time_dtr[i]->toLocalTime()).toString("yyyyMMddhhmmss")); - str.replace(QString("%%1ISO%").arg(time_str[i]), + str.replace(QString("%%1ISO%").arg(s_timeStr[i]), (time_dtr[i]->toLocalTime()).toString(Qt::ISODate)); - str.replace(QString("%%1UTC%").arg(time_str[i]), + str.replace(QString("%%1UTC%").arg(s_timeStr[i]), time_dtr[i]->toString("yyyyMMddhhmmss")); - str.replace(QString("%%1ISOUTC%").arg(time_str[i]), + str.replace(QString("%%1ISOUTC%").arg(s_timeStr[i]), time_dtr[i]->toString(Qt::ISODate)); } str.replace(QString("%RECORDEDID%"), QString::number(m_recordedid)); diff --git a/mythtv/libs/libmyth/rssparse.cpp b/mythtv/libs/libmyth/rssparse.cpp index ae93c3bb38b..4451047d579 100644 --- a/mythtv/libs/libmyth/rssparse.cpp +++ b/mythtv/libs/libmyth/rssparse.cpp @@ -193,26 +193,26 @@ class MRSSParser { struct ArbitraryLocatedData { - QString URL; - QString Rating; - QString RatingScheme; - QString Title; - QString Description; - QString Keywords; - QString CopyrightURL; - QString CopyrightText; - int RatingAverage {0}; - int RatingCount {0}; - int RatingMin {0}; - int RatingMax {0}; - int Views {0}; - int Favs {0}; - QString Tags; - QList Thumbnails; - QList Credits; - QList Comments; - QList PeerLinks; - QList Scenes; + QString m_url; + QString m_rating; + QString m_ratingScheme; + QString m_title; + QString m_description; + QString m_keywords; + QString m_copyrightUrl; + QString m_copyrightText; + int m_ratingAverage {0}; + int m_ratingCount {0}; + int m_ratingMin {0}; + int m_ratingMax {0}; + int m_views {0}; + int m_favs {0}; + QString m_tags; + QList m_thumbnails; + QList m_credits; + QList m_comments; + QList m_peerLinks; + QList m_scenes; ArbitraryLocatedData() = default; @@ -221,42 +221,42 @@ class MRSSParser */ ArbitraryLocatedData& operator+= (const ArbitraryLocatedData& child) { - if (!child.URL.isEmpty()) - URL = child.URL; - if (!child.Rating.isEmpty()) - Rating = child.Rating; - if (!child.RatingScheme.isEmpty()) - RatingScheme = child.RatingScheme; - if (!child.Title.isEmpty()) - Title = child.Title; - if (!child.Description.isEmpty()) - Description = child.Description; - if (!child.Keywords.isEmpty()) - Keywords = child.Keywords; - if (!child.CopyrightURL.isEmpty()) - CopyrightURL = child.CopyrightURL; - if (!child.CopyrightText.isEmpty()) - CopyrightText = child.CopyrightText; - if (child.RatingAverage != 0) - RatingAverage = child.RatingAverage; - if (child.RatingCount != 0) - RatingCount = child.RatingCount; - if (child.RatingMin != 0) - RatingMin = child.RatingMin; - if (child.RatingMax != 0) - RatingMax = child.RatingMax; - if (child.Views != 0) - Views = child.Views; - if (child.Favs != 0) - Favs = child.Favs; - if (!child.Tags.isEmpty()) - Tags = child.Tags; - - Thumbnails += child.Thumbnails; - Credits += child.Credits; - Comments += child.Comments; - PeerLinks += child.PeerLinks; - Scenes += child.Scenes; + if (!child.m_url.isEmpty()) + m_url = child.m_url; + if (!child.m_rating.isEmpty()) + m_rating = child.m_rating; + if (!child.m_ratingScheme.isEmpty()) + m_ratingScheme = child.m_ratingScheme; + if (!child.m_title.isEmpty()) + m_title = child.m_title; + if (!child.m_description.isEmpty()) + m_description = child.m_description; + if (!child.m_keywords.isEmpty()) + m_keywords = child.m_keywords; + if (!child.m_copyrightUrl.isEmpty()) + m_copyrightUrl = child.m_copyrightUrl; + if (!child.m_copyrightText.isEmpty()) + m_copyrightText = child.m_copyrightText; + if (child.m_ratingAverage != 0) + m_ratingAverage = child.m_ratingAverage; + if (child.m_ratingCount != 0) + m_ratingCount = child.m_ratingCount; + if (child.m_ratingMin != 0) + m_ratingMin = child.m_ratingMin; + if (child.m_ratingMax != 0) + m_ratingMax = child.m_ratingMax; + if (child.m_views != 0) + m_views = child.m_views; + if (child.m_favs != 0) + m_favs = child.m_favs; + if (!child.m_tags.isEmpty()) + m_tags = child.m_tags; + + m_thumbnails += child.m_thumbnails; + m_credits += child.m_credits; + m_comments += child.m_comments; + m_peerLinks += child.m_peerLinks; + m_scenes += child.m_scenes; return *this; } }; @@ -298,7 +298,7 @@ class MRSSParser if (en.hasAttribute("url")) entry.URL = en.attribute("url"); else - entry.URL = d.URL; + entry.URL = d.m_url; entry.Size = en.attribute("fileSize").toInt(); entry.Type = en.attribute("type"); @@ -329,30 +329,30 @@ class MRSSParser entry.Lang = QString(); if (!en.attribute("rating").isNull()) - entry.Rating = d.Rating; + entry.Rating = d.m_rating; else entry.Rating = QString(); - entry.RatingScheme = d.RatingScheme; - entry.Title = d.Title; - entry.Description = d.Description; - entry.Keywords = d.Keywords; - entry.CopyrightURL = d.CopyrightURL; - entry.CopyrightText = d.CopyrightText; - if (d.RatingAverage != 0) - entry.RatingAverage = d.RatingAverage; + entry.RatingScheme = d.m_ratingScheme; + entry.Title = d.m_title; + entry.Description = d.m_description; + entry.Keywords = d.m_keywords; + entry.CopyrightURL = d.m_copyrightUrl; + entry.CopyrightText = d.m_copyrightText; + if (d.m_ratingAverage != 0) + entry.RatingAverage = d.m_ratingAverage; else entry.RatingAverage = 0; - entry.RatingCount = d.RatingCount; - entry.RatingMin = d.RatingMin; - entry.RatingMax = d.RatingMax; - entry.Views = d.Views; - entry.Favs = d.Favs; - entry.Tags = d.Tags; - entry.Thumbnails = d.Thumbnails; - entry.Credits = d.Credits; - entry.Comments = d.Comments; - entry.PeerLinks = d.PeerLinks; - entry.Scenes = d.Scenes; + entry.RatingCount = d.m_ratingCount; + entry.RatingMin = d.m_ratingMin; + entry.RatingMax = d.m_ratingMax; + entry.Views = d.m_views; + entry.Favs = d.m_favs; + entry.Tags = d.m_tags; + entry.Thumbnails = d.m_thumbnails; + entry.Credits = d.m_credits; + entry.Comments = d.m_comments; + entry.PeerLinks = d.m_peerLinks; + entry.Scenes = d.m_scenes; result << entry; } @@ -667,26 +667,26 @@ class MRSSParser } ArbitraryLocatedData result; - result.URL = GetURL(element); - result.Rating = rating; - result.RatingScheme = rscheme; - result.Title = GetTitle(element); - result.Description = GetDescription(element); - result.Keywords = GetKeywords(element); - result.CopyrightURL = curl; - result.CopyrightText = ctext; - result.RatingAverage = raverage; - result.RatingCount = rcount; - result.RatingMin = rmin; - result.RatingMax = rmax; - result.Views = views; - result.Favs = favs; - result.Tags = tags; - result.Thumbnails = GetThumbnails(element); - result.Credits = GetCredits(element); - result.Comments = GetComments(element); - result.PeerLinks = GetPeerLinks(element); - result.Scenes = GetScenes(element); + result.m_url = GetURL(element); + result.m_rating = rating; + result.m_ratingScheme = rscheme; + result.m_title = GetTitle(element); + result.m_description = GetDescription(element); + result.m_keywords = GetKeywords(element); + result.m_copyrightUrl = curl; + result.m_copyrightText = ctext; + result.m_ratingAverage = raverage; + result.m_ratingCount = rcount; + result.m_ratingMin = rmin; + result.m_ratingMax = rmax; + result.m_views = views; + result.m_favs = favs; + result.m_tags = tags; + result.m_thumbnails = GetThumbnails(element); + result.m_credits = GetCredits(element); + result.m_comments = GetComments(element); + result.m_peerLinks = GetPeerLinks(element); + result.m_scenes = GetScenes(element); return result; } diff --git a/mythtv/libs/libmythbase/logging.cpp b/mythtv/libs/libmythbase/logging.cpp index 778f4666d06..3474bd233a1 100644 --- a/mythtv/libs/libmythbase/logging.cpp +++ b/mythtv/libs/libmythbase/logging.cpp @@ -78,11 +78,11 @@ static bool logThreadFinished = false; static bool debugRegistration = false; typedef struct { - bool propagate; - int quiet; - int facility; - bool dblog; - QString path; + bool m_propagate; + int m_quiet; + int m_facility; + bool m_dblog; + QString m_path; } LogPropagateOpts; LogPropagateOpts logPropagateOpts {false, 0, 0, true, ""}; @@ -177,13 +177,13 @@ QByteArray LoggingItem::toByteArray(void) /// \return C-string of the thread name char *LoggingItem::getThreadName(void) { - static const char *unknown = "thread_unknown"; + static constexpr char s_unknown[] = "thread_unknown"; if( m_threadName ) return m_threadName; QMutexLocker locker(&logThreadMutex); - return logThreadHash.value(m_threadId, (char *)unknown); + return logThreadHash.value(m_threadId, (char *)s_unknown); } /// \brief Get the thread ID of the thread that produced the LoggingItem @@ -652,41 +652,41 @@ void logPropagateCalc(void) logPropagateArgs = " --verbose " + mask; logPropagateArgList << "--verbose" << mask; - if (logPropagateOpts.propagate) + if (logPropagateOpts.m_propagate) { - logPropagateArgs += " --logpath " + logPropagateOpts.path; - logPropagateArgList << "--logpath" << logPropagateOpts.path; + logPropagateArgs += " --logpath " + logPropagateOpts.m_path; + logPropagateArgList << "--logpath" << logPropagateOpts.m_path; } QString name = logLevelGetName(logLevel); logPropagateArgs += " --loglevel " + name; logPropagateArgList << "--loglevel" << name; - for (int i = 0; i < logPropagateOpts.quiet; i++) + for (int i = 0; i < logPropagateOpts.m_quiet; i++) { logPropagateArgs += " --quiet"; logPropagateArgList << "--quiet"; } - if (logPropagateOpts.dblog) + if (logPropagateOpts.m_dblog) { logPropagateArgs += " --enable-dblog"; logPropagateArgList << "--enable-dblog"; } #if !defined(_WIN32) && !defined(Q_OS_ANDROID) - if (logPropagateOpts.facility >= 0) + if (logPropagateOpts.m_facility >= 0) { const CODE *syslogname = nullptr; for (syslogname = &facilitynames[0]; (syslogname->c_name && - syslogname->c_val != logPropagateOpts.facility); syslogname++); + syslogname->c_val != logPropagateOpts.m_facility); syslogname++); logPropagateArgs += QString(" --syslog %1").arg(syslogname->c_name); logPropagateArgList << "--syslog" << syslogname->c_name; } #if CONFIG_SYSTEMD_JOURNAL - else if (logPropagateOpts.facility == SYSTEMD_JOURNAL_FACILITY) + else if (logPropagateOpts.m_facility == SYSTEMD_JOURNAL_FACILITY) { logPropagateArgs += " --systemd-journal"; logPropagateArgList << "--systemd-journal"; @@ -699,7 +699,7 @@ void logPropagateCalc(void) /// \return true if --quiet is being propagated bool logPropagateQuiet(void) { - return logPropagateOpts.quiet; + return logPropagateOpts.m_quiet; } /// \brief Entry point to start logging for the application. This will @@ -724,16 +724,16 @@ void logStart(const QString& logfile, int progress, int quiet, int facility, LOG(VB_GENERAL, LOG_NOTICE, QString("Setting Log Level to LOG_%1") .arg(logLevelGetName(logLevel).toUpper())); - logPropagateOpts.propagate = propagate; - logPropagateOpts.quiet = quiet; - logPropagateOpts.facility = facility; - logPropagateOpts.dblog = dblog; + logPropagateOpts.m_propagate = propagate; + logPropagateOpts.m_quiet = quiet; + logPropagateOpts.m_facility = facility; + logPropagateOpts.m_dblog = dblog; if (propagate) { QFileInfo finfo(logfile); QString path = finfo.path(); - logPropagateOpts.path = path; + logPropagateOpts.m_path = path; } logPropagateCalc(); diff --git a/mythtv/libs/libmythbase/loggingserver.cpp b/mythtv/libs/libmythbase/loggingserver.cpp index 69d3d54a8de..e6e36861e08 100644 --- a/mythtv/libs/libmythbase/loggingserver.cpp +++ b/mythtv/libs/libmythbase/loggingserver.cpp @@ -65,8 +65,8 @@ LogForwardThread *logForwardThread = nullptr; typedef QList LoggerList; typedef struct { - LoggerList *list; - qlonglong epoch; + LoggerList *m_itemList; + qlonglong m_itemEpoch; } LoggerListItem; typedef QMap ClientMap; @@ -805,7 +805,7 @@ void LogForwardThread::forwardMessage(LogMessage *msg) // cout << "msg " << clientId.toLocal8Bit().constData() << endl; if (logItem) { - loggingGetTimeStamp(&logItem->epoch, nullptr); + loggingGetTimeStamp(&logItem->m_itemEpoch, nullptr); } else { @@ -885,20 +885,20 @@ void LogForwardThread::forwardMessage(LogMessage *msg) } logItem = new LoggerListItem; - loggingGetTimeStamp(&logItem->epoch, nullptr); - logItem->list = loggers; + loggingGetTimeStamp(&logItem->m_itemEpoch, nullptr); + logItem->m_itemList = loggers; logClientMap.insert(clientId, logItem); item->DecrRef(); } - if (logItem && logItem->list && !logItem->list->isEmpty()) + if (logItem && logItem->m_itemList && !logItem->m_itemList->isEmpty()) { - LoggerList::iterator it = logItem->list->begin(); + LoggerList::iterator it = logItem->m_itemList->begin(); LoggingItem *item = LoggingItem::create(json); if (!item) return; - for (; it != logItem->list->end(); ++it) + for (; it != logItem->m_itemList->end(); ++it) { (*it)->logmsg(item); } diff --git a/mythtv/libs/libmythbase/mthreadpool.cpp b/mythtv/libs/libmythbase/mthreadpool.cpp index ffa872f9185..be994e8f17f 100644 --- a/mythtv/libs/libmythbase/mthreadpool.cpp +++ b/mythtv/libs/libmythbase/mthreadpool.cpp @@ -104,7 +104,7 @@ class MPoolThread : public MThread { public: MPoolThread(MThreadPool &pool, int timeout) : - MThread("PT"), m_pool(pool), m_expiry_timeout(timeout) + MThread("PT"), m_pool(pool), m_expiryTimeout(timeout) { QMutexLocker locker(&s_lock); setObjectName(QString("PT%1").arg(s_thread_num)); @@ -120,12 +120,12 @@ class MPoolThread : public MThread QMutexLocker locker(&m_lock); while (true) { - if (m_do_run && !m_runnable) - m_wait.wait(locker.mutex(), m_expiry_timeout+1); + if (m_doRun && !m_runnable) + m_wait.wait(locker.mutex(), m_expiryTimeout+1); if (!m_runnable) { - m_do_run = false; + m_doRun = false; locker.unlock(); m_pool.NotifyDone(this); @@ -133,8 +133,8 @@ class MPoolThread : public MThread break; } - if (!m_runnable_name.isEmpty()) - loggingRegisterThread(m_runnable_name); + if (!m_runnableName.isEmpty()) + loggingRegisterThread(m_runnableName); bool autodelete = m_runnable->autoDelete(); m_runnable->run(); @@ -154,7 +154,7 @@ class MPoolThread : public MThread t.start(); - if (m_do_run) + if (m_doRun) { locker.unlock(); m_pool.NotifyAvailable(this); @@ -176,10 +176,10 @@ class MPoolThread : public MThread bool reserved) { QMutexLocker locker(&m_lock); - if (m_do_run && (m_runnable == nullptr)) + if (m_doRun && (m_runnable == nullptr)) { m_runnable = runnable; - m_runnable_name = std::move(runnableName); + m_runnableName = std::move(runnableName); m_reserved = reserved; m_wait.wakeAll(); return true; @@ -190,16 +190,16 @@ class MPoolThread : public MThread void Shutdown(void) { QMutexLocker locker(&m_lock); - m_do_run = false; + m_doRun = false; m_wait.wakeAll(); } QMutex m_lock; QWaitCondition m_wait; MThreadPool &m_pool; - int m_expiry_timeout; - bool m_do_run {true}; - QString m_runnable_name; + int m_expiryTimeout; + bool m_doRun {true}; + QString m_runnableName; bool m_reserved {false}; static QMutex s_lock; @@ -218,21 +218,21 @@ class MThreadPoolPrivate int GetRealMaxThread(void) { - return max(m_max_thread_count,1) + m_reserve_thread; + return max(m_maxThreadCount,1) + m_reserveThread; } mutable QMutex m_lock; QString m_name; QWaitCondition m_wait; bool m_running {true}; - int m_expiry_timeout {120 * 1000}; - int m_max_thread_count {QThread::idealThreadCount()}; - int m_reserve_thread {0}; + int m_expiryTimeout {120 * 1000}; + int m_maxThreadCount {QThread::idealThreadCount()}; + int m_reserveThread {0}; - MPoolQueues m_run_queues; - QSet m_avail_threads; - QSet m_running_threads; - QList m_delete_threads; + MPoolQueues m_runQueues; + QSet m_availThreads; + QSet m_runningThreads; + QList m_deleteThreads; static QMutex s_pool_lock; static MThreadPool *s_pool; @@ -268,11 +268,11 @@ void MThreadPool::Stop(void) { QMutexLocker locker(&m_priv->m_lock); m_priv->m_running = false; - QSet::iterator it = m_priv->m_avail_threads.begin(); - for (; it != m_priv->m_avail_threads.end(); ++it) + QSet::iterator it = m_priv->m_availThreads.begin(); + for (; it != m_priv->m_availThreads.end(); ++it) (*it)->Shutdown(); - it = m_priv->m_running_threads.begin(); - for (; it != m_priv->m_running_threads.end(); ++it) + it = m_priv->m_runningThreads.begin(); + for (; it != m_priv->m_runningThreads.end(); ++it) (*it)->Shutdown(); m_priv->m_wait.wakeAll(); } @@ -282,26 +282,26 @@ void MThreadPool::DeletePoolThreads(void) waitForDone(); QMutexLocker locker(&m_priv->m_lock); - QSet::iterator it = m_priv->m_avail_threads.begin(); - for (; it != m_priv->m_avail_threads.end(); ++it) + QSet::iterator it = m_priv->m_availThreads.begin(); + for (; it != m_priv->m_availThreads.end(); ++it) { - m_priv->m_delete_threads.push_front(*it); + m_priv->m_deleteThreads.push_front(*it); } - m_priv->m_avail_threads.clear(); + m_priv->m_availThreads.clear(); - while (!m_priv->m_delete_threads.empty()) + while (!m_priv->m_deleteThreads.empty()) { - MPoolThread *thread = m_priv->m_delete_threads.back(); + MPoolThread *thread = m_priv->m_deleteThreads.back(); locker.unlock(); thread->wait(); locker.relock(); delete thread; - if (m_priv->m_delete_threads.back() == thread) - m_priv->m_delete_threads.pop_back(); + if (m_priv->m_deleteThreads.back() == thread) + m_priv->m_deleteThreads.pop_back(); else - m_priv->m_delete_threads.removeAll(thread); + m_priv->m_deleteThreads.removeAll(thread); } } @@ -346,8 +346,8 @@ void MThreadPool::start(QRunnable *runnable, const QString& debugName, int prior if (TryStartInternal(runnable, debugName, false)) return; - MPoolQueues::iterator it = m_priv->m_run_queues.find(priority); - if (it != m_priv->m_run_queues.end()) + MPoolQueues::iterator it = m_priv->m_runQueues.find(priority); + if (it != m_priv->m_runQueues.end()) { (*it).push_back(MPoolEntry(runnable,debugName)); } @@ -355,7 +355,7 @@ void MThreadPool::start(QRunnable *runnable, const QString& debugName, int prior { MPoolQueue list; list.push_back(MPoolEntry(runnable,debugName)); - m_priv->m_run_queues[priority] = list; + m_priv->m_runQueues[priority] = list; } } @@ -363,14 +363,14 @@ void MThreadPool::startReserved( QRunnable *runnable, const QString& debugName, int waitForAvailMS) { QMutexLocker locker(&m_priv->m_lock); - if (waitForAvailMS > 0 && m_priv->m_avail_threads.empty() && - m_priv->m_running_threads.size() >= m_priv->m_max_thread_count) + if (waitForAvailMS > 0 && m_priv->m_availThreads.empty() && + m_priv->m_runningThreads.size() >= m_priv->m_maxThreadCount) { MythTimer t; t.start(); int left = waitForAvailMS - t.elapsed(); - while (left > 0 && m_priv->m_avail_threads.empty() && - m_priv->m_running_threads.size() >= m_priv->m_max_thread_count) + while (left > 0 && m_priv->m_availThreads.empty() && + m_priv->m_runningThreads.size() >= m_priv->m_maxThreadCount) { m_priv->m_wait.wait(locker.mutex(), left); left = waitForAvailMS - t.elapsed(); @@ -392,39 +392,39 @@ bool MThreadPool::TryStartInternal( if (!m_priv->m_running) return false; - while (!m_priv->m_delete_threads.empty()) + while (!m_priv->m_deleteThreads.empty()) { - m_priv->m_delete_threads.back()->wait(); - delete m_priv->m_delete_threads.back(); - m_priv->m_delete_threads.pop_back(); + m_priv->m_deleteThreads.back()->wait(); + delete m_priv->m_deleteThreads.back(); + m_priv->m_deleteThreads.pop_back(); } - while (m_priv->m_avail_threads.begin() != m_priv->m_avail_threads.end()) + while (m_priv->m_availThreads.begin() != m_priv->m_availThreads.end()) { - MPoolThread *thread = *m_priv->m_avail_threads.begin(); - m_priv->m_avail_threads.erase(m_priv->m_avail_threads.begin()); - m_priv->m_running_threads.insert(thread); + MPoolThread *thread = *m_priv->m_availThreads.begin(); + m_priv->m_availThreads.erase(m_priv->m_availThreads.begin()); + m_priv->m_runningThreads.insert(thread); if (reserved) - m_priv->m_reserve_thread++; + m_priv->m_reserveThread++; if (thread->SetRunnable(runnable, debugName, reserved)) { return true; } if (reserved) - m_priv->m_reserve_thread--; + m_priv->m_reserveThread--; thread->Shutdown(); - m_priv->m_running_threads.remove(thread); - m_priv->m_delete_threads.push_front(thread); + m_priv->m_runningThreads.remove(thread); + m_priv->m_deleteThreads.push_front(thread); } if (reserved || - m_priv->m_running_threads.size() < m_priv->GetRealMaxThread()) + m_priv->m_runningThreads.size() < m_priv->GetRealMaxThread()) { if (reserved) - m_priv->m_reserve_thread++; - MPoolThread *thread = new MPoolThread(*this, m_priv->m_expiry_timeout); - m_priv->m_running_threads.insert(thread); + m_priv->m_reserveThread++; + MPoolThread *thread = new MPoolThread(*this, m_priv->m_expiryTimeout); + m_priv->m_runningThreads.insert(thread); thread->SetRunnable(runnable, debugName, reserved); thread->start(); if (thread->isRunning()) @@ -435,10 +435,10 @@ bool MThreadPool::TryStartInternal( // Thread failed to run, OOM? // QThread will print an error, so we don't have to if (reserved) - m_priv->m_reserve_thread--; + m_priv->m_reserveThread--; thread->Shutdown(); - m_priv->m_running_threads.remove(thread); - m_priv->m_delete_threads.push_front(thread); + m_priv->m_runningThreads.remove(thread); + m_priv->m_deleteThreads.push_front(thread); } return false; @@ -450,18 +450,18 @@ void MThreadPool::NotifyAvailable(MPoolThread *thread) if (!m_priv->m_running) { - m_priv->m_running_threads.remove(thread); + m_priv->m_runningThreads.remove(thread); thread->Shutdown(); - m_priv->m_delete_threads.push_front(thread); + m_priv->m_deleteThreads.push_front(thread); m_priv->m_wait.wakeAll(); return; } - MPoolQueues::iterator it = m_priv->m_run_queues.begin(); - if (it == m_priv->m_run_queues.end()) + MPoolQueues::iterator it = m_priv->m_runQueues.begin(); + if (it == m_priv->m_runQueues.end()) { - m_priv->m_running_threads.remove(thread); - m_priv->m_avail_threads.insert(thread); + m_priv->m_runningThreads.remove(thread); + m_priv->m_availThreads.insert(thread); m_priv->m_wait.wakeAll(); return; } @@ -469,83 +469,83 @@ void MThreadPool::NotifyAvailable(MPoolThread *thread) MPoolEntry e = (*it).front(); if (!thread->SetRunnable(e.first, e.second, false)) { - m_priv->m_running_threads.remove(thread); + m_priv->m_runningThreads.remove(thread); m_priv->m_wait.wakeAll(); if (!TryStartInternal(e.first, e.second, false)) { thread->Shutdown(); - m_priv->m_delete_threads.push_front(thread); + m_priv->m_deleteThreads.push_front(thread); return; } thread->Shutdown(); - m_priv->m_delete_threads.push_front(thread); + m_priv->m_deleteThreads.push_front(thread); } (*it).pop_front(); if ((*it).empty()) - m_priv->m_run_queues.erase(it); + m_priv->m_runQueues.erase(it); } void MThreadPool::NotifyDone(MPoolThread *thread) { QMutexLocker locker(&m_priv->m_lock); - m_priv->m_running_threads.remove(thread); - m_priv->m_avail_threads.remove(thread); - if (!m_priv->m_delete_threads.contains(thread)) - m_priv->m_delete_threads.push_front(thread); + m_priv->m_runningThreads.remove(thread); + m_priv->m_availThreads.remove(thread); + if (!m_priv->m_deleteThreads.contains(thread)) + m_priv->m_deleteThreads.push_front(thread); m_priv->m_wait.wakeAll(); } int MThreadPool::expiryTimeout(void) const { QMutexLocker locker(&m_priv->m_lock); - return m_priv->m_expiry_timeout; + return m_priv->m_expiryTimeout; } void MThreadPool::setExpiryTimeout(int expiryTimeout) { QMutexLocker locker(&m_priv->m_lock); - m_priv->m_expiry_timeout = expiryTimeout; + m_priv->m_expiryTimeout = expiryTimeout; } int MThreadPool::maxThreadCount(void) const { QMutexLocker locker(&m_priv->m_lock); - return m_priv->m_max_thread_count; + return m_priv->m_maxThreadCount; } void MThreadPool::setMaxThreadCount(int maxThreadCount) { QMutexLocker locker(&m_priv->m_lock); - m_priv->m_max_thread_count = maxThreadCount; + m_priv->m_maxThreadCount = maxThreadCount; } int MThreadPool::activeThreadCount(void) const { QMutexLocker locker(&m_priv->m_lock); - return m_priv->m_avail_threads.size() + m_priv->m_running_threads.size(); + return m_priv->m_availThreads.size() + m_priv->m_runningThreads.size(); } /* void MThreadPool::reserveThread(void) { QMutexLocker locker(&m_priv->m_lock); - m_priv->m_reserve_thread++; + m_priv->m_reserveThread++; } void MThreadPool::releaseThread(void) { QMutexLocker locker(&m_priv->m_lock); - if (m_priv->m_reserve_thread > 0) - m_priv->m_reserve_thread--; + if (m_priv->m_reserveThread > 0) + m_priv->m_reserveThread--; } */ void MThreadPool::ReleaseThread(void) { QMutexLocker locker(&m_priv->m_lock); - if (m_priv->m_reserve_thread > 0) - m_priv->m_reserve_thread--; + if (m_priv->m_reserveThread > 0) + m_priv->m_reserveThread--; } #if 0 @@ -567,21 +567,21 @@ void MThreadPool::waitForDone(void) QMutexLocker locker(&m_priv->m_lock); while (true) { - while (!m_priv->m_delete_threads.empty()) + while (!m_priv->m_deleteThreads.empty()) { - m_priv->m_delete_threads.back()->wait(); - delete m_priv->m_delete_threads.back(); - m_priv->m_delete_threads.pop_back(); + m_priv->m_deleteThreads.back()->wait(); + delete m_priv->m_deleteThreads.back(); + m_priv->m_deleteThreads.pop_back(); } - if (m_priv->m_running && !m_priv->m_run_queues.empty()) + if (m_priv->m_running && !m_priv->m_runQueues.empty()) { m_priv->m_wait.wait(locker.mutex()); continue; } - QSet working = m_priv->m_running_threads; - working = working.subtract(m_priv->m_avail_threads); + QSet working = m_priv->m_runningThreads; + working = working.subtract(m_priv->m_availThreads); if (working.empty()) break; m_priv->m_wait.wait(locker.mutex()); diff --git a/mythtv/libs/libmythbase/mythcdrom-linux.cpp b/mythtv/libs/libmythbase/mythcdrom-linux.cpp index 3f44886d180..4e1738a95cd 100644 --- a/mythtv/libs/libmythbase/mythcdrom-linux.cpp +++ b/mythtv/libs/libmythbase/mythcdrom-linux.cpp @@ -39,73 +39,73 @@ typedef struct cdrom_generic_command CDROMgenericCmd; // It is the joining of a struct event_header and a struct media_event_desc typedef struct { - uint16_t data_len[2]; + uint16_t m_dataLen[2]; #if HAVE_BIGENDIAN - uint8_t nea : 1; - uint8_t reserved1 : 4; - uint8_t notification_class : 3; + uint8_t m_nea : 1; + uint8_t m_reserved1 : 4; + uint8_t m_notificationClass : 3; #else - uint8_t notification_class : 3; - uint8_t reserved1 : 4; - uint8_t nea : 1; + uint8_t m_notificationClass : 3; + uint8_t m_reserved1 : 4; + uint8_t m_nea : 1; #endif - uint8_t supp_event_class; + uint8_t m_suppEventClass; #if HAVE_BIGENDIAN - uint8_t reserved2 : 4; - uint8_t media_event_code : 4; - uint8_t reserved3 : 6; - uint8_t media_present : 1; - uint8_t door_open : 1; + uint8_t m_reserved2 : 4; + uint8_t m_mediaEventCode : 4; + uint8_t m_reserved3 : 6; + uint8_t m_mediaPresent : 1; + uint8_t m_doorOpen : 1; #else - uint8_t media_event_code : 4; - uint8_t reserved2 : 4; - uint8_t door_open : 1; - uint8_t media_present : 1; - uint8_t reserved3 : 6; + uint8_t m_mediaEventCode : 4; + uint8_t m_reserved2 : 4; + uint8_t m_doorOpen : 1; + uint8_t m_mediaPresent : 1; + uint8_t m_reserved3 : 6; #endif - uint8_t start_slot; - uint8_t end_slot; + uint8_t m_startSlot; + uint8_t m_endSlot; } CDROMeventStatus; // and this is returned by GPCMD_READ_DISC_INFO typedef struct { - uint16_t disc_information_length; + uint16_t m_discInformationLength; #if HAVE_BIGENDIAN - uint8_t reserved1 : 3; - uint8_t erasable : 1; - uint8_t border_status : 2; - uint8_t disc_status : 2; + uint8_t m_reserved1 : 3; + uint8_t m_erasable : 1; + uint8_t m_borderStatus : 2; + uint8_t m_discStatus : 2; #else - uint8_t disc_status : 2; - uint8_t border_status : 2; - uint8_t erasable : 1; - uint8_t reserved1 : 3; + uint8_t m_discStatus : 2; + uint8_t m_borderStatus : 2; + uint8_t m_erasable : 1; + uint8_t m_reserved1 : 3; #endif - uint8_t n_first_track; - uint8_t n_sessions_lsb; - uint8_t first_track_lsb; - uint8_t last_track_lsb; + uint8_t m_nFirstTrack; + uint8_t m_nSessionsLsb; + uint8_t m_firstTrackLsb; + uint8_t m_lastTrackLsb; #if HAVE_BIGENDIAN - uint8_t did_v : 1; - uint8_t dbc_v : 1; - uint8_t uru : 1; - uint8_t reserved2 : 5; + uint8_t m_didV : 1; + uint8_t m_dbcV : 1; + uint8_t m_uru : 1; + uint8_t m_reserved2 : 5; #else - uint8_t reserved2 : 5; - uint8_t uru : 1; - uint8_t dbc_v : 1; - uint8_t did_v : 1; + uint8_t m_reserved2 : 5; + uint8_t m_uru : 1; + uint8_t m_dbcV : 1; + uint8_t m_didV : 1; #endif - uint8_t disc_type; - uint8_t n_sessions_msb; - uint8_t first_track_msb; - uint8_t last_track_msb; - uint32_t disc_id; - uint32_t lead_in; - uint32_t lead_out; - uint8_t disc_bar_code[8]; - uint8_t reserved3; - uint8_t n_opc; + uint8_t m_discType; + uint8_t m_nSessionsMsb; + uint8_t m_firstTrackMsb; + uint8_t m_lastTrackMsb; + uint32_t m_discId; + uint32_t m_leadIn; + uint32_t m_leadOut; + uint8_t m_discBarCode[8]; + uint8_t m_reserved3; + uint8_t m_nOpc; } CDROMdiscInfo; enum CDROMdiscStatus @@ -208,7 +208,7 @@ bool MythCDROMLinux::hasWritableMedia() } CDROMdiscInfo *di = (CDROMdiscInfo *) buffer; - switch (di->disc_status) + switch (di->m_discStatus) { case MEDIA_IS_EMPTY: return true; @@ -218,7 +218,7 @@ bool MythCDROMLinux::hasWritableMedia() // writing, so we treat it just like a finished disc: case MEDIA_IS_COMPLETE: - return di->erasable; + return di->m_erasable; case MEDIA_IS_OTHER: ; @@ -255,22 +255,22 @@ int MythCDROMLinux::SCSIstatus() CDROMeventStatus *es = (CDROMeventStatus *) buffer; if ((ioctl(m_DeviceHandle, CDROM_SEND_PACKET, &cgc) < 0) - || es->nea // drive does not support request - || (es->notification_class != 0x4)) // notification class mismatch + || es->m_nea // drive does not support request + || (es->m_notificationClass != 0x4)) // notification class mismatch { LOG(VB_MEDIA, LOG_ERR, LOC + ":SCSIstatus() - failed to send SCSI packet to " + m_DevicePath + ENO); return CDS_TRAY_OPEN; } - if (es->media_present) + if (es->m_mediaPresent) { LOG(VB_MEDIA, LOG_DEBUG, LOC + ":SCSIstatus() - ioctl said tray was open, " "but drive is actually closed with a disc"); return CDS_DISC_OK; } - if (es->door_open) + if (es->m_doorOpen) { LOG(VB_MEDIA, LOG_DEBUG, LOC + ":SCSIstatus() - tray is definitely open"); diff --git a/mythtv/libs/libmythbase/mythcdrom.cpp b/mythtv/libs/libmythbase/mythcdrom.cpp index a9af0c31c6d..64663491f14 100644 --- a/mythtv/libs/libmythbase/mythcdrom.cpp +++ b/mythtv/libs/libmythbase/mythcdrom.cpp @@ -138,8 +138,8 @@ void MythCDROM::setDeviceSpeed(const char *devicePath, int speed) typedef struct { - udfread_block_input input; /* This *must* be the first entry in the struct */ - RemoteFile* file; + udfread_block_input m_input; /* This *must* be the first entry in the struct */ + RemoteFile* m_file; } blockInput_t; static int _def_close(udfread_block_input *p_gen) @@ -147,10 +147,10 @@ static int _def_close(udfread_block_input *p_gen) blockInput_t *p = (blockInput_t *)p_gen; int result = -1; - if (p && p->file) + if (p && p->m_file) { - delete p->file; - p->file = nullptr; + delete p->m_file; + p->m_file = nullptr; result = 0; } @@ -161,7 +161,7 @@ static uint32_t _def_size(udfread_block_input *p_gen) { blockInput_t *p = (blockInput_t *)p_gen; - return (uint32_t)(p->file->GetRealFileSize() / UDF_BLOCK_SIZE); + return (uint32_t)(p->m_file->GetRealFileSize() / UDF_BLOCK_SIZE); } static int _def_read(udfread_block_input *p_gen, uint32_t lba, void *buf, uint32_t nblocks, int flags) @@ -170,8 +170,8 @@ static int _def_read(udfread_block_input *p_gen, uint32_t lba, void *buf, uint32 int result = -1; blockInput_t *p = (blockInput_t *)p_gen; - if (p && p->file && (p->file->Seek(lba * UDF_BLOCK_SIZE, SEEK_SET) != -1)) - result = p->file->Read(buf, nblocks * UDF_BLOCK_SIZE) / UDF_BLOCK_SIZE; + if (p && p->m_file && (p->m_file->Seek(lba * UDF_BLOCK_SIZE, SEEK_SET) != -1)) + result = p->m_file->Read(buf, nblocks * UDF_BLOCK_SIZE) / UDF_BLOCK_SIZE; return result; } @@ -188,15 +188,15 @@ MythCDROM::ImageType MythCDROM::inspectImage(const QString &path) { blockInput_t blockInput; - blockInput.file = new RemoteFile(path); // Normally deleted via a call to udfread_close - blockInput.input.close = _def_close; - blockInput.input.read = _def_read; - blockInput.input.size = _def_size; + blockInput.m_file = new RemoteFile(path); // Normally deleted via a call to udfread_close + blockInput.m_input.close = _def_close; + blockInput.m_input.read = _def_read; + blockInput.m_input.size = _def_size; - if (blockInput.file->isOpen()) + if (blockInput.m_file->isOpen()) { udfread *udf = udfread_init(); - if (udfread_open_input(udf, &blockInput.input) == 0) + if (udfread_open_input(udf, &blockInput.m_input) == 0) { UDFDIR *dir = udfread_opendir(udf, "/BDMV"); @@ -230,13 +230,13 @@ MythCDROM::ImageType MythCDROM::inspectImage(const QString &path) else { // Open failed, so we have clean this up here - delete blockInput.file; + delete blockInput.m_file; } } else { LOG(VB_MEDIA, LOG_ERR, QString("inspectImage - unable to open \"%1\"").arg(path)); - delete blockInput.file; + delete blockInput.m_file; } } diff --git a/mythtv/libs/libmythbase/mythcorecontext.cpp b/mythtv/libs/libmythbase/mythcorecontext.cpp index f72e9ea058b..e4733a9df5e 100644 --- a/mythtv/libs/libmythbase/mythcorecontext.cpp +++ b/mythtv/libs/libmythbase/mythcorecontext.cpp @@ -64,8 +64,8 @@ class MythCoreContextPrivate : public QObject public: MythCoreContext *m_parent; - QObject *m_GUIcontext; - QObject *m_GUIobject; + QObject *m_guiContext; + QObject *m_guiObject; QString m_appBinaryVersion; QMutex m_localHostLock; ///< Locking for m_localHostname @@ -79,17 +79,17 @@ class MythCoreContextPrivate : public QObject MythSocket *m_serverSock; ///< socket for sending MythProto requests MythSocket *m_eventSock; ///< socket events arrive on - QMutex m_WOLInProgressLock; - QWaitCondition m_WOLInProgressWaitCondition; - bool m_WOLInProgress; - bool m_IsWOLAllowed; + QMutex m_wolInProgressLock; + QWaitCondition m_wolInProgressWaitCondition; + bool m_wolInProgress; + bool m_isWOLAllowed; bool m_backend; bool m_frontend; MythDB *m_database; - QThread *m_UIThread; + QThread *m_uiThread; MythLocale *m_locale; QString m_language; @@ -122,16 +122,16 @@ MythCoreContextPrivate::MythCoreContextPrivate(MythCoreContext *lparent, QString binversion, QObject *guicontext) : m_parent(lparent), - m_GUIcontext(guicontext), m_GUIobject(nullptr), + m_guiContext(guicontext), m_guiObject(nullptr), m_appBinaryVersion(std::move(binversion)), m_sockLock(QMutex::NonRecursive), m_serverSock(nullptr), m_eventSock(nullptr), - m_WOLInProgress(false), - m_IsWOLAllowed(true), + m_wolInProgress(false), + m_isWOLAllowed(true), m_backend(false), m_frontend(false), m_database(GetMythDB()), - m_UIThread(QThread::currentThread()), + m_uiThread(QThread::currentThread()), m_locale(nullptr), m_scheduler(nullptr), m_blockingClient(true), @@ -206,17 +206,17 @@ MythCoreContextPrivate::~MythCoreContextPrivate() bool MythCoreContextPrivate::WaitForWOL(int timeout_in_ms) { int timeout_remaining = timeout_in_ms; - while (m_WOLInProgress && (timeout_remaining > 0)) + while (m_wolInProgress && (timeout_remaining > 0)) { LOG(VB_GENERAL, LOG_INFO, LOC + "Wake-On-LAN in progress, waiting..."); int max_wait = min(1000, timeout_remaining); - m_WOLInProgressWaitCondition.wait( - &m_WOLInProgressLock, max_wait); + m_wolInProgressWaitCondition.wait( + &m_wolInProgressLock, max_wait); timeout_remaining -= max_wait; } - return !m_WOLInProgress; + return !m_wolInProgress; } MythCoreContext::MythCoreContext(const QString &binversion, @@ -404,7 +404,7 @@ bool MythCoreContext::ConnectToMasterServer(bool blockingClient, d->m_serverSock = nullptr; QCoreApplication::postEvent( - d->m_GUIcontext, new MythEvent("CONNECTION_FAILURE")); + d->m_guiContext, new MythEvent("CONNECTION_FAILURE")); return false; } @@ -420,7 +420,7 @@ MythSocket *MythCoreContext::ConnectCommandSocket( MythSocket *serverSock = nullptr; { - QMutexLocker locker(&d->m_WOLInProgressLock); + QMutexLocker locker(&d->m_wolInProgressLock); d->WaitForWOL(); } @@ -478,14 +478,14 @@ MythSocket *MythCoreContext::ConnectCommandSocket( { if (!we_attempted_wol) { - QMutexLocker locker(&d->m_WOLInProgressLock); - if (d->m_WOLInProgress) + QMutexLocker locker(&d->m_wolInProgressLock); + if (d->m_wolInProgress) { d->WaitForWOL(); continue; } - d->m_WOLInProgress = we_attempted_wol = true; + d->m_wolInProgress = we_attempted_wol = true; } MythWakeup(WOLcmd, kMSDontDisableDrawing | kMSDontBlockInputDevs | @@ -499,7 +499,7 @@ MythSocket *MythCoreContext::ConnectCommandSocket( if (cnt == 1) { QCoreApplication::postEvent( - d->m_GUIcontext, new MythEvent("CONNECTION_FAILURE")); + d->m_guiContext, new MythEvent("CONNECTION_FAILURE")); } if (sleepms) @@ -508,9 +508,9 @@ MythSocket *MythCoreContext::ConnectCommandSocket( if (we_attempted_wol) { - QMutexLocker locker(&d->m_WOLInProgressLock); - d->m_WOLInProgress = false; - d->m_WOLInProgressWaitCondition.wakeAll(); + QMutexLocker locker(&d->m_wolInProgressLock); + d->m_wolInProgress = false; + d->m_wolInProgressWaitCondition.wakeAll(); } if (!serverSock && !proto_mismatch) @@ -524,7 +524,7 @@ MythSocket *MythCoreContext::ConnectCommandSocket( else { QCoreApplication::postEvent( - d->m_GUIcontext, new MythEvent("CONNECTION_RESTABLISHED")); + d->m_guiContext, new MythEvent("CONNECTION_RESTABLISHED")); } return serverSock; @@ -616,12 +616,12 @@ bool MythCoreContext::IsBlockingClient(void) const void MythCoreContext::SetWOLAllowed(bool allow) { - d->m_IsWOLAllowed = allow; + d->m_isWOLAllowed = allow; } bool MythCoreContext::IsWOLAllowed() const { - return d->m_IsWOLAllowed; + return d->m_isWOLAllowed; } void MythCoreContext::SetAsBackend(bool backend) @@ -1247,7 +1247,7 @@ bool MythCoreContext::CheckSubnet(const QAbstractSocket *socket) bool MythCoreContext::CheckSubnet(const QHostAddress &peer) { - static const QHostAddress linklocal("fe80::"); + static const QHostAddress kLinkLocal("fe80::"); if (GetBoolSetting("AllowConnFromAll",false)) return true; if (d->m_approvedIps.contains(peer)) @@ -1261,7 +1261,7 @@ bool MythCoreContext::CheckSubnet(const QHostAddress &peer) } // allow all link-local - if (peer.isInSubnet(linklocal,10)) + if (peer.isInSubnet(kLinkLocal,10)) { d->m_approvedIps.append(peer); return true; @@ -1312,7 +1312,7 @@ void MythCoreContext::ClearOverrideSettingForSession(const QString &key) bool MythCoreContext::IsUIThread(void) { - return is_current_thread(d->m_UIThread); + return is_current_thread(d->m_uiThread); } /** @@ -1418,7 +1418,7 @@ bool MythCoreContext::SendReceiveStringList( LOG(VB_GENERAL, LOG_CRIT, LOC + QString("Reconnection to backend server failed")); - QCoreApplication::postEvent(d->m_GUIcontext, + QCoreApplication::postEvent(d->m_guiContext, new MythEvent("PERSISTENT_CONNECTION_FAILURE")); } } @@ -1650,11 +1650,11 @@ bool MythCoreContext::CheckProtoVersion(MythSocket *socket, uint timeout_ms, .arg(QString::fromUtf8(MYTH_PROTO_TOKEN)) .arg(strlist[1])); - if (error_dialog_desired && d->m_GUIcontext) + if (error_dialog_desired && d->m_guiContext) { QStringList list(strlist[1]); QCoreApplication::postEvent( - d->m_GUIcontext, new MythEvent("VERSION_MISMATCH", list)); + d->m_guiContext, new MythEvent("VERSION_MISMATCH", list)); } return false; @@ -1695,22 +1695,22 @@ void MythCoreContext::SetLocalHostname(const QString &hostname) void MythCoreContext::SetGUIObject(QObject *gui) { - d->m_GUIobject = gui; + d->m_guiObject = gui; } bool MythCoreContext::HasGUI(void) const { - return d->m_GUIobject; + return d->m_guiObject; } QObject *MythCoreContext::GetGUIObject(void) { - return d->m_GUIobject; + return d->m_guiObject; } QObject *MythCoreContext::GetGUIContext(void) { - return d->m_GUIcontext; + return d->m_guiContext; } MythDB *MythCoreContext::GetDB(void) diff --git a/mythtv/libs/libmythbase/mythcoreutil.cpp b/mythtv/libs/libmythbase/mythcoreutil.cpp index 275c1b72908..631a94f196c 100644 --- a/mythtv/libs/libmythbase/mythcoreutil.cpp +++ b/mythtv/libs/libmythbase/mythcoreutil.cpp @@ -171,8 +171,8 @@ QByteArray gzipCompress(const QByteArray& data) if (data.length() == 0) return QByteArray(); - static const int CHUNK_SIZE = 1024; - char out[CHUNK_SIZE]; + static constexpr int kChunkSize = 1024; + char out[kChunkSize]; // allocate inflate state z_stream strm; @@ -197,7 +197,7 @@ QByteArray gzipCompress(const QByteArray& data) // run deflate() do { - strm.avail_out = CHUNK_SIZE; + strm.avail_out = kChunkSize; strm.next_out = (Bytef*)(out); ret = deflate(&strm, Z_FINISH); @@ -213,7 +213,7 @@ QByteArray gzipCompress(const QByteArray& data) return QByteArray(); } - result.append(out, CHUNK_SIZE - strm.avail_out); + result.append(out, kChunkSize - strm.avail_out); } while (strm.avail_out == 0); @@ -229,8 +229,8 @@ QByteArray gzipUncompress(const QByteArray &data) if (data.length() == 0) return QByteArray(); - static const int CHUNK_SIZE = 1024; - char out[CHUNK_SIZE]; + static constexpr int kChunkSize = 1024; + char out[kChunkSize]; // allocate inflate state z_stream strm; @@ -250,7 +250,7 @@ QByteArray gzipUncompress(const QByteArray &data) do { - strm.avail_out = CHUNK_SIZE; + strm.avail_out = kChunkSize; strm.next_out = (Bytef*)out; ret = inflate(&strm, Z_NO_FLUSH); @@ -265,7 +265,7 @@ QByteArray gzipUncompress(const QByteArray &data) return QByteArray(); } - result.append(out, CHUNK_SIZE - strm.avail_out); + result.append(out, kChunkSize - strm.avail_out); } while (strm.avail_out == 0); diff --git a/mythtv/libs/libmythbase/mythdb.cpp b/mythtv/libs/libmythbase/mythdb.cpp index 2b7c95853a5..6548f16fe79 100644 --- a/mythtv/libs/libmythbase/mythdb.cpp +++ b/mythtv/libs/libmythbase/mythdb.cpp @@ -55,9 +55,9 @@ void DestroyMythDB(void) struct SingleSetting { - QString key; - QString value; - QString host; + QString m_key; + QString m_value; + QString m_host; }; typedef QHash SettingsMap; @@ -68,7 +68,7 @@ class MythDBPrivate MythDBPrivate(); ~MythDBPrivate(); - DatabaseParams m_DBparams; ///< Current database host & WOL details + DatabaseParams m_dbParams; ///< Current database host & WOL details QString m_localhostname; MDBManager m_dbmanager; @@ -198,12 +198,12 @@ QString MythDB::DBErrorMessage(const QSqlError& err) DatabaseParams MythDB::GetDatabaseParams(void) const { - return d->m_DBparams; + return d->m_dbParams; } void MythDB::SetDatabaseParams(const DatabaseParams ¶ms) { - d->m_DBparams = params; + d->m_dbParams = params; } void MythDB::SetLocalHostname(const QString &name) @@ -283,9 +283,9 @@ bool MythDB::SaveSettingOnHost(const QString &key, if (!d->m_suppressDBMessages) LOG(VB_GENERAL, LOG_ERR, loc + "- No database yet"); SingleSetting setting; - setting.host = host; - setting.key = key; - setting.value = newValue; + setting.m_host = host; + setting.m_key = key; + setting.m_value = newValue; d->m_delayedSettings.append(setting); return false; } @@ -906,7 +906,7 @@ void MythDB::WriteDelayedSettings(void) while (!d->m_delayedSettings.isEmpty()) { SingleSetting setting = d->m_delayedSettings.takeFirst(); - SaveSettingOnHost(setting.key, setting.value, setting.host); + SaveSettingOnHost(setting.m_key, setting.m_value, setting.m_host); } } diff --git a/mythtv/libs/libmythbase/mythdbcon.cpp b/mythtv/libs/libmythbase/mythdbcon.cpp index 393c2529961..d51d4c0d53c 100644 --- a/mythtv/libs/libmythbase/mythdbcon.cpp +++ b/mythtv/libs/libmythbase/mythdbcon.cpp @@ -914,14 +914,14 @@ void MSqlAddMoreBindings(MSqlBindings &output, MSqlBindings &addfrom) struct Holder { Holder( QString hldr = QString(), int pos = -1 ) - : holderName(std::move( hldr )), holderPos( pos ) {} + : m_holderName(std::move( hldr )), m_holderPos( pos ) {} bool operator==( const Holder& h ) const - { return h.holderPos == holderPos && h.holderName == holderName; } + { return h.m_holderPos == m_holderPos && h.m_holderName == m_holderName; } bool operator!=( const Holder& h ) const - { return h.holderPos != holderPos || h.holderName != holderName; } - QString holderName; - int holderPos; + { return h.m_holderPos != m_holderPos || h.m_holderName != m_holderName; } + QString m_holderName; + int m_holderPos; }; void MSqlEscapeAsAQuery(QString &query, MSqlBindings &bindings) @@ -946,7 +946,7 @@ void MSqlEscapeAsAQuery(QString &query, MSqlBindings &bindings) for (i = holders.count() - 1; i >= 0; --i) { - holder = holders[(uint)i].holderName; + holder = holders[(uint)i].m_holderName; val = bindings[holder]; QSqlField f("", val.type()); if (val.isNull()) @@ -954,7 +954,7 @@ void MSqlEscapeAsAQuery(QString &query, MSqlBindings &bindings) else f.setValue(val); - query = query.replace((uint)holders[(uint)i].holderPos, holder.length(), + query = query.replace((uint)holders[(uint)i].m_holderPos, holder.length(), result.driver()->formatValue(f)); } } diff --git a/mythtv/libs/libmythbase/mythdownloadmanager.cpp b/mythtv/libs/libmythbase/mythdownloadmanager.cpp index 70df7b4fed4..6123b521fa7 100644 --- a/mythtv/libs/libmythbase/mythdownloadmanager.cpp +++ b/mythtv/libs/libmythbase/mythdownloadmanager.cpp @@ -670,7 +670,7 @@ void MythDownloadManager::downloadQNetworkRequest(MythDownloadInfo *dlInfo) if (!dlInfo) return; - static const char dateFormat[] = "ddd, dd MMM yyyy hh:mm:ss 'GMT'"; + static constexpr char kDateFormat[] = "ddd, dd MMM yyyy hh:mm:ss 'GMT'"; QUrl qurl(dlInfo->m_url); QNetworkRequest request; @@ -725,7 +725,7 @@ void MythDownloadManager::downloadQNetworkRequest(MythDownloadInfo *dlInfo) if (!dateString.isNull()) { QDateTime loadDate = - MythDate::fromString(dateString, dateFormat); + MythDate::fromString(dateString, kDateFormat); loadDate.setTimeSpec(Qt::UTC); if (loadDate.secsTo(now) <= 720) { @@ -1219,7 +1219,7 @@ void MythDownloadManager::downloadFinished(MythDownloadInfo *dlInfo) return; int statusCode = -1; - static const char dateFormat[] = "ddd, dd MMM yyyy hh:mm:ss 'GMT'"; + static constexpr char kDateFormat[] = "ddd, dd MMM yyyy hh:mm:ss 'GMT'"; QNetworkReply *reply = dlInfo->m_reply; if (reply) @@ -1330,7 +1330,7 @@ void MythDownloadManager::downloadFinished(MythDownloadInfo *dlInfo) QNetworkCacheMetaData::RawHeader newheader; QDateTime now = MythDate::current(); newheader = QNetworkCacheMetaData::RawHeader("Date", - now.toString(dateFormat).toLatin1()); + now.toString(kDateFormat).toLatin1()); headers.append(newheader); urlData.setRawHeaders(headers); m_infoLock->lock(); @@ -1553,7 +1553,7 @@ QDateTime MythDownloadManager::GetLastModified(const QString &url) // the cache object is less than 20 minutes old, // then use the cached header otherwise redownload the header - static const char dateFormat[] = "ddd, dd MMM yyyy hh:mm:ss 'GMT'"; + static constexpr char kDateFormat[] = "ddd, dd MMM yyyy hh:mm:ss 'GMT'"; LOG(VB_FILE, LOG_DEBUG, LOC + QString("GetLastModified('%1')").arg(url)); QDateTime result; @@ -1595,7 +1595,7 @@ QDateTime MythDownloadManager::GetLastModified(const QString &url) if (!date.isNull()) { QDateTime loadDate = - MythDate::fromString(date, dateFormat); + MythDate::fromString(date, kDateFormat); loadDate.setTimeSpec(Qt::UTC); if (loadDate.secsTo(now) <= 1200) // 20 Minutes { diff --git a/mythtv/libs/libmythbase/mythmiscutil.cpp b/mythtv/libs/libmythbase/mythmiscutil.cpp index 87b560c7f04..f917c3f2b46 100644 --- a/mythtv/libs/libmythbase/mythmiscutil.cpp +++ b/mythtv/libs/libmythbase/mythmiscutil.cpp @@ -981,26 +981,26 @@ void wrapList(QStringList &list, int width) QString xml_indent(uint level) { - static QReadWriteLock rw_lock; - static QMap cache; + static QReadWriteLock s_rwLock; + static QMap s_cache; - rw_lock.lockForRead(); - QMap::const_iterator it = cache.find(level); - if (it != cache.end()) + s_rwLock.lockForRead(); + QMap::const_iterator it = s_cache.find(level); + if (it != s_cache.end()) { QString tmp = *it; - rw_lock.unlock(); + s_rwLock.unlock(); return tmp; } - rw_lock.unlock(); + s_rwLock.unlock(); QString ret = ""; for (uint i = 0; i < level; i++) ret += " "; - rw_lock.lockForWrite(); - cache[level] = ret; - rw_lock.unlock(); + s_rwLock.lockForWrite(); + s_cache[level] = ret; + s_rwLock.unlock(); return ret; } diff --git a/mythtv/libs/libmythbase/mythsystemunix.cpp b/mythtv/libs/libmythbase/mythsystemunix.cpp index 8351e82c522..52fba200baa 100644 --- a/mythtv/libs/libmythbase/mythsystemunix.cpp +++ b/mythtv/libs/libmythbase/mythsystemunix.cpp @@ -45,8 +45,8 @@ if( (x) >= 0 ) { \ typedef struct { - MythSystemLegacyUnix *ms; - int type; + MythSystemLegacyUnix *m_ms; + int m_type; } FDType_t; typedef QMap FDMap_t; @@ -165,8 +165,8 @@ void MythSystemLegacyIOHandler::HandleRead(int fd, QBuffer *buff) fdLock.unlock(); // Emit the data ready signal (1 = stdout, 2 = stderr) - MythSystemLegacyUnix *ms = fdType->ms; - emit ms->readDataReady(fdType->type); + MythSystemLegacyUnix *ms = fdType->m_ms; + emit ms->readDataReady(fdType->m_type); } } @@ -451,8 +451,8 @@ void MythSystemLegacyManager::append(MythSystemLegacyUnix *ms) if( ms->GetSetting("UseStdout") ) { FDType_t *fdType = new FDType_t; - fdType->ms = ms; - fdType->type = 1; + fdType->m_ms = ms; + fdType->m_type = 1; fdLock.lock(); fdMap.insert( ms->m_stdpipe[1], fdType ); fdLock.unlock(); @@ -462,8 +462,8 @@ void MythSystemLegacyManager::append(MythSystemLegacyUnix *ms) if( ms->GetSetting("UseStderr") ) { FDType_t *fdType = new FDType_t; - fdType->ms = ms; - fdType->type = 2; + fdType->m_ms = ms; + fdType->m_type = 2; fdLock.lock(); fdMap.insert( ms->m_stdpipe[2], fdType ); fdLock.unlock(); diff --git a/mythtv/libs/libmythbase/serverpool.cpp b/mythtv/libs/libmythbase/serverpool.cpp index 0e580747d66..41abd46a649 100644 --- a/mythtv/libs/libmythbase/serverpool.cpp +++ b/mythtv/libs/libmythbase/serverpool.cpp @@ -161,12 +161,12 @@ void ServerPool::SelectDefaultListen(bool force) // IPv4 address is not defined, populate one // restrict autoconfiguration to RFC1918 private networks static QPair - privNet1 = QHostAddress::parseSubnet("10.0.0.0/8"), - privNet2 = QHostAddress::parseSubnet("172.16.0.0/12"), - privNet3 = QHostAddress::parseSubnet("192.168.0.0/16"); + s_privNet1 = QHostAddress::parseSubnet("10.0.0.0/8"), + s_privNet2 = QHostAddress::parseSubnet("172.16.0.0/12"), + s_privNet3 = QHostAddress::parseSubnet("192.168.0.0/16"); - if (ip.isInSubnet(privNet1) || ip.isInSubnet(privNet2) || - ip.isInSubnet(privNet3)) + if (ip.isInSubnet(s_privNet1) || ip.isInSubnet(s_privNet2) || + ip.isInSubnet(s_privNet3)) { LOG(VB_GENERAL, LOG_DEBUG, QString("Adding '%1' to address list.") diff --git a/mythtv/libs/libmythbase/signalhandling.cpp b/mythtv/libs/libmythbase/signalhandling.cpp index 98e8f07caf1..7f1d4771c3a 100644 --- a/mythtv/libs/libmythbase/signalhandling.cpp +++ b/mythtv/libs/libmythbase/signalhandling.cpp @@ -195,11 +195,11 @@ void SignalHandler::SetHandlerPrivate(int signum, SigHandlerFunc handler) } typedef struct { - int signum; - int code; - int pid; - int uid; - uint64_t value; + int m_signum; + int m_code; + int m_pid; + int m_uid; + uint64_t m_value; } SignalInfo; void SignalHandler::signalHandler(int signum, siginfo_t *info, void *context) @@ -207,18 +207,18 @@ void SignalHandler::signalHandler(int signum, siginfo_t *info, void *context) SignalInfo signalInfo; (void)context; - signalInfo.signum = signum; + signalInfo.m_signum = signum; #ifdef _WIN32 (void)info; - signalInfo.code = 0; - signalInfo.pid = 0; - signalInfo.uid = 0; - signalInfo.value = 0; + signalInfo.m_code = 0; + signalInfo.m_pid = 0; + signalInfo.m_uid = 0; + signalInfo.m_value = 0; #else - signalInfo.code = (info ? info->si_code : 0); - signalInfo.pid = (info ? (int)info->si_pid : 0); - signalInfo.uid = (info ? (int)info->si_uid : 0); - signalInfo.value = (info ? *(uint64_t *)&info->si_value : 0); + signalInfo.m_code = (info ? info->si_code : 0); + signalInfo.m_pid = (info ? (int)info->si_pid : 0); + signalInfo.m_uid = (info ? (int)info->si_uid : 0); + signalInfo.m_value = (info ? *(uint64_t *)&info->si_value : 0); #endif // Keep trying if there's no room to write, but stop on error (-1) @@ -292,7 +292,7 @@ void SignalHandler::handleSignal(void) SignalInfo signalInfo; int ret = ::read(s_sigFd[1], &signalInfo, sizeof(SignalInfo)); bool infoComplete = (ret == sizeof(SignalInfo)); - int signum = (infoComplete ? signalInfo.signum : 0); + int signum = (infoComplete ? signalInfo.m_signum : 0); if (infoComplete) { @@ -300,8 +300,8 @@ void SignalHandler::handleSignal(void) signame = strdup(signame ? signame : "Unknown Signal"); LOG(VB_GENERAL, LOG_CRIT, QString("Received %1: Code %2, PID %3, UID %4, Value 0x%5") - .arg(signame) .arg(signalInfo.code) .arg(signalInfo.pid) - .arg(signalInfo.uid) .arg(signalInfo.value,8,16,QChar('0'))); + .arg(signame) .arg(signalInfo.m_code) .arg(signalInfo.m_pid) + .arg(signalInfo.m_uid) .arg(signalInfo.m_value,8,16,QChar('0'))); free(signame); } diff --git a/mythtv/libs/libmythfreemheg/ParseText.cpp b/mythtv/libs/libmythfreemheg/ParseText.cpp index 2dcbda99e41..d4b82cd205e 100644 --- a/mythtv/libs/libmythfreemheg/ParseText.cpp +++ b/mythtv/libs/libmythfreemheg/ParseText.cpp @@ -325,8 +325,8 @@ const char *rchTagNames[] = // Some example programs use these colour names static struct { - const char *name; - unsigned char r, g, b, t; + const char *m_name; + unsigned char m_r, m_g, m_b, m_t; } colourTable[] = { { "black", 0, 0, 0, 0 }, @@ -782,7 +782,7 @@ void MHParseText::NextSym() // Check the colour table. If it's there generate a string containing the colour info. for (int i = 0; i < (int)(sizeof(colourTable) / sizeof(colourTable[0])); i++) { - if (stricmp(buff, colourTable[i].name) == 0) + if (stricmp(buff, colourTable[i].m_name) == 0) { m_nType = PTString; unsigned char *str = (unsigned char *)realloc(m_String, 4 + 1); @@ -793,10 +793,10 @@ void MHParseText::NextSym() } m_String = str; - m_String[0] = colourTable[i].r; - m_String[1] = colourTable[i].g; - m_String[2] = colourTable[i].b; - m_String[3] = colourTable[i].t; + m_String[0] = colourTable[i].m_r; + m_String[1] = colourTable[i].m_g; + m_String[2] = colourTable[i].m_b; + m_String[3] = colourTable[i].m_t; m_nStringLength = 4; m_String[m_nStringLength] = 0; return; diff --git a/mythtv/libs/libmythfreemheg/Text.cpp b/mythtv/libs/libmythfreemheg/Text.cpp index 7f1bddb4082..b15dbed0586 100644 --- a/mythtv/libs/libmythfreemheg/Text.cpp +++ b/mythtv/libs/libmythfreemheg/Text.cpp @@ -470,12 +470,12 @@ class MHTextItem { public: MHTextItem(); - MHOctetString m_Text; // UTF-8 text - QString m_Unicode; // Unicode text - int m_nUnicode; // Number of characters in it - int m_Width; // Size of this block - MHRgba m_Colour; // Colour of the text - int m_nTabCount; // Number of tabs immediately before this (usually zero) + MHOctetString m_text; // UTF-8 text + QString m_unicode; // Unicode text + int m_nUnicode; // Number of characters in it + int m_width; // Size of this block + MHRgba m_colour; // Colour of the text + int m_nTabCount; // Number of tabs immediately before this (usually zero) // Generate new items inheriting properties from the previous MHTextItem *NewItem(); @@ -484,15 +484,15 @@ class MHTextItem MHTextItem::MHTextItem() { m_nUnicode = 0; - m_Width = 0; // Size of this block - m_Colour = MHRgba(0, 0, 0, 255); + m_width = 0; // Size of this block + m_colour = MHRgba(0, 0, 0, 255); m_nTabCount = 0; } MHTextItem *MHTextItem::NewItem() { MHTextItem *pItem = new MHTextItem; - pItem->m_Colour = m_Colour; + pItem->m_colour = m_colour; return pItem; } @@ -502,7 +502,7 @@ class MHTextLine public: MHTextLine() = default; ~MHTextLine(); - MHSequence m_Items; + MHSequence m_items; int m_nLineWidth {0}; int m_nLineHeight {0}; int m_nDescent {0}; @@ -510,9 +510,9 @@ class MHTextLine MHTextLine::~MHTextLine() { - for (int i = 0; i < m_Items.Size(); i++) + for (int i = 0; i < m_items.Size(); i++) { - delete(m_Items.GetAt(i)); + delete(m_items.GetAt(i)); } } @@ -557,11 +557,11 @@ void MHText::Redraw() // Set up the first item on the first line. MHTextItem *pCurrItem = new MHTextItem; MHTextLine *pCurrLine = new MHTextLine; - pCurrLine->m_Items.Append(pCurrItem); + pCurrLine->m_items.Append(pCurrItem); theText.Append(pCurrLine); - MHStack m_ColourStack; // Stack to handle nested colour codes. - m_ColourStack.Push(textColour); - pCurrItem->m_Colour = textColour; + MHStack colourStack; // Stack to handle nested colour codes. + colourStack.Push(textColour); + pCurrItem->m_colour = textColour; // FILE *fd=stdout; fprintf(fd, "Redraw Text "); m_Content.PrintMe(fd, 0); fprintf(fd, "\n"); int i = 0; @@ -572,10 +572,10 @@ void MHText::Redraw() if (ch == 0x09) // Tab - start a new item if we have any text in the existing one. { - if (pCurrItem->m_Text.Size() != 0) + if (pCurrItem->m_text.Size() != 0) { pCurrItem = pCurrItem->NewItem(); - pCurrLine->m_Items.Append(pCurrItem); + pCurrLine->m_items.Append(pCurrItem); } if (m_HorizJ == Start) pCurrItem->m_nTabCount++; @@ -588,7 +588,7 @@ void MHText::Redraw() pCurrLine = new MHTextLine; theText.Append(pCurrLine); pCurrItem = pCurrItem->NewItem(); - pCurrLine->m_Items.Append(pCurrItem); + pCurrLine->m_items.Append(pCurrItem); } else if (ch == 0x1b) // Escape - special codes. @@ -616,16 +616,16 @@ void MHText::Redraw() if (code == 0x43 && paramCount == 4 && i + paramCount <= m_Content.Size()) { // Start of colour. - if (pCurrItem->m_Text.Size() != 0) + if (pCurrItem->m_text.Size() != 0) { pCurrItem = pCurrItem->NewItem(); - pCurrLine->m_Items.Append(pCurrItem); + pCurrLine->m_items.Append(pCurrItem); } - pCurrItem->m_Colour = MHRgba(m_Content.GetAt(i), m_Content.GetAt(i + 1), + pCurrItem->m_colour = MHRgba(m_Content.GetAt(i), m_Content.GetAt(i + 1), m_Content.GetAt(i + 2), 255 - m_Content.GetAt(i + 3)); // Push this colour onto the colour stack. - m_ColourStack.Push(pCurrItem->m_Colour); + colourStack.Push(pCurrItem->m_colour); } else { @@ -640,19 +640,19 @@ void MHText::Redraw() if (code == 0x63) { - if (m_ColourStack.Size() > 1) + if (colourStack.Size() > 1) { - m_ColourStack.Pop(); + colourStack.Pop(); // Start a new item since we're using a new colour. - if (pCurrItem->m_Text.Size() != 0) + if (pCurrItem->m_text.Size() != 0) { pCurrItem = pCurrItem->NewItem(); - pCurrLine->m_Items.Append(pCurrItem); + pCurrLine->m_items.Append(pCurrItem); } // Set the subsequent text in the colour we're using now. - pCurrItem->m_Colour = m_ColourStack.Top(); + pCurrItem->m_colour = colourStack.Top(); } } else MHLOG(MHLogWarning, QString("Unknown text escape code 0x%1").arg(code,2,16)); @@ -675,7 +675,7 @@ void MHText::Redraw() i++; } - pCurrItem->m_Text.Append(MHOctetString(m_Content, nStart, i - nStart)); + pCurrItem->m_text.Append(MHOctetString(m_Content, nStart, i - nStart)); } } @@ -691,30 +691,30 @@ void MHText::Redraw() MHTextLine *pLine = theText.GetAt(i); pLine->m_nLineWidth = 0; - for (int j = 0; j < pLine->m_Items.Size(); j++) + for (int j = 0; j < pLine->m_items.Size(); j++) { - MHTextItem *pItem = pLine->m_Items.GetAt(j); + MHTextItem *pItem = pLine->m_items.GetAt(j); // Set any tabs. pLine->m_nLineWidth = Tabs(pLine->m_nLineWidth, pItem->m_nTabCount); - if (pItem->m_Unicode.isEmpty()) // Convert UTF-8 to Unicode. + if (pItem->m_unicode.isEmpty()) // Convert UTF-8 to Unicode. { - int s = pItem->m_Text.Size(); - pItem->m_Unicode = QString::fromUtf8((const char *)pItem->m_Text.Bytes(), s); - pItem->m_nUnicode = pItem->m_Unicode.length(); + int s = pItem->m_text.Size(); + pItem->m_unicode = QString::fromUtf8((const char *)pItem->m_text.Bytes(), s); + pItem->m_nUnicode = pItem->m_unicode.length(); } // Fit the text onto the line. int nFullText = pItem->m_nUnicode; // Get the box size and update pItem->m_nUnicode to the number that will fit. - QRect rect = m_pDisplay->GetBounds(pItem->m_Unicode, pItem->m_nUnicode, m_nBoxWidth - pLine->m_nLineWidth); + QRect rect = m_pDisplay->GetBounds(pItem->m_unicode, pItem->m_nUnicode, m_nBoxWidth - pLine->m_nLineWidth); if (nFullText != pItem->m_nUnicode && m_fTextWrap) // Doesn't fit, we have to word-wrap. { int nTruncated = pItem->m_nUnicode; // Just in case. // Now remove characters until we find a word-break character. - while (pItem->m_nUnicode > 0 && pItem->m_Unicode[pItem->m_nUnicode] != ' ') + while (pItem->m_nUnicode > 0 && pItem->m_unicode[pItem->m_nUnicode] != ' ') { pItem->m_nUnicode--; } @@ -736,7 +736,7 @@ void MHText::Redraw() int nNewStart = pItem->m_nUnicode; // Remove any spaces at the start of the new section. - while (nNewWidth != 0 && pItem->m_Unicode[nNewStart] == ' ') + while (nNewWidth != 0 && pItem->m_unicode[nNewStart] == ' ') { nNewStart++; nNewWidth--; @@ -749,29 +749,29 @@ void MHText::Redraw() theText.InsertAt(pNewLine, i + 1); // The first item on the new line is the rest of the text. MHTextItem *pNewItem = pItem->NewItem(); - pNewLine->m_Items.Append(pNewItem); - pNewItem->m_Unicode = pItem->m_Unicode.mid(nNewStart, nNewWidth); + pNewLine->m_items.Append(pNewItem); + pNewItem->m_unicode = pItem->m_unicode.mid(nNewStart, nNewWidth); pNewItem->m_nUnicode = nNewWidth; // Move any remaining items, e.g. in a different colour, from this line onto the new line. - while (pLine->m_Items.Size() > j + 1) + while (pLine->m_items.Size() > j + 1) { - pNewLine->m_Items.Append(pLine->m_Items.GetAt(j + 1)); - pLine->m_Items.RemoveAt(j + 1); + pNewLine->m_items.Append(pLine->m_items.GetAt(j + 1)); + pLine->m_items.RemoveAt(j + 1); } } // Remove any spaces at the end of the old section. If we don't do that and // we are centering or right aligning the text we'll get it wrong. - while (pItem->m_nUnicode > 1 && pItem->m_Unicode[pItem->m_nUnicode-1] == ' ') + while (pItem->m_nUnicode > 1 && pItem->m_unicode[pItem->m_nUnicode-1] == ' ') { pItem->m_nUnicode--; } - rect = m_pDisplay->GetBounds(pItem->m_Unicode, pItem->m_nUnicode); + rect = m_pDisplay->GetBounds(pItem->m_unicode, pItem->m_nUnicode); } - pItem->m_Width = rect.width(); + pItem->m_width = rect.width(); pLine->m_nLineWidth += rect.width(); if (rect.height() > pLine->m_nLineHeight) @@ -823,20 +823,20 @@ void MHText::Redraw() xOffset = (m_nBoxWidth - pLine->m_nLineWidth) / 2; } - for (int j = 0; j < pLine->m_Items.Size(); j++) + for (int j = 0; j < pLine->m_items.Size(); j++) { - MHTextItem *pItem = pLine->m_Items.GetAt(j); + MHTextItem *pItem = pLine->m_items.GetAt(j); // Tab across if necessary. xOffset = Tabs(xOffset, pItem->m_nTabCount); - if (! pItem->m_Unicode.isEmpty()) // We may have blank lines. + if (! pItem->m_unicode.isEmpty()) // We may have blank lines. { m_pDisplay->AddText(xOffset, yOffset + (pLine->m_nLineHeight + lineSpace) / 2 - pLine->m_nDescent, - pItem->m_Unicode.left(pItem->m_nUnicode), pItem->m_Colour); + pItem->m_unicode.left(pItem->m_nUnicode), pItem->m_colour); } - xOffset += pItem->m_Width; + xOffset += pItem->m_width; } yOffset += lineSpace; diff --git a/mythtv/libs/libmythfreesurround/el_processor.cpp b/mythtv/libs/libmythfreesurround/el_processor.cpp index 91dffd02f4f..171870b8137 100644 --- a/mythtv/libs/libmythfreesurround/el_processor.cpp +++ b/mythtv/libs/libmythfreesurround/el_processor.cpp @@ -48,55 +48,55 @@ class decoder_impl { public: // create an instance of the decoder // blocksize is fixed over the lifetime of this object for performance reasons - decoder_impl(unsigned blocksize=8192): N(blocksize), halfN(blocksize/2) { + decoder_impl(unsigned blocksize=8192): m_n(blocksize), m_halfN(blocksize/2) { #ifdef USE_FFTW3 // create FFTW buffers - lt = (float*)fftwf_malloc(sizeof(float)*N); - rt = (float*)fftwf_malloc(sizeof(float)*N); - dst = (float*)fftwf_malloc(sizeof(float)*N); - dftL = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex)*N); - dftR = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex)*N); - src = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex)*N); - loadL = fftwf_plan_dft_r2c_1d(N, lt, dftL,FFTW_MEASURE); - loadR = fftwf_plan_dft_r2c_1d(N, rt, dftR,FFTW_MEASURE); - store = fftwf_plan_dft_c2r_1d(N, src, dst,FFTW_MEASURE); + m_lt = (float*)fftwf_malloc(sizeof(float)*m_n); + m_rt = (float*)fftwf_malloc(sizeof(float)*m_n); + m_dst = (float*)fftwf_malloc(sizeof(float)*m_n); + m_dftL = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex)*m_n); + m_dftR = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex)*m_n); + m_src = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex)*m_n); + m_loadL = fftwf_plan_dft_r2c_1d(m_n, m_lt, m_dftL,FFTW_MEASURE); + m_loadR = fftwf_plan_dft_r2c_1d(m_n, m_rt, m_dftR,FFTW_MEASURE); + m_store = fftwf_plan_dft_c2r_1d(m_n, m_src, m_dst,FFTW_MEASURE); #else // create lavc fft buffers - lt = (float*)av_malloc(sizeof(FFTSample)*N); - rt = (float*)av_malloc(sizeof(FFTSample)*N); - dftL = (FFTComplexArray*)av_malloc(sizeof(FFTComplex)*N*2); - dftR = (FFTComplexArray*)av_malloc(sizeof(FFTComplex)*N*2); - src = (FFTComplexArray*)av_malloc(sizeof(FFTComplex)*N*2); - fftContextForward = (FFTContext*)av_malloc(sizeof(FFTContext)); - memset(fftContextForward, 0, sizeof(FFTContext)); - fftContextReverse = (FFTContext*)av_malloc(sizeof(FFTContext)); - memset(fftContextReverse, 0, sizeof(FFTContext)); - ff_fft_init(fftContextForward, 13, 0); - ff_fft_init(fftContextReverse, 13, 1); + m_lt = (float*)av_malloc(sizeof(FFTSample)*m_n); + m_rt = (float*)av_malloc(sizeof(FFTSample)*m_n); + m_dftL = (FFTComplexArray*)av_malloc(sizeof(FFTComplex)*m_n*2); + m_dftR = (FFTComplexArray*)av_malloc(sizeof(FFTComplex)*m_n*2); + m_src = (FFTComplexArray*)av_malloc(sizeof(FFTComplex)*m_n*2); + m_fftContextForward = (FFTContext*)av_malloc(sizeof(FFTContext)); + memset(m_fftContextForward, 0, sizeof(FFTContext)); + m_fftContextReverse = (FFTContext*)av_malloc(sizeof(FFTContext)); + memset(m_fftContextReverse, 0, sizeof(FFTContext)); + ff_fft_init(m_fftContextForward, 13, 0); + ff_fft_init(m_fftContextReverse, 13, 1); #endif // resize our own buffers - frontR.resize(N); - frontL.resize(N); - avg.resize(N); - surR.resize(N); - surL.resize(N); - trueavg.resize(N); - xfs.resize(N); - yfs.resize(N); - inbuf[0].resize(N); - inbuf[1].resize(N); + m_frontR.resize(m_n); + m_frontL.resize(m_n); + m_avg.resize(m_n); + m_surR.resize(m_n); + m_surL.resize(m_n); + m_trueavg.resize(m_n); + m_xFs.resize(m_n); + m_yFs.resize(m_n); + m_inbuf[0].resize(m_n); + m_inbuf[1].resize(m_n); for (unsigned c=0;c<6;c++) { - outbuf[c].resize(N); - filter[c].resize(N); + m_outbuf[c].resize(m_n); + m_filter[c].resize(m_n); } sample_rate(48000); // generate the window function (square root of hann, b/c it is applied before and after the transform) - wnd.resize(N); - for (unsigned k=0;k PI) phaseDiff -= 2*PI; phaseDiff = abs(phaseDiff); - if (linear_steering) { + if (m_linearSteering) { // --- this is the fancy new linear mode --- // get sound field x/y position - yfs[f] = get_yfs(ampDiff,phaseDiff); - xfs[f] = get_xfs(ampDiff,yfs[f]); + m_yFs[f] = get_yfs(ampDiff,phaseDiff); + m_xFs[f] = get_xfs(ampDiff,m_yFs[f]); // add dimension control - yfs[f] = clamp(yfs[f] - dimension); + m_yFs[f] = clamp(m_yFs[f] - dimension); // add crossfeed control - xfs[f] = clamp(xfs[f] * (front_separation*(1+yfs[f])/2 + rear_separation*(1-yfs[f])/2)); + m_xFs[f] = clamp(m_xFs[f] * (m_frontSeparation*(1+m_yFs[f])/2 + m_rearSeparation*(1-m_yFs[f])/2)); // 3. generate frequency filters for each output channel - float left = (1-xfs[f])/2, right = (1+xfs[f])/2; - float front = (1+yfs[f])/2, back = (1-yfs[f])/2; + float left = (1-m_xFs[f])/2, right = (1+m_xFs[f])/2; + float front = (1+m_yFs[f])/2, back = (1-m_yFs[f])/2; float volume[5] = { - front * (left * center_width + max(0,-xfs[f]) * (1-center_width)), // left - front * center_level*((1-abs(xfs[f])) * (1-center_width)), // center - front * (right * center_width + max(0, xfs[f]) * (1-center_width)), // right - back * surround_level * left, // left surround - back * surround_level * right // right surround + front * (left * center_width + max(0,-m_xFs[f]) * (1-center_width)), // left + front * center_level*((1-abs(m_xFs[f])) * (1-center_width)), // center + front * (right * center_width + max(0, m_xFs[f]) * (1-center_width)), // right + back * m_surroundLevel * left, // left surround + back * m_surroundLevel * right // right surround }; // adapt the prior filter for (unsigned c=0;c<5;c++) - filter[c][f] = (1-adaption_rate)*filter[c][f] + adaption_rate*volume[c]; + m_filter[c][f] = (1-adaption_rate)*m_filter[c][f] + adaption_rate*volume[c]; } else { // --- this is the old & simple steering mode --- @@ -322,57 +322,57 @@ class decoder_impl { phaseDiff = abs(phaseDiff); // determine sound field x-position - xfs[f] = ampDiff; + m_xFs[f] = ampDiff; // determine preliminary sound field y-position from phase difference - yfs[f] = 1 - (phaseDiff/PI)*2; + m_yFs[f] = 1 - (phaseDiff/PI)*2; - if (abs(xfs[f]) > surround_balance) { + if (abs(m_xFs[f]) > m_surroundBalance) { // blend linearly between the surrounds and the fronts if the balance exceeds the surround encoding balance // this is necessary because the sound field is trapezoidal and will be stretched behind the listener - float frontness = (abs(xfs[f]) - surround_balance)/(1-surround_balance); - yfs[f] = (1-frontness) * yfs[f] + frontness * 1; + float frontness = (abs(m_xFs[f]) - m_surroundBalance)/(1-m_surroundBalance); + m_yFs[f] = (1-frontness) * m_yFs[f] + frontness * 1; } // add dimension control - yfs[f] = clamp(yfs[f] - dimension); + m_yFs[f] = clamp(m_yFs[f] - dimension); // add crossfeed control - xfs[f] = clamp(xfs[f] * (front_separation*(1+yfs[f])/2 + rear_separation*(1-yfs[f])/2)); + m_xFs[f] = clamp(m_xFs[f] * (m_frontSeparation*(1+m_yFs[f])/2 + m_rearSeparation*(1-m_yFs[f])/2)); // 3. generate frequency filters for each output channel, according to the signal position // the sum of all channel volumes must be 1.0 - float left = (1-xfs[f])/2, right = (1+xfs[f])/2; - float front = (1+yfs[f])/2, back = (1-yfs[f])/2; + float left = (1-m_xFs[f])/2, right = (1+m_xFs[f])/2; + float front = (1+m_yFs[f])/2, back = (1-m_yFs[f])/2; float volume[5] = { - front * (left * center_width + max(0,-xfs[f]) * (1-center_width)), // left - front * center_level*((1-abs(xfs[f])) * (1-center_width)), // center - front * (right * center_width + max(0, xfs[f]) * (1-center_width)), // right - back * surround_level*max(0,min(1,((1-(xfs[f]/surround_balance))/2))), // left surround - back * surround_level*max(0,min(1,((1+(xfs[f]/surround_balance))/2))) // right surround + front * (left * center_width + max(0,-m_xFs[f]) * (1-center_width)), // left + front * center_level*((1-abs(m_xFs[f])) * (1-center_width)), // center + front * (right * center_width + max(0, m_xFs[f]) * (1-center_width)), // right + back * m_surroundLevel*max(0,min(1,((1-(m_xFs[f]/m_surroundBalance))/2))),// left surround + back * m_surroundLevel*max(0,min(1,((1+(m_xFs[f]/m_surroundBalance))/2))) // right surround }; // adapt the prior filter for (unsigned c=0;c<5;c++) - filter[c][f] = (1-adaption_rate)*filter[c][f] + adaption_rate*volume[c]; + m_filter[c][f] = (1-adaption_rate)*m_filter[c][f] + adaption_rate*volume[c]; } // ... and build the signal which we want to position - frontL[f] = polar(ampL+ampR,phaseL); - frontR[f] = polar(ampL+ampR,phaseR); - avg[f] = frontL[f] + frontR[f]; - surL[f] = polar(ampL+ampR,phaseL+phase_offsetL); - surR[f] = polar(ampL+ampR,phaseR+phase_offsetR); - trueavg[f] = cfloat(dftL[f][0] + dftR[f][0], dftL[f][1] + dftR[f][1]); + m_frontL[f] = polar(ampL+ampR,phaseL); + m_frontR[f] = polar(ampL+ampR,phaseR); + m_avg[f] = m_frontL[f] + m_frontR[f]; + m_surL[f] = polar(ampL+ampR,phaseL+m_phaseOffsetL); + m_surR[f] = polar(ampL+ampR,phaseR+m_phaseOffsetR); + m_trueavg[f] = cfloat(m_dftL[f][0] + m_dftR[f][0], m_dftL[f][1] + m_dftR[f][1]); } // 4. distribute the unfiltered reference signals over the channels - apply_filter(&frontL[0],&filter[0][0],&output[0][0]); // front left - apply_filter(&avg[0], &filter[1][0],&output[1][0]); // front center - apply_filter(&frontR[0],&filter[2][0],&output[2][0]); // front right - apply_filter(&surL[0],&filter[3][0],&output[3][0]); // surround left - apply_filter(&surR[0],&filter[4][0],&output[4][0]); // surround right - apply_filter(&trueavg[0],&filter[5][0],&output[5][0]); // lfe + apply_filter(&m_frontL[0], &m_filter[0][0],&output[0][0]); // front left + apply_filter(&m_avg[0], &m_filter[1][0],&output[1][0]); // front center + apply_filter(&m_frontR[0], &m_filter[2][0],&output[2][0]); // front right + apply_filter(&m_surL[0], &m_filter[3][0],&output[3][0]); // surround left + apply_filter(&m_surR[0], &m_filter[4][0],&output[4][0]); // surround right + apply_filter(&m_trueavg[0],&m_filter[5][0],&output[5][0]); // lfe } #define FASTER_CALC @@ -426,22 +426,22 @@ class decoder_impl { // filter the complex source signal and add it to target void apply_filter(cfloat *signal, const float *flt, float *target) { // filter the signal - for (unsigned f=0;f<=halfN;f++) { - src[f][0] = signal[f].real() * flt[f]; - src[f][1] = signal[f].imag() * flt[f]; + for (unsigned f=0;f<=m_halfN;f++) { + m_src[f][0] = signal[f].real() * flt[f]; + m_src[f][1] = signal[f].imag() * flt[f]; } #ifdef USE_FFTW3 // transform into time domain - fftwf_execute(store); - - float* pT1 = &target[current_buf*halfN]; - float* pWnd1 = &wnd[0]; - float* pDst1 = &dst[0]; - float* pT2 = &target[(current_buf^1)*halfN]; - float* pWnd2 = &wnd[halfN]; - float* pDst2 = &dst[halfN]; + fftwf_execute(m_store); + + float* pT1 = &target[m_currentBuf*m_halfN]; + float* pWnd1 = &m_wnd[0]; + float* pDst1 = &m_dst[0]; + float* pT2 = &target[(m_currentBuf^1)*m_halfN]; + float* pWnd2 = &m_wnd[m_halfN]; + float* pDst2 = &m_dst[m_halfN]; // add the result to target, windowed - for (unsigned int k=0;k frontL,frontR,avg,surL,surR; // the signal (phase-corrected) in the frequency domain - std::vector trueavg; // for lfe generation - std::vector xfs,yfs; // the feature space positions for each frequency bin - std::vector wnd; // the window function, precalculated - std::vector filter[6]; // a frequency filter for each output channel - std::vector inbuf[2]; // the sliding input buffers - std::vector outbuf[6]; // the sliding output buffers + std::vector m_frontL,m_frontR,m_avg,m_surL,m_surR; // the signal (phase-corrected) in the frequency domain + std::vector m_trueavg; // for lfe generation + std::vector m_xFs,m_yFs; // the feature space positions for each frequency bin + std::vector m_wnd; // the window function, precalculated + std::vector m_filter[6]; // a frequency filter for each output channel + std::vector m_inbuf[2]; // the sliding input buffers + std::vector m_outbuf[6]; // the sliding output buffers // coefficients - float surround_high,surround_low; // high and low surround mixing coefficient (e.g. 0.8165/0.5774) - float surround_balance; // the xfs balance that follows from the coeffs - float surround_level; // gain for the surround channels (follows from the coeffs - float phase_offsetL, phase_offsetR;// phase shifts to be applied to the rear channels - float front_separation; // front stereo separation - float rear_separation; // rear stereo separation - bool linear_steering; // whether the steering should be linear or not - cfloat A,B,C,D,E,F,G,H; // coefficients for the linear steering - int current_buf; // specifies which buffer is 2nd half of input sliding buffer - float * inbufs[2]; // for passing back to driver - float * outbufs[6]; // for passing back to driver + float m_surroundHigh,m_surroundLow; // high and low surround mixing coefficient (e.g. 0.8165/0.5774) + float m_surroundBalance; // the xfs balance that follows from the coeffs + float m_surroundLevel; // gain for the surround channels (follows from the coeffs + float m_phaseOffsetL, m_phaseOffsetR;// phase shifts to be applied to the rear channels + float m_frontSeparation; // front stereo separation + float m_rearSeparation; // rear stereo separation + bool m_linearSteering; // whether the steering should be linear or not + cfloat m_a,m_b,m_c,m_d,m_e,m_f,m_g,m_h; // coefficients for the linear steering + int m_currentBuf; // specifies which buffer is 2nd half of input sliding buffer + float * m_inbufs[2]; // for passing back to driver + float * m_outbufs[6]; // for passing back to driver friend class fsurround_decoder; }; diff --git a/mythtv/libs/libmythfreesurround/freesurround.cpp b/mythtv/libs/libmythfreesurround/freesurround.cpp index a725e0c3db0..3d10e56c00a 100644 --- a/mythtv/libs/libmythfreesurround/freesurround.cpp +++ b/mythtv/libs/libmythfreesurround/freesurround.cpp @@ -50,21 +50,21 @@ unsigned int block_size = default_block_size; struct buffers { buffers(unsigned int s): - l(s),r(s),c(s),ls(s),rs(s),lfe(s), rls(s), rrs(s) { } + m_l(s),m_r(s),m_c(s),m_ls(s),m_rs(s),m_lfe(s), m_rls(s), m_rrs(s) { } void resize(unsigned int s) { - l.resize(s); r.resize(s); lfe.resize(s); - ls.resize(s); rs.resize(s); c.resize(s); - rls.resize(s); rrs.resize(s); + m_l.resize(s); m_r.resize(s); m_lfe.resize(s); + m_ls.resize(s); m_rs.resize(s); m_c.resize(s); + m_rls.resize(s); m_rrs.resize(s); } void clear() { - l.clear(); r.clear(); lfe.clear(); - ls.clear(); rs.clear(); c.clear(); - rls.clear(); rrs.clear(); + m_l.clear(); m_r.clear(); m_lfe.clear(); + m_ls.clear(); m_rs.clear(); m_c.clear(); + m_rls.clear(); m_rrs.clear(); } - std::vector l,r,c,ls,rs,lfe,cs,lcs,rcs, - rls, rrs; // for demultiplexing + std::vector m_l,m_r,m_c,m_ls,m_rs,m_lfe,m_cs,m_lcs,m_rcs, + m_rls, m_rrs; // for demultiplexing }; //#define SPEAKERTEST @@ -186,8 +186,8 @@ uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels) { // should be -7dB to keep power level the same // but we bump the level a tad. - bufs->c[ic] = bufs->l[ic] = bufs->r[ic] = samples[i] * m6db; - bufs->ls[ic] = bufs->rs[ic] = bufs->c[ic]; + bufs->m_c[ic] = bufs->m_l[ic] = bufs->m_r[ic] = samples[i] * m6db; + bufs->m_ls[ic] = bufs->m_rs[ic] = bufs->m_c[ic]; } process = false; break; @@ -208,12 +208,12 @@ uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels) { float lt = *samples++; float rt = *samples++; - bufs->l[ic] = lt; - bufs->lfe[ic] = bufs->c[ic] = (lt+rt) * m3db; - bufs->r[ic] = rt; + bufs->m_l[ic] = lt; + bufs->m_lfe[ic] = bufs->m_c[ic] = (lt+rt) * m3db; + bufs->m_r[ic] = rt; // surround channels receive out-of-phase - bufs->ls[ic] = (rt-lt) * 0.5; - bufs->rs[ic] = (lt-rt) * 0.5; + bufs->m_ls[ic] = (rt-lt) * 0.5; + bufs->m_rs[ic] = (lt-rt) * 0.5; } process = false; break; @@ -222,11 +222,11 @@ uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels) { float lt = *samples++; float rt = *samples++; - bufs->l[ic] = lt * m3db; - bufs->lfe[ic] = bufs->c[ic] = (lt+rt) * m3db; - bufs->r[ic] = rt * m3db; - bufs->ls[ic] = bufs->l[ic]; - bufs->rs[ic] = bufs->r[ic]; + bufs->m_l[ic] = lt * m3db; + bufs->m_lfe[ic] = bufs->m_c[ic] = (lt+rt) * m3db; + bufs->m_r[ic] = rt * m3db; + bufs->m_ls[ic] = bufs->m_l[ic]; + bufs->m_rs[ic] = bufs->m_r[ic]; } process = false; break; @@ -250,12 +250,12 @@ uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels) float c = *samples++; float ls = *samples++; float rs = *samples++; - bufs->l[ic] = lt; - bufs->lfe[ic] = 0.0F; - bufs->c[ic] = c; - bufs->r[ic] = rt; - bufs->ls[ic] = ls; - bufs->rs[ic] = rs; + bufs->m_l[ic] = lt; + bufs->m_lfe[ic] = 0.0F; + bufs->m_c[ic] = c; + bufs->m_r[ic] = rt; + bufs->m_ls[ic] = ls; + bufs->m_rs[ic] = rs; } process = false; channels = 6; @@ -272,13 +272,13 @@ uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels) float cs = *samples++; float ls = *samples++; float rs = *samples++; - bufs->l[ic] = lt; - bufs->lfe[ic] = lfe; - bufs->c[ic] = c; - bufs->r[ic] = rt; - bufs->ls[ic] = ls; - bufs->rs[ic] = rs; - bufs->rls[ic] = bufs->rrs[ic] = cs * m3db; + bufs->m_l[ic] = lt; + bufs->m_lfe[ic] = lfe; + bufs->m_c[ic] = c; + bufs->m_r[ic] = rt; + bufs->m_ls[ic] = ls; + bufs->m_rs[ic] = rs; + bufs->m_rls[ic] = bufs->m_rrs[ic] = cs * m3db; } process = false; channels = 8; @@ -330,14 +330,14 @@ uint FreeSurround::receiveFrames(void *buffer, uint maxFrames) float *output = (float *)buffer; if (channels == 8) { - float *l = &bufs->l[outindex]; - float *c = &bufs->c[outindex]; - float *r = &bufs->r[outindex]; - float *ls = &bufs->ls[outindex]; - float *rs = &bufs->rs[outindex]; - float *lfe = &bufs->lfe[outindex]; - float *rls = &bufs->rls[outindex]; - float *rrs = &bufs->rrs[outindex]; + float *l = &bufs->m_l[outindex]; + float *c = &bufs->m_c[outindex]; + float *r = &bufs->m_r[outindex]; + float *ls = &bufs->m_ls[outindex]; + float *rs = &bufs->m_rs[outindex]; + float *lfe = &bufs->m_lfe[outindex]; + float *rls = &bufs->m_rls[outindex]; + float *rrs = &bufs->m_rrs[outindex]; for (uint i = 0; i < maxFrames; i++) { // printf("1:%f 2:%f 3:%f 4:%f 5:%f 6:%f 7:%f 8:%f\n", @@ -379,12 +379,12 @@ uint FreeSurround::receiveFrames(void *buffer, uint maxFrames) } else { - float *l = &bufs->l[outindex]; - float *c = &bufs->c[outindex]; - float *r = &bufs->r[outindex]; - float *ls = &bufs->ls[outindex]; - float *rs = &bufs->rs[outindex]; - float *lfe = &bufs->lfe[outindex]; + float *l = &bufs->m_l[outindex]; + float *c = &bufs->m_c[outindex]; + float *r = &bufs->m_r[outindex]; + float *ls = &bufs->m_ls[outindex]; + float *rs = &bufs->m_rs[outindex]; + float *lfe = &bufs->m_lfe[outindex]; for (uint i = 0; i < maxFrames; i++) { *output++ = *l++; diff --git a/mythtv/libs/libmythmetadata/cleanup.cpp b/mythtv/libs/libmythmetadata/cleanup.cpp index 1fea0a91f62..ec82bda508a 100644 --- a/mythtv/libs/libmythmetadata/cleanup.cpp +++ b/mythtv/libs/libmythmetadata/cleanup.cpp @@ -9,32 +9,32 @@ class CleanupHooksImp typedef std::list clean_list; private: - clean_list m_clean_list; + clean_list m_cleanList; public: void addHook(CleanupProc *clean_proc) { - m_clean_list.push_back(clean_proc); + m_cleanList.push_back(clean_proc); } void removeHook(CleanupProc *clean_proc) { - clean_list::iterator p = std::find(m_clean_list.begin(), - m_clean_list.end(), clean_proc); - if (p != m_clean_list.end()) + clean_list::iterator p = std::find(m_cleanList.begin(), + m_cleanList.end(), clean_proc); + if (p != m_cleanList.end()) { - m_clean_list.erase(p); + m_cleanList.erase(p); } } void cleanup() { - for (clean_list::iterator p = m_clean_list.begin(); - p != m_clean_list.end();++p) + for (clean_list::iterator p = m_cleanList.begin(); + p != m_cleanList.end();++p) { (*p)->doClean(); } - m_clean_list.clear(); + m_cleanList.clear(); } }; diff --git a/mythtv/libs/libmythmetadata/dbaccess.cpp b/mythtv/libs/libmythmetadata/dbaccess.cpp index e2f26db8b86..ecca96b847d 100644 --- a/mythtv/libs/libmythmetadata/dbaccess.cpp +++ b/mythtv/libs/libmythmetadata/dbaccess.cpp @@ -34,15 +34,15 @@ class SingleValueImp public: SingleValueImp(QString table_name, QString id_name, QString value_name) - : m_table_name(std::move(table_name)), m_id_name(std::move(id_name)), - m_value_name(std::move(value_name)), m_clean_stub(this) + : m_tableName(std::move(table_name)), m_idName(std::move(id_name)), + m_valueName(std::move(value_name)), m_cleanStub(this) { - m_insert_sql = QString("INSERT INTO %1 (%2) VALUES (:NAME)") - .arg(m_table_name).arg(m_value_name); - m_fill_sql = QString("SELECT %1, %2 FROM %3").arg(m_id_name) - .arg(m_value_name).arg(m_table_name); - m_delete_sql = QString("DELETE FROM %1 WHERE %2 = :ID") - .arg(m_table_name).arg(m_id_name); + m_insertSql = QString("INSERT INTO %1 (%2) VALUES (:NAME)") + .arg(m_tableName).arg(m_valueName); + m_fillSql = QString("SELECT %1, %2 FROM %3").arg(m_idName) + .arg(m_valueName).arg(m_tableName); + m_deleteSql = QString("DELETE FROM %1 WHERE %2 = :ID") + .arg(m_tableName).arg(m_idName); } virtual ~SingleValueImp() = default; @@ -66,7 +66,7 @@ class SingleValueImp if (!exists(name, &id)) { MSqlQuery query(MSqlQuery::InitCon()); - query.prepare(m_insert_sql); + query.prepare(m_insertSql); query.bindValue(":NAME", name); if (query.exec()) { @@ -101,7 +101,7 @@ class SingleValueImp if (p != m_entries.end()) { MSqlQuery query(MSqlQuery::InitCon()); - query.prepare(m_delete_sql); + query.prepare(m_deleteSql); query.bindValue(":ID", p->first); if (query.exec()) { @@ -133,19 +133,19 @@ class SingleValueImp if (m_dirty) { m_dirty = false; - m_ret_entries.clear(); + m_retEntries.clear(); for (entry_map::const_iterator p = m_entries.begin(); p != m_entries.end(); ++p) { - m_ret_entries.push_back(entry_list::value_type(p->first, + m_retEntries.push_back(entry_list::value_type(p->first, p->second)); } - std::sort(m_ret_entries.begin(), m_ret_entries.end(), + std::sort(m_retEntries.begin(), m_retEntries.end(), call_sort(*this)); } - return m_ret_entries; + return m_retEntries; } virtual bool sort(const entry &lhs, const entry &rhs) @@ -157,7 +157,7 @@ class SingleValueImp { m_ready = false; m_dirty = true; - m_ret_entries.clear(); + m_retEntries.clear(); m_entries.clear(); } @@ -179,7 +179,7 @@ class SingleValueImp MSqlQuery query(MSqlQuery::InitCon()); - if (query.exec(m_fill_sql)) + if (query.exec(m_fillSql)) { while (query.next()) { @@ -191,19 +191,19 @@ class SingleValueImp } private: - QString m_table_name; - QString m_id_name; - QString m_value_name; + QString m_tableName; + QString m_idName; + QString m_valueName; - QString m_insert_sql; - QString m_fill_sql; - QString m_delete_sql; + QString m_insertSql; + QString m_fillSql; + QString m_deleteSql; bool m_ready {false}; bool m_dirty {true}; - entry_list m_ret_entries; + entry_list m_retEntries; entry_map m_entries; - SimpleCleanup m_clean_stub; + SimpleCleanup m_cleanStub; }; //////////////////////////////////////////// @@ -260,14 +260,14 @@ class MultiValueImp public: MultiValueImp(QString table_name, QString id_name, - QString value_name) : m_table_name(std::move(table_name)), - m_id_name(std::move(id_name)), m_value_name(std::move(value_name)), - m_clean_stub(this) + QString value_name) : m_tableName(std::move(table_name)), + m_idName(std::move(id_name)), m_valueName(std::move(value_name)), + m_cleanStub(this) { - m_insert_sql = QString("INSERT INTO %1 (%2, %3) VALUES (:ID, :VALUE)") - .arg(m_table_name).arg(m_id_name).arg(m_value_name); - m_fill_sql = QString("SELECT %1, %2 FROM %3 ORDER BY %4").arg(m_id_name) - .arg(m_value_name).arg(m_table_name).arg(m_id_name); + m_insertSql = QString("INSERT INTO %1 (%2, %3) VALUES (:ID, :VALUE)") + .arg(m_tableName).arg(m_idName).arg(m_valueName); + m_fillSql = QString("SELECT %1, %2 FROM %3 ORDER BY %4").arg(m_idName) + .arg(m_valueName).arg(m_tableName).arg(m_idName); } mutable QMutex m_mutex; @@ -285,14 +285,14 @@ class MultiValueImp void cleanup() { m_ready = false; - m_val_map.clear(); + m_valMap.clear(); } int add(int id, int value) { bool db_insert = false; - id_map::iterator p = m_val_map.find(id); - if (p != m_val_map.end()) + id_map::iterator p = m_valMap.find(id); + if (p != m_valMap.end()) { entry::values_type &va = p->second.values; entry::values_type::iterator v = @@ -308,14 +308,14 @@ class MultiValueImp entry e; e.id = id; e.values.push_back(value); - m_val_map.insert(id_map::value_type(id, e)); + m_valMap.insert(id_map::value_type(id, e)); db_insert = true; } if (db_insert) { MSqlQuery query(MSqlQuery::InitCon()); - query.prepare(m_insert_sql); + query.prepare(m_insertSql); query.bindValue(":ID", id); query.bindValue(":VALUE", value); if (!query.exec()) @@ -327,8 +327,8 @@ class MultiValueImp bool get(int id, entry &values) { - id_map::iterator p = m_val_map.find(id); - if (p != m_val_map.end()) + id_map::iterator p = m_valMap.find(id); + if (p != m_valMap.end()) { values = p->second; return true; @@ -338,8 +338,8 @@ class MultiValueImp void remove(int id, int value) { - id_map::iterator p = m_val_map.find(id); - if (p != m_val_map.end()) + id_map::iterator p = m_valMap.find(id); + if (p != m_valMap.end()) { entry::values_type::iterator vp = std::find(p->second.values.begin(), p->second.values.end(), @@ -349,7 +349,7 @@ class MultiValueImp MSqlQuery query(MSqlQuery::InitCon()); QString del_query = QString("DELETE FROM %1 WHERE %2 = :ID AND " "%3 = :VALUE") - .arg(m_table_name).arg(m_id_name).arg(m_value_name); + .arg(m_tableName).arg(m_idName).arg(m_valueName); query.prepare(del_query); query.bindValue(":ID", p->first); query.bindValue(":VALUE", int(*vp)); @@ -364,26 +364,26 @@ class MultiValueImp void remove(int id) { - id_map::iterator p = m_val_map.find(id); - if (p != m_val_map.end()) + id_map::iterator p = m_valMap.find(id); + if (p != m_valMap.end()) { MSqlQuery query(MSqlQuery::InitCon()); QString del_query = QString("DELETE FROM %1 WHERE %2 = :ID") - .arg(m_table_name).arg(m_id_name); + .arg(m_tableName).arg(m_idName); query.prepare(del_query); query.bindValue(":ID", p->first); if (!query.exec() || !query.isActive()) { MythDB::DBError("multivalue remove", query); } - m_val_map.erase(p); + m_valMap.erase(p); } } bool exists(int id, int value) { - id_map::iterator p = m_val_map.find(id); - if (p != m_val_map.end()) + id_map::iterator p = m_valMap.find(id); + if (p != m_valMap.end()) { entry::values_type::iterator vp = std::find(p->second.values.begin(), p->second.values.end(), @@ -395,33 +395,33 @@ class MultiValueImp bool exists(int id) { - return m_val_map.find(id) != m_val_map.end(); + return m_valMap.find(id) != m_valMap.end(); } private: void fill_from_db() { - m_val_map.clear(); + m_valMap.clear(); MSqlQuery query(MSqlQuery::InitCon()); - if (query.exec(m_fill_sql) && query.size() > 0) + if (query.exec(m_fillSql) && query.size() > 0) { - id_map::iterator p = m_val_map.end(); + id_map::iterator p = m_valMap.end(); while (query.next()) { int id = query.value(0).toInt(); int val = query.value(1).toInt(); - if (p == m_val_map.end() || - (p != m_val_map.end() && p->first != id)) + if (p == m_valMap.end() || + (p != m_valMap.end() && p->first != id)) { - p = m_val_map.find(id); - if (p == m_val_map.end()) + p = m_valMap.find(id); + if (p == m_valMap.end()) { entry e; e.id = id; - p = m_val_map.insert(id_map::value_type(id, e)).first; + p = m_valMap.insert(id_map::value_type(id, e)).first; } } p->second.values.push_back(val); @@ -430,18 +430,18 @@ class MultiValueImp } private: - id_map m_val_map; + id_map m_valMap; - QString m_table_name; - QString m_id_name; - QString m_value_name; + QString m_tableName; + QString m_idName; + QString m_valueName; - QString m_insert_sql; - QString m_fill_sql; - QString m_id_sql; + QString m_insertSql; + QString m_fillSql; + QString m_idSql; bool m_ready {false}; - SimpleCleanup m_clean_stub; + SimpleCleanup m_cleanStub; }; //////////////////////////////////////////// @@ -490,9 +490,9 @@ VideoCategory::VideoCategory() : VideoCategory &VideoCategory::GetCategory() { - static VideoCategory vc; - vc.load_data(); - return vc; + static VideoCategory s_vc; + s_vc.load_data(); + return s_vc; } //////////////////////////////////////////// @@ -504,9 +504,9 @@ VideoCountry::VideoCountry() : VideoCountry &VideoCountry::getCountry() { - static VideoCountry vc; - vc.load_data(); - return vc; + static VideoCountry s_vc; + s_vc.load_data(); + return s_vc; } //////////////////////////////////////////// @@ -518,9 +518,9 @@ VideoGenre::VideoGenre() : VideoGenre &VideoGenre::getGenre() { - static VideoGenre vg; - vg.load_data(); - return vg; + static VideoGenre s_vg; + s_vg.load_data(); + return s_vg; } //////////////////////////////////////////// @@ -532,9 +532,9 @@ VideoCast::VideoCast() : VideoCast &VideoCast::GetCast() { - static VideoCast vc; - vc.load_data(); - return vc; + static VideoCast s_vc; + s_vc.load_data(); + return s_vc; } //////////////////////////////////////////// @@ -546,9 +546,9 @@ VideoGenreMap::VideoGenreMap() : VideoGenreMap &VideoGenreMap::getGenreMap() { - static VideoGenreMap vgm; - vgm.load_data(); - return vgm; + static VideoGenreMap s_vgm; + s_vgm.load_data(); + return s_vgm; } //////////////////////////////////////////// @@ -561,9 +561,9 @@ VideoCountryMap::VideoCountryMap() : VideoCountryMap &VideoCountryMap::getCountryMap() { - static VideoCountryMap vcm; - vcm.load_data(); - return vcm; + static VideoCountryMap s_vcm; + s_vcm.load_data(); + return s_vcm; } //////////////////////////////////////////// @@ -576,9 +576,9 @@ VideoCastMap::VideoCastMap() : VideoCastMap &VideoCastMap::getCastMap() { - static VideoCastMap vcm; - vcm.load_data(); - return vcm; + static VideoCastMap s_vcm; + s_vcm.load_data(); + return s_vcm; } //////////////////////////////////////////// @@ -601,7 +601,7 @@ class FileAssociationsImp MSqlQuery query(MSqlQuery::InitCon()); association_list::iterator p = find(ret_fa.extension); - if (p != m_file_associations.end()) + if (p != m_fileAssociations.end()) { ret_fa.id = p->id; existing_fa = &(*p); @@ -628,7 +628,7 @@ class FileAssociationsImp if (query.exec("SELECT LAST_INSERT_ID()") && query.next()) { ret_fa.id = query.value(0).toUInt(); - m_file_associations.push_back(ret_fa); + m_fileAssociations.push_back(ret_fa); } else return false; @@ -646,7 +646,7 @@ class FileAssociationsImp bool get(unsigned int id, file_association &val) const { association_list::const_iterator p = find(id); - if (p != m_file_associations.end()) + if (p != m_fileAssociations.end()) { val = *p; return true; @@ -657,7 +657,7 @@ class FileAssociationsImp bool get(const QString &ext, file_association &val) const { association_list::const_iterator p = find(ext); - if (p != m_file_associations.end()) + if (p != m_fileAssociations.end()) { val = *p; return true; @@ -668,14 +668,14 @@ class FileAssociationsImp bool remove(unsigned int id) { association_list::iterator p = find(id); - if (p != m_file_associations.end()) + if (p != m_fileAssociations.end()) { MSqlQuery query(MSqlQuery::InitCon()); query.prepare("DELETE FROM videotypes WHERE intid = :ID"); query.bindValue(":ID", p->id); if (query.exec()) { - m_file_associations.erase(p); + m_fileAssociations.erase(p); return true; } } @@ -684,13 +684,13 @@ class FileAssociationsImp const association_list &getList() const { - return m_file_associations; + return m_fileAssociations; } void getExtensionIgnoreList(ext_ignore_list &ext_ignore) const { - for (association_list::const_iterator p = m_file_associations.begin(); - p != m_file_associations.end(); ++p) + for (association_list::const_iterator p = m_fileAssociations.begin(); + p != m_fileAssociations.end(); ++p) { ext_ignore.push_back(std::make_pair(p->extension, p->ignore)); } @@ -711,7 +711,7 @@ class FileAssociationsImp void cleanup() { m_ready = false; - m_file_associations.clear(); + m_fileAssociations.clear(); } private: @@ -728,15 +728,15 @@ class FileAssociationsImp query.value(2).toString(), query.value(3).toBool(), query.value(4).toBool()); - m_file_associations.push_back(fa); + m_fileAssociations.push_back(fa); } } } association_list::iterator find(const QString &ext) { - for (association_list::iterator p = m_file_associations.begin(); - p != m_file_associations.end(); ++p) + for (association_list::iterator p = m_fileAssociations.begin(); + p != m_fileAssociations.end(); ++p) { if (p->extension.length() == ext.length() && ext.indexOf(p->extension) == 0) @@ -744,23 +744,23 @@ class FileAssociationsImp return p; } } - return m_file_associations.end(); + return m_fileAssociations.end(); } association_list::iterator find(unsigned int id) { - for (association_list::iterator p = m_file_associations.begin(); - p != m_file_associations.end(); ++p) + for (association_list::iterator p = m_fileAssociations.begin(); + p != m_fileAssociations.end(); ++p) { if (p->id == id) return p; } - return m_file_associations.end(); + return m_fileAssociations.end(); } association_list::const_iterator find(const QString &ext) const { - for (association_list::const_iterator p = m_file_associations.begin(); - p != m_file_associations.end(); ++p) + for (association_list::const_iterator p = m_fileAssociations.begin(); + p != m_fileAssociations.end(); ++p) { if (p->extension.length() == ext.length() && ext.indexOf(p->extension) == 0) @@ -768,21 +768,21 @@ class FileAssociationsImp return p; } } - return m_file_associations.end(); + return m_fileAssociations.end(); } association_list::const_iterator find(unsigned int id) const { - for (association_list::const_iterator p = m_file_associations.begin(); - p != m_file_associations.end(); ++p) + for (association_list::const_iterator p = m_fileAssociations.begin(); + p != m_fileAssociations.end(); ++p) { if (p->id == id) return p; } - return m_file_associations.end(); + return m_fileAssociations.end(); } private: - association_list m_file_associations; + association_list m_fileAssociations; bool m_ready {false}; }; @@ -834,7 +834,7 @@ FileAssociations::~FileAssociations() FileAssociations &FileAssociations::getFileAssociation() { - static FileAssociations fa; - fa.load_data(); - return fa; + static FileAssociations s_fa; + s_fa.load_data(); + return s_fa; } diff --git a/mythtv/libs/libmythmetadata/dirscan.cpp b/mythtv/libs/libmythmetadata/dirscan.cpp index dde190feef4..89c6933495f 100644 --- a/mythtv/libs/libmythmetadata/dirscan.cpp +++ b/mythtv/libs/libmythmetadata/dirscan.cpp @@ -19,11 +19,11 @@ namespace private: typedef std::map ext_map; ext_map m_extensions; - bool m_list_unknown; + bool m_listUnknown; public: ext_lookup(const FileAssociations::ext_ignore_list &ext_disposition, - bool list_unknown) : m_list_unknown(list_unknown) + bool list_unknown) : m_listUnknown(list_unknown) { for (FileAssociations::ext_ignore_list::const_iterator p = ext_disposition.begin(); p != ext_disposition.end(); ++p) @@ -38,7 +38,7 @@ namespace ext_map::const_iterator p = m_extensions.find(extension.toLower()); if (p != m_extensions.end()) return p->second; - return !m_list_unknown; + return !m_listUnknown; } }; diff --git a/mythtv/libs/libmythmetadata/metadatagrabber.cpp b/mythtv/libs/libmythmetadata/metadatagrabber.cpp index 27bfe4c0efb..0b08148bc7a 100644 --- a/mythtv/libs/libmythmetadata/metadatagrabber.cpp +++ b/mythtv/libs/libmythmetadata/metadatagrabber.cpp @@ -25,9 +25,9 @@ static QMutex grabberLock; static QDateTime grabberAge; typedef struct GrabberOpts { - QString path; - QString setting; - QString def; + QString m_path; + QString m_setting; + QString m_def; } GrabberOpts; // TODO @@ -44,9 +44,9 @@ static GrabberOpts GrabberOptsMaker(QString thepath, QString thesetting, QString { GrabberOpts opts; - opts.path = std::move(thepath); - opts.setting = std::move(thesetting); - opts.def = std::move(thedefault); + opts.m_path = std::move(thepath); + opts.m_setting = std::move(thesetting); + opts.m_def = std::move(thedefault); return opts; } @@ -123,7 +123,7 @@ GrabberList MetaGrabberScript::GetList(GrabberType type, QMap::const_iterator it; for (it = grabberTypes.begin(); it != grabberTypes.end(); ++it) { - QString path = (it->path).arg(GetShareDir()); + QString path = (it->m_path).arg(GetShareDir()); QStringList scripts = QDir(path).entryList(QDir::Executable | QDir::Files); if (scripts.count() == 0) // no scripts found @@ -199,14 +199,14 @@ MetaGrabberScript MetaGrabberScript::GetType(const GrabberType type) { InitializeStaticMaps(); - QString cmd = gCoreContext->GetSetting(grabberTypes[type].setting, - grabberTypes[type].def); + QString cmd = gCoreContext->GetSetting(grabberTypes[type].m_setting, + grabberTypes[type].m_def); if (cmd.isEmpty()) { // should the python bindings had not been installed at any stage // the settings could have been set to an empty string, so use default - cmd = grabberTypes[type].def; + cmd = grabberTypes[type].m_def; } if (grabberAge.isValid() && grabberAge.secsTo(MythDate::current()) <= kGrabberRefresh) @@ -267,19 +267,19 @@ MetaGrabberScript MetaGrabberScript::FromTag(const QString &tag, MetaGrabberScript MetaGrabberScript::FromInetref(const QString &inetref, bool absolute) { - static QRegExp retagref("^([a-zA-Z0-9_\\-\\.]+\\.[a-zA-Z0-9]{1,3})_(.*)"); - static QRegExp retagref2("^([a-zA-Z0-9_\\-\\.]+\\.[a-zA-Z0-9]{1,3}):(.*)"); - static QMutex reLock; - QMutexLocker lock(&reLock); + static QRegExp s_retagref("^([a-zA-Z0-9_\\-\\.]+\\.[a-zA-Z0-9]{1,3})_(.*)"); + static QRegExp s_retagref2("^([a-zA-Z0-9_\\-\\.]+\\.[a-zA-Z0-9]{1,3}):(.*)"); + static QMutex s_reLock; + QMutexLocker lock(&s_reLock); QString tag; - if (retagref.indexIn(inetref) > -1) + if (s_retagref.indexIn(inetref) > -1) { - tag = retagref.cap(1); + tag = s_retagref.cap(1); } - else if (retagref2.indexIn(inetref) > -1) + else if (s_retagref2.indexIn(inetref) > -1) { - tag = retagref2.cap(1); + tag = s_retagref2.cap(1); } if (!tag.isEmpty()) { @@ -295,16 +295,16 @@ MetaGrabberScript MetaGrabberScript::FromInetref(const QString &inetref, QString MetaGrabberScript::CleanedInetref(const QString &inetref) { - static QRegExp retagref("^([a-zA-Z0-9_\\-\\.]+\\.[a-zA-Z0-9]{1,3})_(.*)"); - static QRegExp retagref2("^([a-zA-Z0-9_\\-\\.]+\\.[a-zA-Z0-9]{1,3}):(.*)"); - static QMutex reLock; - QMutexLocker lock(&reLock); + static QRegExp s_retagref("^([a-zA-Z0-9_\\-\\.]+\\.[a-zA-Z0-9]{1,3})_(.*)"); + static QRegExp s_retagref2("^([a-zA-Z0-9_\\-\\.]+\\.[a-zA-Z0-9]{1,3}):(.*)"); + static QMutex s_reLock; + QMutexLocker lock(&s_reLock); // try to strip grabber tag from inetref - if (retagref.indexIn(inetref) > -1) - return retagref.cap(2); - if (retagref2.indexIn(inetref) > -1) - return retagref2.cap(2); + if (s_retagref.indexIn(inetref) > -1) + return s_retagref.cap(2); + if (s_retagref2.indexIn(inetref) > -1) + return s_retagref2.cap(2); return inetref; } diff --git a/mythtv/libs/libmythmetadata/musicmetadata.cpp b/mythtv/libs/libmythmetadata/musicmetadata.cpp index 208365f786b..055d33e12b1 100644 --- a/mythtv/libs/libmythmetadata/musicmetadata.cpp +++ b/mythtv/libs/libmythmetadata/musicmetadata.cpp @@ -2128,7 +2128,7 @@ AlbumArtImage *AlbumArtImages::getImageAt(uint index) QString AlbumArtImages::getTypeName(ImageType type) { // these const's should match the ImageType enum's - static const char* type_strings[] = { + static const char* s_typeStrings[] = { QT_TR_NOOP("Unknown"), // IT_UNKNOWN QT_TR_NOOP("Front Cover"), // IT_FRONTCOVER QT_TR_NOOP("Back Cover"), // IT_BACKCOVER @@ -2138,14 +2138,14 @@ QString AlbumArtImages::getTypeName(ImageType type) }; return QCoreApplication::translate("AlbumArtImages", - type_strings[type]); + s_typeStrings[type]); } // static method to get a filename from an ImageType QString AlbumArtImages::getTypeFilename(ImageType type) { // these const's should match the ImageType enum's - static const char* filename_strings[] = { + static const char* s_filenameStrings[] = { QT_TR_NOOP("unknown"), // IT_UNKNOWN QT_TR_NOOP("front"), // IT_FRONTCOVER QT_TR_NOOP("back"), // IT_BACKCOVER @@ -2155,7 +2155,7 @@ QString AlbumArtImages::getTypeFilename(ImageType type) }; return QCoreApplication::translate("AlbumArtImages", - filename_strings[type]); + s_filenameStrings[type]); } // static method to guess the image type from the filename diff --git a/mythtv/libs/libmythmetadata/videometadatalistmanager.cpp b/mythtv/libs/libmythmetadata/videometadatalistmanager.cpp index b0ca82318c6..bbfbb6584b2 100644 --- a/mythtv/libs/libmythmetadata/videometadatalistmanager.cpp +++ b/mythtv/libs/libmythmetadata/videometadatalistmanager.cpp @@ -17,29 +17,29 @@ class VideoMetadataListManagerImp public: void setList(metadata_list &list) { - m_id_map.clear(); - m_file_map.clear(); - m_meta_list.swap(list); + m_idMap.clear(); + m_fileMap.clear(); + m_metaList.swap(list); - for (metadata_list::iterator p = m_meta_list.begin(); - p != m_meta_list.end(); ++p) + for (metadata_list::iterator p = m_metaList.begin(); + p != m_metaList.end(); ++p) { - m_id_map.insert(int_to_meta::value_type((*p)->GetID(), p)); - m_file_map.insert( + m_idMap.insert(int_to_meta::value_type((*p)->GetID(), p)); + m_fileMap.insert( string_to_meta::value_type((*p)->GetFilename(), p)); } } const metadata_list &getList() const { - return m_meta_list; + return m_metaList; } VideoMetadataPtr byFilename(const QString &file_name) const { - string_to_meta::const_iterator p = m_file_map.find(file_name); - if (p != m_file_map.end()) + string_to_meta::const_iterator p = m_fileMap.find(file_name); + if (p != m_fileMap.end()) { return *(p->second); } @@ -48,8 +48,8 @@ class VideoMetadataListManagerImp VideoMetadataPtr byID(unsigned int db_id) const { - int_to_meta::const_iterator p = m_id_map.find(db_id); - if (p != m_id_map.end()) + int_to_meta::const_iterator p = m_idMap.find(db_id); + if (p != m_idMap.end()) { return *(p->second); } @@ -71,19 +71,19 @@ class VideoMetadataListManagerImp { if (metadata) { - int_to_meta::iterator im = m_id_map.find(metadata->GetID()); + int_to_meta::iterator im = m_idMap.find(metadata->GetID()); - if (im != m_id_map.end()) + if (im != m_idMap.end()) { metadata_list::iterator mdi = im->second; (*mdi)->DeleteFromDatabase(); - m_id_map.erase(im); + m_idMap.erase(im); string_to_meta::iterator sm = - m_file_map.find(metadata->GetFilename()); - if (sm != m_file_map.end()) - m_file_map.erase(sm); - m_meta_list.erase(mdi); + m_fileMap.find(metadata->GetFilename()); + if (sm != m_fileMap.end()) + m_fileMap.erase(sm); + m_metaList.erase(mdi); return true; } } @@ -92,9 +92,9 @@ class VideoMetadataListManagerImp } private: - metadata_list m_meta_list; - int_to_meta m_id_map; - string_to_meta m_file_map; + metadata_list m_metaList; + int_to_meta m_idMap; + string_to_meta m_fileMap; }; VideoMetadataListManager::VideoMetadataListManager() diff --git a/mythtv/libs/libmythmetadata/videoscan.cpp b/mythtv/libs/libmythmetadata/videoscan.cpp index 7c1a2519cc5..f1d45729734 100644 --- a/mythtv/libs/libmythmetadata/videoscan.cpp +++ b/mythtv/libs/libmythmetadata/videoscan.cpp @@ -39,12 +39,12 @@ namespace public: dirhandler(DirListType &video_files, const QStringList &image_extensions) : - m_video_files(video_files) + m_videoFiles(video_files) { for (QStringList::const_iterator p = image_extensions.begin(); p != image_extensions.end(); ++p) { - m_image_ext.insert((*p).toLower()); + m_imageExt.insert((*p).toLower()); } } @@ -67,17 +67,17 @@ namespace QString("handleFile: %1 :: %2").arg(fq_file_name).arg(host)); #endif (void) file_name; - if (m_image_ext.find(extension.toLower()) == m_image_ext.end()) + if (m_imageExt.find(extension.toLower()) == m_imageExt.end()) { - m_video_files[fq_file_name].check = false; - m_video_files[fq_file_name].host = host; + m_videoFiles[fq_file_name].check = false; + m_videoFiles[fq_file_name].host = host; } } private: typedef std::set image_ext; - image_ext m_image_ext; - DirListType &m_video_files; + image_ext m_imageExt; + DirListType &m_videoFiles; }; } diff --git a/mythtv/libs/libmythmpeg2/decode.c b/mythtv/libs/libmythmpeg2/decode.c index a53e9f9a898..8321cf632ea 100644 --- a/mythtv/libs/libmythmpeg2/decode.c +++ b/mythtv/libs/libmythmpeg2/decode.c @@ -192,7 +192,7 @@ mpeg2_state_t mpeg2_parse (mpeg2dec_t * mpeg2dec) mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec) { - static int (* process_header[]) (mpeg2dec_t * mpeg2dec) = { + static int (* s_processHeader[]) (mpeg2dec_t * mpeg2dec) = { mpeg2_header_picture, mpeg2_header_extension, mpeg2_header_user_data, mpeg2_header_sequence, NULL, NULL, NULL, NULL, mpeg2_header_gop }; @@ -223,7 +223,7 @@ mpeg2_state_t mpeg2_parse_header (mpeg2dec_t * mpeg2dec) } mpeg2dec->bytes_since_tag += copied; - if (process_header[mpeg2dec->code & 0x0b] (mpeg2dec)) { + if (s_processHeader[mpeg2dec->code & 0x0b] (mpeg2dec)) { mpeg2dec->code = mpeg2dec->buf_start[-1]; mpeg2dec->action = mpeg2_seek_header; return STATE_INVALID; diff --git a/mythtv/libs/libmythmpeg2/header.c b/mythtv/libs/libmythmpeg2/header.c index 203d8318359..47d73f57a9a 100644 --- a/mythtv/libs/libmythmpeg2/header.c +++ b/mythtv/libs/libmythmpeg2/header.c @@ -131,7 +131,7 @@ int mpeg2_header_sequence (mpeg2dec_t * mpeg2dec) { uint8_t * buffer = mpeg2dec->chunk_start; mpeg2_sequence_t * sequence = &(mpeg2dec->new_sequence); - static unsigned int frame_period[16] = { + static unsigned int s_framePeriod[16] = { 0, 1126125, 1125000, 1080000, 900900, 900000, 540000, 450450, 450000, /* unofficial: xing 15 fps */ 1800000, @@ -156,7 +156,7 @@ int mpeg2_header_sequence (mpeg2dec_t * mpeg2dec) SEQ_VIDEO_FORMAT_UNSPECIFIED); sequence->pixel_width = buffer[3] >> 4; /* aspect ratio */ - sequence->frame_period = frame_period[buffer[3] & 15]; + sequence->frame_period = s_framePeriod[buffer[3] & 15]; sequence->byte_rate = (buffer[4]<<10) | (buffer[5]<<2) | (buffer[6]>>6); @@ -335,8 +335,8 @@ int mpeg2_guess_aspect (const mpeg2_sequence_t * sequence, unsigned int * pixel_height) { static struct { - unsigned int width, height; - } video_modes[] = { + unsigned int m_width, m_height; + } s_videoModes[] = { {720, 576}, /* 625 lines, 13.5 MHz (D1, DV, DVB, DVD) */ {704, 576}, /* 625 lines, 13.5 MHz (1/1 D1, DVB, DVD, 4CIF) */ {544, 576}, /* 625 lines, 10.125 MHz (DVB, laserdisc) */ @@ -361,10 +361,10 @@ int mpeg2_guess_aspect (const mpeg2_sequence_t * sequence, *pixel_height = sequence->pixel_height; unsigned int width = sequence->picture_width; unsigned int height = sequence->picture_height; - for (i = 0; i < sizeof (video_modes) / sizeof (video_modes[0]); i++) - if (width == video_modes[i].width && height == video_modes[i].height) + for (i = 0; i < sizeof (s_videoModes) / sizeof (s_videoModes[0]); i++) + if (width == s_videoModes[i].m_width && height == s_videoModes[i].m_height) break; - if (i == sizeof (video_modes) / sizeof (video_modes[0]) || + if (i == sizeof (s_videoModes) / sizeof (s_videoModes[0]) || (sequence->pixel_width == 1 && sequence->pixel_height == 1) || width != sequence->display_width || height != sequence->display_height) return 0; @@ -377,11 +377,11 @@ int mpeg2_guess_aspect (const mpeg2_sequence_t * sequence, unsigned int DAR_16_9 = 0; if (! (sequence->flags & SEQ_FLAG_MPEG2)) { - static unsigned int mpeg1_check[2][2] = {{11, 54}, {27, 45}}; + static unsigned int s_mpeg1Check[2][2] = {{11, 54}, {27, 45}}; DAR_16_9 = (sequence->pixel_height == 27 || sequence->pixel_height == 45); if (width < 704 || - sequence->pixel_height != mpeg1_check[DAR_16_9][height == 576]) + sequence->pixel_height != s_mpeg1Check[DAR_16_9][height == 576]) return 0; } else { DAR_16_9 = (3 * sequence->picture_width * sequence->pixel_width > @@ -816,7 +816,7 @@ static int quant_matrix_ext (mpeg2dec_t * mpeg2dec) int mpeg2_header_extension (mpeg2dec_t * mpeg2dec) { - static int (* parser[]) (mpeg2dec_t *) = { + static int (* s_parser[]) (mpeg2dec_t *) = { 0, sequence_ext, sequence_display_ext, quant_matrix_ext, copyright_ext, 0, 0, picture_display_ext, picture_coding_ext }; @@ -827,7 +827,7 @@ int mpeg2_header_extension (mpeg2dec_t * mpeg2dec) if (!(mpeg2dec->ext_state & ext_bit)) return 0; /* ignore illegal extensions */ mpeg2dec->ext_state &= ~ext_bit; - return parser[ext] (mpeg2dec); + return s_parser[ext] (mpeg2dec); } int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec) @@ -840,7 +840,7 @@ int mpeg2_header_user_data (mpeg2dec_t * mpeg2dec) static void prescale (mpeg2dec_t * mpeg2dec, int index) { - static int non_linear_scale [] = { + static int s_nonLinearScale [] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 18, 20, 22, 24, 28, 32, 36, 40, 44, 48, 52, @@ -851,7 +851,7 @@ static void prescale (mpeg2dec_t * mpeg2dec, int index) if (mpeg2dec->scaled[index] != mpeg2dec->q_scale_type) { mpeg2dec->scaled[index] = mpeg2dec->q_scale_type; for (int i = 0; i < 32; i++) { - int k = mpeg2dec->q_scale_type ? non_linear_scale[i] : (i << 1); + int k = mpeg2dec->q_scale_type ? s_nonLinearScale[i] : (i << 1); for (int j = 0; j < 64; j++) decoder->quantizer_prescale[index][i][j] = k * mpeg2dec->quantizer_matrix[index][j]; diff --git a/mythtv/libs/libmythmpeg2/idct_mmx.c b/mythtv/libs/libmythmpeg2/idct_mmx.c index d9b5e2187eb..3e0c56a90dc 100644 --- a/mythtv/libs/libmythmpeg2/idct_mmx.c +++ b/mythtv/libs/libmythmpeg2/idct_mmx.c @@ -404,15 +404,15 @@ static inline void idct_col (int16_t * const col, const int offset) #define T3 43790 #define C4 23170 - static const short _T1[] ATTR_ALIGN(8) = {T1,T1,T1,T1}; - static const short _T2[] ATTR_ALIGN(8) = {T2,T2,T2,T2}; - static const short _T3[] ATTR_ALIGN(8) = {T3,T3,T3,T3}; - static const short _C4[] ATTR_ALIGN(8) = {C4,C4,C4,C4}; + static const short kT1[] ATTR_ALIGN(8) = {T1,T1,T1,T1}; + static const short kT2[] ATTR_ALIGN(8) = {T2,T2,T2,T2}; + static const short kT3[] ATTR_ALIGN(8) = {T3,T3,T3,T3}; + static const short kC4[] ATTR_ALIGN(8) = {C4,C4,C4,C4}; /* column code adapted from peter gubanov */ /* http://www.elecard.com/peter/idct.shtml */ - movq_m2r (*_T1, mm0); /* mm0 = T1 */ + movq_m2r (*kT1, mm0); /* mm0 = T1 */ movq_m2r (*(col+offset+1*8), mm1); /* mm1 = x1 */ movq_r2r (mm0, mm2); /* mm2 = T1 */ @@ -420,7 +420,7 @@ static inline void idct_col (int16_t * const col, const int offset) movq_m2r (*(col+offset+7*8), mm4); /* mm4 = x7 */ pmulhw_r2r (mm1, mm0); /* mm0 = T1*x1 */ - movq_m2r (*_T3, mm5); /* mm5 = T3 */ + movq_m2r (*kT3, mm5); /* mm5 = T3 */ pmulhw_r2r (mm4, mm2); /* mm2 = T1*x7 */ movq_m2r (*(col+offset+5*8), mm6); /* mm6 = x5 */ @@ -429,7 +429,7 @@ static inline void idct_col (int16_t * const col, const int offset) movq_m2r (*(col+offset+3*8), mm3); /* mm3 = x3 */ psubsw_r2r (mm4, mm0); /* mm0 = v17 */ - movq_m2r (*_T2, mm4); /* mm4 = T2 */ + movq_m2r (*kT2, mm4); /* mm4 = T2 */ pmulhw_r2r (mm3, mm5); /* mm5 = (T3-1)*x3 */ paddsw_r2r (mm2, mm1); /* mm1 = u17 */ @@ -467,7 +467,7 @@ static inline void idct_col (int16_t * const col, const int offset) movq_m2r (*(col+offset+0*8), mm3); /* mm3 = x0 */ paddsw_r2r (mm5, mm1); /* mm1 = u12+v12 */ - movq_m2r (*_C4, mm0); /* mm0 = C4/2 */ + movq_m2r (*kC4, mm0); /* mm0 = C4/2 */ psubsw_r2r (mm5, mm7); /* mm7 = u12-v12 */ movq_r2m (mm6, *(col+offset+5*8)); /* save b0 in scratch1 */ diff --git a/mythtv/libs/libmythupnp/msocketdevice.cpp b/mythtv/libs/libmythupnp/msocketdevice.cpp index b43ca9be86f..5836f104831 100644 --- a/mythtv/libs/libmythupnp/msocketdevice.cpp +++ b/mythtv/libs/libmythupnp/msocketdevice.cpp @@ -54,10 +54,10 @@ class MSocketDevicePrivate public: explicit MSocketDevicePrivate(MSocketDevice::Protocol p) - : protocol(p) + : m_protocol(p) { } - MSocketDevice::Protocol protocol; + MSocketDevice::Protocol m_protocol; }; @@ -272,15 +272,15 @@ MSocketDevice::Type MSocketDevice::type() const */ MSocketDevice::Protocol MSocketDevice::protocol() const { - if (d->protocol == Unknown) - d->protocol = getProtocol(); + if (d->m_protocol == Unknown) + d->m_protocol = getProtocol(); - return d->protocol; + return d->m_protocol; } void MSocketDevice::setProtocol(Protocol protocol) { - d->protocol = protocol; + d->m_protocol = protocol; } /*! @@ -320,7 +320,7 @@ void MSocketDevice::setSocket(int socket, Type type) fd = socket; - d->protocol = Unknown; + d->m_protocol = Unknown; e = NoError; diff --git a/mythtv/libs/libmythupnp/msocketdevice_unix.cpp b/mythtv/libs/libmythupnp/msocketdevice_unix.cpp index 6d45db65322..0cc413d43bb 100644 --- a/mythtv/libs/libmythupnp/msocketdevice_unix.cpp +++ b/mythtv/libs/libmythupnp/msocketdevice_unix.cpp @@ -859,18 +859,18 @@ qint64 MSocketDevice::bytesAvailable() const sure all bits are set to zero, preventing underflow with the FreeBSD/Linux/Solaris ioctls. */ - union { size_t st; - int i; + union { size_t m_st; + int m_i; } nbytes {}; - nbytes.st = 0; + nbytes.m_st = 0; // gives shorter than true amounts on Unix domain sockets. - if (::ioctl(fd, FIONREAD, (char*)&nbytes.i) < 0) + if (::ioctl(fd, FIONREAD, (char*)&nbytes.m_i) < 0) return -1; - return (qint64) nbytes.i + QIODevice::bytesAvailable(); + return (qint64) nbytes.m_i + QIODevice::bytesAvailable(); }