Make 1st parameter of CConfig::Write() a reference.

Pointer doesn't make much sense, because File can't be NULL.
This commit is contained in:
Alexey Sokolov
2011-09-07 02:17:42 +07:00
parent 508ca27a4c
commit fa9321ac2d
3 changed files with 8 additions and 8 deletions
+6 -6
View File
@@ -170,22 +170,22 @@ bool CConfig::Parse(CFile& file, CString& sErrorMsg)
return true;
}
void CConfig::Write(CFile *pFile, unsigned int iIndentation) {
void CConfig::Write(CFile& File, unsigned int iIndentation) {
CString sIndentation = CString(iIndentation, '\t');
for (EntryMapIterator it = m_ConfigEntries.begin(); it != m_ConfigEntries.end(); ++it) {
for (VCString::const_iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
pFile->Write(sIndentation + it->first + " = " + *it2 + "\n");
File.Write(sIndentation + it->first + " = " + *it2 + "\n");
}
}
for (SubConfigMapIterator it = m_SubConfigs.begin(); it != m_SubConfigs.end(); ++it) {
for (SubConfig::const_iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) {
pFile->Write("\n");
File.Write("\n");
pFile->Write(sIndentation + "<" + it->first + " " + it2->first + ">\n");
it2->second.m_pSubConfig->Write(pFile, iIndentation + 1);
pFile->Write(sIndentation + "</" + it->first + ">\n");
File.Write(sIndentation + "<" + it->first + " " + it2->first + ">\n");
it2->second.m_pSubConfig->Write(File, iIndentation + 1);
File.Write(sIndentation + "</" + it->first + ">\n");
}
}
}
+1 -1
View File
@@ -134,7 +134,7 @@ public:
}
bool Parse(CFile& file, CString& sErrorMsg);
void Write(CFile *pFile, unsigned int iIndentation = 0);
void Write(CFile& file, unsigned int iIndentation = 0);
private:
EntryMap m_ConfigEntries;
+1 -1
View File
@@ -499,7 +499,7 @@ bool CZNC::WriteConfig() {
config.AddSubConfig("User", it->second->GetUserName(), it->second->ToConfig());
}
config.Write(pFile);
config.Write(*pFile);
// If Sync() fails... well, let's hope nothing important breaks..
pFile->Sync();