From e910a7b428236ad0624d3a8aaf7a96d8e3dde010 Mon Sep 17 00:00:00 2001 From: Tobias Markus Date: Thu, 22 Jan 2015 21:56:21 +0100 Subject: [PATCH] cppcheck performance fixes --- xbmc/Application.cpp | 2 +- xbmc/ApplicationMessenger.cpp | 8 ++--- xbmc/CueDocument.cpp | 5 +-- xbmc/DynamicDll.cpp | 4 +-- xbmc/GUIInfoManager.cpp | 2 +- xbmc/GUILargeTextureManager.cpp | 8 ++--- xbmc/LangInfo.cpp | 33 +++++++++---------- xbmc/PartyModeManager.cpp | 2 +- xbmc/TextureCacheJob.cpp | 12 +++---- xbmc/dialogs/GUIDialogContextMenu.cpp | 6 ++-- xbmc/dialogs/GUIDialogContextMenu.h | 6 ++-- xbmc/filesystem/test/TestFileFactory.cpp | 8 ++--- xbmc/guilib/GUIFont.cpp | 4 +-- xbmc/guilib/GUILabel.h | 4 +-- xbmc/guilib/GUIMultiSelectText.cpp | 2 +- xbmc/guilib/GUIRSSControl.cpp | 5 ++- xbmc/guilib/GUITexture.cpp | 4 +-- xbmc/guilib/JpegIO.cpp | 1 - xbmc/guilib/Key.cpp | 14 ++++---- xbmc/guilib/Resolution.h | 10 +++--- xbmc/guilib/TextureManager.cpp | 3 +- xbmc/music/MusicDatabase.cpp | 10 +++--- xbmc/music/infoscanner/MusicAlbumInfo.cpp | 4 +-- xbmc/music/infoscanner/MusicArtistInfo.cpp | 4 +-- xbmc/music/infoscanner/MusicInfoScanner.cpp | 4 +-- xbmc/music/karaoke/karaokelyricscdg.cpp | 2 +- xbmc/music/karaoke/karaokelyricstextkar.cpp | 2 +- xbmc/music/karaoke/karaokelyricstextlrc.cpp | 2 +- xbmc/music/karaoke/karaokelyricstextustar.cpp | 2 +- xbmc/music/tags/TagLoaderTagLib.cpp | 2 +- xbmc/network/cddb.cpp | 4 +-- xbmc/pictures/Picture.cpp | 4 +-- xbmc/profiles/Profile.cpp | 10 +++--- xbmc/pvr/channels/PVRChannelGroup.h | 2 +- xbmc/pvr/channels/PVRChannelGroups.cpp | 4 +-- xbmc/settings/AdvancedSettings.h | 4 +-- 36 files changed, 97 insertions(+), 106 deletions(-) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 95b24a62b0b21..97875a2a9e787 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -3204,7 +3204,7 @@ bool CApplication::ProcessEventServer(float frameTime) } } - if (m_lastAxisMap.size() > 0) + if (!m_lastAxisMap.empty()) { // Process all the stored axis. for (map >::iterator iter = m_lastAxisMap.begin(); iter != m_lastAxisMap.end(); ++iter) diff --git a/xbmc/ApplicationMessenger.cpp b/xbmc/ApplicationMessenger.cpp index 9bb0f33c4513c..344886b51f102 100644 --- a/xbmc/ApplicationMessenger.cpp +++ b/xbmc/ApplicationMessenger.cpp @@ -118,7 +118,7 @@ void CApplicationMessenger::Cleanup() { CSingleLock lock (m_critSection); - while (m_vecMessages.size() > 0) + while (!m_vecMessages.empty()) { ThreadMessage* pMsg = m_vecMessages.front(); @@ -129,7 +129,7 @@ void CApplicationMessenger::Cleanup() m_vecMessages.pop(); } - while (m_vecWindowMessages.size() > 0) + while (!m_vecWindowMessages.empty()) { ThreadMessage* pMsg = m_vecWindowMessages.front(); @@ -203,7 +203,7 @@ void CApplicationMessenger::ProcessMessages() { // process threadmessages CSingleLock lock (m_critSection); - while (m_vecMessages.size() > 0) + while (!m_vecMessages.empty()) { ThreadMessage* pMsg = m_vecMessages.front(); //first remove the message from the queue, else the message could be processed more then once @@ -871,7 +871,7 @@ void CApplicationMessenger::ProcessWindowMessages() { CSingleLock lock (m_critSection); //message type is window, process window messages - while (m_vecWindowMessages.size() > 0) + while (!m_vecWindowMessages.empty()) { ThreadMessage* pMsg = m_vecWindowMessages.front(); //first remove the message from the queue, else the message could be processed more then once diff --git a/xbmc/CueDocument.cpp b/xbmc/CueDocument.cpp index 2d5e27c197ecb..d22d317a294c5 100644 --- a/xbmc/CueDocument.cpp +++ b/xbmc/CueDocument.cpp @@ -69,9 +69,6 @@ using namespace XFILE; CCueDocument::CCueDocument(void) { - m_strArtist = ""; - m_strAlbum = ""; - m_strGenre = ""; m_iYear = 0; m_replayGainAlbumPeak = 0.0f; m_replayGainAlbumGain = 0.0f; @@ -249,7 +246,7 @@ void CCueDocument::GetMediaFiles(vector& mediaFiles) for (int i = 0; i < m_iTotalTracks; i++) uniqueFiles.insert(m_Track[i].strFile); - for (set::iterator it = uniqueFiles.begin(); it != uniqueFiles.end(); it++) + for (set::iterator it = uniqueFiles.begin(); it != uniqueFiles.end(); ++it) mediaFiles.push_back(*it); } diff --git a/xbmc/DynamicDll.cpp b/xbmc/DynamicDll.cpp index 96796eb474711..f81c7d18bdadd 100644 --- a/xbmc/DynamicDll.cpp +++ b/xbmc/DynamicDll.cpp @@ -31,9 +31,9 @@ DllDynamic::DllDynamic() m_DelayUnload=true; } -DllDynamic::DllDynamic(const std::string& strDllName) +DllDynamic::DllDynamic(const std::string& strDllName): + m_strDllName(strDllName) { - m_strDllName=strDllName; m_dll=NULL; m_DelayUnload=true; } diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index 54473d45e7675..be60171a8fad2 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -5662,7 +5662,7 @@ std::string CGUIInfoManager::GetSkinVariableString(int info, bool CGUIInfoManager::ConditionsChangedValues(const std::map& map) { - for (std::map::const_iterator it = map.begin() ; it != map.end() ; it++) + for (std::map::const_iterator it = map.begin() ; it != map.end() ; ++it) { if (it->first->Get() != it->second) return true; diff --git a/xbmc/GUILargeTextureManager.cpp b/xbmc/GUILargeTextureManager.cpp index 0450ffe98743f..4c965a5df4f64 100644 --- a/xbmc/GUILargeTextureManager.cpp +++ b/xbmc/GUILargeTextureManager.cpp @@ -32,9 +32,9 @@ using namespace std; -CImageLoader::CImageLoader(const std::string &path, const bool useCache) +CImageLoader::CImageLoader(const std::string &path, const bool useCache): + m_path(path) { - m_path = path; m_texture = NULL; m_use_cache = useCache; } @@ -78,9 +78,9 @@ bool CImageLoader::DoWork() return true; } -CGUILargeTextureManager::CLargeTexture::CLargeTexture(const std::string &path) +CGUILargeTextureManager::CLargeTexture::CLargeTexture(const std::string &path): + m_path(path) { - m_path = path; m_refCount = 1; m_timeToDelete = 0; } diff --git a/xbmc/LangInfo.cpp b/xbmc/LangInfo.cpp index a88e1646e3d11..26a6834b80085 100644 --- a/xbmc/LangInfo.cpp +++ b/xbmc/LangInfo.cpp @@ -44,28 +44,25 @@ using namespace PVR; #define SPEED_UNIT_STRINGS 20200 -CLangInfo::CRegion::CRegion(const CRegion& region) -{ - m_strName=region.m_strName; - m_forceUnicodeFont=region.m_forceUnicodeFont; - m_strGuiCharSet=region.m_strGuiCharSet; - m_strSubtitleCharSet=region.m_strSubtitleCharSet; - m_strDVDMenuLanguage=region.m_strDVDMenuLanguage; - m_strDVDAudioLanguage=region.m_strDVDAudioLanguage; - m_strDVDSubtitleLanguage=region.m_strDVDSubtitleLanguage; - m_strLangLocaleName = region.m_strLangLocaleName; - m_strLangLocaleCodeTwoChar = region.m_strLangLocaleCodeTwoChar; - m_strRegionLocaleName = region.m_strRegionLocaleName; - - m_strDateFormatShort=region.m_strDateFormatShort; - m_strDateFormatLong=region.m_strDateFormatLong; - m_strTimeFormat=region.m_strTimeFormat; +CLangInfo::CRegion::CRegion(const CRegion& region): + m_strGuiCharSet(region.m_strGuiCharSet), + m_strSubtitleCharSet(region.m_strSubtitleCharSet), + m_strDVDMenuLanguage(region.m_strDVDMenuLanguage), + m_strDVDAudioLanguage(region.m_strDVDAudioLanguage), + m_strDVDSubtitleLanguage(region.m_strDVDSubtitleLanguage), + m_strLangLocaleName(region.m_strLangLocaleName), + m_strLangLocaleCodeTwoChar(region.m_strLangLocaleCodeTwoChar), + m_strRegionLocaleName(region.m_strRegionLocaleName), + m_strName(region.m_strName), + m_strDateFormatLong(region.m_strDateFormatLong), + m_strDateFormatShort(region.m_strDateFormatShort), + m_strTimeFormat(region.m_strTimeFormat), + m_strTimeZone(region.m_strTimeZone) +{ m_strMeridiemSymbols[MERIDIEM_SYMBOL_PM]=region.m_strMeridiemSymbols[MERIDIEM_SYMBOL_PM]; m_strMeridiemSymbols[MERIDIEM_SYMBOL_AM]=region.m_strMeridiemSymbols[MERIDIEM_SYMBOL_AM]; - m_strTimeFormat=region.m_strTimeFormat; m_tempUnit=region.m_tempUnit; m_speedUnit=region.m_speedUnit; - m_strTimeZone = region.m_strTimeZone; } CLangInfo::CRegion::CRegion() diff --git a/xbmc/PartyModeManager.cpp b/xbmc/PartyModeManager.cpp index fe95bf03535e9..de5555d414d24 100644 --- a/xbmc/PartyModeManager.cpp +++ b/xbmc/PartyModeManager.cpp @@ -610,7 +610,7 @@ bool CPartyModeManager::AddInitialSongs(vector > &songIDs) std::string sqlWhereMusic = "songview.idSong IN ("; std::string sqlWhereVideo = "idMVideo IN ("; - for (vector< pair >::iterator it = chosenSongIDs.begin(); it != chosenSongIDs.end(); it++) + for (vector< pair >::iterator it = chosenSongIDs.begin(); it != chosenSongIDs.end(); ++it) { std::string song = StringUtils::Format("%i,", it->second); if (it->first == 1) diff --git a/xbmc/TextureCacheJob.cpp b/xbmc/TextureCacheJob.cpp index a21614d29ccfb..cf111ed07d532 100644 --- a/xbmc/TextureCacheJob.cpp +++ b/xbmc/TextureCacheJob.cpp @@ -37,11 +37,11 @@ #include "cores/omxplayer/OMXImage.h" #endif -CTextureCacheJob::CTextureCacheJob(const std::string &url, const std::string &oldHash) +CTextureCacheJob::CTextureCacheJob(const std::string &url, const std::string &oldHash): + m_url(url), + m_oldHash(oldHash), + m_cachePath(CTextureCache::GetCacheFile(m_url)) { - m_url = url; - m_oldHash = oldHash; - m_cachePath = CTextureCache::GetCacheFile(m_url); } CTextureCacheJob::~CTextureCacheJob() @@ -208,9 +208,9 @@ std::string CTextureCacheJob::GetImageHash(const std::string &url) return ""; } -CTextureDDSJob::CTextureDDSJob(const std::string &original) +CTextureDDSJob::CTextureDDSJob(const std::string &original): + m_original(original) { - m_original = original; } bool CTextureDDSJob::operator==(const CJob* job) const diff --git a/xbmc/dialogs/GUIDialogContextMenu.cpp b/xbmc/dialogs/GUIDialogContextMenu.cpp index fa293f72318c8..9cd77aa4eb8bf 100644 --- a/xbmc/dialogs/GUIDialogContextMenu.cpp +++ b/xbmc/dialogs/GUIDialogContextMenu.cpp @@ -208,7 +208,7 @@ float CGUIDialogContextMenu::GetWidth() const return CGUIDialog::GetWidth(); } -bool CGUIDialogContextMenu::SourcesMenu(const std::string &strType, const CFileItemPtr item, float posX, float posY) +bool CGUIDialogContextMenu::SourcesMenu(const std::string &strType, const CFileItemPtr& item, float posX, float posY) { // TODO: This should be callable even if we don't have any valid items if (!item) @@ -224,7 +224,7 @@ bool CGUIDialogContextMenu::SourcesMenu(const std::string &strType, const CFileI return false; } -void CGUIDialogContextMenu::GetContextButtons(const std::string &type, const CFileItemPtr item, CContextButtons &buttons) +void CGUIDialogContextMenu::GetContextButtons(const std::string &type, const CFileItemPtr& item, CContextButtons &buttons) { // Add buttons to the ContextMenu that should be visible for both sources and autosourced items if (item && item->IsRemovable()) @@ -301,7 +301,7 @@ void CGUIDialogContextMenu::GetContextButtons(const std::string &type, const CFi buttons.Add(CONTEXT_BUTTON_REACTIVATE_LOCK, 12353); } -bool CGUIDialogContextMenu::OnContextButton(const std::string &type, const CFileItemPtr item, CONTEXT_BUTTON button) +bool CGUIDialogContextMenu::OnContextButton(const std::string &type, const CFileItemPtr& item, CONTEXT_BUTTON button) { // Add Source doesn't require a valid share if (button == CONTEXT_BUTTON_ADD_SOURCE) diff --git a/xbmc/dialogs/GUIDialogContextMenu.h b/xbmc/dialogs/GUIDialogContextMenu.h index b96d56743d484..76cf6ca7a6875 100644 --- a/xbmc/dialogs/GUIDialogContextMenu.h +++ b/xbmc/dialogs/GUIDialogContextMenu.h @@ -158,11 +158,11 @@ class CGUIDialogContextMenu : virtual bool OnAction(const CAction& action); virtual void SetPosition(float posX, float posY); - static bool SourcesMenu(const std::string &strType, const CFileItemPtr item, float posX, float posY); + static bool SourcesMenu(const std::string &strType, const CFileItemPtr& item, float posX, float posY); static void SwitchMedia(const std::string& strType, const std::string& strPath); - static void GetContextButtons(const std::string &type, const CFileItemPtr item, CContextButtons &buttons); - static bool OnContextButton(const std::string &type, const CFileItemPtr item, CONTEXT_BUTTON button); + static void GetContextButtons(const std::string &type, const CFileItemPtr& item, CContextButtons &buttons); + static bool OnContextButton(const std::string &type, const CFileItemPtr& item, CONTEXT_BUTTON button); /*! \brief Show the context menu with the given choices \param choices the choices available for the user. diff --git a/xbmc/filesystem/test/TestFileFactory.cpp b/xbmc/filesystem/test/TestFileFactory.cpp index b1619715d85d7..6614fa04377c8 100644 --- a/xbmc/filesystem/test/TestFileFactory.cpp +++ b/xbmc/filesystem/test/TestFileFactory.cpp @@ -39,10 +39,10 @@ class TestFileFactory : public testing::Test CXBMCTestUtils::Instance().getGUISettingsFiles(); std::vector::iterator it; - for (it = guisettings.begin(); it < guisettings.end(); it++) + for (it = guisettings.begin(); it < guisettings.end(); ++it) CSettings::Get().Load(*it); - for (it = advancedsettings.begin(); it < advancedsettings.end(); it++) + for (it = advancedsettings.begin(); it < advancedsettings.end(); ++it) g_advancedSettings.ParseSettingsFile(*it); CSettings::Get().SetLoaded(); @@ -74,7 +74,7 @@ TEST_F(TestFileFactory, Read) CXBMCTestUtils::Instance().getTestFileFactoryReadUrls(); std::vector::iterator it; - for (it = urls.begin(); it < urls.end(); it++) + for (it = urls.begin(); it < urls.end(); ++it) { std::cout << "Testing URL: " << *it << std::endl; ASSERT_TRUE(file.Open(*it)); @@ -128,7 +128,7 @@ TEST_F(TestFileFactory, Write) CXBMCTestUtils::Instance().getTestFileFactoryWriteUrls(); std::vector::iterator it; - for (it = urls.begin(); it < urls.end(); it++) + for (it = urls.begin(); it < urls.end(); ++it) { std::cout << "Testing URL: " << *it << std::endl; std::cout << "Writing..."; diff --git a/xbmc/guilib/GUIFont.cpp b/xbmc/guilib/GUIFont.cpp index 04511bd174842..b7c48f46e0491 100644 --- a/xbmc/guilib/GUIFont.cpp +++ b/xbmc/guilib/GUIFont.cpp @@ -58,9 +58,9 @@ float CScrollInfo::GetPixelsPerFrame() } CGUIFont::CGUIFont(const std::string& strFontName, uint32_t style, color_t textColor, - color_t shadowColor, float lineSpacing, float origHeight, CGUIFontTTFBase *font) + color_t shadowColor, float lineSpacing, float origHeight, CGUIFontTTFBase *font): + m_strFontName(strFontName) { - m_strFontName = strFontName; m_style = style & FONT_STYLE_MASK; m_textColor = textColor; m_shadowColor = shadowColor; diff --git a/xbmc/guilib/GUILabel.h b/xbmc/guilib/GUILabel.h index 0a4faf11d0e49..7ace1fe57c372 100644 --- a/xbmc/guilib/GUILabel.h +++ b/xbmc/guilib/GUILabel.h @@ -33,7 +33,8 @@ class CLabelInfo { public: - CLabelInfo() + CLabelInfo(): + scrollSuffix(" | ") { font = NULL; align = XBFONT_LEFT; @@ -41,7 +42,6 @@ class CLabelInfo width = 0; angle = 0; scrollSpeed = CScrollInfo::defaultSpeed; - scrollSuffix = " | "; }; bool UpdateColors() { diff --git a/xbmc/guilib/GUIMultiSelectText.cpp b/xbmc/guilib/GUIMultiSelectText.cpp index 8a27a0eb8aec8..8be30afdeff17 100644 --- a/xbmc/guilib/GUIMultiSelectText.cpp +++ b/xbmc/guilib/GUIMultiSelectText.cpp @@ -28,9 +28,9 @@ using namespace std; CGUIMultiSelectTextControl::CSelectableString::CSelectableString(CGUIFont *font, const std::string &text, bool selectable, const std::string &clickAction) : m_text(font, false) + , m_clickAction(clickAction) { m_selectable = selectable; - m_clickAction = clickAction; StringUtils::TrimLeft(m_clickAction, " ="); StringUtils::TrimRight(m_clickAction); m_text.Update(text); diff --git a/xbmc/guilib/GUIRSSControl.cpp b/xbmc/guilib/GUIRSSControl.cpp index 76f1789101d18..be906f340f398 100644 --- a/xbmc/guilib/GUIRSSControl.cpp +++ b/xbmc/guilib/GUIRSSControl.cpp @@ -31,14 +31,13 @@ using namespace std; CGUIRSSControl::CGUIRSSControl(int parentID, int controlID, float posX, float posY, float width, float height, const CLabelInfo& labelInfo, const CGUIInfoColor &channelColor, const CGUIInfoColor &headlineColor, std::string& strRSSTags) : CGUIControl(parentID, controlID, posX, posY, width, height), + m_strRSSTags(strRSSTags), m_label(labelInfo), m_channelColor(channelColor), m_headlineColor(headlineColor), m_scrollInfo(0,0,labelInfo.scrollSpeed,""), m_dirty(true) { - m_strRSSTags = strRSSTags; - m_pReader = NULL; m_rtl = false; m_stopped = false; @@ -49,6 +48,7 @@ CGUIRSSControl::CGUIRSSControl(int parentID, int controlID, float posX, float po CGUIRSSControl::CGUIRSSControl(const CGUIRSSControl &from) : CGUIControl(from), m_feed(), + m_strRSSTags(from.m_strRSSTags), m_label(from.m_label), m_channelColor(from.m_channelColor), m_headlineColor(from.m_headlineColor), @@ -57,7 +57,6 @@ CGUIRSSControl::CGUIRSSControl(const CGUIRSSControl &from) m_scrollInfo(from.m_scrollInfo), m_dirty(true) { - m_strRSSTags = from.m_strRSSTags; m_pReader = NULL; m_rtl = from.m_rtl; m_stopped = from.m_stopped; diff --git a/xbmc/guilib/GUITexture.cpp b/xbmc/guilib/GUITexture.cpp index 3d1c4d3dc8d61..ba25ad23185db 100644 --- a/xbmc/guilib/GUITexture.cpp +++ b/xbmc/guilib/GUITexture.cpp @@ -32,11 +32,11 @@ CTextureInfo::CTextureInfo() useLarge = false; } -CTextureInfo::CTextureInfo(const std::string &file) +CTextureInfo::CTextureInfo(const std::string &file): + filename(file) { orientation = 0; useLarge = false; - filename = file; } CTextureInfo& CTextureInfo::operator=(const CTextureInfo &right) diff --git a/xbmc/guilib/JpegIO.cpp b/xbmc/guilib/JpegIO.cpp index 1f22fdb42599e..07ea70ef9a15f 100644 --- a/xbmc/guilib/JpegIO.cpp +++ b/xbmc/guilib/JpegIO.cpp @@ -235,7 +235,6 @@ CJpegIO::CJpegIO() m_orientation = 0; m_inputBuffSize = 0; m_inputBuff = NULL; - m_texturePath = ""; memset(&m_cinfo, 0, sizeof(m_cinfo)); m_thumbnailbuffer = NULL; } diff --git a/xbmc/guilib/Key.cpp b/xbmc/guilib/Key.cpp index de12ba587f5c9..cb665e63085df 100644 --- a/xbmc/guilib/Key.cpp +++ b/xbmc/guilib/Key.cpp @@ -185,7 +185,8 @@ CAction::CAction(int actionID, float amount1 /* = 1.0f */, float amount2 /* = 0. m_holdTime = holdTime; } -CAction::CAction(int actionID, unsigned int state, float posX, float posY, float offsetX, float offsetY, const std::string &name) +CAction::CAction(int actionID, unsigned int state, float posX, float posY, float offsetX, float offsetY, const std::string &name): + m_name(name) { m_id = actionID; m_amount[0] = posX; @@ -193,8 +194,7 @@ CAction::CAction(int actionID, unsigned int state, float posX, float posY, float m_amount[2] = offsetX; m_amount[3] = offsetY; for (unsigned int i = 4; i < max_amounts; i++) - m_amount[i] = 0; - m_name = name; + m_amount[i] = 0; m_repeat = 0; m_buttonCode = 0; m_unicode = 0; @@ -212,10 +212,10 @@ CAction::CAction(int actionID, wchar_t unicode) m_holdTime = 0; } -CAction::CAction(int actionID, const std::string &name, const CKey &key) +CAction::CAction(int actionID, const std::string &name, const CKey &key): + m_name(name) { m_id = actionID; - m_name = name; m_amount[0] = 1; // digital button (could change this for repeat acceleration) for (unsigned int i = 1; i < max_amounts; i++) m_amount[i] = 0; @@ -256,10 +256,10 @@ CAction::CAction(int actionID, const std::string &name, const CKey &key) m_amount[0] = key.GetRightThumbX(); } -CAction::CAction(int actionID, const std::string &name) +CAction::CAction(int actionID, const std::string &name): + m_name(name) { m_id = actionID; - m_name = name; for (unsigned int i = 0; i < max_amounts; i++) m_amount[i] = 0; m_repeat = 0; diff --git a/xbmc/guilib/Resolution.h b/xbmc/guilib/Resolution.h index edc4076835c3e..acc7ceb333b58 100644 --- a/xbmc/guilib/Resolution.h +++ b/xbmc/guilib/Resolution.h @@ -99,7 +99,8 @@ struct RESOLUTION_INFO std::string strOutput; std::string strId; public: - RESOLUTION_INFO(int width = 1280, int height = 720, float aspect = 0, const std::string &mode = "") + RESOLUTION_INFO(int width = 1280, int height = 720, float aspect = 0, const std::string &mode = ""): + strMode(mode) { iWidth = width; iHeight = height; @@ -107,7 +108,6 @@ struct RESOLUTION_INFO iScreenWidth = width; iScreenHeight = height; fPixelRatio = aspect ? ((float)width)/height / aspect : 1.0f; - strMode = mode; bFullScreen = true; fRefreshRate = 0; dwFlags = iSubtitles = iScreen = 0; @@ -117,14 +117,16 @@ struct RESOLUTION_INFO return iWidth * fPixelRatio / iHeight; } RESOLUTION_INFO(const RESOLUTION_INFO& res) : - Overscan(res.Overscan) + Overscan(res.Overscan), + strMode(res.strMode), + strOutput(res.strOutput), + strId(res.strId) { bFullScreen = res.bFullScreen; iScreen = res.iScreen; iWidth = res.iWidth; iHeight = res.iHeight; iScreenWidth = res.iScreenWidth; iScreenHeight = res.iScreenHeight; iSubtitles = res.iSubtitles; dwFlags = res.dwFlags; fPixelRatio = res.fPixelRatio; fRefreshRate = res.fRefreshRate; - strMode = res.strMode; strOutput = res.strOutput; strId = res.strId; iBlanking = res.iBlanking; } }; diff --git a/xbmc/guilib/TextureManager.cpp b/xbmc/guilib/TextureManager.cpp index 794b37b632043..d384aec91357e 100644 --- a/xbmc/guilib/TextureManager.cpp +++ b/xbmc/guilib/TextureManager.cpp @@ -129,15 +129,14 @@ void CTextureArray::Free() CTextureMap::CTextureMap() { - m_textureName = ""; m_referenceCount = 0; m_memUsage = 0; } CTextureMap::CTextureMap(const std::string& textureName, int width, int height, int loops) : m_texture(width, height, loops) +, m_textureName(textureName) { - m_textureName = textureName; m_referenceCount = 0; m_memUsage = 0; } diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp index 3b7426ea07b13..0647eafcf3ead 100644 --- a/xbmc/music/MusicDatabase.cpp +++ b/xbmc/music/MusicDatabase.cpp @@ -2796,7 +2796,7 @@ void CMusicDatabase::DeleteCDDBInfo() std::string strSelectedAlbum = pDlg->GetSelectedLabelText(); map::iterator it; - for (it = mapCDDBIds.begin();it != mapCDDBIds.end();it++) + for (it = mapCDDBIds.begin();it != mapCDDBIds.end();++it) { if (it->second == strSelectedAlbum) { @@ -3225,7 +3225,7 @@ bool CMusicDatabase::GetArtistsByWhere(const std::string& strBaseDir, const Filt // get data from returned rows items.Reserve(results.size()); const dbiplus::query_data &data = m_pDS->get_result_set().records; - for (DatabaseResults::const_iterator it = results.begin(); it != results.end(); it++) + for (DatabaseResults::const_iterator it = results.begin(); it != results.end(); ++it) { unsigned int targetRow = (unsigned int)it->at(FieldRow).asInteger(); const dbiplus::sql_record* const record = data.at(targetRow); @@ -3389,7 +3389,7 @@ bool CMusicDatabase::GetAlbumsByWhere(const std::string &baseDir, const Filter & // get data from returned rows items.Reserve(results.size()); const dbiplus::query_data &data = m_pDS->get_result_set().records; - for (DatabaseResults::const_iterator it = results.begin(); it != results.end(); it++) + for (DatabaseResults::const_iterator it = results.begin(); it != results.end(); ++it) { unsigned int targetRow = (unsigned int)it->at(FieldRow).asInteger(); const dbiplus::sql_record* const record = data.at(targetRow); @@ -3490,7 +3490,7 @@ bool CMusicDatabase::GetSongsByWhere(const std::string &baseDir, const Filter &f items.Reserve(results.size()); const dbiplus::query_data &data = m_pDS->get_result_set().records; int count = 0; - for (DatabaseResults::const_iterator it = results.begin(); it != results.end(); it++) + for (DatabaseResults::const_iterator it = results.begin(); it != results.end(); ++it) { unsigned int targetRow = (unsigned int)it->at(FieldRow).asInteger(); const dbiplus::sql_record* const record = data.at(targetRow); @@ -3819,7 +3819,7 @@ void CMusicDatabase::UpdateTables(int version) } m_pDS->close(); - for (vector::const_iterator it = contentPaths.begin(); it != contentPaths.end(); it++) + for (vector::const_iterator it = contentPaths.begin(); it != contentPaths.end(); ++it) { std::string originalPath = *it; std::string path = CLegacyPathTranslation::TranslateMusicDbPath(originalPath); diff --git a/xbmc/music/infoscanner/MusicAlbumInfo.cpp b/xbmc/music/infoscanner/MusicAlbumInfo.cpp index f9dc7f7a77c9a..90aa8f1c4e75a 100644 --- a/xbmc/music/infoscanner/MusicAlbumInfo.cpp +++ b/xbmc/music/infoscanner/MusicAlbumInfo.cpp @@ -27,9 +27,9 @@ using namespace std; using namespace MUSIC_GRABBER; -CMusicAlbumInfo::CMusicAlbumInfo(const std::string& strAlbumInfo, const CScraperUrl& strAlbumURL) +CMusicAlbumInfo::CMusicAlbumInfo(const std::string& strAlbumInfo, const CScraperUrl& strAlbumURL): + m_strTitle2(strAlbumInfo) { - m_strTitle2 = strAlbumInfo; m_albumURL = strAlbumURL; m_relevance = -1; m_bLoaded = false; diff --git a/xbmc/music/infoscanner/MusicArtistInfo.cpp b/xbmc/music/infoscanner/MusicArtistInfo.cpp index 5e6aba82e403e..dc0936ac59136 100644 --- a/xbmc/music/infoscanner/MusicArtistInfo.cpp +++ b/xbmc/music/infoscanner/MusicArtistInfo.cpp @@ -26,10 +26,10 @@ using namespace std; using namespace XFILE; using namespace MUSIC_GRABBER; -CMusicArtistInfo::CMusicArtistInfo(const std::string& strArtist, const CScraperUrl& strArtistURL) +CMusicArtistInfo::CMusicArtistInfo(const std::string& strArtist, const CScraperUrl& strArtistURL): + m_artistURL(strArtistURL) { m_artist.strArtist = strArtist; - m_artistURL = strArtistURL; m_bLoaded = false; } diff --git a/xbmc/music/infoscanner/MusicInfoScanner.cpp b/xbmc/music/infoscanner/MusicInfoScanner.cpp index 18806a4150b2d..0c1b3051393e1 100644 --- a/xbmc/music/infoscanner/MusicInfoScanner.cpp +++ b/xbmc/music/infoscanner/MusicInfoScanner.cpp @@ -129,7 +129,7 @@ void CMusicInfoScanner::Process() m_needsCleanup = false; bool commit = true; - for (std::set::const_iterator it = m_pathsToScan.begin(); it != m_pathsToScan.end(); it++) + for (std::set::const_iterator it = m_pathsToScan.begin(); it != m_pathsToScan.end(); ++it) { if (!CDirectory::Exists(*it) && !m_bClean) { @@ -804,7 +804,7 @@ int CMusicInfoScanner::RetrieveMusicInfo(const std::string& strDirectory, CFileI for (VECSONGS::iterator song = album->songs.begin(); song != album->songs.end(); - song++) + ++song) { if (m_bStop) break; diff --git a/xbmc/music/karaoke/karaokelyricscdg.cpp b/xbmc/music/karaoke/karaokelyricscdg.cpp index 32122222b89a4..d21aa9424e259 100644 --- a/xbmc/music/karaoke/karaokelyricscdg.cpp +++ b/xbmc/music/karaoke/karaokelyricscdg.cpp @@ -33,8 +33,8 @@ CKaraokeLyricsCDG::CKaraokeLyricsCDG( const std::string& cdgFile ) : CKaraokeLyrics() + , m_cdgFile(cdgFile) { - m_cdgFile = cdgFile; m_pCdgTexture = 0; m_streamIdx = -1; m_bgAlpha = 0xff000000; diff --git a/xbmc/music/karaoke/karaokelyricstextkar.cpp b/xbmc/music/karaoke/karaokelyricstextkar.cpp index 604f00048e8cb..8d0ed49c8df4d 100644 --- a/xbmc/music/karaoke/karaokelyricstextkar.cpp +++ b/xbmc/music/karaoke/karaokelyricstextkar.cpp @@ -135,8 +135,8 @@ class MidiTimestamp CKaraokeLyricsTextKAR::CKaraokeLyricsTextKAR( const std::string & midiFile ) : CKaraokeLyricsText() + , m_midiFile(midiFile) { - m_midiFile = midiFile; } diff --git a/xbmc/music/karaoke/karaokelyricstextlrc.cpp b/xbmc/music/karaoke/karaokelyricstextlrc.cpp index 3dbb94bdae57b..9ddc09660e868 100644 --- a/xbmc/music/karaoke/karaokelyricstextlrc.cpp +++ b/xbmc/music/karaoke/karaokelyricstextlrc.cpp @@ -47,8 +47,8 @@ typedef struct CKaraokeLyricsTextLRC::CKaraokeLyricsTextLRC( const std::string & lyricsFile ) : CKaraokeLyricsText() + , m_lyricsFile(lyricsFile) { - m_lyricsFile = lyricsFile; } diff --git a/xbmc/music/karaoke/karaokelyricstextustar.cpp b/xbmc/music/karaoke/karaokelyricstextustar.cpp index 58f51292dd22b..15712c66922d0 100644 --- a/xbmc/music/karaoke/karaokelyricstextustar.cpp +++ b/xbmc/music/karaoke/karaokelyricstextustar.cpp @@ -31,8 +31,8 @@ CKaraokeLyricsTextUStar::CKaraokeLyricsTextUStar( const std::string & lyricsFile ) : CKaraokeLyricsText() + , m_lyricsFile(lyricsFile) { - m_lyricsFile = lyricsFile; } diff --git a/xbmc/music/tags/TagLoaderTagLib.cpp b/xbmc/music/tags/TagLoaderTagLib.cpp index b780c23416a04..7058e278be340 100644 --- a/xbmc/music/tags/TagLoaderTagLib.cpp +++ b/xbmc/music/tags/TagLoaderTagLib.cpp @@ -594,7 +594,7 @@ bool CTagLoaderTagLib::ParseXiphComment(Ogg::XiphComment *xiph, EmbeddedArt *art if (pictures[i].data().size()) { string mime = pictures[i].mimeType().toCString(); - if (mime.find("image/") != 0) + if (mime.compare(0, 6, "image/") != 0) continue; TagLib::uint size = pictures[i].data().size(); tag.SetCoverArtInfo(size, mime); diff --git a/xbmc/network/cddb.cpp b/xbmc/network/cddb.cpp index b3e045b6031e8..28af4eaa50ad3 100644 --- a/xbmc/network/cddb.cpp +++ b/xbmc/network/cddb.cpp @@ -54,11 +54,9 @@ using namespace CDDB; //------------------------------------------------------------------------------------------------------------------- Xcddb::Xcddb() : m_cddb_socket(INVALID_SOCKET) + , m_cddb_ip_adress(g_advancedSettings.m_cddbAddress) { m_lastError = 0; - m_cddb_ip_adress = g_advancedSettings.m_cddbAddress; - cCacheDir = ""; - m_strNull = ""; } //------------------------------------------------------------------------------------------------------------------- diff --git a/xbmc/pictures/Picture.cpp b/xbmc/pictures/Picture.cpp index b98f6ae8c2ce6..b4f97f79fd761 100644 --- a/xbmc/pictures/Picture.cpp +++ b/xbmc/pictures/Picture.cpp @@ -72,13 +72,13 @@ bool CPicture::CreateThumbnailFromSurface(const unsigned char *buffer, int width return ret; } -CThumbnailWriter::CThumbnailWriter(unsigned char* buffer, int width, int height, int stride, const std::string& thumbFile) +CThumbnailWriter::CThumbnailWriter(unsigned char* buffer, int width, int height, int stride, const std::string& thumbFile): + m_thumbFile(thumbFile) { m_buffer = buffer; m_width = width; m_height = height; m_stride = stride; - m_thumbFile = thumbFile; } CThumbnailWriter::~CThumbnailWriter() diff --git a/xbmc/profiles/Profile.cpp b/xbmc/profiles/Profile.cpp index 02d8eabfae090..210612f21d9ea 100644 --- a/xbmc/profiles/Profile.cpp +++ b/xbmc/profiles/Profile.cpp @@ -22,7 +22,8 @@ #include "GUIInfoManager.h" #include "utils/XMLUtils.h" -CProfile::CLock::CLock(LockType type, const std::string &password) +CProfile::CLock::CLock(LockType type, const std::string &password): + code(password) { programs = false; pictures = false; @@ -32,7 +33,6 @@ CProfile::CLock::CLock(LockType type, const std::string &password) settings = LOCK_LEVEL::NONE; addonManager = false; mode = type; - code = password; } void CProfile::CLock::Validate() @@ -44,11 +44,11 @@ void CProfile::CLock::Validate() code = "-"; } -CProfile::CProfile(const std::string &directory, const std::string &name, const int id) +CProfile::CProfile(const std::string &directory, const std::string &name, const int id): + m_directory(directory), + m_name(name) { m_id = id; - m_directory = directory; - m_name = name; m_bDatabases = true; m_bCanWrite = true; m_bSources = true; diff --git a/xbmc/pvr/channels/PVRChannelGroup.h b/xbmc/pvr/channels/PVRChannelGroup.h index 6b96e64d6a0a9..dddd625eac484 100644 --- a/xbmc/pvr/channels/PVRChannelGroup.h +++ b/xbmc/pvr/channels/PVRChannelGroup.h @@ -551,7 +551,7 @@ namespace PVR class CPVRPersistGroupJob : public CJob { public: - CPVRPersistGroupJob(CPVRChannelGroupPtr group) { m_group = group; } + CPVRPersistGroupJob(CPVRChannelGroupPtr group): m_group(group) {} virtual ~CPVRPersistGroupJob() {} const char *GetType() const { return "pvr-channelgroup-persist"; } diff --git a/xbmc/pvr/channels/PVRChannelGroups.cpp b/xbmc/pvr/channels/PVRChannelGroups.cpp index e61a883360a78..436c877c9c7bc 100644 --- a/xbmc/pvr/channels/PVRChannelGroups.cpp +++ b/xbmc/pvr/channels/PVRChannelGroups.cpp @@ -403,7 +403,7 @@ CPVRChannelGroupPtr CPVRChannelGroups::GetPreviousGroup(const CPVRChannelGroup & } // no match return last visible group - for (std::vector::const_reverse_iterator it = m_groups.rbegin(); it != m_groups.rend(); it++) + for (std::vector::const_reverse_iterator it = m_groups.rbegin(); it != m_groups.rend(); ++it) { if (!(*it)->IsHidden()) return *it; @@ -432,7 +432,7 @@ CPVRChannelGroupPtr CPVRChannelGroups::GetNextGroup(const CPVRChannelGroup &grou } // no match return first visible group - for (std::vector::const_iterator it = m_groups.begin(); it != m_groups.end(); it++) + for (std::vector::const_iterator it = m_groups.begin(); it != m_groups.end(); ++it) { if (!(*it)->IsHidden()) return *it; diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h index 365fedeb7f973..dad2c45b28a66 100644 --- a/xbmc/settings/AdvancedSettings.h +++ b/xbmc/settings/AdvancedSettings.h @@ -69,10 +69,10 @@ struct TVShowRegexp bool byDate; std::string regexp; int defaultSeason; - TVShowRegexp(bool d, const std::string& r, int s = 1) + TVShowRegexp(bool d, const std::string& r, int s = 1): + regexp(r) { byDate = d; - regexp = r; defaultSeason = s; } };