aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-search-private.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-04-27 02:21:32 +0800
committerDan Winship <danw@src.gnome.org>2001-04-27 02:21:32 +0800
commit18af050c0507105544f5a83cd529a8b7a4264bdd (patch)
tree8a6dfbc597e0a30cd7659b2012d07208a1f360bc /camel/camel-search-private.c
parent678e848710c297d8219a878970aa5471e5b3ec7d (diff)
downloadgsoc2013-evolution-18af050c0507105544f5a83cd529a8b7a4264bdd.tar
gsoc2013-evolution-18af050c0507105544f5a83cd529a8b7a4264bdd.tar.gz
gsoc2013-evolution-18af050c0507105544f5a83cd529a8b7a4264bdd.tar.bz2
gsoc2013-evolution-18af050c0507105544f5a83cd529a8b7a4264bdd.tar.lz
gsoc2013-evolution-18af050c0507105544f5a83cd529a8b7a4264bdd.tar.xz
gsoc2013-evolution-18af050c0507105544f5a83cd529a8b7a4264bdd.tar.zst
gsoc2013-evolution-18af050c0507105544f5a83cd529a8b7a4264bdd.zip
Remove UNICODE_CFLAGS (and some other stuff that's redundant with
* Makefile.am (INCLUDES): Remove UNICODE_CFLAGS (and some other stuff that's redundant with EXTRA_GNOME_CFLAGS) (libcamel_la_LIBADD): Replace UNICODE_LIBS with GAL_LIBS. * camel-search-private.c: * camel-pgp-context.c: * camel-mime-utils.c: Use gunicode interfaces rather than libunicode. * camel-charset-map.c: Use gunicode rather than libunicode. (The charmap-regen code still depends on libunicode though.) * camel-mime-filter-charset.h: * tests/message/test2.c (convert): Use iconv rather than unicode_iconv. * providers/smtp/Makefile.am (libcamelsmtp_la_LIBADD): * providers/pop3/Makefile.am (libcamelpop3_la_LIBADD): * providers/local/Makefile.am (libcamellocal_la_LIBADD): Remove UNICODE_LIBS. * camel.c (camel_init): Remove call to unicode_init. * camel-mime-parser.c: Remove unused unicode.h include. svn path=/trunk/; revision=9585
Diffstat (limited to 'camel/camel-search-private.c')
-rw-r--r--camel/camel-search-private.c76
1 files changed, 19 insertions, 57 deletions
diff --git a/camel/camel-search-private.c b/camel/camel-search-private.c
index de374c6127..e46cc29cc8 100644
--- a/camel/camel-search-private.c
+++ b/camel/camel-search-private.c
@@ -40,10 +40,11 @@
#include "camel-multipart.h"
#include "camel-stream-mem.h"
#include "e-util/e-sexp.h"
-#include <unicode.h>
#include "camel-search-private.h"
+#include <gal/unicode/gunicode.h>
+
#define d(x)
/* builds the regex into pattern */
@@ -190,55 +191,16 @@ header_soundex(const char *header, const char *match)
return truth;
}
-#if 0
-/* Why do it this way when the unicode lib already has a function to do this? */
-static unicode_char_t
-utf8_get (const char **inp)
-{
- guint32 c, v = 0, s, shift;
- const unsigned char *p = *inp;
-
- if (p == NULL)
- return 0;
-
- s = *p++;
- if ((s & 0x80) == 0) { /* 7 bit char */
- v = s;
- } else if (s>0xf7) { /* invalid char, we can only have upto 4 bits encoded */
- p = NULL;
- } else if (s>=0xc0) { /* valid start char */
- shift = 0;
- do {
- c = *p++;
- if ((c & 0xc0) == 0x80) {
- v = (v<<6) | (c&0x3f);
- shift += 5;
- } else {
- *inp = NULL;
- return 0;
- }
- s <<= 1;
- } while ((s & 0x80) != 0);
- v |= s << shift;
- } else { /* invalid start char, internal char */
- p = NULL;
- }
-
- *inp = p;
- return v;
-}
-#endif
-
-static unicode_char_t
+static gunichar
utf8_get (const char **inp)
{
const unsigned char *p = *inp;
- unicode_char_t c;
+ gunichar c;
g_return_val_if_fail (p != NULL, 0);
- p = unicode_get_utf8 (p, &c);
- *inp = p;
+ c = g_utf8_get_char (p);
+ *inp = g_utf8_next_char (p);
return c;
}
@@ -246,8 +208,8 @@ utf8_get (const char **inp)
static const char *
camel_ustrstrcase (const char *haystack, const char *needle)
{
- unicode_char_t *nuni, *puni;
- unicode_char_t u;
+ gunichar *nuni, *puni;
+ gunichar u;
const char *p;
g_return_val_if_fail (haystack != NULL, NULL);
@@ -258,11 +220,11 @@ camel_ustrstrcase (const char *haystack, const char *needle)
if (strlen(haystack) == 0)
return NULL;
- puni = nuni = alloca (sizeof (unicode_char_t) * strlen (needle));
+ puni = nuni = alloca (sizeof (gunichar) * strlen (needle));
p = needle;
while ((u = utf8_get (&p)))
- *puni++ = unicode_tolower (u);
+ *puni++ = g_unichar_tolower (u);
/* NULL means there was illegal utf-8 sequence */
if (!p)
@@ -270,9 +232,9 @@ camel_ustrstrcase (const char *haystack, const char *needle)
p = haystack;
while ((u = utf8_get (&p))) {
- unicode_char_t c;
+ gunichar c;
- c = unicode_tolower (u);
+ c = g_unichar_tolower (u);
/* We have valid stripped char */
if (c == nuni[0]) {
const gchar *q = p;
@@ -283,7 +245,7 @@ camel_ustrstrcase (const char *haystack, const char *needle)
if (!q || !u)
return NULL;
- c = unicode_tolower (u);
+ c = g_unichar_tolower (u);
if (c != nuni[npos])
break;
@@ -311,15 +273,15 @@ camel_ustrstrcase (const char *haystack, const char *needle)
static int
camel_ustrcasecmp (const char *s1, const char *s2)
{
- unicode_char_t u1, u2 = 0;
+ gunichar u1, u2 = 0;
CAMEL_SEARCH_COMPARE (s1, s2, NULL);
u1 = utf8_get (&s1);
u2 = utf8_get (&s2);
while (u1 && u2) {
- u1 = unicode_tolower (u1);
- u2 = unicode_tolower (u2);
+ u1 = g_unichar_tolower (u1);
+ u2 = g_unichar_tolower (u2);
if (u1 < u2)
return -1;
else if (u1 > u2)
@@ -341,15 +303,15 @@ camel_ustrcasecmp (const char *s1, const char *s2)
static int
camel_ustrncasecmp (const char *s1, const char *s2, size_t len)
{
- unicode_char_t u1, u2 = 0;
+ gunichar u1, u2 = 0;
CAMEL_SEARCH_COMPARE (s1, s2, NULL);
u1 = utf8_get (&s1);
u2 = utf8_get (&s2);
while (len > 0 && u1 && u2) {
- u1 = unicode_tolower (u1);
- u2 = unicode_tolower (u2);
+ u1 = g_unichar_tolower (u1);
+ u2 = g_unichar_tolower (u2);
if (u1 < u2)
return -1;
else if (u1 > u2)