From 4164e5f3f959b771c474b360f9887f84c3d0cff8 Mon Sep 17 00:00:00 2001 From: Jacob Quinn Date: Fri, 31 Jan 2020 12:20:28 -0700 Subject: [PATCH] Fix implementation and test --- src/CSV.jl | 2 +- test/basics.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CSV.jl b/src/CSV.jl index d85454e9..8ab285f6 100644 --- a/src/CSV.jl +++ b/src/CSV.jl @@ -361,7 +361,7 @@ function file(source, if footerskip > 0 && len > 0 lastbyte = buf[end] endpos = (lastbyte == UInt8('\r') || lastbyte == UInt8('\n')) + - lastbyte == UInt8('\n') && buf[end - 1] == UInt8('\r') + (lastbyte == UInt8('\n') && buf[end - 1] == UInt8('\r')) revlen = skiptorow(ReversedBuf(buf), 1 + endpos, len, oq, eq, cq, 0, footerskip) - 2 len -= revlen debug && println("adjusted for footerskip, len = $(len + revlen - 1) => $len") diff --git a/test/basics.jl b/test/basics.jl index 4e70cd3e..1a7a3be0 100644 --- a/test/basics.jl +++ b/test/basics.jl @@ -388,7 +388,7 @@ df = CSV.read(IOBuffer("x\n01:02:03\n\n04:05:06\n"), delim=',') # 566 f = CSV.File(IOBuffer("x\r\n1\r\n2\r\n3\r\n4\r\n5\r\n"), footerskip=3) -@test length(f) == 3 +@test length(f) == 2 @test f[1][1] == 1 end