~ubuntu-branches/ubuntu/feisty/k3b/feisty-backports

« back to all changes in this revision

Viewing changes to libk3b/tools/k3biso9660.cpp

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2007-09-05 10:00:13 UTC
  • mfrom: (28.1.11 gutsy)
  • Revision ID: james.westby@ubuntu.com-20070905100013-h0ey1jtz2xvd8dq2
Tags: 1.0.3-0ubuntu3~feisty1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* 
 
1
/*
2
2
 *
3
 
 * $Id: k3biso9660.cpp 619556 2007-01-03 17:38:12Z trueg $
 
3
 * $Id: k3biso9660.cpp 690529 2007-07-21 10:51:47Z trueg $
4
4
 * Copyright (C) 2003 Sebastian Trueg <trueg@k3b.org>
5
5
 *
6
6
 * This file is part of the K3b project.
32
32
 
33
33
 
34
34
/* callback function for libisofs */
35
 
int K3bIso9660::read_callback( char* buf, sector_t start, int len, void* udata ) 
 
35
int K3bIso9660::read_callback( char* buf, sector_t start, int len, void* udata )
36
36
{
37
37
  K3bIso9660* isoF = static_cast<K3bIso9660*>(udata);
38
 
  
 
38
 
39
39
  return isoF->read( start, buf, len );
40
40
}
41
41
 
42
42
/* callback function for libisofs */
43
 
int K3bIso9660::isofs_callback( struct iso_directory_record *idr, void *udata ) 
 
43
int K3bIso9660::isofs_callback( struct iso_directory_record *idr, void *udata )
44
44
{
45
45
  K3bIso9660 *iso = static_cast<K3bIso9660*> (udata);
46
46
  QString path, isoPath,user,group,symlink;
128
128
 
129
129
  if (idr->flags[0] & 2) {
130
130
      entry = new K3bIso9660Directory( iso, isoPath, path, access | S_IFDIR, time, adate, cdate,
131
 
                                       user, group, symlink, 
132
 
                                       special ? 0 : isonum_733(idr->extent), 
 
131
                                       user, group, symlink,
 
132
                                       special ? 0 : isonum_733(idr->extent),
133
133
                                       special ? 0 : isonum_733(idr->size) );
134
134
  }
135
135
  else {
139
139
      (static_cast<K3bIso9660File*>(entry))->setZF( z_algo, z_params, z_size );
140
140
  }
141
141
  iso->dirent->addEntry(entry);
142
 
  
 
142
 
143
143
  return 0;
144
144
}
145
145
 
151
151
                                  int access,
152
152
                                  int date,
153
153
                                  int adate,
154
 
                                  int cdate, 
 
154
                                  int cdate,
155
155
                                  const QString& user,
156
156
                                  const QString& group,
157
157
                                  const QString& symlink )
178
178
 
179
179
 
180
180
 
181
 
K3bIso9660File::K3bIso9660File( K3bIso9660* archive, 
182
 
                                const QString& isoName, 
183
 
                                const QString& name, 
 
181
K3bIso9660File::K3bIso9660File( K3bIso9660* archive,
 
182
                                const QString& isoName,
 
183
                                const QString& name,
184
184
                                int access,
185
 
                                int date, 
 
185
                                int date,
186
186
                                int adate,
187
 
                                int cdate, 
188
 
                                const QString& user, 
 
187
                                int cdate,
 
188
                                const QString& user,
189
189
                                const QString& group,
190
 
                                const QString& symlink, 
191
 
                                unsigned int pos, 
 
190
                                const QString& symlink,
 
191
                                unsigned int pos,
192
192
                                unsigned int size )
193
193
  : K3bIso9660Entry( archive, isoName, name, access, date, adate, cdate, user, group, symlink ),
194
194
    m_startSector(pos),
286
286
}
287
287
 
288
288
 
289
 
K3bIso9660Directory::K3bIso9660Directory( K3bIso9660* archive, 
290
 
                                          const QString& isoName, 
291
 
                                          const QString& name, 
 
289
K3bIso9660Directory::K3bIso9660Directory( K3bIso9660* archive,
 
290
                                          const QString& isoName,
 
291
                                          const QString& name,
292
292
                                          int access,
293
 
                                          int date, 
294
 
                                          int adate, 
295
 
                                          int cdate, 
296
 
                                          const QString& user, 
 
293
                                          int date,
 
294
                                          int adate,
 
295
                                          int cdate,
 
296
                                          const QString& user,
297
297
                                          const QString& group,
298
298
                                          const QString& symlink,
299
 
                                          unsigned int pos, 
 
299
                                          unsigned int pos,
300
300
                                          unsigned int size  )
301
301
  : K3bIso9660Entry( archive, isoName, name, access, date, adate, cdate, user, group, symlink ),
302
302
    m_bExpanded( size == 0 ), // we can only expand entries that represent an actual directory
329
329
  const_cast<K3bIso9660Directory*>(this)->expand();
330
330
 
331
331
  QStringList l;
332
 
  
 
332
 
333
333
  QDictIterator<K3bIso9660Entry> it( m_entries );
334
334
  for( ; it.current(); ++it )
335
335
    l.append( it.currentKey() );
336
 
  
 
336
 
337
337
  return l;
338
338
}
339
339
 
