According to the infos I have, VCD files should be plain ASCII, but we
got report of a version adding a UTF8 BOM at the beginning of the file,
so we need to skip it.

This fixes bug #755.

Signed-off-by: Wolfram Sang <w...@the-dreams.de>
---

Thanks to Aurelien Jacobs for the criticism.

 src/input/vcd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/input/vcd.c b/src/input/vcd.c
index 66f126b..b25c738 100644
--- a/src/input/vcd.c
+++ b/src/input/vcd.c
@@ -105,6 +105,10 @@ static gboolean parse_section(GString *buf, gchar **name, 
gchar **contents)
        status = FALSE;
        pos = 0;
 
+       /* Skip UTF8 BOM */
+       if (buf->len >= 3 && !strncmp(buf->str, "\xef\xbb\xbf", 3))
+               pos = 3;
+
        /* Skip any initial white-space. */
        while (pos < buf->len && g_ascii_isspace(buf->str[pos]))
                pos++;
-- 
2.7.0


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to