diff options
author | Dan Winship <danw@src.gnome.org> | 2002-08-01 03:02:02 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2002-08-01 03:02:02 +0800 |
commit | 3a2c51d2a3e64fe444ed9322f01101880df5679c (patch) | |
tree | 8abf40407f3164f13a645f919a4988d4e104b6a6 /e-util | |
parent | 5f313610872f9662635e085c89310458c583bbe1 (diff) | |
download | gsoc2013-evolution-3a2c51d2a3e64fe444ed9322f01101880df5679c.tar gsoc2013-evolution-3a2c51d2a3e64fe444ed9322f01101880df5679c.tar.gz gsoc2013-evolution-3a2c51d2a3e64fe444ed9322f01101880df5679c.tar.bz2 gsoc2013-evolution-3a2c51d2a3e64fe444ed9322f01101880df5679c.tar.lz gsoc2013-evolution-3a2c51d2a3e64fe444ed9322f01101880df5679c.tar.xz gsoc2013-evolution-3a2c51d2a3e64fe444ed9322f01101880df5679c.tar.zst gsoc2013-evolution-3a2c51d2a3e64fe444ed9322f01101880df5679c.zip |
Don't use "isprint(c)" to mean "c >= 32 && c < 128" since it doesn't in
* e-html-utils.c (is_addr_char, is_trailing_garbage): Don't use
"isprint(c)" to mean "c >= 32 && c < 128" since it doesn't in most
locales.
(is_domain_name_char): new macro for dns-valid characters
(email_address_extract): Use is_domain_name_char rather than
is_addr_char for the part after the @.
svn path=/trunk/; revision=17655
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/ChangeLog | 9 | ||||
-rw-r--r-- | e-util/e-html-utils.c | 28 |
2 files changed, 24 insertions, 13 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 714c11cbbf..d9923c0463 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,12 @@ +2002-07-31 Dan Winship <danw@ximian.com> + + * e-html-utils.c (is_addr_char, is_trailing_garbage): Don't use + "isprint(c)" to mean "c >= 32 && c < 128" since it doesn't in most + locales. + (is_domain_name_char): new macro for dns-valid characters + (email_address_extract): Use is_domain_name_char rather than + is_addr_char for the part after the @. + 2002-07-30 Jeffrey Stedfast <fejj@ximian.com> * e-host-utils.c (e_gethostbyname_r): If the user has enabled IPv6 diff --git a/e-util/e-html-utils.c b/e-util/e-html-utils.c index 2b5e3d2d37..958987c475 100644 --- a/e-util/e-html-utils.c +++ b/e-util/e-html-utils.c @@ -39,21 +39,23 @@ check_size (char **buffer, int *buffer_size, char *out, int len) return out; } -/* 1 = non-email-address chars: ()<>@,;:\"[]`'| */ -/* 2 = trailing url garbage: ,.!?;:>)]}`'-_| */ +/* 1 = non-email-address chars: ()<>@,;:\"[]`'{}| */ +/* 2 = trailing url garbage: ,.!?;:>)]}`'-_| */ +/* 4 = dns chars */ static int special_chars[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* nul - 0x0f */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 - 0x1f */ - 1, 2, 1, 0, 0, 0, 0, 3, 1, 3, 0, 0, 3, 2, 2, 0, /* sp - / */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 1, 0, 3, 2, /* 0 - ? */ - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ - O */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 0, 2, /* P - _ */ - 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ` - o */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 0, 0 /* p - del */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* nul - 0x0f */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1f */ + 1, 2, 1, 0, 0, 0, 0, 3, 1, 3, 0, 0, 3, 6, 6, 0, /* sp - / */ + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 1, 0, 3, 2, /* 0 - ? */ + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* @ - O */ + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 3, 0, 2, /* P - _ */ + 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, /* ` - o */ + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 3, 3, 0, 3 /* p - del */ }; -#define is_addr_char(c) (isprint (c) && !(special_chars[c] & 1)) -#define is_trailing_garbage(c) (!isprint(c) || (special_chars[c] & 2)) +#define is_addr_char(c) (c < 128 && !(special_chars[c] & 1)) +#define is_trailing_garbage(c) (c > 127 || (special_chars[c] & 2)) +#define is_domain_name_char(c) (c < 128 && (special_chars[c] & 4)) static char * url_extract (const unsigned char **text, gboolean check) @@ -93,7 +95,7 @@ email_address_extract (const unsigned char **cur, char **out, const unsigned cha return NULL; /* Now look forward for a valid domain part */ - for (end = *cur + 1, dot = NULL; is_addr_char (*end); end++) { + for (end = *cur + 1, dot = NULL; is_domain_name_char (*end); end++) { if (*end == '.' && !dot) dot = end; } |