diff options
76 files changed, 253 insertions, 468 deletions
diff --git a/addons/repository.xbmc.org/addon.xml b/addons/repository.xbmc.org/addon.xml index b0357823b4..803cfca961 100644 --- a/addons/repository.xbmc.org/addon.xml +++ b/addons/repository.xbmc.org/addon.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <addon id="repository.xbmc.org" name="Kodi Add-on repository" - version="3.3.1" + version="3.4.0" provider-name="Team Kodi"> <requires> <import addon="xbmc.addon" version="12.0.0"/> @@ -9,10 +9,10 @@ <extension point="xbmc.addon.repository"> <!-- Do not forget to bump add-on version when changing paths to force a repo refresh --> <dir> - <info>http://mirrors.kodi.tv/addons/nexus/addons.xml.gz</info> - <checksum verify="sha256">http://mirrors.kodi.tv/addons/nexus/addons.xml.gz?sha256</checksum> - <datadir>https://mirrors.kodi.tv/addons/nexus</datadir> - <artdir>http://mirrors.kodi.tv/addons/nexus</artdir> + <info>https://mirrors.kodi.tv/addons/omega/addons.xml.gz</info> + <checksum verify="sha256">https://mirrors.kodi.tv/addons/omega/addons.xml.gz?sha256</checksum> + <datadir>https://mirrors.kodi.tv/addons/omega</datadir> + <artdir>https://mirrors.kodi.tv/addons/omega</artdir> <hashes>sha256</hashes> </dir> </extension> diff --git a/addons/skin.estuary/xml/DialogPVRChannelManager.xml b/addons/skin.estuary/xml/DialogPVRChannelManager.xml index 0f54a139d0..21465a5ac5 100644 --- a/addons/skin.estuary/xml/DialogPVRChannelManager.xml +++ b/addons/skin.estuary/xml/DialogPVRChannelManager.xml @@ -23,7 +23,8 @@ <width>12</width> <height>870</height> <onleft>20</onleft> - <onright>9002</onright> + <onright condition="Integer.IsGreater(Container(20).NumItems, 0)">9002</onright> + <onright condition="Integer.IsEqual(Container(20).NumItems, 0)">9003</onright> <orientation>vertical</orientation> </control> <control type="image"> @@ -200,14 +201,14 @@ <aspectratio>keep</aspectratio> <texture background="true">$INFO[Container(20).ListItem.Property(icon)]</texture> </control> - <control type="grouplist"> + <control type="grouplist" id="9003"> <top>590</top> <itemgap>-18</itemgap> <onleft>60</onleft> <onright>9000</onright> <onup>14</onup> <ondown>7</ondown> - <control type="label" id="9003"> + <control type="label"> <description>misc options Header</description> <width>700</width> <height>52</height> @@ -258,7 +259,8 @@ <control type="grouplist" id="9000"> <right>20</right> <top>90</top> - <onleft>9002</onleft> + <onleft condition="Integer.IsGreater(Container(20).NumItems, 0)">9002</onleft> + <onleft condition="Integer.IsEqual(Container(20).NumItems, 0)">9003</onleft> <onright>20</onright> <itemgap>dialogbuttons_itemgap</itemgap> <width>400</width> diff --git a/cmake/scripts/windowsstore/ArchSetup.cmake b/cmake/scripts/windowsstore/ArchSetup.cmake index f71ca7a32f..c458479097 100644 --- a/cmake/scripts/windowsstore/ArchSetup.cmake +++ b/cmake/scripts/windowsstore/ArchSetup.cmake @@ -1,5 +1,5 @@ # Minimum SDK version we support -set(VS_MINIMUM_SDK_VERSION 10.0.17763.0) +set(VS_MINIMUM_SDK_VERSION 10.0.18362.0) if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION VERSION_LESS VS_MINIMUM_SDK_VERSION) message(FATAL_ERROR "Detected Windows SDK version is ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}.\n" diff --git a/docs/README.Windows.md b/docs/README.Windows.md index d07cac4e43..53545a80f9 100644 --- a/docs/README.Windows.md +++ b/docs/README.Windows.md @@ -82,8 +82,6 @@ Start the Visual Studio installer and click **Workloads** select Click in **Individual components** select * Under **Compilers, build tools and runtimes** section select * `MSVC v142/3 - VS 2019/22 C++ ARM build tools (Latest)` (if compiling for UWP-ARM) -* Under **SDKs, libraries, and frameworks** section select - * `Windows 10 SDK (10.0.18362.0)` (if compiling for UWP or UWP-ARM) Hit `Install`. Yes, it will download and install almost 8GB of stuff for x64 only or up to 20GB if everything is selected for UWP / UWP-ARM as well. @@ -210,17 +208,17 @@ cmake -G "Visual Studio 17 2022" -A Win32 -T host=x64 %userprofile%\kodi Or configure build for UWP 64bit: ``` -cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -T host=x64 %userprofile%\kodi +cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -T host=x64 %userprofile%\kodi ``` Or configure build for UWP 32bit: ``` -cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -T host=x64 %userprofile%\kodi +cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -T host=x64 %userprofile%\kodi ``` Or configure build for UWP ARM 32bit: ``` -cmake -G "Visual Studio 17 2022" -A ARM -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -T host=x64 %userprofile%\kodi +cmake -G "Visual Studio 17 2022" -A ARM -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -T host=x64 %userprofile%\kodi ``` **Visual Studio 2019:** diff --git a/tools/buildsteps/windows/arm-uwp/BuildSetup.bat b/tools/buildsteps/windows/arm-uwp/BuildSetup.bat index 8fd6e03de1..5dc8d8d5ea 100644 --- a/tools/buildsteps/windows/arm-uwp/BuildSetup.bat +++ b/tools/buildsteps/windows/arm-uwp/BuildSetup.bat @@ -13,7 +13,7 @@ SET cmakeGenerator=Visual Studio %vsver% SET cmakeArch=ARM SET TARGET_ARCHITECTURE=arm SET TARGET_PLATFORM=%TARGET_ARCHITECTURE%-uwp -SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=%UCRTVersion% +SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 CALL BuildSetup.bat %* POPD diff --git a/tools/buildsteps/windows/vswhere.bat b/tools/buildsteps/windows/vswhere.bat index b8c60b9e34..1959c20722 100644 --- a/tools/buildsteps/windows/vswhere.bat +++ b/tools/buildsteps/windows/vswhere.bat @@ -38,7 +38,6 @@ IF "%arch%"=="x86" ( ) IF "%vcstore%"=="store" ( - SET sdkver=10.0.18362.0 SET toolsdir="win10-%toolsdir%" ) diff --git a/tools/buildsteps/windows/win32-uwp/BuildSetup.bat b/tools/buildsteps/windows/win32-uwp/BuildSetup.bat index 5ddf234b57..7b9d995b6a 100644 --- a/tools/buildsteps/windows/win32-uwp/BuildSetup.bat +++ b/tools/buildsteps/windows/win32-uwp/BuildSetup.bat @@ -12,7 +12,7 @@ SET cmakeGenerator=Visual Studio %vsver% SET cmakeArch=Win32 SET TARGET_ARCHITECTURE=x86 SET TARGET_PLATFORM=win32-uwp -SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=%UCRTVersion% +SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 CALL BuildSetup.bat %* POPD diff --git a/tools/buildsteps/windows/x64-uwp/BuildSetup.bat b/tools/buildsteps/windows/x64-uwp/BuildSetup.bat index 8144248dd0..aab9fe2d50 100644 --- a/tools/buildsteps/windows/x64-uwp/BuildSetup.bat +++ b/tools/buildsteps/windows/x64-uwp/BuildSetup.bat @@ -12,7 +12,7 @@ SET cmakeGenerator=Visual Studio %vsver% SET cmakeArch=x64 SET TARGET_ARCHITECTURE=x64 SET TARGET_PLATFORM=%TARGET_ARCHITECTURE%-uwp -SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=%UCRTVersion% +SET cmakeProps=-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 CALL BuildSetup.bat %* POPD diff --git a/xbmc/URL.cpp b/xbmc/URL.cpp index 40793ce892..877c9d9585 100644 --- a/xbmc/URL.cpp +++ b/xbmc/URL.cpp @@ -724,7 +724,8 @@ bool CURL::IsProtocolEqual(const std::string &protocol, const char *type) void CURL::GetOptions(std::map<std::string, std::string> &options) const { CUrlOptions::UrlOptions optionsMap = m_options.GetOptions(); - for (CUrlOptions::UrlOptions::const_iterator option = optionsMap.begin(); option != optionsMap.end(); option++) + for (CUrlOptions::UrlOptions::const_iterator option = optionsMap.begin(); + option != optionsMap.end(); ++option) options[option->first] = option->second.asString(); } @@ -767,7 +768,8 @@ void CURL::RemoveOption(const std::string &key) void CURL::GetProtocolOptions(std::map<std::string, std::string> &options) const { CUrlOptions::UrlOptions optionsMap = m_protocolOptions.GetOptions(); - for (CUrlOptions::UrlOptions::const_iterator option = optionsMap.begin(); option != optionsMap.end(); option++) + for (CUrlOptions::UrlOptions::const_iterator option = optionsMap.begin(); + option != optionsMap.end(); ++option) options[option->first] = option->second.asString(); } diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp index 6e36caf6ed..e394d18e43 100644 --- a/xbmc/Util.cpp +++ b/xbmc/Util.cpp @@ -417,7 +417,7 @@ void CUtil::CleanString(const std::string& strFileName, } int j=0; if ((j=reTags.RegFind(strTitleAndYear.c_str())) > 0) - strTitleAndYear = strTitleAndYear.substr(0, j); + strTitleAndYear.resize(j); } // final cleanup - special characters used instead of spaces: @@ -1040,7 +1040,7 @@ void CUtil::SplitParams(const std::string ¶mString, std::vector<std::string> if (!inFunction && ch == ',') { // not in a function, so a comma signifies the end of this parameter if (whiteSpacePos) - parameter = parameter.substr(0, whiteSpacePos); + parameter.resize(whiteSpacePos); // trim off start and end quotes if (parameter.length() > 1 && parameter[0] == '"' && parameter[parameter.length() - 1] == '"') parameter = parameter.substr(1, parameter.length() - 2); @@ -1146,7 +1146,7 @@ int CUtil::GetMatchingSource(const std::string& strPath1, VECSOURCES& VECSOURCES // "Name (Drive Status/Disc Name)" size_t iPos = strName.rfind('('); if (iPos != std::string::npos && iPos > 1) - strName = strName.substr(0, iPos - 1); + strName.resize(iPos - 1); } if (StringUtils::EqualsNoCase(strPath, strName)) { diff --git a/xbmc/addons/Repository.cpp b/xbmc/addons/Repository.cpp index 7c808379a8..0fb4337775 100644 --- a/xbmc/addons/Repository.cpp +++ b/xbmc/addons/Repository.cpp @@ -170,7 +170,7 @@ bool CRepository::FetchChecksum(const std::string& url, std::size_t pos = checksum.find_first_of(" \n"); if (pos != std::string::npos) { - checksum = checksum.substr(0, pos); + checksum.resize(pos); } // Determine update interval from (potential) HTTP response diff --git a/xbmc/addons/gui/GUIDialogAddonInfo.cpp b/xbmc/addons/gui/GUIDialogAddonInfo.cpp index 7ada638a34..1e071e8a58 100644 --- a/xbmc/addons/gui/GUIDialogAddonInfo.cpp +++ b/xbmc/addons/gui/GUIDialogAddonInfo.cpp @@ -65,9 +65,8 @@ using namespace XFILE; using namespace KODI::MESSAGING; CGUIDialogAddonInfo::CGUIDialogAddonInfo(void) - : CGUIDialog(WINDOW_DIALOG_ADDON_INFO, "DialogAddonInfo.xml") + : CGUIDialog(WINDOW_DIALOG_ADDON_INFO, "DialogAddonInfo.xml"), m_item(CFileItemPtr(new CFileItem)) { - m_item = CFileItemPtr(new CFileItem); m_loadType = KEEP_IN_MEMORY; } diff --git a/xbmc/application/ApplicationPowerHandling.cpp b/xbmc/application/ApplicationPowerHandling.cpp index 1d758a12d6..a0978df33e 100644 --- a/xbmc/application/ApplicationPowerHandling.cpp +++ b/xbmc/application/ApplicationPowerHandling.cpp @@ -538,6 +538,9 @@ void CApplicationPowerHandling::CheckShutdown() m_shutdownTimer.Stop(); // Sleep the box + CLog::LogF(LOGDEBUG, "Timer is over (shutdown function: {})", + CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt( + CSettings::SETTING_POWERMANAGEMENT_SHUTDOWNSTATE)); CServiceBroker::GetAppMessenger()->PostMsg(TMSG_SHUTDOWN); } } diff --git a/xbmc/cdrip/CDDARipper.cpp b/xbmc/cdrip/CDDARipper.cpp index fdea7b1f0a..073dd05a36 100644 --- a/xbmc/cdrip/CDDARipper.cpp +++ b/xbmc/cdrip/CDDARipper.cpp @@ -210,7 +210,7 @@ std::string CCDDARipper::GetAlbumDirName(const MUSIC_INFO::CMusicInfoTag& infoTa if (pos == std::string::npos) return ""; // no directory - strAlbumDir = strAlbumDir.substr(0, pos); + strAlbumDir.resize(pos); // replace %A with album artist name if (strAlbumDir.find("%A") != std::string::npos) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp index fae25ea82d..53759c8c52 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp @@ -25,16 +25,16 @@ using namespace AE; using namespace ActiveAE; using namespace std::chrono_literals; -CActiveAESink::CActiveAESink(CEvent *inMsgEvent) : - CThread("AESink"), - m_controlPort("SinkControlPort", inMsgEvent, &m_outMsgEvent), - m_dataPort("SinkDataPort", inMsgEvent, &m_outMsgEvent) +CActiveAESink::CActiveAESink(CEvent* inMsgEvent) + : CThread("AESink"), + m_controlPort("SinkControlPort", inMsgEvent, &m_outMsgEvent), + m_dataPort("SinkDataPort", inMsgEvent, &m_outMsgEvent), + m_sink(nullptr), + m_packer(nullptr) { m_inMsgEvent = inMsgEvent; - m_sink = nullptr; m_stats = nullptr; m_volume = 0.0; - m_packer = nullptr; m_streamNoise = true; } diff --git a/xbmc/cores/AudioEngine/Sinks/windows/AESinkFactoryWin10.cpp b/xbmc/cores/AudioEngine/Sinks/windows/AESinkFactoryWin10.cpp index 3ef08b1965..23d79e5a9d 100644 --- a/xbmc/cores/AudioEngine/Sinks/windows/AESinkFactoryWin10.cpp +++ b/xbmc/cores/AudioEngine/Sinks/windows/AESinkFactoryWin10.cpp @@ -183,7 +183,7 @@ public: struct AEWASAPIDeviceWin10 : public IAEWASAPIDevice { - HRESULT AEWASAPIDeviceWin10::Activate(IAudioClient** ppAudioClient) + HRESULT Activate(IAudioClient** ppAudioClient) { if (!ppAudioClient) return E_POINTER; @@ -212,13 +212,13 @@ struct AEWASAPIDeviceWin10 : public IAEWASAPIDevice return E_UNEXPECTED; }; - int AEWASAPIDeviceWin10::Release() override + int Release() override { delete this; return 0; }; - bool AEWASAPIDeviceWin10::IsUSBDevice() override + bool IsUSBDevice() override { // TODO return false; diff --git a/xbmc/cores/RetroPlayer/rendering/RPRenderManager.cpp b/xbmc/cores/RetroPlayer/rendering/RPRenderManager.cpp index a0886fe26a..5e22ed887f 100644 --- a/xbmc/cores/RetroPlayer/rendering/RPRenderManager.cpp +++ b/xbmc/cores/RetroPlayer/rendering/RPRenderManager.cpp @@ -123,35 +123,56 @@ bool CRPRenderManager::Configure(AVPixelFormat format, return true; } -std::vector<VideoStreamBuffer> CRPRenderManager::GetVideoBuffers(unsigned int width, - unsigned int height) +bool CRPRenderManager::GetVideoBuffer(unsigned int width, + unsigned int height, + VideoStreamBuffer& buffer) { - std::vector<VideoStreamBuffer> buffers; + // Clear any previous pending buffers + for (IRenderBuffer* buffer : m_pendingBuffers) + buffer->Release(); + m_pendingBuffers.clear(); if (m_bFlush || m_state != RENDER_STATE::CONFIGURED) - return buffers; + return false; - // Get buffers from visible renderers - for (IRenderBufferPool* bufferPool : m_processInfo.GetBufferManager().GetBufferPools()) - { - if (!bufferPool->HasVisibleRenderer()) - continue; + // We should do our best to get a valid render buffer. If we return false, + // the game add-on will likely allocate its own memory. + IRenderBuffer* renderBuffer = nullptr; - IRenderBuffer* renderBuffer = bufferPool->GetBuffer(width, height); + auto bufferPools = m_processInfo.GetBufferManager().GetBufferPools(); + + std::sort(bufferPools.begin(), bufferPools.end(), + [](const IRenderBufferPool* lhs, const IRenderBufferPool* rhs) { + // Prefer buffer pools with a visible renderer + if (lhs->HasVisibleRenderer() && !rhs->HasVisibleRenderer()) + return true; + if (!lhs->HasVisibleRenderer() && rhs->HasVisibleRenderer()) + return false; + + //! @todo De-prioritize buffer pools with write-only or unaligned memory + + return false; + }); + + for (IRenderBufferPool* bufferPool : bufferPools) + { + renderBuffer = bufferPool->GetBuffer(width, height); if (renderBuffer != nullptr) - m_pendingBuffers.emplace_back(renderBuffer); + break; else CLog::Log(LOGDEBUG, "RetroPlayer[RENDER]: Unable to get video buffer for frame"); } - for (IRenderBuffer* renderBuffer : m_pendingBuffers) - { - buffers.emplace_back(VideoStreamBuffer{ - renderBuffer->GetFormat(), renderBuffer->GetMemory(), renderBuffer->GetFrameSize(), - renderBuffer->GetMemoryAccess(), renderBuffer->GetMemoryAlignment()}); - } + if (renderBuffer == nullptr) + return false; + + buffer = VideoStreamBuffer{renderBuffer->GetFormat(), renderBuffer->GetMemory(), + renderBuffer->GetFrameSize(), renderBuffer->GetMemoryAccess(), + renderBuffer->GetMemoryAlignment()}; - return buffers; + m_pendingBuffers.emplace_back(std::move(renderBuffer)); + + return true; } void CRPRenderManager::AddFrame(const uint8_t* data, diff --git a/xbmc/cores/RetroPlayer/rendering/RPRenderManager.h b/xbmc/cores/RetroPlayer/rendering/RPRenderManager.h index 14229efad3..bd1ebb59e5 100644 --- a/xbmc/cores/RetroPlayer/rendering/RPRenderManager.h +++ b/xbmc/cores/RetroPlayer/rendering/RPRenderManager.h @@ -93,7 +93,7 @@ public: unsigned int maxWidth, unsigned int maxHeight, float pixelAspectRatio); - std::vector<VideoStreamBuffer> GetVideoBuffers(unsigned int width, unsigned int height); + bool GetVideoBuffer(unsigned int width, unsigned int height, VideoStreamBuffer& buffer); void AddFrame(const uint8_t* data, size_t size, unsigned int width, diff --git a/xbmc/cores/RetroPlayer/streams/RetroPlayerVideo.cpp b/xbmc/cores/RetroPlayer/streams/RetroPlayerVideo.cpp index 3c740e9dc8..14c66a86ae 100644 --- a/xbmc/cores/RetroPlayer/streams/RetroPlayerVideo.cpp +++ b/xbmc/cores/RetroPlayer/streams/RetroPlayerVideo.cpp @@ -13,8 +13,6 @@ #include "cores/RetroPlayer/rendering/RenderTranslator.h" #include "utils/log.h" -#include <algorithm> - using namespace KODI; using namespace RETRO; @@ -74,33 +72,7 @@ bool CRetroPlayerVideo::GetStreamBuffer(unsigned int width, VideoStreamBuffer& videoBuffer = static_cast<VideoStreamBuffer&>(buffer); if (m_bOpen) - { - m_buffers = m_renderManager.GetVideoBuffers(width, height); - - std::sort(m_buffers.begin(), m_buffers.end(), - [](const VideoStreamBuffer& lhs, const VideoStreamBuffer& rhs) { - // Prefer read-write over write only - if (lhs.access == DataAccess::READ_WRITE && rhs.access != DataAccess::READ_WRITE) - return true; - if (lhs.access != DataAccess::READ_WRITE && rhs.access == DataAccess::READ_WRITE) - return false; - - // Prefer aligned over unaligned - if (lhs.alignment == DataAlignment::DATA_ALIGNED && - rhs.alignment != DataAlignment::DATA_ALIGNED) - return true; - if (lhs.alignment != DataAlignment::DATA_ALIGNED && - rhs.alignment == DataAlignment::DATA_ALIGNED) - return false; - - return false; - }); - - //! @todo This comment was in the original code - //! @todo Handle multiple buffers - if (!m_buffers.empty()) - videoBuffer = m_buffers.at(0); - } + return m_renderManager.GetVideoBuffer(width, height, videoBuffer); return false; } @@ -130,8 +102,6 @@ void CRetroPlayerVideo::AddStreamData(const StreamPacket& packet) m_renderManager.AddFrame(videoPacket.data, videoPacket.size, videoPacket.width, videoPacket.height, orientationDegCCW); } - - m_buffers.clear(); } void CRetroPlayerVideo::CloseStream() diff --git a/xbmc/cores/RetroPlayer/streams/RetroPlayerVideo.h b/xbmc/cores/RetroPlayer/streams/RetroPlayerVideo.h index 06ad6245c8..8d153ab5c2 100644 --- a/xbmc/cores/RetroPlayer/streams/RetroPlayerVideo.h +++ b/xbmc/cores/RetroPlayer/streams/RetroPlayerVideo.h @@ -107,7 +107,6 @@ private: // Stream properties bool m_bOpen = false; - std::vector<VideoStreamBuffer> m_buffers; }; } // namespace RETRO } // namespace KODI diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlay.h b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlay.h index f42f7c10f0..96b4cbbc57 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlay.h +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlay.h @@ -122,6 +122,6 @@ public: { } - CDVDOverlayGroup(const CDVDOverlayGroup& src) : CDVDOverlay(src) { m_overlays = src.m_overlays; } + CDVDOverlayGroup(const CDVDOverlayGroup& src) : CDVDOverlay(src), m_overlays(src.m_overlays) {} VecOverlays m_overlays; }; diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecCCText.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecCCText.cpp index 1cf0bc16f3..8f7a3c293c 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecCCText.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecCCText.cpp @@ -26,9 +26,9 @@ namespace constexpr double DEFAULT_DURATION = 20.0 * (double)DVD_TIME_BASE; } // namespace -CDVDOverlayCodecCCText::CDVDOverlayCodecCCText() : CDVDOverlayCodec("CC Text Subtitle Decoder") +CDVDOverlayCodecCCText::CDVDOverlayCodecCCText() + : CDVDOverlayCodec("CC Text Subtitle Decoder"), m_pOverlay(nullptr) { - m_pOverlay = nullptr; m_prevSubId = NO_SUBTITLE_ID; m_prevPTSStart = 0.0; m_prevText.clear(); diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecSSA.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecSSA.cpp index 0f7b200aa5..82c1c76dd5 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecSSA.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecSSA.cpp @@ -23,9 +23,10 @@ using namespace KODI; CDVDOverlayCodecSSA::CDVDOverlayCodecSSA() - : CDVDOverlayCodec("SSA Subtitle Decoder"), m_libass(std::make_shared<CDVDSubtitlesLibass>()) + : CDVDOverlayCodec("SSA Subtitle Decoder"), + m_libass(std::make_shared<CDVDSubtitlesLibass>()), + m_pOverlay(nullptr) { - m_pOverlay = nullptr; m_order = 0; m_libass->Configure(); } diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecText.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecText.cpp index 37e8f70b07..f31e59550f 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecText.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/DVDOverlayCodecText.cpp @@ -27,9 +27,9 @@ namespace constexpr double DEFAULT_DURATION = 20.0 * static_cast<double>(DVD_TIME_BASE); } // namespace -CDVDOverlayCodecText::CDVDOverlayCodecText() : CDVDOverlayCodec("Text Subtitle Decoder") +CDVDOverlayCodecText::CDVDOverlayCodecText() + : CDVDOverlayCodec("Text Subtitle Decoder"), m_pOverlay(nullptr) { - m_pOverlay = nullptr; } bool CDVDOverlayCodecText::Open(CDVDStreamInfo& hints, CDVDCodecOptions& options) diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/OverlayCodecWebVTT.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/OverlayCodecWebVTT.cpp index 7e784a619b..e33ab1dad5 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/OverlayCodecWebVTT.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Overlay/OverlayCodecWebVTT.cpp @@ -21,9 +21,9 @@ using namespace KODI; -COverlayCodecWebVTT::COverlayCodecWebVTT() : CDVDOverlayCodec("WebVTT Subtitle Decoder") +COverlayCodecWebVTT::COverlayCodecWebVTT() + : CDVDOverlayCodec("WebVTT Subtitle Decoder"), m_pOverlay(nullptr) { - m_pOverlay = nullptr; } bool COverlayCodecWebVTT::Open(CDVDStreamInfo& hints, CDVDCodecOptions& options) diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp index 16ee05487b..c775281791 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp @@ -305,11 +305,11 @@ enum AVPixelFormat CDVDVideoCodecFFmpeg::GetFormat(struct AVCodecContext * avctx return avcodec_default_get_format(avctx, fmt); } -CDVDVideoCodecFFmpeg::CDVDVideoCodecFFmpeg(CProcessInfo &processInfo) -: CDVDVideoCodec(processInfo), m_postProc(processInfo) +CDVDVideoCodecFFmpeg::CDVDVideoCodecFFmpeg(CProcessInfo& processInfo) + : CDVDVideoCodec(processInfo), + m_videoBufferPool(std::make_shared<CVideoBufferPoolFFmpeg>()), + m_postProc(processInfo) { - m_videoBufferPool = std::make_shared<CVideoBufferPoolFFmpeg>(); - m_decoderState = STATE_NONE; } diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp index 447a13495d..24edd058e9 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VAAPI.cpp @@ -1500,14 +1500,14 @@ void CVaapiRenderPicture::GetStrides(int(&strides)[YuvImage::MAX_PLANES]) //----------------------------------------------------------------------------- // Output //----------------------------------------------------------------------------- -COutput::COutput(CDecoder &decoder, CEvent *inMsgEvent) : - CThread("Vaapi-Output"), - m_controlPort("OutputControlPort", inMsgEvent, &m_outMsgEvent), - m_dataPort("OutputDataPort", inMsgEvent, &m_outMsgEvent), - m_vaapi(decoder) +COutput::COutput(CDecoder& decoder, CEvent* inMsgEvent) + : CThread("Vaapi-Output"), + m_controlPort("OutputControlPort", inMsgEvent, &m_outMsgEvent), + m_dataPort("OutputDataPort", inMsgEvent, &m_outMsgEvent), + m_vaapi(decoder), + m_bufferPool(std::make_shared<CVaapiBufferPool>(decoder)) { m_inMsgEvent = inMsgEvent; - m_bufferPool = std::make_shared<CVaapiBufferPool>(decoder); } void COutput::Start() diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp index 50e16d492e..f524d09acf 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VDPAU.cpp @@ -2827,15 +2827,15 @@ bool CMixer::CheckStatus(VdpStatus vdp_st, int line) //----------------------------------------------------------------------------- // Output //----------------------------------------------------------------------------- -COutput::COutput(CDecoder &decoder, CEvent *inMsgEvent) : - CThread("Vdpau Output"), - m_controlPort("OutputControlPort", inMsgEvent, &m_outMsgEvent), - m_dataPort("OutputDataPort", inMsgEvent, &m_outMsgEvent), - m_vdpau(decoder), - m_mixer(&m_outMsgEvent) +COutput::COutput(CDecoder& decoder, CEvent* inMsgEvent) + : CThread("Vdpau Output"), + m_controlPort("OutputControlPort", inMsgEvent, &m_outMsgEvent), + m_dataPort("OutputDataPort", inMsgEvent, &m_outMsgEvent), + m_vdpau(decoder), + m_bufferPool(std::make_shared<CVdpauBufferPool>(decoder)), + m_mixer(&m_outMsgEvent) { m_inMsgEvent = inMsgEvent; - m_bufferPool = std::make_shared<CVdpauBufferPool>(decoder); } void COutput::Start() diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.cpp index b704f9b633..f0963b580f 100644 --- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.cpp +++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/VTB.cpp @@ -142,10 +142,10 @@ bool CDecoder::Register() return true; } -CDecoder::CDecoder(CProcessInfo& processInfo) : m_processInfo(processInfo) +CDecoder::CDecoder(CProcessInfo& processInfo) + : m_processInfo(processInfo), m_videoBufferPool(std::make_shared<CVideoBufferPoolVTB>()) { m_avctx = nullptr; - m_videoBufferPool = std::make_shared<CVideoBufferPoolVTB>(); } CDecoder::~CDecoder() diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/OverlayRenderer.h b/xbmc/cores/VideoPlayer/VideoRenderers/OverlayRenderer.h index ba8dd6d465..a6690004e6 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/OverlayRenderer.h +++ b/xbmc/cores/VideoPlayer/VideoRenderers/OverlayRenderer.h @@ -139,11 +139,7 @@ namespace OVERLAY { struct SElement { - SElement() - { - overlay_dvd = NULL; - pts = 0.0; - } + SElement() : overlay_dvd(NULL) { pts = 0.0; } double pts; std::shared_ptr<CDVDOverlay> overlay_dvd; }; diff --git a/xbmc/dbwrappers/sqlitedataset.cpp b/xbmc/dbwrappers/sqlitedataset.cpp index ef9c92777c..d63b32b8eb 100644 --- a/xbmc/dbwrappers/sqlitedataset.cpp +++ b/xbmc/dbwrappers/sqlitedataset.cpp @@ -839,7 +839,7 @@ int SqliteDataset::exec(const std::string& sql) pos = qry.find(" ON ", pos + 1); if (pos != std::string::npos) - qry = qry.substr(0, pos); + qry.resize(pos); } char* errmsg; diff --git a/xbmc/filesystem/CDDAFile.cpp b/xbmc/filesystem/CDDAFile.cpp index cd98b08f9c..b83a8b9c40 100644 --- a/xbmc/filesystem/CDDAFile.cpp +++ b/xbmc/filesystem/CDDAFile.cpp @@ -21,10 +21,9 @@ using namespace MEDIA_DETECT; using namespace XFILE; -CFileCDDA::CFileCDDA(void) +CFileCDDA::CFileCDDA(void) : m_cdio(CLibcdio::GetInstance()) { m_pCdIo = NULL; - m_cdio = CLibcdio::GetInstance(); m_iSectorCount = 52; } diff --git a/xbmc/filesystem/DirectoryCache.cpp b/xbmc/filesystem/DirectoryCache.cpp index d46f11b665..b945e4cf7c 100644 --- a/xbmc/filesystem/DirectoryCache.cpp +++ b/xbmc/filesystem/DirectoryCache.cpp @@ -24,11 +24,10 @@ using namespace XFILE; -CDirectoryCache::CDir::CDir(DIR_CACHE_TYPE cacheType) +CDirectoryCache::CDir::CDir(DIR_CACHE_TYPE cacheType) : m_Items(std::make_unique<CFileItemList>()) { m_cacheType = cacheType; m_lastAccess = 0; - m_Items = std::make_unique<CFileItemList>(); m_Items->SetIgnoreURLOptions(true); m_Items->SetFastLookup(true); } diff --git a/xbmc/filesystem/EventsDirectory.cpp b/xbmc/filesystem/EventsDirectory.cpp index d533475ecc..d21261944b 100644 --- a/xbmc/filesystem/EventsDirectory.cpp +++ b/xbmc/filesystem/EventsDirectory.cpp @@ -38,7 +38,7 @@ bool CEventsDirectory::GetDirectory(const CURL& url, CFileItemList &items) includeHigherLevels = true; // remove the "+" from the end of the hostname - hostname = hostname.substr(0, hostname.size() - 1); + hostname.pop_back(); } EventLevel level = CEventLog::EventLevelFromString(hostname); diff --git a/xbmc/filesystem/FTPParse.cpp b/xbmc/filesystem/FTPParse.cpp index fb5e0350a4..664cb2c290 100644 --- a/xbmc/filesystem/FTPParse.cpp +++ b/xbmc/filesystem/FTPParse.cpp @@ -410,7 +410,7 @@ int CFTPParse::FTPParse(const std::string& str) // handle symlink size_t found = m_name.find(" -> "); if (found != std::string::npos) - m_name = m_name.substr(0, found); + m_name.resize(found); } setTime(date); @@ -442,7 +442,7 @@ int CFTPParse::FTPParse(const std::string& str) // handle symlink size_t found = m_name.find(" -> "); if (found != std::string::npos) - m_name = m_name.substr(0, found); + m_name.resize(found); } setTime(date); diff --git a/xbmc/filesystem/FileCache.cpp b/xbmc/filesystem/FileCache.cpp index 4f2e07b362..b62d8b3911 100644 --- a/xbmc/filesystem/FileCache.cpp +++ b/xbmc/filesystem/FileCache.cpp @@ -38,12 +38,10 @@ using namespace std::chrono_literals; class CWriteRate { public: - CWriteRate() + CWriteRate() : m_stamp(std::chrono::steady_clock::now()), m_time(std::chrono::milliseconds(0)) { - m_stamp = std::chrono::steady_clock::now(); m_pos = 0; m_size = 0; - m_time = std::chrono::milliseconds(0); } void Reset(int64_t pos, bool bResetAll = true) diff --git a/xbmc/guilib/VisibleEffect.cpp b/xbmc/guilib/VisibleEffect.cpp index 17b2daa755..ef953a9537 100644 --- a/xbmc/guilib/VisibleEffect.cpp +++ b/xbmc/guilib/VisibleEffect.cpp @@ -38,11 +38,11 @@ CAnimEffect::CAnimEffect(const TiXmlElement *node, EFFECT_TYPE effect) } CAnimEffect::CAnimEffect(unsigned int delay, unsigned int length, EFFECT_TYPE effect) + : m_pTweener(std::shared_ptr<Tweener>(new LinearTweener())) { m_delay = delay; m_length = length; m_effect = effect; - m_pTweener = std::shared_ptr<Tweener>(new LinearTweener()); } CAnimEffect::~CAnimEffect() = default; @@ -195,11 +195,11 @@ CFadeEffect::CFadeEffect(UTILS::COLOR::Color start, UTILS::COLOR::Color end, unsigned int delay, unsigned int length) - : CAnimEffect(delay, length, EFFECT_TYPE_FADE_DIFFUSE) + : CAnimEffect(delay, length, EFFECT_TYPE_FADE_DIFFUSE), + m_startColor(UTILS::COLOR::ConvertToFloats(start)), + m_endColor(UTILS::COLOR::ConvertToFloats(end)) { m_startAlpha = m_endAlpha = 1.0f; - m_startColor = UTILS::COLOR::ConvertToFloats(start); - m_endColor = UTILS::COLOR::ConvertToFloats(end); } void CFadeEffect::ApplyEffect(float offset, const CPoint ¢er) @@ -741,7 +741,9 @@ void CAnimation::AddEffect(const std::string &type, const TiXmlElement *node, co m_effects.push_back(effect); } -CScroller::CScroller(unsigned int duration /* = 200 */, std::shared_ptr<Tweener> tweener /* = NULL */) +CScroller::CScroller(unsigned int duration /* = 200 */, + std::shared_ptr<Tweener> tweener /* = NULL */) + : m_pTweener(std::move(tweener)) { m_scrollValue = 0; m_delta = 0; @@ -749,7 +751,6 @@ CScroller::CScroller(unsigned int duration /* = 200 */, std::shared_ptr<Tweener> m_startPosition = 0; m_hasResumePoint = false; m_duration = duration > 0 ? duration : 1; - m_pTweener = std::move(tweener); } CScroller::CScroller(const CScroller& right) diff --git a/xbmc/input/IRTranslator.cpp b/xbmc/input/IRTranslator.cpp index 906e4f56e1..837014276a 100644 --- a/xbmc/input/IRTranslator.cpp +++ b/xbmc/input/IRTranslator.cpp @@ -52,7 +52,7 @@ bool CIRTranslator::LoadIRMap(const std::string& irMapPath) std::string remoteMapTag = URIUtils::GetFileName(irMapPath); size_t lastindex = remoteMapTag.find_last_of('.'); if (lastindex != std::string::npos) - remoteMapTag = remoteMapTag.substr(0, lastindex); + remoteMapTag.resize(lastindex); StringUtils::ToLower(remoteMapTag); // Load our xml file, and fill up our mapping tables diff --git a/xbmc/input/WindowTranslator.cpp b/xbmc/input/WindowTranslator.cpp index cceb3f06f2..c750f93462 100644 --- a/xbmc/input/WindowTranslator.cpp +++ b/xbmc/input/WindowTranslator.cpp @@ -219,7 +219,7 @@ int CWindowTranslator::TranslateWindow(const std::string& window) // Eliminate .xml if (StringUtils::EndsWith(strWindow, ".xml")) - strWindow = strWindow.substr(0, strWindow.size() - 4); + strWindow.resize(strWindow.size() - 4); // window12345, for custom window to be keymapped if (strWindow.length() > 6 && StringUtils::StartsWith(strWindow, "window")) diff --git a/xbmc/interfaces/legacy/Control.cpp b/xbmc/interfaces/legacy/Control.cpp index 62dbac68ee..0169d2fcdb 100644 --- a/xbmc/interfaces/legacy/Control.cpp +++ b/xbmc/interfaces/legacy/Control.cpp @@ -956,22 +956,30 @@ namespace XBMCAddon // ============================================================ // ControlLabel // ============================================================ - ControlLabel::ControlLabel(long x, long y, long width, long height, + ControlLabel::ControlLabel(long x, + long y, + long width, + long height, const String& label, - const char* font, const char* p_textColor, + const char* font, + const char* p_textColor, const char* p_disabledColor, long p_alignment, - bool hasPath, long angle) : - strFont("font13"), - textColor(0xffffffff), disabledColor(0x60ffffff), - align(p_alignment), bHasPath(hasPath), iAngle(angle) + bool hasPath, + long angle) + : strFont("font13"), + strText(label), + textColor(0xffffffff), + disabledColor(0x60ffffff), + align(p_alignment), + bHasPath(hasPath), + iAngle(angle) { dwPosX = x; dwPosY = y; dwWidth = width; dwHeight = height; - strText = label; if (font) strFont = font; @@ -1027,26 +1035,32 @@ namespace XBMCAddon // ============================================================ // ControlEdit // ============================================================ - ControlEdit::ControlEdit(long x, long y, long width, long height, const String& label, - const char* font, const char* _textColor, + ControlEdit::ControlEdit(long x, + long y, + long width, + long height, + const String& label, + const char* font, + const char* _textColor, const char* _disabledColor, - long _alignment, const char* focusTexture, - const char* noFocusTexture) : - strFont("font13"), textColor(0xffffffff), disabledColor(0x60ffffff), - align(_alignment) - + long _alignment, + const char* focusTexture, + const char* noFocusTexture) + : strFont("font13"), + strTextureFocus(focusTexture ? focusTexture + : XBMCAddonUtils::getDefaultImage("edit", "texturefocus")), + strTextureNoFocus(noFocusTexture + ? noFocusTexture + : XBMCAddonUtils::getDefaultImage("edit", "texturenofocus")), + textColor(0xffffffff), + disabledColor(0x60ffffff), + align(_alignment) { dwPosX = x; dwPosY = y; dwWidth = width; dwHeight = height; - strTextureFocus = focusTexture ? focusTexture : - XBMCAddonUtils::getDefaultImage("edit", "texturefocus"); - - strTextureNoFocus = noFocusTexture ? noFocusTexture : - XBMCAddonUtils::getDefaultImage("edit", "texturenofocus"); - if (!label.empty()) { strText = label; diff --git a/xbmc/interfaces/python/swig.cpp b/xbmc/interfaces/python/swig.cpp index 5a2599a84e..1ef41db17f 100644 --- a/xbmc/interfaces/python/swig.cpp +++ b/xbmc/interfaces/python/swig.cpp @@ -150,7 +150,7 @@ namespace PythonBindings std::string ns(methodNamespacePrefix); // cut off trailing '::' if (ns.size() > 2 && ns[ns.size() - 1] == ':' && ns[ns.size() - 2] == ':') - ns = ns.substr(0,ns.size()-2); + ns.resize(ns.size() - 2); bool done = false; while(! done) diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp index a1bd42b418..9845960c0f 100644 --- a/xbmc/music/MusicDatabase.cpp +++ b/xbmc/music/MusicDatabase.cpp @@ -4597,12 +4597,12 @@ bool CMusicDatabase::TrimImageURLs(std::string& strImage, const size_t space) { if (strImage.length() > space) { - strImage = strImage.substr(0, space); + strImage.resize(space); // Tidy to last </thumb> tag size_t iPos = strImage.rfind("</thumb>"); if (iPos == std::string::npos) return false; - strImage = strImage.substr(0, iPos + 8); + strImage.resize(iPos + 8); } return true; } diff --git a/xbmc/network/AirPlayServer.cpp b/xbmc/network/AirPlayServer.cpp index 74251d30e6..eaa0aa58fd 100644 --- a/xbmc/network/AirPlayServer.cpp +++ b/xbmc/network/AirPlayServer.cpp @@ -318,7 +318,6 @@ CAirPlayServer::CAirPlayServer(int port, bool nonlocal) : CThread("AirPlayServer { m_port = port; m_nonlocal = nonlocal; - m_ServerSockets = std::vector<SOCKET>(); m_usePassword = false; m_origVolume = -1; CServiceBroker::GetAnnouncementManager()->AddAnnouncer(this); diff --git a/xbmc/network/WakeOnAccess.cpp b/xbmc/network/WakeOnAccess.cpp index 929c68bce8..189e082265 100644 --- a/xbmc/network/WakeOnAccess.cpp +++ b/xbmc/network/WakeOnAccess.cpp @@ -175,14 +175,13 @@ static std::string LookupUPnPHost(const std::string& uuid) return ""; } -CWakeOnAccess::WakeUpEntry::WakeUpEntry (bool isAwake) - : timeout (0, 0, 0, DEFAULT_TIMEOUT_SEC) - , wait_online1_sec(DEFAULT_WAIT_FOR_ONLINE_SEC_1) - , wait_online2_sec(DEFAULT_WAIT_FOR_ONLINE_SEC_2) - , wait_services_sec(DEFAULT_WAIT_FOR_SERVICES_SEC) +CWakeOnAccess::WakeUpEntry::WakeUpEntry(bool isAwake) + : timeout(0, 0, 0, DEFAULT_TIMEOUT_SEC), + wait_online1_sec(DEFAULT_WAIT_FOR_ONLINE_SEC_1), + wait_online2_sec(DEFAULT_WAIT_FOR_ONLINE_SEC_2), + wait_services_sec(DEFAULT_WAIT_FOR_SERVICES_SEC), + nextWake(CDateTime::GetCurrentDateTime()) { - nextWake = CDateTime::GetCurrentDateTime(); - if (isAwake) nextWake += timeout; } diff --git a/xbmc/network/cddb.cpp b/xbmc/network/cddb.cpp index acbfc9f136..1eff318c81 100644 --- a/xbmc/network/cddb.cpp +++ b/xbmc/network/cddb.cpp @@ -870,7 +870,7 @@ bool Xcddb::queryCDinfo(CCdInfo* pInfo) std::string lcAppName = CCompileInfo::GetAppName(); StringUtils::ToLower(lcAppName); if (version.find(' ') != std::string::npos) - version = version.substr(0, version.find(' ')); + version.resize(version.find(' ')); std::string strGreeting = "cddb hello " + lcAppName + " kodi.tv " + CCompileInfo::GetAppName() + " " + version; if ( ! Send(strGreeting.c_str()) ) { diff --git a/xbmc/network/httprequesthandler/HTTPRequestHandlerUtils.cpp b/xbmc/network/httprequesthandler/HTTPRequestHandlerUtils.cpp index 240449a1ba..a3a181eb94 100644 --- a/xbmc/network/httprequesthandler/HTTPRequestHandlerUtils.cpp +++ b/xbmc/network/httprequesthandler/HTTPRequestHandlerUtils.cpp @@ -28,7 +28,7 @@ std::string HTTPRequestHandlerUtils::GetRequestHeaderValue(struct MHD_Connection std::string strValue(value); size_t pos = strValue.find(';'); if (pos != std::string::npos) - strValue = strValue.substr(0, pos); + strValue.resize(pos); return strValue; } diff --git a/xbmc/platform/android/CPUInfoAndroid.cpp b/xbmc/platform/android/CPUInfoAndroid.cpp index 91339d0523..3ccc5752e9 100644 --- a/xbmc/platform/android/CPUInfoAndroid.cpp +++ b/xbmc/platform/android/CPUInfoAndroid.cpp @@ -21,10 +21,8 @@ std::shared_ptr<CCPUInfo> CCPUInfo::GetCPUInfo() return std::make_shared<CCPUInfoAndroid>(); } -CCPUInfoAndroid::CCPUInfoAndroid() +CCPUInfoAndroid::CCPUInfoAndroid() : m_posixFile(std::make_unique<CPosixFile>()) { - m_posixFile = std::make_unique<CPosixFile>(); - if (m_posixFile && m_posixFile->Open(CURL("/proc/cpuinfo"))) { std::array<char, 2048> buffer = {}; diff --git a/xbmc/platform/android/activity/CMakeLists.txt b/xbmc/platform/android/activity/CMakeLists.txt index c3fe1d6fca..79e93e45b4 100644 --- a/xbmc/platform/android/activity/CMakeLists.txt +++ b/xbmc/platform/android/activity/CMakeLists.txt @@ -5,7 +5,6 @@ set(SOURCES android_main.cpp AndroidMouse.cpp AndroidTouch.cpp EventLoop.cpp - GraphicBuffer.cpp JNIMainActivity.cpp JNIXBMCMainView.cpp JNIXBMCMediaSession.cpp @@ -29,9 +28,7 @@ set(HEADERS AndroidExtra.h AndroidKey.h AndroidMouse.h AndroidTouch.h - DllGraphicBuffer.h EventLoop.h - GraphicBuffer.h IActivityHandler.h JNIMainActivity.h JNIXBMCMainView.h diff --git a/xbmc/platform/android/activity/DllGraphicBuffer.h b/xbmc/platform/android/activity/DllGraphicBuffer.h deleted file mode 100644 index 3ddc46c826..0000000000 --- a/xbmc/platform/android/activity/DllGraphicBuffer.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - */ - -#pragma once - -#include "DynamicDll.h" -#include "GraphicBuffer.h" -class DllGraphicBufferInterface -{ -public: - virtual ~DllGraphicBufferInterface() = default; - virtual void GraphicBufferCtor(void *, uint32_t w, uint32_t h, uint32_t format, gfxImageUsage usage)=0; - virtual void GraphicBufferDtor(void *)=0; - virtual int GraphicBufferLock(void*, uint32_t usage, void **addr)=0; - virtual int GraphicBufferUnlock(void*)=0; - virtual int GraphicBufferGetNativeBuffer(void*)=0; -}; - -class DllGraphicBuffer : public DllDynamic, DllGraphicBufferInterface -{ - DECLARE_DLL_WRAPPER(DllGraphicBuffer, DLL_PATH_LIBUI) - - DEFINE_METHOD5(void, GraphicBufferCtor, (void *p1, uint32_t p2, uint32_t p3, uint32_t p4, gfxImageUsage p5)) - DEFINE_METHOD1(void, GraphicBufferDtor, (void* p1)) - DEFINE_METHOD3(int, GraphicBufferLock, (void *p1, uint32_t p2, void** p3)) - DEFINE_METHOD1(int, GraphicBufferUnlock,(void* p1)) - DEFINE_METHOD1(int, GraphicBufferGetNativeBuffer,(void* p1)) - - BEGIN_METHOD_RESOLVE() - RESOLVE_METHOD_RENAME(_ZN7android13GraphicBufferC1Ejjij, GraphicBufferCtor) - RESOLVE_METHOD_RENAME(_ZN7android13GraphicBufferD1Ev, GraphicBufferDtor) - RESOLVE_METHOD_RENAME(_ZN7android13GraphicBuffer4lockEjPPv, GraphicBufferLock) - RESOLVE_METHOD_RENAME(_ZN7android13GraphicBuffer6unlockEv, GraphicBufferUnlock) - RESOLVE_METHOD_RENAME(_ZNK7android13GraphicBuffer15getNativeBufferEv, GraphicBufferGetNativeBuffer) - END_METHOD_RESOLVE() -}; diff --git a/xbmc/platform/android/activity/GraphicBuffer.cpp b/xbmc/platform/android/activity/GraphicBuffer.cpp deleted file mode 100644 index 2cddcb7f1f..0000000000 --- a/xbmc/platform/android/activity/GraphicBuffer.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - * - * The Original Code is Mozilla Corporation code. - * - * The Initial Developer of the Original Code is Mozilla Foundation. - * Portions created by the Initial Developer are Copyright (C) 2009 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * James Willcox <jwillcox@mozilla.com> - */ - -#include "GraphicBuffer.h" - -#include "DllGraphicBuffer.h" -#include "XBMCApp.h" -#include "utils/log.h" - -DllGraphicBuffer *CGraphicBuffer::m_dll = NULL; - -/* Yanked from Android's hardware.h */ -enum -{ - HAL_PIXEL_FORMAT_RGBA_8888 = 1, - HAL_PIXEL_FORMAT_RGBX_8888 = 2, - HAL_PIXEL_FORMAT_RGB_888 = 3, - HAL_PIXEL_FORMAT_RGB_565 = 4, - HAL_PIXEL_FORMAT_BGRA_8888 = 5, - HAL_PIXEL_FORMAT_RGBA_5551 = 6, - HAL_PIXEL_FORMAT_RGBA_4444 = 7, - - /* - * Android YUV format: - * - * This format is exposed outside of the HAL to software - * decoders and applications. - * EGLImageKHR must support it in conjunction with the - * OES_EGL_image_external extension. - * - * YV12 is 4:2:0 YCrCb planar format comprised of a WxH Y plane followed - * by (W/2) x (H/2) Cr and Cb planes. - * - * This format assumes - * - an even width - * - an even height - * - a horizontal stride multiple of 16 pixels - * - a vertical stride equal to the height - * - * y_size = stride * height - * c_size = ALIGN(stride/2, 16) * height/2 - * size = y_size + c_size * 2 - * cr_offset = y_size - * cb_offset = y_size + c_size - * - */ - HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar -}; - -CGraphicBuffer::CGraphicBuffer(uint32_t width, uint32_t height, uint32_t format, gfxImageUsage usage): - m_handle(0) -{ - CLog::Log(LOGDEBUG, "CGraphicBuffer::CGraphicBuffer"); - if (!m_dll) - { - // m_dll is static, there can be only one. - m_dll = new DllGraphicBuffer; - m_dll->Load(); - m_dll->EnableDelayedUnload(false); - } - - m_handle = malloc(4096 * 4); - if (m_dll) - m_dll->GraphicBufferCtor(m_handle, width, height, GetAndroidFormat(format), usage); -} - -CGraphicBuffer::~CGraphicBuffer() -{ - if (m_handle) - { - if (m_dll) - m_dll->GraphicBufferDtor(m_handle); - free(m_handle); - } -} - -bool CGraphicBuffer::Lock(gfxImageUsage aUsage, void **addr) -{ - if (m_dll) - return m_dll->GraphicBufferLock(m_handle, aUsage, addr) == 0; - return false; -} - -uint32_t CGraphicBuffer::GetNativeBuffer() -{ - if (m_dll) - return m_dll->GraphicBufferGetNativeBuffer(m_handle); - return false; -} - -bool CGraphicBuffer::Unlock() -{ - if (m_dll) - return m_dll->GraphicBufferUnlock(m_handle) == 0; - return false; -} - -uint32_t CGraphicBuffer::GetAndroidFormat(uint32_t format) -{ - switch (format) - { - case XB_FMT_A8R8G8B8: - return HAL_PIXEL_FORMAT_BGRA_8888; - case XB_FMT_RGBA8: - return HAL_PIXEL_FORMAT_RGBA_8888; - case XB_FMT_RGB8: - return HAL_PIXEL_FORMAT_RGB_888; - } - return 0; -} diff --git a/xbmc/platform/android/activity/GraphicBuffer.h b/xbmc/platform/android/activity/GraphicBuffer.h deleted file mode 100644 index 86a5405c53..0000000000 --- a/xbmc/platform/android/activity/GraphicBuffer.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2005-2018 Team Kodi - * This file is part of Kodi - https://kodi.tv - * - * SPDX-License-Identifier: GPL-2.0-or-later - * See LICENSES/README.md for more information. - * - * The Original Code is Mozilla Corporation code. - * - * The Initial Developer of the Original Code is Mozilla Foundation. - * Portions created by the Initial Developer are Copyright (C) 2009 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * James Willcox <jwillcox@mozilla.com> - */ - -#pragma once - -#include "guilib/XBTF.h" - -#include <stdint.h> - -class DllGraphicBuffer; - -/* Copied from Android's gralloc.h */ -enum gfxImageUsage { - /* buffer is never read in software */ - GRALLOC_USAGE_SW_READ_NEVER = 0x00000000, - /* buffer is rarely read in software */ - GRALLOC_USAGE_SW_READ_RARELY = 0x00000002, - /* buffer is often read in software */ - GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003, - /* mask for the software read values */ - GRALLOC_USAGE_SW_READ_MASK = 0x0000000F, - - /* buffer is never written in software */ - GRALLOC_USAGE_SW_WRITE_NEVER = 0x00000000, - /* buffer is never written in software */ - GRALLOC_USAGE_SW_WRITE_RARELY = 0x00000020, - /* buffer is never written in software */ - GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030, - /* mask for the software write values */ - GRALLOC_USAGE_SW_WRITE_MASK = 0x000000F0, - - /* buffer will be used as an OpenGL ES texture */ - GRALLOC_USAGE_HW_TEXTURE = 0x00000100, - /* buffer will be used as an OpenGL ES render target */ - GRALLOC_USAGE_HW_RENDER = 0x00000200, - /* buffer will be used by the 2D hardware blitter */ - GRALLOC_USAGE_HW_2D = 0x00000400, - /* buffer will be used with the framebuffer device */ - GRALLOC_USAGE_HW_FB = 0x00001000, - /* mask for the software usage bit-mask */ - GRALLOC_USAGE_HW_MASK = 0x00001F00, - - /* implementation-specific private usage flags */ - GRALLOC_USAGE_PRIVATE_0 = 0x10000000, - GRALLOC_USAGE_PRIVATE_1 = 0x20000000, - GRALLOC_USAGE_PRIVATE_2 = 0x40000000, - GRALLOC_USAGE_PRIVATE_3 = 0x80000000, - GRALLOC_USAGE_PRIVATE_MASK = 0xF0000000, -}; - -class CGraphicBuffer -{ -public: - CGraphicBuffer(uint32_t width, uint32_t height, uint32_t format, gfxImageUsage usage); - virtual ~CGraphicBuffer(); - - bool Lock(gfxImageUsage usage, void **addr); - bool Unlock(); - uint32_t GetNativeBuffer(); - -private: - uint32_t GetAndroidFormat(uint32_t format); - - void *m_handle; - static DllGraphicBuffer *m_dll; -}; diff --git a/xbmc/platform/android/activity/XBMCApp.cpp b/xbmc/platform/android/activity/XBMCApp.cpp index c7d9e917c9..1c09933cbd 100644 --- a/xbmc/platform/android/activity/XBMCApp.cpp +++ b/xbmc/platform/android/activity/XBMCApp.cpp @@ -22,6 +22,8 @@ #include "messaging/ApplicationMessenger.h" #include "settings/AdvancedSettings.h" #include "settings/DisplaySettings.h" +#include "settings/Settings.h" +#include "settings/SettingsComponent.h" #include "windowing/GraphicContext.h" #include <mutex> @@ -292,6 +294,16 @@ void CXBMCApp::onResume() CServiceBroker::GetWinSystem()->GetOSScreenSaver()->IsInhibited()) KeepScreenOn(true); + // Reset shutdown timer on wake up + if (g_application.IsInitialized() && + CServiceBroker::GetSettingsComponent()->GetSettings()->GetInt( + CSettings::SETTING_POWERMANAGEMENT_SHUTDOWNTIME)) + { + auto& components = CServiceBroker::GetAppComponents(); + const auto appPower = components.GetComponent<CApplicationPowerHandling>(); + appPower->ResetShutdownTimers(); + } + m_headsetPlugged = isHeadsetPlugged(); // Clear the applications cache. We could have installed/deinstalled apps diff --git a/xbmc/platform/android/filesystem/APKDirectory.cpp b/xbmc/platform/android/filesystem/APKDirectory.cpp index f573a54102..df890bfed6 100644 --- a/xbmc/platform/android/filesystem/APKDirectory.cpp +++ b/xbmc/platform/android/filesystem/APKDirectory.cpp @@ -57,7 +57,7 @@ bool CAPKDirectory::GetDirectory(const CURL& url, CFileItemList &items) if (dir_marker != std::string::npos) { // return items relative to path - test_name=test_name.substr(0, dir_marker); + test_name.resize(dir_marker); if (items.Contains(host + "/" + test_name)) continue; diff --git a/xbmc/platform/win10/AsyncHelpers.h b/xbmc/platform/win10/AsyncHelpers.h index aaca173aae..dd2a290b9f 100644 --- a/xbmc/platform/win10/AsyncHelpers.h +++ b/xbmc/platform/win10/AsyncHelpers.h @@ -10,18 +10,28 @@ #include <ppl.h> #include <ppltasks.h> +#include <sdkddkver.h> namespace winrt { using namespace Windows::Foundation; } +inline bool is_sta() +{ +#ifdef NTDDI_WIN10_CO // Windows SDK 10.0.22000.0 or newer + return winrt::impl::is_sta_thread(); +#else + return winrt::impl::is_sta(); +#endif +} + inline void Wait(const winrt::IAsyncAction& asyncOp) { if (asyncOp.Status() == winrt::AsyncStatus::Completed) return; - if (!winrt::impl::is_sta()) + if (!is_sta()) return asyncOp.get(); auto __sync = std::make_shared<Concurrency::event>(); @@ -37,7 +47,7 @@ TResult Wait(const winrt::IAsyncOperationWithProgress<TResult, TProgress>& async if (asyncOp.Status() == winrt::AsyncStatus::Completed) return asyncOp.GetResults(); - if (!winrt::impl::is_sta()) + if (!is_sta()) return asyncOp.get(); auto __sync = std::make_shared<Concurrency::event>(); @@ -55,7 +65,7 @@ TResult Wait(const winrt::IAsyncOperation<TResult>& asyncOp) if (asyncOp.Status() == winrt::AsyncStatus::Completed) return asyncOp.GetResults(); - if (!winrt::impl::is_sta()) + if (!is_sta()) return asyncOp.get(); auto __sync = std::make_shared<Concurrency::event>(); @@ -74,7 +84,7 @@ TResult Wait(const Concurrency::task<TResult>& asyncOp) if (asyncOp.is_done()) return asyncOp.get(); - if (!winrt::impl::is_sta()) // blocking suspend is allowed + if (!is_sta()) // blocking suspend is allowed return asyncOp.get(); auto _sync = std::make_shared<Concurrency::event>(); diff --git a/xbmc/platform/win10/main.cpp b/xbmc/platform/win10/main.cpp index 87f24cf63a..0b5f388c52 100644 --- a/xbmc/platform/win10/main.cpp +++ b/xbmc/platform/win10/main.cpp @@ -10,8 +10,10 @@ #include "platform/win10/Win10App.h" +using namespace KODI::PLATFORM::WINDOWS10; + int __stdcall WinMain(HINSTANCE, HINSTANCE, PCSTR, int) { winrt::init_apartment(); - winrt::Windows::ApplicationModel::Core::CoreApplication::Run(KODI::PLATFORM::WINDOWS10::App()); + winrt::Windows::ApplicationModel::Core::CoreApplication::Run(winrt::make<App>()); } diff --git a/xbmc/platform/win10/network/NetworkWin10.cpp b/xbmc/platform/win10/network/NetworkWin10.cpp index 631de872e6..e8b86c358f 100644 --- a/xbmc/platform/win10/network/NetworkWin10.cpp +++ b/xbmc/platform/win10/network/NetworkWin10.cpp @@ -56,6 +56,7 @@ typedef struct icmp_echo_reply { #endif //! IP_STATUS_BASE #include <Icmpapi.h> +#include <winrt/Windows.Networking.Connectivity.h> namespace { diff --git a/xbmc/platform/win32/pch.h b/xbmc/platform/win32/pch.h index 8f56c347d1..2c39ec4e4b 100644 --- a/xbmc/platform/win32/pch.h +++ b/xbmc/platform/win32/pch.h @@ -44,13 +44,14 @@ #include <winrt/Windows.ApplicationModel.Core.h> #include <winrt/Windows.ApplicationModel.Activation.h> #include <winrt/Windows.Foundation.h> +#include <winrt/Windows.Foundation.Collections.h> #include <winrt/Windows.Graphics.Display.h> +#include <winrt/Windows.Storage.h> #include <winrt/Windows.System.h> #include <winrt/Windows.System.Threading.h> #include <winrt/Windows.UI.Core.h> #include <winrt/Windows.UI.Input.h> #include <winrt/Windows.UI.ViewManagement.h> -WINRT_WARNING_PUSH #endif // anything below here should be headers that very rarely (hopefully never) // change yet are included almost everywhere. diff --git a/xbmc/pvr/channels/PVRChannelsPath.cpp b/xbmc/pvr/channels/PVRChannelsPath.cpp index 2f10926c75..2dfca994a2 100644 --- a/xbmc/pvr/channels/PVRChannelsPath.cpp +++ b/xbmc/pvr/channels/PVRChannelsPath.cpp @@ -154,9 +154,8 @@ CPVRChannelsPath::CPVRChannelsPath(bool bRadio, bool bHidden, const std::string& strGroupName, int iGroupClientID) - : m_bRadio(bRadio) + : m_bRadio(bRadio), m_groupName(bHidden ? ".hidden" : strGroupName) { - m_groupName = bHidden ? ".hidden" : strGroupName; if (m_groupName.empty()) { m_kind = Kind::EMPTY; @@ -172,9 +171,8 @@ CPVRChannelsPath::CPVRChannelsPath(bool bRadio, } CPVRChannelsPath::CPVRChannelsPath(bool bRadio, const std::string& strGroupName, int iGroupClientID) - : m_bRadio(bRadio) + : m_bRadio(bRadio), m_groupName(strGroupName) { - m_groupName = strGroupName; if (m_groupName.empty()) { m_kind = Kind::EMPTY; diff --git a/xbmc/settings/DisplaySettings.cpp b/xbmc/settings/DisplaySettings.cpp index 8ddddeb106..023a11adb2 100644 --- a/xbmc/settings/DisplaySettings.cpp +++ b/xbmc/settings/DisplaySettings.cpp @@ -421,7 +421,8 @@ void CDisplaySettings::SetCurrentResolution(RESOLUTION resolution, bool save /* { // Save videoscreen.screenmode setting std::string mode = GetStringFromResolution(resolution); - CServiceBroker::GetSettingsComponent()->GetSettings()->SetString(CSettings::SETTING_VIDEOSCREEN_SCREENMODE, mode.c_str()); + CServiceBroker::GetSettingsComponent()->GetSettings()->SetString( + CSettings::SETTING_VIDEOSCREEN_SCREENMODE, mode); // Check if videoscreen.screen setting also needs to be saved // e.g. if ToggleFullscreen is called diff --git a/xbmc/settings/MediaSourceSettings.cpp b/xbmc/settings/MediaSourceSettings.cpp index 183131f0ec..1cc885b58b 100644 --- a/xbmc/settings/MediaSourceSettings.cpp +++ b/xbmc/settings/MediaSourceSettings.cpp @@ -192,7 +192,7 @@ bool CMediaSourceSettings::UpdateSource(const std::string &strType, const std::s if (pShares == NULL) return false; - for (IVECSOURCES it = pShares->begin(); it != pShares->end(); it++) + for (IVECSOURCES it = pShares->begin(); it != pShares->end(); ++it) { if (it->strName == strOldName) { @@ -230,7 +230,7 @@ bool CMediaSourceSettings::DeleteSource(const std::string &strType, const std::s bool found = false; - for (IVECSOURCES it = pShares->begin(); it != pShares->end(); it++) + for (IVECSOURCES it = pShares->begin(); it != pShares->end(); ++it) { if (it->strName == strName && it->strPath == strPath) { @@ -292,7 +292,7 @@ bool CMediaSourceSettings::UpdateShare(const std::string &type, const std::strin // update our current share list CMediaSource* pShare = NULL; - for (IVECSOURCES it = pShares->begin(); it != pShares->end(); it++) + for (IVECSOURCES it = pShares->begin(); it != pShares->end(); ++it) { if (it->strName == oldName) { @@ -469,7 +469,7 @@ bool CMediaSourceSettings::SetSources(TiXmlNode *root, const char *section, cons return false; XMLUtils::SetPath(sectionNode, "default", defaultPath); - for (CIVECSOURCES it = shares.begin(); it != shares.end(); it++) + for (CIVECSOURCES it = shares.begin(); it != shares.end(); ++it) { const CMediaSource &share = *it; if (share.m_ignore) diff --git a/xbmc/storage/cdioSupport.cpp b/xbmc/storage/cdioSupport.cpp index 70e2463077..cd90504564 100644 --- a/xbmc/storage/cdioSupport.cpp +++ b/xbmc/storage/cdioSupport.cpp @@ -247,10 +247,8 @@ char* CLibcdio::GetDeviceFileName() ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// -CCdIoSupport::CCdIoSupport() -: cdio(nullptr) +CCdIoSupport::CCdIoSupport() : cdio(nullptr), m_cdio(CLibcdio::GetInstance()) { - m_cdio = CLibcdio::GetInstance(); m_nFirstData = -1; /* # of first data track */ m_nNumData = 0; /* # of data tracks */ m_nFirstAudio = -1; /* # of first audio track */ diff --git a/xbmc/utils/Archive.cpp b/xbmc/utils/Archive.cpp index 4f69929a42..cbc2ccf0fe 100644 --- a/xbmc/utils/Archive.cpp +++ b/xbmc/utils/Archive.cpp @@ -31,11 +31,11 @@ using namespace XFILE; #define MAX_STRING_SIZE 100*1024*1024 CArchive::CArchive(CFile* pFile, int mode) + : m_pBuffer(std::unique_ptr<uint8_t[]>(new uint8_t[CARCHIVE_BUFFER_MAX])) { m_pFile = pFile; m_iMode = mode; - m_pBuffer = std::unique_ptr<uint8_t[]>(new uint8_t[CARCHIVE_BUFFER_MAX]); memset(m_pBuffer.get(), 0, CARCHIVE_BUFFER_MAX); if (mode == load) { diff --git a/xbmc/utils/EGLFence.cpp b/xbmc/utils/EGLFence.cpp index 369c40a5f1..535e3bce31 100644 --- a/xbmc/utils/EGLFence.cpp +++ b/xbmc/utils/EGLFence.cpp @@ -13,12 +13,15 @@ using namespace KODI::UTILS::EGL; -CEGLFence::CEGLFence(EGLDisplay display) : - m_display(display) +CEGLFence::CEGLFence(EGLDisplay display) + : m_display(display), + m_eglCreateSyncKHR( + CEGLUtils::GetRequiredProcAddress<PFNEGLCREATESYNCKHRPROC>("eglCreateSyncKHR")), + m_eglDestroySyncKHR( + CEGLUtils::GetRequiredProcAddress<PFNEGLDESTROYSYNCKHRPROC>("eglDestroySyncKHR")), + m_eglGetSyncAttribKHR( + CEGLUtils::GetRequiredProcAddress<PFNEGLGETSYNCATTRIBKHRPROC>("eglGetSyncAttribKHR")) { - m_eglCreateSyncKHR = CEGLUtils::GetRequiredProcAddress<PFNEGLCREATESYNCKHRPROC>("eglCreateSyncKHR"); - m_eglDestroySyncKHR = CEGLUtils::GetRequiredProcAddress<PFNEGLDESTROYSYNCKHRPROC>("eglDestroySyncKHR"); - m_eglGetSyncAttribKHR = CEGLUtils::GetRequiredProcAddress<PFNEGLGETSYNCATTRIBKHRPROC>("eglGetSyncAttribKHR"); } void CEGLFence::CreateFence() diff --git a/xbmc/utils/EGLImage.cpp b/xbmc/utils/EGLImage.cpp index 24f9708ce6..36757995f4 100644 --- a/xbmc/utils/EGLImage.cpp +++ b/xbmc/utils/EGLImage.cpp @@ -104,12 +104,16 @@ std::map<EGLint, const char*> eglAttributes = } // namespace -CEGLImage::CEGLImage(EGLDisplay display) : - m_display(display) +CEGLImage::CEGLImage(EGLDisplay display) + : m_display(display), + m_eglCreateImageKHR( + CEGLUtils::GetRequiredProcAddress<PFNEGLCREATEIMAGEKHRPROC>("eglCreateImageKHR")), + m_eglDestroyImageKHR( + CEGLUtils::GetRequiredProcAddress<PFNEGLDESTROYIMAGEKHRPROC>("eglDestroyImageKHR")), + m_glEGLImageTargetTexture2DOES( + CEGLUtils::GetRequiredProcAddress<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>( + "glEGLImageTargetTexture2DOES")) { - m_eglCreateImageKHR = CEGLUtils::GetRequiredProcAddress<PFNEGLCREATEIMAGEKHRPROC>("eglCreateImageKHR"); - m_eglDestroyImageKHR = CEGLUtils::GetRequiredProcAddress<PFNEGLDESTROYIMAGEKHRPROC>("eglDestroyImageKHR"); - m_glEGLImageTargetTexture2DOES = CEGLUtils::GetRequiredProcAddress<PFNGLEGLIMAGETARGETTEXTURE2DOESPROC>("glEGLImageTargetTexture2DOES"); } bool CEGLImage::CreateImage(EglAttrs imageAttrs) diff --git a/xbmc/utils/ExecString.cpp b/xbmc/utils/ExecString.cpp index 37650e0468..7b55af0183 100644 --- a/xbmc/utils/ExecString.cpp +++ b/xbmc/utils/ExecString.cpp @@ -77,7 +77,7 @@ void SplitParams(const std::string& paramString, std::vector<std::string>& param if (!inFunction && ch == ',') { // not in a function, so a comma signifies the end of this parameter if (whiteSpacePos) - parameter = parameter.substr(0, whiteSpacePos); + parameter.resize(whiteSpacePos); // trim off start and end quotes if (parameter.length() > 1 && parameter[0] == '"' && parameter[parameter.length() - 1] == '"') diff --git a/xbmc/utils/Locale.cpp b/xbmc/utils/Locale.cpp index ff63ed4806..2430889825 100644 --- a/xbmc/utils/Locale.cpp +++ b/xbmc/utils/Locale.cpp @@ -224,7 +224,7 @@ bool CLocale::ParseLocale(const std::string &locale, std::string &language, std: if (pos != std::string::npos) { modifier = tmp.substr(pos + 1); - tmp = tmp.substr(0, pos); + tmp.resize(pos); } // look for the codeset after . @@ -232,7 +232,7 @@ bool CLocale::ParseLocale(const std::string &locale, std::string &language, std: if (pos != std::string::npos) { codeset = tmp.substr(pos + 1); - tmp = tmp.substr(0, pos); + tmp.resize(pos); } // look for the codeset after _ @@ -241,7 +241,7 @@ bool CLocale::ParseLocale(const std::string &locale, std::string &language, std: { territory = tmp.substr(pos + 1); StringUtils::ToUpper(territory); - tmp = tmp.substr(0, pos); + tmp.resize(pos); } // what remains is the language diff --git a/xbmc/utils/URIUtils.cpp b/xbmc/utils/URIUtils.cpp index b2b9b23bc0..c780da6be0 100644 --- a/xbmc/utils/URIUtils.cpp +++ b/xbmc/utils/URIUtils.cpp @@ -230,7 +230,7 @@ void URIUtils::Split(const std::string& strFileNameAndPath, else i--; } if (i > 0) - strFileName = strFileName.substr(0, i); + strFileName.resize(i); } } diff --git a/xbmc/utils/Variant.cpp b/xbmc/utils/Variant.cpp index 8eb7e34f7a..aef5e6c861 100644 --- a/xbmc/utils/Variant.cpp +++ b/xbmc/utils/Variant.cpp @@ -609,7 +609,7 @@ const CVariant& CVariant::operator[](unsigned int position) const& CVariant CVariant::operator[](unsigned int position) && { if (m_type == VariantTypeArray && size() > position) - return std::move(m_data.array->at(position)); + return m_data.array->at(position); else return ConstNullVariant; } diff --git a/xbmc/utils/test/TestCharsetConverter.cpp b/xbmc/utils/test/TestCharsetConverter.cpp index f8736b7729..203191d690 100644 --- a/xbmc/utils/test/TestCharsetConverter.cpp +++ b/xbmc/utils/test/TestCharsetConverter.cpp @@ -220,7 +220,7 @@ TEST_F(TestCharsetConverter, isValidUtf8_1) { varstra1.clear(); g_charsetConverter.ToUtf8("UTF-16LE", refutf16LE3, varstra1); - EXPECT_TRUE(CUtf8Utils::isValidUtf8(varstra1.c_str())); + EXPECT_TRUE(CUtf8Utils::isValidUtf8(varstra1)); } TEST_F(TestCharsetConverter, isValidUtf8_2) @@ -233,7 +233,7 @@ TEST_F(TestCharsetConverter, isValidUtf8_3) { varstra1.clear(); g_charsetConverter.ToUtf8("UTF-16LE", refutf16LE3, varstra1); - EXPECT_TRUE(CUtf8Utils::isValidUtf8(varstra1.c_str())); + EXPECT_TRUE(CUtf8Utils::isValidUtf8(varstra1)); } TEST_F(TestCharsetConverter, isValidUtf8_4) diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index 568fbd7b04..2bb425c4d0 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -1727,7 +1727,7 @@ int CVideoDatabase::AddActor(const std::string& name, const std::string& thumbUR int idActor = -1; // ATTENTION: the trimming of actor names should really not be done here but after the scraping / NFO-parsing - std::string trimmedName = name.c_str(); + std::string trimmedName = name; StringUtils::Trim(trimmedName); std::string strSQL=PrepareSQL("select actor_id from actor where name like '%s'", trimmedName.substr(0, 255).c_str()); diff --git a/xbmc/video/dialogs/GUIDialogVideoInfo.cpp b/xbmc/video/dialogs/GUIDialogVideoInfo.cpp index 240d672744..626a9e0bb8 100644 --- a/xbmc/video/dialogs/GUIDialogVideoInfo.cpp +++ b/xbmc/video/dialogs/GUIDialogVideoInfo.cpp @@ -1919,7 +1919,7 @@ bool CGUIDialogVideoInfo::AddItemsToTag(const std::shared_ptr<CFileItem>& tagIte return true; std::string mediaType = videoUrl.GetItemType(); - mediaType = mediaType.substr(0, mediaType.length() - 1); + mediaType.pop_back(); CFileItemList items; std::string localizedType = GetLocalizedVideoType(mediaType); @@ -1952,7 +1952,7 @@ bool CGUIDialogVideoInfo::RemoveItemsFromTag(const std::shared_ptr<CFileItem>& t return true; std::string mediaType = videoUrl.GetItemType(); - mediaType = mediaType.substr(0, mediaType.length() - 1); + mediaType.pop_back(); CFileItemList items; std::string localizedType = GetLocalizedVideoType(mediaType); diff --git a/xbmc/video/windows/GUIWindowVideoNav.cpp b/xbmc/video/windows/GUIWindowVideoNav.cpp index 7987b10bd7..7f488349e8 100644 --- a/xbmc/video/windows/GUIWindowVideoNav.cpp +++ b/xbmc/video/windows/GUIWindowVideoNav.cpp @@ -1009,7 +1009,7 @@ bool CGUIWindowVideoNav::OnClick(int iItem, const std::string &player) // get the media type and convert from plural to singular (by removing the trailing "s") std::string mediaType = item->GetPath().substr(9); - mediaType = mediaType.substr(0, mediaType.size() - 1); + mediaType.pop_back(); std::string localizedType = CGUIDialogVideoInfo::GetLocalizedVideoType(mediaType); if (localizedType.empty()) return true; diff --git a/xbmc/view/GUIViewState.cpp b/xbmc/view/GUIViewState.cpp index ef62cf3fe4..e0cf9d2aca 100644 --- a/xbmc/view/GUIViewState.cpp +++ b/xbmc/view/GUIViewState.cpp @@ -463,7 +463,7 @@ VECSOURCES& CGUIViewState::GetSources() void CGUIViewState::AddLiveTVSources() { VECSOURCES *sources = CMediaSourceSettings::GetInstance().GetSources("video"); - for (IVECSOURCES it = sources->begin(); it != sources->end(); it++) + for (IVECSOURCES it = sources->begin(); it != sources->end(); ++it) { if (URIUtils::IsLiveTV((*it).strPath)) { diff --git a/xbmc/weather/GUIWindowWeather.cpp b/xbmc/weather/GUIWindowWeather.cpp index 66b93b589d..c78dfb7ad3 100644 --- a/xbmc/weather/GUIWindowWeather.cpp +++ b/xbmc/weather/GUIWindowWeather.cpp @@ -226,7 +226,7 @@ void CGUIWindowWeather::SetLocation(int loc) std::string strLabel = CServiceBroker::GetWeatherManager().GetLocation(loc); size_t iPos = strLabel.rfind(", "); if (iPos != std::string::npos) - strLabel = strLabel.substr(0, iPos); + strLabel.resize(iPos); SET_CONTROL_LABEL(CONTROL_SELECTLOCATION, strLabel); } CServiceBroker::GetWeatherManager().Refresh(); diff --git a/xbmc/windowing/android/WinSystemAndroid.cpp b/xbmc/windowing/android/WinSystemAndroid.cpp index d8ddbb054e..378968d886 100644 --- a/xbmc/windowing/android/WinSystemAndroid.cpp +++ b/xbmc/windowing/android/WinSystemAndroid.cpp @@ -278,6 +278,11 @@ void CWinSystemAndroid::UpdateDisplayModes() } } +bool CWinSystemAndroid::Minimize() +{ + return CXBMCApp::Get().moveTaskToBack(true); +} + bool CWinSystemAndroid::Hide() { return false; diff --git a/xbmc/windowing/android/WinSystemAndroid.h b/xbmc/windowing/android/WinSystemAndroid.h index 0e391934b5..0ed6e9b4f0 100644 --- a/xbmc/windowing/android/WinSystemAndroid.h +++ b/xbmc/windowing/android/WinSystemAndroid.h @@ -46,6 +46,7 @@ public: bool HasCursor() override { return false; } + bool Minimize() override; bool Hide() override; bool Show(bool raise = true) override; void Register(IDispResource *resource) override; |