Index: src/ch/ch.cpp =================================================================== diff -u -rffb46a396ce20cda2e04020cf01c118ae81642b5 -r5598fd0318a9e148ff2c2eb83a6f6c4af251e798 --- src/ch/ch.cpp (.../ch.cpp) (revision ffb46a396ce20cda2e04020cf01c118ae81642b5) +++ src/ch/ch.cpp (.../ch.cpp) (revision 5598fd0318a9e148ff2c2eb83a6f6c4af251e798) @@ -686,7 +686,7 @@ HWND CCopyHandlerApp::HHelp(HWND hwndCaller, LPCTSTR pszFile, UINT uCommand, DWORD_PTR dwData) { - PCTSTR pszPath=NULL; + PCTSTR pszPath=nullptr; WIN32_FIND_DATA wfd; HANDLE handle=::FindFirstFile(m_pszHelpFilePath, &wfd); if (handle != INVALID_HANDLE_VALUE) @@ -695,15 +695,14 @@ ::FindClose(handle); } - if (pszPath == NULL) - return NULL; + if (pszPath == nullptr) + return nullptr; - if (pszFile != NULL) + if (pszFile != nullptr) { - TCHAR szAdd[2*_MAX_PATH]; - _tcscpy(szAdd, pszPath); - _tcscat(szAdd, pszFile); - return ::HtmlHelp(hwndCaller, szAdd, uCommand, dwData); + CString strAdd = pszPath; + strAdd += pszFile; + return ::HtmlHelp(hwndCaller, strAdd, uCommand, dwData); } else return ::HtmlHelp(hwndCaller, pszPath, uCommand, dwData); Index: src/libchcore/log.cpp =================================================================== diff -u -rb1463aec0ea059d60c297e84eed664b3df3ed0a6 -r5598fd0318a9e148ff2c2eb83a6f6c4af251e798 --- src/libchcore/log.cpp (.../log.cpp) (revision b1463aec0ea059d60c297e84eed664b3df3ed0a6) +++ src/libchcore/log.cpp (.../log.cpp) (revision 5598fd0318a9e148ff2c2eb83a6f6c4af251e798) @@ -32,6 +32,7 @@ #include #include "TCoreException.h" #include "ErrorCodes.h" +#include namespace chcore { @@ -334,11 +335,8 @@ // log time time_t t = time(NULL); - wchar_t szData[128]; - _tcscpy(szData, _tctime(&t)); - size_t tLen = _tcslen(szData) - 1; - while (szData[tLen] == _T('\n')) - szData[tLen--] = _T('\0'); + std::wstring strTime = _tctime(&t); + boost::trim_right_if(strTime, boost::is_any_of(L"\n")); m_lock.lock(); @@ -352,7 +350,7 @@ bool bFailed = false; if (pFile) { - if (_ftprintf(pFile, _T("[%s] [%s] %s\r\n"), szData, __logtype_str[iType], pszStr) < 0) + if (_ftprintf(pFile, _T("[%s] [%s] %s\r\n"), strTime.c_str(), __logtype_str[iType], pszStr) < 0) bFailed = true; fclose(pFile); } @@ -363,10 +361,10 @@ switch (iType) { case level_error: - _ftprintf(stderr, _T("[%s] [%s] %s\r\n"), szData, __logtype_str[iType], pszStr); + _ftprintf(stderr, _T("[%s] [%s] %s\r\n"), strTime.c_str(), __logtype_str[iType], pszStr); break; default: - _ftprintf(stdout, _T("[%s] [%s] %s\r\n"), szData, __logtype_str[iType], pszStr); + _ftprintf(stdout, _T("[%s] [%s] %s\r\n"), strTime.c_str(), __logtype_str[iType], pszStr); } } else if (bStd)