aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/select-names/e-select-names-model.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2003-05-14 08:45:20 +0800
committerChris Toshok <toshok@src.gnome.org>2003-05-14 08:45:20 +0800
commit6c97a30c5e83a1bbb93c9c65c24aa21638d2e5fb (patch)
tree24b76500806a88af8c1e9e325b419d1d829b80d8 /addressbook/gui/component/select-names/e-select-names-model.c
parent2579e70339ec9fe523115b654f457b6a07367de8 (diff)
downloadgsoc2013-evolution-6c97a30c5e83a1bbb93c9c65c24aa21638d2e5fb.tar
gsoc2013-evolution-6c97a30c5e83a1bbb93c9c65c24aa21638d2e5fb.tar.gz
gsoc2013-evolution-6c97a30c5e83a1bbb93c9c65c24aa21638d2e5fb.tar.bz2
gsoc2013-evolution-6c97a30c5e83a1bbb93c9c65c24aa21638d2e5fb.tar.lz
gsoc2013-evolution-6c97a30c5e83a1bbb93c9c65c24aa21638d2e5fb.tar.xz
gsoc2013-evolution-6c97a30c5e83a1bbb93c9c65c24aa21638d2e5fb.tar.zst
gsoc2013-evolution-6c97a30c5e83a1bbb93c9c65c24aa21638d2e5fb.zip
strlen -> g_utf8_strlen. (e_select_names_text_model_insert): same.
2003-05-13 Chris Toshok <toshok@ximian.com> * gui/component/select-names/e-select-names-text-model.c (e_select_names_text_model_set_separator): strlen -> g_utf8_strlen. (e_select_names_text_model_insert): same. (e_select_names_text_model_insert_length): big change, make this work with multibyte utf8. (e_select_names_text_model_delete): same. this could possibly use a tighter loop + a memmove, but this works. * gui/component/select-names/e-select-names-model.c (e_select_names_model_get_textification): make sure our truncation to MAX_LENGTH characters uses utf8 characters, not bytes. (e_select_names_model_name_pos): track e-text-model change. pos/length are now in utf8 character terms, so use g_utf8_strlen instead of strlen. (e_select_names_model_text_pos): same. svn path=/trunk/; revision=21165
Diffstat (limited to 'addressbook/gui/component/select-names/e-select-names-model.c')
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/addressbook/gui/component/select-names/e-select-names-model.c b/addressbook/gui/component/select-names/e-select-names-model.c
index 595b4a257e..6c3cb0f9c6 100644
--- a/addressbook/gui/component/select-names/e-select-names-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-model.c
@@ -219,10 +219,11 @@ e_select_names_model_get_textification (ESelectNamesModel *model, const char *se
}
text = g_strjoinv (separator, strv);
-
- if (strlen(text) > MAX_LENGTH) {
- text[MAX_LENGTH] = '\0';
- text = g_realloc (text, MAX_LENGTH + 1);
+
+ if (g_utf8_strlen(text, -1) > MAX_LENGTH) {
+ char *p = g_utf8_offset_to_pointer (text, MAX_LENGTH);
+ *p = '\0';
+ text = g_realloc (text, p - text + 1);
}
g_free (strv);
@@ -650,7 +651,7 @@ e_select_names_model_name_pos (ESelectNamesModel *model, gint seplen, gint index
while (iter && i <= index) {
rp += len + (i > 0 ? seplen : 0);
str = e_destination_get_textrep (E_DESTINATION (iter->data), FALSE);
- len = str ? strlen (str) : 0;
+ len = str ? g_utf8_strlen (str, -1) : 0;
++i;
iter = g_list_next (iter);
}
@@ -680,7 +681,7 @@ e_select_names_model_text_pos (ESelectNamesModel *model, gint seplen, gint pos,
while (iter != NULL) {
str = e_destination_get_textrep (E_DESTINATION (iter->data), FALSE);
- len = str ? strlen (str) : 0;
+ len = str ? g_utf8_strlen (str, -1) : 0;
if (sp <= pos && pos <= sp + len + adj) {
break;