mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fixed an issue that the following sections are ignored if ini-file contains null section "[]".
This commit is contained in:
parent
6eeaa81901
commit
72da30c565
@ -985,6 +985,7 @@ void CConfigParser::ReadIniFile(const std::vector<std::wstring>& iniFileMappings
|
||||
// Get all the sections (i.e. different meters)
|
||||
WCHAR* items = new WCHAR[MAX_LINE_LENGTH];
|
||||
int size = MAX_LINE_LENGTH;
|
||||
WCHAR* epos = NULL;
|
||||
|
||||
// Get all the sections
|
||||
while(true)
|
||||
@ -997,7 +998,11 @@ void CConfigParser::ReadIniFile(const std::vector<std::wstring>& iniFileMappings
|
||||
if (temporary) CSystem::RemoveFile(iniRead);
|
||||
return;
|
||||
}
|
||||
if (res < size - 2) break; // Fits in the buffer
|
||||
if (res < size - 2) // Fits in the buffer
|
||||
{
|
||||
epos = items + res;
|
||||
break;
|
||||
}
|
||||
|
||||
delete [] items;
|
||||
size *= 2;
|
||||
@ -1007,7 +1012,9 @@ void CConfigParser::ReadIniFile(const std::vector<std::wstring>& iniFileMappings
|
||||
// Read the sections
|
||||
std::list<std::wstring> sections;
|
||||
WCHAR* pos = items;
|
||||
while(wcslen(pos) > 0)
|
||||
while (pos < epos)
|
||||
{
|
||||
if (*pos)
|
||||
{
|
||||
std::wstring strTmp(pos);
|
||||
std::transform(strTmp.begin(), strTmp.end(), strTmp.begin(), ::towlower);
|
||||
@ -1017,7 +1024,12 @@ void CConfigParser::ReadIniFile(const std::vector<std::wstring>& iniFileMappings
|
||||
m_Sections.push_back(pos);
|
||||
}
|
||||
sections.push_back(pos);
|
||||
pos = pos + wcslen(pos) + 1;
|
||||
pos += wcslen(pos) + 1;
|
||||
}
|
||||
else // Empty string
|
||||
{
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
|
||||
// Read the keys and values
|
||||
@ -1031,15 +1043,21 @@ void CConfigParser::ReadIniFile(const std::vector<std::wstring>& iniFileMappings
|
||||
{
|
||||
items[0] = 0;
|
||||
int res = GetPrivateProfileString((*iter).c_str(), NULL, NULL, items, size, iniRead.c_str());
|
||||
if (res < size - 2) break; // Fits in the buffer
|
||||
if (res < size - 2) // Fits in the buffer
|
||||
{
|
||||
epos = items + res;
|
||||
break;
|
||||
}
|
||||
|
||||
delete [] items;
|
||||
size *= 2;
|
||||
items = new WCHAR[size];
|
||||
}
|
||||
|
||||
WCHAR* pos = items;
|
||||
while(wcslen(pos) > 0)
|
||||
pos = items;
|
||||
while (pos < epos)
|
||||
{
|
||||
if (*pos)
|
||||
{
|
||||
std::wstring strKey = pos;
|
||||
|
||||
@ -1072,7 +1090,12 @@ void CConfigParser::ReadIniFile(const std::vector<std::wstring>& iniFileMappings
|
||||
SetValue((*iter), strKey, buffer);
|
||||
}
|
||||
|
||||
pos = pos + wcslen(pos) + 1;
|
||||
pos += wcslen(pos) + 1;
|
||||
}
|
||||
else // Empty string
|
||||
{
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete [] buffer;
|
||||
|
Loading…
Reference in New Issue
Block a user