Author: ashaposhnikov
Date: Sat Sep 9 19:43:39 2017
New Revision: 75814
URL:
http://svn.reactos.org/svn/reactos?rev=75814&view=rev
Log:
[RAPPS] CConfigParser cleanup
- removed `static` from strings declaration as pointed out by gadamopoulos
Modified:
branches/GSoC_2017/rapps/reactos/base/applications/rapps/include/misc.h
branches/GSoC_2017/rapps/reactos/base/applications/rapps/misc.cpp
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/include/misc.h
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
==============================================================================
--- branches/GSoC_2017/rapps/reactos/base/applications/rapps/include/misc.h [iso-8859-1]
(original)
+++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/include/misc.h [iso-8859-1]
Sat Sep 9 19:43:39 2017
@@ -25,19 +25,16 @@
// Locale names cache
const static INT m_cchLocaleSize = 5;
- static ATL::CStringW m_szLocaleID;
- static ATL::CStringW m_szCachedINISectionLocale;
- static ATL::CStringW m_szCachedINISectionLocaleNeutral;
+ ATL::CStringW m_szLocaleID;
+ ATL::CStringW m_szCachedINISectionLocale;
+ ATL::CStringW m_szCachedINISectionLocaleNeutral;
const ATL::CStringW szConfigPath;
- static ATL::CStringW GetINIFullPath(const ATL::CStringW& FileName);
- static VOID CacheINILocaleLazy();
+ ATL::CStringW GetINIFullPath(const ATL::CStringW& FileName);
+ VOID CacheINILocale();
public:
- static const ATL::CStringW& GetLocale();
- static INT CConfigParser::GetLocaleSize();
-
CConfigParser(const ATL::CStringW& FileName = "");
UINT GetString(const ATL::CStringW& KeyName, ATL::CStringW& ResultString);
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/misc.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/ap…
==============================================================================
--- branches/GSoC_2017/rapps/reactos/base/applications/rapps/misc.cpp [iso-8859-1]
(original)
+++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/misc.cpp [iso-8859-1] Sat Sep
9 19:43:39 2017
@@ -405,14 +405,10 @@
}
// CConfigParser
-ATL::CStringW CConfigParser::m_szLocaleID;
-ATL::CStringW CConfigParser::m_szCachedINISectionLocale;
-ATL::CStringW CConfigParser::m_szCachedINISectionLocaleNeutral;
CConfigParser::CConfigParser(const ATL::CStringW& FileName) :
szConfigPath(GetINIFullPath(FileName))
{
- // we don't have cached section strings for the current system language, create
them, lazy
- CacheINILocaleLazy();
+ CacheINILocale();
}
ATL::CStringW CConfigParser::GetINIFullPath(const ATL::CStringW& FileName)
@@ -426,32 +422,18 @@
return szBuffer;
}
-VOID CConfigParser::CacheINILocaleLazy()
-{
- if (m_szLocaleID.IsEmpty())
- {
- // TODO: Set default locale if call fails
- // find out what is the current system lang code (e.g. "0a") and append
it to SectionLocale
- GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_ILANGUAGE,
- m_szLocaleID.GetBuffer(m_cchLocaleSize), m_cchLocaleSize);
-
- m_szLocaleID.ReleaseBuffer();
- m_szCachedINISectionLocale = L"Section." + m_szLocaleID;
-
- // turn "Section.0c0a" into "Section.0a", keeping just the
neutral lang part
- m_szCachedINISectionLocaleNeutral = m_szCachedINISectionLocale +
m_szLocaleID.Right(2);
- }
-}
-
-const ATL::CStringW& CConfigParser::GetLocale()
-{
- CacheINILocaleLazy();
- return m_szLocaleID;
-}
-
-INT CConfigParser::GetLocaleSize()
-{
- return m_cchLocaleSize;
+VOID CConfigParser::CacheINILocale()
+{
+ // TODO: Set default locale if call fails
+ // find out what is the current system lang code (e.g. "0a") and append it
to SectionLocale
+ GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_ILANGUAGE,
+ m_szLocaleID.GetBuffer(m_cchLocaleSize), m_cchLocaleSize);
+
+ m_szLocaleID.ReleaseBuffer();
+ m_szCachedINISectionLocale = L"Section." + m_szLocaleID;
+
+ // turn "Section.0c0a" into "Section.0a", keeping just the
neutral lang part
+ m_szCachedINISectionLocaleNeutral = m_szCachedINISectionLocale +
m_szLocaleID.Right(2);
}
UINT CConfigParser::GetString(const ATL::CStringW& KeyName, ATL::CStringW&
ResultString)