Author: ek.kato
Date: Fri Jan 4 04:03:24 2008
New Revision: 5104
Modified:
trunk/xim/compose.cpp
trunk/xim/connection.cpp
trunk/xim/convdisp.cpp
trunk/xim/locale.cpp
trunk/xim/xim.h
trunk/xim/ximic.cpp
trunk/xim/ximim.cpp
trunk/xim/ximpacket.cpp
trunk/xim/ximserver.cpp
trunk/xim/ximtrans.cpp
Log:
* xim/xim.h
- Use appropriate value types for icid, imid, icattr, imattr,
and major packet number to fix compiler warning with GCC4.3.
* xim/connection.cpp
* xim/ximtrans.cpp
* xim/ximic.cpp
* xim/ximim.cpp
* xim/convdisp.cpp
* xim/ximpacket.cpp
- Follow the changes in value types.
- Suppress some compiler warnings.
* xim/locale.cpp (utf8_wctomb)
* xim/compose.cpp (nexttoken)
* xim/ximserver.cpp (keyState::check_key)
- Suppress compiler warnings.
Modified: trunk/xim/compose.cpp
==============================================================================
--- trunk/xim/compose.cpp (original)
+++ trunk/xim/compose.cpp Fri Jan 4 04:03:24 2008
@@ -215,7 +215,7 @@
switch (c) {
case '\\':
case '"':
- *p++ = c;
+ *p++ = (char)c;
len++;
break;
case 'n':
@@ -279,12 +279,12 @@
token = ERROR;
goto string_error;
default:
- *p++ = c;
+ *p++ = (char)c;
len++;
break;
}
} else {
- *p++ = c;
+ *p++ = (char)c;
len++;
}
}
@@ -307,7 +307,7 @@
*tokenbuf = (char *)realloc(*tokenbuf, *buflen);
}
p = *tokenbuf;
- *p++ = c;
+ *p++ = (char)c;
len++;
c = nextch(fp, lastch);
while (isalnum(c) || c == '_' || c == '-') {
@@ -316,7 +316,7 @@
*tokenbuf = (char *)realloc(*tokenbuf, *buflen);
p = *tokenbuf + len;
}
- *p++ = c;
+ *p++ = (char)c;
len++;
c = nextch(fp, lastch);
}
Modified: trunk/xim/connection.cpp
==============================================================================
--- trunk/xim/connection.cpp (original)
+++ trunk/xim/connection.cpp Fri Jan 4 04:03:24 2008
@@ -254,7 +254,7 @@
{
std::list<TxPacket *>::iterator i, j;
bool sent_preedit_done = false;
- int major;
+ C8 major;
while (!mPendingTxQ.empty()) {
if (hasSyncFlag() || hasPreeditStartSyncFlag() ||
@@ -312,7 +312,7 @@
{
std::list<TxPacket *>::iterator i, j;
bool sent_preedit_done = false;
- int major;
+ C8 major;
while (!mPTxQ.empty()) {
if (!mPendingTxQ.empty())
@@ -375,7 +375,7 @@
void XConnection::writeNormalPacket()
{
std::list<TxPacket *>::iterator i;
- int major;
+ C8 major;
while (!mTxQ.empty()) {
i = mTxQ.begin();
Modified: trunk/xim/convdisp.cpp
==============================================================================
--- trunk/xim/convdisp.cpp (original)
+++ trunk/xim/convdisp.cpp Fri Jan 4 04:03:24 2008
@@ -321,7 +321,7 @@
void compose_feedback_array(TxPacket *);
Connection *mConn;
- int mImid, mIcid;
+ C16 mImid, mIcid;
int mPrevLen;
};
@@ -1160,8 +1160,8 @@
XGetGeometry(XimServer::gDpy, win,
&r, &x, &x, &w, &h, &tmp, &tmp);
// Absurd... (cope with Qt from RedHat7.3, and maybe some other)
- m_atr->area.width = w;
- m_atr->area.height = h;
+ m_atr->area.width = (unsigned short)w;
+ m_atr->area.height = (unsigned short)h;
}
void ConvdispOv::update_icxatr()
@@ -1461,7 +1461,7 @@
char *str = im->utf8_to_native_str(utf8);
if (!str) {
logical.width = 0;
- logical.height = (i > 0) ? m_ce[i - 1].height : 0;
+ logical.height = (unsigned short)((i > 0) ? m_ce[i -
1].height : 0);
} else {
len = strlen(str);
XmbTextExtents(m_atr->font_set, str, len, &ink, &logical);
@@ -1656,7 +1656,7 @@
int i, len = 0;
if (c)
len = strlen(c);
- t->pushC16(len); // LENGTH
+ t->pushC16((C16)len); // LENGTH
for (i = 0; i < len; i++) {
t->pushC8(c[i]); // CTEXT
}
@@ -1672,7 +1672,7 @@
{
int i, len, stat, xstat;
len = m_pe->get_char_count();
- t->pushC16(len * 4);
+ t->pushC16((C16)(len * 4));
t->pushC16(0);
std::list<pe_ustring>::iterator it;
for (it = m_pe->ustrings.begin(); it != m_pe->ustrings.end();
++it) {
Modified: trunk/xim/locale.cpp
==============================================================================
--- trunk/xim/locale.cpp (original)
+++ trunk/xim/locale.cpp Fri Jan 4 04:03:24 2008
@@ -600,22 +600,22 @@
return RET_ILSEQ;
switch (count) { // note: falls through cases (no break)
case 6:
- dest[5] = 0x80 | (wc & 0x3f);
+ dest[5] = (unsigned char)(0x80 | (wc & 0x3f));
wc = wc >> 6; wc |= 0x4000000;
case 5:
- dest[4] = 0x80 | (wc & 0x3f);
+ dest[4] = (unsigned char)(0x80 | (wc & 0x3f));
wc = wc >> 6; wc |= 0x200000;
case 4:
- dest[3] = 0x80 | (wc & 0x3f);
+ dest[3] = (unsigned char)(0x80 | (wc & 0x3f));
wc = wc >> 6; wc |= 0x10000;
case 3:
- dest[2] = 0x80 | (wc & 0x3f);
+ dest[2] = (unsigned char)(0x80 | (wc & 0x3f));
wc = wc >> 6; wc |= 0x800;
case 2:
- dest[1] = 0x80 | (wc & 0x3f);
+ dest[1] = (unsigned char)(0x80 | (wc & 0x3f));
wc = wc >> 6; wc |= 0xc0;
case 1:
- dest[0] = wc;
+ dest[0] = (unsigned char)wc;
}
return count;
}
Modified: trunk/xim/xim.h
==============================================================================
--- trunk/xim/xim.h (original)
+++ trunk/xim/xim.h Fri Jan 4 04:03:24 2008
@@ -64,11 +64,11 @@
virtual int write_to_buf(unsigned char *buf, int buflen, int
byte_order) = 0;
virtual void dump(int byte_order) = 0;
- virtual int get_major() = 0;
+ virtual C8 get_major() = 0;
- virtual int pushC8(unsigned int) = 0;
- virtual int pushC16(unsigned int) = 0;
- virtual int pushC32(unsigned int) = 0;
+ virtual int pushC8(C8) = 0;
+ virtual int pushC16(C16) = 0;
+ virtual int pushC32(C32) = 0;
virtual int pushSTRING(char *) = 0;
virtual int pushBytes(const char *, int) = 0;
@@ -97,7 +97,7 @@
static int getPacketLength(unsigned char *, int byte_order);
};
-TxPacket *createTxPacket(int major, int minor);
+TxPacket *createTxPacket(C8 major, C8 minor);
RxPacket *createRxPacket(unsigned char *buf, int byte_order);
RxPacket *copyRxPacket(RxPacket *packet);
@@ -111,7 +111,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, const char *str);
+ void push_error_packet(C16 imid, C16 icid, C16 er, const char *str);
unsigned short to_hs(unsigned short s);
unsigned int to_hl(unsigned int l);
@@ -162,7 +162,7 @@
void clear_pending_queue();
private:
XimIC *get_ic(RxPacket *);
- std::list<int> mCreatedIm;
+ std::list<C16> mCreatedIm;
XimServer *mServer;
bool mSyncFlag;
bool mPreeditStartSyncFlag;
@@ -173,19 +173,19 @@
// definition of IM
class XimIM {
public:
- XimIM(Connection *, int id);
+ XimIM(Connection *, C16 id);
virtual ~XimIM();
virtual void create_ic(RxPacket *) = 0;
- virtual void destroy_ic(int) = 0;
- virtual void set_ic_focus(int icid) = 0;
+ virtual void destroy_ic(C16) = 0;
+ virtual void set_ic_focus(C16 icid) = 0;
virtual void set_ic_values(RxPacket *) = 0;
virtual void get_ic_values(RxPacket *) = 0;
- virtual void unset_ic_focus(int icid) = 0;
+ virtual void unset_ic_focus(C16 icid) = 0;
virtual void forward_event(RxPacket *) = 0;
- virtual void send_sync_reply(int icid) = 0;
- virtual void send_sync(int icid) = 0;
- virtual XimIC *get_ic_by_id(int icid) = 0;
+ virtual void send_sync_reply(C16 icid) = 0;
+ virtual void send_sync(C16 icid) = 0;
+ virtual XimIC *get_ic_by_id(C16 icid) = 0;
virtual void onSendPacket() = 0;
virtual void changeContext(const char *engine) = 0;
void set_encoding(const char *encoding);
@@ -202,7 +202,7 @@
protected:
Connection *mConn;
Locale *mLocale;
- int mID;
+ C16 mID;
char *mEncoding;
char *mLangRegion;
@@ -216,10 +216,10 @@
DefTree *mTreeTop;
};
-int unused_im_id();
-XimIM *create_im(Connection *, int id);
-XimIM *get_im_by_id(int id);
-void close_im(int id);
+C16 unused_im_id();
+XimIM *create_im(Connection *, C16 id);
+XimIM *get_im_by_id(C16 id);
+void close_im(C16 id);
struct keyEventX {
@@ -238,12 +238,12 @@
public:
icxatr();
~icxatr();
- void set_atr(int id, C8 *v, int byte_order);
- bool has_atr(int id);
- bool is_changed(int id);
- void unset_change_mask(int id);
+ void set_atr(C16 id, C8 *v, int byte_order);
+ bool has_atr(C16 id);
+ bool is_changed(C16 id);
+ void unset_change_mask(C16 id);
void print();
- int getSize(int id);
+ C16 getSize(C16 id);
void set_locale_name(const char *locale);
bool use_xft();
@@ -271,16 +271,16 @@
// definition of IC
class XimIC {
public:
- XimIC(Connection *, int imid, int icid, const char *engine);
+ XimIC(Connection *, C16 imid, C16 icid, const char *engine);
~XimIC();
void setFocus();
void unsetFocus();
- int get_icid();
- int get_imid();
+ C16 get_icid();
+ C16 get_imid();
void OnKeyEvent(keyEventX );
void setICAttrs(void *, int);
- int get_ic_atr(int, TxPacket *);
+ C16 get_ic_atr(C16, TxPacket *);
void commit_string(const char *s);
void extra_input(char *t);
void reset_ic();
@@ -303,7 +303,7 @@
icxatr m_xatr;
void send_key_event(XKeyEvent *k);
int lookup_style(unsigned long);
- void set_ic_attr(int, C8 *, int );
+ void set_ic_attr(C16, C8 *, int);
void send_sync();
Connection *mConn;
@@ -311,8 +311,8 @@
// this after deletion of m_kkContext since it is also refered by
// m_kkContext.
Convdisp *mConvdisp;
- int mICid;
- int mIMid;
+ C16 mICid;
+ C16 mIMid;
uString mPending;
bool mIsActive;
keyState *m_keyState;
@@ -326,7 +326,7 @@
int style;
};
-XimIC *create_ic(Connection *, RxPacket *, int imid, int id, const
char *engine);
+XimIC *create_ic(Connection *, RxPacket *, C16 imid, C16 id, const
char *engine);
void procXClientMessage(XClientMessageEvent *m);
#endif
Modified: trunk/xim/ximic.cpp
==============================================================================
--- trunk/xim/ximic.cpp (original)
+++ trunk/xim/ximic.cpp Fri Jan 4 04:03:24 2008
@@ -182,12 +182,12 @@
free(m_locale);
}
-bool icxatr::has_atr(int id)
+bool icxatr::has_atr(C16 id)
{
return atr_mask & (1 << id);
}
-void icxatr::set_atr(int id, C8 *val, int o)
+void icxatr::set_atr(C16 id, C8 *val, int o)
{
switch (id) {
case ICA_InputStyle:
@@ -250,7 +250,7 @@
change_mask |= (1 << id);
}
-bool icxatr::is_changed(int id)
+bool icxatr::is_changed(C16 id)
{
if (change_mask & (1 << id))
return true;
@@ -258,7 +258,7 @@
return false;
}
-void icxatr::unset_change_mask(int id)
+void icxatr::unset_change_mask(C16 id)
{
change_mask &= (~(1 << id));
}
@@ -314,7 +314,7 @@
}
-int icxatr::getSize(int id)
+C16 icxatr::getSize(C16 id)
{
switch (id) {
case ICA_FocusWindow:
@@ -338,7 +338,7 @@
return m_use_xft;
}
-XimIC::XimIC(Connection *c, int imid, int icid, const char *engine)
+XimIC::XimIC(Connection *c, C16 imid, C16 icid, const char *engine)
{
mConn = c;
mIMid = imid;
@@ -378,12 +378,12 @@
return mIsActive;
}
-int XimIC::get_icid()
+C16 XimIC::get_icid()
{
return mICid;
}
-int XimIC::get_imid()
+C16 XimIC::get_imid()
{
return mIMid;
}
@@ -436,21 +436,21 @@
t->pushC16(mIMid);
t->pushC16(mICid);
t->pushC16(1); // flag, synchronous
- t->pushC16((e->serial >> 16) & 0xffff);
+ t->pushC16((C16)((e->serial >> 16) & 0xffff));
- t->pushC8(e->type);
- t->pushC8(e->keycode);
- t->pushC16(e->serial & 0xffff);
+ t->pushC8((C8)e->type);
+ t->pushC8((C8)e->keycode);
+ t->pushC16((C16)e->serial & 0xffff);
t->pushC32(e->time);
t->pushC32(e->root);
t->pushC32(e->window);
t->pushC32(e->subwindow);
- t->pushC16(e->x_root);
- t->pushC16(e->y_root);
- t->pushC16(e->x);
- t->pushC16(e->y);
- t->pushC16(e->state);
- t->pushC8(e->same_screen);
+ t->pushC16((C16)e->x_root);
+ t->pushC16((C16)e->y_root);
+ t->pushC16((C16)e->x);
+ t->pushC16((C16)e->y);
+ t->pushC16((C16)e->state);
+ t->pushC8((C8)e->same_screen);
t->pushC8(0);
mConn->push_packet(t);
}
@@ -489,7 +489,7 @@
int byte_order = mConn->byte_order();
int i;
for (i = 0; i < len;) {
- int atr_id, atr_len;
+ C16 atr_id, atr_len;
atr_id = readC16(&p[i], byte_order);
i += 2;
@@ -508,9 +508,9 @@
}
}
-int XimIC::get_ic_atr(int id, TxPacket *t)
+C16 XimIC::get_ic_atr(C16 id, TxPacket *t)
{
- int l = m_xatr.getSize(id);
+ C16 l = m_xatr.getSize(id);
if (!t)
return l;
@@ -547,7 +547,7 @@
return IS_INVALID;
}
-void XimIC::set_ic_attr(int id, C8 *val, int len)
+void XimIC::set_ic_attr(C16 id, C8 *val, int len)
{
if (id == ICA_PreeditAttribute || id == ICA_StatusAttributes)
setICAttrs(val, len); // list of attribute
@@ -582,11 +582,12 @@
s = m_kkContext->get_preedit_string();
if (!s.empty()) {
char *p;
- int i, len = 0;
+ C16 i;
+ int len = 0;
p = get_im_by_id(mIMid)->uStringToCtext(&s);
if (p) {
len = strlen(p);
- t->pushC16(len); // length of committed strings
+ t->pushC16((C16)len); // length of committed strings
for (i = 0; i < len; i++) {
t->pushC8(p[i]); // put string here
}
@@ -642,7 +643,7 @@
int i, len;
len = strlen(p);
- t->pushC16(len);
+ t->pushC16((C16)len);
for (i = 0; i < len; i++) {
t->pushC8(p[i]);
}
@@ -682,7 +683,7 @@
return im->get_lang_region();
}
-XimIC *create_ic(Connection *c, RxPacket *p, int imid, int icid, const
char *engine)
+XimIC *create_ic(Connection *c, RxPacket *p, C16 imid, C16 icid, const
char *engine)
{
XimIC *ic;
ic = new XimIC(c, imid, icid, engine);
Modified: trunk/xim/ximim.cpp
==============================================================================
--- trunk/xim/ximim.cpp (original)
+++ trunk/xim/ximim.cpp Fri Jan 4 04:03:24 2008
@@ -50,7 +50,7 @@
# include <alloca.h>
#endif
-static std::map<int, XimIM *> g_ims;
+static std::map<C16, XimIM *> g_ims;
// tables
static input_style input_style_tab_with_over_the_spot[] = {
@@ -79,30 +79,30 @@
class XimIM_impl : public XimIM {
public:
- XimIM_impl(Connection *c, int id);
+ XimIM_impl(Connection *c, C16 id);
virtual ~XimIM_impl();
virtual void create_ic(RxPacket *);
- virtual void destroy_ic(int);
- virtual void set_ic_focus(int icid);
+ virtual void destroy_ic(C16);
+ virtual void set_ic_focus(C16 icid);
virtual void set_ic_values(RxPacket *);
virtual void get_ic_values(RxPacket *);
- virtual void unset_ic_focus(int icid);
+ virtual void unset_ic_focus(C16 icid);
virtual void forward_event(RxPacket *);
- virtual void send_sync_reply(int icid);
- virtual void send_sync(int icid);
- virtual XimIC *get_ic_by_id(int id);
+ virtual void send_sync_reply(C16 icid);
+ virtual void send_sync(C16 icid);
+ virtual XimIC *get_ic_by_id(C16 id);
virtual void onSendPacket();
virtual void changeContext(const char *);
private:
- int unused_ic_id();
+ C16 unused_ic_id();
void free_all_ic();
void delete_ic(XimIC *);
char *mEngineName;
- std::map<int, XimIC *> m_ics;
+ std::map<C16, XimIC *> m_ics;
};
-XimIM_impl::XimIM_impl(Connection *c, int id) : XimIM(c, id)
+XimIM_impl::XimIM_impl(Connection *c, C16 id) : XimIM(c, id)
{
mEngineName = strdup(mConn->getXimServer()->getIMName());
}
@@ -116,7 +116,7 @@
void XimIM_impl::create_ic(RxPacket *p)
{
XimIC *ic;
- int icid= unused_ic_id();
+ C16 icid= unused_ic_id();
// create compose table with the first ic
if (icid == 1)
@@ -139,7 +139,7 @@
mConn->push_packet(t);
}
-void XimIM_impl::destroy_ic(int icid)
+void XimIM_impl::destroy_ic(C16 icid)
{
TxPacket *t;
t = createTxPacket(XIM_DESTROY_IC_REPLY, 0);
@@ -154,7 +154,7 @@
void XimIM_impl::changeContext(const char *engine)
{
- std::map<int, XimIC *>::iterator i;
+ std::map<C16, XimIC *>::iterator i;
for (i = m_ics.begin(); i != m_ics.end(); ++i) {
(*i).second->changeContext(engine);
}
@@ -165,7 +165,7 @@
void XimIM_impl::set_ic_values(RxPacket *p)
{
- int imid, icid;
+ C16 imid, icid;
XimIC *ic;
p->rewind();
imid = p->getC16();
@@ -194,7 +194,7 @@
void XimIM_impl::get_ic_values(RxPacket *p)
{
- int icid;
+ C16 icid;
XimIC *ic;
p->rewind();
p->getC16();
@@ -207,14 +207,15 @@
TxPacket *t = createTxPacket(XIM_GET_IC_VALUES_REPLY, 0);
t->pushC16(mID);
t->pushC16(icid);
- int i, id, l;
+ int i, l;
+ C16 id;
l = 0;
for (i = 0; i < len / 2; i++) {
id = p->getC16();
l += ic->get_ic_atr(id, 0);
l += 4;
}
- t->pushC16(l);
+ t->pushC16((C16)l);
t->pushC16(0);
p->rewind();
@@ -231,34 +232,34 @@
mConn->push_packet(t);
}
-int XimIM_impl::unused_ic_id()
+C16 XimIM_impl::unused_ic_id()
{
- std::map<int, XimIC *>::iterator i;
- int max_id = 1; // Does ID of input-context start with 1?
+ std::map<C16, XimIC *>::iterator i;
+ C16 max_id = 1; // Does ID of input-context start with 1?
for (i = m_ics.begin(); i != m_ics.end(); ++i) {
if (max_id <= (*i).first)
- max_id = (*i).first + 1;
+ max_id = (C16)((*i).first + 1);
}
return max_id;
}
-void XimIM_impl::set_ic_focus(int icid)
+void XimIM_impl::set_ic_focus(C16 icid)
{
XimIC *ic = get_ic_by_id(icid);
if (ic)
ic->setFocus();
}
-void XimIM_impl::unset_ic_focus(int icid)
+void XimIM_impl::unset_ic_focus(C16 icid)
{
XimIC *ic = get_ic_by_id(icid);
if (ic)
ic->unsetFocus();
}
-XimIC *XimIM_impl::get_ic_by_id(int icid)
+XimIC *XimIM_impl::get_ic_by_id(C16 icid)
{
- std::map<int, XimIC *>::iterator it;
+ std::map<C16, XimIC *>::iterator it;
it = m_ics.find(icid);
if (it == m_ics.end())
return 0;
@@ -273,7 +274,8 @@
keyEventX k;
xEvent ev_raw;
- int imid, icid, flag;
+ C16 imid, icid;
+ int flag;
XimIC *ic;
imid = p->getC16();
@@ -342,7 +344,7 @@
void XimIM_impl::free_all_ic()
{
- std::map<int, XimIC *>::iterator i;
+ std::map<C16, XimIC *>::iterator i;
for (i = m_ics.begin(); i != m_ics.end(); ++i) {
(*i).second->unsetFocus();
delete (*i).second;
@@ -352,7 +354,7 @@
void XimIM_impl::delete_ic(XimIC *ic)
{
- std::map<int, XimIC *>::iterator it;
+ std::map<C16, XimIC *>::iterator it;
for (it = m_ics.begin(); it != m_ics.end(); ++it) {
if (it->second == ic) {
it->second->unsetFocus();
@@ -363,7 +365,7 @@
}
}
-void XimIM_impl::send_sync_reply(int icid)
+void XimIM_impl::send_sync_reply(C16 icid)
{
TxPacket *t = createTxPacket(XIM_SYNC_REPLY, 0);
t->pushC16(mID);
@@ -371,7 +373,7 @@
mConn->push_packet(t);
}
-void XimIM_impl::send_sync(int icid)
+void XimIM_impl::send_sync(C16 icid)
{
TxPacket *t = createTxPacket(XIM_SYNC, 0);
t->pushC16(mID);
@@ -381,13 +383,13 @@
void XimIM_impl::onSendPacket()
{
- std::map<int, XimIC *>::iterator i;
+ std::map<C16, XimIC *>::iterator i;
for (i = m_ics.begin(); i != m_ics.end(); ++i) {
(*i).second->onSendPacket();
}
}
-XimIM::XimIM(Connection *c, int id)
+XimIM::XimIM(Connection *c, C16 id)
{
mConn = c;
mID = id;
@@ -488,30 +490,30 @@
return ret;
}
-int unused_im_id()
+C16 unused_im_id()
{
- int max_id;
- std::map<int, XimIM *>::iterator i;
+ C16 max_id;
+ std::map<C16, XimIM *>::iterator i;
max_id = 1;
for (i = g_ims.begin(); i != g_ims.end(); ++i) {
if ((*i).first == max_id)
- max_id = (*i).first + 1;
+ max_id = (C16)((*i).first + 1);
}
return max_id;
}
-XimIM *create_im(Connection *c, int id)
+XimIM *create_im(Connection *c, C16 id)
{
XimIM *im;
im = new XimIM_impl(c, id);
- std::pair<int, XimIM *> p(id, im);
+ std::pair<C16, XimIM *> p(id, im);
g_ims.insert(p);
return im;
}
-XimIM *get_im_by_id(int id)
+XimIM *get_im_by_id(C16 id)
{
- std::map<int, XimIM *>::iterator it;
+ std::map<C16, XimIM *>::iterator it;
it = g_ims.find(id);
if (it == g_ims.end())
return NULL;
@@ -519,7 +521,7 @@
return it->second;
}
-void close_im(int id)
+void close_im(C16 id)
{
XimIM *im;
@@ -527,7 +529,7 @@
if (im)
delete im;
- std::map<int, XimIM *>::iterator it;
+ std::map<C16, XimIM *>::iterator it;
it = g_ims.find(id);
if (it != g_ims.end())
g_ims.erase(it);
Modified: trunk/xim/ximpacket.cpp
==============================================================================
--- trunk/xim/ximpacket.cpp (original)
+++ trunk/xim/ximpacket.cpp Fri Jan 4 04:03:24 2008
@@ -63,26 +63,26 @@
void writeC16(C16 val, int byte_order, unsigned char *buf)
{
if (byte_order == LSB_FIRST) {
- buf[0] = val & 255;
- buf[1] = (val >> 8) & 255;
+ buf[0] = (unsigned char)(val & 255);
+ buf[1] = (unsigned char)((val >> 8) & 255);
} else {
- buf[1] = val & 255;
- buf[0] = (val >> 8) & 255;
+ buf[1] = (unsigned char)(val & 255);
+ buf[0] = (unsigned char)((val >> 8) & 255);
}
}
void writeC32(unsigned int val, int byte_order, unsigned char *buf)
{
if (byte_order == LSB_FIRST) {
- buf[0] = val & 255;
- buf[1] = (val >> 8) & 255;
- buf[2] = (val >> 16) & 255;
- buf[3] = (val >> 24) & 255;
+ buf[0] = (unsigned char)(val & 255);
+ buf[1] = (unsigned char)((val >> 8) & 255);
+ buf[2] = (unsigned char)((val >> 16) & 255);
+ buf[3] = (unsigned char)((val >> 24) & 255);
} else {
- buf[3] = val & 255;
- buf[2] = (val >> 8) & 255;
- buf[1] = (val >> 16) & 255;
- buf[0] = (val >> 24) & 255;
+ buf[3] = (unsigned char)(val & 255);
+ buf[2] = (unsigned char)((val >> 8) & 255);
+ buf[1] = (unsigned char)((val >> 16) & 255);
+ buf[0] = (unsigned char)((val >> 24) & 255);
}
}
@@ -95,9 +95,9 @@
{
C16 v;
if (byte_order == LSB_FIRST)
- v = buf[0] + buf[1] * 256;
+ v = (C16)(buf[0] + buf[1] * 256);
else
- v = buf[1] + buf[0] * 256;
+ v = (C16)(buf[1] + buf[0] * 256);
return v;
}
@@ -124,7 +124,7 @@
class TxC8 : public TxElement {
public:
- TxC8(int v) {
+ TxC8(C8 v) {
val = v;
}
virtual int get_size() {
@@ -140,7 +140,7 @@
class TxC16 : public TxElement {
public:
- TxC16(int v) {
+ TxC16(C16 v) {
val = v;
}
virtual int get_size() {
@@ -156,7 +156,7 @@
class TxC32 : public TxElement {
public:
- TxC32(unsigned int v) {
+ TxC32(C32 v) {
val = v;
}
virtual int get_size() {
@@ -185,7 +185,7 @@
return 2 + m_len + pad4(2 + m_len);
}
virtual int write_to_buf(unsigned char *buf, int bo) {
- writeC16(m_len, bo, buf);
+ writeC16((C16)m_len, bo, buf);
memcpy(&buf[2], m_str, m_len);
return get_size();
}
@@ -223,29 +223,29 @@
class TxPacket_impl : public TxPacket {
public:
- TxPacket_impl(int major, int minor);
+ TxPacket_impl(C8 major, C8 minor);
virtual ~TxPacket_impl();
virtual int get_length();
virtual int write_to_buf(unsigned char *buf, int buflen, int byte_order);
virtual void dump(int byte_order);
- virtual int get_major();
+ virtual C8 get_major();
- virtual int pushC8(unsigned int);
- virtual int pushC16(unsigned int);
- virtual int pushC32(unsigned int);
+ virtual int pushC8(C8);
+ virtual int pushC16(C16);
+ virtual int pushC32(C32);
virtual int pushSTRING(char *);
virtual int pushBytes(const char *, int);
virtual int pop_back();
private:
void write_header(unsigned char *buf, int l, int byte_order);
- int m_major, m_minor;
+ C8 m_major, m_minor;
std::list <TxElement *> m_elms;
};
-TxPacket_impl::TxPacket_impl(int major, int minor)
+TxPacket_impl::TxPacket_impl(C8 major, C8 minor)
{
m_major = major;
m_minor = minor;
@@ -288,7 +288,7 @@
return l;
}
-int TxPacket_impl::pushC8(unsigned int v)
+int TxPacket_impl::pushC8(C8 v)
{
TxElement *e;
e = new TxC8(v);
@@ -296,7 +296,7 @@
return e->get_size();
}
-int TxPacket_impl::pushC16(unsigned int v)
+int TxPacket_impl::pushC16(C16 v)
{
TxElement *e;
e = new TxC16(v);
@@ -304,7 +304,7 @@
return e->get_size();
}
-int TxPacket_impl::pushC32(unsigned int v)
+int TxPacket_impl::pushC32(C32 v)
{
TxElement *e;
e = new TxC32(v);
@@ -343,7 +343,7 @@
{
buf[0] = m_major;
buf[1] = m_minor;
- writeC16(l / 4 - 1, byte_order, &buf[2]);
+ writeC16((C16)(l / 4 - 1), byte_order, &buf[2]);
}
void TxPacket_impl::dump(int byte_order)
@@ -357,12 +357,12 @@
free(buf);
}
-int TxPacket_impl::get_major()
+C8 TxPacket_impl::get_major()
{
return m_major;
}
-TxPacket *createTxPacket(int major, int minor)
+TxPacket *createTxPacket(C8 major, C8 minor)
{
return new TxPacket_impl(major, minor);
}
Modified: trunk/xim/ximserver.cpp
==============================================================================
--- trunk/xim/ximserver.cpp (original)
+++ trunk/xim/ximserver.cpp Fri Jan 4 04:03:24 2008
@@ -1106,7 +1106,8 @@
mModifier |= (gMod5Mask & mPreModState);
#if UIM_XIM_USE_JAPANESE_KANA_KEYBOARD_HACK
- mKey = uim_x_kana_input_hack_translate_key(x->key_sym, x->ev.xkey.keycode);
+ mKey = uim_x_kana_input_hack_translate_key(x->key_sym,
+ (KeyCode)x->ev.xkey.keycode);
#endif
if (x->key_sym < 128 && x->key_sym >= 32)
mKey = x->key_sym;
Modified: trunk/xim/ximtrans.cpp
==============================================================================
--- trunk/xim/ximtrans.cpp (original)
+++ trunk/xim/ximtrans.cpp Fri Jan 4 04:03:24 2008
@@ -91,16 +91,16 @@
};
static struct XIMATTRIBUTE {
- XIMATTRIBUTE(const char *n, int t);
+ XIMATTRIBUTE(const char *n, C16 t);
static void write_imattr_to_packet(TxPacket *p);
const char *name;
- int type;
+ C16 type;
} xim_attributes[] = {
XIMATTRIBUTE(XNQueryInputStyle, TYPE_XIMSTYLE),
};
-XIMATTRIBUTE::XIMATTRIBUTE(const char *n, int t)
+XIMATTRIBUTE::XIMATTRIBUTE(const char *n, C16 t)
{
name = n;
type = t;
@@ -119,11 +119,11 @@
l += strlen(xim_attributes[i].name);
l += pad4(strlen(xim_attributes[i].name) + 2);
}
- p->pushC16(l);
+ p->pushC16((C16)l);
for (i = 0; i < (int)(sizeof(xim_attributes) /
sizeof(XIMATTRIBUTE)); i++) {
- p->pushC16((unsigned int)i);
- p->pushC16((unsigned int)xim_attributes[i].type);
- p->pushC16((unsigned int)strlen(xim_attributes[i].name));
+ p->pushC16((C16)i);
+ p->pushC16(xim_attributes[i].type);
+ p->pushC16((C16)strlen(xim_attributes[i].name));
p->pushBytes(xim_attributes[i].name,
strlen(xim_attributes[i].name));
p->pushBytes(tmp, pad4(strlen(xim_attributes[i].name)) + 2);
@@ -131,10 +131,10 @@
}
static struct XICATTRIBUTE {
- XICATTRIBUTE(const char *n, int t);
+ XICATTRIBUTE(const char *n, C16 t);
static void write_icattr_to_packet(TxPacket *p);
const char *name;
- int type;
+ C16 type;
} xic_attributes[] = {
// the sequence is required to be same as the order of
// ICATTTRIBUTE defined in ximpn.h
@@ -159,7 +159,7 @@
XICATTRIBUTE(XNSeparatorofNestedList, TYPE_SEPARATOR),
};
-XICATTRIBUTE::XICATTRIBUTE(const char *n, int t)
+XICATTRIBUTE::XICATTRIBUTE(const char *n, C16 t)
{
name = n;
type = t;
@@ -177,12 +177,12 @@
l += strlen(xic_attributes[i].name);
l += pad4(strlen(xic_attributes[i].name) + 2);
}
- p->pushC16(l);
+ p->pushC16((C16)l);
p->pushC16(0);
for (i = 0; i < (int)(sizeof(xic_attributes) /
sizeof(XICATTRIBUTE)); i++) {
- p->pushC16((unsigned int)i);
- p->pushC16((unsigned int)xic_attributes[i].type);
- p->pushC16((unsigned int)strlen(xic_attributes[i].name));
+ p->pushC16((C16)i);
+ p->pushC16(xic_attributes[i].type);
+ p->pushC16((C16)strlen(xic_attributes[i].name));
p->pushBytes(xic_attributes[i].name,
strlen(xic_attributes[i].name));
p->pushBytes(tmp, pad4(strlen(xic_attributes[i].name) + 2));
@@ -202,7 +202,7 @@
Connection::~Connection()
{
// destruct all the IM created by this Connection
- std::list<int>::iterator i;
+ std::list<C16>::iterator i;
for (i = mCreatedIm.begin(); i != mCreatedIm.end(); ++i) {
close_im(*i);
}
@@ -320,7 +320,7 @@
void Connection::OnSend()
{
- std::list<int>::iterator i;
+ std::list<C16>::iterator i;
for (i = mCreatedIm.begin(); i != mCreatedIm.end(); ++i) {
XimIM *im;
im = get_im_by_id(*i);
@@ -331,7 +331,7 @@
void Connection::OnClose()
{
- std::list<int>::iterator i;
+ std::list<C16>::iterator i;
for (i = mCreatedIm.begin(); i != mCreatedIm.end(); ++i) {
close_im(*i);
}
@@ -348,7 +348,7 @@
mPTxQ.push_back(p);
}
-void Connection::push_error_packet(int imid, int icid, int er, const
char *str)
+void Connection::push_error_packet(C16 imid, C16 icid, C16 er, const
char *str)
{
TxPacket *t;
t = createTxPacket(XIM_ERROR, 0);
@@ -360,11 +360,11 @@
if (icid)
m += 2;
- t->pushC16(m);
+ t->pushC16((C16)m);
t->pushC16(er);
int l = strlen(str);
char tmp[4];
- t->pushC16(l);
+ t->pushC16((C16)l);
t->pushC16(0);
t->pushBytes(str, l);
t->pushBytes(tmp, pad4(l));
@@ -379,9 +379,9 @@
unsigned char *v;
v = (unsigned char *)&s;
if (host_byte_order == LSB_FIRST)
- s = (v[0] << 8) + v[1];
+ s = (unsigned short)((v[0] << 8) + v[1]);
else
- s = (v[1] << 8) + v[0];
+ s = (unsigned short)((v[1] << 8) + v[0]);
return s;
}
@@ -495,7 +495,7 @@
p->getStr8(buf);
TxPacket *t;
- int imid;
+ C16 imid;
XimIM *im;
imid = unused_im_id();
mCreatedIm.push_back(imid); // had to be deleted by the creator Connection
@@ -528,7 +528,7 @@
void Connection::xim_close(RxPacket *p)
{
- int imid;
+ C16 imid;
imid = p->getC16();
TxPacket *t;
t = createTxPacket(XIM_CLOSE_REPLY, 0);
@@ -536,7 +536,7 @@
t->pushC16(0);
push_packet(t);
close_im(imid);
- std::list<int>::iterator i;
+ std::list<C16>::iterator i;
for (i = mCreatedIm.begin(); i != mCreatedIm.end(); ++i) {
if (*i == imid) {
mCreatedIm.erase(i);
@@ -547,7 +547,7 @@
void Connection::xim_query_extension(RxPacket *p)
{
- int imid;
+ C16 imid;
imid = p->getC16();
TxPacket *t;
@@ -562,9 +562,9 @@
{
TxPacket *t;
t = createTxPacket(XIM_ENCODING_NEGOTIATION_REPLY, 0);
- C16 l, m, s;
- int i, idx, index;
- int imid;
+ C16 l, index;
+ int i, m, s;
+ C16 imid, idx;
char buf[32];
XimIM *im;
@@ -600,7 +600,7 @@
void Connection::xim_get_im_values(RxPacket *p)
{
int l, i;
- int imid;
+ C16 imid;
TxPacket *t;
t = createTxPacket(XIM_GET_IM_VALUES_REPLY, 0);
imid = p->getC16(); // input-method id
@@ -618,12 +618,14 @@
t->pushC16(16); // length
// XIMATTRIBUTE
- int nr_style;
+ C16 nr_style;
struct input_style *is = get_im_by_id(imid)->getInputStyles();
- for (nr_style = 0; is[nr_style].style; nr_style++);
+ for (nr_style = 0; is[nr_style].style; nr_style++) {
+ ;
+ }
t->pushC16(0); // attribute id
- t->pushC16(nr_style * 4); // length
+ t->pushC16((C16)(nr_style * 4)); // length
t->pushC16(nr_style); // number
t->pushC16(0);
@@ -636,7 +638,7 @@
void Connection::xim_set_ic_values(RxPacket *p)
{
- int imid;
+ C16 imid;
imid = p->getC16();
p->rewind();
XimIM *im;
@@ -647,7 +649,7 @@
void Connection::xim_get_ic_values(RxPacket *p)
{
- int imid;
+ C16 imid;
imid = p->getC16();
p->rewind();
XimIM *im;
@@ -658,7 +660,7 @@
void Connection::xim_create_ic(RxPacket *p)
{
XimIM *im;
- int imid;
+ C16 imid;
imid = p->getC16();
p->rewind();
im = get_im_by_id(imid);
@@ -667,8 +669,8 @@
void Connection::xim_destroy_ic(RxPacket *p)
{
- int imid;
- int icid;
+ C16 imid;
+ C16 icid;
XimIM *im;
imid = p->getC16();
icid = p->getC16();
@@ -678,7 +680,7 @@
void Connection::xim_set_ic_focus(RxPacket *p)
{
- int imid;
+ C16 imid;
XimIM *im;
imid = p->getC16();
im = get_im_by_id(imid);
@@ -687,7 +689,7 @@
void Connection::xim_unset_ic_focus(RxPacket *p)
{
- int imid;
+ C16 imid;
XimIM *im;
imid = p->getC16();
im = get_im_by_id(imid);
@@ -696,7 +698,7 @@
void Connection::xim_forward_event(RxPacket *p)
{
- int imid, icid;
+ C16 imid, icid;
XimIM *im;
imid = p->getC16();
@@ -738,7 +740,8 @@
void Connection::xim_error(RxPacket *p)
{
- int imid, icid, mask, ecode, len;
+ C16 imid, icid, mask, ecode;
+ int len;
char *buf;
imid = p->getC16();
@@ -769,8 +772,9 @@
XimIC *Connection::get_ic(RxPacket *p)
{
- int imid, icid;
+ C16 imid, icid;
XimIM *im;
+
imid = p->getC16();
icid = p->getC16();
p->rewind();