Search
lxdream.org :: lxdream/src/drivers/cdrom/sector.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/cdrom/sector.c
changeset 1099:566cdeb157ec
prev1097:d4807997e450
next1107:7b279d10f46f
author nkeynes
date Wed Feb 10 18:16:19 2010 +1000 (10 years ago)
permissions -rw-r--r--
last change First draft of basic ISO9660 filesystem reader
file annotate diff log raw
1.1 --- a/src/drivers/cdrom/sector.c Sun Jan 31 18:35:06 2010 +1000
1.2 +++ b/src/drivers/cdrom/sector.c Wed Feb 10 18:16:19 2010 +1000
1.3 @@ -32,7 +32,7 @@
1.4 #define CHECK_READ(dev,lba,count) \
1.5 if( !IS_SECTOR_SOURCE(dev) ) { \
1.6 return CDROM_ERROR_NODISC; \
1.7 - } else if( (lba) >= (dev)->size || (lba+block_count) > (dev)->size ) { \
1.8 + } else if( (dev)->size != 0 && ((lba) >= (dev)->size || (lba+block_count) > (dev)->size) ) { \
1.9 return CDROM_ERROR_BADREAD; \
1.10 }
1.11
1.12 @@ -340,11 +340,13 @@
1.13 if( err != CDROM_ERROR_OK )
1.14 return err;
1.15 if( read_sector_fields == 0 ) { /* Read nothing */
1.16 - *length = 0;
1.17 + if( length != NULL )
1.18 + *length = 0;
1.19 return CDROM_ERROR_OK;
1.20 } else if( read_sector_fields == CDROM_READ_DATA ) {
1.21 /* Data-only */
1.22 - *length = block_count * CDROM_SECTOR_SIZE(device->mode);
1.23 + if( length != NULL )
1.24 + *length = block_count * CDROM_SECTOR_SIZE(device->mode);
1.25 return device->read_blocks( device, lba, block_count, buf );
1.26 } else if( read_sector_fields == CDROM_READ_RAW ) {
1.27 for( i=0; i<block_count; i++ ) {
1.28 @@ -366,7 +368,8 @@
1.29 }
1.30 }
1.31 }
1.32 - *length = len;
1.33 + if( length != NULL )
1.34 + *length = len;
1.35 return CDROM_ERROR_OK;
1.36
1.37 }
.