[glib/glib-2-32] Fix contenttype tests
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-32] Fix contenttype tests
- Date: Sat, 14 Jul 2012 23:24:06 +0000 (UTC)
commit ddd7f7475a3ddffa04bdbac1e34569660bb9a0f8
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jul 14 16:50:35 2012 -0400
Fix contenttype tests
gio/tests/contenttype.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gio/tests/contenttype.c b/gio/tests/contenttype.c
index 2226f7d..c44bcc2 100644
--- a/gio/tests/contenttype.c
+++ b/gio/tests/contenttype.c
@@ -1,4 +1,5 @@
#include <gio/gio.h>
+#include <string.h>
static void
test_guess (void)
@@ -6,7 +7,7 @@ test_guess (void)
gchar *res;
gchar *expected;
gboolean uncertain;
- guchar *data = (guchar*)
+ guchar data[] =
"[Desktop Entry]\n"
"Type=Application\n"
"Name=appinfo-test\n"
@@ -26,28 +27,28 @@ test_guess (void)
g_free (res);
g_free (expected);
- res = g_content_type_guess ("foo.desktop", data, -1, &uncertain);
+ res = g_content_type_guess ("foo.desktop", data, sizeof (data) - 1, &uncertain);
expected = g_content_type_from_mime_type ("application/x-desktop");
g_assert (g_content_type_equals (expected, res));
g_assert (!uncertain);
g_free (res);
g_free (expected);
- res = g_content_type_guess ("foo.txt", data, -1, &uncertain);
+ res = g_content_type_guess ("foo.txt", data, sizeof (data) - 1, &uncertain);
expected = g_content_type_from_mime_type ("text/plain");
g_assert (g_content_type_equals (expected, res));
g_assert (!uncertain);
g_free (res);
g_free (expected);
- res = g_content_type_guess ("foo", data, -1, &uncertain);
+ res = g_content_type_guess ("foo", data, sizeof (data) - 1, &uncertain);
expected = g_content_type_from_mime_type ("text/plain");
g_assert (g_content_type_equals (expected, res));
g_assert (!uncertain);
g_free (res);
g_free (expected);
- res = g_content_type_guess (NULL, data, -1, &uncertain);
+ res = g_content_type_guess (NULL, data, sizeof (data) - 1, &uncertain);
expected = g_content_type_from_mime_type ("application/x-desktop");
g_assert (g_content_type_equals (expected, res));
g_assert (!uncertain);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]