Two patches from Peter J. Creath
Fix bug in handling arithmetic with unsigned numbers Return success if reading 0 audio blocks.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: read.c,v 1.7 2005/03/18 12:56:00 rocky Exp $
|
$Id: read.c,v 1.8 2005/10/07 00:06:45 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -63,7 +63,9 @@
|
|||||||
(long int) i_lsn, (long int) end_lsn); \
|
(long int) i_lsn, (long int) end_lsn); \
|
||||||
return DRIVER_OP_ERROR; \
|
return DRIVER_OP_ERROR; \
|
||||||
} \
|
} \
|
||||||
if ( i_lsn + i_blocks -1 > end_lsn ) { \
|
/* Care is used in the expression below to be correct with */ \
|
||||||
|
/* respect to unsigned integers. */ \
|
||||||
|
if ( i_lsn + i_blocks > end_lsn + 1 ) { \
|
||||||
cdio_info("Request truncated to end disk; lsn: %ld, end lsn: %ld", \
|
cdio_info("Request truncated to end disk; lsn: %ld, end lsn: %ld", \
|
||||||
(long int) i_lsn, (long int) end_lsn); \
|
(long int) i_lsn, (long int) end_lsn); \
|
||||||
i_blocks = end_lsn - i_lsn + 1; \
|
i_blocks = end_lsn - i_lsn + 1; \
|
||||||
@@ -122,6 +124,9 @@ cdio_read_audio_sectors (const CdIo_t *p_cdio, void *p_buf, lsn_t i_lsn,
|
|||||||
uint32_t i_blocks)
|
uint32_t i_blocks)
|
||||||
{
|
{
|
||||||
check_lsn_blocks(i_lsn, i_blocks);
|
check_lsn_blocks(i_lsn, i_blocks);
|
||||||
|
|
||||||
|
if (i_blocks == 0) return DRIVER_OP_SUCCESS;
|
||||||
|
|
||||||
if (p_cdio->op.read_audio_sectors)
|
if (p_cdio->op.read_audio_sectors)
|
||||||
return (p_cdio->op.read_audio_sectors) (p_cdio->env, p_buf, i_lsn,
|
return (p_cdio->op.read_audio_sectors) (p_cdio->env, p_buf, i_lsn,
|
||||||
i_blocks);
|
i_blocks);
|
||||||
|
|||||||
Reference in New Issue
Block a user