diff options
author | jylefort <jylefort@FreeBSD.org> | 2005-04-14 05:19:02 +0800 |
---|---|---|
committer | jylefort <jylefort@FreeBSD.org> | 2005-04-14 05:19:02 +0800 |
commit | 2309263699b19ab136d04947a43e027672a7477a (patch) | |
tree | d6e02520842d950fbe99bdb13079ab2cba670c8f /textproc | |
parent | 5ca2893a7d565efe2fb21535c71be9670f376bf4 (diff) | |
download | freebsd-ports-graphics-2309263699b19ab136d04947a43e027672a7477a.tar.gz freebsd-ports-graphics-2309263699b19ab136d04947a43e027672a7477a.tar.zst freebsd-ports-graphics-2309263699b19ab136d04947a43e027672a7477a.zip |
* Fixes HTTP charset parsing.
* Fixes an occasional lockup in translate_session_translate_text().
Approved by: adamw (mentor)
Diffstat (limited to 'textproc')
-rw-r--r-- | textproc/libtranslate/Makefile | 2 | ||||
-rw-r--r-- | textproc/libtranslate/files/patch-src_modules_translate-generic-service.c | 47 | ||||
-rw-r--r-- | textproc/libtranslate/files/patch-src_translate-session.c | 38 |
3 files changed, 86 insertions, 1 deletions
diff --git a/textproc/libtranslate/Makefile b/textproc/libtranslate/Makefile index 06ab6d0af35..11b87f98f57 100644 --- a/textproc/libtranslate/Makefile +++ b/textproc/libtranslate/Makefile @@ -7,7 +7,7 @@ PORTNAME= libtranslate PORTVERSION= 0.99 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= textproc MASTER_SITES= ${MASTER_SITE_SAVANNAH} MASTER_SITE_SUBDIR= ${PORTNAME} diff --git a/textproc/libtranslate/files/patch-src_modules_translate-generic-service.c b/textproc/libtranslate/files/patch-src_modules_translate-generic-service.c new file mode 100644 index 00000000000..1626f25ff71 --- /dev/null +++ b/textproc/libtranslate/files/patch-src_modules_translate-generic-service.c @@ -0,0 +1,47 @@ +--- src/modules/translate-generic-service.c.orig Mon Apr 11 23:08:47 2005 ++++ src/modules/translate-generic-service.c Mon Apr 11 23:15:54 2005 +@@ -484,7 +484,7 @@ + + if (SOUP_STATUS_IS_SUCCESSFUL(message->status_code)) + { +- const char *charset = NULL; ++ char *charset = NULL; + + if (flags & TRANSFER_CONVERT) + { +@@ -493,14 +493,31 @@ + content_type = translate_generic_service_get_header(message, &info, "Content-Type"); + if (content_type) + { +- charset = translate_ascii_strcasestr(content_type, "charset="); +- if (charset) +- charset += 8; ++ const char *tmp; ++ ++ tmp = translate_ascii_strcasestr(content_type, "charset="); ++ if (tmp) ++ { ++ int len; ++ ++ tmp += 8; ++ if (*tmp == '\'' || *tmp == '"') ++ tmp++; ++ ++ len = strlen(tmp); ++ if (len > 0 && (tmp[len - 1] == '\'' || tmp[len - 1] == '"')) ++ len--; ++ ++ charset = g_strndup(tmp, len); ++ } + } + } + + if (charset) +- response = g_convert(message->response.body, message->response.length, "UTF-8", charset, NULL, NULL, err); ++ { ++ response = g_convert(message->response.body, message->response.length, "UTF-8", charset, NULL, NULL, err); ++ g_free(charset); ++ } + else + { + if ((flags & TRANSFER_CONVERT) && ! g_utf8_validate(message->response.body, message->response.length, NULL)) diff --git a/textproc/libtranslate/files/patch-src_translate-session.c b/textproc/libtranslate/files/patch-src_translate-session.c new file mode 100644 index 00000000000..4011dcd7d5c --- /dev/null +++ b/textproc/libtranslate/files/patch-src_translate-session.c @@ -0,0 +1,38 @@ +--- src/translate-session.c.orig Mon Apr 11 22:44:53 2005 ++++ src/translate-session.c Mon Apr 11 22:51:48 2005 +@@ -703,7 +703,14 @@ + GError *tmp_err = NULL; + + g_mutex_lock(info->mutex); +- ret = info->err != NULL; ++ if (info->err) ++ { ++ ret = TRUE; ++ if (info->progress_cond) ++ g_cond_signal(info->progress_cond); ++ } ++ else ++ ret = FALSE; + g_mutex_unlock(info->mutex); + + if (ret) +@@ -728,6 +735,9 @@ + else + g_propagate_error(&info->err, tmp_err); + ++ if (info->progress_cond) ++ g_cond_signal(info->progress_cond); ++ + g_mutex_unlock(info->mutex); + + return; +@@ -759,6 +769,9 @@ + info->err = g_error_new(TRANSLATE_SESSION_ERROR, + TRANSLATE_SESSION_ERROR_NO_SERVICE, + _("no service could translate chunk")); ++ ++ if (info->progress_cond) ++ g_cond_signal(info->progress_cond); + } + + g_mutex_unlock(info->mutex); |