Skip to content

Commit

Permalink
MacOS newline detect fix (#250)
Browse files Browse the repository at this point in the history
* MacOS newline detect fix

* DetectNewLine fix
  • Loading branch information
peto268 authored Apr 22, 2024
1 parent a6f722c commit d59e984
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion source/Sylvan.Data.Csv/CsvDataReader+Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ async Task<bool> InitializeReaderAsync(CancellationToken cancel = default)
}
if (this.newLineMode == NewLineMode.Unknown)
{
this.DetectNewLine();
var m = this.DetectNewLine();
this.newLineMode = m;
}

this.minSafe = delimiter < '\r' ? '\r' : delimiter;
Expand Down
2 changes: 1 addition & 1 deletion source/Sylvan.Data.Csv/CsvDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ NewLineMode DetectNewLine()
var c = this.buffer[idx];
if (c == '\r')
{
if (c + 1 < this.buffer.Length && this.buffer[c + 1] != '\n')
if (idx + 1 < this.buffer.Length && this.buffer[idx + 1] != '\n')
{
return NewLineMode.MacOS;
}
Expand Down

0 comments on commit d59e984

Please sign in to comment.