mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fixed a problem caused by @include statement added in r219.
This commit is contained in:
parent
6551a62fba
commit
95bec98c87
@ -854,9 +854,10 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, int depth)
|
|||||||
delete [] items;
|
delete [] items;
|
||||||
size *= 2;
|
size *= 2;
|
||||||
items = new WCHAR[size];
|
items = new WCHAR[size];
|
||||||
};
|
}
|
||||||
|
|
||||||
// Read the sections
|
// Read the sections
|
||||||
|
std::list<std::wstring> sections;
|
||||||
WCHAR* pos = items;
|
WCHAR* pos = items;
|
||||||
while(wcslen(pos) > 0)
|
while(wcslen(pos) > 0)
|
||||||
{
|
{
|
||||||
@ -867,6 +868,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, int depth)
|
|||||||
m_Keys[strTmp] = std::vector<std::wstring>();
|
m_Keys[strTmp] = std::vector<std::wstring>();
|
||||||
m_Sections.push_back(pos);
|
m_Sections.push_back(pos);
|
||||||
}
|
}
|
||||||
|
sections.push_back(pos);
|
||||||
pos = pos + wcslen(pos) + 1;
|
pos = pos + wcslen(pos) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -874,19 +876,19 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, int depth)
|
|||||||
int bufferSize = MAX_LINE_LENGTH;
|
int bufferSize = MAX_LINE_LENGTH;
|
||||||
WCHAR* buffer = new WCHAR[bufferSize];
|
WCHAR* buffer = new WCHAR[bufferSize];
|
||||||
|
|
||||||
stdext::hash_map<std::wstring, std::vector<std::wstring> >::const_iterator iter = m_Keys.begin();
|
std::list<std::wstring>::const_iterator iter = sections.begin();
|
||||||
for ( ; iter != m_Keys.end(); ++iter)
|
for ( ; iter != sections.end(); ++iter)
|
||||||
{
|
{
|
||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
items[0] = 0;
|
items[0] = 0;
|
||||||
int res = GetPrivateProfileString((*iter).first.c_str(), NULL, NULL, items, size, iniRead.c_str());
|
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) break; // Fits in the buffer
|
||||||
|
|
||||||
delete [] items;
|
delete [] items;
|
||||||
size *= 2;
|
size *= 2;
|
||||||
items = new WCHAR[size];
|
items = new WCHAR[size];
|
||||||
};
|
}
|
||||||
|
|
||||||
WCHAR* pos = items;
|
WCHAR* pos = items;
|
||||||
while(wcslen(pos) > 0)
|
while(wcslen(pos) > 0)
|
||||||
@ -896,13 +898,13 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, int depth)
|
|||||||
while(true)
|
while(true)
|
||||||
{
|
{
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
int res = GetPrivateProfileString((*iter).first.c_str(), strKey.c_str(), L"", buffer, bufferSize, iniRead.c_str());
|
int res = GetPrivateProfileString((*iter).c_str(), strKey.c_str(), L"", buffer, bufferSize, iniRead.c_str());
|
||||||
if (res < bufferSize - 2) break; // Fits in the buffer
|
if (res < bufferSize - 2) break; // Fits in the buffer
|
||||||
|
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
bufferSize *= 2;
|
bufferSize *= 2;
|
||||||
buffer = new WCHAR[bufferSize];
|
buffer = new WCHAR[bufferSize];
|
||||||
};
|
}
|
||||||
|
|
||||||
if (wcsnicmp(strKey.c_str(), L"@include", 8) == 0)
|
if (wcsnicmp(strKey.c_str(), L"@include", 8) == 0)
|
||||||
{
|
{
|
||||||
@ -917,7 +919,7 @@ void CConfigParser::ReadIniFile(const std::wstring& iniFile, int depth)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetValue((*iter).first, strKey, buffer);
|
SetValue((*iter), strKey, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = pos + wcslen(pos) + 1;
|
pos = pos + wcslen(pos) + 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user