Fix assert in the text sample when logging char events
Passing long argument to "%c" printf format specifier was correctly flagged as invalid in 64 bit Unix builds where long != int. Fix this by just making the "keycode" variable int in the first place, there doesn't seem to be any reason whatsoever for it to be long and this allows us to get rid of a couple of existing casts instead of adding yet another one.
This commit is contained in:
@@ -588,7 +588,7 @@ bool MyTextCtrl::ms_logClip = false;
|
||||
void MyTextCtrl::LogKeyEvent(const wxChar *name, wxKeyEvent& event) const
|
||||
{
|
||||
wxString key;
|
||||
long keycode = event.GetKeyCode();
|
||||
const int keycode = event.GetKeyCode();
|
||||
{
|
||||
switch ( keycode )
|
||||
{
|
||||
@@ -710,12 +710,12 @@ void MyTextCtrl::LogKeyEvent(const wxChar *name, wxKeyEvent& event) const
|
||||
|
||||
default:
|
||||
{
|
||||
if ( wxIsprint((int)keycode) )
|
||||
key.Printf(wxT("'%c'"), (char)keycode);
|
||||
if ( wxIsprint(keycode) )
|
||||
key.Printf(wxT("'%c'"), keycode);
|
||||
else if ( keycode > 0 && keycode < 27 )
|
||||
key.Printf(_("Ctrl-%c"), wxT('A') + keycode - 1);
|
||||
else
|
||||
key.Printf(wxT("unknown (%ld)"), keycode);
|
||||
key.Printf(wxT("unknown (%d)"), keycode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user