mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 23:18:52 +00:00
dataurisrc: Do not include trailing \0
into buffer
This commit is contained in:
parent
fe9e49da87
commit
d109dd2752
2 changed files with 10 additions and 6 deletions
|
@ -388,7 +388,7 @@ gst_data_uri_src_set_uri (GstURIHandler * handler, const gchar * uri,
|
||||||
bdata = g_uri_unescape_string (data_start, NULL);
|
bdata = g_uri_unescape_string (data_start, NULL);
|
||||||
if (bdata == NULL)
|
if (bdata == NULL)
|
||||||
goto invalid_uri_encoded_data;
|
goto invalid_uri_encoded_data;
|
||||||
bsize = strlen (bdata) + 1;
|
bsize = strlen (bdata);
|
||||||
}
|
}
|
||||||
/* Convert to UTF8 */
|
/* Convert to UTF8 */
|
||||||
if (strcmp ("text/plain", mimetype) == 0 &&
|
if (strcmp ("text/plain", mimetype) == 0 &&
|
||||||
|
@ -399,7 +399,7 @@ gst_data_uri_src_set_uri (GstURIHandler * handler, const gchar * uri,
|
||||||
gpointer data;
|
gpointer data;
|
||||||
|
|
||||||
data =
|
data =
|
||||||
g_convert_with_fallback (bdata, -1, "UTF-8", charset, (char *) "*",
|
g_convert_with_fallback (bdata, bsize, "UTF-8", charset, (char *) "*",
|
||||||
&read, &written, NULL);
|
&read, &written, NULL);
|
||||||
g_free (bdata);
|
g_free (bdata);
|
||||||
|
|
||||||
|
|
|
@ -553,11 +553,15 @@ GST_START_TEST (test_dataurisrc_uris)
|
||||||
h = gst_harness_new_with_element (src, NULL, "src");
|
h = gst_harness_new_with_element (src, NULL, "src");
|
||||||
gst_harness_play (h);
|
gst_harness_play (h);
|
||||||
|
|
||||||
buf = gst_harness_pull (h);
|
fail_unless (gst_harness_pull_until_eos (h, &buf));
|
||||||
fail_unless (buf);
|
|
||||||
|
|
||||||
|
if (tests[i].contents_len == 0) {
|
||||||
|
fail_unless (buf == NULL);
|
||||||
|
} else {
|
||||||
|
fail_unless (buf);
|
||||||
gst_check_buffer_data (buf, tests[i].contents, tests[i].contents_len);
|
gst_check_buffer_data (buf, tests[i].contents, tests[i].contents_len);
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
}
|
||||||
|
|
||||||
gst_harness_teardown (h);
|
gst_harness_teardown (h);
|
||||||
gst_object_unref (src);
|
gst_object_unref (src);
|
||||||
|
|
Loading…
Reference in a new issue