From acf2aeb241d07602fcfaec0c388afa14310c9b62 Mon Sep 17 00:00:00 2001 From: David Hampton Date: Sun, 1 Dec 2019 20:35:58 -0500 Subject: [PATCH] Tidy: Use the auto type specifier instead of duplicating types. (libs) The clang-tidy "use auto" modernization checker pointed out a ton of places where a type specifier was duplicated, e.g. "Foo *var = new Foo();", where the code can be simplified by using the new "auto" keyword. The previous example will be updated to read "auto *var = new Foo();". This example looks trivial, but when "Foo" is a 25 character QMap or something even longer, it makes the code easier to read. All replacements made by clang-tidy with some manual reformatting. There are a couple of manual replacements of begin()/end() with cbegin()/cend() to ensure that iterators are still const when using the "auto" keyword. https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html --- mythtv/libs/libmyth/audio/audioconvert.cpp | 6 +- mythtv/libs/libmyth/audio/audiooutput.cpp | 4 +- mythtv/libs/libmyth/audio/audiooutputalsa.cpp | 8 +-- mythtv/libs/libmyth/audio/audiooutputbase.cpp | 8 +-- .../audio/audiooutputdigitalencoder.cpp | 4 +- .../libs/libmyth/audio/audiooutputgraph.cpp | 10 ++-- mythtv/libs/libmyth/audio/audiooutputjack.cpp | 11 ++-- mythtv/libs/libmyth/audio/audiooutputnull.cpp | 2 +- mythtv/libs/libmyth/audio/audiooutputoss.cpp | 2 +- .../libs/libmyth/audio/audiooutputpulse.cpp | 10 ++-- mythtv/libs/libmyth/audio/audiooutpututil.cpp | 8 +-- .../libs/libmyth/audio/audiopulsehandler.cpp | 8 +-- mythtv/libs/libmyth/audio/spdifencoder.cpp | 2 +- mythtv/libs/libmyth/audio/volumebase.cpp | 2 +- mythtv/libs/libmyth/backendselect.cpp | 16 ++---- mythtv/libs/libmyth/guistartup.cpp | 4 +- mythtv/libs/libmyth/langsettings.cpp | 5 +- mythtv/libs/libmyth/mythcontext.cpp | 12 ++-- mythtv/libs/libmyth/mythmediamonitor.cpp | 4 +- mythtv/libs/libmyth/netgrabbermanager.cpp | 2 +- mythtv/libs/libmyth/netutils.cpp | 20 +++---- mythtv/libs/libmyth/output.cpp | 8 +-- mythtv/libs/libmyth/programinfoupdater.cpp | 2 +- mythtv/libs/libmyth/rawsettingseditor.cpp | 4 +- mythtv/libs/libmyth/remoteutil.cpp | 14 ++--- mythtv/libs/libmyth/standardsettings.cpp | 46 +++++++-------- mythtv/libs/libmyth/storagegroupeditor.cpp | 23 +++----- mythtv/libs/libmythbase/bonjourregister.cpp | 2 +- mythtv/libs/libmythbase/housekeeper.cpp | 6 +- mythtv/libs/libmythbase/logging.cpp | 8 +-- mythtv/libs/libmythbase/loggingserver.cpp | 14 ++--- mythtv/libs/libmythbase/mthreadpool.cpp | 2 +- mythtv/libs/libmythbase/mythcdrom-linux.cpp | 4 +- mythtv/libs/libmythbase/mythcdrom.cpp | 6 +- .../libmythbase/mythcommandlineparser.cpp | 7 +-- mythtv/libs/libmythbase/mythcorecontext.cpp | 2 +- mythtv/libs/libmythbase/mythdbcon.cpp | 3 +- .../libs/libmythbase/mythdownloadmanager.cpp | 23 ++++---- mythtv/libs/libmythbase/mythmiscutil.cpp | 2 +- mythtv/libs/libmythbase/mythplugin.cpp | 14 ++--- mythtv/libs/libmythbase/mythsystem.cpp | 6 +- mythtv/libs/libmythbase/mythsystemlegacy.cpp | 8 +-- mythtv/libs/libmythbase/mythsystemunix.cpp | 4 +- mythtv/libs/libmythbase/mythtimezone.cpp | 3 +- mythtv/libs/libmythbase/mythtranslation.cpp | 2 +- .../libmythbase/platforms/mythpowerdbus.cpp | 6 +- mythtv/libs/libmythbase/remotefile.cpp | 2 +- mythtv/libs/libmythbase/serverpool.cpp | 10 ++-- .../test_mythsorthelper.cpp | 12 ++-- mythtv/libs/libmythbase/unzip.cpp | 8 +-- mythtv/libs/libmythfreemheg/BaseClasses.cpp | 2 +- .../libs/libmythfreemheg/DynamicLineArt.cpp | 2 +- mythtv/libs/libmythfreemheg/Engine.cpp | 18 +++--- mythtv/libs/libmythfreemheg/Groups.cpp | 4 +- mythtv/libs/libmythfreemheg/ParseBinary.cpp | 6 +- mythtv/libs/libmythfreemheg/ParseNode.cpp | 12 ++-- mythtv/libs/libmythfreemheg/ParseText.cpp | 12 ++-- mythtv/libs/libmythfreemheg/Programs.cpp | 2 +- mythtv/libs/libmythfreemheg/Stream.cpp | 6 +- mythtv/libs/libmythfreemheg/Text.cpp | 8 +-- mythtv/libs/libmythfreemheg/TokenGroup.cpp | 8 +-- .../libs/libmythfreesurround/freesurround.cpp | 4 +- mythtv/libs/libmythmetadata/cleanup.cpp | 6 +- mythtv/libs/libmythmetadata/dbaccess.cpp | 45 +++++++-------- mythtv/libs/libmythmetadata/dirscan.cpp | 4 +- mythtv/libs/libmythmetadata/imagemanager.cpp | 13 ++--- mythtv/libs/libmythmetadata/imagemetadata.cpp | 2 +- mythtv/libs/libmythmetadata/lyricsdata.cpp | 4 +- .../libs/libmythmetadata/metadatacommon.cpp | 2 +- .../libs/libmythmetadata/metadatadownload.cpp | 4 +- .../libs/libmythmetadata/metadatafactory.cpp | 18 +++--- .../libmythmetadata/metadataimagedownload.cpp | 2 +- mythtv/libs/libmythmetadata/metaio.cpp | 6 +- .../libs/libmythmetadata/metaioavfcomment.cpp | 2 +- .../libs/libmythmetadata/metaioflacvorbis.cpp | 12 ++-- mythtv/libs/libmythmetadata/metaioid3.cpp | 32 +++++------ mythtv/libs/libmythmetadata/metaiomp4.cpp | 13 ++--- .../libs/libmythmetadata/metaiooggvorbis.cpp | 5 +- mythtv/libs/libmythmetadata/metaiotaglib.cpp | 2 +- mythtv/libs/libmythmetadata/metaiowavpack.cpp | 4 +- mythtv/libs/libmythmetadata/musicmetadata.cpp | 22 ++++---- .../libmythmetadata/mythuiimageresults.cpp | 6 +- .../libmythmetadata/mythuimetadataresults.cpp | 7 +-- .../libs/libmythmetadata/parentalcontrols.cpp | 3 +- mythtv/libs/libmythmetadata/videometadata.cpp | 6 +- .../videometadatalistmanager.cpp | 13 ++--- mythtv/libs/libmythmetadata/videoscan.cpp | 17 +++--- mythtv/libs/libmythmetadata/videoutils.cpp | 6 +- .../libmythprotoserver/mythsocketmanager.cpp | 2 +- .../requesthandler/basehandler.cpp | 2 +- .../requesthandler/deletethread.cpp | 2 +- .../requesthandler/fileserverhandler.cpp | 3 +- .../requesthandler/outboundhandler.cpp | 2 +- .../libs/libmythservicecontracts/service.cpp | 2 +- .../test_datacontracts/test_datacontracts.cpp | 22 ++++---- mythtv/libs/libmythui/cecadapter.cpp | 6 +- mythtv/libs/libmythui/mythdialogbox.cpp | 33 +++++------ mythtv/libs/libmythui/mythdisplay.cpp | 4 +- mythtv/libs/libmythui/mythfontmanager.cpp | 3 +- mythtv/libs/libmythui/mythfontproperties.cpp | 2 +- mythtv/libs/libmythui/mythgenerictree.cpp | 6 +- mythtv/libs/libmythui/mythimage.cpp | 4 +- mythtv/libs/libmythui/mythmainwindow.cpp | 56 ++++++++++--------- .../libs/libmythui/mythnotificationcenter.cpp | 37 ++++-------- mythtv/libs/libmythui/mythpainter.cpp | 2 +- mythtv/libs/libmythui/mythpainter_qimage.cpp | 2 +- mythtv/libs/libmythui/mythpainter_qt.cpp | 4 +- mythtv/libs/libmythui/mythprogressdialog.cpp | 3 +- mythtv/libs/libmythui/mythscreentype.cpp | 4 +- mythtv/libs/libmythui/myththemedmenu.cpp | 13 ++--- mythtv/libs/libmythui/mythudplistener.cpp | 2 +- mythtv/libs/libmythui/mythuianimation.cpp | 2 +- mythtv/libs/libmythui/mythuibutton.cpp | 9 ++- mythtv/libs/libmythui/mythuibuttonlist.cpp | 45 +++++++-------- mythtv/libs/libmythui/mythuibuttontree.cpp | 14 ++--- mythtv/libs/libmythui/mythuicheckbox.cpp | 4 +- mythtv/libs/libmythui/mythuiclock.cpp | 4 +- mythtv/libs/libmythui/mythuicomposite.cpp | 8 +-- mythtv/libs/libmythui/mythuieditbar.cpp | 24 ++++---- mythtv/libs/libmythui/mythuifilebrowser.cpp | 29 ++++------ mythtv/libs/libmythui/mythuigroup.cpp | 5 +- mythtv/libs/libmythui/mythuiguidegrid.cpp | 10 ++-- mythtv/libs/libmythui/mythuihelper.cpp | 3 +- mythtv/libs/libmythui/mythuiimage.cpp | 29 ++++------ mythtv/libs/libmythui/mythuiprogressbar.cpp | 8 +-- mythtv/libs/libmythui/mythuiscrollbar.cpp | 4 +- mythtv/libs/libmythui/mythuishape.cpp | 4 +- mythtv/libs/libmythui/mythuisimpletext.cpp | 4 +- mythtv/libs/libmythui/mythuispinbox.cpp | 6 +- mythtv/libs/libmythui/mythuistatetracker.cpp | 2 +- mythtv/libs/libmythui/mythuistatetype.cpp | 18 +++--- mythtv/libs/libmythui/mythuitext.cpp | 4 +- mythtv/libs/libmythui/mythuitextedit.cpp | 6 +- mythtv/libs/libmythui/mythuitype.cpp | 4 +- mythtv/libs/libmythui/mythuivideo.cpp | 2 +- mythtv/libs/libmythui/mythuiwebbrowser.cpp | 22 ++++---- mythtv/libs/libmythui/mythvirtualkeyboard.cpp | 20 +++---- .../libmythui/opengl/mythpainteropengl.cpp | 2 +- .../libmythui/opengl/mythrenderopengl.cpp | 16 +++--- .../libmythui/platforms/mythdisplayx11.cpp | 8 +-- .../libmythui/platforms/mythnvcontrol.cpp | 4 +- .../libs/libmythui/platforms/mythxdisplay.cpp | 4 +- mythtv/libs/libmythui/screensaver-dbus.cpp | 2 +- mythtv/libs/libmythui/xmlparsebase.cpp | 2 +- .../libs/libmythupnp/bufferedsocketdevice.cpp | 2 +- mythtv/libs/libmythupnp/eventing.cpp | 7 +-- mythtv/libs/libmythupnp/httpserver.cpp | 4 +- mythtv/libs/libmythupnp/mmembuf.cpp | 2 +- .../libs/libmythupnp/msocketdevice_unix.cpp | 8 +-- mythtv/libs/libmythupnp/services/rtti.cpp | 4 +- mythtv/libs/libmythupnp/ssdp.cpp | 9 +-- mythtv/libs/libmythupnp/ssdpcache.cpp | 2 +- mythtv/libs/libmythupnp/taskqueue.cpp | 7 +-- mythtv/libs/libmythupnp/upnpcds.cpp | 6 +- mythtv/libs/libmythupnp/upnpcdsobjects.cpp | 2 +- mythtv/libs/libmythupnp/upnpdevice.cpp | 14 ++--- mythtv/libs/libmythupnp/upnpserviceimpl.cpp | 2 +- mythtv/libs/libmythupnp/upnpsubscription.cpp | 8 +-- mythtv/libs/libmythupnp/upnptasksearch.cpp | 2 +- mythtv/libs/libmythupnp/websocket.cpp | 6 +- .../websocket_mythevent.cpp | 2 +- 161 files changed, 627 insertions(+), 743 deletions(-) diff --git a/mythtv/libs/libmyth/audio/audioconvert.cpp b/mythtv/libs/libmyth/audio/audioconvert.cpp index d86319f5d61..67ac3568e30 100644 --- a/mythtv/libs/libmyth/audio/audioconvert.cpp +++ b/mythtv/libs/libmyth/audio/audioconvert.cpp @@ -682,7 +682,7 @@ int AudioConvert::Process(void* out, const void* in, int bytes, bool noclip) // cppcheck-suppress unassignedVariable uint8_t buffer[65536+15]; - uint8_t* tmp = (uint8_t*)(((long)buffer + 15) & ~0xf); + auto* tmp = (uint8_t*)(((long)buffer + 15) & ~0xf); int left = bytes; while (left > 0) @@ -720,8 +720,8 @@ int AudioConvert::Process(void* out, const void* in, int bytes, bool noclip) */ void AudioConvert::MonoToStereo(void* dst, const void* src, int samples) { - float* d = (float*)dst; - float* s = (float*)src; + auto* d = (float*)dst; + auto* s = (float*)src; for (int i = 0; i < samples; i++) { *d++ = *s; diff --git a/mythtv/libs/libmyth/audio/audiooutput.cpp b/mythtv/libs/libmyth/audio/audiooutput.cpp index 2e4934331a6..284838428a3 100644 --- a/mythtv/libs/libmyth/audio/audiooutput.cpp +++ b/mythtv/libs/libmyth/audio/audiooutput.cpp @@ -419,7 +419,7 @@ static void fillSelectionsFromDir(const QDir &dir, AudioOutput::ADCVect* AudioOutput::GetOutputList(void) { - ADCVect *list = new ADCVect; + auto *list = new ADCVect; #ifdef USING_PULSE bool pasuspended = PulseHandler::Suspend(PulseHandler::kPulseSuspend); @@ -650,7 +650,7 @@ int AudioOutput::DecodeAudio(AVCodecContext *ctx, return ret; } - AVSampleFormat format = (AVSampleFormat)m_frame->format; + auto format = (AVSampleFormat)m_frame->format; AudioFormat fmt = AudioOutputSettings::AVSampleFormatToFormat(format, ctx->bits_per_raw_sample); diff --git a/mythtv/libs/libmyth/audio/audiooutputalsa.cpp b/mythtv/libs/libmyth/audio/audiooutputalsa.cpp index 448758e8b5a..e220e92ff1a 100644 --- a/mythtv/libs/libmyth/audio/audiooutputalsa.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputalsa.cpp @@ -323,7 +323,7 @@ AudioOutputSettings* AudioOutputALSA::GetOutputSettings(bool passthrough) AudioFormat fmt = FORMAT_NONE; int err = 0; - AudioOutputSettings *settings = new AudioOutputSettings(); + auto *settings = new AudioOutputSettings(); if (m_pcm_handle) { @@ -827,7 +827,7 @@ int AudioOutputALSA::GetVolumeChannel(int channel) const if (!m_mixer.elem) return retvol; - snd_mixer_selem_channel_id_t chan = (snd_mixer_selem_channel_id_t) channel; + auto chan = (snd_mixer_selem_channel_id_t) channel; if (!snd_mixer_selem_has_playback_channel(m_mixer.elem, chan)) return retvol; @@ -863,7 +863,7 @@ void AudioOutputALSA::SetVolumeChannel(int channel, int volume) mixervol = max(mixervol, m_mixer.volmin); mixervol = min(mixervol, m_mixer.volmax); - snd_mixer_selem_channel_id_t chan = (snd_mixer_selem_channel_id_t) channel; + auto chan = (snd_mixer_selem_channel_id_t) channel; if (snd_mixer_selem_has_playback_switch(m_mixer.elem)) snd_mixer_selem_set_playback_switch(m_mixer.elem, chan, (volume > 0)); @@ -984,7 +984,7 @@ bool AudioOutputALSA::OpenMixer(void) QMap *AudioOutputALSA::GetDevices(const char *type) { - QMap *alsadevs = new QMap(); + auto *alsadevs = new QMap(); void **hints = nullptr, **n = nullptr; if (snd_device_name_hint(-1, type, &hints) < 0) diff --git a/mythtv/libs/libmyth/audio/audiooutputbase.cpp b/mythtv/libs/libmyth/audio/audiooutputbase.cpp index 31578fb5f6b..f3677c8bab1 100644 --- a/mythtv/libs/libmyth/audio/audiooutputbase.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputbase.cpp @@ -189,7 +189,7 @@ AudioOutputSettings* AudioOutputBase::GetOutputSettingsUsers(bool digital) else if (m_output_settingsdigital) return m_output_settingsdigital; - AudioOutputSettings* aosettings = new AudioOutputSettings; + auto* aosettings = new AudioOutputSettings; *aosettings = *GetOutputSettingsCleaned(digital); aosettings->GetUsers(); @@ -1628,9 +1628,9 @@ void AudioOutputBase::GetBufferStatus(uint &fill, uint &total) */ void AudioOutputBase::OutputAudioLoop(void) { - uchar *zeros = new uchar[m_fragment_size]; - uchar *fragment_buf = new uchar[m_fragment_size + 16]; - uchar *fragment = (uchar *)AOALIGN(fragment_buf[0]); + auto *zeros = new uchar[m_fragment_size]; + auto *fragment_buf = new uchar[m_fragment_size + 16]; + auto *fragment = (uchar *)AOALIGN(fragment_buf[0]); memset(zeros, 0, m_fragment_size); // to reduce startup latency, write silence in 8ms chunks diff --git a/mythtv/libs/libmyth/audio/audiooutputdigitalencoder.cpp b/mythtv/libs/libmyth/audio/audiooutputdigitalencoder.cpp index 73b7aa62efd..57fb7194f66 100644 --- a/mythtv/libs/libmyth/audio/audiooutputdigitalencoder.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputdigitalencoder.cpp @@ -161,7 +161,7 @@ size_t AudioOutputDigitalEncoder::Encode(void *buf, int len, AudioFormat format) LOG(VB_AUDIO, LOG_INFO, LOC + QString("low mem, reallocating in buffer from %1 to %2") .arg(m_in_size) .arg(required_len)); - inbuf_t *tmp = reinterpret_cast + auto *tmp = reinterpret_cast (realloc(m_in, m_in_size, required_len)); if (!tmp) { @@ -275,7 +275,7 @@ size_t AudioOutputDigitalEncoder::Encode(void *buf, int len, AudioFormat format) LOG(VB_AUDIO, LOG_WARNING, LOC + QString("low mem, reallocating out buffer from %1 to %2") .arg(m_out_size) .arg(required_len)); - outbuf_t *tmp = reinterpret_cast + auto *tmp = reinterpret_cast (realloc(m_out, m_out_size, required_len)); if (!tmp) { diff --git a/mythtv/libs/libmyth/audio/audiooutputgraph.cpp b/mythtv/libs/libmyth/audio/audiooutputgraph.cpp index 5c3dd05396c..13dc1a06542 100644 --- a/mythtv/libs/libmyth/audio/audiooutputgraph.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputgraph.cpp @@ -154,8 +154,8 @@ class AudioOutputGraph::Buffer : protected QByteArray unsigned long cnt = len; int n = size(); resize(n + sizeof(int16_t) * cnt); - const uchar *s = reinterpret_cast< const uchar* >(b); - int16_t *p = reinterpret_cast< int16_t* >(data() + n); + const auto *s = reinterpret_cast< const uchar* >(b); + auto *p = reinterpret_cast< int16_t* >(data() + n); while (cnt--) *p++ = (int16_t(*s++) - CHAR_MAX) << (16 - CHAR_BIT); } @@ -172,8 +172,8 @@ class AudioOutputGraph::Buffer : protected QByteArray int n = size(); resize(n + sizeof(int16_t) * cnt); const float f((1 << 15) - 1); - const float *s = reinterpret_cast< const float* >(b); - int16_t *p = reinterpret_cast< int16_t* >(data() + n); + const auto *s = reinterpret_cast< const float* >(b); + auto *p = reinterpret_cast< int16_t* >(data() + n); while (cnt--) *p++ = int16_t(f * *s++); } @@ -312,7 +312,7 @@ MythImage *AudioOutputGraph::GetImage(int64_t timecode) const image.setPixel(x, height - 1 - y, rgb); } - MythImage *mi = new MythImage(m_painter); + auto *mi = new MythImage(m_painter); mi->Assign(image); return mi; } diff --git a/mythtv/libs/libmyth/audio/audiooutputjack.cpp b/mythtv/libs/libmyth/audio/audiooutputjack.cpp index cf11c93ac1b..6f669292d9c 100644 --- a/mythtv/libs/libmyth/audio/audiooutputjack.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputjack.cpp @@ -58,7 +58,7 @@ AudioOutputSettings* AudioOutputJACK::GetOutputSettings(bool /*digital*/) int rate = 0; int i = 0; const char **matching_ports = nullptr; - AudioOutputSettings *settings = new AudioOutputSettings(); + auto *settings = new AudioOutputSettings(); m_client = _jack_client_open(); if (!m_client) @@ -344,7 +344,7 @@ void AudioOutputJACK::DeinterleaveAudio(const float *aubuf, float **bufs, int nf */ int AudioOutputJACK::_JackCallback(jack_nframes_t nframes, void *arg) { - AudioOutputJACK *aoj = static_cast(arg); + auto *aoj = static_cast(arg); return aoj->JackCallback(nframes); } @@ -433,7 +433,7 @@ int AudioOutputJACK::JackCallback(jack_nframes_t nframes) */ int AudioOutputJACK::_JackXRunCallback(void *arg) { - AudioOutputJACK *aoj = static_cast(arg); + auto *aoj = static_cast(arg); return aoj->JackXRunCallback(); } @@ -461,7 +461,7 @@ int AudioOutputJACK::JackXRunCallback(void) */ int AudioOutputJACK::_JackGraphOrderCallback(void *arg) { - AudioOutputJACK *aoj = static_cast(arg); + auto *aoj = static_cast(arg); return aoj->JackGraphOrderCallback(); } @@ -569,8 +569,7 @@ void AudioOutputJACK::WriteAudio(unsigned char *aubuf, int size) jack_client_t* AudioOutputJACK::_jack_client_open(void) { QString client_name = QString("mythtv_%1").arg(getpid()); - jack_options_t open_options = - (jack_options_t)(JackUseExactName | JackNoStartServer); + auto open_options = (jack_options_t)(JackUseExactName | JackNoStartServer); jack_status_t open_status = JackFailure; jack_client_t *client = jack_client_open(client_name.toLatin1().constData(), diff --git a/mythtv/libs/libmyth/audio/audiooutputnull.cpp b/mythtv/libs/libmyth/audio/audiooutputnull.cpp index 2cd52a95d83..4e465cf247c 100644 --- a/mythtv/libs/libmyth/audio/audiooutputnull.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputnull.cpp @@ -53,7 +53,7 @@ void AudioOutputNULL::CloseDevice() AudioOutputSettings* AudioOutputNULL::GetOutputSettings(bool /*digital*/) { // Pretend that we support everything - AudioOutputSettings *settings = new AudioOutputSettings(); + auto *settings = new AudioOutputSettings(); // NOLINTNEXTLINE(bugprone-infinite-loop) while (int rate = settings->GetNextRate()) diff --git a/mythtv/libs/libmyth/audio/audiooutputoss.cpp b/mythtv/libs/libmyth/audio/audiooutputoss.cpp index 8890d99ba95..ad94cfe5af3 100644 --- a/mythtv/libs/libmyth/audio/audiooutputoss.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputoss.cpp @@ -36,7 +36,7 @@ AudioOutputOSS::~AudioOutputOSS() AudioOutputSettings* AudioOutputOSS::GetOutputSettings(bool /*digital*/) { - AudioOutputSettings *settings = new AudioOutputSettings(); + auto *settings = new AudioOutputSettings(); QByteArray device = m_main_device.toLatin1(); m_audiofd = open(device.constData(), O_WRONLY | O_NONBLOCK); diff --git a/mythtv/libs/libmyth/audio/audiooutputpulse.cpp b/mythtv/libs/libmyth/audio/audiooutputpulse.cpp index 46e95442acb..0bc80ef33e1 100644 --- a/mythtv/libs/libmyth/audio/audiooutputpulse.cpp +++ b/mythtv/libs/libmyth/audio/audiooutputpulse.cpp @@ -618,7 +618,7 @@ void AudioOutputPulseAudio::FlushStream(const char *caller) void AudioOutputPulseAudio::ContextStateCallback(pa_context *c, void *arg) { QString fn_log_tag = "_ContextStateCallback, "; - AudioOutputPulseAudio *audoutP = static_cast(arg); + auto *audoutP = static_cast(arg); switch (pa_context_get_state(c)) { case PA_CONTEXT_READY: @@ -637,7 +637,7 @@ void AudioOutputPulseAudio::ContextStateCallback(pa_context *c, void *arg) void AudioOutputPulseAudio::StreamStateCallback(pa_stream *s, void *arg) { QString fn_log_tag = "StreamStateCallback, "; - AudioOutputPulseAudio *audoutP = static_cast(arg); + auto *audoutP = static_cast(arg); switch (pa_stream_get_state(s)) { case PA_STREAM_READY: @@ -653,7 +653,7 @@ void AudioOutputPulseAudio::StreamStateCallback(pa_stream *s, void *arg) void AudioOutputPulseAudio::WriteCallback(pa_stream */*s*/, size_t /*size*/, void *arg) { - AudioOutputPulseAudio *audoutP = static_cast(arg); + auto *audoutP = static_cast(arg); pa_threaded_mainloop_signal(audoutP->m_mainloop, 0); } @@ -666,7 +666,7 @@ void AudioOutputPulseAudio::OpCompletionCallback( pa_context *c, int ok, void *arg) { QString fn_log_tag = "OpCompletionCallback, "; - AudioOutputPulseAudio *audoutP = static_cast(arg); + auto *audoutP = static_cast(arg); if (!ok) { VBERROR(fn_log_tag + QString("bummer, an operation failed: %1") @@ -690,7 +690,7 @@ void AudioOutputPulseAudio::ServerInfoCallback( void AudioOutputPulseAudio::SinkInfoCallback( pa_context */*c*/, const pa_sink_info *info, int /*eol*/, void *arg) { - AudioOutputPulseAudio *audoutP = static_cast(arg); + auto *audoutP = static_cast(arg); if (!info) { diff --git a/mythtv/libs/libmyth/audio/audiooutpututil.cpp b/mythtv/libs/libmyth/audio/audiooutpututil.cpp index 6544ab14e82..6f4703642d6 100644 --- a/mythtv/libs/libmyth/audio/audiooutpututil.cpp +++ b/mythtv/libs/libmyth/audio/audiooutpututil.cpp @@ -102,7 +102,7 @@ void AudioOutputUtil::AdjustVolume(void *buf, int len, int volume, bool music, bool upmix) { float g = volume / 100.0F; - float *fptr = (float *)buf; + auto *fptr = (float *)buf; int samples = len >> 2; int i = 0; @@ -203,8 +203,8 @@ char *AudioOutputUtil::GeneratePinkFrames(char *frames, int channels, initialize_pink_noise(&pink, bits); - int16_t *samp16 = (int16_t*) frames; - int32_t *samp32 = (int32_t*) frames; + auto *samp16 = (int16_t*) frames; + auto *samp32 = (int32_t*) frames; while (count-- > 0) { @@ -287,7 +287,7 @@ int AudioOutputUtil::DecodeAudio(AVCodecContext *ctx, return ret; } - AVSampleFormat format = (AVSampleFormat)frame->format; + auto format = (AVSampleFormat)frame->format; data_size = frame->nb_samples * frame->channels * av_get_bytes_per_sample(format); diff --git a/mythtv/libs/libmyth/audio/audiopulsehandler.cpp b/mythtv/libs/libmyth/audio/audiopulsehandler.cpp index 199a0926baa..b926df96cbd 100644 --- a/mythtv/libs/libmyth/audio/audiopulsehandler.cpp +++ b/mythtv/libs/libmyth/audio/audiopulsehandler.cpp @@ -55,7 +55,7 @@ bool PulseHandler::Suspend(enum PulseAction action) static int s_iPulseRunning = -1; static QTime s_time; - static enum PulseAction s_ePulseAction = PulseAction(-1); + static auto s_ePulseAction = PulseAction(-1); // Use the last result of IsPulseAudioRunning if within time if (!s_time.isNull() && s_time.elapsed() < 30000) @@ -93,7 +93,7 @@ bool PulseHandler::Suspend(enum PulseAction action) // create our handler if (!g_pulseHandler) { - PulseHandler* handler = new PulseHandler(); + auto* handler = new PulseHandler(); if (handler) { LOG(VB_AUDIO, LOG_INFO, LOC + "Created PulseHandler object"); @@ -125,7 +125,7 @@ static void StatusCallback(pa_context *ctx, void *userdata) return; // validate the callback - PulseHandler *handler = static_cast(userdata); + auto *handler = static_cast(userdata); if (!handler) { LOG(VB_GENERAL, LOG_ERR, LOC + "Callback: no handler."); @@ -167,7 +167,7 @@ static void OperationCallback(pa_context *ctx, int success, void *userdata) } // validate the callback - PulseHandler *handler = static_cast(userdata); + auto *handler = static_cast(userdata); if (!handler) { LOG(VB_GENERAL, LOG_ERR, LOC + "Operation: no handler."); diff --git a/mythtv/libs/libmyth/audio/spdifencoder.cpp b/mythtv/libs/libmyth/audio/spdifencoder.cpp index 43d77ddadd2..02b6b13fbd3 100644 --- a/mythtv/libs/libmyth/audio/spdifencoder.cpp +++ b/mythtv/libs/libmyth/audio/spdifencoder.cpp @@ -158,7 +158,7 @@ bool SPDIFEncoder::SetMaxHDRate(int rate) */ int SPDIFEncoder::funcIO(void *opaque, unsigned char *buf, int size) { - SPDIFEncoder *enc = (SPDIFEncoder *)opaque; + auto *enc = (SPDIFEncoder *)opaque; memcpy(enc->m_buffer + enc->m_size, buf, size); enc->m_size += size; diff --git a/mythtv/libs/libmyth/audio/volumebase.cpp b/mythtv/libs/libmyth/audio/volumebase.cpp index 8a0a7e08961..85db1eb8c95 100644 --- a/mythtv/libs/libmyth/audio/volumebase.cpp +++ b/mythtv/libs/libmyth/audio/volumebase.cpp @@ -23,7 +23,7 @@ class VolumeWriteBackThread : public MThread static VolumeWriteBackThread *Instance() { QMutexLocker lock(&s_mutex); - static VolumeWriteBackThread *s_instance = new VolumeWriteBackThread; + static auto *s_instance = new VolumeWriteBackThread; return s_instance; } diff --git a/mythtv/libs/libmyth/backendselect.cpp b/mythtv/libs/libmyth/backendselect.cpp index 6021ecd70bd..c2ecfb13d58 100644 --- a/mythtv/libs/libmyth/backendselect.cpp +++ b/mythtv/libs/libmyth/backendselect.cpp @@ -52,7 +52,7 @@ BackendSelection::Decision BackendSelection::Prompt( if (!mainStack) return ret; - BackendSelection *backendSettings = + auto *backendSettings = new BackendSelection(mainStack, dbParams, pConfig, true); if (backendSettings->Create()) @@ -98,8 +98,7 @@ void BackendSelection::Accept(MythUIButtonListItem *item) if (!item) return; - DeviceLocation *dev = item->GetData().value(); - + auto *dev = item->GetData().value(); if (!dev) { Cancel(); @@ -304,7 +303,7 @@ void BackendSelection::customEvent(QEvent *event) { if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (me == nullptr) return; @@ -337,8 +336,7 @@ void BackendSelection::customEvent(QEvent *event) } else if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = dynamic_cast(event); - + auto *dce = dynamic_cast(event); if (!dce) return; @@ -358,10 +356,8 @@ void BackendSelection::PromptForPassword(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *pwDialog = new MythTextInputDialog(popupStack, - message, - FilterNone, - true); + auto *pwDialog = new MythTextInputDialog(popupStack, message, + FilterNone, true); if (pwDialog->Create()) { diff --git a/mythtv/libs/libmyth/guistartup.cpp b/mythtv/libs/libmyth/guistartup.cpp index e06c7558672..b78551adfdc 100644 --- a/mythtv/libs/libmyth/guistartup.cpp +++ b/mythtv/libs/libmyth/guistartup.cpp @@ -176,9 +176,7 @@ void GUIStartup::Close(void) QString message = tr("Do you really want to exit MythTV?"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *confirmdialog - = new MythConfirmationDialog( - popupStack, message); + auto *confirmdialog = new MythConfirmationDialog(popupStack, message); if (confirmdialog->Create()) popupStack->AddScreen(confirmdialog); diff --git a/mythtv/libs/libmyth/langsettings.cpp b/mythtv/libs/libmyth/langsettings.cpp index c6de3bdb584..54a65573a57 100644 --- a/mythtv/libs/libmyth/langsettings.cpp +++ b/mythtv/libs/libmyth/langsettings.cpp @@ -80,7 +80,7 @@ bool LanguageSelection::Create(void) void LanguageSelection::Load(void) { - MythLocale *locale = new MythLocale(); + auto *locale = new MythLocale(); QString langCode; @@ -187,8 +187,7 @@ bool LanguageSelection::prompt(bool force) if (!mainStack) return false; - LanguageSelection *langSettings = new LanguageSelection(mainStack, - true); + auto *langSettings = new LanguageSelection(mainStack, true); if (langSettings->Create()) { diff --git a/mythtv/libs/libmyth/mythcontext.cpp b/mythtv/libs/libmyth/mythcontext.cpp index 32920539021..447756d60c6 100644 --- a/mythtv/libs/libmyth/mythcontext.cpp +++ b/mythtv/libs/libmyth/mythcontext.cpp @@ -476,8 +476,7 @@ bool MythContextPrivate::FindDatabase(bool prompt, bool noAutodetect) if (manualSelect) { // Get the user to select a backend from a possible list: - BackendSelection::Decision d = (BackendSelection::Decision) - ChooseBackend(failure); + auto d = (BackendSelection::Decision)ChooseBackend(failure); switch (d) { case BackendSelection::kAcceptConfigure: @@ -727,10 +726,9 @@ bool MythContextPrivate::PromptForDatabaseParams(const QString &error) EnableDBerrors(); MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); - DatabaseSettings *dbsetting = new DatabaseSettings(); - StandardSettingDialog *ssd = - new StandardSettingDialog(mainStack, "databasesettings", - dbsetting); + auto *dbsetting = new DatabaseSettings(); + auto *ssd = new StandardSettingDialog(mainStack, "databasesettings", + dbsetting); if (ssd->Create()) { mainStack->AddScreen(ssd); @@ -1361,7 +1359,7 @@ bool MythContextPrivate::event(QEvent *e) m_registration = GetNotificationCenter()->Register(this); } - MythEvent *me = dynamic_cast(e); + auto *me = dynamic_cast(e); if (me == nullptr) return true; diff --git a/mythtv/libs/libmyth/mythmediamonitor.cpp b/mythtv/libs/libmyth/mythmediamonitor.cpp index f7d9bbda8dd..d3eec769b10 100644 --- a/mythtv/libs/libmyth/mythmediamonitor.cpp +++ b/mythtv/libs/libmyth/mythmediamonitor.cpp @@ -361,7 +361,7 @@ MediaMonitor::MediaMonitor(QObject* par, unsigned long interval, QStringList::Iterator dev; for (dev = m_IgnoreList.begin(); dev != m_IgnoreList.end(); ++dev) { - QFileInfo *fi = new QFileInfo(*dev); + auto *fi = new QFileInfo(*dev); if (fi && fi->isSymLink()) { @@ -804,7 +804,7 @@ bool MediaMonitor::eventFilter(QObject *obj, QEvent *event) { if (event->type() == MythMediaEvent::kEventType) { - MythMediaEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (me == nullptr) { LOG(VB_GENERAL, LOG_ALERT, diff --git a/mythtv/libs/libmyth/netgrabbermanager.cpp b/mythtv/libs/libmyth/netgrabbermanager.cpp index 42f97241746..4022d6146b2 100644 --- a/mythtv/libs/libmyth/netgrabbermanager.cpp +++ b/mythtv/libs/libmyth/netgrabbermanager.cpp @@ -168,7 +168,7 @@ void GrabberManager::stopTimer() void GrabberManager::doUpdate() { - GrabberDownloadThread *gdt = new GrabberDownloadThread(this); + auto *gdt = new GrabberDownloadThread(this); if (m_refreshAll) gdt->refreshAll(); gdt->start(QThread::LowPriority); diff --git a/mythtv/libs/libmyth/netutils.cpp b/mythtv/libs/libmyth/netutils.cpp index eaf852ecaef..7f79d5346c9 100644 --- a/mythtv/libs/libmyth/netutils.cpp +++ b/mythtv/libs/libmyth/netutils.cpp @@ -75,8 +75,8 @@ GrabberScript* findTreeGrabberByCommand(const QString& commandline, bool search = query.value(6).toBool(); bool tree = query.value(7).toBool(); - GrabberScript *tmp = new GrabberScript(title, image, type, author, search, - tree, desc, command, ver); + auto *tmp = new GrabberScript(title, image, type, author, search, + tree, desc, command, ver); return tmp; } @@ -107,8 +107,8 @@ GrabberScript* findSearchGrabberByCommand(const QString& commandline, bool search = query.value(6).toBool(); bool tree = query.value(7).toBool(); - GrabberScript *tmp = new GrabberScript(title, image, type, author, search, - tree, desc, command, ver); + auto *tmp = new GrabberScript(title, image, type, author, search, + tree, desc, command, ver); return tmp; } @@ -138,8 +138,8 @@ GrabberScript::scriptList findAllDBTreeGrabbers() bool search = query.value(7).toBool(); bool tree = query.value(8).toBool(); - GrabberScript *script = new GrabberScript(title, image, type, author, search, - tree, desc, commandline, ver); + auto *script = new GrabberScript(title, image, type, author, search, + tree, desc, commandline, ver); tmp.append(script); } @@ -173,8 +173,8 @@ GrabberScript::scriptList findAllDBTreeGrabbersByHost(ArticleType type) bool search = query.value(6).toBool(); bool tree = query.value(7).toBool(); - GrabberScript *script = new GrabberScript(title, image, type, author, search, - tree, desc, commandline, ver); + auto *script = new GrabberScript(title, image, type, author, search, + tree, desc, commandline, ver); tmp.append(script); } @@ -208,8 +208,8 @@ GrabberScript::scriptList findAllDBSearchGrabbers(ArticleType type) bool search = query.value(6).toBool(); bool tree = query.value(7).toBool(); - GrabberScript *script = new GrabberScript(title, image, type, author, search, - tree, desc, commandline, ver); + auto *script = new GrabberScript(title, image, type, author, search, + tree, desc, commandline, ver); tmp.append(script); } diff --git a/mythtv/libs/libmyth/output.cpp b/mythtv/libs/libmyth/output.cpp index 4994c4df5d9..f0b93e376f1 100644 --- a/mythtv/libs/libmyth/output.cpp +++ b/mythtv/libs/libmyth/output.cpp @@ -35,14 +35,14 @@ void OutputListeners::error(const QString &e) void OutputListeners::addVisual(MythTV::Visual *v) { - Visuals::iterator it = std::find(m_visuals.begin(), m_visuals.end(), v); + auto it = std::find(m_visuals.begin(), m_visuals.end(), v); if (it == m_visuals.end()) m_visuals.push_back(v); } void OutputListeners::removeVisual(MythTV::Visual *v) { - Visuals::iterator it = std::find(m_visuals.begin(), m_visuals.end(), v); + auto it = std::find(m_visuals.begin(), m_visuals.end(), v); if (it != m_visuals.end()) m_visuals.erase(it); } @@ -53,7 +53,7 @@ void OutputListeners::dispatchVisual(uchar *buffer, unsigned long b_len, if (! buffer) return; - Visuals::iterator it = m_visuals.begin(); + auto it = m_visuals.begin(); for (; it != m_visuals.end(); ++it) { QMutexLocker locker((*it)->mutex()); @@ -63,7 +63,7 @@ void OutputListeners::dispatchVisual(uchar *buffer, unsigned long b_len, void OutputListeners::prepareVisuals() { - Visuals::iterator it = m_visuals.begin(); + auto it = m_visuals.begin(); for (; it != m_visuals.end(); ++it) { QMutexLocker locker((*it)->mutex()); diff --git a/mythtv/libs/libmyth/programinfoupdater.cpp b/mythtv/libs/libmyth/programinfoupdater.cpp index ef3d21b54ba..a192337071b 100644 --- a/mythtv/libs/libmyth/programinfoupdater.cpp +++ b/mythtv/libs/libmyth/programinfoupdater.cpp @@ -55,7 +55,7 @@ void ProgramInfoUpdater::run(void) m_lock.lock(); // send adds and deletes in the order they were queued - vector::iterator ita = m_needsAddDelete.begin(); + auto ita = m_needsAddDelete.begin(); for (; ita != m_needsAddDelete.end(); ++ita) { if (kPIAdd != (*ita).m_action && kPIDelete != (*ita).m_action) diff --git a/mythtv/libs/libmyth/rawsettingseditor.cpp b/mythtv/libs/libmyth/rawsettingseditor.cpp index 22e99fdb2b7..ae63fe7ecff 100644 --- a/mythtv/libs/libmyth/rawsettingseditor.cpp +++ b/mythtv/libs/libmyth/rawsettingseditor.cpp @@ -110,8 +110,8 @@ void RawSettingsEditor::Init(void) while (it != settingsList.end()) { - MythUIButtonListItem *item = new MythUIButtonListItem(m_settingsList, - "", qVariantFromValue(*it)); + auto *item = new MythUIButtonListItem(m_settingsList, "", + qVariantFromValue(*it)); if (m_settings[*it].isEmpty()) item->SetText(*it); diff --git a/mythtv/libs/libmyth/remoteutil.cpp b/mythtv/libs/libmyth/remoteutil.cpp index 2fa3f6efe9e..35059d9efc4 100644 --- a/mythtv/libs/libmyth/remoteutil.cpp +++ b/mythtv/libs/libmyth/remoteutil.cpp @@ -25,7 +25,7 @@ vector *RemoteGetRecordedList(int sort) QStringList strlist(str); - vector *info = new vector; + auto *info = new vector; if (!RemoteGetRecordingList(*info, strlist)) { @@ -192,8 +192,8 @@ uint RemoteGetRecordingList( QStringList::const_iterator it = strList.begin() + 1; for (int i = 0; i < numrecordings; i++) { - ProgramInfo *pginfo = new ProgramInfo(it, strList.end()); - reclist.push_back(pginfo); + auto *pginfo = new ProgramInfo(it, strList.end()); + reclist.push_back(pginfo); } return ((uint) reclist.size()) - reclist_initial_size; @@ -205,7 +205,7 @@ vector *RemoteGetConflictList(const ProgramInfo *pginfo) QStringList strlist( cmd ); pginfo->ToStringList(strlist); - vector *retlist = new vector; + auto *retlist = new vector; RemoteGetRecordingList(*retlist, strlist); return retlist; @@ -537,8 +537,8 @@ vector *RemoteGetCurrentlyRecordingList(void) str += "Recording"; QStringList strlist( str ); - vector *reclist = new vector; - vector *info = new vector; + auto *reclist = new vector; + auto *info = new vector; if (!RemoteGetRecordingList(*info, strlist)) { delete info; @@ -546,7 +546,7 @@ vector *RemoteGetCurrentlyRecordingList(void) } ProgramInfo *p = nullptr; - vector::iterator it = info->begin(); + auto it = info->begin(); // make sure whatever RemoteGetRecordingList() returned // only has RecStatus::Recording shows for ( ; it != info->end(); ++it) diff --git a/mythtv/libs/libmyth/standardsettings.cpp b/mythtv/libs/libmyth/standardsettings.cpp index 3a6c3391f20..8084be9c976 100644 --- a/mythtv/libs/libmyth/standardsettings.cpp +++ b/mythtv/libs/libmyth/standardsettings.cpp @@ -36,8 +36,7 @@ StandardSetting::~StandardSetting() MythUIButtonListItem * StandardSetting::createButton(MythUIButtonList * list) { - MythUIButtonListItemSetting *item = - new MythUIButtonListItemSetting(list, m_label); + auto *item = new MythUIButtonListItemSetting(list, m_label); item->SetData(qVariantFromValue(this)); connect(this, SIGNAL(ShouldRedraw(StandardSetting *)), item, SLOT(ShouldUpdate(StandardSetting *))); @@ -290,8 +289,7 @@ void GroupSetting::edit(MythScreenType *screen) if (!isEnabled()) return; - DialogCompletionEvent *dce = - new DialogCompletionEvent("leveldown", 0, "", ""); + auto *dce = new DialogCompletionEvent("leveldown", 0, "", ""); QCoreApplication::postEvent(screen, dce); } @@ -383,7 +381,7 @@ void MythUITextEditSetting::edit(MythScreenType * screen) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *settingdialog = + auto *settingdialog = new MythTextInputDialog(popupStack, getLabel(), FilterNone, m_passwordEcho, m_settingValue); @@ -421,8 +419,7 @@ void MythUIFileBrowserSetting::edit(MythScreenType * screen) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIFileBrowser *settingdialog = new MythUIFileBrowser(popupStack, - m_settingValue); + auto *settingdialog = new MythUIFileBrowser(popupStack, m_settingValue); settingdialog->SetTypeFilter(m_typeFilter); settingdialog->SetNameFilter(m_nameFilter); @@ -520,8 +517,7 @@ void MythUIComboBoxSetting::edit(MythScreenType * screen) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = - new MythDialogBox(getLabel(), popupStack, "optionmenu"); + auto *menuPopup = new MythDialogBox(getLabel(), popupStack, "optionmenu"); if (menuPopup->Create()) { @@ -565,7 +561,7 @@ void MythUIComboBoxSetting::resultEdit(DialogCompletionEvent *dce) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *settingdialog = + auto *settingdialog = new MythTextInputDialog(popupStack, getLabel(), FilterNone, false, m_settingValue); @@ -667,8 +663,7 @@ void MythUISpinBoxSetting::edit(MythScreenType * screen) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythSpinBoxDialog *settingdialog = new MythSpinBoxDialog(popupStack, - getLabel()); + auto *settingdialog = new MythSpinBoxDialog(popupStack, getLabel()); if (settingdialog->Create()) { @@ -729,8 +724,7 @@ void MythUICheckBoxSetting::edit(MythScreenType * screen) if (!isEnabled()) return; - DialogCompletionEvent *dce = - new DialogCompletionEvent("editsetting", 0, "", ""); + auto *dce = new DialogCompletionEvent("editsetting", 0, "", ""); QCoreApplication::postEvent(screen, dce); } @@ -784,7 +778,7 @@ void StandardSettingDialog::settingSelected(MythUIButtonListItem *item) if (!item) return; - StandardSetting *setting = item->GetData().value(); + auto *setting = item->GetData().value(); if (setting && m_selectedSettingHelp) { disconnect(m_selectedSettingHelp); @@ -795,7 +789,7 @@ void StandardSettingDialog::settingSelected(MythUIButtonListItem *item) void StandardSettingDialog::settingClicked(MythUIButtonListItem *item) { - StandardSetting* setting = item->GetData().value(); + auto* setting = item->GetData().value(); if (setting) setting->edit(this); } @@ -819,7 +813,7 @@ void StandardSettingDialog::customEvent(QEvent *event) MythUIButtonListItem * item = m_buttonList->GetItemCurrent(); if (item) { - StandardSetting *ss = item->GetData().value(); + auto *ss = item->GetData().value(); if (ss) ss->resultEdit(dce); } @@ -937,7 +931,7 @@ void StandardSettingDialog::LevelDown() MythUIButtonListItem *item = m_buttonList->GetItemCurrent(); if (item) { - StandardSetting *ss = item->GetData().value(); + auto *ss = item->GetData().value(); if (ss && ss->haveSubSettings() && ss->isEnabled()) setCurrentGroupSetting(ss); } @@ -952,8 +946,7 @@ void StandardSettingDialog::Close(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox * menuPopup = - new MythDialogBox(label, popupStack, "exitmenu"); + auto * menuPopup = new MythDialogBox(label, popupStack, "exitmenu"); if (menuPopup->Create()) { @@ -991,7 +984,7 @@ bool StandardSettingDialog::keyPressEvent(QKeyEvent *e) MythUIButtonListItem * item = m_buttonList->GetItemCurrent(); if (item) { - StandardSetting *ss = item->GetData().value(); + auto *ss = item->GetData().value(); if (ss) handled = ss->keyPressEvent(e); } @@ -1032,19 +1025,18 @@ void StandardSettingDialog::ShowMenu() if (!item) return; - GroupSetting *source = item->GetData().value(); + auto *source = item->GetData().value(); if (!source) return; // m_title->GetText() for screen title - MythMenu *menu = new MythMenu(source->getLabel(), this, "mainmenu"); + auto *menu = new MythMenu(source->getLabel(), this, "mainmenu"); menu->AddItem(tr("Edit"), SLOT(editEntry())); if (source->canDelete()) menu->AddItem(tr("Delete"), SLOT(deleteSelected())); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menuPopup = new MythDialogBox(menu, popupStack, - "menudialog"); + auto *menuPopup = new MythDialogBox(menu, popupStack, "menudialog"); menuPopup->SetReturnEvent(this, "mainmenu"); if (menuPopup->Create()) @@ -1069,7 +1061,7 @@ void StandardSettingDialog::deleteEntry() if (!item) return; - GroupSetting *source = item->GetData().value(); + auto *source = item->GetData().value(); if (!source) return; @@ -1088,7 +1080,7 @@ void StandardSettingDialog::deleteEntryConfirmed(bool ok) MythUIButtonListItem *item = m_buttonList->GetItemCurrent(); if (!item) return; - GroupSetting *source = item->GetData().value(); + auto *source = item->GetData().value(); if (!source) return; source->deleteEntry(); diff --git a/mythtv/libs/libmyth/storagegroupeditor.cpp b/mythtv/libs/libmyth/storagegroupeditor.cpp index 90418136c7c..96fe30d45b8 100644 --- a/mythtv/libs/libmyth/storagegroupeditor.cpp +++ b/mythtv/libs/libmyth/storagegroupeditor.cpp @@ -95,8 +95,7 @@ void StorageGroupEditor::ShowDeleteDialog() } MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *confirmDelete = - new MythConfirmationDialog(popupStack, message, true); + auto *confirmDelete = new MythConfirmationDialog(popupStack, message, true); if (confirmDelete->Create()) { connect(confirmDelete, SIGNAL(haveResult(bool)), @@ -202,8 +201,7 @@ void StorageGroupDirSetting::ShowDeleteDialog() QString message = tr("Remove '%1'\nDirectory From Storage Group?").arg(getValue()); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythConfirmationDialog *confirmDelete = - new MythConfirmationDialog(popupStack, message, true); + auto *confirmDelete = new MythConfirmationDialog(popupStack, message, true); if (confirmDelete->Create()) { @@ -238,8 +236,7 @@ void StorageGroupEditor::Load(void) { clearSettings(); - ButtonStandardSetting *button = - new ButtonStandardSetting(tr("(Add New Directory)")); + auto *button = new ButtonStandardSetting(tr("(Add New Directory)")); connect(button, SIGNAL(clicked()), SLOT(ShowFileBrowser())); addChild(button); @@ -283,7 +280,7 @@ void StorageGroupEditor::ShowFileBrowser() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIFileBrowser *settingdialog = new MythUIFileBrowser(popupStack, ""); + auto *settingdialog = new MythUIFileBrowser(popupStack, ""); settingdialog->SetTypeFilter(QDir::AllDirs | QDir::Drives); if (settingdialog->Create()) @@ -299,7 +296,7 @@ void StorageGroupEditor::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = dynamic_cast(event); + auto *dce = dynamic_cast(event); if (dce == nullptr) return; QString resultid = dce->GetId(); @@ -350,7 +347,7 @@ StorageGroupListEditor::StorageGroupListEditor(void) void StorageGroupListEditor::AddSelection(const QString &label, const QString &value) { - StorageGroupEditor *button = new StorageGroupEditor(value); + auto *button = new StorageGroupEditor(value); button->setLabel(label); addChild(button); } @@ -443,8 +440,7 @@ void StorageGroupListEditor::Load(void) if (isMaster) { - ButtonStandardSetting *newGroup = - new ButtonStandardSetting(tr("(Create new group)")); + auto *newGroup = new ButtonStandardSetting(tr("(Create new group)")); connect(newGroup, SIGNAL(clicked()), SLOT(ShowNewGroupDialog())); addChild(newGroup); } @@ -470,8 +466,7 @@ void StorageGroupListEditor::Load(void) void StorageGroupListEditor::ShowNewGroupDialog() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *settingdialog = - new MythTextInputDialog(popupStack, + auto *settingdialog = new MythTextInputDialog(popupStack, tr("Enter the name of the new storage group")); if (settingdialog->Create()) @@ -488,7 +483,7 @@ void StorageGroupListEditor::ShowNewGroupDialog() void StorageGroupListEditor::CreateNewGroup(const QString& name) { - StorageGroupEditor *button = new StorageGroupEditor(name); + auto *button = new StorageGroupEditor(name); button->setLabel(name + tr(" Storage Group Directories")); button->Load(); addChild(button); diff --git a/mythtv/libs/libmythbase/bonjourregister.cpp b/mythtv/libs/libmythbase/bonjourregister.cpp index 5e9ecf2babf..de1cd2c153c 100644 --- a/mythtv/libs/libmythbase/bonjourregister.cpp +++ b/mythtv/libs/libmythbase/bonjourregister.cpp @@ -98,7 +98,7 @@ void BonjourRegister::BonjourCallback(DNSServiceRef ref, DNSServiceFlags flags, (void)ref; (void)flags; - BonjourRegister *bonjour = static_cast(object); + auto *bonjour = static_cast(object); if (bonjour) { delete bonjour->m_lock; diff --git a/mythtv/libs/libmythbase/housekeeper.cpp b/mythtv/libs/libmythbase/housekeeper.cpp index 25159ba0a10..cc7aec91c95 100644 --- a/mythtv/libs/libmythbase/housekeeper.cpp +++ b/mythtv/libs/libmythbase/housekeeper.cpp @@ -791,7 +791,7 @@ void HouseKeeper::StartThread(void) // we're running for the first time // start up a new thread LOG(VB_GENERAL, LOG_DEBUG, "Running initial HouseKeepingThread."); - HouseKeepingThread *thread = new HouseKeepingThread(this); + auto *thread = new HouseKeepingThread(this); m_threadList.append(thread); thread->start(); } @@ -806,7 +806,7 @@ void HouseKeeper::StartThread(void) "spawning replacement. Current count %1.") .arg(m_threadList.size())); m_threadList.first()->Discard(); - HouseKeepingThread *thread = new HouseKeepingThread(this); + auto *thread = new HouseKeepingThread(this); m_threadList.prepend(thread); thread->start(); } @@ -823,7 +823,7 @@ void HouseKeeper::customEvent(QEvent *e) { if (e->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(e); + auto *me = dynamic_cast(e); if (me == nullptr) return; if ((me->Message().left(20) == "HOUSE_KEEPER_RUNNING") || diff --git a/mythtv/libs/libmythbase/logging.cpp b/mythtv/libs/libmythbase/logging.cpp index 5d47e233697..0f7168cb9e2 100644 --- a/mythtv/libs/libmythbase/logging.cpp +++ b/mythtv/libs/libmythbase/logging.cpp @@ -553,7 +553,7 @@ LoggingItem *LoggingItem::create(const char *_file, int _line, LogLevel_t _level, LoggingType _type) { - LoggingItem *item = new LoggingItem(_file, _function, _line, _level, _type); + auto *item = new LoggingItem(_file, _function, _line, _level, _type); return item; } @@ -563,7 +563,7 @@ LoggingItem *LoggingItem::create(QByteArray &buf) // Deserialize buffer QVariant variant = QJsonWrapper::parseJson(buf); - LoggingItem *item = new LoggingItem; + auto *item = new LoggingItem; QJsonWrapper::qvariant2qobject(variant.toMap(), item); return item; @@ -876,7 +876,7 @@ QString logLevelGetName(LogLevel_t level) /// \param helptext Descriptive text for --verbose help output void verboseAdd(uint64_t mask, QString name, bool additive, QString helptext) { - VerboseDef *item = new VerboseDef; + auto *item = new VerboseDef; item->mask = mask; // VB_GENERAL -> general @@ -896,7 +896,7 @@ void verboseAdd(uint64_t mask, QString name, bool additive, QString helptext) /// \param shortname one-letter short name for output into logs void loglevelAdd(int value, QString name, char shortname) { - LoglevelDef *item = new LoglevelDef; + auto *item = new LoglevelDef; item->value = value; // LOG_CRIT -> crit diff --git a/mythtv/libs/libmythbase/loggingserver.cpp b/mythtv/libs/libmythbase/loggingserver.cpp index d7e1d4e2c32..209d31f54fe 100644 --- a/mythtv/libs/libmythbase/loggingserver.cpp +++ b/mythtv/libs/libmythbase/loggingserver.cpp @@ -159,7 +159,7 @@ FileLogger *FileLogger::create(const QString& filename, QMutex *mutex) logger = new FileLogger(file); mutex->lock(); - ClientList *clients = new ClientList; + auto *clients = new ClientList; logRevClientMap.insert(logger, clients); return logger; } @@ -266,7 +266,7 @@ SyslogLogger *SyslogLogger::create(QMutex *mutex, bool open) logger = new SyslogLogger(open); mutex->lock(); - ClientList *clients = new ClientList; + auto *clients = new ClientList; logRevClientMap.insert(logger, clients); return logger; } @@ -323,7 +323,7 @@ JournalLogger *JournalLogger::create(QMutex *mutex) logger = new JournalLogger(); mutex->lock(); - ClientList *clients = new ClientList; + auto *clients = new ClientList; logRevClientMap.insert(logger, clients); return logger; } @@ -395,7 +395,7 @@ DatabaseLogger *DatabaseLogger::create(const QString& table, QMutex *mutex) logger = new DatabaseLogger(tble); mutex->lock(); - ClientList *clients = new ClientList; + auto *clients = new ClientList; logRevClientMap.insert(logger, clients); return logger; } @@ -597,7 +597,7 @@ void DBLoggerThread::run(void) // We want the query to be out of scope before the RunEpilog() so // shutdown occurs correctly as otherwise the connection appears still // in use, and we get a qWarning on shutdown. - MSqlQuery *query = new MSqlQuery(MSqlQuery::InitCon()); + auto *query = new MSqlQuery(MSqlQuery::InitCon()); m_logger->prepare(*query); QMutexLocker qLock(&m_queueMutex); @@ -819,7 +819,7 @@ void LogForwardThread::forwardMessage(LogMessage *msg) QMutexLocker lock3(&logRevClientMapMutex); // Need to find or create the loggers - LoggerList *loggers = new LoggerList; + auto *loggers = new LoggerList; // FileLogger from logFile QString logfile = item->logFile(); @@ -939,7 +939,7 @@ void logForwardStop(void) void logForwardMessage(const QList &msg) { - LogMessage *message = new LogMessage(msg); + auto *message = new LogMessage(msg); QMutexLocker lock(&logMsgListMutex); bool wasEmpty = logMsgList.isEmpty(); diff --git a/mythtv/libs/libmythbase/mthreadpool.cpp b/mythtv/libs/libmythbase/mthreadpool.cpp index 515d9b01d43..f563c362ca0 100644 --- a/mythtv/libs/libmythbase/mthreadpool.cpp +++ b/mythtv/libs/libmythbase/mthreadpool.cpp @@ -423,7 +423,7 @@ bool MThreadPool::TryStartInternal( { if (reserved) m_priv->m_reserveThread++; - MPoolThread *thread = new MPoolThread(*this, m_priv->m_expiryTimeout); + auto *thread = new MPoolThread(*this, m_priv->m_expiryTimeout); m_priv->m_runningThreads.insert(thread); thread->SetRunnable(runnable, debugName, reserved); thread->start(); diff --git a/mythtv/libs/libmythbase/mythcdrom-linux.cpp b/mythtv/libs/libmythbase/mythcdrom-linux.cpp index 1ba5eddf9ff..df599803282 100644 --- a/mythtv/libs/libmythbase/mythcdrom-linux.cpp +++ b/mythtv/libs/libmythbase/mythcdrom-linux.cpp @@ -207,7 +207,7 @@ bool MythCDROMLinux::hasWritableMedia() return false; } - CDROMdiscInfo *di = (CDROMdiscInfo *) buffer; + auto *di = (CDROMdiscInfo *) buffer; switch (di->m_discStatus) { case MEDIA_IS_EMPTY: @@ -252,7 +252,7 @@ int MythCDROMLinux::SCSIstatus() cgc.buflen = sizeof(buffer); cgc.data_direction = CGC_DATA_READ; - CDROMeventStatus *es = (CDROMeventStatus *) buffer; + auto *es = (CDROMeventStatus *) buffer; if ((ioctl(m_DeviceHandle, CDROM_SEND_PACKET, &cgc) < 0) || es->m_nea // drive does not support request diff --git a/mythtv/libs/libmythbase/mythcdrom.cpp b/mythtv/libs/libmythbase/mythcdrom.cpp index 14af54cfa76..fbc39b6eb73 100644 --- a/mythtv/libs/libmythbase/mythcdrom.cpp +++ b/mythtv/libs/libmythbase/mythcdrom.cpp @@ -144,7 +144,7 @@ struct blockInput_t static int _def_close(udfread_block_input *p_gen) { - blockInput_t *p = (blockInput_t *)p_gen; + auto *p = (blockInput_t *)p_gen; int result = -1; if (p && p->m_file) @@ -159,7 +159,7 @@ static int _def_close(udfread_block_input *p_gen) static uint32_t _def_size(udfread_block_input *p_gen) { - blockInput_t *p = (blockInput_t *)p_gen; + auto *p = (blockInput_t *)p_gen; return (uint32_t)(p->m_file->GetRealFileSize() / UDF_BLOCK_SIZE); } @@ -168,7 +168,7 @@ static int _def_read(udfread_block_input *p_gen, uint32_t lba, void *buf, uint32 { (void)flags; int result = -1; - blockInput_t *p = (blockInput_t *)p_gen; + auto *p = (blockInput_t *)p_gen; 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; diff --git a/mythtv/libs/libmythbase/mythcommandlineparser.cpp b/mythtv/libs/libmythbase/mythcommandlineparser.cpp index 65c07a75ad0..4cff319524d 100644 --- a/mythtv/libs/libmythbase/mythcommandlineparser.cpp +++ b/mythtv/libs/libmythbase/mythcommandlineparser.cpp @@ -2196,8 +2196,7 @@ void MythCommandLineParser::allowArgs(bool allow) else if (!allow) return; - CommandLineArg *arg = new CommandLineArg("_args", QVariant::StringList, - QStringList()); + auto *arg = new CommandLineArg("_args", QVariant::StringList, QStringList()); m_namedArgs["_args"] = arg; } @@ -2215,7 +2214,7 @@ void MythCommandLineParser::allowExtras(bool allow) return; QMap vmap; - CommandLineArg *arg = new CommandLineArg("_extra", QVariant::Map, vmap); + auto *arg = new CommandLineArg("_extra", QVariant::Map, vmap); m_namedArgs["_extra"] = arg; } @@ -2233,7 +2232,7 @@ void MythCommandLineParser::allowPassthrough(bool allow) else if (!allow) return; - CommandLineArg *arg = new CommandLineArg("_passthrough", + auto *arg = new CommandLineArg("_passthrough", QVariant::StringList, QStringList()); m_namedArgs["_passthrough"] = arg; } diff --git a/mythtv/libs/libmythbase/mythcorecontext.cpp b/mythtv/libs/libmythbase/mythcorecontext.cpp index e4733a9df5e..f24b55de29f 100644 --- a/mythtv/libs/libmythbase/mythcorecontext.cpp +++ b/mythtv/libs/libmythbase/mythcorecontext.cpp @@ -533,7 +533,7 @@ MythSocket *MythCoreContext::ConnectCommandSocket( MythSocket *MythCoreContext::ConnectEventSocket(const QString &hostname, int port) { - MythSocket *eventSock = new MythSocket(-1, this); + auto *eventSock = new MythSocket(-1, this); // Assume that since we _just_ connected the command socket, // this one won't need multiple retries to work... diff --git a/mythtv/libs/libmythbase/mythdbcon.cpp b/mythtv/libs/libmythbase/mythdbcon.cpp index fcc977b5160..c90a4e19169 100644 --- a/mythtv/libs/libmythbase/mythdbcon.cpp +++ b/mythtv/libs/libmythbase/mythdbcon.cpp @@ -45,8 +45,7 @@ bool TestDatabase(const QString& dbHostName, if (dbHostName.isEmpty() || dbUserName.isEmpty()) return ret; - MSqlDatabase *db = new MSqlDatabase("dbtest"); - + auto *db = new MSqlDatabase("dbtest"); if (!db) return ret; diff --git a/mythtv/libs/libmythbase/mythdownloadmanager.cpp b/mythtv/libs/libmythbase/mythdownloadmanager.cpp index 6123b521fa7..24779229880 100644 --- a/mythtv/libs/libmythbase/mythdownloadmanager.cpp +++ b/mythtv/libs/libmythbase/mythdownloadmanager.cpp @@ -126,7 +126,7 @@ class RemoteFileDownloadThread : public QRunnable { bool ok = false; - RemoteFile *rf = new RemoteFile(m_dlInfo->m_url, false, false, 0); + auto *rf = new RemoteFile(m_dlInfo->m_url, false, false, 0); ok = rf->SaveAs(m_dlInfo->m_privData); delete rf; @@ -170,7 +170,7 @@ MythDownloadManager *GetMythDownloadManager(void) if (downloadManager) return downloadManager; - MythDownloadManager *tmpDLM = new MythDownloadManager(); + auto *tmpDLM = new MythDownloadManager(); tmpDLM->start(); while (!tmpDLM->getQueueThread()) usleep(10000); @@ -339,7 +339,7 @@ void MythDownloadManager::queueItem(const QString &url, QNetworkRequest *req, QObject *caller, const MRequestType reqType, const bool reload) { - MythDownloadInfo *dlInfo = new MythDownloadInfo; + auto *dlInfo = new MythDownloadInfo; dlInfo->m_url = url; dlInfo->m_request = req; @@ -374,7 +374,7 @@ bool MythDownloadManager::processItem(const QString &url, QNetworkRequest *req, const QHash *headers, QString *finalUrl) { - MythDownloadInfo *dlInfo = new MythDownloadInfo; + auto *dlInfo = new MythDownloadInfo; dlInfo->m_url = url; dlInfo->m_request = req; @@ -476,7 +476,7 @@ bool MythDownloadManager::download(const QString &url, QByteArray *data, QNetworkReply *MythDownloadManager::download(const QString &url, const bool reload) { - MythDownloadInfo *dlInfo = new MythDownloadInfo; + auto *dlInfo = new MythDownloadInfo; QNetworkReply *reply = nullptr; dlInfo->m_url = url; @@ -657,8 +657,7 @@ bool MythDownloadManager::postAuth(const QString &url, QByteArray *data, */ void MythDownloadManager::downloadRemoteFile(MythDownloadInfo *dlInfo) { - RemoteFileDownloadThread *dlThread = - new RemoteFileDownloadThread(this, dlInfo); + auto *dlThread = new RemoteFileDownloadThread(this, dlInfo); MThreadPool::globalInstance()->start(dlThread, "RemoteFileDownload"); } @@ -1607,7 +1606,7 @@ QDateTime MythDownloadManager::GetLastModified(const QString &url) if (!result.isValid()) { - MythDownloadInfo *dlInfo = new MythDownloadInfo; + auto *dlInfo = new MythDownloadInfo; dlInfo->m_url = url; dlInfo->m_syncMode = true; // Head request, we only want to inspect the headers @@ -1644,7 +1643,7 @@ void MythDownloadManager::loadCookieJar(const QString &filename) { QMutexLocker locker(&m_cookieLock); - MythCookieJar *jar = new MythCookieJar; + auto *jar = new MythCookieJar; jar->load(filename); m_manager->setCookieJar(jar); } @@ -1684,7 +1683,7 @@ QNetworkCookieJar *MythDownloadManager::copyCookieJar(void) auto inJar = dynamic_cast(m_manager->cookieJar()); if (inJar == nullptr) return nullptr; - MythCookieJar *outJar = new MythCookieJar; + auto *outJar = new MythCookieJar; outJar->copyAllCookies(*inJar); return static_cast(outJar); @@ -1702,7 +1701,7 @@ void MythDownloadManager::refreshCookieJar(QNetworkCookieJar *jar) if (inJar == nullptr) return; - MythCookieJar *outJar = new MythCookieJar; + auto *outJar = new MythCookieJar; outJar->copyAllCookies(*inJar); m_inCookieJar = static_cast(outJar); @@ -1719,7 +1718,7 @@ void MythDownloadManager::updateCookieJar(void) auto inJar = dynamic_cast(m_inCookieJar); if (inJar != nullptr) { - MythCookieJar *outJar = new MythCookieJar; + auto *outJar = new MythCookieJar; outJar->copyAllCookies(*inJar); m_manager->setCookieJar(static_cast(outJar)); } diff --git a/mythtv/libs/libmythbase/mythmiscutil.cpp b/mythtv/libs/libmythbase/mythmiscutil.cpp index f917c3f2b46..dfa92a90bde 100644 --- a/mythtv/libs/libmythbase/mythmiscutil.cpp +++ b/mythtv/libs/libmythbase/mythmiscutil.cpp @@ -262,7 +262,7 @@ bool ping(const QString &host, int timeout) */ bool telnet(const QString &host, int port) { - MythSocket *s = new MythSocket(); + auto *s = new MythSocket(); bool connected = s->ConnectToHost(host, port); s->DecrRef(); diff --git a/mythtv/libs/libmythbase/mythplugin.cpp b/mythtv/libs/libmythbase/mythplugin.cpp index 942e4906da0..3a056b42e1b 100644 --- a/mythtv/libs/libmythbase/mythplugin.cpp +++ b/mythtv/libs/libmythbase/mythplugin.cpp @@ -23,8 +23,7 @@ using namespace std; int MythPlugin::init(const char *libversion) { using PluginInitFunc = int (*)(const char *); - PluginInitFunc ifunc = (PluginInitFunc)QLibrary::resolve("mythplugin_init"); - + auto ifunc = (PluginInitFunc)QLibrary::resolve("mythplugin_init"); if (ifunc) return ifunc(libversion); @@ -46,8 +45,8 @@ int MythPlugin::run(void) { using PluginRunFunc = int (*)(); - int rVal = -1; - PluginRunFunc rfunc = (PluginRunFunc)QLibrary::resolve("mythplugin_run"); + int rVal = -1; + auto rfunc = (PluginRunFunc)QLibrary::resolve("mythplugin_run"); if (rfunc) rVal = rfunc(); @@ -59,9 +58,8 @@ int MythPlugin::config(void) { using PluginConfigFunc = int (*)(); - int rVal = -1; - PluginConfigFunc rfunc = (PluginConfigFunc)QLibrary::resolve( - "mythplugin_config"); + int rVal = -1; + auto rfunc = (PluginConfigFunc)QLibrary::resolve("mythplugin_config"); if (rfunc) { @@ -75,7 +73,7 @@ int MythPlugin::config(void) MythPluginType MythPlugin::type(void) { using PluginTypeFunc = MythPluginType (*)(); - PluginTypeFunc rfunc = (PluginTypeFunc)QLibrary::resolve("mythplugin_type"); + auto rfunc = (PluginTypeFunc)QLibrary::resolve("mythplugin_type"); if (rfunc) return rfunc(); diff --git a/mythtv/libs/libmythbase/mythsystem.cpp b/mythtv/libs/libmythbase/mythsystem.cpp index eaf05fb876a..0e5e2e22f01 100644 --- a/mythtv/libs/libmythbase/mythsystem.cpp +++ b/mythtv/libs/libmythbase/mythsystem.cpp @@ -51,8 +51,7 @@ class MythSystemLegacyWrapper : public MythSystem if (args.empty()) return nullptr; - MythSystemLegacy *legacy = - new MythSystemLegacy(args.join(" "), flags); + auto *legacy = new MythSystemLegacy(args.join(" "), flags); if (!startPath.isEmpty()) legacy->SetDirectory(startPath); @@ -64,8 +63,7 @@ class MythSystemLegacyWrapper : public MythSystem return nullptr; } - MythSystemLegacyWrapper *wrapper = - new MythSystemLegacyWrapper(legacy, flags); + auto *wrapper = new MythSystemLegacyWrapper(legacy, flags); // TODO implement cpuPriority and diskPriority return wrapper; diff --git a/mythtv/libs/libmythbase/mythsystemlegacy.cpp b/mythtv/libs/libmythbase/mythsystemlegacy.cpp index 3473491ffec..e7c034be94a 100644 --- a/mythtv/libs/libmythbase/mythsystemlegacy.cpp +++ b/mythtv/libs/libmythbase/mythsystemlegacy.cpp @@ -453,7 +453,7 @@ void MythSystemLegacy::HandlePostRun(void) // handler thread), we need to use postEvents if (GetSetting("DisableDrawing")) { - QEvent *event = new QEvent(MythEvent::kPopDisableDrawingEventType); + auto *event = new QEvent(MythEvent::kPopDisableDrawingEventType); QCoreApplication::postEvent(gCoreContext->GetGUIObject(), event); } @@ -461,7 +461,7 @@ void MythSystemLegacy::HandlePostRun(void) // the UDP ports before the child application has stopped and terminated if (GetSetting("DisableUDP")) { - QEvent *event = new QEvent(MythEvent::kEnableUDPListenerEventType); + auto *event = new QEvent(MythEvent::kEnableUDPListenerEventType); QCoreApplication::postEvent(gCoreContext->GetGUIObject(), event); } @@ -469,7 +469,7 @@ void MythSystemLegacy::HandlePostRun(void) // after all existing (blocked) events are processed and ignored. if (GetSetting("BlockInputDevs")) { - QEvent *event = new QEvent(MythEvent::kUnlockInputDevicesEventType); + auto *event = new QEvent(MythEvent::kUnlockInputDevicesEventType); QCoreApplication::postEvent(gCoreContext->GetGUIObject(), event); } } @@ -501,7 +501,7 @@ MythSystemLegacyPrivate::MythSystemLegacyPrivate(const QString &debugName) : uint myth_system(const QString &command, uint flags, uint timeout) { flags |= kMSRunShell | kMSAutoCleanup; - MythSystemLegacy *ms = new MythSystemLegacy(command, flags); + auto *ms = new MythSystemLegacy(command, flags); ms->Run(timeout); uint result = ms->Wait(0); if (!ms->GetSetting("RunInBackground")) diff --git a/mythtv/libs/libmythbase/mythsystemunix.cpp b/mythtv/libs/libmythbase/mythsystemunix.cpp index 7d77574cc91..26d4cc7a20e 100644 --- a/mythtv/libs/libmythbase/mythsystemunix.cpp +++ b/mythtv/libs/libmythbase/mythsystemunix.cpp @@ -450,7 +450,7 @@ void MythSystemLegacyManager::append(MythSystemLegacyUnix *ms) if( ms->GetSetting("UseStdout") ) { - FDType_t *fdType = new FDType_t; + auto *fdType = new FDType_t; fdType->m_ms = ms; fdType->m_type = 1; fdLock.lock(); @@ -461,7 +461,7 @@ void MythSystemLegacyManager::append(MythSystemLegacyUnix *ms) if( ms->GetSetting("UseStderr") ) { - FDType_t *fdType = new FDType_t; + auto *fdType = new FDType_t; fdType->m_ms = ms; fdType->m_type = 2; fdLock.lock(); diff --git a/mythtv/libs/libmythbase/mythtimezone.cpp b/mythtv/libs/libmythbase/mythtimezone.cpp index f18f596bb75..708155a99f7 100644 --- a/mythtv/libs/libmythbase/mythtimezone.cpp +++ b/mythtv/libs/libmythbase/mythtimezone.cpp @@ -242,8 +242,7 @@ static QString getSystemTimeZoneID(void) // least get the zone name/abbreviation (as opposed to the // identifier for the set of rules governing the zone) char name[64]; - struct tm *result = (struct tm *)malloc(sizeof(*result)); - + auto *result = (struct tm *)malloc(sizeof(struct tm)); if (result != nullptr) { time_t t = time(nullptr); diff --git a/mythtv/libs/libmythbase/mythtranslation.cpp b/mythtv/libs/libmythbase/mythtranslation.cpp index 760878e1164..22991c7c998 100644 --- a/mythtv/libs/libmythbase/mythtranslation.cpp +++ b/mythtv/libs/libmythbase/mythtranslation.cpp @@ -55,7 +55,7 @@ void MythTranslation::load(const QString &module_name) lang = "en_us"; } - QTranslator *trans = new QTranslator(nullptr); + auto *trans = new QTranslator(nullptr); if (trans->load(GetTranslationsDir() + module_name + "_" + lang + ".qm", ".")) { diff --git a/mythtv/libs/libmythbase/platforms/mythpowerdbus.cpp b/mythtv/libs/libmythbase/platforms/mythpowerdbus.cpp index 15886950926..ce92f6185f7 100644 --- a/mythtv/libs/libmythbase/platforms/mythpowerdbus.cpp +++ b/mythtv/libs/libmythbase/platforms/mythpowerdbus.cpp @@ -46,9 +46,9 @@ bool MythPowerDBus::IsAvailable(void) if (!checked) { checked = true; - QDBusInterface* upower = new QDBusInterface( + auto* upower = new QDBusInterface( UPOWER_SERVICE, UPOWER_PATH, UPOWER_INTERFACE, QDBusConnection::systemBus()); - QDBusInterface* login1 = new QDBusInterface( + auto* login1 = new QDBusInterface( LOGIN1_SERVICE, LOGIN1_PATH, LOGIN1_INTERFACE, QDBusConnection::systemBus()); available = upower->isValid() || login1->isValid(); delete upower; @@ -297,7 +297,7 @@ bool MythPowerDBus::ScheduleFeature(enum Feature Type, uint Delay) struct timespec time {}; if (clock_gettime(CLOCK_REALTIME, &time) == 0) { - quint64 nanosecs = static_cast((time.tv_sec * 1000000000) + + auto nanosecs = static_cast((time.tv_sec * 1000000000) + time.tv_nsec + (Delay * 1000000000)); QLatin1String type; switch (Type) diff --git a/mythtv/libs/libmythbase/remotefile.cpp b/mythtv/libs/libmythbase/remotefile.cpp index b460d4216b3..d75a87ab35a 100644 --- a/mythtv/libs/libmythbase/remotefile.cpp +++ b/mythtv/libs/libmythbase/remotefile.cpp @@ -137,7 +137,7 @@ MythSocket *RemoteFile::openSocket(bool control) QString sgroup = qurl.userName(); - MythSocket *lsock = new MythSocket(); + auto *lsock = new MythSocket(); QString stype = (control) ? "control socket" : "file data socket"; QString loc = QString("RemoteFile::openSocket(%1): ").arg(stype); diff --git a/mythtv/libs/libmythbase/serverpool.cpp b/mythtv/libs/libmythbase/serverpool.cpp index 41abd46a649..379bbcb3f68 100644 --- a/mythtv/libs/libmythbase/serverpool.cpp +++ b/mythtv/libs/libmythbase/serverpool.cpp @@ -396,7 +396,7 @@ bool ServerPool::listen(QList addrs, quint16 port, && ! gCoreContext->GetBoolSetting("IPv6Support",true)) continue; - PrivTcpServer *server = new PrivTcpServer(this, servertype); + auto *server = new PrivTcpServer(this, servertype); connect(server, &PrivTcpServer::newConnection, this, &ServerPool::newTcpConnection); @@ -525,7 +525,7 @@ bool ServerPool::bind(QList addrs, quint16 port, } } - PrivUdpSocket *socket = new PrivUdpSocket(this, host); + auto *socket = new PrivUdpSocket(this, host); if (socket->bind(*it, port)) { @@ -631,11 +631,11 @@ void ServerPool::newTcpConnection(qt_socket_fd_t socket) { // Ignore connections from an SSL server for now, these are only handled // by HttpServer which overrides newTcpConnection - PrivTcpServer *server = dynamic_cast(QObject::sender()); + auto *server = dynamic_cast(QObject::sender()); if (!server || server->GetServerType() == kSSLServer) return; - QTcpSocket *qsock = new QTcpSocket(this); + auto *qsock = new QTcpSocket(this); if (qsock->setSocketDescriptor(socket) && gCoreContext->CheckSubnet(qsock)) { @@ -647,7 +647,7 @@ void ServerPool::newTcpConnection(qt_socket_fd_t socket) void ServerPool::newUdpDatagram(void) { - QUdpSocket *socket = dynamic_cast(sender()); + auto *socket = dynamic_cast(sender()); while (socket->state() == QAbstractSocket::BoundState && socket->hasPendingDatagrams()) diff --git a/mythtv/libs/libmythbase/test/test_mythsorthelper/test_mythsorthelper.cpp b/mythtv/libs/libmythbase/test/test_mythsorthelper/test_mythsorthelper.cpp index ac823b62c34..1d76ed6520f 100644 --- a/mythtv/libs/libmythbase/test/test_mythsorthelper/test_mythsorthelper.cpp +++ b/mythtv/libs/libmythbase/test/test_mythsorthelper/test_mythsorthelper.cpp @@ -56,10 +56,8 @@ void TestSortHelper::titles_timing(void) QFETCH(int, sensitive); QFETCH(int, disposition); QFETCH(QString, exclusions); - MythSortHelper *sh = - new MythSortHelper(static_cast(sensitive), - static_cast(disposition), - ""); + auto *sh = new MythSortHelper(static_cast(sensitive), + static_cast(disposition), ""); QBENCHMARK { QString title = sh->doTitle("The Flash"); } @@ -77,10 +75,8 @@ void TestSortHelper::pathnames_timing(void) QFETCH(int, disposition); QFETCH(QString, exclusions); - MythSortHelper *sh = - new MythSortHelper(static_cast(sensitive), - static_cast(disposition), - ""); + auto *sh = new MythSortHelper(static_cast(sensitive), + static_cast(disposition), ""); QBENCHMARK { QString title = sh->doPathname("dvds/The Flash/Season 2/The Flash - S02E01.ts"); } diff --git a/mythtv/libs/libmythbase/unzip.cpp b/mythtv/libs/libmythbase/unzip.cpp index 78ec227d40b..27047f7c6db 100644 --- a/mythtv/libs/libmythbase/unzip.cpp +++ b/mythtv/libs/libmythbase/unzip.cpp @@ -227,7 +227,7 @@ bool UnZip::isOpen() const */ UnZip::ErrorCode UnZip::openArchive(const QString& filename) { - QFile* file = new QFile(filename); + auto* file = new QFile(filename); if (!file->exists()) { delete file; @@ -924,7 +924,7 @@ UnZip::ErrorCode UnzipPrivate::parseCentralDirectoryRecord() QString filename = QString::fromLatin1(buffer2, szName); - ZipEntryP* h = new ZipEntryP; + auto* h = new ZipEntryP; h->compMethod = compMethod; h->gpFlag[0] = buffer1[UNZIP_CD_OFF_GPFLAG]; @@ -1245,7 +1245,7 @@ bool UnzipPrivate::createDirectory(const QString& path) */ quint32 UnzipPrivate::getULong(const unsigned char* data, quint32 offset) { - quint32 res = (quint32) data[offset]; + auto res = (quint32) data[offset]; res |= (((quint32)data[offset+1]) << 8); res |= (((quint32)data[offset+2]) << 16); res |= (((quint32)data[offset+3]) << 24); @@ -1258,7 +1258,7 @@ quint32 UnzipPrivate::getULong(const unsigned char* data, quint32 offset) */ quint64 UnzipPrivate::getULLong(const unsigned char* data, quint32 offset) { - quint64 res = (quint64) data[offset]; + auto res = (quint64) data[offset]; res |= (((quint64)data[offset+1]) << 8); res |= (((quint64)data[offset+2]) << 16); res |= (((quint64)data[offset+3]) << 24); diff --git a/mythtv/libs/libmythfreemheg/BaseClasses.cpp b/mythtv/libs/libmythfreemheg/BaseClasses.cpp index 1245c665392..50e63f8b11c 100644 --- a/mythtv/libs/libmythfreemheg/BaseClasses.cpp +++ b/mythtv/libs/libmythfreemheg/BaseClasses.cpp @@ -219,7 +219,7 @@ void MHOctetString::Append(const MHOctetString &str) int newLen = m_nLength + str.m_nLength; // Allocate a new string big enough to contain both and initialised to the first string. - unsigned char *p = (unsigned char *)realloc(m_pChars, newLen); + auto *p = (unsigned char *)realloc(m_pChars, newLen); if (p == nullptr) { diff --git a/mythtv/libs/libmythfreemheg/DynamicLineArt.cpp b/mythtv/libs/libmythfreemheg/DynamicLineArt.cpp index 55efaf6cf97..f8c5644f42b 100644 --- a/mythtv/libs/libmythfreemheg/DynamicLineArt.cpp +++ b/mythtv/libs/libmythfreemheg/DynamicLineArt.cpp @@ -184,7 +184,7 @@ void MHDrawPoly::Initialise(MHParseNode *p, MHEngine *engine) for (int i = 0; i < args->GetSeqCount(); i++) { - MHPointArg *pPoint = new MHPointArg; + auto *pPoint = new MHPointArg; m_Points.Append(pPoint); pPoint->Initialise(args->GetSeqN(i), engine); } diff --git a/mythtv/libs/libmythfreemheg/Engine.cpp b/mythtv/libs/libmythfreemheg/Engine.cpp index 246d86ef311..63c138c828e 100644 --- a/mythtv/libs/libmythfreemheg/Engine.cpp +++ b/mythtv/libs/libmythfreemheg/Engine.cpp @@ -48,7 +48,7 @@ MHEG *MHCreateEngine(MHContext *context) MHEngine::MHEngine(MHContext *context): m_Context(context) { // Required for BBC Freeview iPlayer - MHPSEntry *pEntry = new MHPSEntry; + auto *pEntry = new MHPSEntry; pEntry->m_FileName.Copy("ram://bbcipstr"); pEntry->m_Data.Append(new MHUnion(true)); // Default true // The next value must be true to enable Freeview interaction channel @@ -293,7 +293,7 @@ bool MHEngine::Launch(const MHObjectRef &target, bool fIsSpawn) return false; } - MHApplication *pProgram = dynamic_cast(ParseProgram(text)); + auto *pProgram = dynamic_cast(ParseProgram(text)); if (! pProgram) { MHLOG(MHLogWarning, "Empty application"); @@ -685,7 +685,7 @@ void MHEngine::EventTriggered(MHRoot *pSource, enum EventType ev, const MHUnion default: { // Asynchronous events. Add to the event queue. - MHAsynchEvent *pEvent = new MHAsynchEvent; + auto *pEvent = new MHAsynchEvent; pEvent->m_pEventSource = pSource; pEvent->m_eventType = ev; pEvent->m_eventData = evData; @@ -766,7 +766,7 @@ void MHEngine::BringToFront(const MHRoot *p) return; // If it's not there do nothing } - MHVisible *pVis = (MHVisible *)p; // Can now safely cast it. + auto *pVis = (MHVisible *)p; // Can now safely cast it. CurrentApp()->m_DisplayStack.RemoveAt(nPos); // Remove it from its present posn CurrentApp()->m_DisplayStack.Append(pVis); // Push it on the top. Redraw(pVis->GetVisibleArea()); // Request a redraw @@ -781,7 +781,7 @@ void MHEngine::SendToBack(const MHRoot *p) return; // If it's not there do nothing } - MHVisible *pVis = (MHVisible *)p; // Can now safely cast it. + auto *pVis = (MHVisible *)p; // Can now safely cast it. CurrentApp()->m_DisplayStack.RemoveAt(nPos); // Remove it from its present posn CurrentApp()->m_DisplayStack.InsertAt(pVis, 0); // Put it on the bottom. Redraw(pVis->GetVisibleArea()); // Request a redraw @@ -796,7 +796,7 @@ void MHEngine::PutBefore(const MHRoot *p, const MHRoot *pRef) return; // If it's not there do nothing } - MHVisible *pVis = (MHVisible *)p; // Can now safely cast it. + auto *pVis = (MHVisible *)p; // Can now safely cast it. int nRef = CurrentApp()->FindOnStack(pRef); if (nRef == -1) @@ -834,7 +834,7 @@ void MHEngine::PutBehind(const MHRoot *p, const MHRoot *pRef) return; // If the reference visible isn't there do nothing. } - MHVisible *pVis = (MHVisible *)p; // Can now safely cast it. + auto *pVis = (MHVisible *)p; // Can now safely cast it. CurrentApp()->m_DisplayStack.RemoveAt(nPos); if (nRef >= nPos) @@ -1016,7 +1016,7 @@ void MHEngine::RequestExternalContent(MHIngredient *pRequester) // Need to record this and check later. MHLOG(MHLogNotifications, QString("Waiting for %1 <= %2") .arg(pRequester->m_ObjectReference.Printable()).arg(csPath.left(128)) ); - MHExternContent *pContent = new MHExternContent; + auto *pContent = new MHExternContent; pContent->m_FileName = csPath; pContent->m_pRequester = pRequester; pContent->m_time.start(); @@ -1173,7 +1173,7 @@ bool MHEngine::LoadStorePersistent(bool fIsLoad, const MHOctetString &fileName, // Set the store to the values. for (i = 0; i < variables.Size(); i++) { - MHUnion *pValue = new MHUnion; + auto *pValue = new MHUnion; pEntry->m_Data.Append(pValue); FindObject(*(variables.GetAt(i)))->GetVariableValue(*pValue, this); MHLOG(MHLogNotifications, QString("Store Persistent(%1) %2=>#%3") diff --git a/mythtv/libs/libmythfreemheg/Groups.cpp b/mythtv/libs/libmythfreemheg/Groups.cpp index 9cfc5ebb1c8..d34dbd31a4d 100644 --- a/mythtv/libs/libmythfreemheg/Groups.cpp +++ b/mythtv/libs/libmythfreemheg/Groups.cpp @@ -371,7 +371,7 @@ void MHGroup::SetTimer(int nTimerId, bool fAbsolute, int nMilliSecs, MHEngine * return; } - MHTimer *pTimer = new MHTimer; + auto *pTimer = new MHTimer; m_Timers.append(pTimer); pTimer->m_nTimerId = nTimerId; @@ -920,7 +920,7 @@ void MHPersistent::Initialise(MHParseNode *p, MHEngine *engine) for (int i = 0; i < pVarSeq->GetSeqCount(); i++) { - MHObjectRef *pVar = new MHObjectRef; + auto *pVar = new MHObjectRef; m_Variables.Append(pVar); pVar->Initialise(pVarSeq->GetSeqN(i), engine); } diff --git a/mythtv/libs/libmythfreemheg/ParseBinary.cpp b/mythtv/libs/libmythfreemheg/ParseBinary.cpp index 1a1a702d222..e4e58e82ed8 100644 --- a/mythtv/libs/libmythfreemheg/ParseBinary.cpp +++ b/mythtv/libs/libmythfreemheg/ParseBinary.cpp @@ -58,7 +58,7 @@ void MHParseBinary::ParseString(int endStr, MHOctetString &str) } int nLength = endStr - m_p; - unsigned char *stringValue = (unsigned char *)malloc(nLength + 1); + auto *stringValue = (unsigned char *)malloc(nLength + 1); if (stringValue == nullptr) { MHERROR("Out of memory"); @@ -181,7 +181,7 @@ MHParseNode *MHParseBinary::DoParse() if (tagClass == Context) { - MHPTagged *pNode = new MHPTagged(tagNumber); + auto *pNode = new MHPTagged(tagNumber); try { @@ -343,7 +343,7 @@ MHParseNode *MHParseBinary::DoParse() } case U_SEQUENCE: // Sequence { - MHParseSequence *pNode = new MHParseSequence(); + auto *pNode = new MHParseSequence(); if (endOfItem == INDEFINITE_LENGTH) { diff --git a/mythtv/libs/libmythfreemheg/ParseNode.cpp b/mythtv/libs/libmythfreemheg/ParseNode.cpp index 98e2c52c96f..71f08b5b665 100644 --- a/mythtv/libs/libmythfreemheg/ParseNode.cpp +++ b/mythtv/libs/libmythfreemheg/ParseNode.cpp @@ -61,12 +61,12 @@ int MHParseNode::GetArgCount() { if (m_nNodeType == PNTagged) { - MHPTagged *pTag = (MHPTagged *)this; + auto *pTag = (MHPTagged *)this; return pTag->m_Args.Size(); } if (m_nNodeType == PNSeq) { - MHParseSequence *pSeq = (MHParseSequence *)this; + auto *pSeq = (MHParseSequence *)this; return pSeq->Size(); } @@ -79,7 +79,7 @@ MHParseNode *MHParseNode::GetArgN(int n) { if (m_nNodeType == PNTagged) { - MHPTagged *pTag = (MHPTagged *)this; + auto *pTag = (MHPTagged *)this; if (n < 0 || n >= pTag->m_Args.Size()) { @@ -90,7 +90,7 @@ MHParseNode *MHParseNode::GetArgN(int n) } if (m_nNodeType == PNSeq) { - MHParseSequence *pSeq = (MHParseSequence *)this; + auto *pSeq = (MHParseSequence *)this; if (n < 0 || n >= pSeq->Size()) { @@ -145,7 +145,7 @@ int MHParseNode::GetSeqCount() Failure("Expected sequence"); } - MHParseSequence *pSeq = (MHParseSequence *)this; + auto *pSeq = (MHParseSequence *)this; return pSeq->Size(); } @@ -156,7 +156,7 @@ MHParseNode *MHParseNode::GetSeqN(int n) Failure("Expected sequence"); } - MHParseSequence *pSeq = (MHParseSequence *)this; + auto *pSeq = (MHParseSequence *)this; if (n < 0 || n >= pSeq->Size()) { diff --git a/mythtv/libs/libmythfreemheg/ParseText.cpp b/mythtv/libs/libmythfreemheg/ParseText.cpp index d4b82cd205e..88c6c9aa205 100644 --- a/mythtv/libs/libmythfreemheg/ParseText.cpp +++ b/mythtv/libs/libmythfreemheg/ParseText.cpp @@ -466,7 +466,7 @@ void MHParseText::NextSym() } // We grow the buffer to the largest string in the input. - unsigned char *str = (unsigned char *)realloc(m_String, m_nStringLength + 2); + auto *str = (unsigned char *)realloc(m_String, m_nStringLength + 2); if (str == nullptr) { @@ -568,7 +568,7 @@ void MHParseText::NextSym() } // We grow the buffer to the largest string in the input. - unsigned char *str = (unsigned char *)realloc(m_String, m_nStringLength + 2); + auto *str = (unsigned char *)realloc(m_String, m_nStringLength + 2); if (str == nullptr) { @@ -785,7 +785,7 @@ void MHParseText::NextSym() if (stricmp(buff, colourTable[i].m_name) == 0) { m_nType = PTString; - unsigned char *str = (unsigned char *)realloc(m_String, 4 + 1); + auto *str = (unsigned char *)realloc(m_String, 4 + 1); if (str == nullptr) { @@ -858,7 +858,7 @@ MHParseNode *MHParseText::DoParse() Error("Expected ':' after '{'"); } - MHPTagged *pTag = new MHPTagged(m_nTag); + auto *pTag = new MHPTagged(m_nTag); pRes = pTag; NextSym(); @@ -874,7 +874,7 @@ MHParseNode *MHParseText::DoParse() case PTTag: // Tag on its own. { int nTag = m_nTag; - MHPTagged *pTag = new MHPTagged(nTag); + auto *pTag = new MHPTagged(nTag); pRes = pTag; NextSym(); @@ -1081,7 +1081,7 @@ MHParseNode *MHParseText::DoParse() case PTStartSeq: // Open parenthesis. { - MHParseSequence *pSeq = new MHParseSequence; + auto *pSeq = new MHParseSequence; pRes = pSeq; NextSym(); diff --git a/mythtv/libs/libmythfreemheg/Programs.cpp b/mythtv/libs/libmythfreemheg/Programs.cpp index 453a0c20ef1..fa9132669fb 100644 --- a/mythtv/libs/libmythfreemheg/Programs.cpp +++ b/mythtv/libs/libmythfreemheg/Programs.cpp @@ -1071,7 +1071,7 @@ void MHCall::Initialise(MHParseNode *p, MHEngine *engine) for (int i = 0; i < args->GetSeqCount(); i++) { - MHParameter *pParm = new MHParameter; + auto *pParm = new MHParameter; m_Parameters.Append(pParm); pParm->Initialise(args->GetSeqN(i), engine); } diff --git a/mythtv/libs/libmythfreemheg/Stream.cpp b/mythtv/libs/libmythfreemheg/Stream.cpp index 83a05fc0de7..1218512bcef 100644 --- a/mythtv/libs/libmythfreemheg/Stream.cpp +++ b/mythtv/libs/libmythfreemheg/Stream.cpp @@ -43,19 +43,19 @@ void MHStream::Initialise(MHParseNode *p, MHEngine *engine) if (pItem->GetTagNo() == C_AUDIO) { - MHAudio *pAudio = new MHAudio; + auto *pAudio = new MHAudio; m_Multiplex.Append(pAudio); pAudio->Initialise(pItem, engine); } else if (pItem->GetTagNo() == C_VIDEO) { - MHVideo *pVideo = new MHVideo; + auto *pVideo = new MHVideo; m_Multiplex.Append(pVideo); pVideo->Initialise(pItem, engine); } else if (pItem->GetTagNo() == C_RTGRAPHICS) { - MHRTGraphics *pRtGraph = new MHRTGraphics; + auto *pRtGraph = new MHRTGraphics; m_Multiplex.Append(pRtGraph); pRtGraph->Initialise(pItem, engine); } diff --git a/mythtv/libs/libmythfreemheg/Text.cpp b/mythtv/libs/libmythfreemheg/Text.cpp index b15dbed0586..15a494d4d9b 100644 --- a/mythtv/libs/libmythfreemheg/Text.cpp +++ b/mythtv/libs/libmythfreemheg/Text.cpp @@ -491,7 +491,7 @@ MHTextItem::MHTextItem() MHTextItem *MHTextItem::NewItem() { - MHTextItem *pItem = new MHTextItem; + auto *pItem = new MHTextItem; pItem->m_colour = m_colour; return pItem; } @@ -555,8 +555,8 @@ void MHText::Redraw() // Process any escapes in the text and construct the text arrays. MHSequence theText; // Set up the first item on the first line. - MHTextItem *pCurrItem = new MHTextItem; - MHTextLine *pCurrLine = new MHTextLine; + auto *pCurrItem = new MHTextItem; + auto *pCurrLine = new MHTextLine; pCurrLine->m_items.Append(pCurrItem); theText.Append(pCurrLine); MHStack colourStack; // Stack to handle nested colour codes. @@ -745,7 +745,7 @@ void MHText::Redraw() if (nNewWidth != 0) { // Create a new line from the extra text. - MHTextLine *pNewLine = new MHTextLine; + auto *pNewLine = new MHTextLine; theText.InsertAt(pNewLine, i + 1); // The first item on the new line is the rest of the text. MHTextItem *pNewItem = pItem->NewItem(); diff --git a/mythtv/libs/libmythfreemheg/TokenGroup.cpp b/mythtv/libs/libmythfreemheg/TokenGroup.cpp index 3a980dcc22b..0d8da5f2ea9 100644 --- a/mythtv/libs/libmythfreemheg/TokenGroup.cpp +++ b/mythtv/libs/libmythfreemheg/TokenGroup.cpp @@ -41,7 +41,7 @@ void MHTokenGroupItem::Initialise(MHParseNode *p, MHEngine *engine) for (int i = 0; i < pSlots->GetSeqCount(); i++) { MHParseNode *pAct = pSlots->GetSeqN(i); - MHActionSequence *pActions = new MHActionSequence; + auto *pActions = new MHActionSequence; m_ActionSlots.Append(pActions); // The action slot entry may be NULL. @@ -123,7 +123,7 @@ void MHTokenGroup::Initialise(MHParseNode *p, MHEngine *engine) { for (int i = 0; i < pMovements->GetArgCount(); i++) { - MHMovement *pMove = new MHMovement; + auto *pMove = new MHMovement; m_MovementTable.Append(pMove); pMove->Initialise(pMovements->GetArgN(i), engine); } @@ -135,7 +135,7 @@ void MHTokenGroup::Initialise(MHParseNode *p, MHEngine *engine) { for (int i = 0; i < pTokenGrp->GetArgCount(); i++) { - MHTokenGroupItem *pToken = new MHTokenGroupItem; + auto *pToken = new MHTokenGroupItem; m_TokenGrpItems.Append(pToken); pToken->Initialise(pTokenGrp->GetArgN(i), engine); } @@ -148,7 +148,7 @@ void MHTokenGroup::Initialise(MHParseNode *p, MHEngine *engine) for (int i = 0; i < pNoToken->GetArgCount(); i++) { MHParseNode *pAct = pNoToken->GetArgN(i); - MHActionSequence *pActions = new MHActionSequence; + auto *pActions = new MHActionSequence; m_NoTokenActionSlots.Append(pActions); // The action slot entry may be NULL. diff --git a/mythtv/libs/libmythfreesurround/freesurround.cpp b/mythtv/libs/libmythfreesurround/freesurround.cpp index 3d1f096871d..78da10a6965 100644 --- a/mythtv/libs/libmythfreesurround/freesurround.cpp +++ b/mythtv/libs/libmythfreesurround/freesurround.cpp @@ -163,7 +163,7 @@ uint FreeSurround::putFrames(void* buffer, uint numFrames, uint numChannels) int ic = in_count; int bs = block_size/2; bool process = true; - float *samples = (float *)buffer; + auto *samples = (float *)buffer; // demultiplex float **inputs = decoder->getInputBuffers(); @@ -327,7 +327,7 @@ uint FreeSurround::receiveFrames(void *buffer, uint maxFrames) uint oc = out_count; if (maxFrames > oc) maxFrames = oc; uint outindex = processed_size - oc; - float *output = (float *)buffer; + auto *output = (float *)buffer; if (channels == 8) { float *l = &bufs->m_l[outindex]; diff --git a/mythtv/libs/libmythmetadata/cleanup.cpp b/mythtv/libs/libmythmetadata/cleanup.cpp index e31c0147b15..7b88ab821f8 100644 --- a/mythtv/libs/libmythmetadata/cleanup.cpp +++ b/mythtv/libs/libmythmetadata/cleanup.cpp @@ -19,8 +19,7 @@ class CleanupHooksImp void removeHook(CleanupProc *clean_proc) { - clean_list::iterator p = std::find(m_cleanList.begin(), - m_cleanList.end(), clean_proc); + auto p = std::find(m_cleanList.begin(), m_cleanList.end(), clean_proc); if (p != m_cleanList.end()) { m_cleanList.erase(p); @@ -29,8 +28,7 @@ class CleanupHooksImp void cleanup() { - for (clean_list::iterator p = m_cleanList.begin(); - p != m_cleanList.end();++p) + for (auto p = m_cleanList.begin(); p != m_cleanList.end(); ++p) { (*p)->doClean(); } diff --git a/mythtv/libs/libmythmetadata/dbaccess.cpp b/mythtv/libs/libmythmetadata/dbaccess.cpp index 5b7c5316cba..3dee3d68d59 100644 --- a/mythtv/libs/libmythmetadata/dbaccess.cpp +++ b/mythtv/libs/libmythmetadata/dbaccess.cpp @@ -97,7 +97,7 @@ class SingleValueImp void remove(int id) { - entry_map::iterator p = m_entries.find(id); + auto p = m_entries.find(id); if (p != m_entries.end()) { MSqlQuery query(MSqlQuery::InitCon()); @@ -164,8 +164,7 @@ class SingleValueImp private: entry_map::iterator find(const QString &name) { - for (entry_map::iterator p = m_entries.begin(); - p != m_entries.end(); ++p) + for (auto p = m_entries.begin(); p != m_entries.end(); ++p) { if (p->second == name) return p; @@ -291,12 +290,11 @@ class MultiValueImp int add(int id, int value) { bool db_insert = false; - id_map::iterator p = m_valMap.find(id); + auto p = m_valMap.find(id); if (p != m_valMap.end()) { entry::values_type &va = p->second.values; - entry::values_type::iterator v = - std::find(va.begin(), va.end(), value); + auto v = std::find(va.begin(), va.end(), value); if (v == va.end()) { va.push_back(value); @@ -327,7 +325,7 @@ class MultiValueImp bool get(int id, entry &values) { - id_map::iterator p = m_valMap.find(id); + auto p = m_valMap.find(id); if (p != m_valMap.end()) { values = p->second; @@ -338,12 +336,11 @@ class MultiValueImp void remove(int id, int value) { - id_map::iterator p = m_valMap.find(id); + auto 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(), - value); + auto vp = std::find(p->second.values.begin(), + p->second.values.end(), value); if (vp != p->second.values.end()) { MSqlQuery query(MSqlQuery::InitCon()); @@ -364,7 +361,7 @@ class MultiValueImp void remove(int id) { - id_map::iterator p = m_valMap.find(id); + auto p = m_valMap.find(id); if (p != m_valMap.end()) { MSqlQuery query(MSqlQuery::InitCon()); @@ -382,10 +379,10 @@ class MultiValueImp bool exists(int id, int value) { - id_map::iterator p = m_valMap.find(id); + auto p = m_valMap.find(id); if (p != m_valMap.end()) { - entry::values_type::iterator vp = + auto vp = std::find(p->second.values.begin(), p->second.values.end(), value); return vp != p->second.values.end(); @@ -407,7 +404,7 @@ class MultiValueImp if (query.exec(m_fillSql) && query.size() > 0) { - id_map::iterator p = m_valMap.end(); + auto p = m_valMap.end(); while (query.next()) { int id = query.value(0).toInt(); @@ -600,7 +597,7 @@ class FileAssociationsImp file_association *existing_fa = nullptr; MSqlQuery query(MSqlQuery::InitCon()); - association_list::iterator p = find(ret_fa.extension); + auto p = find(ret_fa.extension); if (p != m_fileAssociations.end()) { ret_fa.id = p->id; @@ -667,7 +664,7 @@ class FileAssociationsImp bool remove(unsigned int id) { - association_list::iterator p = find(id); + auto p = find(id); if (p != m_fileAssociations.end()) { MSqlQuery query(MSqlQuery::InitCon()); @@ -690,7 +687,7 @@ class FileAssociationsImp void getExtensionIgnoreList(ext_ignore_list &ext_ignore) const { for (association_list::const_iterator p = m_fileAssociations.begin(); - p != m_fileAssociations.end(); ++p) + p != m_fileAssociations.cend(); ++p) { ext_ignore.push_back(std::make_pair(p->extension, p->ignore)); } @@ -735,7 +732,7 @@ class FileAssociationsImp association_list::iterator find(const QString &ext) { - for (association_list::iterator p = m_fileAssociations.begin(); + for (auto p = m_fileAssociations.begin(); p != m_fileAssociations.end(); ++p) { if (p->extension.length() == ext.length() && @@ -749,7 +746,7 @@ class FileAssociationsImp association_list::iterator find(unsigned int id) { - for (association_list::iterator p = m_fileAssociations.begin(); + for (auto p = m_fileAssociations.begin(); p != m_fileAssociations.end(); ++p) { if (p->id == id) return p; @@ -759,8 +756,8 @@ class FileAssociationsImp association_list::const_iterator find(const QString &ext) const { - for (association_list::const_iterator p = m_fileAssociations.begin(); - p != m_fileAssociations.end(); ++p) + for (auto p = m_fileAssociations.cbegin(); + p != m_fileAssociations.cend(); ++p) { if (p->extension.length() == ext.length() && ext.indexOf(p->extension) == 0) @@ -773,8 +770,8 @@ class FileAssociationsImp association_list::const_iterator find(unsigned int id) const { - for (association_list::const_iterator p = m_fileAssociations.begin(); - p != m_fileAssociations.end(); ++p) + for (auto p = m_fileAssociations.cbegin(); + p != m_fileAssociations.cend(); ++p) { if (p->id == id) return p; } diff --git a/mythtv/libs/libmythmetadata/dirscan.cpp b/mythtv/libs/libmythmetadata/dirscan.cpp index 8239318b1cb..c473fcf0097 100644 --- a/mythtv/libs/libmythmetadata/dirscan.cpp +++ b/mythtv/libs/libmythmetadata/dirscan.cpp @@ -25,8 +25,8 @@ namespace ext_lookup(const FileAssociations::ext_ignore_list &ext_disposition, bool list_unknown) : m_listUnknown(list_unknown) { - for (FileAssociations::ext_ignore_list::const_iterator p = - ext_disposition.begin(); p != ext_disposition.end(); ++p) + for (auto p = ext_disposition.cbegin(); + p != ext_disposition.cend(); ++p) { m_extensions.insert(ext_map::value_type(p->first.toLower(), p->second)); diff --git a/mythtv/libs/libmythmetadata/imagemanager.cpp b/mythtv/libs/libmythmetadata/imagemanager.cpp index 5e32cab6821..470792226cf 100644 --- a/mythtv/libs/libmythmetadata/imagemanager.cpp +++ b/mythtv/libs/libmythmetadata/imagemanager.cpp @@ -315,8 +315,7 @@ QStringList ImageAdapterBase::SupportedVideos() QStringList formats; const FileAssociations::association_list faList = FileAssociations::getFileAssociation().getList(); - for (FileAssociations::association_list::const_iterator p = - faList.begin(); p != faList.end(); ++p) + for (auto p = faList.cbegin(); p != faList.cend(); ++p) { if (!p->use_default && p->playcommand == "Internal") formats << QString(p->extension); @@ -336,7 +335,7 @@ QStringList ImageAdapterBase::SupportedVideos() ImageItem *ImageAdapterLocal::CreateItem(const QFileInfo &fi, int parentId, int devId, const QString & /*base*/) const { - ImageItem *im = new ImageItem(); + auto *im = new ImageItem(); im->m_parentId = parentId; im->m_device = devId; @@ -411,7 +410,7 @@ void ImageAdapterLocal::Notify(const QString &mesg, ImageItem *ImageAdapterSg::CreateItem(const QFileInfo &fi, int parentId, int /*devId*/, const QString &base) const { - ImageItem *im = new ImageItem(); + auto *im = new ImageItem(); im->m_device = 0; im->m_parentId = parentId; @@ -513,7 +512,7 @@ QString ImageAdapterSg::GetAbsFilePath(const ImagePtrK &im) const template ImageItem *ImageDb::CreateImage(const MSqlQuery &query) const { - ImageItem *im = new ImageItem(FS::ImageId(query.value(0).toInt())); + auto *im = new ImageItem(FS::ImageId(query.value(0).toInt())); // Ordered as per DB_COLUMNS im->m_filePath = query.value(1).toString(); @@ -1191,7 +1190,7 @@ QStringList ImageHandler::HandleGetMetadata(const QString &id) const RESULT_ERR("Image not found", QString("File %1 not found").arg(im->m_filePath)) - ReadMetaThread *worker = new ReadMetaThread(im, absPath); + auto *worker = new ReadMetaThread(im, absPath); MThreadPool::globalInstance()->start(worker, "ImageMetaData"); @@ -2500,7 +2499,7 @@ void ImageManagerFe::DeviceEvent(MythMediaEvent *event) QString ImageManagerFe::CreateImport() { - QTemporaryDir *tmp = new QTemporaryDir(QDir::tempPath() % "/" IMPORTDIR "-XXXXXX"); + auto *tmp = new QTemporaryDir(QDir::tempPath() % "/" IMPORTDIR "-XXXXXX"); if (!tmp->isValid()) { delete tmp; diff --git a/mythtv/libs/libmythmetadata/imagemetadata.cpp b/mythtv/libs/libmythmetadata/imagemetadata.cpp index c58d4bd0ed0..1ad7ad49304 100644 --- a/mythtv/libs/libmythmetadata/imagemetadata.cpp +++ b/mythtv/libs/libmythmetadata/imagemetadata.cpp @@ -400,7 +400,7 @@ std::string PictureMetaData::GetTag(const QString &key, bool *exists) return value; Exiv2::ExifKey exifKey = Exiv2::ExifKey(key.toStdString()); - Exiv2::ExifData::iterator exifIt = m_exifData.findKey(exifKey); + auto exifIt = m_exifData.findKey(exifKey); if (exifIt == m_exifData.end()) return value; diff --git a/mythtv/libs/libmythmetadata/lyricsdata.cpp b/mythtv/libs/libmythmetadata/lyricsdata.cpp index 9cd12e054b9..8913ff10fb3 100644 --- a/mythtv/libs/libmythmetadata/lyricsdata.cpp +++ b/mythtv/libs/libmythmetadata/lyricsdata.cpp @@ -183,7 +183,7 @@ void LyricsData::customEvent(QEvent *event) { if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = dynamic_cast(event); + auto *me = dynamic_cast(event); if (!me) return; @@ -317,7 +317,7 @@ void LyricsData::setLyrics(const QStringList &lyrics) { QString lyric = lyrics.at(x); - LyricsLine *line = new LyricsLine; + auto *line = new LyricsLine; if (lyric.startsWith("[offset:")) { diff --git a/mythtv/libs/libmythmetadata/metadatacommon.cpp b/mythtv/libs/libmythmetadata/metadatacommon.cpp index c627509ad65..e7d3745f871 100644 --- a/mythtv/libs/libmythmetadata/metadatacommon.cpp +++ b/mythtv/libs/libmythmetadata/metadatacommon.cpp @@ -412,7 +412,7 @@ MetadataLookup* LookupFromProgramInfo(ProgramInfo *pginfo) .secsTo(pginfo->GetRecordingEndTime()); uint runtime = (runtimesecs/60); - MetadataLookup *ret = new MetadataLookup(kMetadataRecording, kUnknownVideo, + auto *ret = new MetadataLookup(kMetadataRecording, kUnknownVideo, qVariantFromValue(pginfo), kLookupData, false, false, false, false, false, pginfo->GetHostname(),pginfo->GetBasename(),pginfo->GetTitle(), QStringList() << pginfo->GetCategory(), pginfo->GetStars() * 10, diff --git a/mythtv/libs/libmythmetadata/metadatadownload.cpp b/mythtv/libs/libmythmetadata/metadatadownload.cpp index 75443c07531..d95c2774937 100644 --- a/mythtv/libs/libmythmetadata/metadatadownload.cpp +++ b/mythtv/libs/libmythmetadata/metadatadownload.cpp @@ -442,7 +442,7 @@ MetadataLookupList MetadataDownload::readMXML(const QString& MXMLpath, { QByteArray mxmlraw; QDomElement item; - RemoteFile *rf = new RemoteFile(MXMLpath); + auto *rf = new RemoteFile(MXMLpath); if (rf->isOpen()) { @@ -491,7 +491,7 @@ MetadataLookupList MetadataDownload::readNFO(const QString& NFOpath, { QByteArray nforaw; QDomElement item; - RemoteFile *rf = new RemoteFile(NFOpath); + auto *rf = new RemoteFile(NFOpath); if (rf->isOpen()) { diff --git a/mythtv/libs/libmythmetadata/metadatafactory.cpp b/mythtv/libs/libmythmetadata/metadatafactory.cpp index 0a0f61f4428..8faa60388e7 100644 --- a/mythtv/libs/libmythmetadata/metadatafactory.cpp +++ b/mythtv/libs/libmythmetadata/metadatafactory.cpp @@ -87,7 +87,7 @@ void MetadataFactory::Lookup(RecordingRule *recrule, bool automatic, if (!recrule) return; - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetStep(kLookupSearch); lookup->SetType(kMetadataRecording); @@ -115,7 +115,7 @@ void MetadataFactory::Lookup(ProgramInfo *pginfo, bool automatic, if (!pginfo) return; - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetStep(kLookupSearch); lookup->SetType(kMetadataRecording); @@ -143,7 +143,7 @@ void MetadataFactory::Lookup(VideoMetadata *metadata, bool automatic, if (!metadata) return; - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetStep(kLookupSearch); lookup->SetType(kMetadataVideo); @@ -186,7 +186,7 @@ META_PUBLIC MetadataLookupList MetadataFactory::SynchronousLookup(const QString& const QString& grabber, bool allowgeneric) { - MetadataLookup *lookup = new MetadataLookup(); + auto *lookup = new MetadataLookup(); lookup->SetStep(kLookupSearch); lookup->SetType(kMetadataRecording); @@ -362,7 +362,7 @@ void MetadataFactory::OnVideoResult(MetadataLookup *lookup) if (!lookup) return; - VideoMetadata *metadata = lookup->GetData().value(); + auto *metadata = lookup->GetData().value(); if (!metadata) return; @@ -551,7 +551,7 @@ void MetadataFactory::customEvent(QEvent *levent) } else if (levent->type() == ImageDLEvent::kEventType) { - ImageDLEvent *ide = dynamic_cast(levent); + auto *ide = dynamic_cast(levent); if (ide == nullptr) return; @@ -566,7 +566,7 @@ void MetadataFactory::customEvent(QEvent *levent) } else if (levent->type() == ImageDLFailureEvent::kEventType) { - ImageDLFailureEvent *ide = dynamic_cast(levent); + auto *ide = dynamic_cast(levent); if (ide == nullptr) return; @@ -581,7 +581,7 @@ void MetadataFactory::customEvent(QEvent *levent) } else if (levent->type() == VideoScanChanges::kEventType) { - VideoScanChanges *vsc = dynamic_cast(levent); + auto *vsc = dynamic_cast(levent); if (!vsc) return; @@ -658,7 +658,7 @@ LookupType GuessLookupType(ProgramInfo *pginfo) // recording have an inetref, season, episode, or // subtitle, it's *probably* a movie. If it's some // weird combination of both, we've got to try everything. - RecordingRule *rule = new RecordingRule(); + auto *rule = new RecordingRule(); rule->m_recordID = pginfo->GetRecordingRuleID(); rule->Load(); int ruleepisode = rule->m_episode; diff --git a/mythtv/libs/libmythmetadata/metadataimagedownload.cpp b/mythtv/libs/libmythmetadata/metadataimagedownload.cpp index 3f7ba81c981..a8ce2ad5169 100644 --- a/mythtv/libs/libmythmetadata/metadataimagedownload.cpp +++ b/mythtv/libs/libmythmetadata/metadataimagedownload.cpp @@ -37,7 +37,7 @@ void MetadataImageDownload::addThumb(QString title, { QMutexLocker lock(&m_mutex); - ThumbnailData *id = new ThumbnailData(); + auto *id = new ThumbnailData(); id->title = std::move(title); id->data = std::move(data); id->url = std::move(url); diff --git a/mythtv/libs/libmythmetadata/metaio.cpp b/mythtv/libs/libmythmetadata/metaio.cpp index 00efc6a757e..5a77fcd7a56 100644 --- a/mythtv/libs/libmythmetadata/metaio.cpp +++ b/mythtv/libs/libmythmetadata/metaio.cpp @@ -46,7 +46,7 @@ MetaIO* MetaIO::createTagger(const QString& filename) return new MetaIOOggVorbis; if (extension == "flac") { - MetaIOFLACVorbis *tagger = new MetaIOFLACVorbis; + auto *tagger = new MetaIOFLACVorbis; if (tagger->TagExists(filename)) return tagger; delete tagger; @@ -175,8 +175,8 @@ MusicMetadata* MetaIO::readFromFilename(const QString &filename, bool blnLength) if (blnLength) length = getTrackLength(filename); - MusicMetadata *retdata = new MusicMetadata(filename, artist, "", album, - title, genre, 0, tracknum, length); + auto *retdata = new MusicMetadata(filename, artist, "", album, title, genre, + 0, tracknum, length); return retdata; } diff --git a/mythtv/libs/libmythmetadata/metaioavfcomment.cpp b/mythtv/libs/libmythmetadata/metaioavfcomment.cpp index 9245601f2f5..0c1167103ec 100644 --- a/mythtv/libs/libmythmetadata/metaioavfcomment.cpp +++ b/mythtv/libs/libmythmetadata/metaioavfcomment.cpp @@ -75,7 +75,7 @@ MusicMetadata* MetaIOAVFComment::read(const QString &filename) length = getTrackLength(p_context); - MusicMetadata *retdata = new MusicMetadata(filename, artist, compilation_artist, album, + auto *retdata = new MusicMetadata(filename, artist, compilation_artist, album, title, genre, year, tracknum, length); retdata->determineIfCompilation(); diff --git a/mythtv/libs/libmythmetadata/metaioflacvorbis.cpp b/mythtv/libs/libmythmetadata/metaioflacvorbis.cpp index 3e22513ee8a..a0d26dbc361 100644 --- a/mythtv/libs/libmythmetadata/metaioflacvorbis.cpp +++ b/mythtv/libs/libmythmetadata/metaioflacvorbis.cpp @@ -22,8 +22,7 @@ TagLib::FLAC::File *MetaIOFLACVorbis::OpenFile(const QString &filename) { QByteArray fname = filename.toLocal8Bit(); - TagLib::FLAC::File *flacfile = - new TagLib::FLAC::File(fname.constData()); + auto *flacfile = new TagLib::FLAC::File(fname.constData()); if (!flacfile->isOpen()) { @@ -110,7 +109,7 @@ MusicMetadata* MetaIOFLACVorbis::read(const QString &filename) return nullptr; } - MusicMetadata *metadata = new MusicMetadata(filename); + auto *metadata = new MusicMetadata(filename); ReadGenericMetadata(tag, metadata); @@ -154,7 +153,7 @@ MusicMetadata* MetaIOFLACVorbis::read(const QString &filename) */ QImage* MetaIOFLACVorbis::getAlbumArt(const QString &filename, ImageType type) { - QImage *picture = new QImage(); + auto *picture = new QImage(); TagLib::FLAC::File * flacfile = OpenFile(filename); if (flacfile) @@ -252,8 +251,7 @@ AlbumArtList MetaIOFLACVorbis::getAlbumArtList(const QString &filename) { const TagLib::List& picList = flacfile->pictureList(); - for(TagLib::List::ConstIterator it = picList.begin(); - it != picList.end(); it++) + for(auto it = picList.begin(); it != picList.end(); it++) { Picture* pic = *it; // Assume a valid image would have at least @@ -266,7 +264,7 @@ AlbumArtList MetaIOFLACVorbis::getAlbumArtList(const QString &filename) continue; } - AlbumArtImage *art = new AlbumArtImage(); + auto *art = new AlbumArtImage(); if (pic->description().isEmpty()) art->m_description.clear(); diff --git a/mythtv/libs/libmythmetadata/metaioid3.cpp b/mythtv/libs/libmythmetadata/metaioid3.cpp index 1f94f4297b8..aa336d231ae 100644 --- a/mythtv/libs/libmythmetadata/metaioid3.cpp +++ b/mythtv/libs/libmythmetadata/metaioid3.cpp @@ -249,7 +249,7 @@ MusicMetadata *MetaIOID3::read(const QString &filename) } } - MusicMetadata *metadata = new MusicMetadata(filename); + auto *metadata = new MusicMetadata(filename); ReadGenericMetadata(tag, metadata); @@ -387,7 +387,7 @@ MusicMetadata *MetaIOID3::read(const QString &filename) */ QImage* MetaIOID3::getAlbumArt(const QString &filename, ImageType type) { - QImage *picture = new QImage(); + auto *picture = new QImage(); AttachedPictureFrame::Type apicType = AttachedPictureFrame::FrontCover; @@ -423,11 +423,9 @@ QImage* MetaIOID3::getAlbumArt(const QString &filename, ImageType type) { TagLib::ID3v2::FrameList apicframes = tag->frameListMap()["APIC"]; - for(TagLib::ID3v2::FrameList::Iterator it = apicframes.begin(); - it != apicframes.end(); ++it) + for(auto it = apicframes.begin(); it != apicframes.end(); ++it) { - AttachedPictureFrame *frame = - dynamic_cast(*it); + auto *frame = dynamic_cast(*it); if (frame && frame->type() == apicType) { picture->loadFromData((const uchar *)frame->picture().data(), @@ -480,12 +478,9 @@ AlbumArtList MetaIOID3::readAlbumArt(TagLib::ID3v2::Tag *tag) { TagLib::ID3v2::FrameList apicframes = tag->frameListMap()["APIC"]; - for(TagLib::ID3v2::FrameList::Iterator it = apicframes.begin(); - it != apicframes.end(); ++it) + for(auto it = apicframes.begin(); it != apicframes.end(); ++it) { - - AttachedPictureFrame *frame = - dynamic_cast(*it); + auto *frame = dynamic_cast(*it); if (frame == nullptr) { LOG(VB_GENERAL, LOG_DEBUG, @@ -503,7 +498,7 @@ AlbumArtList MetaIOID3::readAlbumArt(TagLib::ID3v2::Tag *tag) continue; } - AlbumArtImage *art = new AlbumArtImage(); + auto *art = new AlbumArtImage(); if (frame->description().isEmpty()) art->m_description.clear(); @@ -586,9 +581,9 @@ AttachedPictureFrame* MetaIOID3::findAPIC(TagLib::ID3v2::Tag *tag, const String &description) { TagLib::ID3v2::FrameList l = tag->frameList("APIC"); - for(TagLib::ID3v2::FrameList::Iterator it = l.begin(); it != l.end(); ++it) + for(auto it = l.begin(); it != l.end(); ++it) { - AttachedPictureFrame *f = dynamic_cast(*it); + auto *f = dynamic_cast(*it); if (f && f->type() == type && (description.isNull() || f->description() == description)) return f; @@ -811,10 +806,9 @@ UserTextIdentificationFrame* MetaIOID3::find(TagLib::ID3v2::Tag *tag, const String &description) { TagLib::ID3v2::FrameList l = tag->frameList("TXXX"); - for(TagLib::ID3v2::FrameList::Iterator it = l.begin(); it != l.end(); ++it) + for(auto it = l.begin(); it != l.end(); ++it) { - UserTextIdentificationFrame *f = - dynamic_cast(*it); + auto *f = dynamic_cast(*it); if (f && f->description() == description) return f; } @@ -832,9 +826,9 @@ PopularimeterFrame* MetaIOID3::findPOPM(TagLib::ID3v2::Tag *tag, const String &_email) { TagLib::ID3v2::FrameList l = tag->frameList("POPM"); - for(TagLib::ID3v2::FrameList::Iterator it = l.begin(); it != l.end(); ++it) + for(auto it = l.begin(); it != l.end(); ++it) { - PopularimeterFrame *f = dynamic_cast(*it); + auto *f = dynamic_cast(*it); if (f && f->email() == _email) return f; } diff --git a/mythtv/libs/libmythmetadata/metaiomp4.cpp b/mythtv/libs/libmythmetadata/metaiomp4.cpp index b4a788e1af7..7ab8dd4aeaa 100644 --- a/mythtv/libs/libmythmetadata/metaiomp4.cpp +++ b/mythtv/libs/libmythmetadata/metaiomp4.cpp @@ -124,15 +124,10 @@ MusicMetadata* MetaIOMP4::read(const QString &filename) metadataSanityCheck(&artist, &album, &title, &genre); - MusicMetadata *retdata = new MusicMetadata(filename, - artist, - compilation ? artist : "", - album, - title, - genre, - year, - tracknum, - length); + auto *retdata = new MusicMetadata(filename, artist, + compilation ? artist : "", + album, title, genre, year, + tracknum, length); retdata->setCompilation(compilation); diff --git a/mythtv/libs/libmythmetadata/metaiooggvorbis.cpp b/mythtv/libs/libmythmetadata/metaiooggvorbis.cpp index 8fceea6f20d..08067d4174c 100644 --- a/mythtv/libs/libmythmetadata/metaiooggvorbis.cpp +++ b/mythtv/libs/libmythmetadata/metaiooggvorbis.cpp @@ -16,8 +16,7 @@ TagLib::Ogg::Vorbis::File *MetaIOOggVorbis::OpenFile(const QString &filename) { QByteArray fname = filename.toLocal8Bit(); - TagLib::Ogg::Vorbis::File *oggfile = - new TagLib::Ogg::Vorbis::File(fname.constData()); + auto *oggfile = new TagLib::Ogg::Vorbis::File(fname.constData()); if (!oggfile->isOpen()) { @@ -104,7 +103,7 @@ MusicMetadata* MetaIOOggVorbis::read(const QString &filename) return nullptr; } - MusicMetadata *metadata = new MusicMetadata(filename); + auto *metadata = new MusicMetadata(filename); ReadGenericMetadata(tag, metadata); diff --git a/mythtv/libs/libmythmetadata/metaiotaglib.cpp b/mythtv/libs/libmythmetadata/metaiotaglib.cpp index deaf9b29328..369db2e654a 100644 --- a/mythtv/libs/libmythmetadata/metaiotaglib.cpp +++ b/mythtv/libs/libmythmetadata/metaiotaglib.cpp @@ -106,7 +106,7 @@ int MetaIOTagLib::getTrackLength(const QString &filename) { int milliseconds = 0; QByteArray fname = filename.toLocal8Bit(); - TagLib::FileRef *file = new TagLib::FileRef(fname.constData()); + auto *file = new TagLib::FileRef(fname.constData()); if (file && file->audioProperties()) milliseconds = file->audioProperties()->length() * 1000; diff --git a/mythtv/libs/libmythmetadata/metaiowavpack.cpp b/mythtv/libs/libmythmetadata/metaiowavpack.cpp index 8b8307552ea..6218475cafc 100644 --- a/mythtv/libs/libmythmetadata/metaiowavpack.cpp +++ b/mythtv/libs/libmythmetadata/metaiowavpack.cpp @@ -19,7 +19,7 @@ TagLib::WavPack::File *MetaIOWavPack::OpenFile(const QString &filename) { QByteArray fname = filename.toLocal8Bit(); - TagLib::WavPack::File *wpfile = new TagLib::WavPack::File(fname.constData()); + auto *wpfile = new TagLib::WavPack::File(fname.constData()); if (!wpfile->isOpen()) { @@ -97,7 +97,7 @@ MusicMetadata* MetaIOWavPack::read(const QString &filename) return nullptr; } - MusicMetadata *metadata = new MusicMetadata(filename); + auto *metadata = new MusicMetadata(filename); ReadGenericMetadata(tag, metadata); diff --git a/mythtv/libs/libmythmetadata/musicmetadata.cpp b/mythtv/libs/libmythmetadata/musicmetadata.cpp index 00de537337a..ba423864da9 100644 --- a/mythtv/libs/libmythmetadata/musicmetadata.cpp +++ b/mythtv/libs/libmythmetadata/musicmetadata.cpp @@ -281,7 +281,7 @@ MusicMetadata *MusicMetadata::createFromID(int trackid) if (query.exec() && query.next()) { - MusicMetadata *mdata = new MusicMetadata(); + auto *mdata = new MusicMetadata(); mdata->m_artist = query.value(0).toString(); mdata->m_compilation_artist = query.value(1).toString(); mdata->m_album = query.value(2).toString(); @@ -1498,7 +1498,7 @@ void AllMusic::resync() idList.append(id); - MusicMetadata *dbMeta = new MusicMetadata( + auto *dbMeta = new MusicMetadata( query.value(12).toString(), // filename query.value(2).toString(), // artist query.value(3).toString(), // compilation artist @@ -1669,7 +1669,7 @@ void AllMusic::clearCDData(void) void AllMusic::addCDTrack(const MusicMetadata &the_track) { - MusicMetadata *mdata = new MusicMetadata(the_track); + auto *mdata = new MusicMetadata(the_track); mdata->setID(m_cdData.count() + 1); mdata->setRepo(RT_CD); m_cdData.append(mdata); @@ -1761,7 +1761,7 @@ void AllStream::loadStreams(void) for (int x = 0; x < STREAMURLCOUNT; x++) urls[x] = query.value(4 + x).toString(); - MusicMetadata *mdata = new MusicMetadata( + auto *mdata = new MusicMetadata( query.value(0).toInt(), // intid query.value(1).toString(), // broadcaster query.value(2).toString(), // channel @@ -1917,7 +1917,7 @@ void AlbumArtImages::findImages(void) { QString logoUrl = query.value(0).toString(); - AlbumArtImage *image = new AlbumArtImage(); + auto *image = new AlbumArtImage(); image->m_id = -1; image->m_filename = logoUrl; image->m_imageType = IT_FRONTCOVER; @@ -1951,7 +1951,7 @@ void AlbumArtImages::findImages(void) { while (query.next()) { - AlbumArtImage *image = new AlbumArtImage(); + auto *image = new AlbumArtImage(); bool embedded = (query.value(4).toInt() == 1); image->m_id = query.value(0).toInt(); @@ -1988,7 +1988,7 @@ void AlbumArtImages::findImages(void) QString artist = m_parent->Artist().toLower(); if (findIcon("artist", artist) != QString()) { - AlbumArtImage *image = new AlbumArtImage(); + auto *image = new AlbumArtImage(); image->m_id = -1; image->m_filename = findIcon("artist", artist); image->m_imageType = IT_ARTIST; @@ -2002,8 +2002,8 @@ void AlbumArtImages::findImages(void) void AlbumArtImages::scanForImages() { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIBusyDialog *busy = new MythUIBusyDialog(tr("Scanning for music album art..."), - popupStack, "scanbusydialog"); + auto *busy = new MythUIBusyDialog(tr("Scanning for music album art..."), + popupStack, "scanbusydialog"); if (busy->Create()) { @@ -2021,7 +2021,7 @@ void AlbumArtImages::scanForImages() << QString::number(m_parent->ID()) << "1"; - AlbumArtScannerThread *scanThread = new AlbumArtScannerThread(strList); + auto *scanThread = new AlbumArtScannerThread(strList); scanThread->start(); while (scanThread->isRunning()) @@ -2045,7 +2045,7 @@ void AlbumArtImages::scanForImages() for (int x = 2; x < strList.count(); x += 6) { - AlbumArtImage *image = new AlbumArtImage; + auto *image = new AlbumArtImage; image->m_id = strList[x].toInt(); image->m_imageType = (ImageType) strList[x + 1].toInt(); image->m_embedded = (strList[x + 2].toInt() == 1); diff --git a/mythtv/libs/libmythmetadata/mythuiimageresults.cpp b/mythtv/libs/libmythmetadata/mythuiimageresults.cpp index 86b54cbb5c9..06039bfcee5 100644 --- a/mythtv/libs/libmythmetadata/mythuiimageresults.cpp +++ b/mythtv/libs/libmythmetadata/mythuiimageresults.cpp @@ -51,9 +51,7 @@ bool ImageSearchResultsDialog::Create() i != m_list.end(); ++i) { ArtworkInfo info = (*i); - MythUIButtonListItem *button = - new MythUIButtonListItem(m_resultsList, - QString()); + auto *button = new MythUIButtonListItem(m_resultsList, QString()); button->SetText(info.label, "label"); button->SetText(info.thumbnail, "thumbnail"); button->SetText(info.url, "url"); @@ -122,7 +120,7 @@ void ImageSearchResultsDialog::customEvent(QEvent *event) { if (event->type() == ThumbnailDLEvent::kEventType) { - ThumbnailDLEvent *tde = dynamic_cast(event); + auto *tde = dynamic_cast(event); if (tde == nullptr) return; diff --git a/mythtv/libs/libmythmetadata/mythuimetadataresults.cpp b/mythtv/libs/libmythmetadata/mythuimetadataresults.cpp index af84bf83725..87625c7f8c9 100644 --- a/mythtv/libs/libmythmetadata/mythuimetadataresults.cpp +++ b/mythtv/libs/libmythmetadata/mythuimetadataresults.cpp @@ -50,9 +50,8 @@ bool MetadataResultsDialog::Create() for (int i = 0; i != m_results.count(); ++i) { - MythUIButtonListItem *button = - new MythUIButtonListItem(m_resultsList, - m_results[i]->GetTitle()); + auto *button = new MythUIButtonListItem(m_resultsList, + m_results[i]->GetTitle()); InfoMap metadataMap; m_results[i]->toMap(metadataMap); @@ -128,7 +127,7 @@ void MetadataResultsDialog::customEvent(QEvent *event) { if (event->type() == ThumbnailDLEvent::kEventType) { - ThumbnailDLEvent *tde = dynamic_cast(event); + auto *tde = dynamic_cast(event); if (tde == nullptr) return; diff --git a/mythtv/libs/libmythmetadata/parentalcontrols.cpp b/mythtv/libs/libmythmetadata/parentalcontrols.cpp index 80e442669c7..cc8f693070f 100644 --- a/mythtv/libs/libmythmetadata/parentalcontrols.cpp +++ b/mythtv/libs/libmythmetadata/parentalcontrols.cpp @@ -309,8 +309,7 @@ class ParentalLevelChangeCheckerPrivate : public QObject MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *pwd = - new MythTextInputDialog(popupStack, + auto *pwd = new MythTextInputDialog(popupStack, tr("Parental PIN:"), FilterNone, true); connect(pwd, SIGNAL(haveResult(QString)), diff --git a/mythtv/libs/libmythmetadata/videometadata.cpp b/mythtv/libs/libmythmetadata/videometadata.cpp index 5a392f90586..7b3d5a2debb 100644 --- a/mythtv/libs/libmythmetadata/videometadata.cpp +++ b/mythtv/libs/libmythmetadata/videometadata.cpp @@ -827,7 +827,7 @@ void VideoMetadataImp::updateGenres() VideoGenreMap::getGenreMap().remove(m_id); // ensure that all genres we have are in the DB - genre_list::iterator genre = m_genres.begin(); + auto genre = m_genres.begin(); while (genre != m_genres.end()) { if (!genre->second.trimmed().isEmpty()) @@ -848,7 +848,7 @@ void VideoMetadataImp::updateCountries() // remove countries for this video VideoCountryMap::getCountryMap().remove(m_id); - country_list::iterator country = m_countries.begin(); + auto country = m_countries.begin(); while (country != m_countries.end()) { if (!country->second.trimmed().isEmpty()) @@ -869,7 +869,7 @@ void VideoMetadataImp::updateCast() VideoCastMap::getCastMap().remove(m_id); // ensure that all cast we have are in the DB - cast_list::iterator cast = m_cast.begin(); + auto cast = m_cast.begin(); while (cast != m_cast.end()) { if (!cast->second.trimmed().isEmpty()) diff --git a/mythtv/libs/libmythmetadata/videometadatalistmanager.cpp b/mythtv/libs/libmythmetadata/videometadatalistmanager.cpp index 5e1366256cb..28d2b616175 100644 --- a/mythtv/libs/libmythmetadata/videometadatalistmanager.cpp +++ b/mythtv/libs/libmythmetadata/videometadatalistmanager.cpp @@ -21,8 +21,7 @@ class VideoMetadataListManagerImp m_fileMap.clear(); m_metaList.swap(list); - for (metadata_list::iterator p = m_metaList.begin(); - p != m_metaList.end(); ++p) + for (auto p = m_metaList.begin(); p != m_metaList.end(); ++p) { m_idMap.insert(int_to_meta::value_type((*p)->GetID(), p)); m_fileMap.insert( @@ -71,16 +70,15 @@ class VideoMetadataListManagerImp { if (metadata) { - int_to_meta::iterator im = m_idMap.find(metadata->GetID()); + auto im = m_idMap.find(metadata->GetID()); if (im != m_idMap.end()) { - metadata_list::iterator mdi = im->second; + auto mdi = im->second; (*mdi)->DeleteFromDatabase(); m_idMap.erase(im); - string_to_meta::iterator sm = - m_fileMap.find(metadata->GetFilename()); + auto sm = m_fileMap.find(metadata->GetFilename()); if (sm != m_fileMap.end()) m_fileMap.erase(sm); m_metaList.erase(mdi); @@ -440,8 +438,7 @@ bool meta_dir_node::has_entries() const if (!ret) { - for (meta_dir_list::const_iterator p = m_subdirs.begin(); - p != m_subdirs.end(); ++p) + for (auto p = m_subdirs.cbegin(); p != m_subdirs.cend(); ++p) { ret = (*p)->has_entries(); if (ret) break; diff --git a/mythtv/libs/libmythmetadata/videoscan.cpp b/mythtv/libs/libmythmetadata/videoscan.cpp index 6e880d5d8ac..d1f8d269fe8 100644 --- a/mythtv/libs/libmythmetadata/videoscan.cpp +++ b/mythtv/libs/libmythmetadata/videoscan.cpp @@ -257,9 +257,8 @@ void VideoScannerThread::verifyFiles(FileCheckList &files, tr("Verifying video files")); // For every file we know about, check to see if it still exists. - for (VideoMetadataListManager::metadata_list::const_iterator p = - m_dbmetadata->getList().begin(); - p != m_dbmetadata->getList().end(); ++p) + for (auto p = m_dbmetadata->getList().cbegin(); + p != m_dbmetadata->getList().cend(); ++p) { QString lname = (*p)->GetFilename(); QString lhost = (*p)->GetHost().toLower(); @@ -312,7 +311,7 @@ bool VideoScannerThread::updateDB(const FileCheckList &add, const PurgeList &rem SendProgressEvent(counter, (uint)(add.size() + remove.size()), tr("Updating video database")); - for (FileCheckList::const_iterator p = add.begin(); p != add.end(); ++p) + for (auto p = add.cbegin(); p != add.cend(); ++p) { // add files not already in the DB if (!p->second.check) @@ -371,8 +370,7 @@ bool VideoScannerThread::updateDB(const FileCheckList &add, const PurgeList &rem // When prompting is restored, account for the answer here. ret += remove.size(); - for (PurgeList::const_iterator p = remove.begin(); p != remove.end(); - ++p) + for (auto p = remove.cbegin(); p != remove.cend(); ++p) { if (!m_movList.contains(p->first)) { @@ -411,8 +409,7 @@ void VideoScannerThread::SendProgressEvent(uint progress, uint total, if (!m_dialog) return; - ProgressUpdateEvent *pue = new ProgressUpdateEvent(progress, total, - std::move(messsage)); + auto *pue = new ProgressUpdateEvent(progress, total, std::move(messsage)); QApplication::postEvent(m_dialog, pue); } @@ -436,8 +433,8 @@ void VideoScanner::doScan(const QStringList &dirs) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIProgressDialog *progressDlg = new MythUIProgressDialog("", - popupStack, "videoscanprogressdialog"); + auto *progressDlg = new MythUIProgressDialog("", popupStack, + "videoscanprogressdialog"); if (progressDlg->Create()) { diff --git a/mythtv/libs/libmythmetadata/videoutils.cpp b/mythtv/libs/libmythmetadata/videoutils.cpp index d70751a6103..a68c1a40032 100644 --- a/mythtv/libs/libmythmetadata/videoutils.cpp +++ b/mythtv/libs/libmythmetadata/videoutils.cpp @@ -33,7 +33,7 @@ namespace template void CopySecond(const T &src, QStringList &dest) { - for (typename T::const_iterator p = src.begin(); p != src.end(); ++p) + for (auto p = src.cbegin(); p != src.cend(); ++p) { dest.push_back((*p).second); } @@ -56,12 +56,12 @@ void CheckedSet(MythUIType *container, const QString &itemName, if (container) { MythUIType *uit = container->GetChild(itemName); - MythUIText *tt = dynamic_cast(uit); + auto *tt = dynamic_cast(uit); if (tt) CheckedSet(tt, value); else { - MythUIStateType *st = dynamic_cast(uit); + auto *st = dynamic_cast(uit); CheckedSet(st, value); } } diff --git a/mythtv/libs/libmythprotoserver/mythsocketmanager.cpp b/mythtv/libs/libmythprotoserver/mythsocketmanager.cpp index df955a5147e..cc96a14768b 100644 --- a/mythtv/libs/libmythprotoserver/mythsocketmanager.cpp +++ b/mythtv/libs/libmythprotoserver/mythsocketmanager.cpp @@ -105,7 +105,7 @@ bool MythSocketManager::Listen(int port) void MythSocketManager::newConnection(qt_socket_fd_t sd) { QMutexLocker locker(&m_socketListLock); - MythSocket *ms = new MythSocket(sd, this); + auto *ms = new MythSocket(sd, this); if (ms->IsConnected()) m_socketList.insert(ms); else diff --git a/mythtv/libs/libmythprotoserver/requesthandler/basehandler.cpp b/mythtv/libs/libmythprotoserver/requesthandler/basehandler.cpp index aa16ca873fb..03eed1105d4 100644 --- a/mythtv/libs/libmythprotoserver/requesthandler/basehandler.cpp +++ b/mythtv/libs/libmythprotoserver/requesthandler/basehandler.cpp @@ -33,7 +33,7 @@ bool BaseRequestHandler::HandleAnnounce(MythSocket *socket, bool systemevents = ( (eventlevel == 1) || (eventlevel == 3)); bool normalevents = ( (eventlevel == 1) || (eventlevel == 2)); - SocketHandler *handler = new SocketHandler(socket, m_parent, hostname); + auto *handler = new SocketHandler(socket, m_parent, hostname); socket->SetAnnounce(slist); handler->BlockShutdown(blockShutdown); diff --git a/mythtv/libs/libmythprotoserver/requesthandler/deletethread.cpp b/mythtv/libs/libmythprotoserver/requesthandler/deletethread.cpp index 6b71550f3b4..73d4dcb86a3 100644 --- a/mythtv/libs/libmythprotoserver/requesthandler/deletethread.cpp +++ b/mythtv/libs/libmythprotoserver/requesthandler/deletethread.cpp @@ -73,7 +73,7 @@ bool DeleteThread::AddFile(const QString& path) return false; QMutexLocker lock(&m_newlock); - DeleteHandler *handler = new DeleteHandler(path); + auto *handler = new DeleteHandler(path); m_newfiles << handler; return true; } diff --git a/mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp b/mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp index 0cebe0cce5c..5dc2dd7ca3e 100644 --- a/mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp +++ b/mythtv/libs/libmythprotoserver/requesthandler/fileserverhandler.cpp @@ -180,8 +180,7 @@ bool FileServerHandler::HandleAnnounce(MythSocket *socket, { if (slist.size() >= 3) { - SocketHandler *handler = - new SocketHandler(socket, m_parent, commands[2]); + auto *handler = new SocketHandler(socket, m_parent, commands[2]); handler->BlockShutdown(true); handler->AllowStandardEvents(true); diff --git a/mythtv/libs/libmythprotoserver/requesthandler/outboundhandler.cpp b/mythtv/libs/libmythprotoserver/requesthandler/outboundhandler.cpp index 1bd56418959..18937a4ec6f 100644 --- a/mythtv/libs/libmythprotoserver/requesthandler/outboundhandler.cpp +++ b/mythtv/libs/libmythprotoserver/requesthandler/outboundhandler.cpp @@ -63,7 +63,7 @@ bool OutboundRequestHandler::DoConnectToMaster(void) return false; } - SocketHandler *handler = new SocketHandler(m_socket, m_parent, hostname); + auto *handler = new SocketHandler(m_socket, m_parent, hostname); handler->BlockShutdown(true); handler->AllowStandardEvents(true); handler->AllowSystemEvents(true); diff --git a/mythtv/libs/libmythservicecontracts/service.cpp b/mythtv/libs/libmythservicecontracts/service.cpp index 7f99f2eaed1..133f3d41f3c 100644 --- a/mythtv/libs/libmythservicecontracts/service.cpp +++ b/mythtv/libs/libmythservicecontracts/service.cpp @@ -105,7 +105,7 @@ void* Service::ConvertToParameterPtr( int nTypeId, int nParentId = QMetaType::type( sParentFQN.toUtf8() ); - QObject *pParentClass = (QObject *)QMetaType::create( nParentId ); + auto *pParentClass = (QObject *)QMetaType::create( nParentId ); if (pParentClass == nullptr) break; diff --git a/mythtv/libs/libmythservicecontracts/test/test_datacontracts/test_datacontracts.cpp b/mythtv/libs/libmythservicecontracts/test/test_datacontracts/test_datacontracts.cpp index e774aca3d63..737a42bb04b 100644 --- a/mythtv/libs/libmythservicecontracts/test/test_datacontracts/test_datacontracts.cpp +++ b/mythtv/libs/libmythservicecontracts/test/test_datacontracts/test_datacontracts.cpp @@ -35,7 +35,7 @@ void TestDataContracts::cleanupTestCase(void) void TestDataContracts::test_channelinfo(void) { - DTC::ChannelInfo *pChan = new DTC::ChannelInfo(); + auto *pChan = new DTC::ChannelInfo(); pChan->setChanId(1119); pChan->setChanNum("119"); pChan->setCallSign("WEATH"); @@ -48,7 +48,7 @@ void TestDataContracts::test_channelinfo(void) QCOMPARE(known, qtype); // Convert back to DTC::Program - DTC::ChannelInfo *pChan2 = v.value(); + auto *pChan2 = v.value(); QCOMPARE(pChan->ChanId(), pChan2->ChanId()); QCOMPARE(pChan->ChanNum(), pChan2->ChanNum()); QCOMPARE(pChan->CallSign(), pChan2->CallSign()); @@ -58,7 +58,7 @@ void TestDataContracts::test_channelinfo(void) void TestDataContracts::test_program(void) { // Create DTC::Program - DTC::Program *pProgram = new DTC::Program(); + auto *pProgram = new DTC::Program(); pProgram->setTitle("Big Buck Bunny"); pProgram->setDescription("Follow a day of the life of Big Buck Bunny " "when he meets three bullying rodents..."); @@ -72,7 +72,7 @@ void TestDataContracts::test_program(void) QCOMPARE(known, qtype); // Convert back to DTC::Program - DTC::Program *pProgram2 = v.value(); + auto *pProgram2 = v.value(); QCOMPARE(pProgram->Title(), pProgram2->Title()); QCOMPARE(pProgram->Description(), pProgram2->Description()); QCOMPARE(pProgram->Inetref(), pProgram2->Inetref()); @@ -82,7 +82,7 @@ void TestDataContracts::test_program(void) void TestDataContracts::test_programlist(void) { // Create ProgramList with one Program - DTC::ProgramList *pPrograms = new DTC::ProgramList(); + auto *pPrograms = new DTC::ProgramList(); DTC::Program *pProgram = pPrograms->AddNewProgram(); pProgram->setTitle("Big Buck Bunny"); pProgram->setDescription("Follow a day of the life of Big Buck Bunny " @@ -103,7 +103,7 @@ void TestDataContracts::test_programlist(void) QCOMPARE(known, qtype); // Convert back to DTC::ProgramList - DTC::ProgramList *pPrograms2 = v.value(); + auto *pPrograms2 = v.value(); QCOMPARE(pPrograms->StartIndex(), pPrograms2->StartIndex()); QCOMPARE(pPrograms->Count(), pPrograms2->Count()); QCOMPARE(pPrograms->TotalAvailable(), pPrograms2->TotalAvailable()); @@ -114,7 +114,7 @@ void TestDataContracts::test_programlist(void) // Check the program QVariant v2 = pPrograms2->Programs()[0]; - DTC::Program *pProgram2 = v2.value(); + auto *pProgram2 = v2.value(); QCOMPARE(pProgram->Title(), pProgram2->Title()); QCOMPARE(pProgram->Description(), pProgram2->Description()); QCOMPARE(pProgram->Inetref(), pProgram2->Inetref()); @@ -124,7 +124,7 @@ void TestDataContracts::test_programlist(void) void TestDataContracts::test_recrule(void) { // Create DTC::RecRule - DTC::RecRule *pRule = new DTC::RecRule(); + auto *pRule = new DTC::RecRule(); pRule->setId(12345); pRule->setTitle("Big Buck Bunny"); pRule->setSubTitle("Bunny"); @@ -140,7 +140,7 @@ void TestDataContracts::test_recrule(void) QCOMPARE(known, qtype); // Convert back to DTC::RecRule - DTC::RecRule *pRule2 = v.value(); + auto *pRule2 = v.value(); QCOMPARE(pRule->Id(), pRule2->Id()); QCOMPARE(pRule->Title(), pRule2->Title()); QCOMPARE(pRule->SubTitle(), pRule2->SubTitle()); @@ -154,7 +154,7 @@ void TestDataContracts::test_recordinginfo(void) QDateTime now = QDateTime::currentDateTime(); // Create DTC::RecordingInfo - DTC::RecordingInfo *pRecording = new DTC::RecordingInfo(); + auto *pRecording = new DTC::RecordingInfo(); pRecording->setRecordedId(12345); pRecording->setStatus(RecStatus::Recorded); pRecording->setStartTs(now); @@ -167,7 +167,7 @@ void TestDataContracts::test_recordinginfo(void) QCOMPARE(known, qtype); // Convert back to DTC::RecordingInfo - DTC::RecordingInfo *pRecording2 = v.value(); + auto *pRecording2 = v.value(); QCOMPARE(pRecording->RecordedId(), pRecording2->RecordedId()); QCOMPARE(pRecording->Status(), pRecording2->Status()); QCOMPARE(pRecording->StartTs(), pRecording2->StartTs()); diff --git a/mythtv/libs/libmythui/cecadapter.cpp b/mythtv/libs/libmythui/cecadapter.cpp index f902b00e2cc..2f37627769b 100644 --- a/mythtv/libs/libmythui/cecadapter.cpp +++ b/mythtv/libs/libmythui/cecadapter.cpp @@ -154,7 +154,7 @@ class CECAdapterPriv // find adapters #if CEC_LIB_VERSION_MAJOR >= 4 - cec_adapter_descriptor *devices = new cec_adapter_descriptor[MAX_CEC_DEVICES]; + auto *devices = new cec_adapter_descriptor[MAX_CEC_DEVICES]; uint8_t num_devices = m_adapter->DetectAdapters(devices, MAX_CEC_DEVICES, nullptr, true); #else cec_adapter *devices = new cec_adapter[MAX_CEC_DEVICES]; @@ -665,7 +665,7 @@ class CECAdapterPriv return 1; MythUIHelper::ResetScreensaver(); - QKeyEvent* ke = new QKeyEvent(QEvent::KeyPress, action, modifier); + auto* ke = new QKeyEvent(QEvent::KeyPress, action, modifier); qApp->postEvent(GetMythMainWindow(), (QEvent*)ke); return 1; @@ -1000,7 +1000,7 @@ class CECAdapterPriv return; MythUIHelper::ResetScreensaver(); - QKeyEvent* ke = new QKeyEvent(QEvent::KeyPress, action, Qt::NoModifier); + auto* ke = new QKeyEvent(QEvent::KeyPress, action, Qt::NoModifier); qApp->postEvent(GetMythMainWindow(), (QEvent*)ke); } diff --git a/mythtv/libs/libmythui/mythdialogbox.cpp b/mythtv/libs/libmythui/mythdialogbox.cpp index e84b0caad49..38536354c64 100644 --- a/mythtv/libs/libmythui/mythdialogbox.cpp +++ b/mythtv/libs/libmythui/mythdialogbox.cpp @@ -54,20 +54,20 @@ MythMenu::~MythMenu(void) void MythMenu::AddItem(const QString& title, const char* slot, MythMenu *subMenu, bool selected, bool checked) { - MythMenuItem *item = new MythMenuItem(title, slot, checked, subMenu); + auto *item = new MythMenuItem(title, slot, checked, subMenu); AddItem(item, selected, subMenu); } void MythMenu::AddItem(const QString &title, QVariant data, MythMenu *subMenu, bool selected, bool checked) { - MythMenuItem *item = new MythMenuItem(title, std::move(data), checked, subMenu); + auto *item = new MythMenuItem(title, std::move(data), checked, subMenu); AddItem(item, selected, subMenu); } void MythMenu::AddItem(const QString &title, const MythUIButtonCallback &slot, MythMenu *subMenu, bool selected, bool checked) { - MythMenuItem *item = new MythMenuItem(title, slot, checked, subMenu); + auto *item = new MythMenuItem(title, slot, checked, subMenu); AddItem(item, selected, subMenu); } @@ -194,7 +194,7 @@ void MythDialogBox::updateMenu(void) for (int x = 0; x < m_currentMenu->m_menuItems.count(); x++) { MythMenuItem *menuItem = m_currentMenu->m_menuItems.at(x); - MythUIButtonListItem *button = new MythUIButtonListItem(m_buttonList, menuItem->m_text); + auto *button = new MythUIButtonListItem(m_buttonList, menuItem->m_text); button->SetData(qVariantFromValue(menuItem)); button->setDrawArrow((menuItem->m_subMenu != nullptr)); @@ -214,7 +214,7 @@ void MythDialogBox::Select(MythUIButtonListItem* item) if (m_currentMenu) { - MythMenuItem *menuItem = item->GetData().value< MythMenuItem * >(); + auto *menuItem = item->GetData().value< MythMenuItem * >(); if (menuItem->m_subMenu) { @@ -299,7 +299,7 @@ void MythDialogBox::SetText(const QString &text) void MythDialogBox::AddButton(const QString &title, QVariant data, bool newMenu, bool setCurrent) { - MythUIButtonListItem *button = new MythUIButtonListItem(m_buttonList, title); + auto *button = new MythUIButtonListItem(m_buttonList, title); button->SetData(std::move(data)); button->setDrawArrow(newMenu); @@ -313,7 +313,7 @@ void MythDialogBox::AddButton(const QString &title, QVariant data, bool newMenu, void MythDialogBox::AddButton(const QString &title, const char *slot, bool newMenu, bool setCurrent) { - MythUIButtonListItem *button = new MythUIButtonListItem(m_buttonList, title); + auto *button = new MythUIButtonListItem(m_buttonList, title); m_useSlots = true; @@ -418,7 +418,7 @@ void MythDialogBox::SendEvent(int res, const QString& text, const QVariant& data if (!m_currentMenu->m_retObject) return; - DialogCompletionEvent *dce = new DialogCompletionEvent(m_currentMenu->m_resultid, res, text, data); + auto *dce = new DialogCompletionEvent(m_currentMenu->m_resultid, res, text, data); QCoreApplication::postEvent(m_currentMenu->m_retObject, dce); } else @@ -428,7 +428,7 @@ void MythDialogBox::SendEvent(int res, const QString& text, const QVariant& data if (!m_retObject) return; - DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, res, text, data); + auto *dce = new DialogCompletionEvent(m_id, res, text, data); QCoreApplication::postEvent(m_retObject, dce); } } @@ -535,8 +535,7 @@ void MythConfirmationDialog::sendResult(bool ok) if (ok) res = 1; - DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, res, "", - m_resultData); + auto *dce = new DialogCompletionEvent(m_id, res, "", m_resultData); QCoreApplication::postEvent(m_retObject, dce); m_retObject = nullptr; } @@ -657,8 +656,7 @@ void MythTextInputDialog::sendResult() if (m_retObject) { - DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, 0, - inputString, ""); + auto *dce = new DialogCompletionEvent(m_id, 0, inputString, ""); QCoreApplication::postEvent(m_retObject, dce); } @@ -756,8 +754,7 @@ void MythSpinBoxDialog::sendResult() if (m_retObject) { - DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, 0, - inputString, ""); + auto *dce = new DialogCompletionEvent(m_id, 0, inputString, ""); QCoreApplication::postEvent(m_retObject, dce); } @@ -864,8 +861,7 @@ void MythUISearchDialog::slotSendResult() if (m_retObject) { - DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, 0, - result, ""); + auto *dce = new DialogCompletionEvent(m_id, 0, result, ""); QCoreApplication::postEvent(m_retObject, dce); } @@ -1067,8 +1063,7 @@ void MythTimeInputDialog::okClicked(void) if (m_retObject) { QVariant data(dateTime); - DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, 0, "", - data); + auto *dce = new DialogCompletionEvent(m_id, 0, "", data); QCoreApplication::postEvent(m_retObject, dce); } diff --git a/mythtv/libs/libmythui/mythdisplay.cpp b/mythtv/libs/libmythui/mythdisplay.cpp index fb35d300e40..69fb4d00e24 100644 --- a/mythtv/libs/libmythui/mythdisplay.cpp +++ b/mythtv/libs/libmythui/mythdisplay.cpp @@ -491,7 +491,7 @@ bool MythDisplay::SwitchToVideo(int Width, int Height, double Rate) bool MythDisplay::SwitchToGUI(Mode NextMode) { DisplayResScreen next = m_mode[NextMode]; - double target_rate = static_cast(NAN); + auto target_rate = static_cast(NAN); // need to change video mode? // If GuiVidModeRefreshRate is 0, assume any refresh rate is good enough. @@ -535,7 +535,7 @@ double MythDisplay::GetRefreshRate(void) std::vector MythDisplay::GetRefreshRates(int Width, int Height) { - double tr = static_cast(NAN); + auto tr = static_cast(NAN); std::vector empty; const DisplayResScreen drs(Width, Height, 0, 0, -1.0, 0.0); diff --git a/mythtv/libs/libmythui/mythfontmanager.cpp b/mythtv/libs/libmythui/mythfontmanager.cpp index ebd7d76d6db..b3f625142d3 100644 --- a/mythtv/libs/libmythui/mythfontmanager.cpp +++ b/mythtv/libs/libmythui/mythfontmanager.cpp @@ -248,8 +248,7 @@ bool MythFontManager::RegisterFont(const QString &fontPath, return false; id = ref->GetFontID(); } - MythFontReference *fontReference = - new MythFontReference(fontPath, registeredFor, id); + auto *fontReference = new MythFontReference(fontPath, registeredFor, id); m_fontPathToReference.insert(fontPath, fontReference); return true; } diff --git a/mythtv/libs/libmythui/mythfontproperties.cpp b/mythtv/libs/libmythui/mythfontproperties.cpp index 455b3806503..5e14a63ab4d 100644 --- a/mythtv/libs/libmythui/mythfontproperties.cpp +++ b/mythtv/libs/libmythui/mythfontproperties.cpp @@ -177,7 +177,7 @@ MythFontProperties *MythFontProperties::ParseFromXml( static bool s_showAvailable = true; bool fromBase = false; - MythFontProperties *newFont = new MythFontProperties(); + auto *newFont = new MythFontProperties(); newFont->Freeze(); if (element.tagName() == "font") diff --git a/mythtv/libs/libmythui/mythgenerictree.cpp b/mythtv/libs/libmythui/mythgenerictree.cpp index 46f77bead07..ff0b368605e 100644 --- a/mythtv/libs/libmythui/mythgenerictree.cpp +++ b/mythtv/libs/libmythui/mythgenerictree.cpp @@ -87,7 +87,7 @@ void MythGenericTree::ensureSortFields(void) MythGenericTree* MythGenericTree::addNode(const QString &a_string, int an_int, bool selectable_flag, bool visible) { - MythGenericTree *new_node = new MythGenericTree(a_string.simplified(), + auto *new_node = new MythGenericTree(a_string.simplified(), an_int, selectable_flag); new_node->SetVisible(visible); return addNode(new_node); @@ -97,7 +97,7 @@ MythGenericTree* MythGenericTree::addNode(const QString &a_string, const QString &sortText, int an_int, bool selectable_flag, bool visible) { - MythGenericTree *new_node = new MythGenericTree(a_string.simplified(), + auto *new_node = new MythGenericTree(a_string.simplified(), an_int, selectable_flag); new_node->SetVisible(visible); new_node->SetSortText(sortText); @@ -502,7 +502,7 @@ void MythGenericTree::SetVisible(bool visible) MythUIButtonListItem *MythGenericTree::CreateListButton(MythUIButtonList *list) { - MythUIButtonListItem *item = new MythUIButtonListItem(list, GetText()); + auto *item = new MythUIButtonListItem(list, GetText()); item->SetData(qVariantFromValue(this)); item->SetTextFromMap(m_strings); item->SetImageFromMap(m_imageFilenames); diff --git a/mythtv/libs/libmythui/mythimage.cpp b/mythtv/libs/libmythui/mythimage.cpp index 3d0cbb95f76..df6ebd4a13e 100644 --- a/mythtv/libs/libmythui/mythimage.cpp +++ b/mythtv/libs/libmythui/mythimage.cpp @@ -273,7 +273,7 @@ bool MythImage::Load(MythImageReader *reader) if (!reader || !reader->canRead()) return false; - QImage *im = new QImage; + auto *im = new QImage; if (im && reader->read(im)) { @@ -306,7 +306,7 @@ bool MythImage::Load(const QString &filename) QString mythUrl = RemoteFile::FindFile(fname, url.host(), url.userName()); if (!mythUrl.isEmpty()) { - RemoteFile *rf = new RemoteFile(mythUrl, false, false, 0); + auto *rf = new RemoteFile(mythUrl, false, false, 0); QByteArray data; bool ret = rf->SaveAs(data); diff --git a/mythtv/libs/libmythui/mythmainwindow.cpp b/mythtv/libs/libmythui/mythmainwindow.cpp index 80560214fd9..1836e51d00a 100644 --- a/mythtv/libs/libmythui/mythmainwindow.cpp +++ b/mythtv/libs/libmythui/mythmainwindow.cpp @@ -852,8 +852,8 @@ void MythMainWindow::closeEvent(QCloseEvent *e) { if (e->spontaneous()) { - QKeyEvent *key = new QKeyEvent(QEvent::KeyPress, d->m_escapekey, - Qt::NoModifier); + auto *key = new QKeyEvent(QEvent::KeyPress, d->m_escapekey, + Qt::NoModifier); QCoreApplication::postEvent(this, key); e->ignore(); } @@ -1492,13 +1492,13 @@ void MythMainWindow::ExitToMainMenu(void) gCoreContext->dispatch(xe); if (screen->objectName() == QString("video playback window")) { - MythEvent *me = new MythEvent("EXIT_TO_MENU"); + auto *me = new MythEvent("EXIT_TO_MENU"); QCoreApplication::postEvent(screen, me); } else { - QKeyEvent *key = new QKeyEvent(QEvent::KeyPress, d->m_escapekey, - Qt::NoModifier); + auto *key = new QKeyEvent(QEvent::KeyPress, d->m_escapekey, + Qt::NoModifier); QCoreApplication::postEvent(this, key); MythNotificationCenter *nc = MythNotificationCenter::GetInstance(); // Notifications have their own stack. We need to continue @@ -1983,7 +1983,7 @@ void MythMainWindow::HandleCallback(const QString &Debug, MythCallbackEvent::Cal QWaitCondition wait; QMutex lock; lock.lock(); - MythCallbackEvent *event = new MythCallbackEvent(Function, &wait, Opaque1, Opaque2); + auto *event = new MythCallbackEvent(Function, &wait, Opaque1, Opaque2); QCoreApplication::postEvent(window, event, Qt::HighEventPriority); int count = 0; while (!wait.wait(&lock, 100) && (count += 100)) @@ -2018,7 +2018,7 @@ bool MythMainWindow::keyLongPressFilter(QEvent **e, QScopedPointer &sNewEvent) { QEvent *newEvent = nullptr; - QKeyEvent *ke = dynamic_cast(*e); + auto *ke = dynamic_cast(*e); if (!ke) return false; int keycode = ke->key(); @@ -2088,8 +2088,10 @@ bool MythMainWindow::keyLongPressFilter(QEvent **e, // short press or non-repeating keyboard - generate key Qt::KeyboardModifiers modifier = Qt::NoModifier; if (ke->timestamp() - d->m_longPressTime >= LONGPRESS_INTERVAL) + { // non-repeatng keyboard modifier = Qt::MetaModifier; + } newEvent = new QKeyEvent(QEvent::KeyPress, keycode, ke->modifiers() | modifier, ke->nativeScanCode(), ke->nativeVirtualKey(), ke->nativeModifiers(), @@ -2127,7 +2129,7 @@ bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) case QEvent::KeyPress: { ResetIdleTimer(); - QKeyEvent *ke = dynamic_cast(e); + auto *ke = dynamic_cast(e); // Work around weird GCC run-time bug. Only manifest on Mac OS X if (!ke) @@ -2149,8 +2151,8 @@ bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) if (keycode > 0) { - QKeyEvent *key = new QKeyEvent(QEvent::KeyPress, keycode, - ke->modifiers()); + auto *key = new QKeyEvent(QEvent::KeyPress, keycode, + ke->modifiers()); QObject *key_target = getTarget(*key); if (!key_target) QCoreApplication::postEvent(this, key); @@ -2186,7 +2188,7 @@ bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) if (!d->m_gesture.recording()) { d->m_gesture.start(); - QMouseEvent *mouseEvent = dynamic_cast(e); + auto *mouseEvent = dynamic_cast(e); if (!mouseEvent) return false; d->m_gesture.record(mouseEvent->pos()); @@ -2210,7 +2212,7 @@ bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) d->m_gesture.stop(); MythGestureEvent *ge = d->m_gesture.gesture(); - QMouseEvent *mouseEvent = dynamic_cast(e); + auto *mouseEvent = dynamic_cast(e); /* handle clicks separately */ if (ge->gesture() == MythGestureEvent::Click) @@ -2335,7 +2337,7 @@ bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) d->m_gestureTimer->stop(); d->m_gestureTimer->start(GESTURE_TIMEOUT); - QMouseEvent *mouseEvent = dynamic_cast(e); + auto *mouseEvent = dynamic_cast(e); if (!mouseEvent) return false; d->m_gesture.record(mouseEvent->pos()); @@ -2347,13 +2349,13 @@ bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) { ResetIdleTimer(); ShowMouseCursor(true); - QWheelEvent* qmw = static_cast(e); + auto* qmw = static_cast(e); int delta = qmw->delta(); if (delta>0) { qmw->accept(); - QKeyEvent *key = new QKeyEvent(QEvent::KeyPress, Qt::Key_Up, - Qt::NoModifier); + auto *key = new QKeyEvent(QEvent::KeyPress, Qt::Key_Up, + Qt::NoModifier); QObject *key_target = getTarget(*key); if (!key_target) QCoreApplication::postEvent(this, key); @@ -2363,8 +2365,8 @@ bool MythMainWindow::eventFilter(QObject * /*watched*/, QEvent *e) if (delta<0) { qmw->accept(); - QKeyEvent *key = new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, - Qt::NoModifier); + auto *key = new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, + Qt::NoModifier); QObject *key_target = getTarget(*key); if (!key_target) QCoreApplication::postEvent(this, key); @@ -2384,7 +2386,7 @@ void MythMainWindow::customEvent(QEvent *ce) { if (ce->type() == MythGestureEvent::kEventType) { - MythGestureEvent *ge = static_cast(ce); + auto *ge = static_cast(ce); MythScreenStack *toplevel = GetMainStack(); if (toplevel) { @@ -2401,7 +2403,7 @@ void MythMainWindow::customEvent(QEvent *ce) } else if (ce->type() == ExternalKeycodeEvent::kEventType) { - ExternalKeycodeEvent *eke = static_cast(ce); + auto *eke = static_cast(ce); int keycode = eke->getKeycode(); QKeyEvent key(QEvent::KeyPress, keycode, Qt::NoModifier); @@ -2416,7 +2418,7 @@ void MythMainWindow::customEvent(QEvent *ce) else if (ce->type() == LircKeycodeEvent::kEventType && !d->m_ignoreLircKeys) { - LircKeycodeEvent *lke = static_cast(ce); + auto *lke = static_cast(ce); if (LircKeycodeEvent::kLIRCInvalidKeyCombo == lke->modifiers()) { @@ -2446,7 +2448,7 @@ void MythMainWindow::customEvent(QEvent *ce) else if (ce->type() == JoystickKeycodeEvent::kEventType && !d->m_ignoreJoystickKeys) { - JoystickKeycodeEvent *jke = static_cast(ce); + auto *jke = static_cast(ce); int keycode = jke->getKeycode(); if (keycode) @@ -2479,7 +2481,7 @@ void MythMainWindow::customEvent(QEvent *ce) #endif else if (ce->type() == MythMediaEvent::kEventType) { - MythMediaEvent *me = static_cast(ce); + auto *me = static_cast(ce); // A listener based system might be more efficient, but we should never // have that many screens open at once so impact should be minimal. @@ -2516,7 +2518,7 @@ void MythMainWindow::customEvent(QEvent *ce) } else if (ce->type() == ScreenSaverEvent::kEventType) { - ScreenSaverEvent *sse = static_cast(ce); + auto *sse = static_cast(ce); switch (sse->getSSEventType()) { case ScreenSaverEvent::ssetDisable: @@ -2570,7 +2572,7 @@ void MythMainWindow::customEvent(QEvent *ce) } else if (ce->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast(ce); + auto *me = static_cast(ce); QString message = me->Message(); if (message.startsWith(ACTION_HANDLEMEDIA)) @@ -2660,7 +2662,7 @@ void MythMainWindow::customEvent(QEvent *ce) } else if (ce->type() == MythEvent::MythUserMessage) { - MythEvent *me = static_cast(ce); + auto *me = static_cast(ce); const QString& message = me->Message(); if (!message.isEmpty()) @@ -2672,7 +2674,7 @@ void MythMainWindow::customEvent(QEvent *ce) } else if (ce->type() == MythCallbackEvent::kCallbackType) { - MythCallbackEvent *me = static_cast(ce); + auto *me = static_cast(ce); if (me && me->m_function) me->m_function(me->m_opaque1, me->m_opaque2, me->m_opaque3); } diff --git a/mythtv/libs/libmythui/mythnotificationcenter.cpp b/mythtv/libs/libmythui/mythnotificationcenter.cpp index 4e4a17954bd..7751dba5523 100644 --- a/mythtv/libs/libmythui/mythnotificationcenter.cpp +++ b/mythtv/libs/libmythui/mythnotificationcenter.cpp @@ -133,8 +133,7 @@ MythScreenType *MythNotificationScreenStack::GetTopScreen(void) const // loop from last to 2nd for (; it != m_Children.begin(); --it) { - MythNotificationScreen *s = dynamic_cast(*it); - + auto *s = dynamic_cast(*it); if (!s) { // if for whatever reason it's not a notification on our screen @@ -230,8 +229,7 @@ void MythNotificationScreen::SetNotification(MythNotification ¬ification) update = false; } - MythImageNotification *img = - dynamic_cast(¬ification); + auto *img = dynamic_cast(¬ification); if (img) { QString path = img->GetImagePath(); @@ -248,8 +246,7 @@ void MythNotificationScreen::SetNotification(MythNotification ¬ification) } } - MythPlaybackNotification *play = - dynamic_cast(¬ification); + auto *play = dynamic_cast(¬ification); if (play) { UpdatePlayback(play->GetProgress(), play->GetProgressText()); @@ -257,8 +254,7 @@ void MythNotificationScreen::SetNotification(MythNotification ¬ification) m_update |= kDuration; } - MythMediaNotification *media = - dynamic_cast(¬ification); + auto *media = dynamic_cast(¬ification); if (media && m_imagePath.isEmpty() && m_image.isNull()) { m_update |= kNoArtwork; @@ -793,8 +789,7 @@ NCPrivate::~NCPrivate() */ void NCPrivate::ScreenDeleted(void) { - MythNotificationScreen *screen = - static_cast(sender()); + auto *screen = static_cast(sender()); bool duefordeletion = m_deletedScreens.contains(screen); @@ -842,7 +837,7 @@ void NCPrivate::ScreenDeleted(void) { // don't remove the id from the list, as the application is still registered // re-create the screen - MythNotificationScreen *newscreen = + auto *newscreen = new MythNotificationScreen(m_screenStack, *screen); connect(newscreen, SIGNAL(ScreenDeleted()), this, SLOT(ScreenDeleted())); m_registrations[screen->m_id] = newscreen; @@ -872,7 +867,7 @@ bool NCPrivate::Queue(const MythNotification ¬ification) int id = notification.GetId(); void *parent = notification.GetParent(); - MythNotification *tmp = static_cast(notification.clone()); + auto *tmp = static_cast(notification.clone()); if (id > 0) { // quick sanity check to ensure the right caller is attempting @@ -1247,9 +1242,7 @@ void NCPrivate::GetNotificationScreens(QList &_screens) int position = 0; for (; it != itend; ++it) { - MythNotificationScreen *screen = - dynamic_cast(*it); - + auto *screen = dynamic_cast(*it); if (screen) { if ((screen->m_visibility & MythNotification::kPlayback) == 0) @@ -1392,9 +1385,7 @@ void MythNotificationCenter::UnRegister(void *from, int id, bool closeimemdiatel QDateTime MythNotificationCenter::ScreenExpiryTime(const MythScreenType *screen) { - const MythNotificationScreen *s = - dynamic_cast(screen); - + const auto *s = dynamic_cast(screen); if (!s) return QDateTime(); return s->m_expiry; @@ -1402,11 +1393,9 @@ QDateTime MythNotificationCenter::ScreenExpiryTime(const MythScreenType *screen) bool MythNotificationCenter::ScreenCreated(const MythScreenType *screen) { - const MythNotificationScreen *s = - dynamic_cast(screen); - + const auto *s = dynamic_cast(screen); if (!s) - return true;; + return true; return s->m_created; } @@ -1417,9 +1406,7 @@ void MythNotificationCenter::GetNotificationScreens(QList &_scr void MythNotificationCenter::UpdateScreen(MythScreenType *screen) { - MythNotificationScreen *s = - dynamic_cast(screen); - + auto *s = dynamic_cast(screen); if (!s) return; diff --git a/mythtv/libs/libmythui/mythpainter.cpp b/mythtv/libs/libmythui/mythpainter.cpp index 1dc56e37f85..929df5e02be 100644 --- a/mythtv/libs/libmythui/mythpainter.cpp +++ b/mythtv/libs/libmythui/mythpainter.cpp @@ -492,7 +492,7 @@ MythImage* MythPainter::GetImageFromRect(const QRect &area, int radius, QString incoming("R"); if (fillBrush.style() == Qt::LinearGradientPattern && fillBrush.gradient()) { - const QLinearGradient *gradient = static_cast(fillBrush.gradient()); + const auto *gradient = static_cast(fillBrush.gradient()); if (gradient) { incoming = QString::number( diff --git a/mythtv/libs/libmythui/mythpainter_qimage.cpp b/mythtv/libs/libmythui/mythpainter_qimage.cpp index 650540fb369..e52f6daf088 100644 --- a/mythtv/libs/libmythui/mythpainter_qimage.cpp +++ b/mythtv/libs/libmythui/mythpainter_qimage.cpp @@ -112,7 +112,7 @@ void MythQImagePainter::Clear(QPaintDevice *device, const QRegion ®ion) if (!device || region.isEmpty()) return; - QImage *dev = dynamic_cast(device); + auto *dev = dynamic_cast(device); if (!dev) return; diff --git a/mythtv/libs/libmythui/mythpainter_qt.cpp b/mythtv/libs/libmythui/mythpainter_qt.cpp index 49a7caa101a..45f5b19286c 100644 --- a/mythtv/libs/libmythui/mythpainter_qt.cpp +++ b/mythtv/libs/libmythui/mythpainter_qt.cpp @@ -119,7 +119,7 @@ void MythQtPainter::DrawImage(const QRect &r, MythImage *im, return; } - MythQtImage *qim = reinterpret_cast(im); + auto *qim = reinterpret_cast(im); if (qim->NeedsRegen()) qim->RegeneratePixmap(); @@ -136,7 +136,7 @@ MythImage *MythQtPainter::GetFormatImagePriv() void MythQtPainter::DeleteFormatImagePriv(MythImage *im) { - MythQtImage *qim = static_cast(im); + auto *qim = static_cast(im); QMutexLocker locker(&m_imageDeleteLock); if (qim->GetPixmap()) diff --git a/mythtv/libs/libmythui/mythprogressdialog.cpp b/mythtv/libs/libmythui/mythprogressdialog.cpp index 3cd409b1288..2016ced6eb0 100644 --- a/mythtv/libs/libmythui/mythprogressdialog.cpp +++ b/mythtv/libs/libmythui/mythprogressdialog.cpp @@ -164,8 +164,7 @@ void MythUIProgressDialog::customEvent(QEvent *event) { if (event->type() == ProgressUpdateEvent::kEventType) { - ProgressUpdateEvent *pue = dynamic_cast(event); - + auto *pue = dynamic_cast(event); if (!pue) { LOG(VB_GENERAL, LOG_ERR, diff --git a/mythtv/libs/libmythui/mythscreentype.cpp b/mythtv/libs/libmythui/mythscreentype.cpp index 06a6ff281c4..a77f125fa98 100644 --- a/mythtv/libs/libmythui/mythscreentype.cpp +++ b/mythtv/libs/libmythui/mythscreentype.cpp @@ -310,7 +310,7 @@ void MythScreenType::LoadInBackground(const QString& message) OpenBusyPopup(message); - ScreenLoadTask *loadTask = new ScreenLoadTask(*this); + auto *loadTask = new ScreenLoadTask(*this); MThreadPool::globalInstance()->start(loadTask, "ScreenLoad"); } @@ -522,7 +522,7 @@ bool MythScreenType::ParseElement( */ void MythScreenType::CopyFrom(MythUIType *base) { - MythScreenType *st = dynamic_cast(base); + auto *st = dynamic_cast(base); if (!st) { LOG(VB_GENERAL, LOG_ERR, "ERROR, bad parsing"); diff --git a/mythtv/libs/libmythui/myththemedmenu.cpp b/mythtv/libs/libmythui/myththemedmenu.cpp index 8f9fc11d2c5..712d84ef11f 100644 --- a/mythtv/libs/libmythui/myththemedmenu.cpp +++ b/mythtv/libs/libmythui/myththemedmenu.cpp @@ -56,7 +56,7 @@ bool MythThemedMenuState::Create(void) void MythThemedMenuState::CopyFrom(MythUIType *base) { - MythThemedMenuState *st = dynamic_cast(base); + auto *st = dynamic_cast(base); if (!st) { LOG(VB_GENERAL, LOG_INFO, "ERROR, bad parsing"); @@ -373,7 +373,7 @@ void MythThemedMenu::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent*)(event); + auto *dce = (DialogCompletionEvent*)(event); QString resultid = dce->GetId(); //int buttonnum = dce->GetResult(); @@ -691,8 +691,7 @@ void MythThemedMenu::addButton(const QString &type, const QString &text, if (m_watermarkState) m_watermarkState->EnsureStateLoaded(type); - MythUIButtonListItem *listbuttonitem = - new MythUIButtonListItem(m_buttonList, text, + auto *listbuttonitem = new MythUIButtonListItem(m_buttonList, text, qVariantFromValue(newbutton)); listbuttonitem->DisplayState(type, "icon"); @@ -794,8 +793,7 @@ bool MythThemedMenu::handleAction(const QString &action, const QString &password MythScreenStack *stack = GetScreenStack(); - MythThemedMenu *newmenu = new MythThemedMenu("", menu, stack, menu, - false, m_state); + auto *newmenu = new MythThemedMenu("", menu, stack, menu, false, m_state); if (newmenu->foundTheme()) stack->AddScreen(newmenu); else @@ -921,8 +919,7 @@ bool MythThemedMenu::checkPinCode(const QString &password_setting) QString text = tr("Enter password:"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythTextInputDialog *dialog = - new MythTextInputDialog(popupStack, text, FilterNone, true); + auto *dialog = new MythTextInputDialog(popupStack, text, FilterNone, true); if (dialog->Create()) { diff --git a/mythtv/libs/libmythui/mythudplistener.cpp b/mythtv/libs/libmythui/mythudplistener.cpp index 2829bdcf49b..9070682b44b 100644 --- a/mythtv/libs/libmythui/mythudplistener.cpp +++ b/mythtv/libs/libmythui/mythudplistener.cpp @@ -180,7 +180,7 @@ void MythUDPListener::Process(const QByteArray &buf, const QHostAddress& /*sende QStringList args; args << QString::number(timeout); MythMainWindow *window = GetMythMainWindow(); - MythEvent* me = new MythEvent(MythEvent::MythUserMessage, msg, args); + auto* me = new MythEvent(MythEvent::MythUserMessage, msg, args); qApp->postEvent(window, me); } } diff --git a/mythtv/libs/libmythui/mythuianimation.cpp b/mythtv/libs/libmythui/mythuianimation.cpp index 20b953f230e..f4ecda50e76 100644 --- a/mythtv/libs/libmythui/mythuianimation.cpp +++ b/mythtv/libs/libmythui/mythuianimation.cpp @@ -268,7 +268,7 @@ void MythUIAnimation::ParseSection(const QDomElement &element, else continue; - MythUIAnimation* a = new MythUIAnimation(parent, trigger, type); + auto* a = new MythUIAnimation(parent, trigger, type); a->setStartValue(start); a->setEndValue(end); a->setDuration(effectduration); diff --git a/mythtv/libs/libmythui/mythuibutton.cpp b/mythtv/libs/libmythui/mythuibutton.cpp index fc37b45e778..a8f0f99714d 100644 --- a/mythtv/libs/libmythui/mythuibutton.cpp +++ b/mythtv/libs/libmythui/mythuibutton.cpp @@ -104,7 +104,7 @@ void MythUIButton::SetState(const QString& state) m_BackgroundState->DisplayState(m_state); - MythUIGroup *activeState = dynamic_cast + auto *activeState = dynamic_cast (m_BackgroundState->GetCurrentState()); if (activeState) @@ -230,7 +230,7 @@ void MythUIButton::SetText(const QString &msg) m_Message = msg; - MythUIGroup *activeState = dynamic_cast + auto *activeState = dynamic_cast (m_BackgroundState->GetCurrentState()); if (activeState) @@ -274,7 +274,7 @@ bool MythUIButton::ParseElement( */ void MythUIButton::CreateCopy(MythUIType *parent) { - MythUIButton *button = new MythUIButton(parent, objectName()); + auto *button = new MythUIButton(parent, objectName()); button->CopyFrom(this); } @@ -283,8 +283,7 @@ void MythUIButton::CreateCopy(MythUIType *parent) */ void MythUIButton::CopyFrom(MythUIType *base) { - MythUIButton *button = dynamic_cast(base); - + auto *button = dynamic_cast(base); if (!button) { LOG(VB_GENERAL, LOG_ERR, "Dynamic cast of base failed"); diff --git a/mythtv/libs/libmythui/mythuibuttonlist.cpp b/mythtv/libs/libmythui/mythuibuttonlist.cpp index 7bbc56b503a..11fe6b54846 100644 --- a/mythtv/libs/libmythui/mythuibuttonlist.cpp +++ b/mythtv/libs/libmythui/mythuibuttonlist.cpp @@ -212,7 +212,7 @@ MythUIGroup *MythUIButtonList::PrepareButton(int buttonIdx, int itemIdx, if (buttonIdx < 0 || buttonIdx + 1 > m_maxVisible) { QString name = QString("buttonlist button %1").arg(m_maxVisible); - MythUIStateType *button = new MythUIStateType(this, name); + auto *button = new MythUIStateType(this, name); button->CopyFrom(m_buttontemplate); button->ConnectDependants(true); @@ -238,7 +238,7 @@ MythUIGroup *MythUIButtonList::PrepareButton(int buttonIdx, int itemIdx, MythUIStateType *realButton = m_ButtonList[buttonIdx]; m_ButtonToItem[buttonIdx] = buttonItem; buttonItem->SetToRealButton(realButton, itemIdx == m_selPosition); - MythUIGroup *buttonstate = + auto *buttonstate = dynamic_cast(realButton->GetCurrentState()); if (itemIdx == m_selPosition) @@ -1153,7 +1153,7 @@ bool MythUIButtonList::DistributeButtons(void) if (buttonIdx >= first_button) { MythUIStateType *realButton = m_ButtonList[buttonIdx]; - MythUIGroup *buttonstate = dynamic_cast + auto *buttonstate = dynamic_cast (realButton->GetCurrentState()); if (!buttonstate) break; // Not continue @@ -1694,7 +1694,7 @@ void MythUIButtonList::InitButton(int itemIdx, MythUIStateType* & realButton, if (m_maxVisible == 0) { QString name("buttonlist button 0"); - MythUIStateType *button = new MythUIStateType(this, name); + auto *button = new MythUIStateType(this, name); button->CopyFrom(m_buttontemplate); button->ConnectDependants(true); m_ButtonList.append(button); @@ -1742,7 +1742,7 @@ int MythUIButtonList::PageUp(void) MythUIButtonListItem *buttonItem = nullptr; InitButton(pos, realButton, buttonItem); buttonItem->SetToRealButton(realButton, true); - MythUIGroup *buttonstate = dynamic_cast + auto *buttonstate = dynamic_cast (realButton->GetCurrentState()); if (buttonstate == nullptr) @@ -1795,7 +1795,7 @@ int MythUIButtonList::PageUp(void) MythUIButtonListItem *buttonItem = nullptr; InitButton(pos, realButton, buttonItem); buttonItem->SetToRealButton(realButton, true); - MythUIGroup *buttonstate = dynamic_cast + auto *buttonstate = dynamic_cast (realButton->GetCurrentState()); if (buttonstate == nullptr) @@ -1848,7 +1848,7 @@ int MythUIButtonList::PageDown(void) MythUIButtonListItem *buttonItem = nullptr; InitButton(pos, realButton, buttonItem); buttonItem->SetToRealButton(realButton, true); - MythUIGroup *buttonstate = dynamic_cast + auto *buttonstate = dynamic_cast (realButton->GetCurrentState()); if (buttonstate == nullptr) @@ -1901,7 +1901,7 @@ int MythUIButtonList::PageDown(void) MythUIButtonListItem *buttonItem = nullptr; InitButton(pos, realButton, buttonItem); buttonItem->SetToRealButton(realButton, true); - MythUIGroup *buttonstate = dynamic_cast + auto *buttonstate = dynamic_cast (realButton->GetCurrentState()); if (!buttonstate) @@ -2389,7 +2389,7 @@ void MythUIButtonList::Init() for (int i = 0; i < (int)m_itemsVisible; ++i) { QString name = QString("buttonlist button %1").arg(i); - MythUIStateType *button = new MythUIStateType(this, name); + auto *button = new MythUIStateType(this, name); button->CopyFrom(m_buttontemplate); button->ConnectDependants(true); @@ -2601,8 +2601,7 @@ bool MythUIButtonList::gestureEvent(MythGestureEvent *event) if (!type) return false; - MythUIStateType *object = dynamic_cast(type); - + auto *object = dynamic_cast(type); if (object) { handled = true; @@ -2705,8 +2704,7 @@ void MythUIButtonList::customEvent(QEvent *event) { if (event->type() == NextButtonListPageEvent::kEventType) { - NextButtonListPageEvent *npe = - static_cast(event); + auto *npe = static_cast(event); int cur = npe->m_start; for (; cur < npe->m_start + npe->m_pageSize && cur < GetCount(); ++cur) { @@ -2928,7 +2926,7 @@ void MythUIButtonList::DrawSelf(MythPainter * /*p*/, int /*xoffset*/, int /*yoff */ void MythUIButtonList::CreateCopy(MythUIType *parent) { - MythUIButtonList *lb = new MythUIButtonList(parent, objectName()); + auto *lb = new MythUIButtonList(parent, objectName()); lb->CopyFrom(this); } @@ -2937,8 +2935,7 @@ void MythUIButtonList::CreateCopy(MythUIType *parent) */ void MythUIButtonList::CopyFrom(MythUIType *base) { - MythUIButtonList *lb = dynamic_cast(base); - + auto *lb = dynamic_cast(base); if (!lb) return; @@ -3067,7 +3064,7 @@ void MythUIButtonList::ShowSearchDialog(void) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - SearchButtonListDialog *dlg = new SearchButtonListDialog(popupStack, "MythSearchListDialog", this, ""); + auto *dlg = new SearchButtonListDialog(popupStack, "MythSearchListDialog", this, ""); if (dlg->Create()) { @@ -3594,8 +3591,7 @@ void MythUIButtonListItem::SetToRealButton(MythUIStateType *button, bool selecte } // End compatibility code - MythUIGroup *buttonstate = dynamic_cast - (button->GetState(state)); + auto *buttonstate = dynamic_cast(button->GetState(state)); if (!buttonstate) { LOG(VB_GENERAL, LOG_CRIT, QString("Theme Error: Missing buttonlist state: %1") @@ -3656,7 +3652,7 @@ void MythUIButtonListItem::SetToRealButton(MythUIStateType *button, bool selecte while (string_it != m_strings.end()) { - MythUIText *text = dynamic_cast + auto *text = dynamic_cast (buttonstate->GetChild(string_it.key())); if (text) @@ -3712,9 +3708,8 @@ void MythUIButtonListItem::SetToRealButton(MythUIStateType *button, bool selecte while (imagefile_it != m_imageFilenames.end()) { - MythUIImage *image = dynamic_cast + auto *image = dynamic_cast (buttonstate->GetChild(imagefile_it.key())); - if (image) { if (!imagefile_it.value().isEmpty()) @@ -3733,9 +3728,8 @@ void MythUIButtonListItem::SetToRealButton(MythUIStateType *button, bool selecte while (image_it != m_images.end()) { - MythUIImage *image = dynamic_cast + auto *image = dynamic_cast (buttonstate->GetChild(image_it.key())); - if (image) { if (image_it.value()) @@ -3751,9 +3745,8 @@ void MythUIButtonListItem::SetToRealButton(MythUIStateType *button, bool selecte while (state_it != m_states.end()) { - MythUIStateType *statetype = dynamic_cast + auto *statetype = dynamic_cast (buttonstate->GetChild(state_it.key())); - if (statetype) { if (!statetype->DisplayState(state_it.value())) diff --git a/mythtv/libs/libmythui/mythuibuttontree.cpp b/mythtv/libs/libmythui/mythuibuttontree.cpp index 832b0000c26..1e2e43c327e 100644 --- a/mythtv/libs/libmythui/mythuibuttontree.cpp +++ b/mythtv/libs/libmythui/mythuibuttontree.cpp @@ -50,7 +50,7 @@ void MythUIButtonTree::Init() while (i < (int)m_numLists) { QString listname = QString("buttontree list %1").arg(i); - MythUIButtonList *list = new MythUIButtonList(this, listname); + auto *list = new MythUIButtonList(this, listname); list->CopyFrom(m_listTemplate); list->SetVisible(false); list->SetActive(false); @@ -387,7 +387,7 @@ void MythUIButtonTree::RemoveItem(MythUIButtonListItem *item, bool deleteNode) if (!item || !m_rootNode) return; - MythGenericTree *node = item->GetData().value(); + auto *node = item->GetData().value(); if (node && node->getParent()) { @@ -523,7 +523,7 @@ void MythUIButtonTree::handleSelect(MythUIButtonListItem *item) m_activeList = list; - MythGenericTree *node = item->GetData().value (); + auto *node = item->GetData().value (); DoSetCurrentNode(node); SetTreeState(); } @@ -538,7 +538,7 @@ void MythUIButtonTree::handleClick(MythUIButtonListItem *item) if (!item) return; - MythGenericTree *node = item->GetData().value(); + auto *node = item->GetData().value(); if (DoSetCurrentNode(node)) emit itemClicked(item); @@ -633,7 +633,7 @@ bool MythUIButtonTree::gestureEvent(MythGestureEvent *event) if (!type) return false; - MythUIButtonList *list = dynamic_cast(type); + auto *list = dynamic_cast(type); if (list) handled = list->gestureEvent(event); @@ -669,7 +669,7 @@ bool MythUIButtonTree::ParseElement( */ void MythUIButtonTree::CreateCopy(MythUIType *parent) { - MythUIButtonTree *bt = new MythUIButtonTree(parent, objectName()); + auto *bt = new MythUIButtonTree(parent, objectName()); bt->CopyFrom(this); } @@ -678,7 +678,7 @@ void MythUIButtonTree::CreateCopy(MythUIType *parent) */ void MythUIButtonTree::CopyFrom(MythUIType *base) { - MythUIButtonTree *bt = dynamic_cast(base); + auto *bt = dynamic_cast(base); if (!bt) return; diff --git a/mythtv/libs/libmythui/mythuicheckbox.cpp b/mythtv/libs/libmythui/mythuicheckbox.cpp index f3b126ad301..f44e8bf3e6a 100644 --- a/mythtv/libs/libmythui/mythuicheckbox.cpp +++ b/mythtv/libs/libmythui/mythuicheckbox.cpp @@ -186,7 +186,7 @@ bool MythUICheckBox::keyPressEvent(QKeyEvent *event) */ void MythUICheckBox::CreateCopy(MythUIType *parent) { - MythUICheckBox *checkbox = new MythUICheckBox(parent, objectName()); + auto *checkbox = new MythUICheckBox(parent, objectName()); checkbox->CopyFrom(this); } @@ -195,7 +195,7 @@ void MythUICheckBox::CreateCopy(MythUIType *parent) */ void MythUICheckBox::CopyFrom(MythUIType *base) { - MythUICheckBox *button = dynamic_cast(base); + auto *button = dynamic_cast(base); if (!button) { diff --git a/mythtv/libs/libmythui/mythuiclock.cpp b/mythtv/libs/libmythui/mythuiclock.cpp index b3f5272e327..877e4815b74 100644 --- a/mythtv/libs/libmythui/mythuiclock.cpp +++ b/mythtv/libs/libmythui/mythuiclock.cpp @@ -109,7 +109,7 @@ bool MythUIClock::ParseElement( */ void MythUIClock::CopyFrom(MythUIType *base) { - MythUIClock *clock = dynamic_cast(base); + auto *clock = dynamic_cast(base); if (!clock) { @@ -135,6 +135,6 @@ void MythUIClock::CopyFrom(MythUIType *base) */ void MythUIClock::CreateCopy(MythUIType *parent) { - MythUIClock *clock = new MythUIClock(parent, objectName()); + auto *clock = new MythUIClock(parent, objectName()); clock->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuicomposite.cpp b/mythtv/libs/libmythui/mythuicomposite.cpp index 11e1e3abae7..d484b93e7ea 100644 --- a/mythtv/libs/libmythui/mythuicomposite.cpp +++ b/mythtv/libs/libmythui/mythuicomposite.cpp @@ -15,11 +15,11 @@ void MythUIComposite::SetTextFromMap(const InfoMap &infoMap) { MythUIType *type = i.next(); - MythUIText *textType = dynamic_cast (type); + auto *textType = dynamic_cast (type); if (textType) textType->SetTextFromMap(infoMap); - MythUIComposite *group = dynamic_cast (type); + auto *group = dynamic_cast (type); if (group) group->SetTextFromMap(infoMap); } @@ -37,11 +37,11 @@ void MythUIComposite::ResetMap(const InfoMap &infoMap) { MythUIType *type = i.next(); - MythUIText *textType = dynamic_cast (type); + auto *textType = dynamic_cast (type); if (textType) textType->ResetMap(infoMap); - MythUIComposite *group = dynamic_cast (type); + auto *group = dynamic_cast (type); if (group) group->ResetMap(infoMap); } diff --git a/mythtv/libs/libmythui/mythuieditbar.cpp b/mythtv/libs/libmythui/mythuieditbar.cpp index 6ff9a6fd35d..4253109a94c 100644 --- a/mythtv/libs/libmythui/mythuieditbar.cpp +++ b/mythtv/libs/libmythui/mythuieditbar.cpp @@ -127,12 +127,12 @@ void MythUIEditBar::Display(void) return; } - MythUIShape *barshape = dynamic_cast(cut); - MythUIImage *barimage = dynamic_cast(cut); - MythUIShape *leftshape = dynamic_cast(cuttoleft); - MythUIImage *leftimage = dynamic_cast(cuttoleft); - MythUIShape *rightshape = dynamic_cast(cuttoright); - MythUIImage *rightimage = dynamic_cast(cuttoright); + auto *barshape = dynamic_cast(cut); + auto *barimage = dynamic_cast(cut); + auto *leftshape = dynamic_cast(cuttoleft); + auto *leftimage = dynamic_cast(cuttoleft); + auto *rightshape = dynamic_cast(cuttoright); + auto *rightimage = dynamic_cast(cuttoright); QListIterator > regions(m_regions); @@ -202,8 +202,8 @@ void MythUIEditBar::AddBar(MythUIShape *_shape, MythUIImage *_image, if (add) { - MythUIShape *shape = dynamic_cast(add); - MythUIImage *image = dynamic_cast(add); + auto *shape = dynamic_cast(add); + auto *image = dynamic_cast(add); if (shape) shape->SetCropRect(area.left(), area.top(), area.width(), area.height()); @@ -235,7 +235,7 @@ MythUIType *MythUIEditBar::GetNew(MythUIShape *shape, MythUIImage *image) if (shape) { - MythUIShape *newshape = new MythUIShape(this, name); + auto *newshape = new MythUIShape(this, name); if (newshape) { @@ -247,7 +247,7 @@ MythUIType *MythUIEditBar::GetNew(MythUIShape *shape, MythUIImage *image) } else if (image) { - MythUIImage *newimage = new MythUIImage(this, name); + auto *newimage = new MythUIImage(this, name); if (newimage) { @@ -304,7 +304,7 @@ void MythUIEditBar::ClearImages(void) */ void MythUIEditBar::CopyFrom(MythUIType *base) { - MythUIEditBar *editbar = dynamic_cast(base); + auto *editbar = dynamic_cast(base); if (!editbar) return; @@ -324,7 +324,7 @@ void MythUIEditBar::CopyFrom(MythUIType *base) */ void MythUIEditBar::CreateCopy(MythUIType *parent) { - MythUIEditBar *editbar = new MythUIEditBar(parent, objectName()); + auto *editbar = new MythUIEditBar(parent, objectName()); editbar->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuifilebrowser.cpp b/mythtv/libs/libmythui/mythuifilebrowser.cpp index 82ac23e5a04..2920bb7c71b 100644 --- a/mythtv/libs/libmythui/mythuifilebrowser.cpp +++ b/mythtv/libs/libmythui/mythuifilebrowser.cpp @@ -291,9 +291,8 @@ void MythUIFileBrowser::PathClicked(MythUIButtonListItem *item) { if (m_retObject) { - DialogCompletionEvent *dce = - new DialogCompletionEvent(m_id, 0, finfo.filePath(), - item->GetData()); + auto *dce = new DialogCompletionEvent(m_id, 0, finfo.filePath(), + item->GetData()); QCoreApplication::postEvent(m_retObject, dce); } @@ -400,9 +399,8 @@ void MythUIFileBrowser::OKPressed() if (m_retObject) { QString selectedPath = m_locationEdit->GetText(); - DialogCompletionEvent *dce = new DialogCompletionEvent(m_id, 0, - selectedPath, - item->GetData()); + auto *dce = new DialogCompletionEvent(m_id, 0, selectedPath, + item->GetData()); QCoreApplication::postEvent(m_retObject, dce); } @@ -493,9 +491,8 @@ void MythUIFileBrowser::updateRemoteFileList() m_parentSGDir = ""; } - MythUIButtonListItem *item = new MythUIButtonListItem( - m_fileList, displayName, - qVariantFromValue(finfo)); + auto *item = new MythUIButtonListItem(m_fileList, displayName, + qVariantFromValue(finfo)); item->SetText(QString("0"), "filesize"); item->SetText(m_parentDir, "fullpath"); @@ -570,9 +567,8 @@ void MythUIFileBrowser::updateRemoteFileList() continue; } - MythUIButtonListItem *item = - new MythUIButtonListItem(m_fileList, displayName, - qVariantFromValue(finfo)); + auto *item = new MythUIButtonListItem(m_fileList, displayName, + qVariantFromValue(finfo)); if (finfo.size()) item->SetText(FormatSize(finfo.size()), "filesize"); @@ -610,8 +606,8 @@ void MythUIFileBrowser::updateLocalFileList() if (list.isEmpty()) { - MythUIButtonListItem *item = new MythUIButtonListItem(m_fileList, - tr("Parent Directory")); + auto *item = new MythUIButtonListItem(m_fileList, + tr("Parent Directory")); item->DisplayState("upfolder", "nodetype"); } else @@ -657,9 +653,8 @@ void MythUIFileBrowser::updateLocalFileList() type = "file"; } - MythUIButtonListItem *item = - new MythUIButtonListItem(m_fileList, displayName, - qVariantFromValue(finfo)); + auto *item = new MythUIButtonListItem(m_fileList, displayName, + qVariantFromValue(finfo)); if (IsImage(finfo.suffix())) { diff --git a/mythtv/libs/libmythui/mythuigroup.cpp b/mythtv/libs/libmythui/mythuigroup.cpp index 3222162cced..71eea2ad518 100644 --- a/mythtv/libs/libmythui/mythuigroup.cpp +++ b/mythtv/libs/libmythui/mythuigroup.cpp @@ -8,8 +8,7 @@ void MythUIGroup::Reset() void MythUIGroup::CopyFrom(MythUIType *base) { - MythUIGroup *group = dynamic_cast(base); - + auto *group = dynamic_cast(base); if (!group) return; @@ -18,6 +17,6 @@ void MythUIGroup::CopyFrom(MythUIType *base) void MythUIGroup::CreateCopy(MythUIType *parent) { - MythUIGroup *group = new MythUIGroup(parent, objectName()); + auto *group = new MythUIGroup(parent, objectName()); group->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuiguidegrid.cpp b/mythtv/libs/libmythui/mythuiguidegrid.cpp index 1ddac8fa72e..9b97259b4aa 100644 --- a/mythtv/libs/libmythui/mythuiguidegrid.cpp +++ b/mythtv/libs/libmythui/mythuiguidegrid.cpp @@ -212,7 +212,7 @@ bool MythUIGuideGrid::ParseElement( void MythUIGuideGrid::CopyFrom(MythUIType *base) { - MythUIGuideGrid *gg = dynamic_cast(base); + auto *gg = dynamic_cast(base); if (!gg) { @@ -247,7 +247,7 @@ void MythUIGuideGrid::CopyFrom(MythUIType *base) void MythUIGuideGrid::CreateCopy(MythUIType *parent) { - MythUIGuideGrid *gg = new MythUIGuideGrid(parent, objectName()); + auto *gg = new MythUIGuideGrid(parent, objectName()); gg->CopyFrom(this); } @@ -689,7 +689,7 @@ void MythUIGuideGrid::SetProgramInfo(int row, int col, const QRect &area, bool selected) { (void)col; - UIGTCon *data = new UIGTCon(area, title, genre, arrow, recType, recStat); + auto *data = new UIGTCon(area, title, genre, arrow, recType, recStat); m_allData[row].append(data); if (m_drawCategoryColors) @@ -774,7 +774,7 @@ void MythUIGuideGrid::SetCategoryColors(const QMap &catC) void MythUIGuideGrid::LoadImage(int recType, const QString &file) { - MythUIImage *uiimage = new MythUIImage(file, this, "guidegrid image"); + auto *uiimage = new MythUIImage(file, this, "guidegrid image"); uiimage->m_imageProperties.m_isThemeImage = true; uiimage->SetVisible(false); uiimage->Load(false); @@ -786,7 +786,7 @@ void MythUIGuideGrid::LoadImage(int recType, const QString &file) void MythUIGuideGrid::SetArrow(int direction, const QString &file) { - MythUIImage *uiimage = new MythUIImage(file, this, "guidegrid arrow"); + auto *uiimage = new MythUIImage(file, this, "guidegrid arrow"); uiimage->m_imageProperties.m_isThemeImage = true; uiimage->SetVisible(false); uiimage->Load(false); diff --git a/mythtv/libs/libmythui/mythuihelper.cpp b/mythtv/libs/libmythui/mythuihelper.cpp index 3dbecce2cc5..697de4f3e12 100644 --- a/mythtv/libs/libmythui/mythuihelper.cpp +++ b/mythtv/libs/libmythui/mythuihelper.cpp @@ -463,8 +463,7 @@ void MythUIHelper::LoadQtConfig(void) QString themename = GetMythDB()->GetSetting("Theme", DEFAULT_UI_THEME); QString themedir = FindThemeDir(themename); - ThemeInfo *themeinfo = new ThemeInfo(themedir); - + auto *themeinfo = new ThemeInfo(themedir); if (themeinfo) { d->m_isWide = themeinfo->IsWide(); diff --git a/mythtv/libs/libmythui/mythuiimage.cpp b/mythtv/libs/libmythui/mythuiimage.cpp index 7219aa2696c..bc175d29b37 100644 --- a/mythtv/libs/libmythui/mythuiimage.cpp +++ b/mythtv/libs/libmythui/mythuiimage.cpp @@ -391,9 +391,8 @@ class ImageLoader QString frameFilename; int imageCount = 1; - MythImageReader *imageReader = new MythImageReader(imProps.m_filename); - - AnimationFrames *images = new AnimationFrames(); + auto *imageReader = new MythImageReader(imProps.m_filename); + auto *images = new AnimationFrames(); while (imageReader->canRead() && !aborted) { @@ -503,10 +502,9 @@ class ImageLoadThread : public QRunnable if (frames && frames->count() > 1) { - ImageLoadEvent *le = new ImageLoadEvent(m_parent, frames, - m_basefile, - m_imageProperties.m_filename, - aborted); + auto *le = new ImageLoadEvent(m_parent, frames, m_basefile, + m_imageProperties.m_filename, + aborted); QCoreApplication::postEvent(m_parent, le); return; @@ -519,9 +517,9 @@ class ImageLoadThread : public QRunnable m_cacheMode, m_parent, aborted); - ImageLoadEvent *le = new ImageLoadEvent(m_parent, image, m_basefile, - m_imageProperties.m_filename, - m_number, aborted); + auto *le = new ImageLoadEvent(m_parent, image, m_basefile, + m_imageProperties.m_filename, + m_number, aborted); QCoreApplication::postEvent(m_parent, le); } @@ -1038,8 +1036,7 @@ bool MythUIImage::Load(bool allowLoadInBackground, bool forceStat) QString("Load(), spawning thread to load '%1'").arg(filename)); m_runningThreads++; - ImageLoadThread *bImgThread = - new ImageLoadThread(this, GetPainter(), + auto *bImgThread = new ImageLoadThread(this, GetPainter(), imProps, bFilename, i, static_cast(cacheMode2)); GetMythUI()->GetImageThreadPool()->start(bImgThread, "ImageLoad"); @@ -1421,8 +1418,7 @@ bool MythUIImage::ParseElement( void MythUIImage::CopyFrom(MythUIType *base) { d->m_updateLock.lockForWrite(); - MythUIImage *im = dynamic_cast(base); - + auto *im = dynamic_cast(base); if (!im) { LOG(VB_GENERAL, LOG_ERR, @@ -1478,7 +1474,7 @@ void MythUIImage::CopyFrom(MythUIType *base) void MythUIImage::CreateCopy(MythUIType *parent) { QReadLocker updateLocker(&d->m_updateLock); - MythUIImage *im = new MythUIImage(parent, objectName()); + auto *im = new MythUIImage(parent, objectName()); im->CopyFrom(this); } @@ -1528,8 +1524,7 @@ void MythUIImage::customEvent(QEvent *event) { if (event->type() == ImageLoadEvent::kEventType) { - ImageLoadEvent *le = static_cast(event); - + auto *le = static_cast(event); if (le->GetParent() != this) return; diff --git a/mythtv/libs/libmythui/mythuiprogressbar.cpp b/mythtv/libs/libmythui/mythuiprogressbar.cpp index 35d41c0ab04..cdfb4e78e52 100644 --- a/mythtv/libs/libmythui/mythuiprogressbar.cpp +++ b/mythtv/libs/libmythui/mythuiprogressbar.cpp @@ -138,8 +138,8 @@ void MythUIProgressBar::CalculatePosition(void) break; } - MythUIImage *progressImage = dynamic_cast(progressType); - MythUIShape *progressShape = dynamic_cast(progressType); + auto *progressImage = dynamic_cast(progressType); + auto *progressShape = dynamic_cast(progressType); if (width <= 0) width = 1; @@ -162,7 +162,7 @@ void MythUIProgressBar::Finalize() void MythUIProgressBar::CopyFrom(MythUIType *base) { - MythUIProgressBar *progressbar = dynamic_cast(base); + auto *progressbar = dynamic_cast(base); if (!progressbar) return; @@ -179,7 +179,7 @@ void MythUIProgressBar::CopyFrom(MythUIType *base) void MythUIProgressBar::CreateCopy(MythUIType *parent) { - MythUIProgressBar *progressbar = new MythUIProgressBar(parent, objectName()); + auto *progressbar = new MythUIProgressBar(parent, objectName()); progressbar->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuiscrollbar.cpp b/mythtv/libs/libmythui/mythuiscrollbar.cpp index 774d94762c7..030d53ab53f 100644 --- a/mythtv/libs/libmythui/mythuiscrollbar.cpp +++ b/mythtv/libs/libmythui/mythuiscrollbar.cpp @@ -145,7 +145,7 @@ void MythUIScrollBar::Finalize() void MythUIScrollBar::CopyFrom(MythUIType *base) { - MythUIScrollBar *scrollbar = dynamic_cast(base); + auto *scrollbar = dynamic_cast(base); if (!scrollbar) return; @@ -158,7 +158,7 @@ void MythUIScrollBar::CopyFrom(MythUIType *base) void MythUIScrollBar::CreateCopy(MythUIType *parent) { - MythUIScrollBar *scrollbar = new MythUIScrollBar(parent, objectName()); + auto *scrollbar = new MythUIScrollBar(parent, objectName()); scrollbar->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuishape.cpp b/mythtv/libs/libmythui/mythuishape.cpp index 446f413a21f..5c653c17751 100644 --- a/mythtv/libs/libmythui/mythuishape.cpp +++ b/mythtv/libs/libmythui/mythuishape.cpp @@ -149,7 +149,7 @@ bool MythUIShape::ParseElement( */ void MythUIShape::CopyFrom(MythUIType *base) { - MythUIShape *shape = dynamic_cast(base); + auto *shape = dynamic_cast(base); if (!shape) { @@ -171,6 +171,6 @@ void MythUIShape::CopyFrom(MythUIType *base) */ void MythUIShape::CreateCopy(MythUIType *parent) { - MythUIShape *shape = new MythUIShape(parent, objectName()); + auto *shape = new MythUIShape(parent, objectName()); shape->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuisimpletext.cpp b/mythtv/libs/libmythui/mythuisimpletext.cpp index 037c639280a..a83bac67d23 100644 --- a/mythtv/libs/libmythui/mythuisimpletext.cpp +++ b/mythtv/libs/libmythui/mythuisimpletext.cpp @@ -44,7 +44,7 @@ void MythUISimpleText::DrawSelf(MythPainter *p, int xoffset, int yoffset, void MythUISimpleText::CopyFrom(MythUIType *base) { - MythUISimpleText *text = dynamic_cast(base); + auto *text = dynamic_cast(base); if (!text) { @@ -61,6 +61,6 @@ void MythUISimpleText::CopyFrom(MythUIType *base) void MythUISimpleText::CreateCopy(MythUIType *parent) { - MythUISimpleText *text = new MythUISimpleText(parent, objectName()); + auto *text = new MythUISimpleText(parent, objectName()); text->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuispinbox.cpp b/mythtv/libs/libmythui/mythuispinbox.cpp index 7d7ac2383df..59503a819fe 100644 --- a/mythtv/libs/libmythui/mythuispinbox.cpp +++ b/mythtv/libs/libmythui/mythuispinbox.cpp @@ -178,7 +178,7 @@ bool MythUISpinBox::MoveUp(MovementUnit unit, uint amount) */ void MythUISpinBox::CreateCopy(MythUIType *parent) { - MythUISpinBox *spinbox = new MythUISpinBox(parent, objectName()); + auto *spinbox = new MythUISpinBox(parent, objectName()); spinbox->CopyFrom(this); } @@ -187,7 +187,7 @@ void MythUISpinBox::CreateCopy(MythUIType *parent) */ void MythUISpinBox::CopyFrom(MythUIType *base) { - MythUISpinBox *spinbox = dynamic_cast(base); + auto *spinbox = dynamic_cast(base); if (!spinbox) return; @@ -265,7 +265,7 @@ void MythUISpinBox::ShowEntryDialog(QString initialEntry) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - SpinBoxEntryDialog *dlg = new SpinBoxEntryDialog(popupStack, "SpinBoxEntryDialog", + auto *dlg = new SpinBoxEntryDialog(popupStack, "SpinBoxEntryDialog", this, std::move(initialEntry), m_low, m_high, m_step); if (dlg->Create()) diff --git a/mythtv/libs/libmythui/mythuistatetracker.cpp b/mythtv/libs/libmythui/mythuistatetracker.cpp index dcbd0084531..093df5099b5 100644 --- a/mythtv/libs/libmythui/mythuistatetracker.cpp +++ b/mythtv/libs/libmythui/mythuistatetracker.cpp @@ -44,7 +44,7 @@ void MythUIStateTracker::GetFreshState(QVariantMap &state) return; } - MythEvent *e = new MythEvent(ACTION_GETSTATUS); + auto *e = new MythEvent(ACTION_GETSTATUS); qApp->postEvent(GetMythMainWindow(), e); int tries = 0; diff --git a/mythtv/libs/libmythui/mythuistatetype.cpp b/mythtv/libs/libmythui/mythuistatetype.cpp index b510378e7dd..f18dee16f4a 100644 --- a/mythtv/libs/libmythui/mythuistatetype.cpp +++ b/mythtv/libs/libmythui/mythuistatetype.cpp @@ -28,7 +28,7 @@ bool MythUIStateType::AddImage(const QString &name, MythImage *image) // Uses name, not key which is lower case otherwise we break // inheritance - MythUIImage *imType = new MythUIImage(this, name); + auto *imType = new MythUIImage(this, name); imType->SetImage(image); return AddObject(key, imType); @@ -59,7 +59,7 @@ bool MythUIStateType::AddImage(StateType type, MythImage *image) QString name = QString("stateimage%1").arg(type); - MythUIImage *imType = new MythUIImage(this, name); + auto *imType = new MythUIImage(this, name); imType->SetImage(image); return AddObject(type, imType); @@ -263,7 +263,7 @@ bool MythUIStateType::ParseElement( void MythUIStateType::CopyFrom(MythUIType *base) { - MythUIStateType *st = dynamic_cast(base); + auto *st = dynamic_cast(base); if (!st) return; @@ -299,7 +299,7 @@ void MythUIStateType::CopyFrom(MythUIType *base) void MythUIStateType::CreateCopy(MythUIType *parent) { - MythUIStateType *st = new MythUIStateType(parent, objectName()); + auto *st = new MythUIStateType(parent, objectName()); st->CopyFrom(this); } @@ -340,7 +340,7 @@ void MythUIStateType::RecalculateArea(bool recurse) { if (objectName().startsWith("buttonlist button")) { - MythUIButtonList *list = static_cast(m_Parent); + auto *list = static_cast(m_Parent); m_ParentArea = list->GetButtonArea(); } else @@ -395,11 +395,11 @@ void MythUIStateType::SetTextFromMap(const InfoMap &infoMap) { MythUIType *type = i.value(); - MythUIText *textType = dynamic_cast (type); + auto *textType = dynamic_cast (type); if (textType) textType->SetTextFromMap(infoMap); - MythUIComposite *group = dynamic_cast (type); + auto *group = dynamic_cast (type); if (group) group->SetTextFromMap(infoMap); } @@ -410,11 +410,11 @@ void MythUIStateType::SetTextFromMap(const InfoMap &infoMap) { MythUIType *type = j.value(); - MythUIText *textType = dynamic_cast (type); + auto *textType = dynamic_cast (type); if (textType) textType->SetTextFromMap(infoMap); - MythUIComposite *group = dynamic_cast (type); + auto *group = dynamic_cast (type); if (group) group->SetTextFromMap(infoMap); } diff --git a/mythtv/libs/libmythui/mythuitext.cpp b/mythtv/libs/libmythui/mythuitext.cpp index 72655f771d0..a12f0cacd91 100644 --- a/mythtv/libs/libmythui/mythuitext.cpp +++ b/mythtv/libs/libmythui/mythuitext.cpp @@ -1615,7 +1615,7 @@ bool MythUIText::ParseElement( void MythUIText::CopyFrom(MythUIType *base) { - MythUIText *text = dynamic_cast(base); + auto *text = dynamic_cast(base); if (!text) { @@ -1682,7 +1682,7 @@ void MythUIText::CopyFrom(MythUIType *base) void MythUIText::CreateCopy(MythUIType *parent) { - MythUIText *text = new MythUIText(parent, objectName()); + auto *text = new MythUIText(parent, objectName()); text->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuitextedit.cpp b/mythtv/libs/libmythui/mythuitextedit.cpp index 63913855ee0..13e5dcc346a 100644 --- a/mythtv/libs/libmythui/mythuitextedit.cpp +++ b/mythtv/libs/libmythui/mythuitextedit.cpp @@ -527,7 +527,7 @@ bool MythUITextEdit::keyPressEvent(QKeyEvent *event) && GetMythDB()->GetNumSetting("UseVirtualKeyboard", 1) == 1) { MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythUIVirtualKeyboard *kb = new MythUIVirtualKeyboard(popupStack, this); + auto *kb = new MythUIVirtualKeyboard(popupStack, this); if (kb->Create()) { @@ -576,7 +576,7 @@ bool MythUITextEdit::gestureEvent(MythGestureEvent *event) void MythUITextEdit::CopyFrom(MythUIType *base) { - MythUITextEdit *textedit = dynamic_cast(base); + auto *textedit = dynamic_cast(base); if (!textedit) { @@ -600,6 +600,6 @@ void MythUITextEdit::CopyFrom(MythUIType *base) void MythUITextEdit::CreateCopy(MythUIType *parent) { - MythUITextEdit *textedit = new MythUITextEdit(parent, objectName()); + auto *textedit = new MythUITextEdit(parent, objectName()); textedit->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuitype.cpp b/mythtv/libs/libmythui/mythuitype.cpp index e37d1a30373..bc6bc26a6c5 100644 --- a/mythtv/libs/libmythui/mythuitype.cpp +++ b/mythtv/libs/libmythui/mythuitype.cpp @@ -1070,7 +1070,7 @@ void MythUIType::UpdateDependState(MythUIType *dependee, bool isDefault) void MythUIType::UpdateDependState(bool isDefault) { - MythUIType *dependee = static_cast(sender()); + auto *dependee = static_cast(sender()); UpdateDependState(dependee, isDefault); } @@ -1172,7 +1172,7 @@ void MythUIType::CopyFrom(MythUIType *base) QList::Iterator i; for (i = base->m_animations.begin(); i != base->m_animations.end(); ++i) { - MythUIAnimation* animation = new MythUIAnimation(this); + auto* animation = new MythUIAnimation(this); animation->CopyFrom(*i); m_animations.push_back(animation); } diff --git a/mythtv/libs/libmythui/mythuivideo.cpp b/mythtv/libs/libmythui/mythuivideo.cpp index a6abfe8cdf6..cae01dc2832 100644 --- a/mythtv/libs/libmythui/mythuivideo.cpp +++ b/mythtv/libs/libmythui/mythuivideo.cpp @@ -119,6 +119,6 @@ void MythUIVideo::CopyFrom(MythUIType *base) */ void MythUIVideo::CreateCopy(MythUIType *parent) { - MythUIVideo *im = new MythUIVideo(parent, objectName()); + auto *im = new MythUIVideo(parent, objectName()); im->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythuiwebbrowser.cpp b/mythtv/libs/libmythui/mythuiwebbrowser.cpp index 84c940fab69..241dd40f055 100644 --- a/mythtv/libs/libmythui/mythuiwebbrowser.cpp +++ b/mythtv/libs/libmythui/mythuiwebbrowser.cpp @@ -244,7 +244,7 @@ void BrowserApi::customEvent(QEvent *e) { if (e->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast(e); + auto *me = static_cast(e); const QString& message = me->Message(); if (!message.startsWith("MUSIC_CONTROL")) @@ -291,7 +291,7 @@ bool MythWebPage::extension(Extension extension, const ExtensionOption *option, if (!option || !output) return false; - const ErrorPageExtensionOption *erroroption + const auto *erroroption = static_cast(option); ErrorPageExtensionReturn *erroroutput = nullptr; erroroutput = static_cast(output); @@ -536,9 +536,8 @@ void MythWebView::doDownloadRequested(const QNetworkRequest &request) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); QString msg = tr("Enter filename to save file"); - MythTextInputDialog *input = new MythTextInputDialog(popupStack, msg, - FilterNone, false, - saveFilename); + auto *input = new MythTextInputDialog(popupStack, msg, FilterNone, + false, saveFilename); if (input->Create()) { @@ -592,7 +591,7 @@ void MythWebView::customEvent(QEvent *event) { if (event->type() == DialogCompletionEvent::kEventType) { - DialogCompletionEvent *dce = (DialogCompletionEvent *)(event); + auto *dce = (DialogCompletionEvent *)(event); // make sure the user didn't ESCAPE out of the dialog if (dce->GetResult() < 0) @@ -641,7 +640,7 @@ void MythWebView::customEvent(QEvent *event) } else if (event->type() == MythEvent::MythEventMessage) { - MythEvent *me = static_cast(event); + auto *me = static_cast(event); QStringList tokens = me->Message().split(" ", QString::SkipEmptyParts); if (tokens.isEmpty()) @@ -686,7 +685,7 @@ void MythWebView::showDownloadMenu(void) MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); - MythDialogBox *menu = new MythDialogBox(label, popupStack, "downloadmenu"); + auto *menu = new MythDialogBox(label, popupStack, "downloadmenu"); if (!menu->Create()) { @@ -1680,7 +1679,7 @@ void MythUIWebBrowser::HandleMouseAction(const QString &action) { curPos = widget->mapFromGlobal(curPos); - QMouseEvent *me = new QMouseEvent(QEvent::MouseButtonPress, curPos, + auto *me = new QMouseEvent(QEvent::MouseButtonPress, curPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QCoreApplication::postEvent(widget, me); @@ -1763,8 +1762,7 @@ bool MythUIWebBrowser::ParseElement( */ void MythUIWebBrowser::CopyFrom(MythUIType *base) { - MythUIWebBrowser *browser = dynamic_cast(base); - + auto *browser = dynamic_cast(base); if (!browser) { LOG(VB_GENERAL, LOG_ERR, "ERROR, bad parsing"); @@ -1789,6 +1787,6 @@ void MythUIWebBrowser::CopyFrom(MythUIType *base) */ void MythUIWebBrowser::CreateCopy(MythUIType *parent) { - MythUIWebBrowser *browser = new MythUIWebBrowser(parent, objectName()); + auto *browser = new MythUIWebBrowser(parent, objectName()); browser->CopyFrom(this); } diff --git a/mythtv/libs/libmythui/mythvirtualkeyboard.cpp b/mythtv/libs/libmythui/mythvirtualkeyboard.cpp index 85e2bdcedfe..c4b5355bd0b 100644 --- a/mythtv/libs/libmythui/mythvirtualkeyboard.cpp +++ b/mythtv/libs/libmythui/mythvirtualkeyboard.cpp @@ -282,7 +282,7 @@ void MythUIVirtualKeyboard::updateKeys(bool connectSignals) QList *children = GetAllChildren(); for (int i = 0; i < children->size(); ++i) { - MythUIButton *button = dynamic_cast(children->at(i)); + auto *button = dynamic_cast(children->at(i)); if (button) { if (m_keyMap.contains(button->objectName())) @@ -422,7 +422,7 @@ void MythUIVirtualKeyboard::charClicked(void) if (m_parentEdit) { - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, 0, Qt::NoModifier, c); + auto *event = new QKeyEvent(QEvent::KeyPress, 0, Qt::NoModifier, c); m_parentEdit->keyPressEvent(event); } @@ -442,7 +442,7 @@ void MythUIVirtualKeyboard::charClicked(void) if (m_parentEdit) { - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, 0, Qt::NoModifier, c); + auto *event = new QKeyEvent(QEvent::KeyPress, 0, Qt::NoModifier, c); m_parentEdit->keyPressEvent(event); } @@ -483,7 +483,7 @@ void MythUIVirtualKeyboard::delClicked(void) if (m_parentEdit) { //QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Delete, Qt::NoModifier, ""); - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier, ""); + auto *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier, ""); m_parentEdit->keyPressEvent(event); } } @@ -494,7 +494,7 @@ void MythUIVirtualKeyboard::backClicked(void) if (m_parentEdit) { - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier, ""); + auto *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier, ""); m_parentEdit->keyPressEvent(event); } } @@ -530,7 +530,7 @@ void MythUIVirtualKeyboard::returnClicked(void) if (m_shift) { emit keyPressed("{NEWLINE}"); - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, m_newlineKey.keyCode, m_newlineKey.modifiers, ""); + auto *event = new QKeyEvent(QEvent::KeyPress, m_newlineKey.keyCode, m_newlineKey.modifiers, ""); m_parentEdit->keyPressEvent(event); } else @@ -544,13 +544,13 @@ void MythUIVirtualKeyboard::moveleftClicked(void) if (m_shift) { emit keyPressed("{MOVEUP}"); - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, m_upKey.keyCode, m_upKey.modifiers, ""); + auto *event = new QKeyEvent(QEvent::KeyPress, m_upKey.keyCode, m_upKey.modifiers, ""); m_parentEdit->keyPressEvent(event); } else { emit keyPressed("{MOVELEFT}"); - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, m_leftKey.keyCode, m_leftKey.modifiers,""); + auto *event = new QKeyEvent(QEvent::KeyPress, m_leftKey.keyCode, m_leftKey.modifiers,""); m_parentEdit->keyPressEvent(event); } } @@ -563,13 +563,13 @@ void MythUIVirtualKeyboard::moverightClicked(void) if (m_shift) { emit keyPressed("{MOVEDOWN}"); - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, m_downKey.keyCode, m_downKey.modifiers, ""); + auto *event = new QKeyEvent(QEvent::KeyPress, m_downKey.keyCode, m_downKey.modifiers, ""); m_parentEdit->keyPressEvent(event); } else { emit keyPressed("{MOVERIGHT}"); - QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, m_rightKey.keyCode, m_rightKey.modifiers,""); + auto *event = new QKeyEvent(QEvent::KeyPress, m_rightKey.keyCode, m_rightKey.modifiers,""); m_parentEdit->keyPressEvent(event); } } diff --git a/mythtv/libs/libmythui/opengl/mythpainteropengl.cpp b/mythtv/libs/libmythui/opengl/mythpainteropengl.cpp index 27363edb35d..ef0cabcdd53 100644 --- a/mythtv/libs/libmythui/opengl/mythpainteropengl.cpp +++ b/mythtv/libs/libmythui/opengl/mythpainteropengl.cpp @@ -86,7 +86,7 @@ void MythOpenGLPainter::Begin(QPaintDevice *Parent) if (!m_render) { - MythPainterWindowGL* glwin = static_cast(m_parent); + auto* glwin = static_cast(m_parent); if (!glwin) { LOG(VB_GENERAL, LOG_ERR, "FATAL ERROR: Failed to cast parent to MythPainterWindowGL"); diff --git a/mythtv/libs/libmythui/opengl/mythrenderopengl.cpp b/mythtv/libs/libmythui/opengl/mythrenderopengl.cpp index fa3e8d78b16..5741784e6b8 100644 --- a/mythtv/libs/libmythui/opengl/mythrenderopengl.cpp +++ b/mythtv/libs/libmythui/opengl/mythrenderopengl.cpp @@ -70,7 +70,7 @@ MythRenderOpenGL* MythRenderOpenGL::GetOpenGLRender(void) if (!window) return nullptr; - MythRenderOpenGL* result = dynamic_cast(window->GetRenderDevice()); + auto* result = dynamic_cast(window->GetRenderDevice()); if (result) return result; return nullptr; @@ -135,7 +135,7 @@ MythRenderOpenGL::MythRenderOpenGL(const QSurfaceFormat& Format, QPaintDevice* D m_parameters.fill(0); m_transforms.push(QMatrix4x4()); - QWidget *w = dynamic_cast(Device); + auto *w = dynamic_cast(Device); m_window = (w) ? w->windowHandle() : nullptr; setFormat(Format); @@ -573,7 +573,7 @@ MythGLTexture* MythRenderOpenGL::CreateTextureFromQImage(QImage *Image) return nullptr; OpenGLLocker locker(this); - QOpenGLTexture *texture = new QOpenGLTexture(*Image, QOpenGLTexture::DontGenerateMipMaps); + auto *texture = new QOpenGLTexture(*Image, QOpenGLTexture::DontGenerateMipMaps); if (!texture->textureId()) { LOG(VB_GENERAL, LOG_INFO, LOC + "Failed to create texure"); @@ -582,7 +582,7 @@ MythGLTexture* MythRenderOpenGL::CreateTextureFromQImage(QImage *Image) } texture->setMinMagFilters(QOpenGLTexture::Linear, QOpenGLTexture::Linear); texture->setWrapMode(QOpenGLTexture::ClampToEdge); - MythGLTexture *result = new MythGLTexture(texture); + auto *result = new MythGLTexture(texture); result->m_texture = texture; result->m_vbo = CreateVBO(kVertexSize); result->m_totalSize = GetTextureSize(Image->size(), result->m_target != QOpenGLTexture::TargetRectangle); @@ -700,7 +700,7 @@ MythGLTexture* MythRenderOpenGL::CreateFramebufferTexture(QOpenGLFramebufferObje if (!Framebuffer) return nullptr; - MythGLTexture *texture = new MythGLTexture(Framebuffer->texture()); + auto *texture = new MythGLTexture(Framebuffer->texture()); texture->m_size = texture->m_totalSize = Framebuffer->size(); texture->m_vbo = CreateVBO(kVertexSize); texture->m_flip = false; @@ -1154,7 +1154,7 @@ QFunctionPointer MythRenderOpenGL::GetProcAddress(const QString &Proc) const QOpenGLBuffer* MythRenderOpenGL::CreateVBO(int Size, bool Release /*=true*/) { OpenGLLocker locker(this); - QOpenGLBuffer* buffer = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer); + auto* buffer = new QOpenGLBuffer(QOpenGLBuffer::VertexBuffer); if (buffer->create()) { buffer->setUsagePattern(QOpenGLBuffer::StreamDraw); @@ -1295,7 +1295,7 @@ GLfloat* MythRenderOpenGL::GetCachedVertices(GLuint Type, const QRect &Area) return m_cachedVertices[ref]; } - GLfloat *vertices = new GLfloat[8]; + auto *vertices = new GLfloat[8]; vertices[2] = vertices[0] = Area.left(); vertices[5] = vertices[1] = Area.top(); @@ -1457,7 +1457,7 @@ QOpenGLShaderProgram *MythRenderOpenGL::CreateShaderProgram(const QString &Verte OpenGLLocker locker(this); QString vertex = Vertex.isEmpty() ? kDefaultVertexShader : Vertex; QString fragment = Fragment.isEmpty() ? kDefaultFragmentShader: Fragment; - QOpenGLShaderProgram *program = new QOpenGLShaderProgram(); + auto *program = new QOpenGLShaderProgram(); if (!program->addShaderFromSourceCode(QOpenGLShader::Vertex, vertex)) return ShaderError(program, vertex); if (!program->addShaderFromSourceCode(QOpenGLShader::Fragment, fragment)) diff --git a/mythtv/libs/libmythui/platforms/mythdisplayx11.cpp b/mythtv/libs/libmythui/platforms/mythdisplayx11.cpp index 2d4dce8bbfc..f8206477e47 100644 --- a/mythtv/libs/libmythui/platforms/mythdisplayx11.cpp +++ b/mythtv/libs/libmythui/platforms/mythdisplayx11.cpp @@ -127,7 +127,7 @@ const std::vector& MythDisplayX11::GetVideoModes(void) bool MythDisplayX11::SwitchToVideoMode(int Width, int Height, double DesiredRate) { - double rate = static_cast(NAN); + auto rate = static_cast(NAN); DisplayResScreen desired_screen(Width, Height, 0, 0, -1.0, DesiredRate); int idx = DisplayResScreen::FindBestMatch(m_videoModesUnsorted, desired_screen, rate); @@ -144,7 +144,7 @@ bool MythDisplayX11::SwitchToVideoMode(int Width, int Height, double DesiredRate XRRConfigCurrentConfiguration(cfg, &rot); // Search real xrandr rate for desired_rate - short finalrate = static_cast(rate); + auto finalrate = static_cast(rate); for (size_t i = 0; i < m_videoModes.size(); i++) { @@ -195,12 +195,12 @@ void MythDisplayX11::DebugModes(const QString& Message) const if (VERBOSE_LEVEL_CHECK(VB_PLAYBACK, LOG_INFO)) { LOG(VB_PLAYBACK, LOG_INFO, LOC + Message + ":"); - std::vector::const_iterator it = m_videoModes.cbegin(); + auto it = m_videoModes.cbegin(); for ( ; it != m_videoModes.cend(); ++it) { const std::vector& rates = (*it).RefreshRates(); QStringList rateslist; - std::vector::const_reverse_iterator it2 = rates.crbegin(); + auto it2 = rates.crbegin(); for ( ; it2 != rates.crend(); ++it2) rateslist.append(QString("%1").arg(*it2, 2, 'f', 2, '0')); LOG(VB_PLAYBACK, LOG_INFO, QString("%1x%2\t%3") diff --git a/mythtv/libs/libmythui/platforms/mythnvcontrol.cpp b/mythtv/libs/libmythui/platforms/mythnvcontrol.cpp index 65dcabb262b..1586a7a73c3 100644 --- a/mythtv/libs/libmythui/platforms/mythnvcontrol.cpp +++ b/mythtv/libs/libmythui/platforms/mythnvcontrol.cpp @@ -281,7 +281,7 @@ bool MythNVControl::GetNvidiaRates(MythXDisplay *MythDisplay, std::vector::iterator it = VideoModes.begin(); + auto it = VideoModes.begin(); for ( ; it != VideoModes.end(); ++it) { QPair resolution((*it).Width(), (*it).Height()); @@ -309,7 +309,7 @@ bool MythNVControl::GetNvidiaRates(MythXDisplay *MythDisplay, std::vector& rates = scr.RefreshRates(); bool found = false; - for (std::vector::const_iterator it = rates.cbegin(); it != rates.cend(); ++it) + for (auto it = rates.cbegin(); it != rates.cend(); ++it) { uint64_t key = DisplayResScreen::CalcKey(w, h, *it); if (screenmap.contains(key)) diff --git a/mythtv/libs/libmythui/platforms/mythxdisplay.cpp b/mythtv/libs/libmythui/platforms/mythxdisplay.cpp index 4559a412aa2..474e59ff899 100644 --- a/mythtv/libs/libmythui/platforms/mythxdisplay.cpp +++ b/mythtv/libs/libmythui/platforms/mythxdisplay.cpp @@ -58,7 +58,7 @@ MythXDisplay *GetMythXDisplay(Display *d) MythXDisplay *OpenMythXDisplay(bool Warn /*= true*/) { - MythXDisplay *disp = new MythXDisplay(); + auto *disp = new MythXDisplay(); if (disp && disp->Open()) return disp; @@ -269,7 +269,7 @@ void MythXDisplay::CheckOrphanedErrors(void) if (xerrors.empty()) return; - std::map::iterator errors = xerrors.begin(); + auto errors = xerrors.begin(); for (; errors != xerrors.end(); ++errors) if (!xerror_handlers.count(errors->first)) CheckErrors(errors->first); diff --git a/mythtv/libs/libmythui/screensaver-dbus.cpp b/mythtv/libs/libmythui/screensaver-dbus.cpp index 1c04b0e8db4..5f03856437a 100644 --- a/mythtv/libs/libmythui/screensaver-dbus.cpp +++ b/mythtv/libs/libmythui/screensaver-dbus.cpp @@ -123,7 +123,7 @@ ScreenSaverDBus::ScreenSaverDBus() : { // service, path, interface, bus - note that interface = service, hence it is used twice for (uint i=0; i < NUM_DBUS_METHODS; i++) { - ScreenSaverDBusPrivate *ssdbp = + auto *ssdbp = new ScreenSaverDBusPrivate(m_dbusService[i], m_dbusPath[i], m_dbusService[i], &m_bus); ssdbp->SetUnInhibit(m_dbusUnInhibit[i]); m_dbusPrivateInterfaces.push_back(ssdbp); diff --git a/mythtv/libs/libmythui/xmlparsebase.cpp b/mythtv/libs/libmythui/xmlparsebase.cpp index 9ff7479d554..30926a25a91 100644 --- a/mythtv/libs/libmythui/xmlparsebase.cpp +++ b/mythtv/libs/libmythui/xmlparsebase.cpp @@ -916,7 +916,7 @@ bool XMLParseBase::CopyWindowFromBase(const QString &windowname, return false; } - MythScreenType *st = dynamic_cast(ui); + auto *st = dynamic_cast(ui); if (!st) { LOG(VB_GENERAL, LOG_ERR, LOC + diff --git a/mythtv/libs/libmythupnp/bufferedsocketdevice.cpp b/mythtv/libs/libmythupnp/bufferedsocketdevice.cpp index 659c7c867a0..8d08aa704ef 100644 --- a/mythtv/libs/libmythupnp/bufferedsocketdevice.cpp +++ b/mythtv/libs/libmythupnp/bufferedsocketdevice.cpp @@ -260,7 +260,7 @@ void BufferedSocketDevice::Flush() while ( !osBufferFull && ( m_nWriteSize > 0 ) && m_pSocket->isValid()) { - deque::iterator it = m_bufWrite.begin(); + auto it = m_bufWrite.begin(); QByteArray *a = *it; int nwritten = 0; diff --git a/mythtv/libs/libmythupnp/eventing.cpp b/mythtv/libs/libmythupnp/eventing.cpp index fb3c87ca197..7656ca6bad0 100644 --- a/mythtv/libs/libmythupnp/eventing.cpp +++ b/mythtv/libs/libmythupnp/eventing.cpp @@ -374,7 +374,7 @@ void Eventing::NotifySubscriber( SubscriberInfo *pInfo ) // -=>TODO: Need to add support for more than one CallBack URL. - QByteArray *pBuffer = new QByteArray(); // UPnpEventTask will delete this pointer. + auto *pBuffer = new QByteArray(); // UPnpEventTask will delete this pointer. QTextStream tsMsg( pBuffer, QIODevice::WriteOnly ); tsMsg.setCodec(QTextCodec::codecForName("UTF-8")); @@ -407,9 +407,8 @@ void Eventing::NotifySubscriber( SubscriberInfo *pInfo ) QString("UPnp::Eventing::NotifySubscriber( %1 ) : %2 Variables") .arg( sHost ).arg(nCount)); - UPnpEventTask *pEventTask = - new UPnpEventTask(QHostAddress( pInfo->m_qURL.host() ), - nPort, pBuffer ); + auto *pEventTask = new UPnpEventTask(QHostAddress(pInfo->m_qURL.host()), + nPort, pBuffer); TaskQueue::Instance()->AddTask( 250, pEventTask ); diff --git a/mythtv/libs/libmythupnp/httpserver.cpp b/mythtv/libs/libmythupnp/httpserver.cpp index e4b40e60817..9c597699738 100644 --- a/mythtv/libs/libmythupnp/httpserver.cpp +++ b/mythtv/libs/libmythupnp/httpserver.cpp @@ -301,7 +301,7 @@ QString HttpServer::GetServerVersion(void) void HttpServer::newTcpConnection(qt_socket_fd_t socket) { PoolServerType type = kTCPServer; - PrivTcpServer *server = dynamic_cast(QObject::sender()); + auto *server = dynamic_cast(QObject::sender()); if (server) type = server->GetServerType(); @@ -482,7 +482,7 @@ void HttpWorker::run(void) { #ifndef QT_NO_OPENSSL - QSslSocket *pSslSocket = new QSslSocket(); + auto *pSslSocket = new QSslSocket(); if (pSslSocket->setSocketDescriptor(m_socket) && gCoreContext->CheckSubnet(pSslSocket)) { diff --git a/mythtv/libs/libmythupnp/mmembuf.cpp b/mythtv/libs/libmythupnp/mmembuf.cpp index af43091934c..9198429aae0 100644 --- a/mythtv/libs/libmythupnp/mmembuf.cpp +++ b/mythtv/libs/libmythupnp/mmembuf.cpp @@ -150,7 +150,7 @@ int MMembuf::ungetch(int ch) { if (buf.isEmpty() || _index==0) { // we need a new QByteArray - QByteArray *ba = new QByteArray; + auto *ba = new QByteArray; ba->resize(1); buf.prepend(ba); _size++; diff --git a/mythtv/libs/libmythupnp/msocketdevice_unix.cpp b/mythtv/libs/libmythupnp/msocketdevice_unix.cpp index 0cc413d43bb..2c633514c21 100644 --- a/mythtv/libs/libmythupnp/msocketdevice_unix.cpp +++ b/mythtv/libs/libmythupnp/msocketdevice_unix.cpp @@ -99,7 +99,7 @@ static inline void qt_socket_getportaddr(struct sockaddr *sa, if (sa->sa_family == AF_INET6) { - struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *)sa; + auto *sa6 = (struct sockaddr_in6 *)sa; Q_IPV6ADDR tmp; memcpy(&tmp, &sa6->sin6_addr.s6_addr, sizeof(tmp)); QHostAddress a(tmp); @@ -109,7 +109,7 @@ static inline void qt_socket_getportaddr(struct sockaddr *sa, } - struct sockaddr_in *sa4 = (struct sockaddr_in *)sa; + auto *sa4 = (struct sockaddr_in *)sa; QHostAddress a(ntohl(sa4->sin_addr.s_addr)); @@ -132,7 +132,7 @@ MSocketDevice::Protocol MSocketDevice::getProtocol() const struct sockaddr_storage sa {}; QT_SOCKLEN_T sz = sizeof(sa); - struct sockaddr *sap = reinterpret_cast(&sa); + auto *sap = reinterpret_cast(&sa); if (!::getsockname(fd, sap, &sz)) { @@ -376,7 +376,7 @@ int MSocketDevice::option(Option opt) const if (!e) { - MSocketDevice *that = (MSocketDevice*)this; // mutable function + auto *that = (MSocketDevice*)this; // mutable function switch (errno) { diff --git a/mythtv/libs/libmythupnp/services/rtti.cpp b/mythtv/libs/libmythupnp/services/rtti.cpp index 411a89d7d4b..fd92ec2d9c6 100644 --- a/mythtv/libs/libmythupnp/services/rtti.cpp +++ b/mythtv/libs/libmythupnp/services/rtti.cpp @@ -66,7 +66,7 @@ DTC::Enum* Rtti::GetEnum( const QString &sFQN ) nParentId = QMetaType::type( sParentFQN.toUtf8() ); } - QObject *pParentClass = (QObject *)QMetaType::create( nParentId ); + auto *pParentClass = (QObject *)QMetaType::create( nParentId ); if (pParentClass == nullptr) return nullptr; @@ -89,7 +89,7 @@ DTC::Enum* Rtti::GetEnum( const QString &sFQN ) // // ---------------------------------------------------------------------- - DTC::Enum *pEnum = new DTC::Enum(); + auto *pEnum = new DTC::Enum(); pEnum->setType( sFQN ); diff --git a/mythtv/libs/libmythupnp/ssdp.cpp b/mythtv/libs/libmythupnp/ssdp.cpp index 6b86d7f5928..685fb750cef 100644 --- a/mythtv/libs/libmythupnp/ssdp.cpp +++ b/mythtv/libs/libmythupnp/ssdp.cpp @@ -549,7 +549,7 @@ bool SSDP::ProcessSearchRequest( const QStringMap &sHeaders, if ((sST == "ssdp:all") || (sST == "upnp:rootdevice")) { - UPnpSearchTask *pTask = new UPnpSearchTask( m_nServicePort, + auto *pTask = new UPnpSearchTask( m_nServicePort, peerAddress, peerPort, sST, UPnp::g_UPnpDeviceDesc.m_rootDevice.GetUDN()); @@ -575,11 +575,8 @@ bool SSDP::ProcessSearchRequest( const QStringMap &sHeaders, if (sUDN.length() > 0) { - UPnpSearchTask *pTask = new UPnpSearchTask( m_nServicePort, - peerAddress, - peerPort, - sST, - sUDN ); + auto *pTask = new UPnpSearchTask( m_nServicePort, peerAddress, + peerPort, sST, sUDN ); // Excute task now for fastest response, queue for time-delayed response // -=>TODO: To be trully uPnp compliant, this Execute should be removed. diff --git a/mythtv/libs/libmythupnp/ssdpcache.cpp b/mythtv/libs/libmythupnp/ssdpcache.cpp index 37df9b1fe7e..821ff9f8dbf 100644 --- a/mythtv/libs/libmythupnp/ssdpcache.cpp +++ b/mythtv/libs/libmythupnp/ssdpcache.cpp @@ -255,7 +255,7 @@ SSDPCache::SSDPCache() // Add Task to keep SSDPCache purged of stale entries. // ---------------------------------------------------------------------- - SSDPCacheTask *task = new SSDPCacheTask(); + auto *task = new SSDPCacheTask(); TaskQueue::Instance()->AddTask(task); task->DecrRef(); } diff --git a/mythtv/libs/libmythupnp/taskqueue.cpp b/mythtv/libs/libmythupnp/taskqueue.cpp index ee4bb6a9aba..d21ee7ecd0b 100644 --- a/mythtv/libs/libmythupnp/taskqueue.cpp +++ b/mythtv/libs/libmythupnp/taskqueue.cpp @@ -152,9 +152,7 @@ void TaskQueue::Clear( ) { m_mutex.lock(); - for ( TaskMap::iterator it = m_mapTasks.begin(); - it != m_mapTasks.end(); - ++it ) + for ( auto it = m_mapTasks.begin(); it != m_mapTasks.end(); ++it ) { if ((*it).second != nullptr) (*it).second->DecrRef(); @@ -222,8 +220,7 @@ Task *TaskQueue::GetNextExpiredTask( TaskTime tt, long nWithinMilliSecs /*=50*/ m_mutex.lock(); - TaskMap::iterator it = m_mapTasks.begin(); - + auto it = m_mapTasks.begin(); if (it != m_mapTasks.end()) { TaskTime ttTask = (*it).first; diff --git a/mythtv/libs/libmythupnp/upnpcds.cpp b/mythtv/libs/libmythupnp/upnpcds.cpp index bd18e3a902d..b7ea052067e 100644 --- a/mythtv/libs/libmythupnp/upnpcds.cpp +++ b/mythtv/libs/libmythupnp/upnpcds.cpp @@ -740,7 +740,7 @@ void UPnpCDS::HandleGetSystemUpdateID( HTTPRequest *pRequest ) QString("UPnpCDS::ProcessRequest : %1 : %2") .arg(pRequest->m_sBaseUrl) .arg(pRequest->m_sMethod)); - uint16_t nId = GetValue("SystemUpdateID"); + auto nId = GetValue("SystemUpdateID"); list.push_back(NameValue("Id", nId)); @@ -838,7 +838,7 @@ UPnpCDSExtensionResults *UPnpCDSExtension::Browse( UPnpCDSRequest *pRequest ) // Process based on location in hierarchy // ---------------------------------------------------------------------- - UPnpCDSExtensionResults *pResults = new UPnpCDSExtensionResults(); + auto *pResults = new UPnpCDSExtensionResults(); if (pResults != nullptr) { @@ -917,7 +917,7 @@ UPnpCDSExtensionResults *UPnpCDSExtension::Search( UPnpCDSRequest *pRequest ) return nullptr; } - UPnpCDSExtensionResults *pResults = new UPnpCDSExtensionResults(); + auto *pResults = new UPnpCDSExtensionResults(); // CreateItems( pRequest, pResults, 0, "", false ); diff --git a/mythtv/libs/libmythupnp/upnpcdsobjects.cpp b/mythtv/libs/libmythupnp/upnpcdsobjects.cpp index 4f30ba26056..e9508977c8f 100644 --- a/mythtv/libs/libmythupnp/upnpcdsobjects.cpp +++ b/mythtv/libs/libmythupnp/upnpcdsobjects.cpp @@ -200,7 +200,7 @@ CDSObject *CDSObject::GetChild( const QString &sID ) Resource *CDSObject::AddResource( const QString& sProtocol, const QString& sURI ) { - Resource *pRes = new Resource( sProtocol, sURI ); + auto *pRes = new Resource( sProtocol, sURI ); m_resources.append( pRes ); diff --git a/mythtv/libs/libmythupnp/upnpdevice.cpp b/mythtv/libs/libmythupnp/upnpdevice.cpp index 0e7286a8d1c..891476d1212 100644 --- a/mythtv/libs/libmythupnp/upnpdevice.cpp +++ b/mythtv/libs/libmythupnp/upnpdevice.cpp @@ -184,7 +184,7 @@ void UPnpDeviceDesc::ProcessIconList( const QDomNode& oListNode, UPnpDevice *pDe if ( e.tagName() == "icon" ) { - UPnpIcon *pIcon = new UPnpIcon(); + auto *pIcon = new UPnpIcon(); pDevice->m_listIcons.append( pIcon ); SetStrValue( e.namedItem( "mimetype" ), pIcon->m_sMimeType ); @@ -213,7 +213,7 @@ void UPnpDeviceDesc::ProcessServiceList( const QDomNode& oListNode, UPnpDevice * if ( e.tagName() == "service" ) { - UPnpService *pService = new UPnpService(); + auto *pService = new UPnpService(); pDevice->m_listServices.append( pService ); SetStrValue(e.namedItem( "serviceType" ), pService->m_sServiceType); @@ -248,7 +248,7 @@ void UPnpDeviceDesc::ProcessDeviceList( const QDomNode& oListNode, if ( e.tagName() == "device") { - UPnpDevice *pNewDevice = new UPnpDevice(); + auto *pNewDevice = new UPnpDevice(); pDevice->m_listDevices.append( pNewDevice ); _InternalLoad( e, pNewDevice ); } @@ -708,7 +708,7 @@ UPnpDevice::UPnpDevice() : // devices too. // Large PNG Icon - UPnpIcon *pngIconLrg = new UPnpIcon(); + auto *pngIconLrg = new UPnpIcon(); pngIconLrg->m_nDepth = 24; pngIconLrg->m_nHeight = 120; pngIconLrg->m_nWidth = 120; @@ -717,7 +717,7 @@ UPnpDevice::UPnpDevice() : m_listIcons.append(pngIconLrg); // Large JPG Icon - UPnpIcon *jpgIconLrg = new UPnpIcon(); + auto *jpgIconLrg = new UPnpIcon(); jpgIconLrg->m_nDepth = 24; jpgIconLrg->m_nHeight = 120; jpgIconLrg->m_nWidth = 120; @@ -726,7 +726,7 @@ UPnpDevice::UPnpDevice() : m_listIcons.append(jpgIconLrg); // Small PNG Icon - UPnpIcon *pngIconSm = new UPnpIcon(); + auto *pngIconSm = new UPnpIcon(); pngIconSm->m_nDepth = 24; pngIconSm->m_nHeight = 48; pngIconSm->m_nWidth = 48; @@ -735,7 +735,7 @@ UPnpDevice::UPnpDevice() : m_listIcons.append(pngIconSm); // Small JPG Icon - UPnpIcon *jpgIconSm = new UPnpIcon(); + auto *jpgIconSm = new UPnpIcon(); jpgIconSm->m_nDepth = 24; jpgIconSm->m_nHeight = 48; jpgIconSm->m_nWidth = 48; diff --git a/mythtv/libs/libmythupnp/upnpserviceimpl.cpp b/mythtv/libs/libmythupnp/upnpserviceimpl.cpp index 087b22eb4ce..57c287c1e92 100644 --- a/mythtv/libs/libmythupnp/upnpserviceimpl.cpp +++ b/mythtv/libs/libmythupnp/upnpserviceimpl.cpp @@ -6,7 +6,7 @@ void UPnpServiceImpl::RegisterService(UPnpDevice *pDevice) { if (pDevice != nullptr) { - UPnpService *pService = new UPnpService(); + auto *pService = new UPnpService(); pService->m_sServiceType = GetServiceType(); pService->m_sServiceId = GetServiceId(); diff --git a/mythtv/libs/libmythupnp/upnpsubscription.cpp b/mythtv/libs/libmythupnp/upnpsubscription.cpp index 5a396d30101..729f003fa12 100644 --- a/mythtv/libs/libmythupnp/upnpsubscription.cpp +++ b/mythtv/libs/libmythupnp/upnpsubscription.cpp @@ -290,8 +290,8 @@ bool UPNPSubscription::SendUnsubscribeRequest(const QString &usn, LOG(VB_UPNP, LOG_DEBUG, LOC + "\n\n" + sub); - MSocketDevice *sockdev = new MSocketDevice(MSocketDevice::Stream); - BufferedSocketDevice *sock = new BufferedSocketDevice(sockdev); + auto *sockdev = new MSocketDevice(MSocketDevice::Stream); + auto *sock = new BufferedSocketDevice(sockdev); sockdev->setBlocking(true); if (sock->Connect(QHostAddress(host), port)) @@ -357,8 +357,8 @@ int UPNPSubscription::SendSubscribeRequest(const QString &callback, LOG(VB_UPNP, LOG_DEBUG, LOC + "\n\n" + sub); - MSocketDevice *sockdev = new MSocketDevice(MSocketDevice::Stream); - BufferedSocketDevice *sock = new BufferedSocketDevice(sockdev); + auto *sockdev = new MSocketDevice(MSocketDevice::Stream); + auto *sock = new BufferedSocketDevice(sockdev); sockdev->setBlocking(true); QString uuid; diff --git a/mythtv/libs/libmythupnp/upnptasksearch.cpp b/mythtv/libs/libmythupnp/upnptasksearch.cpp index c0aaad08573..e06eeda0556 100644 --- a/mythtv/libs/libmythupnp/upnptasksearch.cpp +++ b/mythtv/libs/libmythupnp/upnptasksearch.cpp @@ -147,7 +147,7 @@ void UPnpSearchTask::SendMsg( MSocketDevice *pSocket, void UPnpSearchTask::Execute( TaskQueue * /*pQueue*/ ) { - MSocketDevice *pSocket = new MSocketDevice( MSocketDevice::Datagram ); + auto *pSocket = new MSocketDevice( MSocketDevice::Datagram ); // ---------------------------------------------------------------------- // Refresh IP Address List in case of changes diff --git a/mythtv/libs/libmythupnp/websocket.cpp b/mythtv/libs/libmythupnp/websocket.cpp index 7d9df42e3a2..8f869e02a99 100644 --- a/mythtv/libs/libmythupnp/websocket.cpp +++ b/mythtv/libs/libmythupnp/websocket.cpp @@ -49,7 +49,7 @@ void WebSocketServer::newTcpConnection(qt_socket_fd_t socket) { PoolServerType type = kTCPServer; - PrivTcpServer *server = dynamic_cast(QObject::sender()); + auto *server = dynamic_cast(QObject::sender()); if (server) type = server->GetServerType(); @@ -83,7 +83,7 @@ WebSocketWorkerThread::WebSocketWorkerThread(WebSocketServer& webSocketServer, void WebSocketWorkerThread::run(void) { - WebSocketWorker *worker = new WebSocketWorker(m_webSocketServer, m_socketFD, + auto *worker = new WebSocketWorker(m_webSocketServer, m_socketFD, m_connectionType #ifndef QT_NO_OPENSSL , m_sslConfig @@ -163,7 +163,7 @@ void WebSocketWorker::SetupSocket() { #ifndef QT_NO_OPENSSL - QSslSocket *pSslSocket = new QSslSocket(); + auto *pSslSocket = new QSslSocket(); if (pSslSocket->setSocketDescriptor(m_socketFD) && gCoreContext->CheckSubnet(pSslSocket)) { diff --git a/mythtv/libs/libmythupnp/websocket_extensions/websocket_mythevent.cpp b/mythtv/libs/libmythupnp/websocket_extensions/websocket_mythevent.cpp index fef7b5e44c4..09741e7d732 100644 --- a/mythtv/libs/libmythupnp/websocket_extensions/websocket_mythevent.cpp +++ b/mythtv/libs/libmythupnp/websocket_extensions/websocket_mythevent.cpp @@ -57,7 +57,7 @@ void WebSocketMythEvent::customEvent(QEvent* event) if (!m_sendEvents) return; - MythEvent *me = static_cast(event); + auto *me = static_cast(event); QString message = me->Message(); if (message.startsWith("SYSTEM_EVENT"))