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:
Paul Cornett
2020-02-02 22:50:32 -08:00
parent 6724f8c052
commit 948ddc6e0f
115 changed files with 273 additions and 303 deletions
+1 -1
View File
@@ -211,7 +211,7 @@ public:
if ( !found )
{
if (IsRecordingDefaults())
((wxConfigBase *)this)->Write(key, defVal);
const_cast<wxConfigBase*>(this)->Write(key, defVal);
*value = defVal;
}
return found;
+1 -1
View File
@@ -1218,7 +1218,7 @@ public:
{ return m_data; }
wxDataViewItem GetItem() const
{ return wxDataViewItem( (void*) this ); }
{ return wxDataViewItem(const_cast<void*>(static_cast<const void*>(this))); }
virtual bool IsContainer()
{ return false; }
+1 -1
View File
@@ -391,7 +391,7 @@ public:
void Insert(const T* pItem, size_t uiIndex)
{
base::insert(this->begin() + uiIndex, (T*)pItem);
base::insert(this->begin() + uiIndex, pItem);
}
void Empty() { DoEmpty(); base::clear(); }
+2 -2
View File
@@ -152,8 +152,8 @@ protected:
unsigned char m_currentBlue;
int m_pageNumber;
bool m_clipping;
double m_underlinePosition;
double m_underlineThickness;
mutable double m_underlinePosition;
mutable double m_underlineThickness;
wxPrintData m_printData;
double m_pageHeight;
wxArrayString m_definedPSFonts;
+2 -2
View File
@@ -68,8 +68,8 @@ protected:
void DoSetRange(double min_val, double max_val);
void DoSetIncrement(double inc);
void GtkDisableEvents() const;
void GtkEnableEvents() const;
void GtkDisableEvents();
void GtkEnableEvents();
// Update the number of digits used to match our range (and base).
void GtkSetEntryWidth();
+6 -2
View File
@@ -483,7 +483,8 @@ public:
wxDEPRECATED( wxNode *Nth(size_t n) const ); // use Item
// kludge for typesafe list migration in core classes.
wxDEPRECATED( operator wxList&() const );
wxDEPRECATED( operator wxList&() );
wxDEPRECATED( operator const wxList&() const );
#endif // wxLIST_COMPATIBILITY
protected:
@@ -1147,7 +1148,6 @@ inline int wxListBase::Number() const { return (int)GetCount(); }
inline wxNode *wxListBase::First() const { return (wxNode *)GetFirst(); }
inline wxNode *wxListBase::Last() const { return (wxNode *)GetLast(); }
inline wxNode *wxListBase::Nth(size_t n) const { return (wxNode *)Item(n); }
inline wxListBase::operator wxList&() const { return *(wxList*)this; }
#endif
@@ -1200,6 +1200,10 @@ public:
#if !wxUSE_STD_CONTAINERS
// wxListBase deprecated methods
inline wxListBase::operator wxList&() { return *static_cast<wxList*>(this); }
inline wxListBase::operator const wxList&() const { return *static_cast<const wxList*>(this); }
// -----------------------------------------------------------------------------
// wxStringList class for compatibility with the old code
// -----------------------------------------------------------------------------
+6 -5
View File
@@ -87,10 +87,11 @@ public:
// Find/delete wxDDEConnection corresponding to the HCONV
wxDDEConnection *FindConnection(WXHCONV conv);
bool DeleteConnection(WXHCONV conv);
wxString& GetServiceName() const { return (wxString&) m_serviceName; }
wxString& GetServiceName() { return m_serviceName; }
const wxString& GetServiceName() const { return m_serviceName; }
wxDDEConnectionList& GetConnections() const
{ return (wxDDEConnectionList&) m_connections; }
wxDDEConnectionList& GetConnections() { return m_connections; }
const wxDDEConnectionList& GetConnections() const { return m_connections; }
protected:
int m_lastError;
@@ -120,8 +121,8 @@ public:
wxDDEConnection *FindConnection(WXHCONV conv);
bool DeleteConnection(WXHCONV conv);
wxDDEConnectionList& GetConnections() const
{ return (wxDDEConnectionList&) m_connections; }
wxDDEConnectionList& GetConnections() { return m_connections; }
const wxDDEConnectionList& GetConnections() const { return m_connections; }
protected:
int m_lastError;
+1 -1
View File
@@ -122,7 +122,7 @@ public:
// non NULL)
static HBITMAP ConvertToBitmap(const BITMAPINFO *pbi,
HDC hdc = 0,
void *bits = NULL);
const void *bits = NULL);
// create a plain DIB (not a DIB section) from a DDB, the caller is
// responsable for freeing it using ::GlobalFree()
+1 -1
View File
@@ -263,7 +263,7 @@ private:
wxString m_strKey; // key name (relative to m_hRootKey)
WOW64ViewMode m_viewMode; // which view to select under WOW64
AccessMode m_mode; // valid only if key is opened
long m_dwLastError; // last error (0 if none)
mutable long m_dwLastError; // last error (0 if none)
wxDECLARE_NO_COPY_CLASS(wxRegKey);
+2 -2
View File
@@ -263,12 +263,12 @@
#if wxUSE_UNICODE_WINDOWS_H
inline int StartDoc(HDC h, CONST DOCINFOW* info)
{
return StartDocW(h, (DOCINFOW*) info);
return StartDocW(h, const_cast<DOCINFOW*>(info));
}
#else
inline int StartDoc(HDC h, CONST DOCINFOA* info)
{
return StartDocA(h, (DOCINFOA*) info);
return StartDocA(h, const_cast<DOCINFOA*>(info);
}
#endif
#endif
+1 -1
View File
@@ -66,7 +66,7 @@ inline Type* wxCFRetain(Type *r)
// Casting r to CFTypeRef ensures we are calling the real C version defined in CFBase.h
// and not any possibly templated/overloaded CFRetain.
if ( r != NULL )
r = (Type*)::CFRetain((CFTypeRef)r);
r = const_cast<Type*>(static_cast<const Type*>(::CFRetain(static_cast<CFTypeRef>(r))));
return r;
}
+6 -6
View File
@@ -43,21 +43,21 @@ public:
void SetFont(const wxFont& font)
{ m_font = font; m_ownerDrawn = true; }
wxFont& GetFont() const
{ return (wxFont&) m_font; }
wxFont& GetFont() { return m_font; }
const wxFont& GetFont() const { return m_font; }
void SetTextColour(const wxColour& colText)
{ m_colText = colText; m_ownerDrawn = true; }
wxColour& GetTextColour() const
{ return (wxColour&) m_colText; }
wxColour& GetTextColour() { return m_colText; }
const wxColour& GetTextColour() const { return m_colText; }
void SetBackgroundColour(const wxColour& colBack)
{ m_colBack = colBack; m_ownerDrawn = true; }
wxColour& GetBackgroundColour() const
{ return (wxColour&) m_colBack ; }
wxColour& GetBackgroundColour() { return m_colBack; }
const wxColour& GetBackgroundColour() const { return m_colBack ; }
void SetMarginWidth(int width)
+1 -1
View File
@@ -27,7 +27,7 @@ class WXDLLIMPEXP_PROPGRID wxPGPropArgCls
public:
wxPGPropArgCls( const wxPGProperty* property )
{
m_ptr.property = (wxPGProperty*) property;
m_ptr.property = const_cast<wxPGProperty*>(property);
m_flags = IsProperty;
}
wxPGPropArgCls( const wxString& str )
+1 -1
View File
@@ -571,7 +571,7 @@ protected:
// Returns property by its label.
wxPGProperty* BaseGetPropertyByLabel( const wxString& label,
wxPGProperty* parent = NULL ) const;
const wxPGProperty* parent = NULL ) const;
// Unselect sub-properties.
void DoRemoveChildrenFromSelection(wxPGProperty* p, bool recursive,
+4 -3
View File
@@ -105,7 +105,8 @@ struct WXDLLIMPEXP_BASE wxStringData
nAllocLength; // allocated memory size
// mimics declaration 'wxStringCharType data[nAllocLength]'
wxStringCharType* data() const { return (wxStringCharType*)(this + 1); }
wxStringCharType* data() { return reinterpret_cast<wxStringCharType*>(this + 1); }
const wxStringCharType* data() const { return reinterpret_cast<const wxStringCharType*>(this + 1); }
// empty string has a special ref count so it's never deleted
bool IsEmpty() const { return (nRefs == -1); }
@@ -151,9 +152,9 @@ protected:
// initializes the string to the empty value (must be called only from
// ctors, use Reinit() otherwise)
#if wxUSE_UNICODE_UTF8
void Init() { m_pchData = (wxStringCharType *)wxEmptyStringImpl; } // FIXME-UTF8
void Init() { m_pchData = const_cast<wxStringCharType*>(wxEmptyStringImpl); } // FIXME-UTF8
#else
void Init() { m_pchData = (wxStringCharType *)wxEmptyString; }
void Init() { m_pchData = const_cast<wxStringCharType*>(wxEmptyString); }
#endif
// initializes the string with (a part of) C-string
void InitWith(const wxStringCharType *psz, size_t nPos = 0, size_t nLen = npos);
+3 -3
View File
@@ -640,7 +640,7 @@ private:
wxThreadInternal *m_internal;
// protects access to any methods of wxThreadInternal object
wxCriticalSection m_critsect;
mutable wxCriticalSection m_critsect;
// true if the thread is detached, false if it is joinable
bool m_isDetached;
@@ -731,7 +731,7 @@ public:
// returns a pointer to the thread which can be used to call Run()
wxThread *GetThread() const
{
wxCriticalSectionLocker locker((wxCriticalSection&)m_critSection);
wxCriticalSectionLocker locker(m_critSection);
wxThread* thread = m_thread;
@@ -741,7 +741,7 @@ public:
protected:
wxThread *m_thread;
wxThreadKind m_kind;
wxCriticalSection m_critSection; // To guard the m_thread variable
mutable wxCriticalSection m_critSection; // To guard the m_thread variable
friend class wxThreadHelperThread;
};
+1 -1
View File
@@ -1032,7 +1032,7 @@ public:
// does this window have the capture?
virtual bool HasCapture() const
{ return (wxWindow *)this == GetCapture(); }
{ return reinterpret_cast<const wxWindow*>(this) == GetCapture(); }
// enable the specified touch events for this window, return false if
// the requested events are not supported
+2 -2
View File
@@ -110,7 +110,7 @@ WXDLLIMPEXP_BASE size_t wxWC2MB(char *buf, const wchar_t *psz, size_t n);
// (notice that these intentionally return "char *" and not "void *" unlike the
// standard memxxx() for symmetry with the wide char versions):
inline char* wxTmemchr(const char* s, char c, size_t len)
{ return (char*)memchr(s, c, len); }
{ return const_cast<char*>(static_cast<const char*>(memchr(s, c, len))); }
inline int wxTmemcmp(const char* sz1, const char* sz2, size_t len)
{ return memcmp(sz1, sz2, len); }
inline char* wxTmemcpy(char* szOut, const char* szIn, size_t len)
@@ -727,7 +727,7 @@ inline char * wxStrchr(char *s, T c)
{ return const_cast<char*>(wxStrchr(const_cast<const char*>(s), c)); }
template <typename T>
inline wchar_t * wxStrchr(wchar_t *s, T c)
{ return (wchar_t *)wxStrchr((const wchar_t *)s, c); }
{ return const_cast<wchar_t*>(wxStrchr(const_cast<const wchar_t*>(s), c)); }
template <typename T>
inline char * wxStrrchr(char *s, T c)
{ return const_cast<char*>(wxStrrchr(const_cast<const char*>(s), c)); }
+1 -1
View File
@@ -28,7 +28,7 @@
#include "artbrows.h"
#define ART_CLIENT(id) \
choice->Append(#id, (void*)id);
choice->Append(#id, const_cast<void*>(static_cast<const void*>(id)));
#define ART_ICON(id) \
{ \
int ind; \
+1 -1
View File
@@ -292,7 +292,7 @@ unsigned int MyMusicTreeModel::GetChildren( const wxDataViewItem &parent,
if (node == m_classical)
{
MyMusicTreeModel *model = (MyMusicTreeModel*)(const MyMusicTreeModel*) this;
MyMusicTreeModel* model = const_cast<MyMusicTreeModel*>(this);
model->m_classicalMusicIsKnownToControl = true;
}
+1 -1
View File
@@ -2022,7 +2022,7 @@ void DnDShapeDataObject::CreateBitmap() const
m_shape->Draw(dc);
dc.SelectObject(wxNullBitmap);
DnDShapeDataObject *self = (DnDShapeDataObject *)this; // const_cast
DnDShapeDataObject* self = const_cast<DnDShapeDataObject*>(this);
self->m_dobjBitmap.SetBitmap(bitmap);
self->m_hasBitmap = true;
}
+2 -2
View File
@@ -53,7 +53,7 @@ public:
bool TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap);
//// Accessors
wxBitmap& GetBackgroundBitmap() const { return (wxBitmap&) m_background; }
const wxBitmap& GetBackgroundBitmap() const { return m_background; }
bool GetUseScreen() const { return m_useScreen; }
void SetUseScreen(bool useScreen) { m_useScreen = useScreen; }
@@ -136,7 +136,7 @@ public:
wxRect GetRect() const { return wxRect(m_pos.x, m_pos.y, m_bitmap.GetWidth(), m_bitmap.GetHeight()); }
wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; }
const wxBitmap& GetBitmap() const { return m_bitmap; }
void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
int GetDragMethod() const { return m_dragMethod; }
+2 -2
View File
@@ -634,7 +634,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
pgman->SetPropertyValue("ArrayStringProperty",test_arrstr_1);
wxColour emptyCol;
pgman->SetPropertyValue("ColourProperty",emptyCol);
pgman->SetPropertyValue("ColourProperty",(wxObject*)wxBLACK);
pgman->SetPropertyValue("ColourProperty", const_cast<wxObject*>(static_cast<const wxObject*>(wxBLACK)));
pgman->SetPropertyValue("Size",WXVARIANT(wxSize(150,150)));
pgman->SetPropertyValue("Position",WXVARIANT(wxPoint(150,150)));
pgman->SetPropertyValue("MultiChoiceProperty",test_arrint_1);
@@ -690,7 +690,7 @@ bool FormMain::RunTests( bool fullTest, bool interactive )
pg->SetPropertyValue("BoolProperty",true);
pg->SetPropertyValue("EnumProperty",80);
pg->SetPropertyValue("ArrayStringProperty",test_arrstr_2);
pg->SetPropertyValue("ColourProperty",(wxObject*)wxWHITE);
pg->SetPropertyValue("ColourProperty", const_cast<wxObject*>(static_cast<const wxObject*>(wxWHITE)));
pg->SetPropertyValue("Size",WXVARIANT(wxSize(300,300)));
pg->SetPropertyValue("Position",WXVARIANT(wxPoint(300,300)));
pg->SetPropertyValue("MultiChoiceProperty",test_arrint_2);
+2 -2
View File
@@ -1205,11 +1205,11 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
m_tab = new MyTextCtrl( this, 100, "Multiline, allow <TAB> processing.",
wxPoint(180,90), wxSize(200,70), wxTE_MULTILINE | wxTE_PROCESS_TAB );
m_tab->SetClientData((void *)wxS("tab"));
m_tab->SetClientData(const_cast<void*>(static_cast<const void*>(wxS("tab"))));
m_enter = new MyTextCtrl( this, 100, "Multiline, allow <ENTER> processing.",
wxPoint(180,170), wxSize(200,70), wxTE_MULTILINE | wxTE_PROCESS_ENTER );
m_enter->SetClientData((void *)wxS("enter"));
m_enter->SetClientData(const_cast<void*>(static_cast<const void*>(wxS("enter"))));
m_textrich = new MyTextCtrl(this, wxID_ANY, "Allows more than 30Kb of text\n"
"(on all Windows versions)\n"
+1 -1
View File
@@ -140,7 +140,7 @@ wxConfigBase *wxConfigBase::Create()
{ \
if ( IsRecordingDefaults() ) \
{ \
((wxConfigBase *)this)->DoWrite##name(key, defVal); \
const_cast<wxConfigBase*>(this)->DoWrite##name(key, defVal);\
} \
\
*val = defVal; \
+1 -1
View File
@@ -80,7 +80,7 @@ extern "C"
static int wxCMPFUNC_CONV
CompareCharsetItems(const void *i1, const void *i2)
{
return ( ((CharsetItem*)i1) -> u - ((CharsetItem*)i2) -> u );
return static_cast<const CharsetItem*>(i1)->u - static_cast<const CharsetItem*>(i2)->u;
}
}
+2 -1
View File
@@ -479,7 +479,8 @@ wxFileOffset wxFile::Length() const
wxFileOffset iLen = const_cast<wxFile *>(this)->SeekEnd();
if ( iLen != wxInvalidOffset ) {
// restore old position
if ( ((wxFile *)this)->Seek(iRc) == wxInvalidOffset ) {
if (const_cast<wxFile*>(this)->Seek(iRc) == wxInvalidOffset)
{
// error
iLen = wxInvalidOffset;
}
+1 -1
View File
@@ -945,7 +945,7 @@ static wxString wxCreateTempImpl(
wxCharBuffer buf(path.fn_str());
// cast is safe because the string length doesn't change
int fdTemp = mkstemp( (char*)(const char*) buf );
int fdTemp = mkstemp(const_cast<char*>(static_cast<const char*>(buf)));
if ( fdTemp == -1 )
{
// this might be not necessary as mkstemp() on most systems should have
+1 -1
View File
@@ -261,7 +261,7 @@ int wxFontBase::GetPointSize() const
wxSize wxFontBase::GetPixelSize() const
{
wxScreenDC dc;
dc.SetFont(*(wxFont *)this);
dc.SetFont(*static_cast<const wxFont*>(this));
return wxSize(dc.GetCharWidth(), dc.GetCharHeight());
}
+2 -2
View File
@@ -2641,7 +2641,7 @@ bool wxImage::SaveFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename),
#if HAS_FILE_STREAMS
wxCHECK_MSG( IsOk(), false, wxT("invalid image") );
((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename);
const_cast<wxImage*>(this)->SetOption(wxIMAGE_OPTION_FILENAME, filename);
wxImageFileOutputStream stream(filename);
@@ -2661,7 +2661,7 @@ bool wxImage::SaveFile( const wxString& WXUNUSED_UNLESS_STREAMS(filename),
#if HAS_FILE_STREAMS
wxCHECK_MSG( IsOk(), false, wxT("invalid image") );
((wxImage*)this)->SetOption(wxIMAGE_OPTION_FILENAME, filename);
const_cast<wxImage*>(this)->SetOption(wxIMAGE_OPTION_FILENAME, filename);
wxImageFileOutputStream stream(filename);
+6 -6
View File
@@ -360,7 +360,7 @@ int wxIFFDecoder::ReadIFF()
}
// check if we really got an IFF file
if (strncmp((char *)dataptr, "FORM", 4) != 0) {
if (strncmp(reinterpret_cast<const char*>(dataptr), "FORM", 4) != 0) {
Destroy();
return wxIFF_INVFORMAT;
}
@@ -368,7 +368,7 @@ int wxIFFDecoder::ReadIFF()
dataptr = dataptr + 8; // skip ID and length of FORM
// check if the IFF file is an ILBM (picture) file
if (strncmp((char *) dataptr, "ILBM", 4) != 0) {
if (strncmp(reinterpret_cast<const char*>(dataptr), "ILBM", 4) != 0) {
Destroy();
return wxIFF_INVFORMAT;
}
@@ -394,7 +394,7 @@ int wxIFFDecoder::ReadIFF()
}
bool truncated = (dataptr + 8 + chunkLen > dataend);
if (strncmp((char *)dataptr, "BMHD", 4) == 0) { // BMHD chunk?
if (strncmp(reinterpret_cast<const char*>(dataptr), "BMHD", 4) == 0) { // BMHD chunk?
if (chunkLen < 12 + 2 || truncated) {
break;
}
@@ -407,7 +407,7 @@ int wxIFFDecoder::ReadIFF()
BMHDok = true; // got BMHD
dataptr += 8 + chunkLen; // to next chunk
}
else if (strncmp((char *)dataptr, "CMAP", 4) == 0) { // CMAP ?
else if (strncmp(reinterpret_cast<const char*>(dataptr), "CMAP", 4) == 0) { // CMAP ?
if (truncated) {
break;
}
@@ -435,7 +435,7 @@ int wxIFFDecoder::ReadIFF()
colors);
dataptr += 8 + chunkLen; // to next chunk
} else if (strncmp((char *)dataptr, "CAMG", 4) == 0) { // CAMG ?
} else if (strncmp(reinterpret_cast<const char*>(dataptr), "CAMG", 4) == 0) { // CAMG ?
if (chunkLen < 4 || truncated) {
break;
}
@@ -443,7 +443,7 @@ int wxIFFDecoder::ReadIFF()
CAMGok = true; // got CAMG
dataptr += 8 + chunkLen; // to next chunk
}
else if (strncmp((char *)dataptr, "BODY", 4) == 0) { // BODY ?
else if (strncmp(reinterpret_cast<const char*>(dataptr), "BODY", 4) == 0) { // BODY ?
if (!BMHDok) { // BMHD found?
break;
}
+3 -3
View File
@@ -689,10 +689,10 @@ static int LINKAGEMODE
wx_comparestrings(const void *arg1, const void *arg2)
{
wxChar **s1 = (wxChar **) arg1;
wxChar **s2 = (wxChar **) arg2;
const wxChar* s1 = *static_cast<wxChar* const*>(arg1);
const wxChar* s2 = *static_cast<wxChar* const*>(arg2);
return wxStrcmp (*s1, *s2);
return wxStrcmp(s1, s2);
}
} // end of extern "C" (required because of GCC Bug c++/33078
+1 -1
View File
@@ -537,7 +537,7 @@ wxMenuItem *wxMenuBase::FindItem(int itemId, wxMenu **itemMenu) const
if ( item->GetId() == itemId )
{
if ( itemMenu )
*itemMenu = (wxMenu *)this;
*itemMenu = const_cast<wxMenu*>(static_cast<const wxMenu*>(this));
}
else if ( item->IsSubMenu() )
{
+1 -1
View File
@@ -349,7 +349,7 @@ void wxPrinterBase::ReportError(wxWindow *parent, wxPrintout *WXUNUSED(printout)
wxPrintDialogData& wxPrinterBase::GetPrintDialogData() const
{
return (wxPrintDialogData&) m_printDialogData;
return const_cast<wxPrintDialogData&>(m_printDialogData);
}
//----------------------------------------------------------------------------
+2 -2
View File
@@ -78,7 +78,7 @@ bool wxSelectSets::HasFD(int fd) const
{
for ( int n = 0; n < Max; n++ )
{
if ( wxFD_ISSET(fd, (fd_set*) &m_fds[n]) )
if ( wxFD_ISSET(fd, const_cast<fd_set*>(&m_fds[n])) )
return true;
}
@@ -113,7 +113,7 @@ bool wxSelectSets::Handle(int fd, wxFDIOHandler& handler) const
{
for ( int n = 0; n < Max; n++ )
{
if ( wxFD_ISSET(fd, (fd_set*) &m_fds[n]) )
if ( wxFD_ISSET(fd, const_cast<fd_set*>(&m_fds[n])) )
{
wxLogTrace(wxSelectDispatcher_Trace,
wxT("Got %s event on fd %d"), ms_names[n], fd);
+3 -3
View File
@@ -2047,7 +2047,7 @@ wxMBConvUTF32swap::FromWChar(char *dst, size_t dstLen,
#define ICONV_FAILED(cres, bufLeft) (cres == (size_t)-1)
#endif
#define ICONV_CHAR_CAST(x) ((ICONV_CONST char **)(x))
#define ICONV_CHAR_CAST(x) const_cast<ICONV_CONST char**>(x)
#define ICONV_T_INVALID ((iconv_t)-1)
@@ -2396,7 +2396,7 @@ size_t wxMBConv_iconv::FromWChar(char *dst, size_t dstLen,
src = tmpbuf;
}
char* inbuf = (char*)src;
const char* inbuf = reinterpret_cast<const char*>(src);
if ( dst )
{
// have destination buffer, convert there
@@ -2450,7 +2450,7 @@ size_t wxMBConv_iconv::GetMBNulLen() const
char buf[8]; // should be enough for NUL in any encoding
size_t inLen = sizeof(wchar_t),
outLen = WXSIZEOF(buf);
char *inBuff = (char *)wnul;
const char* inBuff = reinterpret_cast<const char*>(wnul);
char *outBuff = buf;
if ( iconv(w2m, ICONV_CHAR_CAST(&inBuff), &inLen, &outBuff, &outLen) == (size_t)-1 )
{
+1 -1
View File
@@ -511,7 +511,7 @@ size_t wxStreamBuffer::Write(const void *buffer, size_t size)
{
PutToBuffer(buffer, left);
size -= left;
buffer = (char *)buffer + left;
buffer = static_cast<const char*>(buffer) + left;
if ( !FlushBuffer() )
{
+5 -4
View File
@@ -1065,6 +1065,7 @@ private:
// data description
size_t32 m_numStrings; // number of strings in this domain
const
wxMsgTableEntry *m_pOrigTable, // pointer to original strings
*m_pTransTable; // translated
@@ -1079,7 +1080,7 @@ private:
: ui;
}
const char *StringAtOfs(wxMsgTableEntry *pTable, size_t32 n) const
const char* StringAtOfs(const wxMsgTableEntry* pTable, size_t32 n) const
{
const wxMsgTableEntry * const ent = pTable + n;
@@ -1155,7 +1156,7 @@ bool wxMsgCatalogFile::LoadData(const DataBuffer& data,
// examine header
bool bValid = data.length() > sizeof(wxMsgCatalogHeader);
const wxMsgCatalogHeader *pHeader = (wxMsgCatalogHeader *)data.data();
const wxMsgCatalogHeader* pHeader = reinterpret_cast<const wxMsgCatalogHeader*>(data.data());
if ( bValid ) {
// we'll have to swap all the integers if it's true
m_bSwapped = pHeader->magic == MSGCATALOG_MAGIC_SW;
@@ -1174,9 +1175,9 @@ bool wxMsgCatalogFile::LoadData(const DataBuffer& data,
// initialize
m_numStrings = Swap(pHeader->numStrings);
m_pOrigTable = (wxMsgTableEntry *)(data.data() +
m_pOrigTable = reinterpret_cast<const wxMsgTableEntry*>(data.data() +
Swap(pHeader->ofsOrigTable));
m_pTransTable = (wxMsgTableEntry *)(data.data() +
m_pTransTable = reinterpret_cast<const wxMsgTableEntry*>(data.data() +
Swap(pHeader->ofsTransTable));
// now parse catalog's header and try to extract catalog charset and
+1 -1
View File
@@ -99,7 +99,7 @@ wxObjectRefData *wxVariant::CreateRefData() const
wxObjectRefData *wxVariant::CloneRefData(const wxObjectRefData *data) const
{
return ((wxVariantData*) data)->Clone();
return static_cast<const wxVariantData*>(data)->Clone();
}
// Assignment
+10 -9
View File
@@ -1768,7 +1768,7 @@ void wxWindowBase::SetPalette(const wxPalette& pal)
wxWindow *wxWindowBase::GetAncestorWithCustomPalette() const
{
wxWindow *win = (wxWindow *)this;
wxWindow* win = const_cast<wxWindow*>(static_cast<const wxWindow*>(this));
while ( win && !win->HasCustomPalette() )
{
win = win->GetParent();
@@ -1858,7 +1858,7 @@ void wxWindowBase::ClearBackground()
wxWindow *wxWindowBase::FindWindow(long id) const
{
if ( id == m_windowId )
return (wxWindow *)this;
return const_cast<wxWindow*>(static_cast<const wxWindow*>(this));
wxWindowBase *res = NULL;
wxWindowList::compatibility_iterator node;
@@ -1874,13 +1874,13 @@ wxWindow *wxWindowBase::FindWindow(long id) const
res = child->FindWindow( id );
}
return (wxWindow *)res;
return static_cast<wxWindow*>(res);
}
wxWindow *wxWindowBase::FindWindow(const wxString& name) const
{
if ( name == m_windowName )
return (wxWindow *)this;
return const_cast<wxWindow*>(static_cast<const wxWindow*>(this));
wxWindowBase *res = NULL;
wxWindowList::compatibility_iterator node;
@@ -1895,7 +1895,7 @@ wxWindow *wxWindowBase::FindWindow(const wxString& name) const
res = child->FindWindow(name);
}
return (wxWindow *)res;
return static_cast<wxWindow*>(res);
}
@@ -1939,7 +1939,7 @@ wxWindow *wxFindWindowRecursively(const wxWindow *parent,
{
// see if this is the one we're looking for
if ( (*cmp)(parent, label, id) )
return (wxWindow *)parent;
return const_cast<wxWindow*>(parent);
// It wasn't, so check all its children
for ( wxWindowList::compatibility_iterator node = parent->GetChildren().GetFirst();
@@ -1947,7 +1947,7 @@ wxWindow *wxFindWindowRecursively(const wxWindow *parent,
node = node->GetNext() )
{
// recursively check each child
wxWindow *win = (wxWindow *)node->GetData();
wxWindow* win = static_cast<wxWindow*>(node->GetData());
wxWindow *retwin = wxFindWindowRecursively(win, label, id, cmp);
if (retwin)
return retwin;
@@ -2921,7 +2921,8 @@ wxWindowBase::ToDIP(const wxSize& sz, const wxWindowBase* w)
// using them.
wxSize wxWindowBase::GetDlgUnitBase() const
{
const wxWindowBase* const parent = wxGetTopLevelParent((wxWindow*)this);
const wxWindowBase* const parent =
wxGetTopLevelParent(const_cast<wxWindow*>(static_cast<const wxWindow*>(this)));
wxCHECK_MSG( parent, wxDefaultSize, wxS("Must have TLW parent") );
@@ -3499,7 +3500,7 @@ wxWindow *wxWindowBase::DoGetSibling(WindowOrder order) const
wxT("GetPrev/NextSibling() don't work for TLWs!") );
wxWindowList& siblings = GetParent()->GetChildren();
wxWindowList::compatibility_iterator i = siblings.Find((wxWindow *)this);
wxWindowList::compatibility_iterator i = siblings.Find(this);
wxCHECK_MSG( i, NULL, wxT("window not a child of its parent?") );
if ( order == OrderBefore )
+1 -1
View File
@@ -908,7 +908,7 @@ wxCRT_StrtoullBase(const T* nptr, T** endptr, int base, T* sign)
{
// Then it's an error.
if ( endptr )
*endptr = (T*) nptr;
*endptr = const_cast<T*>(nptr);
errno = EINVAL;
return sum;
}
+1 -1
View File
@@ -2639,7 +2639,7 @@ size_t wxZipOutputStream::OnSysWrite(const void *buffer, size_t size)
if (m_comp->Write(buffer, size).LastWrite() != size)
m_lasterror = wxSTREAM_WRITE_ERROR;
m_crcAccumulator = crc32(m_crcAccumulator, (Byte*)buffer, size);
m_crcAccumulator = crc32(m_crcAccumulator, static_cast<const Byte*>(buffer), size);
m_entrySize += m_comp->LastWrite();
return m_comp->LastWrite();
+3 -3
View File
@@ -268,7 +268,7 @@ size_t wxZlibInputStream::OnSysRead(void *buffer, size_t size)
bool wxZlibInputStream::SetDictionary(const char *data, size_t datalen)
{
return (inflateSetDictionary(m_inflate, (Bytef*)data, datalen) == Z_OK);
return inflateSetDictionary(m_inflate, reinterpret_cast<const Bytef*>(data), datalen) == Z_OK;
}
bool wxZlibInputStream::SetDictionary(const wxMemoryBuffer &buf)
@@ -400,7 +400,7 @@ size_t wxZlibOutputStream::OnSysWrite(const void *buffer, size_t size)
return 0;
int err = Z_OK;
m_deflate->next_in = (unsigned char *)buffer;
m_deflate->next_in = const_cast<unsigned char*>(static_cast<const unsigned char*>(buffer));
m_deflate->avail_in = size;
while (err == Z_OK && m_deflate->avail_in > 0) {
@@ -439,7 +439,7 @@ size_t wxZlibOutputStream::OnSysWrite(const void *buffer, size_t size)
bool wxZlibOutputStream::SetDictionary(const char *data, size_t datalen)
{
return (deflateSetDictionary(m_deflate, (Bytef*)data, datalen) == Z_OK);
return deflateSetDictionary(m_deflate, reinterpret_cast<const Bytef*>(data), datalen) == Z_OK;
}
bool wxZlibOutputStream::SetDictionary(const wxMemoryBuffer &buf)
+1 -1
View File
@@ -213,7 +213,7 @@ wxObjectRefData *wxAcceleratorTable::CreateRefData() const
wxObjectRefData *wxAcceleratorTable::CloneRefData(const wxObjectRefData *data) const
{
return new wxAccelRefData(*(wxAccelRefData *)data);
return new wxAccelRefData(*static_cast<const wxAccelRefData*>(data));
}
#endif // wxUSE_ACCEL
+2 -2
View File
@@ -3913,8 +3913,8 @@ int wxDataViewMainWindow::RecalculateCount() const
{
if (IsVirtualList())
{
wxDataViewVirtualListModel *list_model =
(wxDataViewVirtualListModel*) GetModel();
const wxDataViewVirtualListModel* list_model =
static_cast<const wxDataViewVirtualListModel*>(GetModel());
return list_model->GetCount();
}
+2 -7
View File
@@ -2253,13 +2253,8 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string,
/* JC: calculate UnderlineThickness/UnderlinePosition */
// VS: dirty, but is there any better solution?
double *pt;
pt = (double*) &m_underlinePosition;
*pt = YLOG2DEVREL((wxCoord)(UnderlinePosition * fontSize)) / 1000.0f;
pt = (double*) &m_underlineThickness;
*pt = YLOG2DEVREL((wxCoord)(UnderlineThickness * fontSize)) / 1000.0f;
m_underlinePosition = YLOG2DEVREL(int(UnderlinePosition * fontSize)) / 1000.0;
m_underlineThickness = YLOG2DEVREL(int(UnderlineThickness * fontSize)) / 1000.0;
}
+4 -4
View File
@@ -1020,7 +1020,7 @@ void wxCairoPenData::Apply( wxGraphicsContext* context )
cairo_set_line_width(ctext,m_width);
cairo_set_line_cap(ctext,m_cap);
cairo_set_line_join(ctext,m_join);
cairo_set_dash(ctext,(double*)m_lengths,m_count,0.0);
cairo_set_dash(ctext, m_lengths, m_count, 0);
}
//-----------------------------------------------------------------------------
@@ -1504,7 +1504,7 @@ void wxCairoMatrixData::TransformDistance( wxDouble *dx, wxDouble *dy ) const
// returns the native representation
void * wxCairoMatrixData::GetNativeMatrix() const
{
return (void*) &m_matrix;
return const_cast<cairo_matrix_t*>(&m_matrix);
}
// ----------------------------------------------------------------------------
@@ -1954,7 +1954,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxWindowDC&
cairo_t* cr = static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext());
Init(cr ? cairo_reference(cr) : NULL);
#elif defined __WXGTK20__
wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl();
const wxGTKDCImpl* impldc = static_cast<const wxGTKDCImpl*>(dc.GetImpl());
Init( gdk_cairo_create( impldc->GetGDKWindow() ) );
// Transfer transformation settings from source DC to Cairo context on our own.
@@ -2167,7 +2167,7 @@ wxCairoContext::wxCairoContext( wxGraphicsRenderer* renderer, const wxMemoryDC&
cairo_t* cr = static_cast<cairo_t*>(dc.GetImpl()->GetCairoContext());
Init(cr ? cairo_reference(cr) : NULL);
#elif defined __WXGTK20__
wxGTKDCImpl *impldc = (wxGTKDCImpl*) dc.GetImpl();
const wxGTKDCImpl* impldc = static_cast<const wxGTKDCImpl*>(dc.GetImpl());
Init( gdk_cairo_create( impldc->GetGDKWindow() ) );
// Transfer transformation settings from source DC to Cairo context on our own.
+2 -2
View File
@@ -7025,7 +7025,7 @@ bool wxGrid::IsCellEditControlShown() const
int row = m_currentCellCoords.GetRow();
int col = m_currentCellCoords.GetCol();
wxGridCellAttr* attr = GetCellAttr(row, col);
wxGridCellEditor* editor = attr->GetEditor((wxGrid*) this, row, col);
wxGridCellEditor* editor = attr->GetEditor(this, row, col);
attr->DecRef();
if ( editor )
@@ -8743,7 +8743,7 @@ wxGridCellAttr *wxGrid::GetCellAttr(int row, int col) const
wxGridCellAttr *wxGrid::GetOrCreateCellAttr(int row, int col) const
{
wxGridCellAttr *attr = NULL;
bool canHave = ((wxGrid*)this)->CanHaveAttributes();
const bool canHave = CanHaveAttributes();
wxCHECK_MSG( canHave, attr, wxT("Cell attributes not allowed"));
wxCHECK_MSG( m_table, attr, wxT("must have a table") );
+1 -1
View File
@@ -125,7 +125,7 @@ void wxGenericHyperlinkCtrl::ConnectMenuHandlers()
wxSize wxGenericHyperlinkCtrl::DoGetBestClientSize() const
{
wxClientDC dc((wxWindow *)this);
wxClientDC dc(const_cast<wxGenericHyperlinkCtrl*>(this));
return dc.GetTextExtent(GetLabel());
}
+1 -1
View File
@@ -41,6 +41,6 @@ wxIcon::wxIcon() : wxBitmap()
void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
{
wxIcon *icon = (wxIcon*)(&bmp);
const wxIcon* icon = static_cast<const wxIcon*>(&bmp);
*this = *icon;
}
+5 -13
View File
@@ -711,7 +711,7 @@ static void gtk_assert_dialog_init(GTypeInstance* instance, void*)
/* icon */
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
image = gtk_image_new_from_stock("gtk-dialog-error", GTK_ICON_SIZE_DIALOG);
wxGCC_WARNING_RESTORE()
gtk_box_pack_start (GTK_BOX(hbox), image, FALSE, FALSE, 12);
@@ -768,15 +768,11 @@ static void gtk_assert_dialog_init(GTypeInstance* instance, void*)
gtk_button_box_set_layout (GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END);
/* add the buttons */
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
button = gtk_assert_dialog_add_button_to (GTK_BOX(hbox), "Save to _file", GTK_STOCK_SAVE);
wxGCC_WARNING_RESTORE()
button = gtk_assert_dialog_add_button_to(GTK_BOX(hbox), "Save to _file", "gtk-save");
g_signal_connect (button, "clicked",
G_CALLBACK(gtk_assert_dialog_save_backtrace_callback), dlg);
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
button = gtk_assert_dialog_add_button_to (GTK_BOX(hbox), "Copy to clip_board", GTK_STOCK_COPY);
wxGCC_WARNING_RESTORE()
button = gtk_assert_dialog_add_button_to(GTK_BOX(hbox), "Copy to clip_board", "gtk-copy");
g_signal_connect (button, "clicked", G_CALLBACK(gtk_assert_dialog_copy_callback), dlg);
}
#endif // wxUSE_STACKWALKER
@@ -789,14 +785,10 @@ static void gtk_assert_dialog_init(GTypeInstance* instance, void*)
wxGCC_WARNING_RESTORE()
/* add the stop button */
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
gtk_assert_dialog_add_button (dlg, "_Stop", GTK_STOCK_QUIT, GTK_ASSERT_DIALOG_STOP);
wxGCC_WARNING_RESTORE()
gtk_assert_dialog_add_button(dlg, "_Stop", "gtk-quit", GTK_ASSERT_DIALOG_STOP);
/* add the continue button */
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
continuebtn = gtk_assert_dialog_add_button (dlg, "_Continue", GTK_STOCK_YES, GTK_ASSERT_DIALOG_CONTINUE);
wxGCC_WARNING_RESTORE()
continuebtn = gtk_assert_dialog_add_button(dlg, "_Continue", "gtk-yes", GTK_ASSERT_DIALOG_CONTINUE);
gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_ASSERT_DIALOG_CONTINUE);
g_signal_connect (continuebtn, "clicked", G_CALLBACK(gtk_assert_dialog_continue_callback), dlg);
+1 -1
View File
@@ -87,7 +87,7 @@ wxGDIRefData *wxBrush::CreateGDIRefData() const
wxGDIRefData *wxBrush::CloneGDIRefData(const wxGDIRefData *data) const
{
return new wxBrushRefData(*(wxBrushRefData *)data);
return new wxBrushRefData(*static_cast<const wxBrushRefData*>(data));
}
bool wxBrush::operator==(const wxBrush& brush) const
+1 -1
View File
@@ -184,7 +184,7 @@ wxSize wxButtonBase::GetDefaultSize(wxWindow* WXUNUSED(win))
GtkWidget *btn = gtk_button_new_with_mnemonic(labelGTK.utf8_str());
#else
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
GtkWidget *btn = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
GtkWidget* btn = gtk_button_new_from_stock("gtk-cancel");
wxGCC_WARNING_RESTORE()
#endif
gtk_container_add(GTK_CONTAINER(box), btn);
+2 -2
View File
@@ -160,7 +160,7 @@ targets_selection_received( GtkWidget *WXUNUSED(widget),
clip.GetId().c_str() );
// the atoms we received, holding a list of targets (= formats)
const GdkAtom* const atoms = (GdkAtom*)gtk_selection_data_get_data(selection_data);
const GdkAtom* const atoms = reinterpret_cast<const GdkAtom*>(gtk_selection_data_get_data(selection_data));
for (size_t i = 0; i < selection_data_length / sizeof(GdkAtom); i++)
{
const wxDataFormat format(atoms[i]);
@@ -406,7 +406,7 @@ async_targets_selection_received( GtkWidget *WXUNUSED(widget),
clip.GetId().c_str() );
// the atoms we received, holding a list of targets (= formats)
const GdkAtom* const atoms = (GdkAtom*)gtk_selection_data_get_data(selection_data);
const GdkAtom* const atoms = reinterpret_cast<const GdkAtom*>(gtk_selection_data_get_data(selection_data));
for (size_t i = 0; i < selection_data_length / sizeof(GdkAtom); i++)
{
const wxDataFormat format(atoms[i]);
+3 -3
View File
@@ -745,7 +745,7 @@ void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset
}
if (m_gdkwindow)
gdk_draw_lines( m_gdkwindow, m_penGC, (GdkPoint*) gpts, n);
gdk_draw_lines(m_gdkwindow, m_penGC, const_cast<GdkPoint*>(gpts), n);
delete[] gpts_alloc;
}
@@ -791,7 +791,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
bool originChanged;
DrawingSetup(gc, originChanged);
gdk_draw_polygon(m_gdkwindow, gc, true, (GdkPoint*) gdkpoints, n);
gdk_draw_polygon(m_gdkwindow, gc, true, const_cast<GdkPoint*>(gdkpoints), n);
if (originChanged)
gdk_gc_set_ts_origin(gc, 0, 0);
@@ -809,7 +809,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
gdkpoints[(i+1)%n].y);
}
*/
gdk_draw_polygon( m_gdkwindow, m_penGC, FALSE, (GdkPoint*) gdkpoints, n );
gdk_draw_polygon(m_gdkwindow, m_penGC, false, const_cast<GdkPoint*>(gdkpoints), n);
}
}
+3 -8
View File
@@ -85,9 +85,6 @@ bool wxDirDialog::Create(wxWindow* parent,
if (parent)
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
#ifndef __WXGTK4__
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
#endif
m_widget = gtk_file_chooser_dialog_new(
wxGTK_CONV(m_message),
gtk_parent,
@@ -95,19 +92,17 @@ bool wxDirDialog::Create(wxWindow* parent,
#ifdef __WXGTK4__
static_cast<const char*>(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL)))),
#else
GTK_STOCK_CANCEL,
"gtk-cancel",
#endif
GTK_RESPONSE_CANCEL,
#ifdef __WXGTK4__
static_cast<const char*>(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_OPEN)))),
#else
GTK_STOCK_OPEN,
"gtk-open",
#endif
GTK_RESPONSE_ACCEPT,
NULL);
#ifndef __WXGTK4__
wxGCC_WARNING_RESTORE()
#endif
g_object_ref(m_widget);
gtk_dialog_set_default_response(GTK_DIALOG(m_widget), GTK_RESPONSE_ACCEPT);
+4 -9
View File
@@ -213,9 +213,6 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message,
if (parent)
gtk_parent = GTK_WINDOW( gtk_widget_get_toplevel(parent->m_widget) );
#ifndef __WXGTK4__
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
#endif
wxString ok_btn_stock;
if ( style & wxFD_SAVE )
{
@@ -223,7 +220,7 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message,
#ifdef __WXGTK4__
ok_btn_stock = wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_SAVE));
#else
ok_btn_stock = GTK_STOCK_SAVE;
ok_btn_stock = "gtk-save";
#endif
}
else
@@ -232,7 +229,7 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message,
#ifdef __WXGTK4__
ok_btn_stock = wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_OPEN));
#else
ok_btn_stock = GTK_STOCK_OPEN;
ok_btn_stock = "gtk-open";
#endif
}
@@ -243,14 +240,12 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message,
#ifdef __WXGTK4__
static_cast<const gchar*>(wxGTK_CONV(wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL)))),
#else
GTK_STOCK_CANCEL,
"gtk-cancel",
#endif
GTK_RESPONSE_CANCEL,
static_cast<const gchar*>(wxGTK_CONV(ok_btn_stock)), GTK_RESPONSE_ACCEPT,
NULL);
#ifndef __WXGTK4__
wxGCC_WARNING_RESTORE()
#endif
g_object_ref(m_widget);
GtkFileChooser* file_chooser = GTK_FILE_CHOOSER(m_widget);
+2
View File
@@ -1349,6 +1349,7 @@ wxGetGtkAccel(const wxMenuItem* item, guint* accel_key, GdkModifierType* accel_m
#ifndef __WXGTK4__
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
wxGCC_WARNING_SUPPRESS(cast-qual)
const char *wxGetStockGtkID(wxWindowID id)
{
#define STOCKITEM(wx,gtk) \
@@ -1451,6 +1452,7 @@ const char *wxGetStockGtkID(wxWindowID id)
return NULL;
}
wxGCC_WARNING_RESTORE(cast-qual)
wxGCC_WARNING_RESTORE()
#endif // !__WXGTK4__
+5 -15
View File
@@ -52,9 +52,7 @@ wxString wxMessageDialog::GetDefaultYesLabel() const
#ifdef __WXGTK4__
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_YES));
#else
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
return GTK_STOCK_YES;
wxGCC_WARNING_RESTORE()
return "gtk-yes";
#endif
}
@@ -63,9 +61,7 @@ wxString wxMessageDialog::GetDefaultNoLabel() const
#ifdef __WXGTK4__
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_NO));
#else
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
return GTK_STOCK_NO;
wxGCC_WARNING_RESTORE()
return "gtk-no";
#endif
}
@@ -74,9 +70,7 @@ wxString wxMessageDialog::GetDefaultOKLabel() const
#ifdef __WXGTK4__
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_OK));
#else
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
return GTK_STOCK_OK;
wxGCC_WARNING_RESTORE()
return "gtk-ok";
#endif
}
@@ -85,9 +79,7 @@ wxString wxMessageDialog::GetDefaultCancelLabel() const
#ifdef __WXGTK4__
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_CANCEL));
#else
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
return GTK_STOCK_CANCEL;
wxGCC_WARNING_RESTORE()
return "gtk-cancel";
#endif
}
@@ -96,9 +88,7 @@ wxString wxMessageDialog::GetDefaultHelpLabel() const
#ifdef __WXGTK4__
return wxConvertMnemonicsToGTK(wxGetStockLabel(wxID_HELP));
#else
wxGCC_WARNING_SUPPRESS(deprecated-declarations)
return GTK_STOCK_HELP;
wxGCC_WARNING_RESTORE()
return "gtk-help";
#endif
}
+3 -3
View File
@@ -127,7 +127,7 @@ wxGDIRefData *wxPen::CreateGDIRefData() const
wxGDIRefData *wxPen::CloneGDIRefData(const wxGDIRefData *data) const
{
return new wxPenRefData(*(wxPenRefData *)data);
return new wxPenRefData(*static_cast<const wxPenRefData*>(data));
}
bool wxPen::operator == ( const wxPen& pen ) const
@@ -193,7 +193,7 @@ int wxPen::GetDashes( wxDash **ptr ) const
{
wxCHECK_MSG( IsOk(), -1, wxT("invalid pen") );
*ptr = (wxDash*)M_PENDATA->m_dash;
*ptr = const_cast<wxDash*>(M_PENDATA->m_dash);
return M_PENDATA->m_countDashes;
}
@@ -208,7 +208,7 @@ wxDash* wxPen::GetDash() const
{
wxCHECK_MSG( IsOk(), NULL, wxT("invalid pen") );
return (wxDash*)M_PENDATA->m_dash;
return const_cast<wxDash*>(M_PENDATA->m_dash);
}
wxPenCap wxPen::GetCap() const
+2 -2
View File
@@ -188,13 +188,13 @@ void wxSpinButton::DoEnable(bool enable)
void wxSpinButton::GtkDisableEvents() const
{
g_signal_handlers_block_by_func(m_widget,
(gpointer)gtk_value_changed, (void*) this);
(void*)gtk_value_changed, const_cast<wxSpinButton*>(this));
}
void wxSpinButton::GtkEnableEvents() const
{
g_signal_handlers_unblock_by_func(m_widget,
(gpointer)gtk_value_changed, (void*) this);
(void*)gtk_value_changed, const_cast<wxSpinButton*>(this));
}
GdkWindow *wxSpinButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED_IN_GTK2(windows)) const
+6 -12
View File
@@ -291,22 +291,16 @@ void wxSpinCtrlGTKBase::DoSetIncrement(double inc)
gtk_spin_button_set_increments( GTK_SPIN_BUTTON(m_widget), inc, page);
}
void wxSpinCtrlGTKBase::GtkDisableEvents() const
void wxSpinCtrlGTKBase::GtkDisableEvents()
{
g_signal_handlers_block_by_func( m_widget,
(gpointer)gtk_value_changed, (void*) this);
g_signal_handlers_block_by_func(m_widget,
(gpointer)gtk_changed, (void*) this);
g_signal_handlers_block_by_func(m_widget, (void*)gtk_value_changed, this);
g_signal_handlers_block_by_func(m_widget, (void*)gtk_changed, this);
}
void wxSpinCtrlGTKBase::GtkEnableEvents() const
void wxSpinCtrlGTKBase::GtkEnableEvents()
{
g_signal_handlers_unblock_by_func(m_widget,
(gpointer)gtk_value_changed, (void*) this);
g_signal_handlers_unblock_by_func(m_widget,
(gpointer)gtk_changed, (void*) this);
g_signal_handlers_unblock_by_func(m_widget, (void*)gtk_value_changed, this);
g_signal_handlers_unblock_by_func(m_widget, (void*)gtk_changed, this);
}
void wxSpinCtrlGTKBase::OnChar( wxKeyEvent &event )
+1 -1
View File
@@ -66,7 +66,7 @@ wxGtkTextRemoveTagsWithPrefix(GtkTextBuffer *text_buffer,
text_buffer,
"remove_tag",
G_CALLBACK(wxGtkOnRemoveTag),
gpointer(prefix)
const_cast<void*>(static_cast<const void*>(prefix))
);
gtk_text_buffer_remove_all_tags(text_buffer, start, end);
g_signal_handler_disconnect(text_buffer, remove_handler_id);
+1 -1
View File
@@ -5182,7 +5182,7 @@ void wxWindowGTK::GTKSendPaintEvents(const GdkRegion* region)
GTK_SHADOW_NONE,
&rect,
parent->m_widget,
(char *)"base",
const_cast<char*>("base"),
0, 0, w, h);
#endif // !__WXGTK3__
}
+1 -1
View File
@@ -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()));
}
}
+2 -2
View File
@@ -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
}
}
+2 -2
View File
@@ -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;
+6 -10
View File
@@ -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);
}
+3 -3
View File
@@ -989,7 +989,7 @@ void wxMSWDCImpl::DoDrawPolygon(int n,
CalcBoundingBox(points[i].x, points[i].y);
int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING);
(void)Polygon(GetHdc(), (POINT*) points, n);
Polygon(GetHdc(), reinterpret_cast<const POINT*>(points), n);
SetPolyFillMode(GetHdc(),prev);
}
}
@@ -1029,7 +1029,7 @@ wxMSWDCImpl::DoDrawPolyPolygon(int n,
CalcBoundingBox(points[i].x, points[i].y);
int prev = SetPolyFillMode(GetHdc(),fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING);
(void)PolyPolygon(GetHdc(), (POINT*) points, count, n);
PolyPolygon(GetHdc(), reinterpret_cast<const POINT*>(points), count, n);
SetPolyFillMode(GetHdc(),prev);
}
}
@@ -1057,7 +1057,7 @@ void wxMSWDCImpl::DoDrawLines(int n, const wxPoint points[], wxCoord xoffset, wx
for (i = 0; i < n; i++)
CalcBoundingBox(points[i].x, points[i].y);
(void)Polyline(GetHdc(), (POINT*) points, n);
Polyline(GetHdc(), reinterpret_cast<const POINT*>(points), n);
}
}
+4 -4
View File
@@ -565,7 +565,7 @@ wxDDEConnection::DoExecute(const void *data, size_t size, wxIPCFormat format)
}
else // no conversion necessary for wxIPC_UNICODETEXT
{
realData = (LPBYTE)data;
realData = const_cast<BYTE*>(static_cast<const BYTE*>(data));
realSize = size;
}
@@ -689,7 +689,7 @@ bool wxDDEConnection::DoPoke(const wxString& item, const void *data, size_t size
DWORD result;
HSZ item_atom = DDEGetAtom(item);
bool ok = DdeClientTransaction((LPBYTE)data,
bool ok = DdeClientTransaction(const_cast<BYTE*>(static_cast<const BYTE*>(data)),
size,
GetHConv(),
item_atom, format,
@@ -952,7 +952,7 @@ _DDECallback(UINT wType,
}
HDDEDATA handle = DdeCreateDataHandle(DDEIdInst,
(LPBYTE)data,
const_cast<BYTE*>(static_cast<const BYTE*>(data)),
user_size,
0,
hsz2,
@@ -1035,7 +1035,7 @@ _DDECallback(UINT wType,
HDDEDATA data = DdeCreateDataHandle
(
DDEIdInst,
(LPBYTE)connection->m_sendingData,
const_cast<BYTE*>(static_cast<const BYTE*>(connection->m_sendingData)),
connection->m_dataSize,
0,
hsz2,
+2 -2
View File
@@ -348,7 +348,7 @@ HBITMAP wxDIB::CreateDDB(HDC hdc) const
}
/* static */
HBITMAP wxDIB::ConvertToBitmap(const BITMAPINFO *pbmi, HDC hdc, void *bits)
HBITMAP wxDIB::ConvertToBitmap(const BITMAPINFO *pbmi, HDC hdc, const void *bits)
{
wxCHECK_MSG( pbmi, 0, wxT("invalid DIB in ConvertToBitmap") );
@@ -389,7 +389,7 @@ HBITMAP wxDIB::ConvertToBitmap(const BITMAPINFO *pbmi, HDC hdc, void *bits)
numColors = 0;
}
bits = (char *)pbmih + sizeof(*pbmih) + numColors*sizeof(RGBQUAD);
bits = reinterpret_cast<const char*>(pbmih + 1) + numColors * sizeof(RGBQUAD);
}
HBITMAP hbmp = ::CreateDIBitmap
+1 -1
View File
@@ -292,7 +292,7 @@ int wxDirDialog::ShowSHBrowseForFolder(WXHWND owner)
// do show the dialog
wxItemIdList pidl(SHBrowseForFolder(&bi));
wxItemIdList::Free((LPITEMIDLIST)bi.pidlRoot);
wxItemIdList::Free(const_cast<LPITEMIDLIST>(bi.pidlRoot));
if ( !pidl )
{
+2 -2
View File
@@ -480,7 +480,7 @@ bool wxEnhMetaFileDataObject::SetData(const wxDataFormat& format,
if ( format == wxDF_ENHMETAFILE )
{
hEMF = *(HENHMETAFILE *)buf;
hEMF = *static_cast<const HENHMETAFILE*>(buf);
wxCHECK_MSG( hEMF, false, wxT("pasting invalid enh metafile") );
}
@@ -555,7 +555,7 @@ bool wxEnhMetaFileSimpleDataObject::GetDataHere(void *buf) const
bool wxEnhMetaFileSimpleDataObject::SetData(size_t WXUNUSED(len),
const void *buf)
{
HENHMETAFILE hEMF = *(HENHMETAFILE *)buf;
HENHMETAFILE hEMF = *static_cast<const HENHMETAFILE*>(buf);
wxCHECK_MSG( hEMF, false, wxT("pasting invalid enh metafile") );
m_metafile.SetHENHMETAFILE((WXHANDLE)hEMF);
+3 -3
View File
@@ -411,7 +411,7 @@ wxBitmap wxImageList::GetBitmap(int index) const
if ( ii.hbmMask )
{
// draw it the first time to find a suitable mask colour
((wxImageList*)this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT);
const_cast<wxImageList*>(this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT);
dc.SelectObject(wxNullBitmap);
// find the suitable mask colour
@@ -426,7 +426,7 @@ wxBitmap wxImageList::GetBitmap(int index) const
// redraw icon over the mask colour to actually draw it
dc.SelectObject(bitmap);
((wxImageList*)this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT);
const_cast<wxImageList*>(this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_TRANSPARENT);
dc.SelectObject(wxNullBitmap);
// get the image, set the mask colour and convert back to get transparent bitmap
@@ -437,7 +437,7 @@ wxBitmap wxImageList::GetBitmap(int index) const
else // no mask
{
// Just draw it normally.
((wxImageList*)this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_NORMAL);
const_cast<wxImageList*>(this)->Draw(index, dc, 0, 0, wxIMAGELIST_DRAW_NORMAL);
dc.SelectObject(wxNullBitmap);
// And adjust its alpha flag as the destination bitmap would get it if
+1 -1
View File
@@ -695,7 +695,7 @@ bool wxQTMediaBackend::Load(const wxString& fileName)
FSSpec sfFile;
OSErr err = m_lib.NativePathNameToFSSpec(
(char*) (const char*) fileName.mb_str(),
const_cast<char*>(static_cast<const char*>(fileName.mb_str())),
&sfFile, 0);
bool result = (err == noErr);
+1 -1
View File
@@ -1225,7 +1225,7 @@ wxColour wxNotebook::GetThemeBackgroundColour() const
#if wxUSE_UXTHEME
if (wxUxThemeIsActive())
{
wxUxThemeHandle hTheme((wxNotebook*) this, L"TAB");
wxUxThemeHandle hTheme(this, L"TAB");
if (hTheme)
{
// This is total guesswork.
+1 -1
View File
@@ -768,7 +768,7 @@ namespace
const int invalid_entry_marker = 0;
}
wxVariant wxActiveXEvents::ms_invalidEntryMarker((void*)&invalid_entry_marker);
wxVariant wxActiveXEvents::ms_invalidEntryMarker(static_cast<const void*>(&invalid_entry_marker));
size_t wxActiveXEvent::ParamCount() const
{
+1 -1
View File
@@ -567,7 +567,7 @@ bool wxAutomationObject::GetInstance(const wxString& progId, int flags) const
return false;
}
hr = pUnk->QueryInterface(IID_IDispatch, (LPVOID*) &m_dispatchPtr);
hr = pUnk->QueryInterface(IID_IDispatch, const_cast<void**>(&m_dispatchPtr));
if (FAILED(hr))
{
wxLogSysError(hr,
+2 -2
View File
@@ -1114,7 +1114,7 @@ bool wxBitmapDataObject2::GetDataHere(void *pBuf) const
bool wxBitmapDataObject2::SetData(size_t WXUNUSED(len), const void *pBuf)
{
HBITMAP hbmp = *(HBITMAP *)pBuf;
HBITMAP hbmp = *static_cast<const HBITMAP*>(pBuf);
BITMAP bmp;
if ( !GetObject(hbmp, sizeof(BITMAP), &bmp) )
@@ -1273,7 +1273,7 @@ bool wxFileDataObject::SetData(size_t WXUNUSED(size),
// ((char *)&(pDropFiles.pFiles)) + pDropFiles.pFiles. We're also advised
// to use DragQueryFile to work with this structure, but not told where and
// how to get HDROP.
HDROP hdrop = (HDROP)pData; // NB: it works, but I'm not sure about it
HDROP hdrop = static_cast<HDROP>(const_cast<void*>(pData)); // NB: it works, but I'm not sure about it
// get number of files (magic value -1)
UINT nFiles = ::DragQueryFile(hdrop, (unsigned)-1, NULL, 0u);
+1 -1
View File
@@ -138,7 +138,7 @@ bool Uuid::Set(const wxChar *pc)
{
// get UUID from string
#ifdef _UNICODE
if ( UuidFromString((unsigned short *)pc, &m_uuid) != RPC_S_OK)
if (UuidFromString(reinterpret_cast<RPC_WSTR>(const_cast<wxChar*>(pc)), &m_uuid) != RPC_S_OK)
#else
if ( UuidFromString((wxUChar *)pc, &m_uuid) != RPC_S_OK)
#endif
+1 -1
View File
@@ -442,7 +442,7 @@ wxProgressDialog::~wxProgressDialog()
DWORD rc = ::MsgWaitForMultipleObjects
(
1, // number of objects to wait for
(HANDLE *)&hThread, // the objects
&hThread, // the objects
false, // wait for any objects, not all
INFINITE, // no timeout
QS_ALLINPUT | // return as soon as there are any events
+4 -4
View File
@@ -481,11 +481,11 @@ size_t wxRegConfig::GetNumberOfEntries(bool WXUNUSED(bRecursive)) const
// dummy vars
wxString str;
long l;
bool bCont = ((wxRegConfig*)this)->GetFirstEntry(str, l);
bool bCont = GetFirstEntry(str, l);
while ( bCont ) {
nEntries++;
bCont = ((wxRegConfig*)this)->GetNextEntry(str, l);
bCont = GetNextEntry(str, l);
}
return nEntries;
@@ -498,11 +498,11 @@ size_t wxRegConfig::GetNumberOfGroups(bool WXUNUSED(bRecursive)) const
// dummy vars
wxString str;
long l;
bool bCont = ((wxRegConfig*)this)->GetFirstGroup(str, l);
bool bCont = GetFirstGroup(str, l);
while ( bCont ) {
nGroups++;
bCont = ((wxRegConfig*)this)->GetNextGroup(str, l);
bCont = GetNextGroup(str, l);
}
return nGroups;
+2 -2
View File
@@ -135,7 +135,7 @@ wxRegion::wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle)
m_refData = new wxRegionRefData;
M_REGION = ::CreatePolygonRgn
(
(POINT*)points,
reinterpret_cast<const POINT*>(points),
n,
fillStyle == wxODDEVEN_RULE ? ALTERNATE : WINDING
);
@@ -153,7 +153,7 @@ wxGDIRefData *wxRegion::CreateGDIRefData() const
wxGDIRefData *wxRegion::CloneGDIRefData(const wxGDIRefData *data) const
{
return new wxRegionRefData(*(wxRegionRefData *)data);
return new wxRegionRefData(*static_cast<const wxRegionRefData*>(data));
}
// ----------------------------------------------------------------------------
+2 -6
View File
@@ -87,11 +87,7 @@ aStdKeys[] =
// macros
// ----------------------------------------------------------------------------
// const_cast<> is not yet supported by all compilers
#define CONST_CAST ((wxRegKey *)this)->
// and neither is mutable which m_dwLastError should be
#define m_dwLastError CONST_CAST m_dwLastError
#define CONST_CAST const_cast<wxRegKey*>(this)->
// ----------------------------------------------------------------------------
// non member functions
@@ -1071,7 +1067,7 @@ bool wxRegKey::SetValue(const wxString& szValue, const wxString& strValue)
m_dwLastError = RegSetValueEx((HKEY) m_hKey,
RegValueStr(szValue),
(DWORD) RESERVED, REG_SZ,
(RegString)wxMSW_CONV_LPCTSTR(strValue),
reinterpret_cast<const BYTE*>(wxMSW_CONV_LPCTSTR(strValue)),
(strValue.Len() + 1)*sizeof(wxChar));
if ( m_dwLastError == ERROR_SUCCESS )
return true;
+1 -1
View File
@@ -401,7 +401,7 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate,
m_hWnd = (WXHWND)::CreateDialogIndirect
(
wxGetInstance(),
(DLGTEMPLATE*)dlgTemplate,
static_cast<const DLGTEMPLATE*>(dlgTemplate),
parent ? GetHwndOf(parent) : NULL,
(DLGPROC)wxDlgProc
);
+2 -2
View File
@@ -812,9 +812,9 @@ bool wxShell(const wxString& command)
{
wxString cmd;
wxChar *shell = wxGetenv(wxT("COMSPEC"));
const wxChar* shell = wxGetenv(wxT("COMSPEC"));
if ( !shell )
shell = (wxChar*) wxT("\\COMMAND.COM");
shell = wxT("\\COMMAND.COM");
if ( !command )
{
+1 -1
View File
@@ -520,7 +520,7 @@ size_t wxPipeOutputStream::OnSysWrite(const void *buffer, size_t len)
if ( !chunkWritten )
break;
buffer = (char *)buffer + chunkWritten;
buffer = static_cast<const char*>(buffer) + chunkWritten;
totalWritten += chunkWritten;
len -= chunkWritten;
}
+1 -1
View File
@@ -638,7 +638,7 @@ wxSize wxFont::GetPixelSize() const
#if wxUSE_GRAPHICS_CONTEXT
// TODO: consider caching the value
wxGraphicsContext* dc = wxGraphicsContext::CreateFromNative((CGContextRef)NULL);
dc->SetFont(*(wxFont*)this, *wxBLACK);
dc->SetFont(*this, *wxBLACK);
wxDouble width, height = 0;
dc->GetTextExtent(wxT("g"), &width, &height, NULL, NULL);
delete dc;
+3 -2
View File
@@ -187,7 +187,8 @@ wxMetaFile::CloneGDIRefData(const wxGDIRefData * WXUNUSED(data)) const
WXHMETAFILE wxMetaFile::GetHMETAFILE() const
{
return (WXHMETAFILE) (CFDataRef) M_METAFILEDATA->GetData();
const void* p = M_METAFILEDATA->GetData();
return static_cast<WXHMETAFILE>(const_cast<void*>(p));
}
bool wxMetaFile::SetClipboard(int WXUNUSED(width), int WXUNUSED(height))
@@ -340,7 +341,7 @@ bool wxMetafileDataObject::GetDataHere(void *buf) const
bool wxMetafileDataObject::SetData(size_t len, const void *buf)
{
wxMetafileRefData* metafiledata = new wxMetafileRefData(wxCFRefFromGet(wxCFDataRef((UInt8*)buf, len).get()));
wxMetafileRefData* metafiledata = new wxMetafileRefData(wxCFRefFromGet(wxCFDataRef(static_cast<const UInt8*>(buf), len).get()));
m_metafile.UnRef();
m_metafile.SetRefData( metafiledata );
return true;
+6 -6
View File
@@ -173,7 +173,7 @@ wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData &tocopy) : wxGDIRefData()
UseAlpha(true);
unsigned char* dest = (unsigned char*)GetRawAccess();
unsigned char* source = (unsigned char*)tocopy.GetRawAccess();
const unsigned char* source = static_cast<const unsigned char*>(tocopy.GetRawAccess());
size_t numbytes = GetBytesPerRow() * GetHeight();
memcpy( dest, source, numbytes );
}
@@ -780,7 +780,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
if ( the_width % 8 )
linesize++;
unsigned char* linestart = (unsigned char*) bits ;
const unsigned char* linestart = reinterpret_cast<const unsigned char*>(bits);
unsigned char* destptr = (unsigned char*) GetBitmapData()->BeginRawAccess() ;
for ( int y = 0 ; y < the_height ; ++y , linestart += linesize, destptr += GetBitmapData()->GetBytesPerRow() )
@@ -949,7 +949,7 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
int destheight = rect.height*scale ;
{
unsigned char *sourcedata = (unsigned char*) GetBitmapData()->GetRawAccess() ;
const unsigned char* sourcedata = static_cast<const unsigned char*>(GetBitmapData()->GetRawAccess());
unsigned char *destdata = (unsigned char*) ret.GetBitmapData()->BeginRawAccess() ;
wxASSERT((sourcedata != NULL) && (destdata != NULL));
@@ -957,7 +957,7 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
{
int sourcelinesize = GetBitmapData()->GetBytesPerRow() ;
int destlinesize = ret.GetBitmapData()->GetBytesPerRow() ;
unsigned char* source = sourcedata + size_t(rect.x * scale) * 4 + size_t(rect.y * scale) * sourcelinesize;
const unsigned char* source = sourcedata + size_t(rect.x * scale) * 4 + size_t(rect.y * scale) * sourcelinesize;
unsigned char* dest = destdata;
for (int yy = 0; yy < destheight; ++yy, source += sourcelinesize , dest += destlinesize)
@@ -1199,7 +1199,7 @@ wxImage wxBitmap::ConvertToImage() const
// this call may trigger a conversion from platform image to bitmap, issue it
// before any measurements are taken, multi-resolution platform images may be
// rendered incorrectly otherwise
unsigned char* sourcestart = (unsigned char*) GetBitmapData()->GetRawAccess() ;
const unsigned char* sourcestart = static_cast<const unsigned char*>(GetBitmapData()->GetRawAccess());
// create an wxImage object
int width = GetWidth();
@@ -1244,7 +1244,7 @@ wxImage wxBitmap::ConvertToImage() const
for (int yy = 0; yy < height; yy++ , sourcestart += GetBitmapData()->GetBytesPerRow() , mask += maskBytesPerRow )
{
unsigned char * maskp = mask ;
const wxUint32 * source = (wxUint32*)sourcestart;
const wxUint32* source = reinterpret_cast<const wxUint32*>(sourcestart);
for (int xx = 0; xx < width; xx++)
{
+2 -2
View File
@@ -292,7 +292,7 @@ wxArrayVideoModes wxDisplayImplMacOSX::GetModes(const wxVideoMode& mode) const
for (CFIndex i = 0; i < CFArrayGetCount(theArray); ++i)
{
CGDisplayModeRef theValue = (CGDisplayModeRef) CFArrayGetValueAtIndex( theArray, i );
CGDisplayModeRef theValue = static_cast<CGDisplayModeRef>(const_cast<void*>(CFArrayGetValueAtIndex(theArray, i)));
wxVideoMode theMode(
CGDisplayModeGetWidth(theValue),
@@ -336,7 +336,7 @@ bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode )
for (CFIndex i = 0; i < CFArrayGetCount(theArray); ++i)
{
CGDisplayModeRef theValue = (CGDisplayModeRef) CFArrayGetValueAtIndex( theArray, i );
CGDisplayModeRef theValue = static_cast<CGDisplayModeRef>(const_cast<void*>(CFArrayGetValueAtIndex(theArray, i)));
wxVideoMode theMode(
CGDisplayModeGetWidth(theValue),
+2 -2
View File
@@ -130,7 +130,7 @@ void wxOSXPrintData::TransferPrinterNameFrom( const wxPrintData &data )
count = CFArrayGetCount(printerList);
for (index = 0; index < count; index++)
{
printer = (PMPrinter)CFArrayGetValueAtIndex(printerList, index);
printer = static_cast<PMPrinter>(const_cast<void*>(CFArrayGetValueAtIndex(printerList, index)));
if ((data.GetPrinterName().empty()) && (PMPrinterIsDefault(printer)))
break;
@@ -184,7 +184,7 @@ void wxOSXPrintData::TransferPaperInfoFrom( const wxPrintData &data )
CFIndex top = CFArrayGetCount(paperlist);
for ( CFIndex i = 0 ; i < top ; ++ i )
{
PMPaper paper = (PMPaper) CFArrayGetValueAtIndex( paperlist, i );
PMPaper paper = static_cast<PMPaper>(const_cast<void*>(CFArrayGetValueAtIndex(paperlist, i)));
PMPaperGetHeight(paper, &height);
PMPaperGetWidth(paper, &width);
if ( fabs( width - papersize.x ) < 5 &&
+1 -1
View File
@@ -183,7 +183,7 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding)
{
theString = wxCFRef<CFStringRef>(CFStringCreateWithBytes(
kCFAllocatorDefault,
(UInt8*)src,
reinterpret_cast<const UInt8*>(src),
srcSize * sizeof(wchar_t),
wxCFStringEncodingWcharT,
false));
+1 -1
View File
@@ -269,7 +269,7 @@ static void wxFSEventCallback(ConstFSEventStreamRef WXUNUSED(streamRef), void *c
static void wxDeleteContext(const void* context)
{
wxFSEventWatcherContext* watcherContext =
(wxFSEventWatcherContext*) context;
static_cast<wxFSEventWatcherContext*>(const_cast<void*>(context));
delete watcherContext;
}
+1 -1
View File
@@ -274,7 +274,7 @@ void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
Unshare();
M_PENDATA->m_nbDash = nb_dashes;
M_PENDATA->m_dash = (wxDash *)Dash;
M_PENDATA->m_dash = const_cast<wxDash*>(Dash);
RealizeResource();
}
+1 -1
View File
@@ -195,7 +195,7 @@ void wxMacStringToPascal( const wxString&from , unsigned char * to )
wxString wxMacMakeStringFromPascal( const unsigned char * from )
{
return wxString( (char*) &from[1] , wxConvLocal , from[0] );
return wxString(&from[1], wxConvLocal, from[0]);
}
#endif // wxOSX_USE_COCOA_OR_CARBON
+1 -1
View File
@@ -1853,7 +1853,7 @@ void wxWindowMac::Update()
wxNonOwnedWindow* wxWindowMac::MacGetTopLevelWindow() const
{
wxWindowMac *iter = (wxWindowMac*)this ;
wxWindowMac* iter = const_cast<wxWindowMac*>(this);
while ( iter )
{
+2 -1
View File
@@ -637,7 +637,8 @@ public:
}
else
{
pg->OnComboItemPaint( this, item, &dc, (wxRect&)rect, flags );
wxRect r(rect);
pg->OnComboItemPaint(this, item, &dc, r, flags);
}
}
+1 -1
View File
@@ -2201,7 +2201,7 @@ private:
wxPGVIterator wxPropertyGridManager::GetVIterator( int flags ) const
{
return wxPGVIterator( new wxPGVIteratorBase_Manager( (wxPropertyGridManager*)this, flags ) );
return wxPGVIterator(new wxPGVIteratorBase_Manager(const_cast<wxPropertyGridManager*>(this), flags));
}
#endif // wxUSE_PROPGRID
+2 -2
View File
@@ -1936,7 +1936,7 @@ void wxPropertyGrid::DrawExpanderButton( wxDC& dc, const wxRect& rect,
// Hopefully this does not cause problems.
#if (wxPG_USE_RENDERER_NATIVE)
wxRendererNative::Get().DrawTreeItemButton(
(wxWindow*)this,
const_cast<wxPropertyGrid*>(this),
dc,
r,
wxCONTROL_EXPANDED
@@ -1952,7 +1952,7 @@ void wxPropertyGrid::DrawExpanderButton( wxDC& dc, const wxRect& rect,
{
#if (wxPG_USE_RENDERER_NATIVE)
wxRendererNative::Get().DrawTreeItemButton(
(wxWindow*)this,
const_cast<wxPropertyGrid*>(this),
dc,
r,
0

Some files were not shown because too many files have changed in this diff Show More