From 7aff0dfe966aa7462fd0b3f305a87ddaa04d476c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 9 Mar 2006 11:10:03 +0000 Subject: [PATCH] gst/typefind/gsttypefindfunctions.c: Remove part from previous commit that was bogus: g_utf8_validate() does in fact ... Original commit message from CVS: * gst/typefind/gsttypefindfunctions.c: (utf8_type_find_have_valid_utf8_at_offset): Remove part from previous commit that was bogus: g_utf8_validate() does in fact not accept embedded zeroes, so we don't need to check for those (thanks to Mike for the hint). --- ChangeLog | 9 +++++++++ gst/typefind/gsttypefindfunctions.c | 21 ++------------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e97630..82fc744 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-03-09 Tim-Philipp Müller + + * gst/typefind/gsttypefindfunctions.c: + (utf8_type_find_have_valid_utf8_at_offset): + Remove part from previous commit that was bogus: + g_utf8_validate() does in fact not accept embedded + zeroes, so we don't need to check for those (thanks + to Mike for the hint). + 2006-03-08 Tim-Philipp Müller * gst/typefind/gsttypefindfunctions.c: diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index 9236256..9c5e0bb 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -46,20 +46,6 @@ static GstStaticCaps utf8_caps = GST_STATIC_CAPS ("text/plain"); #define UTF8_CAPS gst_static_caps_get(&utf8_caps) -static guint -utf8_type_find_count_embedded_zeroes (const gchar * data, guint size) -{ - guint num = 0; - - while (size > 0) { - if (data[size - 1] == 0) - ++num; - --size; - } - - return num; -} - static gboolean utf8_type_find_have_valid_utf8_at_offset (GstTypeFind * tf, guint64 offset, GstTypeFindProbability * prob) @@ -80,11 +66,8 @@ utf8_type_find_have_valid_utf8_at_offset (GstTypeFind * tf, guint64 offset, gchar *start = (gchar *) data; if (g_utf8_validate (start, size, (const gchar **) &end) || (end - start + 4 > size)) { /* allow last char to be cut off */ - /* embedded zeroes are a sure sign that this isn't a plain text file */ - if (utf8_type_find_count_embedded_zeroes (start, size) <= 2) { - *prob = probability; - return TRUE; - } + *prob = probability; + return TRUE; } *prob = 0; return FALSE; -- 2.7.4