From: Bert Vermeulen Date: Tue, 19 Aug 2014 22:41:22 +0000 (+0200) Subject: input: Only feed scanned header to streams, not scanned files. X-Git-Tag: libsigrok-0.4.0~1103 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=33e4303baa3a33e5321bae9f3769deb6afd9b7a3;p=libsigrok.git input: Only feed scanned header to streams, not scanned files. --- diff --git a/src/input/input.c b/src/input/input.c index 4aee8d22..3bccdbc4 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -312,6 +312,12 @@ static gboolean check_required_metadata(const uint8_t *metadata, uint8_t *avail) * If an input module is found, an instance is created and returned. * Otherwise, NULL is returned. * + * If an instance is created, it has the given buffer used for scanning + * already submitted to it, to be processed before more data is sent. + * This allows a frontend to submit an initial chunk of a non-seekable + * stream, such as stdin, without having to keep it around and submit + * it again later. + * */ SR_API const struct sr_input *sr_input_scan_buffer(GString *buf) { @@ -460,7 +466,6 @@ SR_API const struct sr_input *sr_input_scan_file(const char *filename) /* Found a matching module. */ in = sr_input_new(imod, NULL); - g_string_insert_len(in->buf, 0, buf->str, buf->len); break; } g_string_free(header_buf, TRUE);