Skip to content

Commit

Permalink
_tcstowcs, _wcstotcs, _tctowc 廃止
Browse files Browse the repository at this point in the history
  • Loading branch information
berryzplus committed Sep 11, 2019
1 parent 9fb292c commit e7eaaa6
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 41 deletions.
6 changes: 3 additions & 3 deletions sakura_core/env/CShareData_IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ void CShareData_IO::IO_KeyBind( CDataProfile& cProfile, CommonSetting_KeyBind& s
if( cProfile.IsReadingMode() ){
if (bOldVer) {
KEYDATA& keydata = sKeyBind.m_pKeyNameArr[i];
_tcstowcs( szKeyName, keydata.m_szKeyName, _countof(szKeyName) );
wcscpy_s( szKeyName, keydata.m_szKeyName );
if( cProfile.IOProfileData( szSecName, szKeyName, MakeStringBufferW(szKeyData) ) ){
int buf[8];
scan_ints( szKeyData, LTEXT("%d,%d,%d,%d,%d,%d,%d,%d"), buf );
Expand Down Expand Up @@ -1748,10 +1748,10 @@ void CShareData_IO::ShareData_IO_Type_One( CDataProfile& cProfile, STypeConfig&
pH = pT+1;
if( NULL != (pT=wcschr(pH, L',')) ){
*pT = L'\0';
_wcstotcs( types.m_KeyHelpArr[j].m_szAbout, pH, _countof(types.m_KeyHelpArr[j].m_szAbout) );
wcsncpy_s( types.m_KeyHelpArr[j].m_szAbout, pH, _TRUNCATE );
pH = pT+1;
if( L'\0' != (*pH) ){
_wcstotcs( types.m_KeyHelpArr[j].m_szPath, pH, _countof2(types.m_KeyHelpArr[j].m_szPath) );
types.m_KeyHelpArr[j].m_szPath = pH;
types.m_nKeyHelpNum = j+1; // iniに保存せずに、読み出せたファイル分を辞書数とする
}
}
Expand Down
6 changes: 2 additions & 4 deletions sakura_core/func/CFuncLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,9 @@ bool CFuncLookup::Funccode2Name( int funccode, WCHAR* ptr, int bufsize ) const
int position = funccode - F_USERMACRO_0;
if( m_pMacroRec[position].IsEnabled() ){
const WCHAR *p = m_pMacroRec[position].GetTitle();
_tcstowcs( ptr, p, bufsize - 1 );
ptr[ bufsize - 1 ] = LTEXT('\0');
wcsncpy_s( ptr, bufsize, p, _TRUNCATE );
}else{
_snwprintf( ptr, bufsize, LS(STR_ERR_DLGFUNCLKUP03), position );
ptr[ bufsize - 1 ] = LTEXT('\0');
_snwprintf_s( ptr, bufsize, _TRUNCATE, LS(STR_ERR_DLGFUNCLKUP03), position );
}
return true;
}
Expand Down
4 changes: 1 addition & 3 deletions sakura_core/macro/CWSHManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ CMacroManagerBase* CWSHMacroManager::Creator(const WCHAR* FileExt)
lstrcat(FileType, L"\\ScriptEngine");
if(ReadRegistry(HKEY_CLASSES_ROOT, FileType, NULL, EngineName, 1024))
{
wchar_t EngineNameW[1024];
_tcstowcs(EngineNameW, EngineName, _countof(EngineNameW));
return new CWSHMacroManager(EngineNameW);
return new CWSHMacroManager(EngineName);
}
}
return NULL;
Expand Down
6 changes: 3 additions & 3 deletions sakura_core/typeprop/CImpExpManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ bool CImpExpRegex::Import( const wstring& sFileName, wstring& sErrMsg )
{
//1行読み込み
wstring line=in.ReadLineW();
_wcstotcs(buff,line.c_str(),_countof(buff));
line.copy( buff, line.length(), 0 );

if(count >= MAX_REGEX_KEYWORD){
sErrMsg = LS(STR_IMPEXP_REGEX1);
Expand Down Expand Up @@ -655,9 +655,9 @@ bool CImpExpRegex::Import( const wstring& sFileName, wstring& sErrMsg )
{
if( 0 < MAX_REGEX_KEYWORDLISTLEN - keywordPos - 1 ){
regexKeyArr[count].m_nColorIndex = k;
_tcstowcs(&pKeyword[keywordPos], p, t_min<int>(MAX_REGEX_KEYWORDLEN, MAX_REGEX_KEYWORDLISTLEN - keywordPos - 1));
wcsncpy_s( &pKeyword[keywordPos], MAX_REGEX_KEYWORDLISTLEN - keywordPos, p, _TRUNCATE );
count++;
keywordPos += auto_strlen(&pKeyword[keywordPos]) + 1;
keywordPos += wcsnlen( &pKeyword[keywordPos], MAX_REGEX_KEYWORDLISTLEN - keywordPos ) + 1;
}else{
sErrMsg = LS(STR_IMPEXP_REGEX2);
}
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/typeprop/CPropTypesKeyHelp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ INT_PTR CPropTypesKeyHelp::DispatchEvent(
}
// 開けたなら1行目を取得してから閉じる -> szAbout
std::wstring line=in.ReadLineW();
_wcstotcs(szAbout,line.c_str(),_countof(szAbout));
line.copy( szAbout, line.length(), 0 );
in.Close();
}
strcnv(szAbout);
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/typeprop/CPropTypesRegex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ int CPropTypesRegex::GetData( HWND hwndDlg )
ListView_GetItemText(hwndList, i, 0, &szKeyWord[0], szKeyWordSize );
ListView_GetItemText(hwndList, i, 1, szColorIndex, _countof(szColorIndex));
if( pKeyword < pKeywordLast - 1 ){
_tcstowcs(pKeyword, &szKeyWord[0], pKeywordLast - pKeyword);
wcsncpy_s( pKeyword, pKeywordLast - pKeyword, &szKeyWord[0], _TRUNCATE );
}
//色指定文字列を番号に変換する
m_Types.m_RegexKeywordArr[i].m_nColorIndex = COLORIDX_REGEX1;
Expand Down
4 changes: 1 addition & 3 deletions sakura_core/util/shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,7 @@ static LRESULT CALLBACK PropSheetWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, L
LPMALLOC pMalloc;
if( SUCCEEDED(::SHGetMalloc(&pMalloc)) ){
LPITEMIDLIST pIDL;
WCHAR pszDisplayName[_MAX_PATH];
_tcstowcs(pszDisplayName, szPath, _countof(pszDisplayName));
// pszDisplayName = szPath;
WCHAR* pszDisplayName = szPath;
if( SUCCEEDED(pDesktopFolder->ParseDisplayName(NULL, NULL, pszDisplayName, NULL, &pIDL, NULL)) ){
SHELLEXECUTEINFO si;
::ZeroMemory( &si, sizeof(si) );
Expand Down
15 changes: 0 additions & 15 deletions sakura_core/util/string_ex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,20 +393,10 @@ void wcstombs_vector(const wchar_t* pSrc, int nSrcLen, std::vector<char>* ret)
(*ret)[nNewLen]='\0';
}

size_t _tcstowcs(WCHAR* pszDst, const WCHAR* pszSrc, size_t nDstCount)
{
wcsncpy_s(pszDst, nDstCount, pszSrc, _TRUNCATE);
return wcslen(pszDst);
}
size_t _tcstombs(CHAR* szDst, const WCHAR* pszSrc, size_t nDstCount)
{
return wcstombs2(szDst, pszSrc, nDstCount);
}
size_t _wcstotcs(WCHAR* pszDst, const WCHAR* pszSrc, size_t nDstCount)
{
wcsncpy_s(pszDst, nDstCount, pszSrc, _TRUNCATE);
return wcslen(pszDst);
}
size_t _mbstotcs(WCHAR* pszDst, const CHAR* szSrc, size_t nDstCount)
{
return mbstowcs2(pszDst, szSrc, nDstCount);
Expand All @@ -415,11 +405,6 @@ int _tctomb(const WCHAR* p,ACHAR* mb)
{
return wctomb(mb,*p);
}
int _tctowc(const WCHAR* p,WCHAR* wc)
{
*wc=*p;
return 1;
}

// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
// メモリ //
Expand Down
3 changes: 0 additions & 3 deletions sakura_core/util/string_ex.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,9 @@ void wcstombs_vector(const wchar_t* pSrc, std::vector<char>* ret); //戻り値
void wcstombs_vector(const wchar_t* pSrc, int nSrcLen, std::vector<char>* ret); //戻り値はvectorとして返す。

//WCHAR
size_t _tcstowcs(WCHAR* pszDst, const WCHAR* pszSrc, size_t nDstCount);
size_t _tcstombs(CHAR* szDst, const WCHAR* pszSrc, size_t nDstCount);
size_t _wcstotcs(WCHAR* pszDst, const WCHAR* pszSrc, size_t nDstCount);
size_t _mbstotcs(WCHAR* pszDst, const CHAR* szSrc, size_t nDstCount);
int _tctomb(const WCHAR* p,ACHAR* mb);
int _tctowc(const WCHAR* p,WCHAR* wc);

// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
// リテラル比較 //
Expand Down
8 changes: 3 additions & 5 deletions sakura_core/window/CEditWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4208,11 +4208,9 @@ LRESULT CEditWnd::WinListMenu( HMENU hMenu, EditNode* pEditNodeArr, int nRowNum,
//!ツールチップのテキストを取得
void CEditWnd::GetTooltipText(WCHAR* pszBuf, size_t nBufCount, int nID) const
{
// 機能文字列の取得 -> tmp -> pszBuf
WCHAR tmp[256];
size_t nLen;
GetDocument()->m_cFuncLookup.Funccode2Name( nID, tmp, _countof(tmp) );
nLen = _wcstotcs(pszBuf, tmp, nBufCount);
// 機能文字列の取得 -> pszBuf
GetDocument()->m_cFuncLookup.Funccode2Name( nID, pszBuf, nBufCount );
size_t nLen = wcsnlen( pszBuf, nBufCount );

// 機能に対応するキー名の取得(複数)
CNativeW** ppcAssignedKeyList;
Expand Down

0 comments on commit e7eaaa6

Please sign in to comment.