344
344
  const_cast<K3bIso9660Directory*>(this)->expand();
345
345
 
346
346
  QStringList l;
347
 
  
 
347
 
348
348
  QDictIterator<K3bIso9660Entry> it( m_iso9660Entries );
349
349
  for( ; it.current(); ++it )
350
350
    l.append( it.currentKey() );
351
 
  
 
351
 
352
352
  return l;
353
353
}
354
354
 
454
454
class K3bIso9660::Private
455
455
{
456
456
public:
457
 
  Private() 
 
457
  Private()
458
458
    : cdDevice(0),
459
459
      fd(-1),
460
460
      isOpen(false),
555
555
  boot_entry *be;
556
556
  QString path;
557
557
  K3bIso9660File *entry;
558
 
    
 
558
 
559
559
  entry=new K3bIso9660File( this, "Catalog", "Catalog", dirent->permissions() & ~S_IFDIR,
560
560
                            dirent->date(), dirent->adate(), dirent->cdate(),
561
561
                            dirent->user(), dirent->group(), QString::null,
602
602
 
603
603
    else if( d->cdDevice ) {
604
604
      // now check if we have a scrambled video dvd
605
 
      if( d->cdDevice->copyrightProtectionSystemType() > 0 ) {
606
 
        
 
605
      if( d->cdDevice->copyrightProtectionSystemType() == 1 ) {
 
606
 
607
607
        kdDebug() << "(K3bIso9660) found encrypted dvd. using libdvdcss." << endl;
608
 
        
 
608
 
609
609
        // open the libdvdcss stuff
610
610
        d->backend = new K3bIso9660LibDvdCssBackend( d->cdDevice );
611
611
        if( !d->backend->open() ) {
666
666
        path="El Torito Boot";
667
667
        if( c_b > 1 )
668
668
          path += " (" + QString::number(c_b) + ")";
669
 
                        
 
669
 
670
670
        dirent = new K3bIso9660Directory( this, path, path, access | S_IFDIR,
671
671
                                          buf.st_mtime, buf.st_atime, buf.st_ctime, uid, gid, QString::null );
672
672
        d->elToritoDirs.append( dirent );
673
 
                        
 
673
 
674
674
        addBoot(bootdesc);
675
675
        c_b++;
676
676
      }
694
694
          path = "Joliet level " + QString::number(m_joliet);
695
695
          if( c_j > 1 )
696
696
            path += " (" + QString::number(c_j) + ")";
697
 
        } 
 
697
        }
698
698
        else {
699
 
          path = QString::fromLocal8Bit( primaryDesc->volume_id, 32 ); 
 
699
          path = QString::fromLocal8Bit( primaryDesc->volume_id, 32 );
700
700
          if( c_i > 1 )
701
701
            path += " (" + QString::number(c_i) + ")";
702
702
        }
703
 
        
 
703
 
704
704
        dirent = new K3bIso9660Directory( this, path, path, access | S_IFDIR,
705
705
                                          buf.st_mtime, buf.st_atime, buf.st_ctime, uid, gid, QString::null );
706
706
 
707
707
        // expand the root entry
708
708
        ProcessDir( &K3bIso9660::read_callback, isonum_733(idr->extent),isonum_733(idr->size),&K3bIso9660::isofs_callback,this);
709
 
        
 
709
 
710
710
        if (m_joliet)
711
711
          c_j++;
712
712
        else
727
727
  }
728
728
 
729
729
  FreeISO9660(desc);
730
 
  
 
730
 
731
731
  return true;
732
732
}
733
733
 
761
761
    // Since the first isoDir is the KArchive
762
762
    // root we must not delete it but all the
763
763
    // others.
764
 
    
 
764
 
765
765
    d->elToritoDirs.setAutoDelete(true);
766
766
    d->jolietDirs.setAutoDelete(true);
767
767
    d->isoDirs.setAutoDelete(true);