}
/* Decode HTML entitles in text */
-static void
-decode_entitles (char *s)
+void
+decode_entitles (char *s, guint *len)
{
+ guint l;
char *t = s; /* t - tortoise */
char *h = s; /* h - hare */
char *e = s;
char *end_ptr;
int state = 0, val, base;
+
+ if (len == NULL || *len == 0) {
+ l = strlen (s);
+ }
+ else {
+ l = *len;
+ }
- while (*h) {
+ while (h - s < l) {
switch (state) {
/* Out of entitle */
case 0:
}
}
*t = '\0';
-
+
+ if (len != NULL) {
+ *len = t - s;
+ }
}
static void
url_text = memory_pool_alloc (task->task_pool, len + 1);
g_strlcpy (url_text, c, len + 1);
- decode_entitles (url_text);
+ decode_entitles (url_text, NULL);
if (g_ascii_strncasecmp (url_text, "http://", sizeof ("http://") - 1) != 0) {
return;
gboolean add_html_node (struct worker_task *task, memory_pool_t *pool, struct mime_text_part *part, char *tag_text, GNode **cur_level);
struct html_tag * get_tag_by_name (const char *name);
+void decode_entitles (char *s, guint *len);
#endif
url_parse_text (task->task_pool, task, text_part, FALSE);
}
else {
+ decode_entitles (text_part->content->data, &text_part->content->len);
url_parse_text (task->task_pool, task, text_part, FALSE);
#if 0
url_parse_text (task->task_pool, task, text_part, TRUE);