From ac1476aabed3efb8c96f45c3eac225ece5376394 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Fri, 18 Jun 2010 15:58:01 +0800 Subject: [PATCH] fixes compile warnings. --- src/ExtEditor.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/ExtEditor.cc b/src/ExtEditor.cc index 410a072..cc62811 100644 --- a/src/ExtEditor.cc +++ b/src/ExtEditor.cc @@ -233,6 +233,8 @@ ExtEditor::processLabelKey(guint keyval){ break; } break; + default: + break; } return FALSE; } @@ -257,6 +259,8 @@ ExtEditor::processSpace(guint keyval){ g_return_val_if_fail(cursor_pos == 0 , FALSE); selectCandidateInPage(cursor_pos); break; + default: + break; } return TRUE; } @@ -291,7 +295,8 @@ ExtEditor::removeCharBefore() } m_text.erase(m_cursor - 1, 1); - m_cursor = std::max(0, (int)(m_cursor - 1)); + m_cursor = std::max(0, static_cast(m_cursor - 1)); + return TRUE; } gboolean @@ -308,6 +313,7 @@ ExtEditor::removeCharAfter() } m_text.erase(m_cursor, 1); m_cursor = std::min(m_cursor, (guint)m_text.length()); + return TRUE; } void @@ -375,12 +381,12 @@ ExtEditor::selectCandidate (guint index) const char * prefix_str = prefix.c_str(); const GArray * commands = ibus_engine_plugin_get_available_commands(m_lua_plugin); int match_count = -1; - for (int i = 0; i < commands->len; ++i) { + for (int i = 0; i < static_cast(commands->len); ++i) { lua_command_t * command = &g_array_index(commands, lua_command_t, i); if ( strncmp(prefix_str, command->command_name, len) == 0 ){ match_count++; } - if ( match_count == index ) { + if ( match_count == static_cast(index) ) { m_text.clear(); m_text = "i"; m_text += command->command_name; @@ -396,7 +402,7 @@ ExtEditor::selectCandidate (guint index) case LABEL_LIST_ALPHA: { g_return_val_if_fail(m_result_num > 1, FALSE); - g_return_val_if_fail(index < m_result_num, FALSE); + g_return_val_if_fail(static_cast(index) < m_result_num, FALSE); const lua_command_candidate_t * candidate = g_array_index(m_candidates, lua_command_candidate_t *, index); if ( candidate->content ){ @@ -429,6 +435,8 @@ ExtEditor::selectCandidate (guint index) return TRUE; } break; + default: + break; } return FALSE; } @@ -534,7 +542,7 @@ ExtEditor::fillCommandCandidates(std::string prefix) int len = prefix.length(); const char * prefix_str = prefix.c_str(); const GArray * commands = ibus_engine_plugin_get_available_commands(m_lua_plugin); - for ( int i = 0; i < commands->len; ++i){ + for ( int i = 0; i < static_cast(commands->len); ++i){ lua_command_t * command = &g_array_index(commands, lua_command_t, i); if ( strncmp(prefix_str, command->command_name, len) == 0){ std::string candidate = command->command_name; -- 2.7.4