From 6057972be41063d3c6038f09605eec76931a847a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 19 Apr 2001 23:13:07 +0000 Subject: [PATCH] some const correctness for wxClassInfo git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9800 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/dynlib.cpp | 2 +- src/common/object.cpp | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index 796231c31a..0b479642b6 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -166,7 +166,7 @@ void wxLibrary::PrepareClasses(wxClassInfo *first) { if (info->m_className) classTable.Put(info->m_className, (wxObject *)info); - info = info->GetNext(); + info = (wxClassInfo *)info->GetNext(); } // Set base pointers for each wxClassInfo diff --git a/src/common/object.cpp b/src/common/object.cpp index 731dd2fdeb..8f4755be97 100644 --- a/src/common/object.cpp +++ b/src/common/object.cpp @@ -193,7 +193,11 @@ void wxObject::operator delete[] (void * buf) * Class info: provides run-time class type information. */ -wxClassInfo::wxClassInfo(wxChar *cName, wxChar *baseName1, wxChar *baseName2, int sz, wxObjectConstructorFn constr) +wxClassInfo::wxClassInfo(const wxChar *cName, + const wxChar *baseName1, + const wxChar *baseName2, + int sz, + wxObjectConstructorFn constr) { m_className = cName; m_baseClassName1 = baseName1; @@ -217,21 +221,23 @@ wxObject *wxClassInfo::CreateObject() return (wxObject *) NULL; } -wxClassInfo *wxClassInfo::FindClass(wxChar *c) +wxClassInfo *wxClassInfo::FindClass(const wxChar *c) { wxClassInfo *p = sm_first; while (p) { - if (p && p->GetClassName() && wxStrcmp(p->GetClassName(), c) == 0) - return p; + if ( wxStrcmp(p->GetClassName(), c) == 0 ) + break; + p = p->m_next; } - return (wxClassInfo *) NULL; + + return p; } // Climb upwards through inheritance hierarchy. // Dual inheritance is catered for. -bool wxClassInfo::IsKindOf(wxClassInfo *info) const +bool wxClassInfo::IsKindOf(const wxClassInfo *info) const { if (info == NULL) return FALSE; -- 2.45.2