On Wed, Apr 06, 2016 at 11:38:08PM +0200, Wolfram Sang wrote: > According to the infos I have, VCD files should be plain ASCII, but > nonetheless DSView on Windows seems to add a UTF8 BOM at the beginning > of the file, so we need to skip it. > > This fixes bug #755. > > Signed-off-by: Wolfram Sang <[email protected]> > --- > src/input/vcd.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/src/input/vcd.c b/src/input/vcd.c > index 66f126b..0908e61 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->str[0] == '\xef' && buf->str[1] == '\xbb' && buf->str[2] == > '\xbf')
You could use strncmp() here. And for good mesure, you could check buf->len. Something like this: if (buf->len >= 3 && !strncmp(buf->str, "\xef\xbb\xbf", 3)) Aurel ------------------------------------------------------------------------------ _______________________________________________ sigrok-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sigrok-devel

