Use const for constant local variables in wxWidgets headers

This avoids warnings from MSVS 2017 static analyzer when C++ core rule
set is activated.

Closes https://github.com/wxWidgets/wxWidgets/pull/819
This commit is contained in:
orbitcowboy
2018-05-29 09:54:19 +02:00
committed by Vadim Zeitlin
parent 2fc20abbdd
commit 8dfd799fd5
9 changed files with 19 additions and 19 deletions

View File

@@ -994,7 +994,7 @@ public:
// This is logically equivalent to strlen(str.mb_str()) but avoids
// actually converting the string to multibyte and just computes the
// length that it would have after conversion.
size_t ofs = wxConvLibc.FromWChar(NULL, 0, str.wc_str(), str.length());
const size_t ofs = wxConvLibc.FromWChar(NULL, 0, str.wc_str(), str.length());
return ofs == wxCONV_FAILED ? 0 : static_cast<ptrdiff_t>(ofs);
}
@@ -2161,17 +2161,17 @@ public:
// searching (return starting index, or -1 if not found)
int Find(const wxString& sub) const // like strstr
{
size_type idx = find(sub);
const size_type idx = find(sub);
return (idx == npos) ? wxNOT_FOUND : (int)idx;
}
int Find(const char *sub) const // like strstr
{
size_type idx = find(sub);
const size_type idx = find(sub);
return (idx == npos) ? wxNOT_FOUND : (int)idx;
}
int Find(const wchar_t *sub) const // like strstr
{
size_type idx = find(sub);
const size_type idx = find(sub);
return (idx == npos) ? wxNOT_FOUND : (int)idx;
}