[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libcdio-devel] ack! another bug fixed in mmc_read_cd....
From: |
Robert William Fuller |
Subject: |
[Libcdio-devel] ack! another bug fixed in mmc_read_cd.... |
Date: |
Fri, 09 May 2008 06:00:46 -0400 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071019) |
Turns out mmc_read_cd() was ignoring the read_sector_type and treating
everything as CDIO_MMC_READ_TYPE_ANY. I do not know when this occurred
but it seems like it happened at the introduction of the
CDIO_MMC_SET_READ_TYPE macro. Basically, the broken code looked like this:
i_read_type = read_sector_type << 2;
if (b_digital_audio_play) i_read_type |= 0x2;
CDIO_MMC_SET_READ_TYPE(cdb.field, i_read_type);
where the macro looks like this:
#define CDIO_MMC_SET_READ_TYPE(cdb, sector_type) \
cdb[1] = (sector_type << 2)
Because of the double shift, once in the macro, and once in
mmc_read_cd(), the read_sector_type was being put into the reserved
field of the cdb where it was ignored. I fixed it with this code (and
eliminated a local variable in the process:)
CDIO_MMC_SET_READ_TYPE(cdb.field, read_sector_type);
if (b_digital_audio_play) cdb.field[1] |= 0x2;
Of course the unfortunate side of this is that if somebody has broken
code that depends on broken behavior, they'll now get an error instead
of erroneous success.
- [Libcdio-devel] ack! another bug fixed in mmc_read_cd....,
Robert William Fuller <=