From 6bb73040dd7447f9f45685f7f8dd5b53abc58485 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 22 Nov 2020 15:27:02 +0100 Subject: file2string: remove question mark from safe chars Trigraphs such as "??=" (which are enabled by default with -std=c11) can mess up strings, so avoid them entirely by escaping question marks. This also drops Python 2 compatibility from file2string, making the change to the waf rule necessary. The input file is now opened in binary mode which is also more correct versus the old text mode which just happened to work even on binary files. --- waftools/generators/sources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'waftools') diff --git a/waftools/generators/sources.py b/waftools/generators/sources.py index 0f5b993758..dae1985e2d 100644 --- a/waftools/generators/sources.py +++ b/waftools/generators/sources.py @@ -34,7 +34,7 @@ def f2s(self): def fn(out): source = getattr(self, 'source', None) src = self.path.find_resource(source) - file2string(source, iter(src.read().splitlines(True)), out) + file2string(source, iter(src.read('rb').splitlines(True)), out) execf(self, fn) @TaskGen.feature('ebml_header') -- cgit v1.2.3