Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e789c60
auto_strlen を使う必要が無いところで使わないように変更
Sep 15, 2019
4b7d343
auto_strcpy を使う必要が無いところで使わないように変更
Sep 15, 2019
46f40e2
_tcsistr を使う必要が無いところで使わないように変更
Sep 15, 2019
3b20a54
auto_memcpy を使う必要が無いところで使わないように変更
Sep 15, 2019
61d300a
auto_strcpy_s を使う必要が無いところで使わないように変更
Sep 15, 2019
6ee34cb
auto_strncpy を使う必要が無いところで使わないように変更
Sep 15, 2019
c0d6521
auto_strcat を使う必要が無いところで使わないように変更
Sep 15, 2019
47ea505
auto_strcat_s を使う必要が無いところで使わないように変更
Sep 15, 2019
4e364f4
auto_memcmp を使う必要が無いところで使わないように変更
Sep 15, 2019
9755786
auto_memicmp を使う必要が無いところで使わないように変更
Sep 15, 2019
b405ea4
auto_strnicmp を使う必要が無いところで使わないように変更
Sep 15, 2019
d7dd86e
auto_stricmp を使う必要が無いところで使わないように変更
Sep 15, 2019
876faf1
auto_strstr を使う必要が無いところで使わないように変更
Sep 15, 2019
46fa080
auto_strchr を使う必要が無いところで使わないように変更
Sep 15, 2019
96868a1
auto_atol を使う必要が無いところで使わないように変更
Sep 15, 2019
cdcca90
auto_memset を使う必要が無いところで使わないように変更
Sep 15, 2019
c1bd913
auto_strcmp を使う必要が無いところで使わないように変更
Sep 15, 2019
e6b8c2a
auto_strncmp を使う必要が無いところで使わないように変更
Sep 15, 2019
239918f
下記のマクロ廃止
Sep 15, 2019
2bcc3da
レビュー指摘対応
beru Sep 15, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sakura_core/CDataProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct StringBufferW_{

StringBufferW_& operator = (const StringBufferW_& rhs)
{
auto_strcpy_s(pData,nDataCount,rhs.pData);
wcscpy_s(pData,nDataCount,rhs.pData);
return *this;
}
};
Expand All @@ -51,7 +51,7 @@ struct StringBufferA_{

StringBufferA_& operator = (const StringBufferA_& rhs)
{
auto_strcpy_s(pData,nDataCount,rhs.pData);
strcpy_s(pData,nDataCount,rhs.pData);
return *this;
}
};
Expand Down
4 changes: 2 additions & 2 deletions sakura_core/CDicMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ int CDicMgr::HokanSearch(
if( szLine.length() == 0 )continue;

if( bHokanLoHiCase ){ /* 英大文字小文字を同一視する */
nRet = auto_memicmp( pszKey, szLine.c_str(), nKeyLen );
nRet = wmemicmp( pszKey, szLine.c_str(), nKeyLen );
}else{
nRet = auto_memcmp( pszKey, szLine.c_str(), nKeyLen );
nRet = wmemcmp( pszKey, szLine.c_str(), nKeyLen );
}
if( 0 == nRet ){
vKouho.push_back( szLine );
Expand Down
4 changes: 2 additions & 2 deletions sakura_core/CEol.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ struct SEolDefinition{
const ACHAR* m_szDataA;
int m_nLen;

bool StartsWith(const WCHAR* pData, int nLen) const{ return m_nLen<=nLen && 0==auto_memcmp(pData,m_szDataW,m_nLen); }
bool StartsWith(const ACHAR* pData, int nLen) const{ return m_nLen<=nLen && m_szDataA[0] != '\0' && 0==auto_memcmp(pData,m_szDataA,m_nLen); }
bool StartsWith(const WCHAR* pData, int nLen) const{ return m_nLen<=nLen && 0==wmemcmp(pData,m_szDataW,m_nLen); }
bool StartsWith(const ACHAR* pData, int nLen) const{ return m_nLen<=nLen && m_szDataA[0] != '\0' && 0==amemcmp(pData,m_szDataA,m_nLen); }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amemcmpってなんでしたっけ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

実質 memcmp ですね。

inline int amemcmp(const ACHAR* p1, const ACHAR* p2, size_t count){ return ::memcmp(p1,p2,count); }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memcmpと書けばよいものをamemcmpと書いて分かりづらくしている、ととるか
memcmpと書いたらansi想定かどうか分かりづらいからamemcmpと書いて分かりやすくしてる、ととるか。

ぼく個人は、付加価値を与えない独自定義は、コードを分かりづらくしてるだけだと考えています。(これまたPRの趣旨とずれている・・・)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

きっと amemcmp 関数を書いた中の人にとっては priceless だったんでしょう。

};
extern const SEolDefinition g_aEolTable[];

Expand Down
2 changes: 1 addition & 1 deletion sakura_core/CFileExt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const WCHAR *CFileExt::GetExtFilter( void )

int i = (int)m_vstrFilter.size();
m_vstrFilter.resize( i + work.length() );
auto_memcpy( &m_vstrFilter[i], &work[0], work.length() );
wmemcpy( &m_vstrFilter[i], &work[0], work.length() );
}
if( 0 == m_nCount ){
m_vstrFilter.push_back( L'\0' );
Expand Down
18 changes: 9 additions & 9 deletions sakura_core/CGrepAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ void CGrepAgent::OnAfterSave(const SSaveInfo& sSaveInfo)
*/
void CGrepAgent::CreateFolders( const WCHAR* pszPath, std::vector<std::wstring>& vPaths )
{
const int nPathLen = auto_strlen( pszPath );
const int nPathLen = wcslen( pszPath );
auto szPath = std::make_unique<WCHAR[]>(nPathLen + 1);
auto szTmp = std::make_unique<WCHAR[]>(nPathLen + 1);
auto_strcpy( &szPath[0], pszPath );
wcscpy( &szPath[0], pszPath );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wcslenのとこで書きましたが、std::wstring使ったらいいんじゃないかと。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my_strtok の呼び出しに使うバッファなので std::wstring にはしない方が良いかなと思います。
規格的に要件は満たしているので std::wstring をバッファ的に扱っても問題起きないかもしれませんが。

WCHAR* token;
int nPathPos = 0;
while( NULL != (token = my_strtok<WCHAR>( &szPath[0], nPathLen, &nPathPos, L";")) ){
auto_strcpy( &szTmp[0], token );
wcscpy( &szTmp[0], token );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

szTmpもstd::wstringでいいんじゃないかと。
stringなら代入演算子が使えるので、より直感的に書けるのもメリットだと思います。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

後続の while ループで " 文字を削る更新処理をしていますが、std::wstring でも効率を落とさずに直感的に書けますか?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

効率を最優先に考えるのは、必要な場面だけにしたいです。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in-place な指定文字を削る処理が複数個所で使われていたら関数化するのが良さそうですね。

WCHAR* p;
WCHAR* q;
p = q = &szTmp[0];
Expand Down Expand Up @@ -711,7 +711,7 @@ int CGrepAgent::DoGrepTree(
int nWork = 0;
int nHitCountOld = -100;
bool bOutputFolderName = false;
int nBasePathLen = auto_strlen(pszBasePath);
int nBasePathLen = wcslen(pszBasePath);
CGrepEnumOptions cGrepEnumOptions;
CGrepEnumFilterFiles cGrepEnumFilterFiles;
cGrepEnumFilterFiles.Enumerates( pszPath, cGrepEnumKeys, cGrepEnumOptions, cGrepExceptAbsFiles );
Expand Down Expand Up @@ -751,7 +751,7 @@ int CGrepAgent::DoGrepTree(
currentFile += L"\\";
currentFile += lpFileName;
int nBasePathLen2 = nBasePathLen + 1;
if( (int)auto_strlen(pszPath) < nBasePathLen2 ){
if( (int)wcslen(pszPath) < nBasePathLen2 ){
nBasePathLen2 = nBasePathLen;
}

Expand Down Expand Up @@ -1196,7 +1196,7 @@ int CGrepAgent::DoGrepFile(
X / O : (D)Folder(Abs) -> (G)RelPath(File)
X / X : (H)FullPath
*/
auto pszWork = std::make_unique<wchar_t[]>(auto_strlen(pszFullPath) + auto_strlen(pszCodeName) + 10);
auto pszWork = std::make_unique<wchar_t[]>(wcslen(pszFullPath) + wcslen(pszCodeName) + 10);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この10ってなんでしたっけ?
というのをどっかで確認したいです。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使われている書式文字列的にはそこまで要らないとは思いますが余裕を持って + 10 してるんでしょうね。

wchar_t* szWork0 = &pszWork[0];
if( sGrepOption.bGrepOutputBaseFolder || sGrepOption.bGrepSeparateFolder ){
if( !bOutputBaseFolder && sGrepOption.bGrepOutputBaseFolder ){
Expand All @@ -1214,7 +1214,7 @@ int CGrepAgent::DoGrepFile(
if( pszFolder[0] ){
auto_sprintf( szWork0, L"■\"%s\"\r\n", pszFolder ); // (C), (D)
}else{
auto_strcpy( szWork0, L"■\r\n" );
wcscpy( szWork0, L"■\r\n" );
}
cmemMessage.AppendString( szWork0 );
bOutputFolderName = true;
Expand Down Expand Up @@ -1243,7 +1243,7 @@ int CGrepAgent::DoGrepFile(
{
if( CODE_AUTODETECT == sGrepOption.nGrepCharSet ){
if( IsValidCodeType(nCharCode) ){
auto_strcpy( szCpName, CCodeTypeName(nCharCode).Bracket() );
wcscpy( szCpName, CCodeTypeName(nCharCode).Bracket() );
pszCodeName = szCpName;
}else{
CCodePage::GetNameBracket(szCpName, nCharCode);
Expand Down Expand Up @@ -1694,7 +1694,7 @@ int CGrepAgent::DoGrepReplaceFile(
{
if( CODE_AUTODETECT == sGrepOption.nGrepCharSet ){
if( IsValidCodeType(nCharCode) ){
auto_strcpy( szCpName, CCodeTypeName(nCharCode).Bracket() );
wcscpy( szCpName, CCodeTypeName(nCharCode).Bracket() );
pszCodeName = szCpName;
}else{
CCodePage::GetNameBracket(szCpName, nCharCode);
Expand Down
12 changes: 6 additions & 6 deletions sakura_core/CGrepEnumFileBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ class CGrepEnumFileBase {
int baseLen = wcslen( lpBaseFolder );
LPWSTR lpPath = new WCHAR[ baseLen + wcslen( vecKeys[ i ] ) + 2 ];
if( NULL == lpPath ) break;
auto_strcpy( lpPath, lpBaseFolder );
auto_strcpy( lpPath + baseLen, L"\\" );
auto_strcpy( lpPath + baseLen + 1, vecKeys[ i ] );
wcscpy( lpPath, lpBaseFolder );
wcscpy( lpPath + baseLen, L"\\" );
wcscpy( lpPath + baseLen + 1, vecKeys[ i ] );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wstring使ったら += できますね。
PRの趣旨とはちょっとずれてしまいますが。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そうですね。それかスマポ使ってメモリ解放の記述を自動化してあげても良いかも。。
メモリの動的確保を行う際にvecKeys[ i ] の長さを wcslen で調べているのに wcscpy でまた長さを調べてるのも無駄ですね。
VGrepEnumKeysstd::vector< LPCWSTR > じゃなくて std::vector<std::wstring_view> にした方が良さそう。

まぁこのPRでは wstring への置き換えまでやると考える事が増えるのでやらないようにしたいです。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

サクラエディタには、文字列的なモノを扱うクラスがいっぱいありますが、そいつらを整備してやれば、ソコソコの可読性をキープしつつ効率を維持することができるような気がします。

ここのコンテキストだと StringBuffer に CNativeW::AppendStringF を実装してやればよさそう、とか。

このPRでまとめて対処する気はありませんけども。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

将来のC++で文字列の組み込み型が登場するまではコテコテのC言語の記述を保ちたいと思いますん。

// vecKeys[ i ] ==> "subdir\*.h" 等の場合に後で(ファイル|フォルダ)名に "subdir\" を連結する
const WCHAR* keyDirYen = wcsrchr( vecKeys[ i ], L'\\' );
const WCHAR* keyDirSlash = wcsrchr( vecKeys[ i ], L'/' );
Expand Down Expand Up @@ -150,9 +150,9 @@ class CGrepEnumFileBase {
wcsncpy( lpName, vecKeys[ i ], nKeyDirLen );
wcscpy( lpName + nKeyDirLen, w32fd.cFileName );
LPWSTR lpFullPath = new WCHAR[ baseLen + wcslen(lpName) + 2 ];
auto_strcpy( lpFullPath, lpBaseFolder );
auto_strcpy( lpFullPath + baseLen, L"\\" );
auto_strcpy( lpFullPath + baseLen + 1, lpName );
wcscpy( lpFullPath, lpBaseFolder );
wcscpy( lpFullPath + baseLen, L"\\" );
wcscpy( lpFullPath + baseLen + 1, lpName );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wstring使ったら += できますね。
PRの趣旨とはちょっとずれてしまいますが。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あとループの内側で毎回メモリ確保と解放をせずに、サイズが足りてるなら領域を使いまわしたりもできそうですね。
このPRではやりませんけど。

if( IsValid( w32fd, lpName ) ){
if( pExceptItems && pExceptItems->IsExist( lpFullPath ) ){
}else{
Expand Down
4 changes: 2 additions & 2 deletions sakura_core/CHokanMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,9 @@ void CHokanMgr::HokanSearchByKeyword(
const wchar_t* word = keywordMgr.GetKeyWord(kwdset,i);
int nRet;
if( bHokanLoHiCase ){
nRet = auto_memicmp(pszCurWord, word, nKeyLen );
nRet = wmemicmp(pszCurWord, word, nKeyLen );
}else{
nRet = auto_memcmp(pszCurWord, word, nKeyLen );
nRet = wmemcmp(pszCurWord, word, nKeyLen );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PRの趣旨とは関係ないですが、利用する関数が誤ってる気がします。

wmemcmp ← メモリ領域を wchar_t のバイナリ配列として比較。
wcscmp ← メモリ領域を文字列(=NUL文字で終端される wchar_t の配列)として比較。

つまり、SUPERニッチな関数以外では wmemcmp を使う必要はないはず・・・。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そうなんでしょうか?処理結果が問題無いなら誤っているとまではいえない気もします。

wcscmp だと文字列長渡さないのが気になりますね。まぁ本当はC文字列ではなくて比較する両方の文字列の長さが事前に分かっている型を使いたいです。まず文字列長が一致しているかの比較が出来るので文字列一致判定の効率が良くなる場合が有ると思います。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

関数の特性を見て分かる通り、領域内にNUL文字 '\0' が含まれる場合に差が出ます。
差が出るということは、同じじゃないってことで、問題があるってことだと思います。

wcscmpだと -1, 0, 1 の3つの可能性があるので微妙ですが、operator == だと文字列長を考慮せずには語れませんね・・・。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

関数の特性を見て分かる通り、領域内にNUL文字 '\0' が含まれる場合に差が出ます。
差が出るということは、同じじゃないってことで、問題があるってことだと思います。

具体的に問題が生じるケースがあるのか自分は掴めていません。

wcscmpだと -1, 0, 1 の3つの可能性があるので微妙ですが、operator == だと文字列長を考慮せずには語れませんね・・・。

ここでの使われ方は同一かどうかの比較なので、その要件を満たすならまぁ良いんじゃないかなと思います。

}
if( nRet != 0 ){
continue;
Expand Down
4 changes: 2 additions & 2 deletions sakura_core/CKeyWordSetMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,11 +534,11 @@ int CKeyWordSetMgr::CleanKeyWords( int nIdx )
unsigned int nKeyWordLen = wcslen( p );
if( nKeyWordLen == wcslen( r ) ){
if( m_bKEYWORDCASEArr[nIdx] ){
if( 0 == auto_memcmp( p, r, nKeyWordLen ) ){
if( 0 == wmemcmp( p, r, nKeyWordLen ) ){
bDelKey = true;
}
}else{
if( 0 == auto_memicmp( p, r, nKeyWordLen ) ){
if( 0 == wmemicmp( p, r, nKeyWordLen ) ){
bDelKey = true;
}
}
Expand Down
8 changes: 4 additions & 4 deletions sakura_core/CSearchAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ const wchar_t* CSearchAgent::SearchStringWord(
for( size_t iSW = 0; iSW < nSize; ++iSW ) {
if( searchWords[iSW].second == nNextWordTo2 - nNextWordFrom2 ){
/* 1==大文字小文字の区別 */
if( (!bLoHiCase && 0 == auto_memicmp( &(pLine[nNextWordFrom2]) , searchWords[iSW].first, searchWords[iSW].second ) ) ||
(bLoHiCase && 0 == auto_memcmp( &(pLine[nNextWordFrom2]) , searchWords[iSW].first, searchWords[iSW].second ) )
if( (!bLoHiCase && 0 == wmemicmp( &(pLine[nNextWordFrom2]) , searchWords[iSW].first, searchWords[iSW].second ) ) ||
(bLoHiCase && 0 == wmemcmp( &(pLine[nNextWordFrom2]) , searchWords[iSW].first, searchWords[iSW].second ) )
){
*pnMatchLen = searchWords[iSW].second;
return &pLine[nNextWordFrom2];
Expand Down Expand Up @@ -603,8 +603,8 @@ int CSearchAgent::SearchWord(
if( searchWords[iSW].second == nNextWordTo2 - nNextWordFrom2 ){
const wchar_t* pData = pDocLine->GetPtr(); // 2002/2/10 aroka CMemory変更
/* 1==大文字小文字の区別 */
if( (!sSearchOption.bLoHiCase && 0 == auto_memicmp( &(pData[nNextWordFrom2]) , searchWords[iSW].first, searchWords[iSW].second ) ) ||
(sSearchOption.bLoHiCase && 0 == auto_memcmp( &(pData[nNextWordFrom2]) , searchWords[iSW].first, searchWords[iSW].second ) )
if( (!sSearchOption.bLoHiCase && 0 == wmemicmp( &(pData[nNextWordFrom2]) , searchWords[iSW].first, searchWords[iSW].second ) ) ||
(sSearchOption.bLoHiCase && 0 == wmemcmp( &(pData[nNextWordFrom2]) , searchWords[iSW].first, searchWords[iSW].second ) )
){
pMatchRange->SetFromY(nLinePos); // マッチ行
pMatchRange->SetToY (nLinePos); // マッチ行
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/CSortedTagJumpList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ BOOL CSortedTagJumpList::GetParam( int index, WCHAR* keyword, WCHAR* filename, i
if( depth ) *depth = p->depth;
if( baseDir ){
if( 0 <= p->baseDirId && (size_t)p->baseDirId < m_baseDirArr.size() ){
auto_strcpy( baseDir, m_baseDirArr[p->baseDirId].c_str() );
wcscpy( baseDir, m_baseDirArr[p->baseDirId].c_str() );
}
}
return TRUE;
Expand Down
10 changes: 5 additions & 5 deletions sakura_core/_main/CCommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ int CCommandLine::CheckCommandLine(
{
if( len >= ptr->len && // 長さが足りているか
( str[ptr->len] == '=' || str[ptr->len] == ':' ) && // オプション部分の長さチェック
auto_memicmp( str, ptr->opt, ptr->len ) == 0 ) // 文字列の比較 // 2006.10.25 ryoji memcmp() -> _memicmp()
wmemicmp( str, ptr->opt, ptr->len ) == 0 ) // 文字列の比較 // 2006.10.25 ryoji memcmp() -> _memicmp()
{
*arg = str + ptr->len + 1; // 引数開始位置
*arglen = len - ptr->len - 1;
Expand All @@ -164,7 +164,7 @@ int CCommandLine::CheckCommandLine(
for( ptr = _COptWoA; ptr->opt != NULL; ptr++ )
{
if( len == ptr->len && // 長さチェック
auto_memicmp( str, ptr->opt, ptr->len ) == 0 ) // 文字列の比較
wmemicmp( str, ptr->opt, ptr->len ) == 0 ) // 文字列の比較
{
*arglen = 0;
return ptr->value;
Expand Down Expand Up @@ -288,7 +288,7 @@ void CCommandLine::ParseCommandLine( LPCWSTR pszCmdLineSrc, bool bResponse )
// Nov. 11, 2005 susu
// 不正なファイル名のままだとファイル保存時ダイアログが出なくなるので
// 簡単なファイルチェックを行うように修正
if (_tcsncmp_literal(szPath, L"file:///")==0) {
if (wcsncmp_literal(szPath, L"file:///")==0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

何度か書いた独自マクロってのはこれのことです。
この変更に関してはなんも問題なしと思います。

wcscpy(szPath, &(szPath[8]));
}
int len = wcslen(szPath);
Expand Down Expand Up @@ -384,7 +384,7 @@ void CCommandLine::ParseCommandLine( LPCWSTR pszCmdLineSrc, bool bResponse )
case CMDLINEOPT_GREPMODE: // GREPMODE
m_bGrepMode = true;
if( L'\0' == m_fi.m_szDocType[0] ){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ちょっと関係ありませんが、if( !m_fi.m_szDocType[0] ) と書いても同じですよね、これ。

auto_strcpy( m_fi.m_szDocType , L"grepout" );
wcscpy( m_fi.m_szDocType , L"grepout" );
}
break;
case CMDLINEOPT_GREPDLG: // GREPDLG
Expand Down Expand Up @@ -473,7 +473,7 @@ void CCommandLine::ParseCommandLine( LPCWSTR pszCmdLineSrc, bool bResponse )
m_bDebugMode = true;
// 2010.06.16 Moca -TYPE=output 扱いとする
if( L'\0' == m_fi.m_szDocType[0] ){
auto_strcpy( m_fi.m_szDocType , L"output" );
wcscpy( m_fi.m_szDocType , L"output" );
}
break;
case CMDLINEOPT_NOMOREOPT: // 2007.09.09 genta これ以降引数無効
Expand Down
20 changes: 10 additions & 10 deletions sakura_core/_main/CControlTray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ HWND CControlTray::Create( HINSTANCE hInstance )
m_pcPropertyManager = new CPropertyManager();
m_pcPropertyManager->Create( GetTrayHwnd(), &m_hIcons, &m_cMenuDrawer );

auto_strcpy(m_szLanguageDll, GetDllShareData().m_Common.m_sWindow.m_szLanguageDll);
wcscpy(m_szLanguageDll, GetDllShareData().m_Common.m_sWindow.m_szLanguageDll);

return GetTrayHwnd();
}
Expand Down Expand Up @@ -672,8 +672,8 @@ LRESULT CControlTray::DispatchEvent(
switch( (e_PM_CHANGESETTING_SELECT)lParam ){
case PM_CHANGESETTING_ALL:
{
bool bChangeLang = auto_strcmp( GetDllShareData().m_Common.m_sWindow.m_szLanguageDll, m_szLanguageDll ) != 0;
auto_strcpy( m_szLanguageDll, GetDllShareData().m_Common.m_sWindow.m_szLanguageDll );
bool bChangeLang = wcscmp( GetDllShareData().m_Common.m_sWindow.m_szLanguageDll, m_szLanguageDll ) != 0;
wcscpy( m_szLanguageDll, GetDllShareData().m_Common.m_sWindow.m_szLanguageDll );
std::vector<std::wstring> values;
if( bChangeLang ){
CShareData::getInstance()->ConvertLangValues(values, true);
Expand Down Expand Up @@ -732,8 +732,8 @@ LRESULT CControlTray::DispatchEvent(
}
*(CShareData::getInstance()->GetTypeSettings()[nIdx]) = type;
CShareData::getInstance()->GetTypeSettings()[nIdx]->m_nIdx = nIdx;
auto_strcpy(m_pShareData->m_TypeMini[nIdx].m_szTypeName, type.m_szTypeName);
auto_strcpy(m_pShareData->m_TypeMini[nIdx].m_szTypeExts, type.m_szTypeExts);
wcscpy(m_pShareData->m_TypeMini[nIdx].m_szTypeName, type.m_szTypeName);
wcscpy(m_pShareData->m_TypeMini[nIdx].m_szTypeExts, type.m_szTypeExts);
m_pShareData->m_TypeMini[nIdx].m_id = type.m_id;
m_pShareData->m_TypeMini[nIdx].m_encoding = type.m_encoding;
}else{
Expand Down Expand Up @@ -765,7 +765,7 @@ LRESULT CControlTray::DispatchEvent(
int nAddNameNum = nInsert + 1;
auto_sprintf( type->m_szTypeName, LS(STR_TRAY_TYPE_NAME), nAddNameNum );
for(int k = 1; k < m_pShareData->m_nTypesCount; k++){
if( auto_strcmp(types[k]->m_szTypeName, type->m_szTypeName) == 0 ){
if( wcscmp(types[k]->m_szTypeName, type->m_szTypeName) == 0 ){
nAddNameNum++;
auto_sprintf( type->m_szTypeName, LS(STR_TRAY_TYPE_NAME), nAddNameNum );
k = 0;
Expand All @@ -782,8 +782,8 @@ LRESULT CControlTray::DispatchEvent(
m_pShareData->m_TypeMini[i] = m_pShareData->m_TypeMini[i-1];
}
types[nInsert] = type;
auto_strcpy(m_pShareData->m_TypeMini[nInsert].m_szTypeName, type->m_szTypeName);
auto_strcpy(m_pShareData->m_TypeMini[nInsert].m_szTypeExts, type->m_szTypeExts);
wcscpy(m_pShareData->m_TypeMini[nInsert].m_szTypeName, type->m_szTypeName);
wcscpy(m_pShareData->m_TypeMini[nInsert].m_szTypeExts, type->m_szTypeExts);
m_pShareData->m_TypeMini[nInsert].m_id = type->m_id;
m_pShareData->m_TypeMini[nInsert].m_encoding = type->m_encoding;
}else{
Expand Down Expand Up @@ -1234,15 +1234,15 @@ bool CControlTray::OpenNewEditor(
CResponsefileDeleter respDeleter;
if( szCmdLineOption ){
// Grepなどで入りきらない場合はレスポンスファイルを利用する
if( cCmdLineBuf.max_size() < cCmdLineBuf.size() + auto_strlen(szCmdLineOption) ){
if( cCmdLineBuf.max_size() < cCmdLineBuf.size() + wcslen(szCmdLineOption) ){
WCHAR szIniDir[_MAX_PATH];
GetInidir(szIniDir);
LPWSTR pszTempFile = _wtempnam(szIniDir, L"skr_resp");
if( !pszTempFile ){
ErrorMessage(hWndParent, LS(STR_TRAY_RESPONSEFILE));
return false;
}
auto_strcpy(szResponseFile, pszTempFile);
wcscpy(szResponseFile, pszTempFile);
free(pszTempFile);
CTextOutputStream output(szResponseFile);
if( !output ){
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/_os/CClipboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ bool CClipboard::GetText(CNativeW* cmemBuf, bool* pbColumnSelect, bool* pbLineSe
CShiftJis::SJISToUnicode(cmemSjis, &cmemUni);
cmemSjis.Clean();
// '\0'までを取得
cmemUni._SetStringLength(auto_strlen(cmemUni.GetStringPtr()));
cmemUni._SetStringLength(wcslen(cmemUni.GetStringPtr()));
cmemUni.swap(*cmemBuf);
::GlobalUnlock(hText);
return true;
Expand Down
4 changes: 2 additions & 2 deletions sakura_core/basis/CMyString.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class CFilePath : public StaticString<WCHAR,_MAX_PATH>{
LPCWSTR GetExt( bool bWithoutDot = false ) const
{
const WCHAR* head = c_str();
const WCHAR* p = auto_strchr(head,L'\0') - 1;
const WCHAR* p = wcschr(head,L'\0') - 1;
while(p>=head){
if(*p==L'.')break;
if(*p==L'\\')break;
Expand All @@ -71,7 +71,7 @@ class CFilePath : public StaticString<WCHAR,_MAX_PATH>{
if(p>=head && *p==L'.'){
return bWithoutDot ? p+1 : p; //bWithoutDot==trueならドットなしを返す
}else{
return auto_strchr(head,L'\0');
return wcschr(head,L'\0');
}
}
};
Expand Down
Loading