• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision28523 (tree)
Time2019-03-12 05:19:24
Authorstefankueng

Log Message

replace std::codecvt_utf8 with calls to MultibyteToWideChar/WideCharToMultibyte since C++17 does not have std::codecvt_utf8 anymore.

Change Summary

Incremental Difference

--- trunk/src/Utils/PersonalDictionary.cpp (revision 28522)
+++ trunk/src/Utils/PersonalDictionary.cpp (revision 28523)
@@ -1,6 +1,6 @@
1-// TortoiseSVN - a Windows shell extension for easy version control
1+// TortoiseSVN - a Windows shell extension for easy version control
22
3-// Copyright (C) 2003-2006, 2008, 2010, 2014, 2016 - TortoiseSVN
3+// Copyright (C) 2003-2006, 2008, 2010, 2014, 2016, 2019 - TortoiseSVN
44
55 // This program is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU General Public License
@@ -22,6 +22,7 @@
2222 #include <codecvt>
2323 #include "PersonalDictionary.h"
2424 #include "PathUtils.h"
25+#include "UnicodeUtils.h"
2526
2627 CPersonalDictionary::CPersonalDictionary(LONG lLanguage /* = 0*/) :
2728 m_bLoaded(false)
@@ -36,7 +37,7 @@
3637 bool CPersonalDictionary::Load()
3738 {
3839 CString sWord;
39- TCHAR line[PDICT_MAX_WORD_LENGTH + 1];
40+ char line[PDICT_MAX_WORD_LENGTH + 1];
4041
4142 if (m_bLoaded)
4243 return true;
@@ -51,9 +52,7 @@
5152 wcscat_s(path, sLang);
5253 wcscat_s(path, L".dic");
5354
54- std::locale ulocale(std::locale(), new std::codecvt_utf8<wchar_t>);
55- std::wifstream File;
56- File.imbue(ulocale);
55+ std::ifstream File;
5756 char filepath[MAX_PATH + 1] = { 0 };
5857 SecureZeroMemory(filepath, sizeof(filepath));
5958 WideCharToMultiByte(CP_ACP, NULL, path, -1, filepath, _countof(filepath)-1, NULL, NULL);
@@ -65,7 +64,7 @@
6564 do
6665 {
6766 File.getline(line, _countof(line));
68- sWord = line;
67+ sWord = CUnicodeUtils::GetUnicode(line);
6968 if (!sWord.IsEmpty())
7069 dict.insert(sWord);
7170 } while (File.gcount() > 0);
@@ -111,9 +110,7 @@
111110 wcscat_s(path, sLang);
112111 wcscat_s(path, L".dic");
113112
114- std::locale ulocale(std::locale(), new std::codecvt_utf8<wchar_t>);
115- std::wofstream File;
116- File.imbue(ulocale);
113+ std::ofstream File;
117114 char filepath[MAX_PATH + 1] = { 0 };
118115 SecureZeroMemory(filepath, sizeof(filepath));
119116 WideCharToMultiByte(CP_ACP, NULL, path, -1, filepath, _countof(filepath)-1, NULL, NULL);
@@ -121,7 +118,7 @@
121118 for (std::set<CString>::iterator it = dict.begin(); it != dict.end(); ++it)
122119 {
123120 if (!it->IsEmpty())
124- File << (LPCTSTR)*it << L"\n";
121+ File << CUnicodeUtils::StdGetUTF8((LPCWSTR)*it).c_str() << "\n";
125122 }
126123 File.close();
127124 return true;
Show on old repository browser