From 838129b7629fd7b04c86d98b826788d0ed131e8d Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 9 Oct 2024 11:05:23 -0500 Subject: [PATCH] fix on 1.11 --- src/serialization.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/serialization.jl b/src/serialization.jl index 990f4ea..3022373 100644 --- a/src/serialization.jl +++ b/src/serialization.jl @@ -282,8 +282,11 @@ function deserialize_lpcm(stream::LPCMStream, sample_offset::Integer=0, bytes_per_sample = _bytes_per_sample(stream.format) jump(stream.io, bytes_per_sample * sample_offset) byte_count = bytes_per_sample * sample_count - byte_count = byte_count >= 0 ? byte_count : typemax(Int) # handle overflow - return deserialize_lpcm(stream.format, read(stream.io, byte_count)) + # XXX on Julia 1.11.0, setting byte_count to the sentinal value typemax(Int) + # doesn't work: the correct number of bytes is returned from `read`, but the + # values change every time. By using a different method, we avoid that problem + bytes = byte_count >= 0 ? read(stream.io, byte_count) : read(stream.io) # handle overflow + return deserialize_lpcm(stream.format, bytes) end _matrix(samples::Matrix) = samples