aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRechi <Rechi@users.noreply.github.com>2018-06-13 12:32:05 +0200
committerGitHub <noreply@github.com>2018-06-13 12:32:05 +0200
commit641478380147dab6f1dfed730bd031eac6ba0cf0 (patch)
tree870b580c54f2a0171e7c0537566a3a2957e87094
parent14fb994179cdffa5f2b1bcb979f2ca73fde4623a (diff)
parentff93e5855fe00cf311598cc811f43063dd8ada62 (diff)
Merge pull request #14032 from MaxKellermann/mediasource_cleanup
CMediaSource cleanup
-rw-r--r--xbmc/MediaSource.h16
-rw-r--r--xbmc/Util.cpp4
2 files changed, 9 insertions, 11 deletions
diff --git a/xbmc/MediaSource.h b/xbmc/MediaSource.h
index 742398f18e..f6ed201733 100644
--- a/xbmc/MediaSource.h
+++ b/xbmc/MediaSource.h
@@ -29,7 +29,7 @@
\brief Represents a share.
\sa VECMediaSource, IVECSOURCES
*/
-class CMediaSource
+class CMediaSource final
{
public:
enum SourceType
@@ -42,8 +42,6 @@ public:
SOURCE_TYPE_VPATH = 5,
SOURCE_TYPE_REMOVABLE = 6
};
- CMediaSource() { m_iDriveType=SOURCE_TYPE_UNKNOWN; m_iLockMode=LOCK_MODE_EVERYONE; m_iBadPwdCount=0; m_iHasLock=0; m_ignore=false; m_allowSharing=true; };
- virtual ~CMediaSource() = default;
bool operator==(const CMediaSource &right) const;
@@ -69,7 +67,7 @@ public:
- SOURCE_TYPE_REMOTE \n
Network source.
*/
- SourceType m_iDriveType;
+ SourceType m_iDriveType = SOURCE_TYPE_UNKNOWN;
/*!
\brief The type of Lock UI to show when accessing the media source.
@@ -90,16 +88,16 @@ public:
- LOCK_MODE_UNKNOWN \n
Value is unknown or unspecified.
*/
- LockType m_iLockMode;
+ LockType m_iLockMode = LOCK_MODE_EVERYONE;
std::string m_strLockCode; ///< Input code for Lock UI to verify, can be chosen freely.
- int m_iHasLock;
- int m_iBadPwdCount; ///< Number of wrong passwords user has entered since share was last unlocked
+ int m_iHasLock = 0;
+ int m_iBadPwdCount = 0; ///< Number of wrong passwords user has entered since share was last unlocked
std::string m_strThumbnailImage; ///< Path to a thumbnail image for the share, or blank for default
std::vector<std::string> vecPaths;
- bool m_ignore; /// <Do not store in xml
- bool m_allowSharing; /// <Allow browsing of source from UPnP / WebServer
+ bool m_ignore = false; /// <Do not store in xml
+ bool m_allowSharing = true; /// <Allow browsing of source from UPnP / WebServer
};
/*!
diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp
index 6c7238dbea..a6d90bc003 100644
--- a/xbmc/Util.cpp
+++ b/xbmc/Util.cpp
@@ -1196,7 +1196,7 @@ int CUtil::GetMatchingSource(const std::string& strPath1, VECSOURCES& VECSOURCES
// we first test the NAME of a source
for (int i = 0; i < (int)VECSOURCES.size(); ++i)
{
- CMediaSource share = VECSOURCES.at(i);
+ const CMediaSource &share = VECSOURCES[i];
std::string strName = share.strName;
// special cases for dvds
@@ -1234,7 +1234,7 @@ int CUtil::GetMatchingSource(const std::string& strPath1, VECSOURCES& VECSOURCES
size_t iLenPath = strDest.size();
for (int i = 0; i < (int)VECSOURCES.size(); ++i)
{
- CMediaSource share = VECSOURCES.at(i);
+ const CMediaSource &share = VECSOURCES[i];
// does it match a source name?
if (share.strPath.substr(0,8) == "shout://")