input: vcd: skip BOM at beginning of file

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 <wsa@the-dreams.de>
This commit is contained in:
Wolfram Sang 2016-04-10 21:02:52 +02:00 committed by Uwe Hermann
parent 62974b235a
commit 1f706c21a2
1 changed files with 4 additions and 0 deletions

View File

@ -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++;