Skip to content

Commit 248f7fd

Browse files
compress_hw_get_hpointer: use SNDRV_COMPRESS_AVAIL64
Refactor compress_hw_get_hpointer to use the new SNDRV_COMPRESS_AVAIL64 which benefits from overflow safety.
1 parent a885db3 commit 248f7fd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib/compress_hw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,14 @@ static int compress_hw_get_hpointer(void *data,
228228
unsigned int *avail, struct timespec *tstamp)
229229
{
230230
struct compress_hw_data *compress = (struct compress_hw_data *)data;
231-
struct snd_compr_avail kavail;
231+
struct snd_compr_avail64 kavail;
232232
__u64 time;
233233

234234
if (!is_compress_hw_ready(compress))
235235
return oops(compress, ENODEV, "device not ready");
236236

237-
if (ioctl(compress->fd, SNDRV_COMPRESS_AVAIL, &kavail))
238-
return oops(compress, errno, "cannot get avail");
237+
if (ioctl(compress->fd, SNDRV_COMPRESS_AVAIL64, &kavail))
238+
return oops(compress, errno, "cannot get avail64");
239239
if (0 == kavail.tstamp.sampling_rate)
240240
return oops(compress, ENODATA, "sample rate unknown");
241241
*avail = (unsigned int)kavail.avail;

0 commit comments

Comments
 (0)