File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,10 @@ function JSify(data, functionsOnly) {
87
87
}
88
88
89
89
function processLibraryFunction ( snippet , ident , finalName ) {
90
- snippet = snippet . toString ( ) ;
90
+ // It is possible that when printing the function as a string on Windows, the js interpreter we are in returns the string with Windows
91
+ // line endings \r\n. This is undesirable, since line endings are managed in the form \n in the output for binary file writes, so
92
+ // make sure the endings are uniform.
93
+ snippet = snippet . toString ( ) . replace ( / \r \n / gm, "\n" ) ;
91
94
assert ( snippet . indexOf ( 'XXX missing C define' ) == - 1 ,
92
95
'Trying to include a library function with missing C defines: ' + finalName + ' | ' + snippet ) ;
93
96
Original file line number Diff line number Diff line change @@ -13,8 +13,13 @@ def check_line_endings(filename, print_errors=True):
13
13
if print_errors : print >> sys .stderr , "Unable to read file '" + filename + "', or file was empty!"
14
14
return 1
15
15
16
- if "\r \r \n " in data :
17
- if print_errors : print >> sys .stderr , "File '" + filename + "' contains BAD line endings of form \\ r\\ r\\ n!"
16
+ bad_line_ending_index = data .find ("\r \r \n " )
17
+ if bad_line_ending_index != - 1 :
18
+ if print_errors :
19
+ print >> sys .stderr , "File '" + filename + "' contains BAD line endings of form \\ r\\ r\\ n!"
20
+ bad_line = data [max (0 ,bad_line_ending_index - 50 ):min (len (data ), bad_line_ending_index + 50 )]
21
+ bad_line = bad_line .replace ('\r ' , '\\ r' ).replace ('\n ' , '\\ n' )
22
+ print >> sys .stderr , "Content around the location: '" + bad_line + "'"
18
23
return 1 # Bad line endings in file, return a non-zero process exit code.
19
24
20
25
has_dos_line_endings = False
You can’t perform that action at this time.
0 commit comments