diff --git a/PowerEditor/src/MISC/Common/Common.h b/PowerEditor/src/MISC/Common/Common.h index c695eea4..f4e29341 100644 --- a/PowerEditor/src/MISC/Common/Common.h +++ b/PowerEditor/src/MISC/Common/Common.h @@ -96,9 +96,9 @@ bool matchInList(const TCHAR *fileName, const std::vector & patt class WcharMbcsConvertor final { public: - static WcharMbcsConvertor* getInstance() { + static WcharMbcsConvertor& getInstance() { static WcharMbcsConvertor instance; - return &instance; + return instance; } const wchar_t * char2wchar(const char *mbStr, UINT codepage, int lenIn=-1, int *pLenOut=NULL, int *pBytesNotProcessed=NULL); diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp index 9e3ebd38..67572c58 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp @@ -202,12 +202,12 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath) ExternalLangContainer *containers[30]; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); for (int x = 0; x < numLexers; ++x) { GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN); GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN); - const TCHAR *pLexerName = wmc->char2wchar(lexName, CP_ACP); + const TCHAR *pLexerName = wmc.char2wchar(lexName, CP_ACP); if (!nppParams->isExistingExternalLangName(pLexerName) && nppParams->ExternalLangHasRoom()) containers[x] = new ExternalLangContainer(pLexerName, lexDesc); else @@ -253,7 +253,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath) nppParams->getExternalLexerFromXmlTree(pXmlDoc); nppParams->getExternalLexerDoc()->push_back(pXmlDoc); - const char *pDllName = wmc->wchar2char(pluginFilePath, CP_ACP); + const char *pDllName = wmc.wchar2char(pluginFilePath, CP_ACP); ::SendMessage(_nppData._scintillaMainHandle, SCI_LOADLEXERLIBRARY, 0, reinterpret_cast(pDllName)); } diff --git a/PowerEditor/src/MISC/md5/md5Dlgs.cpp b/PowerEditor/src/MISC/md5/md5Dlgs.cpp index 9d2662b8..84cc8d2a 100644 --- a/PowerEditor/src/MISC/md5/md5Dlgs.cpp +++ b/PowerEditor/src/MISC/md5/md5Dlgs.cpp @@ -64,8 +64,8 @@ INT_PTR CALLBACK HashFromFilesDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR { if (_ht == hashType::hash_md5) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const char *path = wmc->wchar2char(it.c_str(), CP_ACP); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const char *path = wmc.wchar2char(it.c_str(), CP_ACP); MD5 md5; char *md5Result = md5.digestFile(path); @@ -76,7 +76,7 @@ INT_PTR CALLBACK HashFromFilesDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR files2check += TEXT("\r\n"); wchar_t* fileName = ::PathFindFileName(it.c_str()); - hashResultStr += wmc->char2wchar(md5Result, CP_ACP); + hashResultStr += wmc.char2wchar(md5Result, CP_ACP); hashResultStr += TEXT(" "); hashResultStr += fileName; hashResultStr += TEXT("\r\n"); @@ -173,8 +173,8 @@ void HashFromTextDlg::generateHash() // So we get the result of UTF8 text (tested with Chinese). wchar_t *text = new wchar_t[len + 1]; ::GetDlgItemText(_hSelf, IDC_HASH_TEXT_EDIT, text, len + 1); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const char *newText = wmc->wchar2char(text, SC_CP_UTF8); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const char *newText = wmc.wchar2char(text, SC_CP_UTF8); if (_ht == hash_md5) { MD5 md5; @@ -212,7 +212,7 @@ void HashFromTextDlg::generateHashPerLine() std::wstring aLine; std::string result; MD5 md5; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); while (std::getline(ss, aLine)) { // getline() detect only '\n' but not "\r\n" under windows @@ -224,7 +224,7 @@ void HashFromTextDlg::generateHashPerLine() result += "\r\n"; else { - const char *newText = wmc->wchar2char(aLine.c_str(), SC_CP_UTF8); + const char *newText = wmc.wchar2char(aLine.c_str(), SC_CP_UTF8); if (_ht == hash_md5) { diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 3e76b2fc..087dc401 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2486,8 +2486,8 @@ void Notepad_plus::addHotSpot() const size_t generic_fontnameLen = 128; TCHAR *generic_fontname = new TCHAR[generic_fontnameLen]; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const wchar_t * fontNameW = wmc->char2wchar(fontNameA, _nativeLangSpeaker.getLangEncoding()); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const wchar_t * fontNameW = wmc.char2wchar(fontNameA, _nativeLangSpeaker.getLangEncoding()); wcscpy_s(generic_fontname, generic_fontnameLen, fontNameW); hotspotStyle._fontName = generic_fontname; diff --git a/PowerEditor/src/Notepad_plus_Window.cpp b/PowerEditor/src/Notepad_plus_Window.cpp index b45f9b0b..e07e2dd1 100644 --- a/PowerEditor/src/Notepad_plus_Window.cpp +++ b/PowerEditor/src/Notepad_plus_Window.cpp @@ -285,8 +285,8 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin if (::PathFileExists(cmdLineParams->_easterEggName.c_str())) { std::string content = getFileContent(cmdLineParams->_easterEggName.c_str()); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - _userQuote = wmc->char2wchar(content.c_str(), SC_CP_UTF8); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + _userQuote = wmc.char2wchar(content.c_str(), SC_CP_UTF8); if (!_userQuote.empty()) { _quoteParams.reset(); diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index dc83ebad..3eadefa8 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -574,8 +574,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa { char *fileNamesA = static_cast(pCopyData->lpData); const CmdLineParamsDTO & cmdLineParams = pNppParam->getCmdLineParams(); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const wchar_t *fileNamesW = wmc->char2wchar(fileNamesA, CP_ACP); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const wchar_t *fileNamesW = wmc.char2wchar(fileNamesA, CP_ACP); loadCommandlineParams(fileNamesW, &cmdLineParams); break; } diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 49b25de1..6180eba3 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -2766,8 +2766,8 @@ void Notepad_plus::command(int id) { char author[maxSelLen+1] = ""; _pEditView->getSelectedText(author, maxSelLen + 1); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const wchar_t * authorW = wmc->char2wchar(author, _nativeLangSpeaker.getLangEncoding()); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const wchar_t * authorW = wmc.char2wchar(author, _nativeLangSpeaker.getLangEncoding()); int iQuote = getQuoteIndexFrom(authorW); if (iQuote == -1) @@ -2803,8 +2803,8 @@ void Notepad_plus::command(int id) const char *authorName = "«J¤µ§^"; HWND hItem = ::GetDlgItem(_aboutDlg.getHSelf(), IDC_AUTHOR_NAME); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const wchar_t *authorNameW = wmc->char2wchar(authorName, NPP_CP_BIG5); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const wchar_t *authorNameW = wmc.char2wchar(authorName, NPP_CP_BIG5); ::SetWindowText(hItem, authorNameW); } } diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 869395f9..761e5585 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -1057,8 +1057,8 @@ bool NppParameters::load() { // Read cloud choice std::string cloudChoiceStr = getFileContent(cloudChoicePath.c_str()); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - std::wstring cloudChoiceStrW = wmc->char2wchar(cloudChoiceStr.c_str(), SC_CP_UTF8); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + std::wstring cloudChoiceStrW = wmc.char2wchar(cloudChoiceStr.c_str(), SC_CP_UTF8); if (not cloudChoiceStrW.empty() and ::PathFileExists(cloudChoiceStrW.c_str())) { @@ -1913,7 +1913,7 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins if (!root) return false; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); TiXmlNodeA *contextMenuRoot = root->FirstChildElement("ScintillaContextMenu"); if (contextMenuRoot) @@ -1927,8 +1927,8 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins generic_string folderName; generic_string displayAs; - folderName = folderNameA?wmc->char2wchar(folderNameA, SC_CP_UTF8):TEXT(""); - displayAs = displayAsA?wmc->char2wchar(displayAsA, SC_CP_UTF8):TEXT(""); + folderName = folderNameA?wmc.char2wchar(folderNameA, SC_CP_UTF8):TEXT(""); + displayAs = displayAsA?wmc.char2wchar(displayAsA, SC_CP_UTF8):TEXT(""); int id; const char *idStr = (childNode->ToElement())->Attribute("id", &id); @@ -1943,8 +1943,8 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins generic_string menuEntryName; generic_string menuItemName; - menuEntryName = menuEntryNameA?wmc->char2wchar(menuEntryNameA, SC_CP_UTF8):TEXT(""); - menuItemName = menuItemNameA?wmc->char2wchar(menuItemNameA, SC_CP_UTF8):TEXT(""); + menuEntryName = menuEntryNameA?wmc.char2wchar(menuEntryNameA, SC_CP_UTF8):TEXT(""); + menuItemName = menuItemNameA?wmc.char2wchar(menuItemNameA, SC_CP_UTF8):TEXT(""); if (not menuEntryName.empty() and not menuItemName.empty()) { @@ -1959,8 +1959,8 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins generic_string pluginName; generic_string pluginCmdName; - pluginName = pluginNameA?wmc->char2wchar(pluginNameA, SC_CP_UTF8):TEXT(""); - pluginCmdName = pluginCmdNameA?wmc->char2wchar(pluginCmdNameA, SC_CP_UTF8):TEXT(""); + pluginName = pluginNameA?wmc.char2wchar(pluginNameA, SC_CP_UTF8):TEXT(""); + pluginCmdName = pluginCmdNameA?wmc.char2wchar(pluginCmdNameA, SC_CP_UTF8):TEXT(""); // if plugin menu existing plls the value of PluginEntryName and PluginCommandItemName are valid if (pluginsMenu && not pluginName.empty() && not pluginCmdName.empty()) @@ -2752,8 +2752,8 @@ void NppParameters::setCloudChoice(const TCHAR *pathChoice) } cloudChoicePath += TEXT("choice"); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - std::string cloudPathA = wmc->wchar2char(pathChoice, SC_CP_UTF8); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + std::string cloudPathA = wmc.wchar2char(pathChoice, SC_CP_UTF8); writeFileContent(cloudChoicePath.c_str(), cloudPathA.c_str()); } @@ -5021,8 +5021,8 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) const TCHAR *charsAddedW = element->Attribute(TEXT("charsAdded")); if (charsAddedW) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - _nppGUI._customWordChars = wmc->wchar2char(charsAddedW, SC_CP_UTF8); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + _nppGUI._customWordChars = wmc.wchar2char(charsAddedW, SC_CP_UTF8); } } else if (!lstrcmp(nm, TEXT("delimiterSelection"))) @@ -5799,8 +5799,8 @@ void NppParameters::createXmlTreeFromGUIParams() TiXmlElement *GUIConfigElement = (newGUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); GUIConfigElement->SetAttribute(TEXT("name"), TEXT("wordCharList")); GUIConfigElement->SetAttribute(TEXT("useDefault"), _nppGUI._isWordCharDefault ? TEXT("yes") : TEXT("no")); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const wchar_t* charsAddStr = wmc->char2wchar(_nppGUI._customWordChars.c_str(), SC_CP_UTF8); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const wchar_t* charsAddStr = wmc.char2wchar(_nppGUI._customWordChars.c_str(), SC_CP_UTF8); GUIConfigElement->SetAttribute(TEXT("charsAdded"), charsAddStr); } diff --git a/PowerEditor/src/ScitillaComponent/Buffer.cpp b/PowerEditor/src/ScitillaComponent/Buffer.cpp index 5c2c76c6..3c65df7e 100644 --- a/PowerEditor/src/ScitillaComponent/Buffer.cpp +++ b/PowerEditor/src/ScitillaComponent/Buffer.cpp @@ -878,7 +878,7 @@ bool FileManager::backupCurrentBuffer() } else { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); int grabSize; for (int i = 0; i < lengthDoc; i += grabSize) { @@ -888,7 +888,7 @@ bool FileManager::backupCurrentBuffer() int newDataLen = 0; int incompleteMultibyteChar = 0; - const char *newData = wmc->encode(SC_CP_UTF8, encoding, buf+i, grabSize, &newDataLen, &incompleteMultibyteChar); + const char *newData = wmc.encode(SC_CP_UTF8, encoding, buf+i, grabSize, &newDataLen, &incompleteMultibyteChar); grabSize -= incompleteMultibyteChar; items_written = UnicodeConvertor.fwrite(newData, newDataLen); } @@ -1003,7 +1003,7 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g } else { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); int grabSize; for (int i = 0; i < lengthDoc; i += grabSize) { @@ -1013,7 +1013,7 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g int newDataLen = 0; int incompleteMultibyteChar = 0; - const char *newData = wmc->encode(SC_CP_UTF8, encoding, buf+i, grabSize, &newDataLen, &incompleteMultibyteChar); + const char *newData = wmc.encode(SC_CP_UTF8, encoding, buf+i, grabSize, &newDataLen, &incompleteMultibyteChar); grabSize -= incompleteMultibyteChar; items_written = UnicodeConvertor.fwrite(newData, newDataLen); } @@ -1309,8 +1309,8 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data, { int id = fileFormat._language - L_EXTERNAL; TCHAR * name = NppParameters::getInstance()->getELCFromIndex(id)._name; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const char *pName = wmc->wchar2char(name, CP_ACP); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const char *pName = wmc.wchar2char(name, CP_ACP); _pscratchTilla->execute(SCI_SETLEXERLANGUAGE, 0, reinterpret_cast(pName)); } @@ -1369,9 +1369,9 @@ bool FileManager::loadFileData(Document doc, const TCHAR * filename, char* data, } else { - WcharMbcsConvertor* wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); int newDataLen = 0; - const char *newData = wmc->encode(fileFormat._encoding, SC_CP_UTF8, data, static_cast(lenFile), &newDataLen, &incompleteMultibyteChar); + const char *newData = wmc.encode(fileFormat._encoding, SC_CP_UTF8, data, static_cast(lenFile), &newDataLen, &incompleteMultibyteChar); _pscratchTilla->execute(SCI_APPENDTEXT, newDataLen, reinterpret_cast(newData)); } diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 1d71ad25..8e038ed0 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -525,7 +525,7 @@ void ScintillaEditView::setSpecialStyle(const Style & styleToSet) if (styleToSet._fontName && lstrcmp(styleToSet._fontName, TEXT("")) != 0) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); if (not _pParameter->isInFontList(styleToSet._fontName)) { @@ -533,7 +533,7 @@ void ScintillaEditView::setSpecialStyle(const Style & styleToSet) } else { - const char * fontNameA = wmc->wchar2char(styleToSet._fontName, CP_UTF8); + const char * fontNameA = wmc.wchar2char(styleToSet._fontName, CP_UTF8); execute(SCI_STYLESETFONT, styleID, reinterpret_cast(fontNameA)); } } @@ -657,8 +657,8 @@ void ScintillaEditView::setXmlLexer(LangType type) execute(SCI_SETLEXER, SCLEX_HTML); const TCHAR *htmlKeyWords_generic =_pParameter->getWordList(L_HTML, LANG_INDEX_INSTR); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const char *htmlKeyWords = wmc->wchar2char(htmlKeyWords_generic, CP_ACP); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const char *htmlKeyWords = wmc.wchar2char(htmlKeyWords_generic, CP_ACP); execute(SCI_SETKEYWORDS, 0, reinterpret_cast(htmlKeyWords?htmlKeyWords:"")); makeStyle(L_HTML); @@ -790,8 +790,8 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName) for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; ++i) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const char * keyWords_char = wmc->wchar2char(userLangContainer->_keywordLists[i], codepage); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const char * keyWords_char = wmc.wchar2char(userLangContainer->_keywordLists[i], codepage); if (globalMappper().setLexerMapper.find(i) != globalMappper().setLexerMapper.end()) { @@ -887,8 +887,8 @@ void ScintillaEditView::setExternalLexer(LangType typeDoc) int id = typeDoc - L_EXTERNAL; TCHAR * name = _pParameter->getELCFromIndex(id)._name; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const char *pName = wmc->wchar2char(name, CP_ACP); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const char *pName = wmc.wchar2char(name, CP_ACP); execute(SCI_SETLEXERLANGUAGE, 0, reinterpret_cast(pName)); @@ -926,8 +926,8 @@ void ScintillaEditView::setCppLexer(LangType langType) { if (doxygenKeyWords) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const char * doxygenKeyWords_char = wmc->wchar2char(doxygenKeyWords, CP_ACP); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const char * doxygenKeyWords_char = wmc.wchar2char(doxygenKeyWords, CP_ACP); execute(SCI_SETKEYWORDS, 2, reinterpret_cast(doxygenKeyWords_char)); } } @@ -975,8 +975,8 @@ void ScintillaEditView::setJsLexer() if (doxygenKeyWords) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const char * doxygenKeyWords_char = wmc->wchar2char(doxygenKeyWords, CP_ACP); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const char * doxygenKeyWords_char = wmc.wchar2char(doxygenKeyWords, CP_ACP); execute(SCI_SETKEYWORDS, 2, reinterpret_cast(doxygenKeyWords_char)); } @@ -1184,47 +1184,47 @@ void ScintillaEditView::setLexer(int lexerID, LangType langType, int whichList) makeStyle(langType, pKwArray); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); if (whichList & LIST_0) { - const char * keyWords_char = wmc->wchar2char(pKwArray[LANG_INDEX_INSTR], CP_ACP); + const char * keyWords_char = wmc.wchar2char(pKwArray[LANG_INDEX_INSTR], CP_ACP); setKeywords(langType, keyWords_char, LANG_INDEX_INSTR); } if (whichList & LIST_1) { - const char * keyWords_char = wmc->wchar2char(pKwArray[LANG_INDEX_INSTR2], CP_ACP); + const char * keyWords_char = wmc.wchar2char(pKwArray[LANG_INDEX_INSTR2], CP_ACP); setKeywords(langType, keyWords_char, LANG_INDEX_INSTR2); } if (whichList & LIST_2) { - const char * keyWords_char = wmc->wchar2char(pKwArray[LANG_INDEX_TYPE], CP_ACP); + const char * keyWords_char = wmc.wchar2char(pKwArray[LANG_INDEX_TYPE], CP_ACP); setKeywords(langType, keyWords_char, LANG_INDEX_TYPE); } if (whichList & LIST_3) { - const char * keyWords_char = wmc->wchar2char(pKwArray[LANG_INDEX_TYPE2], CP_ACP); + const char * keyWords_char = wmc.wchar2char(pKwArray[LANG_INDEX_TYPE2], CP_ACP); setKeywords(langType, keyWords_char, LANG_INDEX_TYPE2); } if (whichList & LIST_4) { - const char * keyWords_char = wmc->wchar2char(pKwArray[LANG_INDEX_TYPE3], CP_ACP); + const char * keyWords_char = wmc.wchar2char(pKwArray[LANG_INDEX_TYPE3], CP_ACP); setKeywords(langType, keyWords_char, LANG_INDEX_TYPE3); } if (whichList & LIST_5) { - const char * keyWords_char = wmc->wchar2char(pKwArray[LANG_INDEX_TYPE4], CP_ACP); + const char * keyWords_char = wmc.wchar2char(pKwArray[LANG_INDEX_TYPE4], CP_ACP); setKeywords(langType, keyWords_char, LANG_INDEX_TYPE4); } if (whichList & LIST_6) { - const char * keyWords_char = wmc->wchar2char(pKwArray[LANG_INDEX_TYPE5], CP_ACP); + const char * keyWords_char = wmc.wchar2char(pKwArray[LANG_INDEX_TYPE5], CP_ACP); setKeywords(langType, keyWords_char, LANG_INDEX_TYPE5); } execute(SCI_SETPROPERTY, reinterpret_cast("fold"), reinterpret_cast("1")); @@ -2132,11 +2132,11 @@ generic_string ScintillaEditView::getGenericTextAsString(size_t start, size_t en void ScintillaEditView::getGenericText(TCHAR *dest, size_t destlen, size_t start, size_t end) const { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); char *destA = new char[end - start + 1]; getText(destA, start, end); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); - const TCHAR *destW = wmc->char2wchar(destA, cp); + const TCHAR *destW = wmc.char2wchar(destA, cp); _tcsncpy_s(dest, destlen, destW, _TRUNCATE); delete [] destA; } @@ -2146,20 +2146,20 @@ void ScintillaEditView::getGenericText(TCHAR *dest, size_t destlen, size_t start void ScintillaEditView::getGenericText(TCHAR *dest, size_t destlen, int start, int end, int *mstart, int *mend) const { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); char *destA = new char[end - start + 1]; getText(destA, start, end); UINT cp = static_cast(execute(SCI_GETCODEPAGE)) ; - const TCHAR *destW = wmc->char2wchar(destA, cp, mstart, mend); + const TCHAR *destW = wmc.char2wchar(destA, cp, mstart, mend); _tcsncpy_s(dest, destlen, destW, _TRUNCATE); delete [] destA; } void ScintillaEditView::insertGenericTextFrom(size_t position, const TCHAR *text2insert) const { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); - const char *text2insertA = wmc->wchar2char(text2insert, cp); + const char *text2insertA = wmc.wchar2char(text2insert, cp); execute(SCI_INSERTTEXT, position, reinterpret_cast(text2insertA)); } @@ -2211,12 +2211,12 @@ char * ScintillaEditView::getWordOnCaretPos(char * txt, int size) TCHAR * ScintillaEditView::getGenericWordOnCaretPos(TCHAR * txt, int size) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); char *txtA = new char[size + 1]; getWordOnCaretPos(txtA, size); - const TCHAR * txtW = wmc->char2wchar(txtA, cp); + const TCHAR * txtW = wmc.char2wchar(txtA, cp); wcscpy_s(txt, size, txtW); delete [] txtA; return txt; @@ -2242,12 +2242,12 @@ char * ScintillaEditView::getSelectedText(char * txt, int size, bool expand) TCHAR * ScintillaEditView::getGenericSelectedText(TCHAR * txt, int size, bool expand) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); char *txtA = new char[size + 1]; getSelectedText(txtA, size, expand); - const TCHAR * txtW = wmc->char2wchar(txtA, cp); + const TCHAR * txtW = wmc.char2wchar(txtA, cp); wcscpy_s(txt, size, txtW); delete [] txtA; return txt; @@ -2257,9 +2257,9 @@ int ScintillaEditView::searchInTarget(const TCHAR * text2Find, size_t lenOfText2 { execute(SCI_SETTARGETRANGE, fromPos, toPos); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); - const char *text2FindA = wmc->wchar2char(text2Find, cp); + const char *text2FindA = wmc.wchar2char(text2Find, cp); size_t text2FindALen = strlen(text2FindA); size_t len = (lenOfText2Find > text2FindALen) ? lenOfText2Find : text2FindALen; return static_cast(execute(SCI_SEARCHINTARGET, len, reinterpret_cast(text2FindA))); @@ -2267,25 +2267,25 @@ int ScintillaEditView::searchInTarget(const TCHAR * text2Find, size_t lenOfText2 void ScintillaEditView::appandGenericText(const TCHAR * text2Append) const { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); - const char *text2AppendA =wmc->wchar2char(text2Append, cp); + const char *text2AppendA =wmc.wchar2char(text2Append, cp); execute(SCI_APPENDTEXT, strlen(text2AppendA), reinterpret_cast(text2AppendA)); } void ScintillaEditView::addGenericText(const TCHAR * text2Append) const { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); - const char *text2AppendA =wmc->wchar2char(text2Append, cp); + const char *text2AppendA =wmc.wchar2char(text2Append, cp); execute(SCI_ADDTEXT, strlen(text2AppendA), reinterpret_cast(text2AppendA)); } void ScintillaEditView::addGenericText(const TCHAR * text2Append, long *mstart, long *mend) const { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); - const char *text2AppendA =wmc->wchar2char(text2Append, cp, mstart, mend); + const char *text2AppendA =wmc.wchar2char(text2Append, cp, mstart, mend); execute(SCI_ADDTEXT, strlen(text2AppendA), reinterpret_cast(text2AppendA)); } @@ -2295,9 +2295,9 @@ int32_t ScintillaEditView::replaceTarget(const TCHAR * str2replace, int fromTarg { execute(SCI_SETTARGETRANGE, fromTargetPos, toTargetPos); } - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); - const char *str2replaceA = wmc->wchar2char(str2replace, cp); + const char *str2replaceA = wmc.wchar2char(str2replace, cp); return static_cast(execute(SCI_REPLACETARGET, static_cast(-1), reinterpret_cast(str2replaceA))); } @@ -2307,25 +2307,25 @@ int ScintillaEditView::replaceTargetRegExMode(const TCHAR * re, int fromTargetPo { execute(SCI_SETTARGETRANGE, fromTargetPos, toTargetPos); } - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); - const char *reA = wmc->wchar2char(re, cp); + const char *reA = wmc.wchar2char(re, cp); return static_cast(execute(SCI_REPLACETARGETRE, static_cast(-1), reinterpret_cast(reA))); } void ScintillaEditView::showAutoComletion(size_t lenEntered, const TCHAR* list) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); - const char *listA = wmc->wchar2char(list, cp); + const char *listA = wmc.wchar2char(list, cp); execute(SCI_AUTOCSHOW, lenEntered, reinterpret_cast(listA)); } void ScintillaEditView::showCallTip(int startPos, const TCHAR * def) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); - const char *defA = wmc->wchar2char(def, cp); + const char *defA = wmc.wchar2char(def, cp); execute(SCI_CALLTIPSHOW, startPos, reinterpret_cast(defA)); } @@ -2345,14 +2345,14 @@ void ScintillaEditView::getLine(size_t lineNumber, TCHAR * line, int lineBufferL if (lineLen >= lineBufferLen) return; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); char *lineA = new char[lineBufferLen]; // From Scintilla documentation for SCI_GETLINE: "The buffer is not terminated by a 0 character." memset(lineA, 0x0, sizeof(char) * lineBufferLen); execute(SCI_GETLINE, lineNumber, reinterpret_cast(lineA)); - const TCHAR *lineW = wmc->char2wchar(lineA, cp); + const TCHAR *lineW = wmc.char2wchar(lineA, cp); lstrcpyn(line, lineW, lineBufferLen); delete [] lineA; } @@ -2626,8 +2626,8 @@ const char * ScintillaEditView::getCompleteKeywordList(std::basic_string & kwl += " "; const TCHAR *defKwl_generic = _pParameter->getWordList(langType, keywordIndex); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const char * defKwl = wmc->wchar2char(defKwl_generic, CP_ACP); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const char * defKwl = wmc.wchar2char(defKwl_generic, CP_ACP); kwl += defKwl?defKwl:""; return kwl.c_str(); @@ -3009,9 +3009,9 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, const TCHAR *str) execute(SCI_SETTARGETRANGE, cmi[i]._selLpos, cmi[i]._selRpos); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); - const char *strA = wmc->wchar2char(str, cp); + const char *strA = wmc.wchar2char(str, cp); execute(SCI_REPLACETARGET, static_cast(-1), reinterpret_cast(strA)); if (hasVirtualSpc) @@ -3116,9 +3116,9 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, int initial, int in } execute(SCI_SETTARGETRANGE, cmi[i]._selLpos, cmi[i]._selRpos); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(execute(SCI_GETCODEPAGE)); - const char *strA = wmc->wchar2char(str, cp); + const char *strA = wmc.wchar2char(str, cp); execute(SCI_REPLACETARGET, static_cast(-1), reinterpret_cast(strA)); if (hasVirtualSpc) diff --git a/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp b/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp index d22d4d30..e7d4b7d9 100644 --- a/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp +++ b/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp @@ -165,9 +165,9 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView, Scintil char * text2Find = new char[textlen]; pHighlightView->getSelectedText(text2Find, textlen, false); //do not expand selection (false) - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); UINT cp = static_cast(pHighlightView->execute(SCI_GETCODEPAGE)); - const TCHAR * text2FindW = wmc->char2wchar(text2Find, cp); + const TCHAR * text2FindW = wmc.char2wchar(text2Find, cp); highlightViewWithWord(pHighlightView, text2FindW); diff --git a/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp b/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp index 7e9bca8e..701ccd55 100644 --- a/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp +++ b/PowerEditor/src/WinControls/AboutDlg/AboutDlg.cpp @@ -43,10 +43,10 @@ INT_PTR CALLBACK AboutDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara HWND compileDateHandle = ::GetDlgItem(_hSelf, IDC_BUILD_DATETIME); generic_string buildTime = TEXT("Build time : "); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - buildTime += wmc->char2wchar(__DATE__, CP_ACP); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + buildTime += wmc.char2wchar(__DATE__, CP_ACP); buildTime += TEXT(" - "); - buildTime += wmc->char2wchar(__TIME__, CP_ACP); + buildTime += wmc.char2wchar(__TIME__, CP_ACP); NppParameters *pNppParam = NppParameters::getInstance(); LPCTSTR bitness = pNppParam ->isx64() ? TEXT("(64-bit)") : TEXT("(32-bit)"); @@ -136,10 +136,10 @@ INT_PTR CALLBACK DebugInfoDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM / // Build time _debugInfoStr += TEXT("Build time : "); generic_string buildTime; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - buildTime += wmc->char2wchar(__DATE__, CP_ACP); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + buildTime += wmc.char2wchar(__DATE__, CP_ACP); buildTime += TEXT(" - "); - buildTime += wmc->char2wchar(__TIME__, CP_ACP); + buildTime += wmc.char2wchar(__TIME__, CP_ACP); _debugInfoStr += buildTime; _debugInfoStr += TEXT("\r\n"); diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp index 6f31a660..9563856c 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp @@ -259,18 +259,18 @@ bool FunctionListPanel::serialize(const generic_string & outputFilename) const char* leavesLabel = "leaves"; const char* nameLabel = "name"; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); json j; - j[rootLabel] = wmc->wchar2char(fileNameLabel, CP_ACP); + j[rootLabel] = wmc.wchar2char(fileNameLabel, CP_ACP); for (const auto & info : _foundFuncInfos) { - std::string leafName = wmc->wchar2char(info._data.c_str(), CP_ACP); + std::string leafName = wmc.wchar2char(info._data.c_str(), CP_ACP); if (!info._data2.empty()) // node { bool isFound = false; - std::string nodeName = wmc->wchar2char(info._data2.c_str(), CP_ACP); + std::string nodeName = wmc.wchar2char(info._data2.c_str(), CP_ACP); for (auto & i : j[nodesLabel]) { diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp index 5de72640..171e532e 100644 --- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp +++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp @@ -631,7 +631,7 @@ bool loadFromJson(PluginViewList & pl, const json& j) if (j.empty()) return false; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); json jArray = j["npp-plugins"]; if (jArray.empty() || jArray.type() != json::value_t::array) @@ -644,29 +644,29 @@ bool loadFromJson(PluginViewList & pl, const json& j) PluginUpdateInfo* pi = new PluginUpdateInfo(); string valStr = i.at("folder-name").get(); - pi->_folderName = wmc->char2wchar(valStr.c_str(), CP_ACP); + pi->_folderName = wmc.char2wchar(valStr.c_str(), CP_ACP); valStr = i.at("display-name").get(); - pi->_displayName = wmc->char2wchar(valStr.c_str(), CP_ACP); + pi->_displayName = wmc.char2wchar(valStr.c_str(), CP_ACP); valStr = i.at("author").get(); - pi->_author = wmc->char2wchar(valStr.c_str(), CP_ACP); + pi->_author = wmc.char2wchar(valStr.c_str(), CP_ACP); valStr = i.at("description").get(); - pi->_description = wmc->char2wchar(valStr.c_str(), CP_ACP); + pi->_description = wmc.char2wchar(valStr.c_str(), CP_ACP); valStr = i.at("id").get(); - pi->_id = wmc->char2wchar(valStr.c_str(), CP_ACP); + pi->_id = wmc.char2wchar(valStr.c_str(), CP_ACP); valStr = i.at("version").get(); generic_string newValStr(valStr.begin(), valStr.end()); pi->_version = Version(newValStr); valStr = i.at("repository").get(); - pi->_repository = wmc->char2wchar(valStr.c_str(), CP_ACP); + pi->_repository = wmc.char2wchar(valStr.c_str(), CP_ACP); valStr = i.at("homepage").get(); - pi->_homepage = wmc->char2wchar(valStr.c_str(), CP_ACP); + pi->_homepage = wmc.char2wchar(valStr.c_str(), CP_ACP); pl.pushBack(pi); diff --git a/PowerEditor/src/localization.cpp b/PowerEditor/src/localization.cpp index 4b7ed2b8..31b0a429 100644 --- a/PowerEditor/src/localization.cpp +++ b/PowerEditor/src/localization.cpp @@ -154,7 +154,7 @@ generic_string NativeLangSpeaker::getSpecialMenuEntryName(const char *entryName) TiXmlNodeA *entriesRoot = mainMenu->FirstChild("Entries"); if (!entriesRoot) return TEXT(""); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); for (TiXmlNodeA *childNode = entriesRoot->FirstChildElement("Item"); childNode ; @@ -168,7 +168,7 @@ generic_string NativeLangSpeaker::getSpecialMenuEntryName(const char *entryName) const char *name = element->Attribute("name"); if (!strcmp(idName, entryName)) { - return wmc->char2wchar(name, _nativeLangEncoding); + return wmc.char2wchar(name, _nativeLangEncoding); } } } @@ -189,7 +189,7 @@ generic_string NativeLangSpeaker::getNativeLangMenuString(int itemID) const node = node->FirstChild("Commands"); if (!node) return TEXT(""); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); for (TiXmlNodeA *childNode = node->FirstChildElement("Item"); childNode ; @@ -202,7 +202,7 @@ generic_string NativeLangSpeaker::getNativeLangMenuString(int itemID) const const char *name = element->Attribute("name"); if (name) { - return wmc->char2wchar(name, _nativeLangEncoding); + return wmc.char2wchar(name, _nativeLangEncoding); } } } @@ -228,8 +228,8 @@ generic_string NativeLangSpeaker::getLocalizedStrFromID(const char *strID, const const char *value = element->Attribute("value"); if (not value) return defaultString; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - return wmc->char2wchar(value, _nativeLangEncoding); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + return wmc.char2wchar(value, _nativeLangEncoding); } @@ -265,7 +265,7 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin return; const char* idName = nullptr; - WcharMbcsConvertor* wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); for (TiXmlNodeA *childNode = entriesRoot->FirstChildElement("Item"); childNode ; @@ -279,7 +279,7 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin if (menuPos._x != -1) { const char *name = element->Attribute("name"); - const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding); ::ModifyMenu(menuHandle, menuPos._x, MF_BYPOSITION, 0, nameW); } } @@ -291,12 +291,12 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin const char *name = element->Attribute("name"); if (!strcmp(idName, "Plugins")) { - const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding); pluginsTrans = nameW; } else if (!strcmp(idName, "Window")) { - const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding); windowTrans = nameW; } } @@ -313,7 +313,7 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin element->Attribute("id", &id); const char *name = element->Attribute("name"); - const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding); ::ModifyMenu(menuHandle, id, MF_BYCOMMAND, id, nameW); } @@ -358,7 +358,7 @@ void NativeLangSpeaker::changeMenuLang(HMENU menuHandle, generic_string & plugin pos = z; } - const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding); ::ModifyMenu(hMenu, pos, MF_BYPOSITION, 0, nameW); } } @@ -407,7 +407,7 @@ void NativeLangSpeaker::changeLangTabContextMenu(HMENU hCM) tabBarMenu = tabBarMenu->FirstChild("TabBar"); if (tabBarMenu) { - WcharMbcsConvertor* wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); int nbCMItems = sizeof(tabContextMenuItemPos)/sizeof(int); for (TiXmlNodeA *childNode = tabBarMenu->FirstChildElement("Item"); @@ -424,7 +424,7 @@ void NativeLangSpeaker::changeLangTabContextMenu(HMENU hCM) const char *pName = element->Attribute("name"); if (pName) { - const wchar_t *pNameW = wmc->char2wchar(pName, _nativeLangEncoding); + const wchar_t *pNameW = wmc.char2wchar(pName, _nativeLangEncoding); int cmdID = ::GetMenuItemID(hCM, pos); ::ModifyMenu(hCM, pos, MF_BYPOSITION, cmdID, pNameW); } @@ -464,16 +464,16 @@ void NativeLangSpeaker::changeLangTabDrapContextMenu(HMENU hCM) } } - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); if (goToViewA && goToViewA[0]) { - const wchar_t *goToViewG = wmc->char2wchar(goToViewA, _nativeLangEncoding); + const wchar_t *goToViewG = wmc.char2wchar(goToViewA, _nativeLangEncoding); int cmdID = ::GetMenuItemID(hCM, POS_GO2VIEW); ::ModifyMenu(hCM, POS_GO2VIEW, MF_BYPOSITION|MF_STRING, cmdID, goToViewG); } if (cloneToViewA && cloneToViewA[0]) { - const wchar_t *cloneToViewG = wmc->char2wchar(cloneToViewA, _nativeLangEncoding); + const wchar_t *cloneToViewG = wmc.char2wchar(cloneToViewA, _nativeLangEncoding); int cmdID = ::GetMenuItemID(hCM, POS_CLONE2VIEW); ::ModifyMenu(hCM, POS_CLONE2VIEW, MF_BYPOSITION|MF_STRING, cmdID, cloneToViewG); } @@ -493,14 +493,14 @@ void NativeLangSpeaker::changeConfigLang(HWND hDlg) styleConfDlgNode = styleConfDlgNode->FirstChild("StyleConfig"); if (!styleConfDlgNode) return; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); // Set Title const char *titre = (styleConfDlgNode->ToElement())->Attribute("title"); if ((titre && titre[0]) && hDlg) { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); ::SetWindowText(hDlg, nameW); } for (TiXmlNodeA *childNode = styleConfDlgNode->FirstChildElement("Item"); @@ -516,7 +516,7 @@ void NativeLangSpeaker::changeConfigLang(HWND hDlg) HWND hItem = ::GetDlgItem(hDlg, id); if (hItem) { - const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding); ::SetWindowText(hItem, nameW); } } @@ -536,7 +536,7 @@ void NativeLangSpeaker::changeConfigLang(HWND hDlg) HWND hItem = ::GetDlgItem(hDlg, id); if (hItem) { - const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding); ::SetWindowText(hItem, nameW); } } @@ -557,8 +557,8 @@ void NativeLangSpeaker::changeStyleCtrlsLang(HWND hDlg, int *idArray, const char hItem = ::GetDlgItem(hDlg, idArray[i]); if (hItem) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const wchar_t *nameW = wmc->char2wchar(translatedText[i], _nativeLangEncoding); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const wchar_t *nameW = wmc.char2wchar(translatedText[i], _nativeLangEncoding); ::SetWindowText(hItem, nameW); } } @@ -575,7 +575,7 @@ void NativeLangSpeaker::changeUserDefineLangPopupDlg(HWND hDlg) userDefineDlgNode = userDefineDlgNode->FirstChild("UserDefine"); if (!userDefineDlgNode) return; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); TiXmlNodeA *stylerDialogNode = userDefineDlgNode->FirstChild("StylerDialog"); if (!stylerDialogNode) return; @@ -583,7 +583,7 @@ void NativeLangSpeaker::changeUserDefineLangPopupDlg(HWND hDlg) const char *titre = (stylerDialogNode->ToElement())->Attribute("title"); if (titre &&titre[0]) { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); ::SetWindowText(hDlg, nameW); } for (TiXmlNodeA *childNode = stylerDialogNode->FirstChildElement("Item"); @@ -599,7 +599,7 @@ void NativeLangSpeaker::changeUserDefineLangPopupDlg(HWND hDlg) HWND hItem = ::GetDlgItem(hDlg, id); if (hItem) { - const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding); ::SetWindowText(hItem, nameW); } @@ -619,13 +619,13 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg) HWND hDlg = userDefineDlg->getHSelf(); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); // Set Title const char *titre = (userDefineDlgNode->ToElement())->Attribute("title"); if (titre && titre[0]) { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); ::SetWindowText(hDlg, nameW); } // for each control @@ -650,7 +650,7 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg) HWND hItem = ::GetDlgItem(hDlg, id); if (hItem) { - const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding); ::SetWindowText(hItem, nameW); } } @@ -684,7 +684,7 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg) titre = (node->ToElement())->Attribute("title"); if (titre &&titre[0]) { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); userDefineDlg->setTabName(i, nameW); } for (TiXmlNodeA *childNode = node->FirstChildElement("Item"); @@ -700,7 +700,7 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg) HWND hItem = ::GetDlgItem(hDlgArrary[i], id); if (hItem) { - const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding); ::SetWindowText(hItem, nameW); } } @@ -725,29 +725,29 @@ void NativeLangSpeaker::changeFindReplaceDlgLang(FindReplaceDlg & findReplaceDlg const char *titre3 = (dlgNode->ToElement())->Attribute("titleFindInFiles"); const char *titre4 = (dlgNode->ToElement())->Attribute("titleMark"); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); if (titre1 && titre1[0]) { - basic_string nameW = wmc->char2wchar(titre1, _nativeLangEncoding); + basic_string nameW = wmc.char2wchar(titre1, _nativeLangEncoding); pNppParam->getFindDlgTabTitiles()._find = nameW; findReplaceDlg.changeTabName(FIND_DLG, pNppParam->getFindDlgTabTitiles()._find.c_str()); } if (titre2 && titre2[0]) { - basic_string nameW = wmc->char2wchar(titre2, _nativeLangEncoding); + basic_string nameW = wmc.char2wchar(titre2, _nativeLangEncoding); pNppParam->getFindDlgTabTitiles()._replace = nameW; findReplaceDlg.changeTabName(REPLACE_DLG, pNppParam->getFindDlgTabTitiles()._replace.c_str()); } if (titre3 && titre3[0]) { - basic_string nameW = wmc->char2wchar(titre3, _nativeLangEncoding); + basic_string nameW = wmc.char2wchar(titre3, _nativeLangEncoding); pNppParam->getFindDlgTabTitiles()._findInFiles = nameW; findReplaceDlg.changeTabName(FINDINFILES_DLG, pNppParam->getFindDlgTabTitiles()._findInFiles.c_str()); } if (titre4 && titre4[0]) { - basic_string nameW = wmc->char2wchar(titre4, _nativeLangEncoding); + basic_string nameW = wmc.char2wchar(titre4, _nativeLangEncoding); pNppParam->getFindDlgTabTitiles()._mark = nameW; findReplaceDlg.changeTabName(MARK_DLG, pNppParam->getFindDlgTabTitiles()._mark.c_str()); } @@ -767,7 +767,7 @@ void NativeLangSpeaker::changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdmin dlgNode = searchDlgNode(dlgNode, "PluginsAdminDlg"); if (dlgNode) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); TiXmlNodeA *ColumnPluginNode = dlgNode->FirstChild("ColumnPlugin"); if (ColumnPluginNode) @@ -775,7 +775,7 @@ void NativeLangSpeaker::changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdmin const char *name = (ColumnPluginNode->ToElement())->Attribute("name"); if (name && name[0]) { - basic_string nameW = wmc->char2wchar(name, _nativeLangEncoding); + basic_string nameW = wmc.char2wchar(name, _nativeLangEncoding); pluginsAdminDlg.changeColumnName(COLUMN_PLUGIN, nameW.c_str()); } } @@ -786,7 +786,7 @@ void NativeLangSpeaker::changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdmin const char *name = (ColumnVersionNode->ToElement())->Attribute("name"); if (name && name[0]) { - basic_string nameW = wmc->char2wchar(name, _nativeLangEncoding); + basic_string nameW = wmc.char2wchar(name, _nativeLangEncoding); pluginsAdminDlg.changeColumnName(COLUMN_VERSION, nameW.c_str()); } } @@ -797,17 +797,17 @@ void NativeLangSpeaker::changePluginsAdminDlgLang(PluginsAdminDlg & pluginsAdmin if (titre1 && titre1[0]) { - basic_string nameW = wmc->char2wchar(titre1, _nativeLangEncoding); + basic_string nameW = wmc.char2wchar(titre1, _nativeLangEncoding); pluginsAdminDlg.changeTabName(AVAILABLE_LIST, nameW.c_str()); } if (titre2 && titre2[0]) { - basic_string nameW = wmc->char2wchar(titre2, _nativeLangEncoding); + basic_string nameW = wmc.char2wchar(titre2, _nativeLangEncoding); pluginsAdminDlg.changeTabName(UPDATES_LIST, nameW.c_str()); } if (titre3 && titre3[0]) { - basic_string nameW = wmc->char2wchar(titre3, _nativeLangEncoding); + basic_string nameW = wmc.char2wchar(titre3, _nativeLangEncoding); pluginsAdminDlg.changeTabName(INSTALLED_LIST, nameW.c_str()); } } @@ -822,115 +822,115 @@ void NativeLangSpeaker::changePrefereceDlgLang(PreferenceDlg & preference) auto currentSel = preference.getListSelectedIndex(); changeDlgLang(preference.getHSelf(), "Preference"); - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); const size_t titreMaxSize = 128; char titre[titreMaxSize]; changeDlgLang(preference._barsDlg.getHSelf(), "Global", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("Global"), nameW); } changeDlgLang(preference._marginsDlg.getHSelf(), "Scintillas", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("Scintillas"), nameW); } changeDlgLang(preference._defaultNewDocDlg.getHSelf(), "NewDoc", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("NewDoc"), nameW); } changeDlgLang(preference._defaultDirectoryDlg.getHSelf(), "DefaultDir", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("DefaultDir"), nameW); } changeDlgLang(preference._recentFilesHistoryDlg.getHSelf(), "RecentFilesHistory", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("RecentFilesHistory"), nameW); } changeDlgLang(preference._fileAssocDlg.getHSelf(), "FileAssoc", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("FileAssoc"), nameW); } changeDlgLang(preference._langMenuDlg.getHSelf(), "Language", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("Language"), nameW); } changeDlgLang(preference._highlighting.getHSelf(), "Highlighting", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("Highlighting"), nameW); } changeDlgLang(preference._printSettingsDlg.getHSelf(), "Print", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("Print"), nameW); } changeDlgLang(preference._settingsDlg.getHSelf(), "MISC", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("MISC"), nameW); } changeDlgLang(preference._backupDlg.getHSelf(), "Backup", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("Backup"), nameW); } changeDlgLang(preference._autoCompletionDlg.getHSelf(), "AutoCompletion", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("AutoCompletion"), nameW); } changeDlgLang(preference._multiInstDlg.getHSelf(), "MultiInstance", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("MultiInstance"), nameW); } changeDlgLang(preference._delimiterSettingsDlg.getHSelf(), "Delimiter", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("Delimiter"), nameW); } changeDlgLang(preference._settingsOnCloudDlg.getHSelf(), "Cloud", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("Cloud"), nameW); } changeDlgLang(preference._searchEngineDlg.getHSelf(), "SearchEngine", titre, titreMaxSize); if (titre[0] != '\0') { - const wchar_t *nameW = wmc->char2wchar(titre, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(titre, _nativeLangEncoding); preference.renameDialogTitle(TEXT("SearchEngine"), nameW); } @@ -968,8 +968,8 @@ void NativeLangSpeaker::changeShortcutLang() CommandShortcut & csc = mainshortcuts[index]; if (csc.getID() == (unsigned long)id) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const wchar_t * nameW = wmc->char2wchar(name, _nativeLangEncoding); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const wchar_t * nameW = wmc.char2wchar(name, _nativeLangEncoding); csc.setName(nameW); } } @@ -999,8 +999,8 @@ void NativeLangSpeaker::changeShortcutLang() const char *name = element->Attribute("name"); ScintillaKeyMap & skm = scinshortcuts[index]; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const wchar_t * nameW = wmc->char2wchar(name, _nativeLangEncoding); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + const wchar_t * nameW = wmc.char2wchar(name, _nativeLangEncoding); skm.setName(nameW); } } @@ -1024,8 +1024,8 @@ generic_string NativeLangSpeaker::getShortcutMapperLangStr(const char *nodeName, const char *name = (targetNode->ToElement())->Attribute("name"); if (name && name[0]) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - return wmc->char2wchar(name, _nativeLangEncoding); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + return wmc.char2wchar(name, _nativeLangEncoding); } return defaultStr; @@ -1059,13 +1059,13 @@ bool NativeLangSpeaker::changeDlgLang(HWND hDlg, const char *dlgTagName, char *t dlgNode = searchDlgNode(dlgNode, dlgTagName); if (!dlgNode) return false; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); // Set Title const char *title2set = (dlgNode->ToElement())->Attribute("title"); if ((title2set && title2set[0]) && hDlg) { - const wchar_t *nameW = wmc->char2wchar(title2set, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(title2set, _nativeLangEncoding); ::SetWindowText(hDlg, nameW); if (title && titleMaxSize) @@ -1086,7 +1086,7 @@ bool NativeLangSpeaker::changeDlgLang(HWND hDlg, const char *dlgTagName, char *t HWND hItem = ::GetDlgItem(hDlg, id); if (hItem) { - const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding); ::SetWindowText(hItem, nameW); } } @@ -1111,7 +1111,7 @@ bool NativeLangSpeaker::changeDlgLang(HWND hDlg, const char *dlgTagName, char *t { TiXmlElementA *comBoelement = gChildNode->ToElement(); const char *name = comBoelement->Attribute("name"); - const wchar_t *nameW = wmc->char2wchar(name, _nativeLangEncoding); + const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding); comboElms.push_back(nameW); } } @@ -1151,15 +1151,15 @@ bool NativeLangSpeaker::getMsgBoxLang(const char *msgBoxTagName, generic_string msgBoxNode = searchDlgNode(msgBoxNode, msgBoxTagName); if (!msgBoxNode) return false; - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); // Set Title const char *titre = (msgBoxNode->ToElement())->Attribute("title"); const char *msg = (msgBoxNode->ToElement())->Attribute("message"); if ((titre && titre[0]) && (msg && msg[0])) { - title = wmc->char2wchar(titre, _nativeLangEncoding); - message = wmc->char2wchar(msg, _nativeLangEncoding); + title = wmc.char2wchar(titre, _nativeLangEncoding); + message = wmc.char2wchar(msg, _nativeLangEncoding); return true; } return false; @@ -1193,8 +1193,8 @@ generic_string NativeLangSpeaker::getFileBrowserLangMenuStr(int cmdID, const TCH if (name && name[0]) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - return wmc->char2wchar(name, _nativeLangEncoding); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + return wmc.char2wchar(name, _nativeLangEncoding); } return defaultStr; } @@ -1230,8 +1230,8 @@ generic_string NativeLangSpeaker::getProjectPanelLangMenuStr(const char * nodeNa if (name && name[0]) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - return wmc->char2wchar(name, _nativeLangEncoding); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + return wmc.char2wchar(name, _nativeLangEncoding); } return defaultStr; } @@ -1250,8 +1250,8 @@ generic_string NativeLangSpeaker::getAttrNameStr(const TCHAR *defaultStr, const const char *name = (targetNode->ToElement())->Attribute("name"); if (name && name[0]) { - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - return wmc->char2wchar(name, _nativeLangEncoding); + WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance(); + return wmc.char2wchar(name, _nativeLangEncoding); } return defaultStr; }