test/harness/testcaseparser.c
changeset 7 721e468c10f3
parent 6 faab25d520dd
child 11 4a80c6053a66
     1.1 --- a/test/harness/testcaseparser.c	Fri Jan 27 16:18:02 2012 +0000
     1.2 +++ b/test/harness/testcaseparser.c	Fri Jan 27 21:40:35 2012 +0000
     1.3 @@ -90,12 +90,20 @@
     1.4  TestcaseParser *testcase_parser_new_from_file(const char *filename)
     1.5  {
     1.6      TestcaseParser *parser;
     1.7 +    gsize len;
     1.8      parser=g_new0(TestcaseParser,1);
     1.9 -    if (!file_get_contents_text(filename,&parser->contents,NULL))
    1.10 +    if (!file_get_contents_text(filename,&parser->contents,&len))
    1.11      {
    1.12  	g_free(parser);
    1.13  	return NULL;
    1.14      }
    1.15 +    if (!g_utf8_validate(parser->contents,len,NULL))
    1.16 +    {
    1.17 +	fprintf(stderr,"%s: Does not contain valid UTF-8\n",filename);
    1.18 +	g_free(parser->contents);
    1.19 +	g_free(parser);
    1.20 +	return NULL;
    1.21 +    }
    1.22      parser->filename=g_strdup(filename);
    1.23      return parser;
    1.24  }