gst/typefind/gsttypefindfunctions.c: Remove part from previous commit that was bogus...
authorTim-Philipp Müller <tim@centricular.net>
Thu, 9 Mar 2006 11:10:03 +0000 (11:10 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Thu, 9 Mar 2006 11:10:03 +0000 (11:10 +0000)
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
gst/typefind/gsttypefindfunctions.c

index 2e97630bcabe3b7d30bdb06d9e114ed3afa17c26..82fc744001144b57501068bfdbf1e6116129d1f8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-03-09  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * 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  <tim at centricular dot net>
 
        * gst/typefind/gsttypefindfunctions.c:
index 923625660c6d21924773eb4336afe4bf51081a5b..9c5e0bbdf9267ad0399e217b8d9010abb81b83d3 100644 (file)
@@ -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;