Revert files to previous version that were affected by wxIsXXX((wxChar)X) change. Note - passing a negative value to those c lib functions is undefined, and could return true on platforms using a lookup table, for example (might crash also?), which is what will happen when casting to char to ansii mode and a char is above 127

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Ryan Norton
2004-11-06 07:09:35 +00:00
parent 311765c2a8
commit 0c6099b79e
4 changed files with 131 additions and 131 deletions

View File

@@ -411,7 +411,7 @@ void MyFrame::OnRename(wxCommandEvent& WXUNUSED(event))
static wxString s_text; static wxString s_text;
s_text = wxGetTextFromUser(wxT("New name: "), wxT("Tree sample question"), s_text = wxGetTextFromUser(wxT("New name: "), wxT("Tree sample question"),
s_text, this); s_text, this);
if ( !s_text.empty() ) if ( !s_text.IsEmpty() )
{ {
m_treeCtrl->SetItemText(item, s_text); m_treeCtrl->SetItemText(item, s_text);
} }
@@ -906,8 +906,8 @@ TREE_EVENT_HANDLER(OnSelChanging)
void LogKeyEvent(const wxChar *name, const wxKeyEvent& event) void LogKeyEvent(const wxChar *name, const wxKeyEvent& event)
{ {
wxString key; wxString key;
int keycode = event.GetKeyCode(); long keycode = event.GetKeyCode();
{
switch ( keycode ) switch ( keycode )
{ {
case WXK_BACK: key = wxT("BACK"); break; case WXK_BACK: key = wxT("BACK"); break;
@@ -1014,12 +1014,13 @@ void LogKeyEvent(const wxChar *name, const wxKeyEvent& event)
default: default:
{ {
if ( wxIsprint((wxChar)keycode) ) if ( wxIsprint((int)keycode) )
key.Printf(wxT("'%c'"), (char)keycode); key.Printf(wxT("'%c'"), (char)keycode);
else if ( keycode > 0 && keycode < 27 ) else if ( keycode > 0 && keycode < 27 )
key.Printf(_("Ctrl-%c"), wxT('A') + keycode - 1); key.Printf(_("Ctrl-%c"), wxT('A') + keycode - 1);
else else
key.Printf(wxT("unknown (%d)"), keycode); key.Printf(wxT("unknown (%ld)"), keycode);
}
} }
} }

View File

@@ -141,7 +141,7 @@ wxAcceleratorEntry *wxGetAccelFromString(const wxString& label)
} }
} }
if ( current.empty() ) { if ( current.IsEmpty() ) {
wxLogDebug(wxT("No accel key found, accel string ignored.")); wxLogDebug(wxT("No accel key found, accel string ignored."));
} }
else { else {
@@ -262,7 +262,7 @@ void wxMenuItemBase::SetAccel(wxAcceleratorEntry *accel)
// we should process them here // we should process them here
default: default:
if ( wxIsalnum((wxChar)code) ) if ( wxIsalnum(code) )
{ {
text << (wxChar)code; text << (wxChar)code;

View File

@@ -243,9 +243,9 @@ void wxTextValidator::OnChar(wxKeyEvent& event)
((m_validatorStyle & wxFILTER_INCLUDE_CHAR_LIST) && !IsInCharIncludeList(wxString((wxChar) keyCode, 1))) || ((m_validatorStyle & wxFILTER_INCLUDE_CHAR_LIST) && !IsInCharIncludeList(wxString((wxChar) keyCode, 1))) ||
((m_validatorStyle & wxFILTER_EXCLUDE_CHAR_LIST) && !IsNotInCharExcludeList(wxString((wxChar) keyCode, 1))) || ((m_validatorStyle & wxFILTER_EXCLUDE_CHAR_LIST) && !IsNotInCharExcludeList(wxString((wxChar) keyCode, 1))) ||
((m_validatorStyle & wxFILTER_ASCII) && !isascii(keyCode)) || ((m_validatorStyle & wxFILTER_ASCII) && !isascii(keyCode)) ||
((m_validatorStyle & wxFILTER_ALPHA) && !wxIsalpha((wxChar)keyCode)) || ((m_validatorStyle & wxFILTER_ALPHA) && !wxIsalpha(keyCode)) ||
((m_validatorStyle & wxFILTER_ALPHANUMERIC) && !wxIsalnum((wxChar)keyCode)) || ((m_validatorStyle & wxFILTER_ALPHANUMERIC) && !wxIsalnum(keyCode)) ||
((m_validatorStyle & wxFILTER_NUMERIC) && !wxIsdigit((wxChar)keyCode) ((m_validatorStyle & wxFILTER_NUMERIC) && !wxIsdigit(keyCode)
&& keyCode != '.' && keyCode != ',' && keyCode != '-') && keyCode != '.' && keyCode != ',' && keyCode != '-')
) )
) )

View File

