[uim-commit] r2951 - in trunk: gtk uim

yamaken at freedesktop.org yamaken at freedesktop.org
Fri Jan 20 13:15:59 PST 2006


Author: yamaken
Date: 2006-01-20 13:15:54 -0800 (Fri, 20 Jan 2006)
New Revision: 2951

Modified:
   trunk/gtk/gtk-im-uim.c
   trunk/uim/prime.c
   trunk/uim/uim-helper.c
   trunk/uim/uim.h
Log:
* uim/uim.h
  - Revise the description about uim_bool to prevent misuses
* gtk/gtk-im-uim.c
  - (im_uim_commit_string, update_prop_label_cb): Fix invalid boolean
    test expression for uim_bool. Although it is invalid, no problem
    will be occurred since the value is exactly UIM_TRUE or UIM_FALSE
    in this case
* uim/prime.c
  - (use_unix_domain_socket): Change type to uim_bool
  - (prime_lib_init): Fix the invalid expression likewise
* uim/uim-helper.c
  - (uim_helper_is_setugid): Simplify


Modified: trunk/gtk/gtk-im-uim.c
===================================================================
--- trunk/gtk/gtk-im-uim.c	2006-01-20 20:29:21 UTC (rev 2950)
+++ trunk/gtk/gtk-im-uim.c	2006-01-20 21:15:54 UTC (rev 2951)
@@ -165,7 +165,7 @@
   g_signal_emit_by_name(uic, "commit", str);
 
   show_state = uim_scm_symbol_value_bool("bridge-show-input-state?");
-  if (show_state == UIM_TRUE) {
+  if (show_state) {
     gdk_window_get_origin(uic->win, &x, &y);
     caret_state_indicator_update(uic->caret_state_indicator, x, y, NULL);
   }
@@ -711,7 +711,7 @@
   g_string_free(prop_label, TRUE);
 
   show_state = uim_scm_symbol_value_bool("bridge-show-input-state?");
-  if (show_state == UIM_TRUE && uic->win) {
+  if (show_state && uic->win) {
     gint timeout;
 
     gdk_window_get_origin(uic->win, &x, &y);

Modified: trunk/uim/prime.c
===================================================================
--- trunk/uim/prime.c	2006-01-20 20:29:21 UTC (rev 2950)
+++ trunk/uim/prime.c	2006-01-20 21:15:54 UTC (rev 2951)
@@ -57,7 +57,7 @@
 static char *prime_command = "prime";
 static char *prime_ud_path;
 static int prime_fd;
-static int use_unix_domain_socket;
+static uim_bool use_unix_domain_socket;
 
 static int
 prime_init_ud(char *path)
@@ -195,13 +195,10 @@
 prime_lib_init(uim_lisp use_udp_)
 {
   char *option;
-  uim_bool use_udp = uim_scm_c_bool(use_udp_);
-  if (use_udp == UIM_TRUE)
-    use_unix_domain_socket = UIM_TRUE;
-  else
-    use_unix_domain_socket = UIM_FALSE;
 
-  if (use_unix_domain_socket == UIM_TRUE) {
+  use_unix_domain_socket = uim_scm_c_bool(use_udp_);
+
+  if (use_unix_domain_socket) {
     prime_ud_path = prime_get_ud_path();
     if (!prime_ud_path)
       return uim_scm_f();

Modified: trunk/uim/uim-helper.c
===================================================================
--- trunk/uim/uim-helper.c	2006-01-20 20:29:21 UTC (rev 2950)
+++ trunk/uim/uim-helper.c	2006-01-20 21:15:54 UTC (rev 2951)
@@ -214,11 +214,7 @@
 uim_bool
 uim_helper_is_setugid(void)
 {
-  if(is_setugid() != 0) {
-    return UIM_TRUE;
-  } else {
-    return UIM_FALSE;
-  }
+  return (is_setugid()) ? UIM_TRUE : UIM_FALSE;
 }
 
 int

Modified: trunk/uim/uim.h
===================================================================
--- trunk/uim/uim.h	2006-01-20 20:29:21 UTC (rev 2950)
+++ trunk/uim/uim.h	2006-01-20 21:15:54 UTC (rev 2951)
@@ -42,9 +42,13 @@
 #include <stdio.h>
 
 /*
- * A boolean type for uim to explicitly indicate intention about values.  A
- * true value is represented as (val != UIM_FALSE). i.e. Don't test a value
- * with (val == UIM_TRUE).
+ * A boolean type for uim to explicitly indicate intention about values
+ *
+ *                           *** IMPORTANT ***
+ *
+ * Do not test a value with (val == UIM_TRUE). The UIM_TRUE is only A TYPICAL
+ * VALUE FOR TRUE. Use (val) or (val != UIM_FALSE) instead.
+ *
  */
 typedef int uim_bool;
 



More information about the uim-commit mailing list