diff -uprN gobject-introspection-1.38.0/giscanner/scannerlexer.l gobject-introspection-1.38.0.az/giscanner/scannerlexer.l --- gobject-introspection-1.38.0/giscanner/scannerlexer.l 2013-07-10 18:13:23 +0200 +++ gobject-introspection-1.38.0.az/giscanner/scannerlexer.l 2014-03-11 16:37:17 +0200 @@ -248,7 +249,11 @@ parse_gtk_doc_comment (GISourceScanner * 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.38.0/giscanner/sourcescanner.py gobject-introspection-1.38.0.az/giscanner/sourcescanner.py --- gobject-introspection-1.38.0/giscanner/sourcescanner.py 2013-07-10 18:13:23 +0200 +++ gobject-introspection-1.38.0.az/giscanner/sourcescanner.py 2014-03-11 16:37:17 +0200 @@ -291,9 +291,13 @@ 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_name = tempfile.mktemp() + cpp_args += ['-o', tmp_name] + 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, )) @@ -302,22 +309,12 @@ class SourceScanner(object): proc.stdin.write('#include <%s>\n' % (filename, )) proc.stdin.close() - tmp_fd, tmp_name = tempfile.mkstemp() - fp = os.fdopen(tmp_fd, 'w+b') - 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_name, 'r+b') self._scanner.parse_file(fp.fileno()) fp.close() os.unlink(tmp_name) diff -uprN gobject-introspection-1.38.0/scannerlexer.c gobject-introspection-1.38.0.az/scannerlexer.c --- gobject-introspection-1.38.0/scannerlexer.c 2013-09-24 15:42:57 +0200 +++ gobject-introspection-1.38.0.az/scannerlexer.c 2014-03-11 16:37:17 +0200 @@ -2840,7 +2840,11 @@ parse_gtk_doc_comment (GISourceScanner * 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++;