@@ -525,7 +525,6 @@ void wxGridCellEditor::Show(bool show, wxGridCellAttr *attr)
m_control->SetBackgroundColour(m_colBgOld); m_control->SetBackgroundColour(m_colBgOld);
m_colBgOld = wxNullColour; m_colBgOld = wxNullColour;
} }
// Workaround for GTK+1 font setting problem on some platforms // Workaround for GTK+1 font setting problem on some platforms
#if !defined(__WXGTK__) || defined(__WXGTK20__) #if !defined(__WXGTK__) || defined(__WXGTK20__)
if ( m_fontOld.Ok() ) if ( m_fontOld.Ok() )
@@ -729,7 +728,7 @@ bool wxGridCellTextEditor::IsAcceptedKey(wxKeyEvent& event)
default: default:
// accept 8 bit chars too if isprint() agrees // accept 8 bit chars too if isprint() agrees
if ( (keycode < 255) && (wxIsprint((wxChar)keycode)) ) if ( (keycode < 255) && (wxIsprint(keycode)) )
return true; return true;
} }
} }
@@ -836,7 +835,7 @@ void wxGridCellNumberEditor::BeginEdit(int row, int col, wxGrid* grid)
{ {
m_valueOld = 0; m_valueOld = 0;
wxString sValue = table->GetValue(row, col); wxString sValue = table->GetValue(row, col);
if (! sValue.ToLong(&m_valueOld) && ! sValue.empty()) if (! sValue.ToLong(&m_valueOld) && ! sValue.IsEmpty())
{ {
wxFAIL_MSG( _T("this cell doesn't have numeric value") ); wxFAIL_MSG( _T("this cell doesn't have numeric value") );
return; return;
@@ -871,7 +870,7 @@ bool wxGridCellNumberEditor::EndEdit(int row, int col,
else else
{ {
text = Text()->GetValue(); text = Text()->GetValue();
changed = (text.empty() || text.ToLong(&value)) && (value != m_valueOld); changed = (text.IsEmpty() || text.ToLong(&value)) && (value != m_valueOld);
} }
if ( changed ) if ( changed )
@@ -923,7 +922,7 @@ bool wxGridCellNumberEditor::IsAcceptedKey(wxKeyEvent& event)
return true; return true;
default: default:
if ( (keycode < 128) && wxIsdigit((wxChar)keycode) ) if ( (keycode < 128) && wxIsdigit(keycode) )
return true; return true;
} }
} }
@@ -936,7 +935,7 @@ void wxGridCellNumberEditor::StartingKey(wxKeyEvent& event)
if ( !HasRange() ) if ( !HasRange() )
{ {
int keycode = event.GetKeyCode(); int keycode = event.GetKeyCode();
if ( wxIsdigit((wxChar)keycode) || keycode == '+' || keycode == '-' if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-'
|| keycode == WXK_NUMPAD0 || keycode == WXK_NUMPAD0
|| keycode == WXK_NUMPAD1 || keycode == WXK_NUMPAD1
|| keycode == WXK_NUMPAD2 || keycode == WXK_NUMPAD2
@@ -1040,7 +1039,7 @@ void wxGridCellFloatEditor::BeginEdit(int row, int col, wxGrid* grid)
{ {
m_valueOld = 0.0; m_valueOld = 0.0;
wxString sValue = table->GetValue(row, col); wxString sValue = table->GetValue(row, col);
if (! sValue.ToDouble(&m_valueOld) && ! sValue.empty()) if (! sValue.ToDouble(&m_valueOld) && ! sValue.IsEmpty())
{ {
wxFAIL_MSG( _T("this cell doesn't have float value") ); wxFAIL_MSG( _T("this cell doesn't have float value") );
return; return;
@@ -1056,7 +1055,7 @@ bool wxGridCellFloatEditor::EndEdit(int row, int col,
double value = 0.0; double value = 0.0;
wxString text(Text()->GetValue()); wxString text(Text()->GetValue());
if ( (text.empty() || text.ToDouble(&value)) && (value != m_valueOld) ) if ( (text.IsEmpty() || text.ToDouble(&value)) && (value != m_valueOld) )
{ {
if (grid->GetTable()->CanSetValueAs(row, col, wxGRID_VALUE_FLOAT)) if (grid->GetTable()->CanSetValueAs(row, col, wxGRID_VALUE_FLOAT))
grid->GetTable()->SetValueAsDouble(row, col, value); grid->GetTable()->SetValueAsDouble(row, col, value);
@@ -1082,7 +1081,7 @@ void wxGridCellFloatEditor::StartingKey(wxKeyEvent& event)
wxString strbuf(tmpbuf, *wxConvCurrent); wxString strbuf(tmpbuf, *wxConvCurrent);
bool is_decimal_point = ( strbuf == bool is_decimal_point = ( strbuf ==
wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER) ); wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER) );
if ( wxIsdigit((wxChar)keycode) || keycode == '+' || keycode == '-' if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-'
|| is_decimal_point || is_decimal_point
|| keycode == WXK_NUMPAD0 || keycode == WXK_NUMPAD0
|| keycode == WXK_NUMPAD1 || keycode == WXK_NUMPAD1
@@ -1193,7 +1192,7 @@ bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event)
( strbuf == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, ( strbuf == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT,
wxLOCALE_CAT_NUMBER) ); wxLOCALE_CAT_NUMBER) );
if ( (keycode < 128) && if ( (keycode < 128) &&
(wxIsdigit((wxChar)keycode) || tolower(keycode) == 'e' || (wxIsdigit(keycode) || tolower(keycode) == 'e' ||
is_decimal_point || keycode == '+' || keycode == '-') ) is_decimal_point || keycode == '+' || keycode == '-') )
return true; return true;
} }