--- gobject-introspection-1.36.0/giscanner/scannerlexer.l 2014-03-11 09:50:11 +0200 +++ gobject-introspection-1.36.0.az/giscanner/scannerlexer.l 2014-01-14 18:50:24 +0200 @@ -239,7 +239,11 @@ parse_comment (GISourceScanner *scanner) while (c2 != EOF && !(c1 == '*' && c2 == '/')) { if (!skip) - g_string_append_c (string, c1); + if (c1 == '\r' && c2 == '\n') + /* Skip Windows line-feeds */ + ; + else + g_string_append_c (string, c1); if (c1 == '\n') lineno++; diff -uprN gobject-introspection-1.36.0/giscanner/sourcescanner.py gobject-introspection-1.36.0.az/giscanner/sourcescanner.py --- gobject-introspection-1.36.0/giscanner/sourcescanner.py 2014-03-11 09:50:11 +0200 +++ gobject-introspection-1.36.0.az/giscanner/sourcescanner.py 2014-01-15 16:55:51 +0200 @@ -291,9 +291,14 @@ class SourceScanner(object): cpp_args += ['-E', '-C', '-I.', '-'] cpp_args += self._cpp_options + + # XXX: Use gcc's output switch instead of STDOUT, else Shell interaction + # can cause mangling of line-endings (MINGW32/MSYS). + tmp = tempfile.mktemp() + cpp_args += ['-o', tmp] + proc = subprocess.Popen(cpp_args, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE) + stdin=subprocess.PIPE) for define in defines: proc.stdin.write('#ifndef %s\n' % (define, )) @@ -306,22 +311,12 @@ class SourceScanner(object): proc.stdin.write('#include <%s>\n' % (filename, )) proc.stdin.close() - tmp = tempfile.mktemp() - fp = open(tmp, 'w+') - while True: - data = proc.stdout.read(4096) - if data is None: - break - fp.write(data) - if len(data) < 4096: - break - fp.seek(0, 0) - assert proc, 'Proc was none' proc.wait() if proc.returncode != 0: raise SystemExit('Error while processing the source.') + fp = open(tmp, 'r+') self._scanner.parse_file(fp.fileno()) fp.close() os.unlink(tmp) diff -uprN gobject-introspection-1.36.0/scannerlexer.c gobject-introspection-1.36.0.az/scannerlexer.c --- gobject-introspection-1.36.0/scannerlexer.c 2014-03-11 09:50:10 +0200 +++ gobject-introspection-1.36.0.az/scannerlexer.c 2014-03-11 10:27:34 +0200 @@ -2754,7 +2754,11 @@ parse_comment (GISourceScanner *scanner) while (c2 != EOF && !(c1 == '*' && c2 == '/')) { if (!skip) - g_string_append_c (string, c1); + if (c1 == '\r' && c2 == '\n') + /* Skip Windows line-feeds */ + ; + else + g_string_append_c (string, c1); if (c1 == '\n') lineno++;