diff options
author | Dan Winship <danw@src.gnome.org> | 2001-04-27 02:21:32 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-04-27 02:21:32 +0800 |
commit | 18af050c0507105544f5a83cd529a8b7a4264bdd (patch) | |
tree | 8a6dfbc597e0a30cd7659b2012d07208a1f360bc | |
parent | 678e848710c297d8219a878970aa5471e5b3ec7d (diff) | |
download | gsoc2013-evolution-18af050c0507105544f5a83cd529a8b7a4264bdd.tar.gz 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
-rw-r--r-- | camel/ChangeLog | 27 | ||||
-rw-r--r-- | camel/Makefile.am | 5 | ||||
-rw-r--r-- | camel/camel-charset-map.c | 7 | ||||
-rw-r--r-- | camel/camel-mime-filter-charset.h | 4 | ||||
-rw-r--r-- | camel/camel-mime-parser.c | 2 | ||||
-rw-r--r-- | camel/camel-mime-utils.c | 22 | ||||
-rw-r--r-- | camel/camel-pgp-context.c | 9 | ||||
-rw-r--r-- | camel/camel-search-private.c | 76 | ||||
-rw-r--r-- | camel/camel.c | 3 | ||||
-rw-r--r-- | camel/providers/local/Makefile.am | 2 | ||||
-rw-r--r-- | camel/providers/pop3/Makefile.am | 2 | ||||
-rw-r--r-- | camel/providers/smtp/Makefile.am | 2 | ||||
-rw-r--r-- | camel/tests/message/test2.c | 25 |
13 files changed, 83 insertions, 103 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index f949548ade..a65bb55a07 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,32 @@ 2001-04-26 Dan Winship <danw@ximian.com> + * 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. + +2001-04-26 Dan Winship <danw@ximian.com> + * camel-service.c (get_host): Use e_gethostbyname_r. (camel_service_gethost): Remove unused var. diff --git a/camel/Makefile.am b/camel/Makefile.am index 9c44351bbf..5c24cd06df 100644 --- a/camel/Makefile.am +++ b/camel/Makefile.am @@ -10,10 +10,7 @@ lib_LTLIBRARIES = libcamel.la INCLUDES = -I.. -I$(srcdir)/.. \ -I$(top_srcdir)/intl \ -I$(top_srcdir)/e-util \ - $(GNOME_INCLUDEDIR) \ - $(GLIB_CFLAGS) \ $(GNOME_XML_CFLAGS) \ - $(UNICODE_CFLAGS) \ $(EXTRA_GNOME_CFLAGS) \ $(KRB4_CFLAGS) \ $(NSPR_CFLAGS) \ @@ -173,7 +170,7 @@ libcamelinclude_HEADERS = \ libcamel_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir) libcamel_la_LIBADD = $(top_builddir)/e-util/libeutil.la \ - $(UNICODE_LIBS) \ + $(GAL_LIBS) \ $(KRB4_LDFLAGS) \ $(NSPR_LDFLAGS) \ $(NSS_LDFLAGS) diff --git a/camel/camel-charset-map.c b/camel/camel-charset-map.c index dac774bdf2..d7aa8763dd 100644 --- a/camel/camel-charset-map.c +++ b/camel/camel-charset-map.c @@ -201,7 +201,7 @@ void main(void) #include "camel-charset-map.h" #include "camel-charset-map-private.h" -#include <unicode.h> +#include <gal/unicode/gunicode.h> #include <locale.h> #include <string.h> #include <glib.h> @@ -224,13 +224,14 @@ camel_charset_step(CamelCharset *c, const char *in, int len) /* check what charset a given string will fit in */ while (inptr < inend) { - unicode_char_t c; + gunichar c; const char *newinptr; - newinptr = unicode_get_utf8(inptr, &c); + newinptr = g_utf8_next_char(inptr); if (newinptr == NULL) { inptr++; continue; } + c = g_utf8_get_char(inptr); inptr = newinptr; if (c<=0xffff) { mask &= charset_mask(c); diff --git a/camel/camel-mime-filter-charset.h b/camel/camel-mime-filter-charset.h index ba1586ca7a..f9c78e8896 100644 --- a/camel/camel-mime-filter-charset.h +++ b/camel/camel-mime-filter-charset.h @@ -22,7 +22,7 @@ #define _CAMEL_MIME_FILTER_CHARSET_H #include <camel/camel-mime-filter.h> -#include <unicode.h> +#include <iconv.h> #define CAMEL_MIME_FILTER_CHARSET(obj) CAMEL_CHECK_CAST (obj, camel_mime_filter_charset_get_type (), CamelMimeFilterCharset) #define CAMEL_MIME_FILTER_CHARSET_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_mime_filter_charset_get_type (), CamelMimeFilterCharsetClass) @@ -35,7 +35,7 @@ struct _CamelMimeFilterCharset { struct _CamelMimeFilterCharsetPrivate *priv; - unicode_iconv_t ic; + iconv_t ic; char *from; char *to; }; diff --git a/camel/camel-mime-parser.c b/camel/camel-mime-parser.c index d08beffca7..77c39ddde9 100644 --- a/camel/camel-mime-parser.c +++ b/camel/camel-mime-parser.c @@ -35,8 +35,6 @@ #include <stdio.h> #include <errno.h> -#include <unicode.h> - #include <regex.h> #include <ctype.h> diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 510323312c..7e486689ef 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -38,7 +38,6 @@ #define MAXHOSTNAMELEN 1024 #endif -#include <unicode.h> #include <iconv.h> #include <time.h> @@ -48,6 +47,7 @@ #include <regex.h> #include <glib.h> +#include <gal/unicode/gunicode.h> #include "camel-mime-utils.h" #include "camel-charset-map.h" @@ -128,7 +128,7 @@ static unsigned char camel_mime_base64_rank[256] = { if any of these change, then the tables above should be regenerated by compiling this with -DBUILD_TABLE, and running. - gcc -DCLEAN_DATE -o buildtable -I.. `glib-config --cflags --libs` -lunicode -DBUILD_TABLE camel-mime-utils.c camel-charset-map.c + gcc -DCLEAN_DATE -o buildtable -I.. `gnome-config --cflags --libs gal` -DBUILD_TABLE camel-mime-utils.c camel-charset-map.c ./buildtable */ @@ -1277,18 +1277,19 @@ header_encode_string (const unsigned char *in) word = NULL; start = inptr; while (inptr && *inptr) { - unicode_char_t c; + gunichar c; const char *newinptr; - newinptr = unicode_get_utf8 (inptr, &c); + newinptr = g_utf8_next_char (inptr); if (newinptr == NULL) { w(g_warning ("Invalid UTF-8 sequence encountered (pos %d, char '%c'): %s", (inptr-in), inptr[0], in)); inptr++; continue; } + c = g_utf8_get_char (inptr); - if (unicode_isspace (c) && !last_was_space) { + if (g_unichar_isspace (c) && !last_was_space) { /* we've reached the end of a 'word' */ if (word && !(last_was_encoded && encoding)) { g_string_append_len (out, start, word - start); @@ -1327,11 +1328,11 @@ header_encode_string (const unsigned char *in) } else if (c >= 256) { encoding = MAX (encoding, 2); last_was_space = FALSE; - } else if (!unicode_isspace (c)) { + } else if (!g_unichar_isspace (c)) { last_was_space = FALSE; } - if (!unicode_isspace (c) && !word) + if (!g_unichar_isspace (c) && !word) word = inptr; inptr = newinptr; @@ -1422,19 +1423,20 @@ header_encode_phrase_get_words (const unsigned char *in) start = inptr; encoding = 0; while (inptr && *inptr) { - unicode_char_t c; + gunichar c; const char *newinptr; - newinptr = unicode_get_utf8 (inptr, &c); + newinptr = g_utf8_next_char (inptr); if (newinptr == NULL) { w(g_warning ("Invalid UTF-8 sequence encountered (pos %d, char '%c'): %s", (inptr - in), inptr[0], in)); inptr++; continue; } + c = g_utf8_get_char (inptr); inptr = newinptr; - if (unicode_isspace (c)) { + if (g_unichar_isspace (c)) { if (count > 0) { word = g_new0 (struct _phrase_word, 1); word->start = start; diff --git a/camel/camel-pgp-context.c b/camel/camel-pgp-context.c index f69efde91f..f34d5f8c27 100644 --- a/camel/camel-pgp-context.c +++ b/camel/camel-pgp-context.c @@ -31,8 +31,6 @@ #include "camel-charset-map.h" -#include <gtk/gtk.h> /* for _() macro */ - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -52,8 +50,8 @@ #include <unistd.h> #include <signal.h> -#include <unicode.h> #include <iconv.h> +#include <gal/unicode/gunicode.h> #define d(x) @@ -992,14 +990,13 @@ pgp_verify (CamelCipherContext *ctx, CamelStream *istream, *outbuf = '\0'; } else { const char *inptr, *inend; - unicode_char_t c; inptr = diagnostics; inend = inptr + inlen; while (inptr && inptr < inend) { - inptr = unicode_get_utf8 (inptr, &c); - *outbuf++ = c & 0xff; + *outbuf++ = g_utf8_get_char (inptr) & 0xff; + inptr = g_utf8_next_char (inptr); } *outbuf = '\0'; 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) diff --git a/camel/camel.c b/camel/camel.c index 6228c7227c..f2d8b8d369 100644 --- a/camel/camel.c +++ b/camel/camel.c @@ -27,7 +27,6 @@ #include <config.h> #endif -#include <unicode.h> #ifdef HAVE_NSS #include <nspr.h> #include <prthread.h> @@ -53,8 +52,6 @@ camel_init (const char *certdb_dir, gboolean nss_init) if (getenv ("CAMEL_VERBOSE_DEBUG")) camel_verbose_debug = TRUE; - unicode_init (); - #ifdef HAVE_NSS if (nss_init) { PR_Init (PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 10); diff --git a/camel/providers/local/Makefile.am b/camel/providers/local/Makefile.am index 9130f62f81..9c6b353186 100644 --- a/camel/providers/local/Makefile.am +++ b/camel/providers/local/Makefile.am @@ -53,6 +53,6 @@ noinst_HEADERS = \ libcamellocal_la_LDFLAGS = -version-info 0:0:0 -libcamellocal_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS) +libcamellocal_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(top_builddir)/libibex/libibex.la EXTRA_DIST = libcamellocal.urls diff --git a/camel/providers/pop3/Makefile.am b/camel/providers/pop3/Makefile.am index 57fb938d89..476e3d3189 100644 --- a/camel/providers/pop3/Makefile.am +++ b/camel/providers/pop3/Makefile.am @@ -32,6 +32,6 @@ libcamelpop3include_HEADERS = \ libcamelpop3_la_LDFLAGS = $(KRB4_LDFLAGS) -version-info 0:0:0 -libcamelpop3_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(UNICODE_LIBS) +libcamelpop3_la_LIBADD = $(top_builddir)/e-util/libeutil.la EXTRA_DIST = libcamelpop3.urls diff --git a/camel/providers/smtp/Makefile.am b/camel/providers/smtp/Makefile.am index 45e1d77f8c..74597f57f5 100644 --- a/camel/providers/smtp/Makefile.am +++ b/camel/providers/smtp/Makefile.am @@ -31,6 +31,6 @@ libcamelsmtpinclude_HEADERS = \ libcamelsmtp_la_LDFLAGS = -version-info 0:0:0 -libcamelsmtp_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(UNICODE_LIBS) +libcamelsmtp_la_LIBADD = $(top_builddir)/e-util/libeutil.la EXTRA_DIST = libcamelsmtp.urls diff --git a/camel/tests/message/test2.c b/camel/tests/message/test2.c index abeafa9524..95b0e324aa 100644 --- a/camel/tests/message/test2.c +++ b/camel/tests/message/test2.c @@ -7,8 +7,7 @@ #include <unistd.h> #include <string.h> #include <stdio.h> - -#include <unicode.h> +#include <iconv.h> #include <camel/camel-internet-address.h> #include <camel/camel-address.h> @@ -17,12 +16,12 @@ static char *convert(const char *in, const char *from, const char *to) { - unicode_iconv_t ic = unicode_iconv_open(to, from); + iconv_t ic = iconv_open(to, from); char *out, *outp; const char *inp; int inlen, outlen; - if (ic == (unicode_iconv_t)-1) + if (ic == (iconv_t)-1) return g_strdup(in); inlen = strlen(in); @@ -31,19 +30,19 @@ static char *convert(const char *in, const char *from, const char *to) outp = out = g_malloc(outlen); inp = in; - if (unicode_iconv(ic, &inp, &inlen, &outp, &outlen) == -1) { + if (iconv(ic, &inp, &inlen, &outp, &outlen) == -1) { test_free(out); - unicode_iconv_close(ic); + iconv_close(ic); return g_strdup(in); } - if (unicode_iconv(ic, NULL, 0, &outp, &outlen) == -1) { + if (iconv(ic, NULL, 0, &outp, &outlen) == -1) { test_free(out); - unicode_iconv_close(ic); + iconv_close(ic); return g_strdup(in); } - unicode_iconv_close(ic); + iconv_close(ic); *outp = 0; @@ -51,17 +50,17 @@ static char *convert(const char *in, const char *from, const char *to) /* lets see if we can convert back again? */ { char *nout, *noutp; - unicode_iconv_t ic = unicode_iconv_open(from, to); + iconv_t ic = iconv_open(from, to); inp = out; inlen = strlen(out); outlen = inlen*5 + 16; noutp = nout = g_malloc(outlen); - if (unicode_iconv(ic, &inp, &inlen, &noutp, &outlen) == -1 - || unicode_iconv(ic, NULL, 0, &noutp, &outlen) == -1) { + if (iconv(ic, &inp, &inlen, &noutp, &outlen) == -1 + || iconv(ic, NULL, 0, &noutp, &outlen) == -1) { g_warning("Cannot convert '%s' \n from %s to %s: %s\n", in, to, from, strerror(errno)); } - unicode_iconv_close(ic); + iconv_close(ic); } /* and lets see what camel thinks out optimal charset is */ |