From 3f8feaf9ab19f28f4bb7a121b34a844596a01472 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Wed, 26 Sep 2012 10:03:00 +0900 Subject: [PATCH] Pass user-supplied CFLAGS to configure. Also fix several compiler warnings. BUG=none Review URL: https://codereview.appspot.com/6564047 --- autogen.sh | 4 ++-- src/engine.c | 22 +++------------------- src/m17nutil.c | 15 +++++++-------- src/setup.c | 17 +++++++++-------- 4 files changed, 21 insertions(+), 37 deletions(-) Index: ibus-m17n-1.3.4/autogen.sh =================================================================== --- ibus-m17n-1.3.4.orig/autogen.sh +++ ibus-m17n-1.3.4/autogen.sh @@ -18,8 +18,8 @@ which gnome-autogen.sh || { exit 1 } -export CFLAGS="-g -O0" -export CXXFLAGS="$CFLAGS" +export CFLAGS=${CFLAGS-"-Wall"} +export CXXFLAGS=${CXXFLAGS-"$CFLAGS"} ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4" REQUIRED_AUTOMAKE_VERSION=1.10 Index: ibus-m17n-1.3.4/src/engine.c =================================================================== --- ibus-m17n-1.3.4.orig/src/engine.c +++ ibus-m17n-1.3.4/src/engine.c @@ -77,14 +77,6 @@ static void ibus_m17n_engine_focus_out static void ibus_m17n_engine_reset (IBusEngine *engine); static void ibus_m17n_engine_enable (IBusEngine *engine); static void ibus_m17n_engine_disable (IBusEngine *engine); -static void ibus_engine_set_cursor_location (IBusEngine *engine, - gint x, - gint y, - gint w, - gint h); -static void ibus_m17n_engine_set_capabilities - (IBusEngine *engine, - guint caps); static void ibus_m17n_engine_page_up (IBusEngine *engine); static void ibus_m17n_engine_page_down (IBusEngine *engine); static void ibus_m17n_engine_cursor_up (IBusEngine *engine); @@ -93,12 +85,6 @@ static void ibus_m17n_engine_property_ac (IBusEngine *engine, const gchar *prop_name, guint prop_state); -static void ibus_m17n_engine_property_show - (IBusEngine *engine, - const gchar *prop_name); -static void ibus_m17n_engine_property_hide - (IBusEngine *engine, - const gchar *prop_name); static void ibus_m17n_engine_commit_string (IBusM17NEngine *m17n, @@ -1247,7 +1233,9 @@ ibus_m17n_engine_callback (MInputContext &anchor_pos); nchars = ibus_text_get_length (text); nbytes = g_utf8_offset_to_pointer (text->text, nchars) - text->text; - mt = mconv_decode_buffer (Mcoding_utf_8, text->text, nbytes); + mt = mconv_decode_buffer (Mcoding_utf_8, + (const unsigned char *) text->text, + nbytes); g_object_unref (text); len = (long) mplist_value (m17n->context->plist); Index: ibus-m17n-1.3.4/src/m17nutil.c =================================================================== --- ibus-m17n-1.3.4.orig/src/m17nutil.c +++ ibus-m17n-1.3.4/src/m17nutil.c @@ -55,7 +55,9 @@ ibus_m17n_mtext_to_utf8 (MText *text) bufsize = (mtext_len (text) + 1) * 6; buf = (gchar *) g_malloc (bufsize); - mconv_rebind_buffer (utf8_converter, buf, bufsize); + mconv_rebind_buffer (utf8_converter, + (const unsigned char *) buf, + bufsize); mconv_encode (utf8_converter, text); buf [utf8_converter->nbytes] = 0; @@ -78,7 +80,9 @@ ibus_m17n_mtext_to_ucs4 (MText *text, gl bufsize = (mtext_len (text) + 1) * 6; buf = (gchar *) g_malloc (bufsize); - mconv_rebind_buffer (utf8_converter, buf, bufsize); + mconv_rebind_buffer (utf8_converter, + (const unsigned char *) buf, + bufsize); if (mconv_encode (utf8_converter, text) < 0) { g_free (buf); return NULL; @@ -204,17 +208,12 @@ ibus_m17n_list_engines (void) if (l) { /* check candidates encoding */ MPlist *sl; - MSymbol varname; - MText *vardesc; - MSymbol varunknown; MSymbol varcharset; sl = mplist_value (l); - varname = mplist_value (sl); + /* L = (VAR-NAME DESCRIPTION 'nil' VALUE) */ sl = mplist_next (sl); - vardesc = mplist_value (sl); sl = mplist_next (sl); - varunknown = mplist_value (sl); sl = mplist_next (sl); varcharset = mplist_value (sl); Index: ibus-m17n-1.3.4/src/setup.c =================================================================== --- ibus-m17n-1.3.4.orig/src/setup.c +++ ibus-m17n-1.3.4/src/setup.c @@ -73,7 +73,9 @@ parse_m17n_value (MPlist *plist, gchar * if (mplist_key (plist) == Mtext) { MText *mtext; - mtext = mconv_decode_buffer (Mcoding_utf_8, text, strlen (text)); + mtext = mconv_decode_buffer (Mcoding_utf_8, + (const unsigned char *) text, + strlen (text)); value = mplist (); mplist_add (value, Mtext, mtext); return value; @@ -372,10 +374,10 @@ setup_dialog_load_config (SetupDialog *d static gchar * _gdk_color_to_string (GdkColor *color) { - g_strdup_printf ("#%02X%02X%02X", - (color->red & 0xFF00) >> 8, - (color->green & 0xFF00) >> 8, - (color->blue & 0xFF00) >> 8); + return g_strdup_printf ("#%02X%02X%02X", + (color->red & 0xFF00) >> 8, + (color->green & 0xFF00) >> 8, + (color->blue & 0xFF00) >> 8); } static void @@ -428,7 +430,7 @@ save_m17n_options (SetupDialog *dialog) gboolean retval = TRUE; if (!gtk_tree_model_get_iter_first (model, &iter)) - return; + return FALSE; do { gtk_tree_model_get (model, &iter, @@ -567,9 +569,8 @@ start (const gchar *engine_name) { IBusBus *bus; IBusConfig *config; - gchar **strv, *section; + gchar **strv; SetupDialog *dialog; - GObject *object; ibus_init (); ibus_m17n_init_common ();