Closed MeFisto94 closed 6 months ago
I think you are right, and it shows how important test coverage is.
Whole family of methods is missing CloseFrame
, for example here: https://github.com/MiloszKrajewski/K4os.Compression.LZ4/blob/52f43450287e0626276e72ac9cb483dca73bfeac/src/K4os.Compression.LZ4.Streams/LZ4Frame.encode.cs#L126
Unfortunately, I'm a little bit busy this week, but I will try to squeeze it somewhere.
Released in 1.3.8
Description Foreword: Maybe I just didn't understand things right, so this is only my suspicion, but: I had problems when using the Encode overloads that immediately return the written bytes as they had only been returning
7
. After a while, I found out that this is the header, and that one is supposed to close the frame/dispose the writer before examinating the written bytes.After I converted my code to return a FrameWriter and properly
CloseFrame
ing it before accessing theCompressedLength
, I get the result that I desired, but I have the suspicion / observation, that said overloads don't explicitly CloseFrame, instead they useusing
blocks, so certainly even accessing the written bytes before disposal.To reproduce Use the int/one shot overloads such as
LZ4Frame.Encode(new byte[100], new byte[1000])
Expected behavior A reasonable return value.
Actual behavior The method is always returning
7
Environment