[uim-commit] r512 - trunk/xim

ekato at freedesktop.org ekato at freedesktop.org
Thu Feb 3 18:38:35 PST 2005


Author: ekato
Date: 2005-02-03 18:38:32 -0800 (Thu, 03 Feb 2005)
New Revision: 512

Modified:
   trunk/xim/canddisp.cpp
   trunk/xim/compose.cpp
   trunk/xim/main.cpp
   trunk/xim/xim.h
   trunk/xim/ximpacket.cpp
   trunk/xim/ximserver.cpp
   trunk/xim/ximtrans.cpp
Log:
* xim/xim.h : Add const qualifiers to appropriate 'char *'
  pointers.
* xim/compose.cpp : Ditto.
* xim/ximtrans.cpp : Ditto.
* xim/ximpacket.cpp : Ditto.
* xim/canddisp.cpp : Ditto.
* xim/main.cpp : Ditto.	 Fix some warnings of printf().
(main) : Remove redundant code for "uim-%s" style server name.	
* xim/ximserver.cpp (print_ustring) : Fix warning of printf().
(XimServer::setupConnection) : Remove redundant code for "uim-%s"
  style server name.


Modified: trunk/xim/canddisp.cpp
===================================================================
--- trunk/xim/canddisp.cpp	2005-02-04 02:14:35 UTC (rev 511)
+++ trunk/xim/canddisp.cpp	2005-02-04 02:38:32 UTC (rev 512)
@@ -51,11 +51,11 @@
 static FILE *candwin_r = NULL, *candwin_w = NULL;
 static int candwin_pid = 0;
 static Canddisp *disp;
-static char *command;
+static const char *command;
 
 static void candwin_read_cb(int fd, int ev);
 
-static char *candwin_command(void)
+static const char *candwin_command(void)
 {
     char *candwin_prog = NULL;
 

Modified: trunk/xim/compose.cpp
===================================================================
--- trunk/xim/compose.cpp	2005-02-04 02:14:35 UTC (rev 511)
+++ trunk/xim/compose.cpp	2005-02-04 02:38:32 UTC (rev 512)
@@ -312,7 +312,7 @@
     long mask;
 
     struct _modtbl {
-	char *name;
+	const char *name;
 	long mask;
     };
     struct _modtbl *p;

Modified: trunk/xim/main.cpp
===================================================================
--- trunk/xim/main.cpp	2005-02-04 02:14:35 UTC (rev 511)
+++ trunk/xim/main.cpp	2005-02-04 02:38:32 UTC (rev 512)
@@ -215,7 +215,7 @@
 
 
 static void
-sendSelectionNotify(XEvent *ev, char *buf, int len)
+sendSelectionNotify(XEvent *ev, const char *buf, int len)
 {
     XEvent e;
     e.type = SelectionNotify;
@@ -317,14 +317,14 @@
 static void
 print_version()
 {
-    printf(version_name);
+    printf("%s", version_name);
 }
 
 static void
 print_usage()
 {
     print_version();
-    printf(usage);
+    printf("%s", usage);
     exit(0);
 }
 
@@ -518,20 +518,6 @@
 	}
     }
 
-#if 0
-    // XXX Setup each backend as a separated XimServer, aimed for
-    // backward compatibility, and should be removed in the future.
-    for (it = uim_info.begin(); it != uim_info.end(); it++) {
-	XimServer *xs = new XimServer(it->locale, it->name, it->lang);
-	res = xs->setupConnection(false);
-	if (res)
-	    printf("XMODIFIERS=@im=uim-%s (%s) registered\n",
-			    it->name, it->lang);
-	else
-	    delete xs;
-    }
-#endif
-
     if (!res) {
 	printf("aborting...\n");
 	return 1;

Modified: trunk/xim/xim.h
===================================================================
--- trunk/xim/xim.h	2005-02-04 02:14:35 UTC (rev 511)
+++ trunk/xim/xim.h	2005-02-04 02:38:32 UTC (rev 512)
@@ -70,7 +70,7 @@
     virtual int pushC16(unsigned int) = 0;
     virtual int pushC32(unsigned int) = 0;
     virtual int pushSTRING(char *) = 0;
-    virtual int pushBytes(char *, int) = 0;
+    virtual int pushBytes(const char *, int) = 0;
 
     virtual int pop_back() = 0;
 };
@@ -112,7 +112,7 @@
     void push_packet(TxPacket *); // for normal packet for reply
     void push_passive_packet(TxPacket *); // for preceding packet for reply
     int byte_order() {return mByteorder;};
