Skip to content

Commit a544fdc

Browse files
Strip all CR bytes from text files, not just CRLF pairs
Simplify normalization to unconditionally remove \r bytes (equivalent to tr -d '\r'), which is proven to produce identical content across platforms per CI diagnostics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent cf6e05b commit a544fdc

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

MS2Create/Program.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,9 @@ private static Stream OpenNormalized(string filePath) {
108108
byte[] raw = File.ReadAllBytes(filePath);
109109
int dst = 0;
110110
for (int src = 0; src < raw.Length; src++) {
111-
if (raw[src] == (byte)'\r' && src + 1 < raw.Length && raw[src + 1] == (byte)'\n') {
112-
continue;
111+
if (raw[src] != (byte)'\r') {
112+
raw[dst++] = raw[src];
113113
}
114-
raw[dst++] = raw[src];
115114
}
116115

117116
return new MemoryStream(raw, 0, dst, writable: false);

0 commit comments

Comments
 (0)