[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdeextragear-1/k3b/src/core/device
From:       Sebastian Trueg <sebastian () trueg ! de>
Date:       2003-10-17 19:05:13
[Download RAW message or body]

CVS commit by trueg: 

fixed cd-text reading. Seems that I cannot rely on QString::fromLocal8Bit to omit
all characters after a \0


  M +12 -18    k3bdevice.cpp   1.29


--- kdeextragear-1/k3b/src/core/device/k3bdevice.cpp  #1.28:1.29
@@ -62,15 +62,4 @@ extern "C" {
 #endif /* #ifndef IDE_DISK_MAJOR */
 
-#ifndef SCSI_DISK_MAJOR
-#define SCSI_DISK_MAJOR(M) ((M) == SCSI_DISK0_MAJOR || \
-  ((M) >= SCSI_DISK1_MAJOR && (M) <= SCSI_DISK7_MAJOR) || \
-  ((M) >= SCSI_DISK8_MAJOR && (M) <= SCSI_DISK15_MAJOR))
-#endif /* #ifndef SCSI_DISK_MAJOR */
-
-#ifndef SCSI_BLK_MAJOR
-#define SCSI_BLK_MAJOR(M) \
-  (SCSI_DISK_MAJOR(M)   \
-   || (M) == SCSI_CDROM_MAJOR)
-#endif /* #ifndef SCSI_BLK_MAJOR */
 
 
@@ -1438,9 +1427,9 @@ K3bCdDevice::AlbumCdText K3bCdDevice::Cd
 
           //
+          // pack.data has a length of 12
+          //
           // id1 tells us the tracknumber of the data (0 for global)
           // data may contain multible \0. In that case after every \0 the track \
number increases 1  //
-          // QString::fromLocal8Bit stops at the first \0. So we do not need to care \
                about that ourselves
-          //
 
           char* nullPos = (char*)pack[i].data - 1;
@@ -1448,5 +1437,10 @@ K3bCdDevice::AlbumCdText K3bCdDevice::Cd
           unsigned int trackNo = pack[i].id2;
           while( nullPos && trackNo <= trackCount ) {
-            QString txtstr = QString::fromLocal8Bit( (char*)nullPos+1, 11 - (nullPos \
- (char*)pack[i].data) ); +            char* nextNullPos = (char*)::memchr( \
nullPos+1, '\0', 11 - (nullPos - (char*)pack[i].data) ); +            QString txtstr; \
 +            if( nextNullPos ) // take all chars up to the next null
+              txtstr = QString::fromLocal8Bit( (char*)nullPos+1, nextNullPos - \
nullPos - 1 ); +            else // take all chars to the end of the pack data (12 \
bytes) +              txtstr = QString::fromLocal8Bit( (char*)nullPos+1, 11 - \
(nullPos - (char*)pack[i].data) );  
             switch( pack[i].id1 ) {
@@ -1516,5 +1510,5 @@ K3bCdDevice::AlbumCdText K3bCdDevice::Cd
           
             trackNo++;
-            nullPos = (char*)::memchr( nullPos+1, '\0', 11 - (nullPos - \
(char*)pack[i].data) ); +            nullPos = nextNullPos;
           }
         }
@@ -2216,7 +2210,7 @@ bool K3bCdDevice::CdDevice::readFormatCa
       if( cmd.transport( TR_DIR_READ, buffer, realLength ) == 0 ) {
         //
-        // now find the 00h format type since that contains the number of \
addressable blocks +        // now find the 00h format type since that contains the \
number of adressable blocks  // and the block size used for formatting the whole \
                media.
-        // There may be multible occurrences of this descriptor (MMC4 says so) but I \
think it's +        // There may be multible occurences of this descriptor (MMC4 says \
so) but I think it's  // sufficient to read the first one
         // 00h may not be supported by the unit (e.g. CD-RW)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic