https://bugs.kde.org/show_bug.cgi?id=382941

--- Comment #20 from Thomas Schmitt <scdbac...@gmx.net> ---
Hi,

some final remarks about the comments:

-----------------------------------------------------------------------

This rumor can be deleted. It is not relevant in any way:

            // Some CDs writer returns the number of bytes that contain
            // the descriptors rather than the number of descriptors

Whereas this part is a wise precaution against mad drive replies of any
kind:

            // Ensure number of descriptors claimed actually fits in the data
            // returned by the mode sense command.
            if (static_cast<int>(numDesc) > ((data.size() - 32 - 8) / 4))
                numDesc = (data.size() - 32 - 8) / 4;

-----------------------------------------------------------------------

The new comment in

        if (data.size() > 32 + 8/* pageLen? */) {

does not explain the numbers 8 and 32. pageLen is a misnomer for data.size().
A better name in modeSense() would be "replyLen".

How about being more verbous:

        //  8 bytes of MODE SENSE(10) header
        // 32 bytes offset of speed descriptor list in Mode page 2Ah
        //          (MMC-3, table 361. Pages of MMC-1 and MMC-2 are smaller.)
        if (data.size() > 8 + 32) {
            // we have descriptors

It is necessary to mention MODE SENSE(10), because MODE SENSE(6) yields a
header length of 4.

-----------------------------------------------------------------------

Have a nice day :)

Thomas

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to