if (result_uncertain)
*result_uncertain = FALSE;
+ /* our test suite and potentially other code used -1 in the past, which is
+ * not documented and not allowed; guard against that */
+ g_return_val_if_fail (data_size != (gsize) -1, g_strdup (XDG_MIME_TYPE_UNKNOWN));
+
if (filename)
{
basename = g_path_get_basename (filename);
if (result_uncertain)
*result_uncertain = FALSE;
+ /* our test suite and potentially other code used -1 in the past, which is
+ * not documented and not allowed; guard against that */
+ g_return_val_if_fail (data_size != (gsize) -1, g_strdup (XDG_MIME_TYPE_UNKNOWN));
+
G_LOCK (gio_xdgmime);
if (filename)
g_free (res);
g_free (expected);
- res = g_content_type_guess ("test.pot", (guchar *)"ABC abc", -1, &uncertain);
+ res = g_content_type_guess ("test.pot", (guchar *)"ABC abc", 7, &uncertain);
expected = g_content_type_from_mime_type ("application/vnd.ms-powerpoint");
g_assert (g_content_type_equals (expected, res));
g_assert (uncertain);
g_free (res);
g_free (expected);
- res = g_content_type_guess ("test.otf", (guchar *)"OTTO", -1, &uncertain);
+ res = g_content_type_guess ("test.otf", (guchar *)"OTTO", 4, &uncertain);
expected = g_content_type_from_mime_type ("application/x-font-otf");
g_assert (g_content_type_equals (expected, res));
g_assert (!uncertain);