xxd.py: always write \n line endings

Previously, `open()` was used with the default option of `newline=None`,
which means that “any '\n' characters written are translated to the
system default line separator”. Now, `xxd.py` always writes `\n` line
endings. This eliminates the need for the .gitattributes file.
This commit is contained in:
Vlad-Stefan Harbuz authored and Sam Lantinga committed 2023-08-13 13:51:31 -07:00
1 parent 723bcd0a8b
commit 796713b9d5
2 files changed
+1 -13

No files matched your search

-12
View File
@@ -1,12 +0,0 @@
*.c text
*.cpp text
*.h text
*.cmake text
*.py text
*.txt text
*.sh text
*.vcxproj text eol=crlf
*.sln text eol=crlf
*.filters text eol=crlf
*.appxmanifest text eol=crlf
*.pbxproj text
+1 -1
View File
@@ -17,7 +17,7 @@ def main():
binary_data = args.input.open("rb").read()
with args.output.open("w") as fout:
with args.output.open("w", newline="\n") as fout:
fout.write("unsigned char {}[] = {{\n".format(varname))
bytes_written = 0
while bytes_written < len(binary_data):