Eliminate -Wcast-qual warnings with GCC and Clang
Use const_cast, mutable, and various other changes to avoid -Wcast-qual
This commit is contained in:
@@ -877,7 +877,7 @@ bool wxHtmlHelpWindow::KeywordSearch(const wxString& keyword,
|
||||
#if wxUSE_PROGRESSDLG
|
||||
progress.Update(status.GetCurIndex(), foundstr);
|
||||
#endif
|
||||
m_SearchList->Append(status.GetName(), (void*)status.GetCurItem());
|
||||
m_SearchList->Append(status.GetName(), const_cast<wxHtmlHelpDataItem*>(status.GetCurItem()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -543,9 +543,9 @@ extern "C" {
|
||||
static int LINKAGEMODE wxHtmlEntityCompare(const void *key, const void *item)
|
||||
{
|
||||
#if wxUSE_UNICODE_UTF8
|
||||
return strcmp((char*)key, ((wxHtmlEntityInfo*)item)->name);
|
||||
return strcmp(static_cast<const char*>(key), static_cast<const wxHtmlEntityInfo*>(item)->name);
|
||||
#else
|
||||
return wxStrcmp((wxChar*)key, ((wxHtmlEntityInfo*)item)->name);
|
||||
return wxStrcmp(static_cast<const wxChar*>(key), static_cast<const wxHtmlEntityInfo*>(item)->name);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -662,7 +662,7 @@ wxHtmlTag *wxHtmlTag::GetFirstSibling() const
|
||||
return m_Parent->m_FirstChild;
|
||||
else
|
||||
{
|
||||
wxHtmlTag *cur = (wxHtmlTag*)this;
|
||||
wxHtmlTag* cur = const_cast<wxHtmlTag*>(this);
|
||||
while (cur->m_Prev)
|
||||
cur = cur->m_Prev;
|
||||
return cur;
|
||||
@@ -675,7 +675,7 @@ wxHtmlTag *wxHtmlTag::GetLastSibling() const
|
||||
return m_Parent->m_LastChild;
|
||||
else
|
||||
{
|
||||
wxHtmlTag *cur = (wxHtmlTag*)this;
|
||||
wxHtmlTag* cur = const_cast<wxHtmlTag*>(this);
|
||||
while (cur->m_Next)
|
||||
cur = cur->m_Next;
|
||||
return cur;
|
||||
|
@@ -269,7 +269,7 @@ const wxHtmlCell *wxHtmlImageMapCell::Find( int cond, const void *param ) const
|
||||
{
|
||||
if (cond == wxHTML_COND_ISIMAGEMAP)
|
||||
{
|
||||
if (m_Name == *((wxString*)(param)))
|
||||
if (m_Name == *static_cast<const wxString*>(param))
|
||||
return this;
|
||||
}
|
||||
return wxHtmlCell::Find(cond, param);
|
||||
@@ -331,8 +331,8 @@ private:
|
||||
size_t m_nCurrFrame;
|
||||
#endif
|
||||
double m_scale;
|
||||
wxHtmlImageMapCell *m_imageMap;
|
||||
wxString m_mapName;
|
||||
mutable const wxHtmlImageMapCell* m_imageMap;
|
||||
mutable wxString m_mapName;
|
||||
wxString m_alt;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxHtmlImageCell);
|
||||
@@ -655,18 +655,14 @@ wxHtmlLinkInfo *wxHtmlImageCell::GetLink( int x, int y ) const
|
||||
p = p->GetParent();
|
||||
}
|
||||
p = op;
|
||||
wxHtmlCell *cell = (wxHtmlCell*)p->Find(wxHTML_COND_ISIMAGEMAP,
|
||||
const wxHtmlCell* cell = p->Find(wxHTML_COND_ISIMAGEMAP,
|
||||
(const void*)(&m_mapName));
|
||||
if (!cell)
|
||||
{
|
||||
((wxString&)m_mapName).Clear();
|
||||
m_mapName.Clear();
|
||||
return wxHtmlCell::GetLink( x, y );
|
||||
}
|
||||
{ // dirty hack, ask Joel why he fills m_ImageMap in this place
|
||||
// THE problem is that we're in const method and we can't modify m_ImageMap
|
||||
wxHtmlImageMapCell **cx = (wxHtmlImageMapCell**)(&m_imageMap);
|
||||
*cx = (wxHtmlImageMapCell*)cell;
|
||||
}
|
||||
m_imageMap = static_cast<const wxHtmlImageMapCell*>(cell);
|
||||
}
|
||||
return m_imageMap->GetLink(x, y);
|
||||
}
|
||||
|
Reference in New Issue
Block a user