Remove ambiguous symbols (part 2)
Replace TEXT("") and _T('') by the L"".
Follow up 94af271be9
Close #15377
pull/15380/head
parent
a68362b48f
commit
0842c991d3
|
@ -34,14 +34,14 @@ using namespace std;
|
||||||
void printInt(int int2print)
|
void printInt(int int2print)
|
||||||
{
|
{
|
||||||
wchar_t str[32];
|
wchar_t str[32];
|
||||||
wsprintf(str, TEXT("%d"), int2print);
|
wsprintf(str, L"%d", int2print);
|
||||||
::MessageBox(NULL, str, TEXT(""), MB_OK);
|
::MessageBox(NULL, str, L"", MB_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void printStr(const wchar_t *str2print)
|
void printStr(const wchar_t *str2print)
|
||||||
{
|
{
|
||||||
::MessageBox(NULL, str2print, TEXT(""), MB_OK);
|
::MessageBox(NULL, str2print, L"", MB_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring commafyInt(size_t n)
|
wstring commafyInt(size_t n)
|
||||||
|
@ -60,7 +60,7 @@ std::string getFileContent(const wchar_t *file2read)
|
||||||
const size_t blockSize = 1024;
|
const size_t blockSize = 1024;
|
||||||
char data[blockSize];
|
char data[blockSize];
|
||||||
std::string wholeFileContent = "";
|
std::string wholeFileContent = "";
|
||||||
FILE *fp = _wfopen(file2read, TEXT("rb"));
|
FILE *fp = _wfopen(file2read, L"rb");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ void writeLog(const wchar_t *logFileName, const char *log2write)
|
||||||
|
|
||||||
SYSTEMTIME currentTime = {};
|
SYSTEMTIME currentTime = {};
|
||||||
::GetLocalTime(¤tTime);
|
::GetLocalTime(¤tTime);
|
||||||
wstring dateTimeStrW = getDateTimeStrFrom(TEXT("yyyy-MM-dd HH:mm:ss"), currentTime);
|
wstring dateTimeStrW = getDateTimeStrFrom(L"yyyy-MM-dd HH:mm:ss", currentTime);
|
||||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||||
std::string log2writeStr = converter.to_bytes(dateTimeStrW);
|
std::string log2writeStr = converter.to_bytes(dateTimeStrW);
|
||||||
log2writeStr += " ";
|
log2writeStr += " ";
|
||||||
|
@ -187,7 +187,7 @@ wstring folderBrowser(HWND parent, const wstring & title, int outputCtrlID, cons
|
||||||
|
|
||||||
wstring getFolderName(HWND parent, const wchar_t *defaultDir)
|
wstring getFolderName(HWND parent, const wchar_t *defaultDir)
|
||||||
{
|
{
|
||||||
return folderBrowser(parent, TEXT("Select a folder"), 0, defaultDir);
|
return folderBrowser(parent, L"Select a folder", 0, defaultDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ bool isInList(const wchar_t *token, const wchar_t *list)
|
||||||
wstring purgeMenuItemString(const wchar_t * menuItemStr, bool keepAmpersand)
|
wstring purgeMenuItemString(const wchar_t * menuItemStr, bool keepAmpersand)
|
||||||
{
|
{
|
||||||
const size_t cleanedNameLen = 64;
|
const size_t cleanedNameLen = 64;
|
||||||
wchar_t cleanedName[cleanedNameLen] = TEXT("");
|
wchar_t cleanedName[cleanedNameLen] = L"";
|
||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
size_t menuNameLen = lstrlen(menuItemStr);
|
size_t menuNameLen = lstrlen(menuItemStr);
|
||||||
if (menuNameLen >= cleanedNameLen)
|
if (menuNameLen >= cleanedNameLen)
|
||||||
|
@ -577,7 +577,7 @@ wstring BuildMenuFileName(int filenameLen, unsigned int pos, const wstring &file
|
||||||
}
|
}
|
||||||
else if (pos == 9)
|
else if (pos == 9)
|
||||||
{
|
{
|
||||||
strTemp.append(TEXT("1&0"));
|
strTemp.append(L"1&0");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -586,7 +586,7 @@ wstring BuildMenuFileName(int filenameLen, unsigned int pos, const wstring &file
|
||||||
strTemp.push_back('&');
|
strTemp.push_back('&');
|
||||||
strTemp.append(uintToString(splitDigits.rem));
|
strTemp.append(uintToString(splitDigits.rem));
|
||||||
}
|
}
|
||||||
strTemp.append(TEXT(": "));
|
strTemp.append(L": ");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -616,7 +616,7 @@ wstring BuildMenuFileName(int filenameLen, unsigned int pos, const wstring &file
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strTemp.append(convertFileName(it, it + MAX_PATH / 2 - 3));
|
strTemp.append(convertFileName(it, it + MAX_PATH / 2 - 3));
|
||||||
strTemp.append(TEXT("..."));
|
strTemp.append(L"...");
|
||||||
strTemp.append(convertFileName(filename.end() - MAX_PATH / 2, filename.end()));
|
strTemp.append(convertFileName(filename.end() - MAX_PATH / 2, filename.end()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -627,17 +627,17 @@ wstring BuildMenuFileName(int filenameLen, unsigned int pos, const wstring &file
|
||||||
|
|
||||||
wstring PathRemoveFileSpec(wstring& path)
|
wstring PathRemoveFileSpec(wstring& path)
|
||||||
{
|
{
|
||||||
wstring::size_type lastBackslash = path.find_last_of(TEXT('\\'));
|
wstring::size_type lastBackslash = path.find_last_of(L'\\');
|
||||||
if (lastBackslash == wstring::npos)
|
if (lastBackslash == wstring::npos)
|
||||||
{
|
{
|
||||||
if (path.size() >= 2 && path[1] == TEXT(':')) // "C:foo.bar" becomes "C:"
|
if (path.size() >= 2 && path[1] == L':') // "C:foo.bar" becomes "C:"
|
||||||
path.erase(2);
|
path.erase(2);
|
||||||
else
|
else
|
||||||
path.erase();
|
path.erase();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (lastBackslash == 2 && path[1] == TEXT(':') && path.size() >= 3) // "C:\foo.exe" becomes "C:\"
|
if (lastBackslash == 2 && path[1] == L':' && path.size() >= 3) // "C:\foo.exe" becomes "C:\"
|
||||||
path.erase(3);
|
path.erase(3);
|
||||||
else if (lastBackslash == 0 && path.size() > 1) // "\foo.exe" becomes "\"
|
else if (lastBackslash == 0 && path.size() > 1) // "\foo.exe" becomes "\"
|
||||||
path.erase(1);
|
path.erase(1);
|
||||||
|
@ -652,7 +652,7 @@ wstring pathAppend(wstring& strDest, const wstring& str2append)
|
||||||
{
|
{
|
||||||
if (strDest.empty() && str2append.empty()) // "" + ""
|
if (strDest.empty() && str2append.empty()) // "" + ""
|
||||||
{
|
{
|
||||||
strDest = TEXT("\\");
|
strDest = L"\\";
|
||||||
return strDest;
|
return strDest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -677,7 +677,7 @@ wstring pathAppend(wstring& strDest, const wstring& str2append)
|
||||||
}
|
}
|
||||||
|
|
||||||
// toto + titi
|
// toto + titi
|
||||||
strDest += TEXT("\\");
|
strDest += L"\\";
|
||||||
strDest += str2append;
|
strDest += str2append;
|
||||||
|
|
||||||
return strDest;
|
return strDest;
|
||||||
|
@ -787,7 +787,7 @@ bool str2numberVector(wstring str2convert, std::vector<size_t>& numVect)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<wstring> v;
|
std::vector<wstring> v;
|
||||||
stringSplit(str2convert, TEXT(" "), v);
|
stringSplit(str2convert, L" ", v);
|
||||||
for (const auto& i : v)
|
for (const auto& i : v)
|
||||||
{
|
{
|
||||||
// Don't treat empty string and the number greater than 9999
|
// Don't treat empty string and the number greater than 9999
|
||||||
|
@ -895,7 +895,7 @@ bool str2Clipboard(const wstring &str2cpy, HWND hwnd)
|
||||||
|
|
||||||
bool buf2Clipboard(const std::vector<Buffer*>& buffers, bool isFullPath, HWND hwnd)
|
bool buf2Clipboard(const std::vector<Buffer*>& buffers, bool isFullPath, HWND hwnd)
|
||||||
{
|
{
|
||||||
const wstring crlf = _T("\r\n");
|
const wstring crlf = L"\r\n";
|
||||||
wstring selection;
|
wstring selection;
|
||||||
for (auto&& buf : buffers)
|
for (auto&& buf : buffers)
|
||||||
{
|
{
|
||||||
|
@ -969,7 +969,7 @@ bool allPatternsAreExclusion(const std::vector<wstring> patterns)
|
||||||
|
|
||||||
wstring GetLastErrorAsString(DWORD errorCode)
|
wstring GetLastErrorAsString(DWORD errorCode)
|
||||||
{
|
{
|
||||||
wstring errorMsg(_T(""));
|
wstring errorMsg(L"");
|
||||||
// Get the error message, if any.
|
// Get the error message, if any.
|
||||||
// If both error codes (passed error n GetLastError) are 0, then return empty
|
// If both error codes (passed error n GetLastError) are 0, then return empty
|
||||||
if (errorCode == 0)
|
if (errorCode == 0)
|
||||||
|
@ -1114,7 +1114,7 @@ bool isCertificateValidated(const wstring & fullFilePath, const wstring & subjec
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
wstring errorMessage = TEXT("Check certificate of ") + fullFilePath + TEXT(" : ");
|
wstring errorMessage = L"Check certificate of " + fullFilePath + L" : ";
|
||||||
errorMessage += GetLastErrorAsString(GetLastError());
|
errorMessage += GetLastErrorAsString(GetLastError());
|
||||||
throw errorMessage;
|
throw errorMessage;
|
||||||
}
|
}
|
||||||
|
@ -1123,7 +1123,7 @@ bool isCertificateValidated(const wstring & fullFilePath, const wstring & subjec
|
||||||
result = CryptMsgGetParam(hMsg, CMSG_SIGNER_INFO_PARAM, 0, NULL, &dwSignerInfo);
|
result = CryptMsgGetParam(hMsg, CMSG_SIGNER_INFO_PARAM, 0, NULL, &dwSignerInfo);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
wstring errorMessage = TEXT("CryptMsgGetParam first call: ");
|
wstring errorMessage = L"CryptMsgGetParam first call: ";
|
||||||
errorMessage += GetLastErrorAsString(GetLastError());
|
errorMessage += GetLastErrorAsString(GetLastError());
|
||||||
throw errorMessage;
|
throw errorMessage;
|
||||||
}
|
}
|
||||||
|
@ -1132,7 +1132,7 @@ bool isCertificateValidated(const wstring & fullFilePath, const wstring & subjec
|
||||||
pSignerInfo = (PCMSG_SIGNER_INFO)LocalAlloc(LPTR, dwSignerInfo);
|
pSignerInfo = (PCMSG_SIGNER_INFO)LocalAlloc(LPTR, dwSignerInfo);
|
||||||
if (!pSignerInfo)
|
if (!pSignerInfo)
|
||||||
{
|
{
|
||||||
wstring errorMessage = TEXT("CryptMsgGetParam memory allocation problem: ");
|
wstring errorMessage = L"CryptMsgGetParam memory allocation problem: ";
|
||||||
errorMessage += GetLastErrorAsString(GetLastError());
|
errorMessage += GetLastErrorAsString(GetLastError());
|
||||||
throw errorMessage;
|
throw errorMessage;
|
||||||
}
|
}
|
||||||
|
@ -1141,7 +1141,7 @@ bool isCertificateValidated(const wstring & fullFilePath, const wstring & subjec
|
||||||
result = CryptMsgGetParam(hMsg, CMSG_SIGNER_INFO_PARAM, 0, (PVOID)pSignerInfo, &dwSignerInfo);
|
result = CryptMsgGetParam(hMsg, CMSG_SIGNER_INFO_PARAM, 0, (PVOID)pSignerInfo, &dwSignerInfo);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
wstring errorMessage = TEXT("CryptMsgGetParam: ");
|
wstring errorMessage = L"CryptMsgGetParam: ";
|
||||||
errorMessage += GetLastErrorAsString(GetLastError());
|
errorMessage += GetLastErrorAsString(GetLastError());
|
||||||
throw errorMessage;
|
throw errorMessage;
|
||||||
}
|
}
|
||||||
|
@ -1154,7 +1154,7 @@ bool isCertificateValidated(const wstring & fullFilePath, const wstring & subjec
|
||||||
pCertContext = CertFindCertificateInStore(hStore, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, CERT_FIND_SUBJECT_CERT, (PVOID)&CertInfo, NULL);
|
pCertContext = CertFindCertificateInStore(hStore, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, CERT_FIND_SUBJECT_CERT, (PVOID)&CertInfo, NULL);
|
||||||
if (!pCertContext)
|
if (!pCertContext)
|
||||||
{
|
{
|
||||||
wstring errorMessage = TEXT("Certificate context: ");
|
wstring errorMessage = L"Certificate context: ";
|
||||||
errorMessage += GetLastErrorAsString(GetLastError());
|
errorMessage += GetLastErrorAsString(GetLastError());
|
||||||
throw errorMessage;
|
throw errorMessage;
|
||||||
}
|
}
|
||||||
|
@ -1165,27 +1165,27 @@ bool isCertificateValidated(const wstring & fullFilePath, const wstring & subjec
|
||||||
dwData = CertGetNameString(pCertContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, NULL, NULL, 0);
|
dwData = CertGetNameString(pCertContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, NULL, NULL, 0);
|
||||||
if (dwData <= 1)
|
if (dwData <= 1)
|
||||||
{
|
{
|
||||||
throw wstring(TEXT("Certificate checking error: getting data size problem."));
|
throw wstring(L"Certificate checking error: getting data size problem.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate memory for subject name.
|
// Allocate memory for subject name.
|
||||||
szName = (LPTSTR)LocalAlloc(LPTR, dwData * sizeof(wchar_t));
|
szName = (LPTSTR)LocalAlloc(LPTR, dwData * sizeof(wchar_t));
|
||||||
if (!szName)
|
if (!szName)
|
||||||
{
|
{
|
||||||
throw wstring(TEXT("Certificate checking error: memory allocation problem."));
|
throw wstring(L"Certificate checking error: memory allocation problem.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get subject name.
|
// Get subject name.
|
||||||
if (CertGetNameString(pCertContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, NULL, szName, dwData) <= 1)
|
if (CertGetNameString(pCertContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, NULL, szName, dwData) <= 1)
|
||||||
{
|
{
|
||||||
throw wstring(TEXT("Cannot get certificate info."));
|
throw wstring(L"Cannot get certificate info.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// check Subject name.
|
// check Subject name.
|
||||||
subjectName = szName;
|
subjectName = szName;
|
||||||
if (subjectName != subjectName2check)
|
if (subjectName != subjectName2check)
|
||||||
{
|
{
|
||||||
throw wstring(TEXT("Certificate checking error: the certificate is not matched."));
|
throw wstring(L"Certificate checking error: the certificate is not matched.");
|
||||||
}
|
}
|
||||||
|
|
||||||
isOK = true;
|
isOK = true;
|
||||||
|
@ -1193,14 +1193,14 @@ bool isCertificateValidated(const wstring & fullFilePath, const wstring & subjec
|
||||||
catch (const wstring& s)
|
catch (const wstring& s)
|
||||||
{
|
{
|
||||||
// display error message
|
// display error message
|
||||||
MessageBox(NULL, s.c_str(), TEXT("Certificate checking"), MB_OK);
|
MessageBox(NULL, s.c_str(), L"Certificate checking", MB_OK);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
// Unknown error
|
// Unknown error
|
||||||
wstring errorMessage = TEXT("Unknown exception occured. ");
|
wstring errorMessage = L"Unknown exception occured. ";
|
||||||
errorMessage += GetLastErrorAsString(GetLastError());
|
errorMessage += GetLastErrorAsString(GetLastError());
|
||||||
MessageBox(NULL, errorMessage.c_str(), TEXT("Certificate checking"), MB_OK);
|
MessageBox(NULL, errorMessage.c_str(), L"Certificate checking", MB_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up.
|
// Clean up.
|
||||||
|
@ -1224,14 +1224,14 @@ bool isAssoCommandExisting(LPCTSTR FullPathName)
|
||||||
PTSTR ext = PathFindExtension(FullPathName);
|
PTSTR ext = PathFindExtension(FullPathName);
|
||||||
|
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
wchar_t buffer[MAX_PATH] = TEXT("");
|
wchar_t buffer[MAX_PATH] = L"";
|
||||||
DWORD bufferLen = MAX_PATH;
|
DWORD bufferLen = MAX_PATH;
|
||||||
|
|
||||||
// check if association exist
|
// check if association exist
|
||||||
hres = AssocQueryString(ASSOCF_VERIFY|ASSOCF_INIT_IGNOREUNKNOWN, ASSOCSTR_COMMAND, ext, NULL, buffer, &bufferLen);
|
hres = AssocQueryString(ASSOCF_VERIFY|ASSOCF_INIT_IGNOREUNKNOWN, ASSOCSTR_COMMAND, ext, NULL, buffer, &bufferLen);
|
||||||
|
|
||||||
isAssoCommandExisting = (hres == S_OK) // check if association exist and no error
|
isAssoCommandExisting = (hres == S_OK) // check if association exist and no error
|
||||||
&& (wcsstr(buffer, TEXT("notepad++.exe")) == NULL); // check association with notepad++
|
&& (wcsstr(buffer, L"notepad++.exe")) == NULL; // check association with notepad++
|
||||||
|
|
||||||
}
|
}
|
||||||
return isAssoCommandExisting;
|
return isAssoCommandExisting;
|
||||||
|
@ -1340,7 +1340,7 @@ int nbDigitsFromNbLines(size_t nbLines)
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
constexpr wchar_t timeFmtEscapeChar = 0x1;
|
constexpr wchar_t timeFmtEscapeChar = 0x1;
|
||||||
constexpr wchar_t middayFormat[] = _T("tt");
|
constexpr wchar_t middayFormat[] = L"tt";
|
||||||
|
|
||||||
// Returns AM/PM string defined by the system locale for the specified time.
|
// Returns AM/PM string defined by the system locale for the specified time.
|
||||||
// This string may be empty or customized.
|
// This string may be empty or customized.
|
||||||
|
@ -1481,7 +1481,7 @@ bool isWin32NamespacePrefixedFileName(const wstring& fileName)
|
||||||
|
|
||||||
// the following covers the \\?\... raw Win32-filenames or the \\?\UNC\... UNC equivalents
|
// the following covers the \\?\... raw Win32-filenames or the \\?\UNC\... UNC equivalents
|
||||||
// and also its *nix like forward slash equivalents
|
// and also its *nix like forward slash equivalents
|
||||||
return (fileName.starts_with(TEXT("\\\\?\\")) || fileName.starts_with(TEXT("//?/")));
|
return (fileName.starts_with(L"\\\\?\\") || fileName.starts_with(L"//?/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isWin32NamespacePrefixedFileName(const wchar_t* szFileName)
|
bool isWin32NamespacePrefixedFileName(const wchar_t* szFileName)
|
||||||
|
@ -1505,7 +1505,7 @@ bool isUnsupportedFileName(const wstring& fileName)
|
||||||
// Exception for the standard filenames ending with the dot-char:
|
// Exception for the standard filenames ending with the dot-char:
|
||||||
// - when someone tries to open e.g. the 'C:\file.', we will accept that as this is the way how to work with filenames
|
// - when someone tries to open e.g. the 'C:\file.', we will accept that as this is the way how to work with filenames
|
||||||
// without an extension (some of the WINAPI calls used later trim that dot-char automatically ...)
|
// without an extension (some of the WINAPI calls used later trim that dot-char automatically ...)
|
||||||
if (!(fileName.ends_with(_T('.')) && isWin32NamespacePrefixedFileName(fileName)) && !fileName.ends_with(_T(' ')))
|
if (!(fileName.ends_with(L'.') && isWin32NamespacePrefixedFileName(fileName)) && !fileName.ends_with(L' '))
|
||||||
{
|
{
|
||||||
bool invalidASCIIChar = false;
|
bool invalidASCIIChar = false;
|
||||||
|
|
||||||
|
@ -1539,15 +1539,15 @@ bool isUnsupportedFileName(const wstring& fileName)
|
||||||
{
|
{
|
||||||
// strip input string to a filename without a possible path and extension(s)
|
// strip input string to a filename without a possible path and extension(s)
|
||||||
wstring fileNameOnly;
|
wstring fileNameOnly;
|
||||||
size_t pos = fileName.find_first_of(TEXT("."));
|
size_t pos = fileName.find_first_of(L".");
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
fileNameOnly = fileName.substr(0, pos);
|
fileNameOnly = fileName.substr(0, pos);
|
||||||
else
|
else
|
||||||
fileNameOnly = fileName;
|
fileNameOnly = fileName;
|
||||||
|
|
||||||
pos = fileNameOnly.find_last_of(TEXT("\\"));
|
pos = fileNameOnly.find_last_of(L"\\");
|
||||||
if (pos == std::string::npos)
|
if (pos == std::string::npos)
|
||||||
pos = fileNameOnly.find_last_of(TEXT("/"));
|
pos = fileNameOnly.find_last_of(L"/");
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
fileNameOnly = fileNameOnly.substr(pos + 1);
|
fileNameOnly = fileNameOnly.substr(pos + 1);
|
||||||
|
|
||||||
|
@ -1555,9 +1555,9 @@ bool isUnsupportedFileName(const wstring& fileName)
|
||||||
std::transform(fileNameOnly.begin(), fileNameOnly.end(), fileNameOnly.begin(), ::towupper);
|
std::transform(fileNameOnly.begin(), fileNameOnly.end(), fileNameOnly.begin(), ::towupper);
|
||||||
|
|
||||||
const std::vector<wstring> reservedWin32NamespaceDeviceList {
|
const std::vector<wstring> reservedWin32NamespaceDeviceList {
|
||||||
TEXT("CON"), TEXT("PRN"), TEXT("AUX"), TEXT("NUL"),
|
L"CON", L"PRN", L"AUX", L"NUL",
|
||||||
TEXT("COM1"), TEXT("COM2"), TEXT("COM3"), TEXT("COM4"), TEXT("COM5"), TEXT("COM6"), TEXT("COM7"), TEXT("COM8"), TEXT("COM9"),
|
L"COM1", L"COM2", L"COM3", L"COM4", L"COM5", L"COM6", L"COM7", L"COM8", L"COM9",
|
||||||
TEXT("LPT1"), TEXT("LPT2"), TEXT("LPT3"), TEXT("LPT4"), TEXT("LPT5"), TEXT("LPT6"), TEXT("LPT7"), TEXT("LPT8"), TEXT("LPT9")
|
L"LPT1", L"LPT2", L"LPT3", L"LPT4", L"LPT5", L"LPT6", L"LPT7", L"LPT8", L"LPT9"
|
||||||
};
|
};
|
||||||
|
|
||||||
// last check is for all the old reserved Windows OS filenames
|
// last check is for all the old reserved Windows OS filenames
|
||||||
|
@ -1590,7 +1590,7 @@ Version::Version(const wstring& versionStr)
|
||||||
std::wstring msg(L"\"");
|
std::wstring msg(L"\"");
|
||||||
msg += versionStr;
|
msg += versionStr;
|
||||||
msg += L"\"";
|
msg += L"\"";
|
||||||
msg += TEXT(": Version parts are more than 4. The string to parse is not a valid version format. Let's make it default value in catch block.");
|
msg += L": Version parts are more than 4. The string to parse is not a valid version format. Let's make it default value in catch block.";
|
||||||
throw msg;
|
throw msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1603,7 +1603,7 @@ Version::Version(const wstring& versionStr)
|
||||||
std::wstring msg(L"\"");
|
std::wstring msg(L"\"");
|
||||||
msg += versionStr;
|
msg += versionStr;
|
||||||
msg += L"\"";
|
msg += L"\"";
|
||||||
msg += TEXT(": One of version character is not number. The string to parse is not a valid version format. Let's make it default value in catch block.");
|
msg += L": One of version character is not number. The string to parse is not a valid version format. Let's make it default value in catch block.";
|
||||||
throw msg;
|
throw msg;
|
||||||
}
|
}
|
||||||
*(v[i]) = std::stoi(s);
|
*(v[i]) = std::stoi(s);
|
||||||
|
@ -1629,7 +1629,7 @@ Version::Version(const wstring& versionStr)
|
||||||
_patch = 0;
|
_patch = 0;
|
||||||
_build = 0;
|
_build = 0;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
throw std::wstring(TEXT("Unknown exception from \"Version::Version(const wstring& versionStr)\""));
|
throw std::wstring(L"Unknown exception from \"Version::Version(const wstring& versionStr)\"");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1650,7 +1650,7 @@ void Version::setVersionFrom(const wstring& filePath)
|
||||||
|
|
||||||
VS_FIXEDFILEINFO* lpFileInfo = nullptr;
|
VS_FIXEDFILEINFO* lpFileInfo = nullptr;
|
||||||
UINT cbFileInfo = 0;
|
UINT cbFileInfo = 0;
|
||||||
VerQueryValue(buffer, TEXT("\\"), reinterpret_cast<LPVOID*>(&lpFileInfo), &cbFileInfo);
|
VerQueryValue(buffer, L"\\", reinterpret_cast<LPVOID*>(&lpFileInfo), &cbFileInfo);
|
||||||
if (cbFileInfo)
|
if (cbFileInfo)
|
||||||
{
|
{
|
||||||
_major = (lpFileInfo->dwFileVersionMS & 0xFFFF0000) >> 16;
|
_major = (lpFileInfo->dwFileVersionMS & 0xFFFF0000) >> 16;
|
||||||
|
@ -1666,7 +1666,7 @@ wstring Version::toString()
|
||||||
{
|
{
|
||||||
if (_build == 0 && _patch == 0 && _minor == 0 && _major == 0) // ""
|
if (_build == 0 && _patch == 0 && _minor == 0 && _major == 0) // ""
|
||||||
{
|
{
|
||||||
return TEXT("");
|
return L"";
|
||||||
}
|
}
|
||||||
else if (_build == 0 && _patch == 0 && _minor == 0) // "major"
|
else if (_build == 0 && _patch == 0 && _minor == 0) // "major"
|
||||||
{
|
{
|
||||||
|
@ -1675,27 +1675,27 @@ wstring Version::toString()
|
||||||
else if (_build == 0 && _patch == 0) // "major.minor"
|
else if (_build == 0 && _patch == 0) // "major.minor"
|
||||||
{
|
{
|
||||||
std::wstring v = std::to_wstring(_major);
|
std::wstring v = std::to_wstring(_major);
|
||||||
v += TEXT(".");
|
v += L".";
|
||||||
v += std::to_wstring(_minor);
|
v += std::to_wstring(_minor);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
else if (_build == 0) // "major.minor.patch"
|
else if (_build == 0) // "major.minor.patch"
|
||||||
{
|
{
|
||||||
std::wstring v = std::to_wstring(_major);
|
std::wstring v = std::to_wstring(_major);
|
||||||
v += TEXT(".");
|
v += L".";
|
||||||
v += std::to_wstring(_minor);
|
v += std::to_wstring(_minor);
|
||||||
v += TEXT(".");
|
v += L".";
|
||||||
v += std::to_wstring(_patch);
|
v += std::to_wstring(_patch);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
// "major.minor.patch.build"
|
// "major.minor.patch.build"
|
||||||
std::wstring ver = std::to_wstring(_major);
|
std::wstring ver = std::to_wstring(_major);
|
||||||
ver += TEXT(".");
|
ver += L".";
|
||||||
ver += std::to_wstring(_minor);
|
ver += std::to_wstring(_minor);
|
||||||
ver += TEXT(".");
|
ver += L".";
|
||||||
ver += std::to_wstring(_patch);
|
ver += std::to_wstring(_patch);
|
||||||
ver += TEXT(".");
|
ver += L".";
|
||||||
ver += std::to_wstring(_build);
|
ver += std::to_wstring(_build);
|
||||||
|
|
||||||
return ver;
|
return ver;
|
||||||
|
|
|
@ -49,7 +49,7 @@ const bool dirDown = false;
|
||||||
typedef std::basic_string<wchar_t> generic_string;
|
typedef std::basic_string<wchar_t> generic_string;
|
||||||
typedef std::basic_stringstream<wchar_t> generic_stringstream;
|
typedef std::basic_stringstream<wchar_t> generic_stringstream;
|
||||||
|
|
||||||
std::wstring folderBrowser(HWND parent, const std::wstring & title = TEXT(""), int outputCtrlID = 0, const wchar_t *defaultStr = NULL);
|
std::wstring folderBrowser(HWND parent, const std::wstring & title = L"", int outputCtrlID = 0, const wchar_t *defaultStr = NULL);
|
||||||
std::wstring getFolderName(HWND parent, const wchar_t *defaultDir = NULL);
|
std::wstring getFolderName(HWND parent, const wchar_t *defaultDir = NULL);
|
||||||
|
|
||||||
void printInt(int int2print);
|
void printInt(int int2print);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -167,11 +167,11 @@ public:
|
||||||
//! \name File Operations
|
//! \name File Operations
|
||||||
//@{
|
//@{
|
||||||
//The doXXX functions apply to a single buffer and dont need to worry about views, with the excpetion of doClose, since closing one view doesnt have to mean the document is gone
|
//The doXXX functions apply to a single buffer and dont need to worry about views, with the excpetion of doClose, since closing one view doesnt have to mean the document is gone
|
||||||
BufferID doOpen(const generic_string& fileName, bool isRecursive = false, bool isReadOnly = false, int encoding = -1, const TCHAR *backupFileName = NULL, FILETIME fileNameTimestamp = {});
|
BufferID doOpen(const std::wstring& fileName, bool isRecursive = false, bool isReadOnly = false, int encoding = -1, const wchar_t *backupFileName = NULL, FILETIME fileNameTimestamp = {});
|
||||||
bool doReload(BufferID id, bool alert = true);
|
bool doReload(BufferID id, bool alert = true);
|
||||||
bool doSave(BufferID, const TCHAR * filename, bool isSaveCopy = false);
|
bool doSave(BufferID, const wchar_t * filename, bool isSaveCopy = false);
|
||||||
void doClose(BufferID, int whichOne, bool doDeleteBackup = false);
|
void doClose(BufferID, int whichOne, bool doDeleteBackup = false);
|
||||||
//bool doDelete(const TCHAR *fileName) const {return ::DeleteFile(fileName) != 0;};
|
//bool doDelete(const wchar_t *fileName) const {return ::DeleteFile(fileName) != 0;};
|
||||||
|
|
||||||
void fileOpen();
|
void fileOpen();
|
||||||
void fileNew();
|
void fileNew();
|
||||||
|
@ -186,7 +186,7 @@ public:
|
||||||
bool fileSave(BufferID id = BUFFER_INVALID);
|
bool fileSave(BufferID id = BUFFER_INVALID);
|
||||||
bool fileSaveAllConfirm();
|
bool fileSaveAllConfirm();
|
||||||
bool fileSaveAll();
|
bool fileSaveAll();
|
||||||
bool fileSaveSpecific(const generic_string& fileNameToSave);
|
bool fileSaveSpecific(const std::wstring& fileNameToSave);
|
||||||
bool fileSaveAs(BufferID id = BUFFER_INVALID, bool isSaveCopy = false);
|
bool fileSaveAs(BufferID id = BUFFER_INVALID, bool isSaveCopy = false);
|
||||||
bool fileDelete(BufferID id = BUFFER_INVALID);
|
bool fileDelete(BufferID id = BUFFER_INVALID);
|
||||||
bool fileRename(BufferID id = BUFFER_INVALID);
|
bool fileRename(BufferID id = BUFFER_INVALID);
|
||||||
|
@ -195,8 +195,8 @@ public:
|
||||||
bool switchToFile(BufferID buffer); //find buffer in active view then in other view.
|
bool switchToFile(BufferID buffer); //find buffer in active view then in other view.
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
bool isFileSession(const TCHAR * filename);
|
bool isFileSession(const wchar_t * filename);
|
||||||
bool isFileWorkspace(const TCHAR * filename);
|
bool isFileWorkspace(const wchar_t * filename);
|
||||||
void filePrint(bool showDialog);
|
void filePrint(bool showDialog);
|
||||||
void saveScintillasZoom();
|
void saveScintillasZoom();
|
||||||
|
|
||||||
|
@ -213,9 +213,9 @@ public:
|
||||||
|
|
||||||
void getCurrentOpenedFiles(Session& session, bool includUntitledDoc = false);
|
void getCurrentOpenedFiles(Session& session, bool includUntitledDoc = false);
|
||||||
|
|
||||||
bool fileLoadSession(const TCHAR* fn = nullptr);
|
bool fileLoadSession(const wchar_t* fn = nullptr);
|
||||||
const TCHAR * fileSaveSession(size_t nbFile, TCHAR ** fileNames, const TCHAR *sessionFile2save, bool includeFileBrowser = false);
|
const wchar_t * fileSaveSession(size_t nbFile, wchar_t ** fileNames, const wchar_t *sessionFile2save, bool includeFileBrowser = false);
|
||||||
const TCHAR * fileSaveSession(size_t nbFile = 0, TCHAR** fileNames = nullptr);
|
const wchar_t * fileSaveSession(size_t nbFile = 0, wchar_t** fileNames = nullptr);
|
||||||
|
|
||||||
bool doBlockComment(comment_mode currCommentMode);
|
bool doBlockComment(comment_mode currCommentMode);
|
||||||
bool doStreamComment();
|
bool doStreamComment();
|
||||||
|
@ -231,25 +231,25 @@ public:
|
||||||
void notifyBufferChanged(Buffer * buffer, int mask);
|
void notifyBufferChanged(Buffer * buffer, int mask);
|
||||||
bool findInFinderFiles(FindersInfo *findInFolderInfo);
|
bool findInFinderFiles(FindersInfo *findInFolderInfo);
|
||||||
|
|
||||||
bool createFilelistForFiles(std::vector<generic_string> & fileNames);
|
bool createFilelistForFiles(std::vector<std::wstring> & fileNames);
|
||||||
bool createFilelistForProjects(std::vector<generic_string> & fileNames);
|
bool createFilelistForProjects(std::vector<std::wstring> & fileNames);
|
||||||
bool findInFiles();
|
bool findInFiles();
|
||||||
bool findInProjects();
|
bool findInProjects();
|
||||||
bool findInFilelist(std::vector<generic_string> & fileList);
|
bool findInFilelist(std::vector<std::wstring> & fileList);
|
||||||
bool replaceInFiles();
|
bool replaceInFiles();
|
||||||
bool replaceInProjects();
|
bool replaceInProjects();
|
||||||
bool replaceInFilelist(std::vector<generic_string> & fileList);
|
bool replaceInFilelist(std::vector<std::wstring> & fileList);
|
||||||
|
|
||||||
void setFindReplaceFolderFilter(const TCHAR *dir, const TCHAR *filters);
|
void setFindReplaceFolderFilter(const wchar_t *dir, const wchar_t *filters);
|
||||||
std::vector<generic_string> addNppComponents(const TCHAR *destDir, const TCHAR *extFilterName, const TCHAR *extFilter);
|
std::vector<std::wstring> addNppComponents(const wchar_t *destDir, const wchar_t *extFilterName, const wchar_t *extFilter);
|
||||||
std::vector<generic_string> addNppPlugins(const TCHAR *extFilterName, const TCHAR *extFilter);
|
std::vector<std::wstring> addNppPlugins(const wchar_t *extFilterName, const wchar_t *extFilter);
|
||||||
int getHtmlXmlEncoding(const TCHAR *fileName) const;
|
int getHtmlXmlEncoding(const wchar_t *fileName) const;
|
||||||
|
|
||||||
HACCEL getAccTable() const{
|
HACCEL getAccTable() const{
|
||||||
return _accelerator.getAccTable();
|
return _accelerator.getAccTable();
|
||||||
};
|
};
|
||||||
|
|
||||||
bool emergency(const generic_string& emergencySavedDir);
|
bool emergency(const std::wstring& emergencySavedDir);
|
||||||
|
|
||||||
Buffer* getCurrentBuffer() {
|
Buffer* getCurrentBuffer() {
|
||||||
return _pEditView->getCurrentBuffer();
|
return _pEditView->getCurrentBuffer();
|
||||||
|
@ -260,7 +260,7 @@ public:
|
||||||
void showQuoteFromIndex(int index) const;
|
void showQuoteFromIndex(int index) const;
|
||||||
void showQuote(const QuoteParams* quote) const;
|
void showQuote(const QuoteParams* quote) const;
|
||||||
|
|
||||||
generic_string getPluginListVerStr() const {
|
std::wstring getPluginListVerStr() const {
|
||||||
return _pluginsAdminDlg.getPluginListVerStr();
|
return _pluginsAdminDlg.getPluginListVerStr();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -463,10 +463,10 @@ private:
|
||||||
void performPostReload(int whichOne);
|
void performPostReload(int whichOne);
|
||||||
//END: Document management
|
//END: Document management
|
||||||
|
|
||||||
int doSaveOrNot(const TCHAR *fn, bool isMulti = false);
|
int doSaveOrNot(const wchar_t *fn, bool isMulti = false);
|
||||||
int doReloadOrNot(const TCHAR *fn, bool dirty);
|
int doReloadOrNot(const wchar_t *fn, bool dirty);
|
||||||
int doCloseOrNot(const TCHAR *fn);
|
int doCloseOrNot(const wchar_t *fn);
|
||||||
int doDeleteOrNot(const TCHAR *fn);
|
int doDeleteOrNot(const wchar_t *fn);
|
||||||
int doSaveAll();
|
int doSaveAll();
|
||||||
|
|
||||||
void enableMenu(int cmdID, bool doEnable) const;
|
void enableMenu(int cmdID, bool doEnable) const;
|
||||||
|
@ -486,7 +486,7 @@ private:
|
||||||
void enableConvertMenuItems(EolType f) const;
|
void enableConvertMenuItems(EolType f) const;
|
||||||
void checkUnicodeMenuItems() const;
|
void checkUnicodeMenuItems() const;
|
||||||
|
|
||||||
generic_string getLangDesc(LangType langType, bool getName = false);
|
std::wstring getLangDesc(LangType langType, bool getName = false);
|
||||||
|
|
||||||
void setLangStatus(LangType langType);
|
void setLangStatus(LangType langType);
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ private:
|
||||||
|
|
||||||
bool isConditionExprLine(intptr_t lineNumber);
|
bool isConditionExprLine(intptr_t lineNumber);
|
||||||
intptr_t findMachedBracePos(size_t startPos, size_t endPos, char targetSymbol, char matchedSymbol);
|
intptr_t findMachedBracePos(size_t startPos, size_t endPos, char targetSymbol, char matchedSymbol);
|
||||||
void maintainIndentation(TCHAR ch);
|
void maintainIndentation(wchar_t ch);
|
||||||
|
|
||||||
void addHotSpot(ScintillaEditView* view = nullptr);
|
void addHotSpot(ScintillaEditView* view = nullptr);
|
||||||
|
|
||||||
|
@ -552,8 +552,8 @@ private:
|
||||||
void pasteToMarkedLines();
|
void pasteToMarkedLines();
|
||||||
void deleteMarkedline(size_t ln);
|
void deleteMarkedline(size_t ln);
|
||||||
void inverseMarks();
|
void inverseMarks();
|
||||||
void replaceMarkedline(size_t ln, const TCHAR *str);
|
void replaceMarkedline(size_t ln, const wchar_t *str);
|
||||||
generic_string getMarkedLine(size_t ln);
|
std::wstring getMarkedLine(size_t ln);
|
||||||
void findMatchingBracePos(intptr_t& braceAtCaret, intptr_t& braceOpposite);
|
void findMatchingBracePos(intptr_t& braceAtCaret, intptr_t& braceOpposite);
|
||||||
bool braceMatch();
|
bool braceMatch();
|
||||||
|
|
||||||
|
@ -580,28 +580,28 @@ private:
|
||||||
bool findInOpenedFiles();
|
bool findInOpenedFiles();
|
||||||
bool findInCurrentFile(bool isEntireDoc);
|
bool findInCurrentFile(bool isEntireDoc);
|
||||||
|
|
||||||
void getMatchedFileNames(const TCHAR *dir, size_t level, const std::vector<generic_string> & patterns, std::vector<generic_string> & fileNames, bool isRecursive, bool isInHiddenDir);
|
void getMatchedFileNames(const wchar_t *dir, size_t level, const std::vector<std::wstring> & patterns, std::vector<std::wstring> & fileNames, bool isRecursive, bool isInHiddenDir);
|
||||||
void doSynScorll(HWND hW);
|
void doSynScorll(HWND hW);
|
||||||
void setWorkingDir(const TCHAR *dir);
|
void setWorkingDir(const wchar_t *dir);
|
||||||
bool str2Cliboard(const generic_string & str2cpy);
|
bool str2Cliboard(const std::wstring & str2cpy);
|
||||||
|
|
||||||
bool getIntegralDockingData(tTbData & dockData, int & iCont, bool & isVisible);
|
bool getIntegralDockingData(tTbData & dockData, int & iCont, bool & isVisible);
|
||||||
int getLangFromMenuName(const TCHAR * langName);
|
int getLangFromMenuName(const wchar_t * langName);
|
||||||
generic_string getLangFromMenu(const Buffer * buf);
|
std::wstring getLangFromMenu(const Buffer * buf);
|
||||||
|
|
||||||
generic_string exts2Filters(const generic_string& exts, int maxExtsLen = -1) const; // maxExtsLen default value -1 makes no limit of whole exts length
|
std::wstring exts2Filters(const std::wstring& exts, int maxExtsLen = -1) const; // maxExtsLen default value -1 makes no limit of whole exts length
|
||||||
int setFileOpenSaveDlgFilters(CustomFileDialog & fDlg, bool showAllExt, int langType = -1); // showAllExt should be true if it's used for open file dialog - all set exts should be used for filtering files
|
int setFileOpenSaveDlgFilters(CustomFileDialog & fDlg, bool showAllExt, int langType = -1); // showAllExt should be true if it's used for open file dialog - all set exts should be used for filtering files
|
||||||
Style * getStyleFromName(const TCHAR *styleName);
|
Style * getStyleFromName(const wchar_t *styleName);
|
||||||
bool dumpFiles(const TCHAR * outdir, const TCHAR * fileprefix = TEXT("")); //helper func
|
bool dumpFiles(const wchar_t * outdir, const wchar_t * fileprefix = L""); //helper func
|
||||||
void drawTabbarColoursFromStylerArray();
|
void drawTabbarColoursFromStylerArray();
|
||||||
void drawAutocompleteColoursFromTheme(COLORREF fgColor, COLORREF bgColor);
|
void drawAutocompleteColoursFromTheme(COLORREF fgColor, COLORREF bgColor);
|
||||||
void drawDocumentMapColoursFromStylerArray();
|
void drawDocumentMapColoursFromStylerArray();
|
||||||
|
|
||||||
std::vector<generic_string> loadCommandlineParams(const TCHAR * commandLine, const CmdLineParams * pCmdParams) {
|
std::vector<std::wstring> loadCommandlineParams(const wchar_t * commandLine, const CmdLineParams * pCmdParams) {
|
||||||
const CmdLineParamsDTO dto = CmdLineParamsDTO::FromCmdLineParams(*pCmdParams);
|
const CmdLineParamsDTO dto = CmdLineParamsDTO::FromCmdLineParams(*pCmdParams);
|
||||||
return loadCommandlineParams(commandLine, &dto);
|
return loadCommandlineParams(commandLine, &dto);
|
||||||
}
|
}
|
||||||
std::vector<generic_string> loadCommandlineParams(const TCHAR * commandLine, const CmdLineParamsDTO * pCmdParams);
|
std::vector<std::wstring> loadCommandlineParams(const wchar_t * commandLine, const CmdLineParamsDTO * pCmdParams);
|
||||||
bool noOpenedDoc() const;
|
bool noOpenedDoc() const;
|
||||||
bool goToPreviousIndicator(int indicID2Search, bool isWrap = true) const;
|
bool goToPreviousIndicator(int indicID2Search, bool isWrap = true) const;
|
||||||
bool goToNextIndicator(int indicID2Search, bool isWrap = true) const;
|
bool goToNextIndicator(int indicID2Search, bool isWrap = true) const;
|
||||||
|
@ -620,7 +620,7 @@ private:
|
||||||
void launchProjectPanel(int cmdID, ProjectPanel ** pProjPanel, int panelID);
|
void launchProjectPanel(int cmdID, ProjectPanel ** pProjPanel, int panelID);
|
||||||
void launchDocMap();
|
void launchDocMap();
|
||||||
void launchFunctionList();
|
void launchFunctionList();
|
||||||
void launchFileBrowser(const std::vector<generic_string> & folders, const generic_string& selectedItemPath, bool fromScratch = false);
|
void launchFileBrowser(const std::vector<std::wstring> & folders, const std::wstring& selectedItemPath, bool fromScratch = false);
|
||||||
void showAllQuotes() const;
|
void showAllQuotes() const;
|
||||||
static DWORD WINAPI threadTextPlayer(void *text2display);
|
static DWORD WINAPI threadTextPlayer(void *text2display);
|
||||||
static DWORD WINAPI threadTextTroller(void *params);
|
static DWORD WINAPI threadTextTroller(void *params);
|
||||||
|
|
Loading…
Reference in New Issue