diff options
-rw-r--r-- | c/episodelistview.cpp | 6 | ||||
-rw-r--r-- | c/wcharptr.cpp | 14 |
2 files changed, 8 insertions, 12 deletions
diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp index 3ecaab1..7cbbcca 100644 --- a/c/episodelistview.cpp +++ b/c/episodelistview.cpp @@ -265,15 +265,11 @@ int CALLBACK EpisodeListView::SortProc(const LPARAM iItem1, const LPARAM iItem2, { Mark m; WcharPtr s1, s2; - int cch, cch1, cch2; if (!Pl("episode_data","episode_title",lvi1.lParam,&s1)) return 0; if (!Pl("episode_data","episode_title",lvi2.lParam,&s2)) return 0; - cch1 = wcslen(s1); - cch2 = wcslen(s2); - cch = cch1 > cch2? cch2: cch1; - return order*_wcsnicmp(s1, s2, cch); + return order*_wcsicmp(s1, s2); } default: return 0; diff --git a/c/wcharptr.cpp b/c/wcharptr.cpp index d1332d5..f36c620 100644 --- a/c/wcharptr.cpp +++ b/c/wcharptr.cpp @@ -6,10 +6,10 @@ WcharPtr WcharPtr::FromNarrow(const char* const src, const int cp) { - int cbMultiByte = strlen(src)+1; - int cchWideChar = MultiByteToWideChar(cp, 0, src, cbMultiByte, nullptr, 0); - wchar_t* dst = new wchar_t[cchWideChar]; - if (!MultiByteToWideChar(cp, 0, src, cbMultiByte, dst, cchWideChar)) { + int cchNarrow = strlen(src)+1; + int cchWide = MultiByteToWideChar(cp, 0, src, cchNarrow, nullptr, 0); + wchar_t* dst = new wchar_t[cchWide]; + if (!MultiByteToWideChar(cp, 0, src, cchNarrow, dst, cchWide)) { delete dst; throw Win32Error(); } @@ -18,9 +18,9 @@ WcharPtr WcharPtr::FromNarrow(const char* const src, const int cp) WcharPtr WcharPtr::Copy(const wchar_t* const src) { - const int cb = wcslen(src)+1; - wchar_t* dst = new wchar_t[cb]; - memcpy(dst, src, cb*sizeof(wchar_t)); + const int cch = wcslen(src)+1; + wchar_t* dst = new wchar_t[cch]; + memcpy(dst, src, cch*sizeof(wchar_t)); return dst; } |