@@ -1187,7 +1187,7 @@ std::wstring NppParameters::getSpecialFolderLocation(int folderKind)
11871187}
11881188
11891189
1190- std::wstring NppParameters::getSettingsFolder ()
1190+ std::wstring NppParameters::getSettingsFolder () const
11911191{
11921192 if (_isLocal)
11931193 return _nppPath;
@@ -1829,7 +1829,7 @@ bool NppParameters::isExistingExternalLangName(const char* newName) const
18291829}
18301830
18311831
1832- const wchar_t * NppParameters::getUserDefinedLangNameFromExt (wchar_t * ext, wchar_t * fullName) const
1832+ const wchar_t * NppParameters::getUserDefinedLangNameFromExt (const wchar_t * ext, const wchar_t * fullName) const
18331833{
18341834 if ((!ext) || (!ext[0 ]))
18351835 return nullptr ;
@@ -1844,7 +1844,7 @@ const wchar_t* NppParameters::getUserDefinedLangNameFromExt(wchar_t *ext, wchar_
18441844 // Force to use dark mode UDL in dark mode or to use light mode UDL in light mode
18451845 for (size_t j = 0 , len = extVect.size (); j < len; ++j)
18461846 {
1847- if (!_wcsicmp (extVect[j].c_str (), ext) || (wcschr (fullName, ' .' ) && !_wcsicmp (extVect[j].c_str (), fullName)))
1847+ if (!:: _wcsicmp (extVect[j].c_str (), ext) || (std:: wcschr (fullName, L ' .' ) && !:: _wcsicmp (extVect[j].c_str (), fullName)))
18481848 {
18491849 // preserve ext matched UDL
18501850 iMatched = i;
@@ -1869,10 +1869,9 @@ const wchar_t* NppParameters::getUserDefinedLangNameFromExt(wchar_t *ext, wchar_
18691869
18701870int NppParameters::getExternalLangIndexFromName (const wchar_t * externalLangName) const
18711871{
1872- WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance ();
18731872 for (int i = 0 ; i < _nbExternalLang ; ++i)
18741873 {
1875- if (! lstrcmp ( externalLangName, wmc. char2wchar (_externalLangArray[i]->_name . c_str (), CP_ACP) ))
1874+ if (externalLangName == string2wstring (_externalLangArray[i]->_name ))
18761875 return i;
18771876 }
18781877 return -1 ;
@@ -1883,7 +1882,7 @@ const UserLangContainer* NppParameters::getULCFromName(const wchar_t* userLangNa
18831882{
18841883 for (int i = 0 ; i < _nbUserLang ; ++i)
18851884 {
1886- if (lstrcmp ( userLangName, _userLangArray[i]->_name . c_str ()) == 0 )
1885+ if (userLangName == _userLangArray[i]->_name )
18871886 return _userLangArray[i].get ();
18881887 }
18891888
@@ -1894,9 +1893,9 @@ const UserLangContainer* NppParameters::getULCFromName(const wchar_t* userLangNa
18941893
18951894COLORREF NppParameters::getCurLineHilitingColour ()
18961895{
1897- const Style * pStyle = _widgetStyleArray.findByName (L" Current line background colour" );
1896+ const Style* pStyle = _widgetStyleArray.findByName (L" Current line background colour" );
18981897 if (!pStyle)
1899- return COLORREF (-1 );
1898+ return static_cast < COLORREF> (-1 );
19001899 return pStyle->_bgColor ;
19011900}
19021901
@@ -1921,7 +1920,7 @@ static int CALLBACK EnumFontFamExProc(const LOGFONT* lpelfe, const TEXTMETRIC*,
19211920 // Start at the end though, that's the most likely place to find a duplicate
19221921 for (int i = vectSize - 1 ; i >= 0 ; --i)
19231922 {
1924- if (lstrcmp ( strVect[i]. c_str (), lfFaceName) == 0 )
1923+ if (strVect[i] == lfFaceName )
19251924 return 1 ; // we already have seen this typeface, ignore it
19261925 }
19271926
@@ -2480,7 +2479,7 @@ void NppParameters::updateStylesXml(TiXmlElement* rootUser, TiXmlElement* rootMo
24802479 const wchar_t * embeddedBG = embeddedWordsStyle->Attribute (L" bgColor" );
24812480 if (embeddedID)
24822481 {
2483- auto do_embedded_to_dot_js_map = [](std::map <std::wstring, std::map<std::wstring, std::wstring>>&colorid_map, std::wstring dotjs_id, std::wstring emb_id_desired, const wchar_t * embID, const wchar_t * embFG, const wchar_t * embBG) {
2482+ auto do_embedded_to_dot_js_map = [](std::map<std::wstring, std::map<std::wstring, std::wstring>>& colorid_map, const std::wstring& dotjs_id, const std::wstring& emb_id_desired, const wchar_t * embID, const wchar_t * embFG, const wchar_t * embBG) {
24842483 if (emb_id_desired == embID)
24852484 {
24862485 if (embFG)
@@ -3831,7 +3830,7 @@ std::pair<unsigned char, unsigned char> NppParameters::feedUserLang(TiXmlNode *n
38313830 }
38323831
38333832 try {
3834- _userLangArray[_nbUserLang] = std::make_unique<UserLangContainer>(name, ext, isDarkModeTheme, udlVersion ? udlVersion : L" " );
3833+ _userLangArray[_nbUserLang] = std::make_unique<UserLangContainer>(name, ext, udlVersion ? udlVersion : L" " , isDarkModeTheme );
38353834
38363835 ++_nbUserLang;
38373836
@@ -3897,7 +3896,7 @@ bool NppParameters::exportUDLToFile(size_t langIndex2export, const std::wstring&
38973896 if (langIndex2export >= NB_MAX_USER_LANG)
38983897 return false ;
38993898
3900- if (static_cast < int32_t >( langIndex2export) >= _nbUserLang)
3899+ if (langIndex2export >= _nbUserLang)
39013900 return false ;
39023901
39033902 TiXmlDocument *pNewXmlUserLangDoc = new TiXmlDocument (fileName2save);
@@ -3936,7 +3935,7 @@ LangType NppParameters::getLangFromExt(const wchar_t *ext)
39363935 return L_TEXT;
39373936}
39383937
3939- void NppParameters::setCloudChoice (const wchar_t * pathChoice)
3938+ void NppParameters::setCloudChoice (const wchar_t * pathChoice) const
39403939{
39413940 std::wstring cloudChoicePath = getSettingsFolder ();
39423941 cloudChoicePath += L" \\ cloud\\ " ;
@@ -3953,7 +3952,7 @@ void NppParameters::setCloudChoice(const wchar_t *pathChoice)
39533952 writeFileContent (cloudChoicePath.c_str (), cloudPathA.c_str ());
39543953}
39553954
3956- void NppParameters::removeCloudChoice ()
3955+ void NppParameters::removeCloudChoice () const
39573956{
39583957 std::wstring cloudChoicePath = getSettingsFolder ();
39593958
@@ -3973,7 +3972,7 @@ bool NppParameters::isCloudPathChanged() const
39733972 wchar_t c = _initialCloudChoice.at (_initialCloudChoice.size ()-1 );
39743973 if (c == ' \\ ' || c == ' /' )
39753974 {
3976- if (_initialCloudChoice.find (_nppGUI._cloudPath ) == 0 )
3975+ if (_initialCloudChoice.starts_with (_nppGUI._cloudPath ))
39773976 return false ;
39783977 }
39793978 }
@@ -3982,7 +3981,7 @@ bool NppParameters::isCloudPathChanged() const
39823981 wchar_t c = _nppGUI._cloudPath .at (_nppGUI._cloudPath .size () - 1 );
39833982 if (c == ' \\ ' || c == ' /' )
39843983 {
3985- if (_nppGUI._cloudPath .find (_initialCloudChoice) == 0 )
3984+ if (_nppGUI._cloudPath .starts_with (_initialCloudChoice))
39863985 return false ;
39873986 }
39883987 }
@@ -4680,7 +4679,7 @@ void NppParameters::feedUserKeywordList(TiXmlNode *node)
46804679 temp += L" 08" ; if (kwl[5 ] != ' 0' ) temp += kwl[5 ];
46814680
46824681 temp += L" 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23" ;
4683- wcscpy_s ( _userLangArray[_nbUserLang - 1 ]->_keywordLists [SCE_USER_KWLIST_DELIMITERS], temp. c_str ()) ;
4682+ _userLangArray[_nbUserLang - 1 ]->_keywordLists [SCE_USER_KWLIST_DELIMITERS] = temp;
46844683 }
46854684 else if (!lstrcmp (keywordsName, L" Comment" ))
46864685 {
@@ -4691,19 +4690,19 @@ void NppParameters::feedUserKeywordList(TiXmlNode *node)
46914690 size_t pos = 0 ;
46924691
46934692 pos = temp.find (L" 0" );
4694- while (pos != string::npos)
4693+ while (pos != std:: string::npos)
46954694 {
46964695 temp.replace (pos, 2 , L" 00" );
46974696 pos = temp.find (L" 0" , pos+1 );
46984697 }
46994698 pos = temp.find (L" 1" );
4700- while (pos != string::npos)
4699+ while (pos != std:: string::npos)
47014700 {
47024701 temp.replace (pos, 2 , L" 03" );
47034702 pos = temp.find (L" 1" );
47044703 }
47054704 pos = temp.find (L" 2" );
4706- while (pos != string::npos)
4705+ while (pos != std:: string::npos)
47074706 {
47084707 temp.replace (pos, 2 , L" 04" );
47094708 pos = temp.find (L" 2" );
@@ -4713,7 +4712,7 @@ void NppParameters::feedUserKeywordList(TiXmlNode *node)
47134712 if (temp[0 ] == ' ' )
47144713 temp.erase (0 , 1 );
47154714
4716- wcscpy_s ( _userLangArray[_nbUserLang - 1 ]->_keywordLists [SCE_USER_KWLIST_COMMENTS], temp. c_str ()) ;
4715+ _userLangArray[_nbUserLang - 1 ]->_keywordLists [SCE_USER_KWLIST_COMMENTS] = temp;
47174716 }
47184717 else
47194718 {
@@ -4723,11 +4722,11 @@ void NppParameters::feedUserKeywordList(TiXmlNode *node)
47234722 int id = globalMappper ().keywordIdMapper [keywordsName];
47244723 if (wcslen (kwl) < max_char)
47254724 {
4726- wcscpy_s ( _userLangArray[_nbUserLang - 1 ]->_keywordLists [id], kwl) ;
4725+ _userLangArray[_nbUserLang - 1 ]->_keywordLists [id] = kwl;
47274726 }
47284727 else
47294728 {
4730- wcscpy_s ( _userLangArray[_nbUserLang - 1 ]->_keywordLists [id], L" imported string too long, needs to be < max_char(30720)" ) ;
4729+ _userLangArray[_nbUserLang - 1 ]->_keywordLists [id] = L" imported string too long, needs to be < max_char(30720)" ;
47314730 }
47324731 }
47334732 }
@@ -5144,7 +5143,7 @@ bool NppParameters::writeProjectPanelsSettings() const
51445143 TiXmlElement projPanelRootNode{L" ProjectPanels" };
51455144
51465145 // Add 3 Project Panel parameters
5147- for (int32_t i = 0 ; i < 3 ; ++i)
5146+ for (int i = 0 ; i < 3 ; ++i)
51485147 {
51495148 TiXmlElement projPanelNode{L" ProjectPanel" };
51505149 (projPanelNode.ToElement ())->SetAttribute (L" id" , i);
@@ -5240,23 +5239,23 @@ TiXmlNode * NppParameters::getChildElementByAttribute(TiXmlNode *pere, const wch
52405239// 2 restes : L_H, L_USER
52415240LangType NppParameters::getLangIDFromStr (const wchar_t *langName)
52425241{
5243- int lang = static_cast <int32_t >(L_TEXT);
5244- for (; lang < L_EXTERNAL; ++lang)
5242+ int lang = static_cast <int >(L_TEXT);
5243+ for (; lang < static_cast < int >( L_EXTERNAL) ; ++lang)
52455244 {
5246- const wchar_t * name = ScintillaEditView::_langNameInfoArray[lang]._langName ;
5247- if (! lstrcmp (name, langName)) // found lang?
5245+ const wchar_t * name = ScintillaEditView::_langNameInfoArray[lang]._langName ;
5246+ if (std::wcscmp (name, langName) == 0 ) // found lang?
52485247 {
5249- return ( LangType) lang;
5248+ return static_cast < LangType>( lang) ;
52505249 }
52515250 }
52525251
52535252 // Cannot find language, check if its an external one
52545253
5255- LangType l = ( LangType) lang;
5254+ auto l = static_cast < LangType>( lang) ;
52565255 if (l == L_EXTERNAL) // try find external lexer
52575256 {
52585257 int id = NppParameters::getInstance ().getExternalLangIndexFromName (langName);
5259- if (id != -1 ) return ( LangType) (id + L_EXTERNAL);
5258+ if (id != -1 ) return static_cast < LangType> (id + static_cast < int >( L_EXTERNAL) );
52605259 }
52615260
52625261 return L_TEXT;
@@ -8147,7 +8146,7 @@ void NppParameters::createXmlTreeFromGUIParams()
81478146 pStr = (_nppGUI._tabStatus & TAB_ALTICONS) ? L" 1" : L" 0" ;
81488147 GUIConfigElement->SetAttribute (L" iconSetNumber" , pStr);
81498148
8150- GUIConfigElement->SetAttribute (L" tabCompactLabelLen" , static_cast <int32_t >(_nppGUI._tabCompactLabelLen ));
8149+ GUIConfigElement->SetAttribute (L" tabCompactLabelLen" , static_cast <int >(_nppGUI._tabCompactLabelLen ));
81518150 }
81528151
81538152 // <GUIConfig name="ScintillaViewsSplitter">vertical</GUIConfig>
@@ -8321,7 +8320,7 @@ void NppParameters::createXmlTreeFromGUIParams()
83218320 {
83228321 TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild (TiXmlElement (L" GUIConfig" )))->ToElement ();
83238322 GUIConfigElement->SetAttribute (L" name" , L" NewDocDefaultSettings" );
8324- GUIConfigElement->SetAttribute (L" format" , static_cast <int32_t >(_nppGUI._newDocDefaultSettings ._format ));
8323+ GUIConfigElement->SetAttribute (L" format" , static_cast <int >(_nppGUI._newDocDefaultSettings ._format ));
83258324 GUIConfigElement->SetAttribute (L" encoding" , _nppGUI._newDocDefaultSettings ._unicodeMode );
83268325 GUIConfigElement->SetAttribute (L" lang" , _nppGUI._newDocDefaultSettings ._lang );
83278326 GUIConfigElement->SetAttribute (L" codepage" , _nppGUI._newDocDefaultSettings ._codepage );
@@ -8354,7 +8353,7 @@ void NppParameters::createXmlTreeFromGUIParams()
83548353 GUIConfigElement->SetAttribute (L" dir" , _nppGUI._backupDir .c_str ());
83558354
83568355 GUIConfigElement->SetAttribute (L" isSnapshotMode" , _nppGUI._isSnapshotMode ? L" yes" : L" no" );
8357- GUIConfigElement->SetAttribute (L" snapshotBackupTiming" , static_cast <int32_t >(_nppGUI._snapshotBackupTiming ));
8356+ GUIConfigElement->SetAttribute (L" snapshotBackupTiming" , static_cast <int >(_nppGUI._snapshotBackupTiming ));
83588357 }
83598358
83608359 // <GUIConfig name = "TaskList">yes< / GUIConfig>
@@ -8400,7 +8399,7 @@ void NppParameters::createXmlTreeFromGUIParams()
84008399 TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild (TiXmlElement (L" GUIConfig" )))->ToElement ();
84018400 GUIConfigElement->SetAttribute (L" name" , L" auto-completion" );
84028401 GUIConfigElement->SetAttribute (L" autoCAction" , _nppGUI._autocStatus );
8403- GUIConfigElement->SetAttribute (L" triggerFromNbChar" , static_cast <int32_t >(_nppGUI._autocFromLen ));
8402+ GUIConfigElement->SetAttribute (L" triggerFromNbChar" , static_cast <int >(_nppGUI._autocFromLen ));
84048403
84058404 const wchar_t * pStr = _nppGUI._autocIgnoreNumbers ? L" yes" : L" no" ;
84068405 GUIConfigElement->SetAttribute (L" autoCIgnoreNumbers" , pStr);
@@ -9893,13 +9892,12 @@ COLORREF NppParameters::getFindDlgStatusMsgColor(int colourIndex)
98939892
98949893LanguageNameInfo NppParameters::getLangNameInfoFromNameID (const wstring& langNameID)
98959894{
9896- LanguageNameInfo res;
9897- for (const LanguageNameInfo& lnf : ScintillaEditView::_langNameInfoArray)
9895+ for (const auto & lnf : ScintillaEditView::_langNameInfoArray)
98989896 {
98999897 if (lnf._langName == langNameID)
99009898 return lnf;
99019899 }
9902- return res ;
9900+ return LanguageNameInfo{} ;
99039901}
99049902
99059903void NppParameters::buildGupParams (std::wstring& params) const
0 commit comments