[evolution-data-server/wip/camel-more-gobject] Replace Camel's g_string_append_u() with GLib's g_string_append_unichar()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/wip/camel-more-gobject] Replace Camel's g_string_append_u() with GLib's g_string_append_unichar()
- Date: Mon, 7 Nov 2016 13:13:11 +0000 (UTC)
commit 7dcfcea7fc7205c63424c5af013bef299c9173de
Author: Milan Crha <mcrha redhat com>
Date: Mon Nov 7 14:12:25 2016 +0100
Replace Camel's g_string_append_u() with GLib's g_string_append_unichar()
src/camel/camel-utf8.c | 21 +++++----------------
src/camel/camel-utf8.h | 3 ---
src/camel/tests/misc/utf7.c | 2 +-
3 files changed, 6 insertions(+), 20 deletions(-)
---
diff --git a/src/camel/camel-utf8.c b/src/camel/camel-utf8.c
index b2c7420..d682b80 100644
--- a/src/camel/camel-utf8.c
+++ b/src/camel/camel-utf8.c
@@ -163,18 +163,6 @@ loop:
return 0xffff;
}
-void
-g_string_append_u (GString *out,
- guint32 c)
-{
- guchar buffer[8];
- guchar *p = buffer;
-
- camel_utf8_putc (&p, c);
- *p = 0;
- g_string_append (out, (const gchar *) buffer);
-}
-
static const gchar utf7_alphabet[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,";
@@ -251,11 +239,11 @@ camel_utf7_utf8 (const gchar *ptr)
i+=6;
if (i >= 16) {
x = (v >> (i - 16)) & 0xffff;
- g_string_append_u (out, x);
+ g_string_append_unichar (out, x);
i-=16;
}
} else {
- g_string_append_u (out, c);
+ g_string_append_unichar (out, c);
state = 0;
}
break;
@@ -379,7 +367,8 @@ camel_utf8_ucs2 (const gchar *pptr)
*
* Returns:
**/
-gchar *camel_ucs2_utf8 (const gchar *ptr)
+gchar *
+camel_ucs2_utf8 (const gchar *ptr)
{
guint16 *ucs = (guint16 *) ptr;
guint32 c;
@@ -387,7 +376,7 @@ gchar *camel_ucs2_utf8 (const gchar *ptr)
gchar *out;
while ((c = *ucs++))
- g_string_append_u (work, g_ntohs (c));
+ g_string_append_unichar (work, g_ntohs (c));
out = g_strdup (work->str);
g_string_free (work, TRUE);
diff --git a/src/camel/camel-utf8.h b/src/camel/camel-utf8.h
index d509f06..48c5e86 100644
--- a/src/camel/camel-utf8.h
+++ b/src/camel/camel-utf8.h
@@ -32,9 +32,6 @@ void camel_utf8_putc (guchar **ptr, guint32 c);
guint32 camel_utf8_getc (const guchar **ptr);
guint32 camel_utf8_getc_limit (const guchar **ptr, const guchar *end);
-/* utility func for utf8 gstrings */
-void g_string_append_u (GString *out, guint32 c);
-
/* convert utf7 to/from utf8, actually this is modified IMAP utf7 */
gchar *camel_utf7_utf8 (const gchar *ptr);
gchar *camel_utf8_utf7 (const gchar *ptr);
diff --git a/src/camel/tests/misc/utf7.c b/src/camel/tests/misc/utf7.c
index b79cf10..567de2f 100644
--- a/src/camel/tests/misc/utf7.c
+++ b/src/camel/tests/misc/utf7.c
@@ -103,7 +103,7 @@ main (gint argc,
do {
u = tests[i].unicode[j++];
camel_utf8_putc ((guchar **) &p, u);
- g_string_append_u (out, u);
+ g_string_append_unichar (out, u);
} while (u);
check (strcmp (utf8enc, out->str) == 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]