Skip to content
Browse files

Updated AddProfile() to cover off uses of m_vecProfiles.push_back(pro…

…file)

-In response to cleanup comments I've moved some of the code that was repeated around validating and incrementing m_nextIdProfile into AddProfile() and replaced any specific code and calls to m_vecProfiles.push_back(profile) in Settings.cpp to AddProfile()

-Re-did integration testing to ensure changes did not cause any side effects. (New profiles.xml, migration from old, adding/deleting profiles)
  • Loading branch information...
1 parent 927d5d4 commit 1920f489e6ba2f1de270d6e9b1e937389499b53d @Dak0ta Dak0ta committed Jul 28, 2011
Showing with 5 additions and 8 deletions.
  1. +5 −8 xbmc/settings/Settings.cpp
View
13 xbmc/settings/Settings.cpp
@@ -1035,11 +1035,7 @@ void CSettings::LoadProfiles(const CStdString& profilesFile)
{
CProfile profile(defaultDir);
profile.Load(pProfile,GetNextProfileId());
-
- //data integrity check - covers off migration from old profiles.xml and bad data coming in
- m_nextIdProfile = max(m_nextIdProfile, profile.getId() + 1);
-
- m_vecProfiles.push_back(profile);
+ AddProfile(profile);
pProfile = pProfile->NextSiblingElement("profile");
}
}
@@ -1053,8 +1049,7 @@ void CSettings::LoadProfiles(const CStdString& profilesFile)
if (m_vecProfiles.empty())
{ // add the master user
CProfile profile("special://masterprofile/", "Master user",0);
- m_nextIdProfile++;
- m_vecProfiles.push_back(profile);
+ AddProfile(profile);
}
// check the validity of the previous profile index
@@ -1905,7 +1900,9 @@ int CSettings::GetProfileIndex(const CStdString &name) const
void CSettings::AddProfile(const CProfile &profile)
{
- m_nextIdProfile++;
+ //data integrity check - covers off migration from old profiles.xml, incrementing of the m_nextIdProfile,and bad data coming in
+ m_nextIdProfile = max(m_nextIdProfile, profile.getId() + 1);
+
m_vecProfiles.push_back(profile);
}

0 comments on commit 1920f48

Please sign in to comment.
Something went wrong with that request. Please try again.