-    void push_error_packet(int imid, int icid, int er, char *str);
+    void push_error_packet(int imid, int icid, int er, const char *str);
 
     unsigned short to_hs(unsigned short s);
     unsigned int to_hl(unsigned int l);

Modified: trunk/xim/ximpacket.cpp
===================================================================
--- trunk/xim/ximpacket.cpp	2005-02-04 02:14:35 UTC (rev 511)
+++ trunk/xim/ximpacket.cpp	2005-02-04 02:38:32 UTC (rev 512)
@@ -200,7 +200,7 @@
 
 class TxBytes : public TxElement {
 public:
-    TxBytes(char *s, int len) {
+    TxBytes(const char *s, int len) {
 	m_str = (char *)malloc(len);
 	m_len = len;
 	memcpy(m_str, s, len);
@@ -235,7 +235,7 @@
     virtual int pushC16(unsigned int);
     virtual int pushC32(unsigned int);
     virtual int pushSTRING(char *);
-    virtual int pushBytes(char *, int);
+    virtual int pushBytes(const char *, int);
 
     virtual int pop_back();
 private:
@@ -319,7 +319,7 @@
     return e->get_size();
 }
 
-int TxPacket_impl::pushBytes(char *b, int len)
+int TxPacket_impl::pushBytes(const char *b, int len)
 {
     TxElement *e;
     e = new TxBytes(b, len);

Modified: trunk/xim/ximserver.cpp
===================================================================
--- trunk/xim/ximserver.cpp	2005-02-04 02:14:35 UTC (rev 511)
+++ trunk/xim/ximserver.cpp	2005-02-04 02:38:32 UTC (rev 512)
@@ -99,7 +99,7 @@
 	ch = *i;
 	nbyte = utf8_wctomb((unsigned char *)utf8, ch);
 	utf8[nbyte] = '\0';
-	printf(utf8);
+	printf("%s", utf8);
     }
     printf("\n");
 }
@@ -190,10 +190,9 @@
 bool
 XimServer::setupConnection(bool useDefaultIM)
 {
-    char *buf;
+    const char *buf;
     if (!useDefaultIM) {
-	buf = (char *)alloca(15 + strlen(mIMName));
-	sprintf(buf, "@server=uim-%s", mIMName);
+	return false;
     } else {
 	buf = "@server=uim";
     }

Modified: trunk/xim/ximtrans.cpp
===================================================================
--- trunk/xim/ximtrans.cpp	2005-02-04 02:14:35 UTC (rev 511)
+++ trunk/xim/ximtrans.cpp	2005-02-04 02:38:32 UTC (rev 512)
@@ -48,7 +48,7 @@
 # endif
 #endif
 
-char *xim_packet_name[] = {
+const char *xim_packet_name[] = {
     // 0
     0, "XIM_CONNECT", "XIM_CONNECT_REPLY",
     "XIM_DISCONNECT", "XIM_DISCONNECT_REPLY",
@@ -90,16 +90,16 @@
 };
 
 static struct XIMATTRIBUTE{
-    XIMATTRIBUTE(char *n, int t);
+    XIMATTRIBUTE(const char *n, int t);
     static void write_imattr_to_packet(TxPacket *p);
 
-    char *name;
+    const char *name;
     int type;
 }xim_attributes[]={
     XIMATTRIBUTE(XNQueryInputStyle, TYPE_XIMSTYLE),
 };
 
-XIMATTRIBUTE::XIMATTRIBUTE(char *n, int t)
+XIMATTRIBUTE::XIMATTRIBUTE(const char *n, int t)
 {
     name = n;
     type = t;
@@ -130,9 +130,9 @@
 }
 
 static struct XICATTRIBUTE{
-    XICATTRIBUTE(char *n, int t);
+    XICATTRIBUTE(const char *n, int t);
     static void write_icattr_to_packet(TxPacket *p);
-    char *name;
+    const char *name;
     int type;
 }xic_attributes[]={
     // the sequence is required to be same as the order of
@@ -158,7 +158,7 @@
     XICATTRIBUTE(XNSeparatorofNestedList, TYPE_SEPARATOR),
 };
 
-XICATTRIBUTE::XICATTRIBUTE(char *n, int t)
+XICATTRIBUTE::XICATTRIBUTE(const char *n, int t)
 {
     name = n;
     type = t;
@@ -359,7 +359,7 @@
     mPTxQ.push_back(p);
 }
 
-void Connection::push_error_packet(int imid, int icid, int er, char *str)
+void Connection::push_error_packet(int imid, int icid, int er, const char *str)
 {
     TxPacket *t;
     t = createTxPacket(XIM_ERROR, 0);



More information about the Uim-commit mailing list