Revision: 7006
Author: [email protected]
Date: Sun May 1 21:20:23 2011
Log: * xim/canddisp.cpp
- (candwin_read_cb): Suppress warnings by casting.
* xim/compose.cpp
- (XimIM::get_mb_string, XimIM::parse_compose_line, KeySymToUcs4,
mb_string_to_utf8): Ditto.
* xim/connection.cpp
- (XConnection::readToBuf): Ditto.
* xim/convdisp.cpp
- (PeWin::draw_char, PeWin::set_back, PeLineWin::get_char_width,
ConvdispOv::check_atr, ConvdispOv::layoutCharEnt,
ConvdispOs::compose_preedit_array,
ConvdispOs::compose_feedback_array): Ditto.
* xim/helper.cpp
- (send_im_list, helper_str_parse): Ditto.
* xim/locale.cpp
- (valid_locales, all_locales): Ditto.
* xim/main.cpp
- (add_window_watch, remove_window_watch, findWindowIf, notifyLocale,
init_supported_locales): Ditto.
* xim/ximic.cpp
- (icxatr::icxatr, XimIC::send_key_event, XimIC::get_ic_atr,
XimIC::reset_ic, XimIC::onSendPacket): Ditto.
* xim/ximpacket.cpp
- (TxString::TxString): Ditto.
* xim/ximserver.cpp
- (XimServer::strToUstring,
InputContext::get_caret_state_label_from_prop_list,
InputContext::update_prop_list, keyState::check_key): Ditto.
* xim/ximtrans.cpp
- (XIMATTRIBUTE::write_imattr_to_packet,
XICATTRIBUTE::write_icattr_to_packet,
Connection::push_error_packet): Ditto.
http://code.google.com/p/uim/source/detail?r=7006
Modified:
/trunk/xim/canddisp.cpp
/trunk/xim/compose.cpp
/trunk/xim/connection.cpp
/trunk/xim/convdisp.cpp
/trunk/xim/helper.cpp
/trunk/xim/locale.cpp
/trunk/xim/main.cpp
/trunk/xim/ximic.cpp
/trunk/xim/ximpacket.cpp
/trunk/xim/ximserver.cpp
/trunk/xim/ximtrans.cpp
=======================================
--- /trunk/xim/canddisp.cpp Thu Jan 6 18:09:56 2011
+++ /trunk/xim/canddisp.cpp Sun May 1 21:20:23 2011
@@ -293,7 +293,7 @@
char buf[1024];
int n;
- n = read(fd, buf, 1024 - 1);
+ n = static_cast<int>(read(fd, buf, 1024 - 1));
if (n == 0) {
terminate_canddisp_connection();
return;
=======================================
--- /trunk/xim/compose.cpp Thu Jan 6 18:09:56 2011
+++ /trunk/xim/compose.cpp Sun May 1 21:20:23 2011
@@ -427,7 +427,7 @@
mb = utf8_to_native_str(local_buf);
if (!mb)
return 0;
- len = strlen(mb);
+ len = static_cast<int>(strlen(mb));
strlcpy(buf, mb, MB_LEN_MAX + 1);
free(mb);
@@ -510,7 +510,7 @@
if (token != KEY)
goto error;
}
- tmp = modmask(*tokenbuf);
+ tmp = static_cast<unsigned int>(modmask(*tokenbuf));
if (!tmp) {
goto error;
}
@@ -1076,7 +1076,7 @@
return (keysym & 0x00ffffff);
if (keysym > 0 && keysym < 0x100)
- return keysym;
+ return static_cast<unsigned int>(keysym);
else if (keysym > 0x1a0 && keysym < 0x200)
return keysym_to_unicode_1a1_1ff[keysym - 0x1a1];
else if (keysym > 0x2a0 && keysym < 0x2ff)
@@ -1141,7 +1141,7 @@
strlcpy(utf8, outbuf, len + 1);
free(outbuf);
- return strlen(utf8);
+ return static_cast<int>(strlen(utf8));
}
/*
=======================================
--- /trunk/xim/connection.cpp Thu Jan 6 18:09:56 2011
+++ /trunk/xim/connection.cpp Sun May 1 21:20:23 2011
@@ -240,7 +240,7 @@
if (format == 8) {
memcpy(&mBuf.buf[mBuf.len], data, nrItems);
- mBuf.len += nrItems;
+ mBuf.len += static_cast<int>(nrItems);
} else
return false;
XFree(data);
=======================================
--- /trunk/xim/convdisp.cpp Thu Jan 6 18:09:56 2011
+++ /trunk/xim/convdisp.cpp Sun May 1 21:20:23 2011
@@ -489,7 +489,7 @@
native_str = im->utf8_to_native_str(utf8);
if (!native_str)
return;
- len = strlen(native_str);
+ len = static_cast<int>(strlen(native_str));
XmbDrawImageString(XimServer::gDpy, mPixmap, mFontset,
gc, x, y, native_str, len);
free(native_str);
@@ -499,7 +499,7 @@
void PeWin::set_back(unsigned long p)
{
- mBack = p;
+ mBack = static_cast<unsigned int>(p);
XSetBackground(XimServer::gDpy, mGC, p);
XSetForeground(XimServer::gDpy, mClearGC, p);
#if HAVE_XFT_UTF8_STRING
@@ -518,7 +518,7 @@
void PeWin::set_fore(unsigned long p)
{
- mFore = p;
+ mFore = static_cast<unsigned int>(p);
XSetForeground(XimServer::gDpy, mGC, p);
XSetBackground(XimServer::gDpy, mClearGC, p);
#if HAVE_XFT_UTF8_STRING
@@ -719,7 +719,7 @@
native_str = im->utf8_to_native_str(utf8);
if (!native_str)
return 0;
- len = strlen(native_str);
+ len = static_cast<int>(strlen(native_str));
XmbTextExtents(mFontset, native_str, len, &ink, &logical);
free(native_str);
}
@@ -1395,12 +1395,14 @@
}
if (!m_atr->has_atr(ICA_Foreground))
- m_atr->foreground_pixel = BlackPixel(XimServer::gDpy,
- DefaultScreen(XimServer::gDpy));
+ m_atr->foreground_pixel
+ = static_cast<C32>(BlackPixel(XimServer::gDpy,
+ DefaultScreen(XimServer::gDpy)));
if (!m_atr->has_atr(ICA_Background))
- m_atr->background_pixel = WhitePixel(XimServer::gDpy,
- DefaultScreen(XimServer::gDpy));
+ m_atr->background_pixel
+ = static_cast<C32>(WhitePixel(XimServer::gDpy,
+ DefaultScreen(XimServer::gDpy)));
return true;
}
@@ -1463,7 +1465,7 @@
logical.width = 0;
logical.height = (unsigned short)((i > 0) ? m_ce[i -
1].height : 0);
} else {
- len = strlen(str);
+ len = static_cast<int>(strlen(str));
XmbTextExtents(m_atr->font_set, str, len, &ink, &logical);
free(str);
}
@@ -1655,7 +1657,7 @@
char *c = im->uStringToCtext(&s);
int i, len = 0;
if (c)
- len = strlen(c);
+ len = static_cast<int>(strlen(c));
t->pushC16((C16)len); // LENGTH
for (i = 0; i < len; i++) {
t->pushC8(c[i]); // CTEXT
@@ -1675,7 +1677,7 @@
t->pushC16(0);
std::list<pe_ustring>::iterator it;
for (it = m_pe->ustrings.begin(); it != m_pe->ustrings.end(); ++it) {
- len = (*it).s.size();
+ len = static_cast<int>((*it).s.size());
stat = (*it).stat;
xstat = FB_None;
if (stat & PE_REVERSE)
=======================================
--- /trunk/xim/helper.cpp Thu Jan 6 18:09:56 2011
+++ /trunk/xim/helper.cpp Sun May 1 21:20:23 2011
@@ -106,7 +106,7 @@
it->desc ? it->desc : "");
if (!tmp)
return;
- len = strlen(buf) + strlen(tmp);
+ len = static_cast<int>(strlen(buf) + strlen(tmp));
buf = (char *)realloc(buf, sizeof(char) * len + 1);
if (!buf)
return;
@@ -117,7 +117,7 @@
asprintf(&tmp, "selected\n");
if (!tmp)
return;
- len = strlen(buf) + strlen(tmp);
+ len = static_cast<int>(strlen(buf) + strlen(tmp));
buf = (char *)realloc(buf, sizeof(char) * len + 1);
if (!buf)
return;
@@ -127,7 +127,7 @@
asprintf(&tmp, "\n");
if (!tmp)
return;
- len = strlen(buf) + strlen(tmp);
+ len = static_cast<int>(strlen(buf) + strlen(tmp));
buf = (char *)realloc(buf, sizeof(char) * len + 1);
if (!buf)
return;
@@ -195,7 +195,7 @@
if (!strcmp(charset, "UTF-8"))
focusedContext->extra_input(line);
else {
- int len = strlen(line);
+ int len = static_cast<int>(strlen(line));
char *utf8_str = (char *)malloc(len * 6 + 1);
if (!utf8_str)
return;
=======================================
--- /trunk/xim/locale.cpp Thu Jan 6 18:09:56 2011
+++ /trunk/xim/locale.cpp Sun May 1 21:20:23 2011
@@ -282,7 +282,7 @@
while ((locale = strsep(&tmpp, ":")) != NULL) {
if (setlocale(LC_CTYPE, locale) != NULL) {
asprintf(&validated, "%s:", locale);
- len += strlen(validated);
+ len += static_cast<int>(strlen(validated));
if (valid_locales) {
valid_locales = (char *)realloc(valid_locales, len + 1);
strcat(valid_locales, validated);
@@ -309,7 +309,7 @@
if (setlocale(LC_CTYPE, test_locale) != NULL) {
asprintf(&validated, "%s:", locale);
- len += strlen(validated);
+ len += static_cast<int>(strlen(validated));
if (valid_locales) {
valid_locales = (char *)realloc(valid_locales, len
+ 1);
@@ -368,10 +368,10 @@
free((char *)valid_locales);
if (locales == NULL) {
- len = strlen(tmp);
+ len = static_cast<int>(strlen(tmp));
locales = strdup(tmp);
} else {
- len += strlen(tmp);
+ len += static_cast<int>(strlen(tmp));
locales = (char *)realloc(locales, len + 1);
strcat(locales, tmp);
}
=======================================
--- /trunk/xim/main.cpp Thu Jan 6 18:09:56 2011
+++ /trunk/xim/main.cpp Sun May 1 21:20:23 2011
@@ -185,7 +185,7 @@
void
add_window_watch(Window id, WindowIf *w, int mask)
{
- std::pair<unsigned int, WindowIf *> p(id, w);
+ std::pair<unsigned int, WindowIf *> p(static_cast<unsigned int>(id),
w);
window_watch_stat.insert(p);
// Event mask is the same value defined in X,
@@ -203,7 +203,7 @@
remove_window_watch(Window id)
{
std::map<unsigned int, WindowIf *>::iterator i;
- i = window_watch_stat.find(id);
+ i = window_watch_stat.find(static_cast<unsigned int>(id));
if (i != window_watch_stat.end())
window_watch_stat.erase(i);
}
@@ -212,7 +212,7 @@
findWindowIf(Window w)
{
std::map<unsigned int, WindowIf *>::iterator i;
- i = window_watch_stat.find(w);
+ i = window_watch_stat.find(static_cast<unsigned int>(w));
if (i == window_watch_stat.end())
return NULL;
@@ -263,7 +263,8 @@
void
notifyLocale(XEvent *ev)
{
- sendSelectionNotify(ev, supported_locales, strlen(supported_locales) +
1);
+ sendSelectionNotify(ev, supported_locales,
+ static_cast<int>(strlen(supported_locales)) + 1);
if (g_option_mask & OPT_TRACE)
printf("selection notify request for locale.\n");
}
@@ -428,7 +429,7 @@
int len;
asprintf(&supported_locales, "@locale=");
- len = strlen(supported_locales);
+ len = static_cast<int>(strlen(supported_locales));
// get all locales
s = compose_localenames_from_im_lang("*");
@@ -444,7 +445,7 @@
tmp = sep;
}
- len += strlen(locales);
+ len += static_cast<int>(strlen(locales));
supported_locales = (char *)realloc(supported_locales,
sizeof(char) * len + 1);
if (!supported_locales) {
=======================================
--- /trunk/xim/ximic.cpp Thu Jan 6 18:09:56 2011
+++ /trunk/xim/ximic.cpp Sun May 1 21:20:23 2011
@@ -162,8 +162,10 @@
font_set_name = NULL;
font_set = NULL;
m_locale = NULL;
- foreground_pixel = BlackPixel(XimServer::gDpy,
DefaultScreen(XimServer::gDpy));
- background_pixel = WhitePixel(XimServer::gDpy,
DefaultScreen(XimServer::gDpy));
+ foreground_pixel = static_cast<C32>(BlackPixel(XimServer::gDpy,
+ DefaultScreen(XimServer::gDpy)));
+ background_pixel = static_cast<C32>(WhitePixel(XimServer::gDpy,
+ DefaultScreen(XimServer::gDpy)));
line_space = 0;
#if HAVE_XFT_UTF8_STRING
m_use_xft = uim_scm_symbol_value_bool("uim-xim-use-xft-font?");
@@ -440,10 +442,10 @@
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->pushC32(static_cast<C32>(e->time));
+ t->pushC32(static_cast<C32>(e->root));
+ t->pushC32(static_cast<C32>(e->window));
+ t->pushC32(static_cast<C32>(e->subwindow));
t->pushC16((C16)e->x_root);
t->pushC16((C16)e->y_root);
t->pushC16((C16)e->x);
@@ -515,7 +517,7 @@
switch (id) {
case ICA_FocusWindow:
- t->pushC32(m_xatr.focus_window);
+ t->pushC32(static_cast<C32>(m_xatr.focus_window));
break;
case ICA_FilterEvents:
if (g_option_mask & OPT_ON_DEMAND_SYNC)
@@ -526,7 +528,7 @@
t->pushC32(KeyPressMask);
break;
case ICA_InputStyle:
- t->pushC32(m_xatr.input_style);
+ t->pushC32(static_cast<C32>(m_xatr.input_style));
break;
default:
printf("try to get unknown ic attribute %d.\n", id);
@@ -585,7 +587,7 @@
int len = 0;
p = get_im_by_id(mIMid)->uStringToCtext(&s);
if (p) {
- len = strlen(p);
+ len = static_cast<int>(strlen(p));
t->pushC16((C16)len); // length of committed strings
for (i = 0; i < len; i++) {
t->pushC8(p[i]); // put string here
@@ -640,7 +642,7 @@
t->pushC16(3); // XLookupChars|synchronous
int i, len;
- len = strlen(p);
+ len = static_cast<int>(strlen(p));
t->pushC16((C16)len);
for (i = 0; i < len; i++) {
=======================================
--- /trunk/xim/ximpacket.cpp Thu Jan 6 18:09:56 2011
+++ /trunk/xim/ximpacket.cpp Sun May 1 21:20:23 2011
@@ -173,10 +173,10 @@
class TxString : public TxElement {
public:
TxString(char *s) {
- init(s, strlen(s));
+ init(s, static_cast<int>(strlen(s)));
}
TxString(char *s, int len) {
- init(s, len);
+ init(s, static_cast<int>(len));
}
virtual ~TxString() {
free(m_str);
=======================================
--- /trunk/xim/ximserver.cpp Thu Jan 6 18:09:56 2011
+++ /trunk/xim/ximserver.cpp Sun May 1 21:20:23 2011
@@ -272,7 +272,7 @@
int l = 0, nbyte = 0;
uchar ch;
- len = strlen(s);
+ len = static_cast<int>(strlen(s));
while (l < len && *s != 0 &&
(nbyte = utf8_mbtowc(&ch, (const unsigned char *)s, len - l)) > 0) {
d->push_back(ch);
@@ -1060,7 +1060,7 @@
if (p) {
p++;
q = strchr(p, '\t');
- len = q - p;
+ len = static_cast<int>(q - p);
if (q && len < 10) {
strlcpy(label, p, len + 1);
if (!state_label) {
@@ -1110,8 +1110,8 @@
Canddisp *disp = canddisp_singleton();
if (strcmp(show_caret_with, "time") == 0)
- timeout =
- uim_scm_symbol_value_int("bridge-show-input-state-time-length");
+ timeout = static_cast<int>(uim_scm_symbol_value_int(
+ "bridge-show-input-state-time-length"));
else
timeout = 0;
@@ -1257,18 +1257,19 @@
mModifier |= (gMod5Mask & mPreModState);
if (x->key_sym < 128 && x->key_sym >= 32)
- mKey = x->key_sym;
+ mKey = static_cast<int>(x->key_sym);
else if (x->key_sym >= XK_F1 && x->key_sym <= XK_F35)
- mKey = x->key_sym - XK_F1 + UKey_F1;
+ mKey = static_cast<int>(x->key_sym - XK_F1 + UKey_F1);
// GTK+ and Qt don't support dead_stroke yet
else if (x->key_sym >= XK_dead_grave && x->key_sym <= XK_dead_horn)
- mKey = x->key_sym - XK_dead_grave + UKey_Dead_Grave;
+ mKey = static_cast<int>(x->key_sym - XK_dead_grave + UKey_Dead_Grave);
else if (x->key_sym >= XK_Kanji && x->key_sym <= XK_Eisu_toggle)
- mKey = x->key_sym - XK_Kanji + UKey_Kanji;
+ mKey = static_cast<int>(x->key_sym - XK_Kanji + UKey_Kanji);
else if (x->key_sym >= XK_Hangul && x->key_sym <= XK_Hangul_Special)
- mKey = x->key_sym - XK_Hangul + UKey_Hangul;
+ mKey = static_cast<int>(x->key_sym - XK_Hangul + UKey_Hangul);
else if (x->key_sym >= XK_kana_fullstop && x->key_sym <=
XK_semivoicedsound)
- mKey = x->key_sym - XK_kana_fullstop + UKey_Kana_Fullstop;
+ mKey = static_cast<int>(
+ x->key_sym - XK_kana_fullstop + UKey_Kana_Fullstop);
else {
switch (x->key_sym) {
case XK_yen: mKey = UKey_Yen; break;
=======================================
--- /trunk/xim/ximtrans.cpp Thu Jan 6 18:09:56 2011
+++ /trunk/xim/ximtrans.cpp Sun May 1 21:20:23 2011
@@ -116,8 +116,8 @@
for (i = 0, l = 0; i < (int)(sizeof(xim_attributes) /
sizeof(XIMATTRIBUTE));
i++) {
l += 6;
- l += strlen(xim_attributes[i].name);
- l += pad4(strlen(xim_attributes[i].name) + 2);
+ l += static_cast<int>(strlen(xim_attributes[i].name));
+ l += pad4(static_cast<int>(strlen(xim_attributes[i].name)) + 2);
}
p->pushC16((C16)l);
for (i = 0; i < (int)(sizeof(xim_attributes) / sizeof(XIMATTRIBUTE));
i++) {
@@ -125,8 +125,9 @@
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);
+ static_cast<int>(strlen(xim_attributes[i].name)));
+ p->pushBytes(tmp, pad4(static_cast<int>(
+ strlen(xim_attributes[i].name))) + 2);
}
}
@@ -174,8 +175,8 @@
}
for (i = 0, l = 0; i < (int)(sizeof(xic_attributes) /
sizeof(XICATTRIBUTE)); i++) {
l += 6;
- l += strlen(xic_attributes[i].name);
- l += pad4(strlen(xic_attributes[i].name) + 2);
+ l += static_cast<int>(strlen(xic_attributes[i].name));
+ l += pad4(static_cast<int>(strlen(xic_attributes[i].name)) + 2);
}
p->pushC16((C16)l);
p->pushC16(0);
@@ -184,8 +185,9 @@
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));
+ static_cast<int>(strlen(xic_attributes[i].name)));
+ p->pushBytes(tmp, pad4(static_cast<int>(
+ strlen(xic_attributes[i].name)) + 2));
}
}
@@ -362,7 +364,7 @@
t->pushC16((C16)m);
t->pushC16(er);
- int l = strlen(str);
+ int l = static_cast<int>(strlen(str));
char tmp[4];
t->pushC16((C16)l);
t->pushC16(0);