1 // KDat - a tar-based DAT archiver
2 // Copyright (C) 1998-2000 Sean Vyain, svyain@mail.tds.net
3 // Copyright (C) 2001-2002 Lawrence Widman, kdat@cardiothink.com
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30 #include <kmessagebox.h>
32 #include <kstandarddirs.h>
35 #include "KDatMainWindow.h"
38 #include "TapeDrive.h"
39 #include "TapeManager.h"
44 _name( i18n( "New Tape" ) ),
45 _size( Options::instance()->getDefaultTapeSize() ),
49 gethostname( buffer
, 1024 );
50 time_t tm
= time( NULL
);
53 _id
.sprintf("%s:%d", buffer
, tm
);
58 Tape::Tape( const char * id
)
77 if ( !TapeDrive::instance()->rewind() ) {
78 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Rewinding tape failed." ), i18n("Format Failed"));
82 // Set block size for tape.
83 if ( !TapeDrive::instance()->setBlockSize( Options::instance()->getTapeBlockSize() ) ) {
84 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Cannot set tape block size." ), i18n("Format Failed"));
92 if ( TapeDrive::instance()->write( KDAT_MAGIC
, KDAT_MAGIC_LENGTH
) < KDAT_MAGIC_LENGTH
) {
93 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Writing magic string failed." ), i18n("Format Failed"));
97 // Tape header version number.
98 iv
= KDAT_TAPE_HEADER_VERSION
;
99 if ( TapeDrive::instance()->write( (const char*)&iv
, 4 ) < 4 ) {
100 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Writing version number failed." ), i18n("Format Failed") );
104 // Write tape ID. Tape ID is machine name + current time.
105 iv
= _id
.length() + 1;
106 if ( TapeDrive::instance()->write( (const char*)&iv
, 4 ) < 4 ) {
107 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Writing tape ID length failed." ), i18n("Format Failed") );
112 #warning "Port Qt4: test if toUtf8 is correct"
114 if ( TapeDrive::instance()->write( _id
.toUtf8(), iv
) < iv
) {
115 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Writing tape ID failed." ), i18n("Format Failed") );
119 // Write end of file marker.
120 TapeDrive::instance()->close();
121 TapeDrive::instance()->open();
123 // Write new tape index.
131 // printf("Can't read tape data because tape isn't stubbed\n" );
139 // printf("Preparing to read tape data\n" );
140 // QString filename1 = locateLocal( "appdata", _id);
141 // printf("The tape data are in \"%s\"\n", filename1.ascii() );
145 QString filename
= locateLocal( "appdata", _id
);
146 _fptr
= fopen( QFile::encodeName(filename
), "r" );
150 // printf("Opened tape archive file \"%s\". %s %d\n",
151 // filename.ascii(), __FILE__, __LINE__ );
158 // No tape index file was found.
159 int result
= KMessageBox::warningContinueCancel( KDatMainWindow::getInstance(),
160 i18n( "No index file was found for this tape.\n"
161 "Recreate the index from tape?" ),
164 if (result
== KMessageBox::Continue
) {
167 IndexDlg
dlg( this, KDatMainWindow::getInstance() );
169 TapeManager::instance()->addTape( this );
178 fseek( _fptr
, 0, SEEK_SET
);
180 // Read index file version number.
181 if ( !fgets( buf
, 4096, _fptr
) ) {
183 KMessageBox::error( KDatMainWindow::getInstance(),
184 i18n( "Reading version number failed." ),
185 i18n("Index File Error") );
188 int version
= atoi( buf
);
192 readVersion1Index( _fptr
);
201 readVersion2Index( _fptr
);
210 readVersion3Index( _fptr
);
219 readVersion4Index( _fptr
);
224 KMessageBox::sorry( KDatMainWindow::getInstance(),
225 i18n( "The tape index file format is version %1. The index cannot be read by this version of KDat. Perhaps the tape index file was created by a newer version of KDat?" , version
),
226 i18n("Tape Index") );
231 void Tape::readAll( int version
)
235 Q3PtrListIterator
<Archive
> i( _children
);
236 for ( ; i
.current(); ++i
) {
237 i
.current()->readAll( version
);
243 QString filename
= locateLocal( "appdata", _id
);
247 // printf("Preparing to write the archive data to \"%s\". %s %d\n",
248 // filename.ascii(), __FILE__, __LINE__ );
253 _fptr
= fopen( QFile::encodeName(filename
), "w" );
257 // printf("Opened new archive file \"%s\". %s %d\n",
258 // filename.ascii(), __FILE__, __LINE__ );
264 printf( "Tape::write() -- cannot open '%s' for writing!\n", filename
.ascii() );
268 freopen( QFile::encodeName(filename
), "w", _fptr
);
271 // printf("Reopened new archive file \"%s\". %s %d\n",
272 // filename.ascii(), __FILE__, __LINE__ );
279 //===== Write the tape data =====
281 fprintf( _fptr
, "%d\n", KDAT_INDEX_FILE_VERSION
);
282 fprintf( _fptr
, "%s\n", _id
.data() );
284 fwrite( &_ctime
, sizeof( _ctime
), 1, _fptr
);
285 fwrite( &_mtime
, sizeof( _mtime
), 1, _fptr
);
286 fwrite( &_size
, sizeof( _size
), 1, _fptr
);
288 memset( buf
, 0, 4096 );
289 memcpy( buf
, _name
.ascii(), _name
.length() > 4095 ? 4095 : _name
.length() );
290 fwrite( buf
, sizeof( char ), 4096, _fptr
);
291 int ival
= _children
.count();
292 fwrite( &ival
, sizeof( ival
), 1, _fptr
);
294 // Fill in the archive offsets later...
295 int archiveTable
= ftell( _fptr
);
296 for ( uint i
= 0; i
< MAX_NUM_ARCHIVES
; i
++ ) {
297 fwrite( &zero
, sizeof( zero
), 1, _fptr
);
300 //===== Write archives =====
301 Q3PtrListIterator
<Archive
> i( _children
);
303 for ( ; i
.current(); ++i
, count
++ ) {
304 // Fill in the file offset.
305 int here
= ftell( _fptr
);
306 fseek( _fptr
, archiveTable
+ 4*count
, SEEK_SET
);
307 fwrite( &here
, sizeof( here
), 1, _fptr
);
308 fseek( _fptr
, here
, SEEK_SET
);
310 i
.current()->write( _fptr
);
313 freopen( QFile::encodeName(filename
), "r+", _fptr
);
316 QString
Tape::getID()
323 QString
Tape::getName()
351 const Q3PtrList
<Archive
>& Tape::getChildren()
358 void Tape::setName( const QString
& name
)
367 // Create a new empty index file.
371 // change file to read-write so we can update it 2002-01-31 LEW
372 QString filename
= locateLocal( "appdata", _id
);
373 freopen( QFile::encodeName(filename
), "r+", _fptr
);
378 if( fseek( _fptr
, 0, SEEK_SET
) < 0 )
382 QString msg
= i18n("Error during fseek #1 while accessing archive: \"%1\": %2").arg( getID() ).arg( i18n(strerror( errno
)) );
383 printf("%s\n", msg
.toLatin1());
384 KMessageBox::error(NULL
, msg
, i18n("File Access Error"));
388 if( fgets( buf
, 4096, _fptr
) == NULL
)
392 QString msg
= i18n("Error while accessing string #1 in archive: \"%1\": %2").arg( getID() ).arg(i18n(strerror( errno
)));
393 printf("%s\n", msg
.toLatin1());
394 KMessageBox::error(NULL
, msg
, i18n("File Access Error"));
398 if( fgets( buf
, 4096, _fptr
) == NULL
)
402 QString msg
= i18n("Error while accessing string #2 in archive: \"%1\": %2").arg( getID() ).arg(i18n(strerror( errno
)));
403 printf("%s\n", msg
.toLatin1());
404 KMessageBox::error(NULL
, msg
, i18n("File Access Error"));
408 if( fseek( _fptr
, 12, SEEK_CUR
) < 0 )
412 QString msg
= i18n("Error during fseek #2 while accessing archive: \"%1\": %2").arg( getID() ).arg(i18n(strerror( errno
)));
413 printf("%s\n", msg
.toLatin1());
414 KMessageBox::error(NULL
, msg
, i18n("File Access Error"));
418 memset( buf
, 0, 4096 );
419 memcpy( buf
, _name
.ascii(), _name
.length() > 4095 ? 4095 : _name
.length() );
420 i
= fwrite( buf
, sizeof( char ), 4096, _fptr
);
421 if( ( i
< 4096 ) || ( ferror( _fptr
) != 0 )){
423 QString msg
= i18n("Error while updating archive name: ");
424 msg
.append( i18n(strerror( errno
)) );
425 printf("%s\n", msg
.latin1());
426 KMessageBox::error(NULL
, msg
, i18n("File Access Error"));
434 // printf("Tape::setName. wrote \"%s\" (%d bytes) into archive ID %s. %s %d\n",
435 // _name.ascii(), _name.length(), getID().toLatin1(), __FILE__, __LINE__);
436 // printf(" The buffer size is 4096. %d bytes were written\n", i);
440 // change back to read-only 2002-01-31 LEW
441 freopen( QFile::encodeName(filename
), "r", _fptr
);
443 TapeManager::instance()->tapeModified( this );
446 void Tape::setMTime( int mtime
)
451 // Create a new empty index file.
455 // change file to read-write so we can update it 2002-01-31 LEW
456 QString filename
= locateLocal( "appdata", _id
);
457 freopen( QFile::encodeName(filename
), "r+", _fptr
);
462 fseek( _fptr
, 0, SEEK_SET
);
463 fgets( buf
, 4096, _fptr
);
464 fgets( buf
, 4096, _fptr
);
465 fseek( _fptr
, 4, SEEK_CUR
);
466 fwrite( &_mtime
, sizeof( _mtime
), 1, _fptr
);
469 // change back to read-only 2002-01-31 LEW
470 freopen( QFile::encodeName(filename
), "r", _fptr
);
472 TapeManager::instance()->tapeModified( this );
475 void Tape::setSize( int size
)
480 // Create a new empty index file.
486 // change file to read-write so we can update it 2002-01-31 LEW
487 QString filename
= locateLocal( "appdata", _id
);
488 freopen( QFile::encodeName(filename
), "r+", _fptr
);
491 fseek( _fptr
, 0, SEEK_SET
);
492 fgets( buf
, 4096, _fptr
);
493 fgets( buf
, 4096, _fptr
);
494 fseek( _fptr
, 8, SEEK_CUR
);
495 fwrite( &_size
, sizeof( _size
), 1, _fptr
);
498 // change back to read-only 2002-01-31 LEW
499 freopen( QFile::encodeName(filename
), "r", _fptr
);
501 TapeManager::instance()->tapeModified( this );
504 void Tape::addChild( Archive
* archive
)
507 // printf("Preparing to add archive to tape file\n" );
512 // change file to read-write so we can update it 2002-01-31 LEW
513 QString filename
= locateLocal( "appdata", _id
);
514 freopen( QFile::encodeName(filename
), "r+", _fptr
);
516 archive
->calcRanges();
518 _children
.append( archive
);
521 fseek( _fptr
, 0, SEEK_END
);
522 int here
= ftell( _fptr
);
523 fseek( _fptr
, 0, SEEK_SET
);
524 fgets( buf
, 4096, _fptr
);
525 fgets( buf
, 4096, _fptr
);
526 fseek( _fptr
, 12 + 4096, SEEK_CUR
);
527 int ival
= _children
.count();
528 fwrite( &ival
, sizeof( ival
), 1, _fptr
);
529 fseek( _fptr
, ( _children
.count() - 1 ) * 4, SEEK_CUR
);
530 fwrite( &here
, sizeof( here
), 1, _fptr
);
531 fseek( _fptr
, here
, SEEK_SET
);
532 archive
->write( _fptr
);
535 setMTime( time( NULL
) );
537 // change back to read-only 2002-01-31 LEW
538 freopen( QFile::encodeName(filename
), "r", _fptr
);
541 // printf("Done adding archive to tape file\n" );
545 void Tape::removeChild( Archive
* archive
)
549 while ( _children
.last() != archive
) {
550 _children
.removeLast();
552 _children
.removeLast();
555 fseek( _fptr
, 0, SEEK_SET
);
556 fgets( buf
, 4096, _fptr
);
557 fgets( buf
, 4096, _fptr
);
558 fseek( _fptr
, 12 + 4096, SEEK_CUR
);
559 int ival
= _children
.count();
560 fwrite( &ival
, sizeof( ival
), 1, _fptr
);
563 fseek( _fptr
, _children
.count() * 4, SEEK_CUR
);
564 fread( &here
, sizeof( here
), 1, _fptr
);
566 fseek( _fptr
, MAX_NUM_ARCHIVES
* 4, SEEK_CUR
);
567 here
= ftell( _fptr
);
570 QString filename
= locateLocal( "appdata", _id
);
571 truncate( QFile::encodeName(filename
), here
);
572 freopen( QFile::encodeName(filename
), "r+", _fptr
);
575 // change back to read-only 2002-01-31 LEW
576 freopen( QFile::encodeName(filename
), "r", _fptr
);
578 setMTime( time( NULL
) );
583 if ( _children
.count() < 1 ) {
587 while ( _children
.first() ) {
588 delete _children
.first();
589 _children
.removeFirst();
593 fseek( _fptr
, 0, SEEK_SET
);
594 fgets( buf
, 4096, _fptr
);
595 fgets( buf
, 4096, _fptr
);
596 fseek( _fptr
, 12 + 4096, SEEK_CUR
);
597 int ival
= _children
.count();
598 fwrite( &ival
, sizeof( ival
), 1, _fptr
);
599 fseek( _fptr
, MAX_NUM_ARCHIVES
* 4, SEEK_CUR
);
600 int here
= ftell( _fptr
);
602 QString filename
= locateLocal( "appdata", _id
);
603 truncate( QFile::encodeName(filename
), here
);
604 freopen( QFile::encodeName(filename
), "r+", _fptr
);
607 // change back to read-only 2002-01-31 LEW
608 freopen( QFile::encodeName(filename
), "r", _fptr
);
610 setMTime( time( NULL
) );
613 void Tape::readVersion1Index( FILE* fptr
)
615 fseek( fptr
, 0, SEEK_CUR
);
620 if ( !fgets( buf
, 4096, fptr
) ) {
621 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading tape ID failed." ), i18n("Index File Error") );
624 QByteArray tapeID
= buf
;
625 tapeID
.truncate( tapeID
.length() - 1 );
626 if ( tapeID
!=_id
) {
627 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Tape ID on tape does not match tape ID in index file." ), i18n("Index File Error") );
631 // Read creation time.
632 if ( !fgets( buf
, 4096, fptr
) ) {
633 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading creation time failed." ), i18n("Index File Error") );
636 _ctime
= atoi( buf
);
638 // Read modification time.
639 if ( !fgets( buf
, 4096, fptr
) ) {
640 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading modification time failed." ), i18n("Index File Error") );
643 _mtime
= atoi( buf
);
646 if ( !fgets( buf
, 4096, fptr
) ) {
647 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading tape name failed." ), i18n("Index File Error") );
651 _name
.truncate( _name
.length() - 1 );
654 if ( !fgets( buf
, 4096, fptr
) ) {
655 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading tape size failed." ), i18n("Index File Error") );
660 // Read number of archives.
661 if ( !fgets( buf
, 4096, fptr
) ) {
662 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading archive count failed." ), i18n("Index File Error") );
665 int numArchives
= atoi( buf
);
667 for ( ; numArchives
; numArchives
-- ) {
668 // Read archive name.
669 if ( !fgets( buf
, 4096, fptr
) ) {
670 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading archive name failed." ), i18n("Index File Error") );
673 QString archiveName
= buf
;
674 archiveName
.truncate( archiveName
.length() - 1 );
676 // Read archive time stamp.
677 if ( !fgets( buf
, 4096, fptr
) ) {
678 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading archive time stamp failed." ), i18n("Index File Error") );
681 int archiveTimeStamp
= atoi( buf
);
683 // Read archive start block.
684 if ( !fgets( buf
, 4096, fptr
) ) {
685 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading archive start block failed." ), i18n("Index File Error") );
688 int archiveStartBlock
= atoi( buf
);
690 // Read archive end block.
691 if ( !fgets( buf
, 4096, fptr
) ) {
692 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading archive end block failed." ), i18n("Index File Error") );
695 int archiveEndBlock
= atoi( buf
);
697 // Create the archive.
698 Archive
* archive
= new Archive( this, archiveTimeStamp
, archiveName
);
699 archive
->setEndBlock( archiveEndBlock
- archiveStartBlock
);
701 _children
.append( archive
);
703 // Read the number of files.
704 if ( !fgets( buf
, 4096, fptr
) ) {
705 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading archive file count failed." ), i18n("Index File Error") );
708 int archiveNumFiles
= atoi( buf
);
711 int tmpFileSize
= -1;
712 int tmpFileMTime
= -1;
713 int tmpFileStartRecord
= -1;
714 for ( ; archiveNumFiles
; archiveNumFiles
-- ) {
716 if ( !fgets( buf
, 4096, fptr
) ) {
717 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading file name failed." ), i18n("Index File Error") );
720 QString fileName
= buf
;
721 fileName
.truncate( fileName
.length() - 1 );
724 if ( !fgets( buf
, 4096, fptr
) ) {
725 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading file size failed." ), i18n("Index File Error") );
728 int fileSize
= atoi( buf
);
730 // Read file modification time.
731 if ( !fgets( buf
, 4096, fptr
) ) {
732 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading file modification time failed." ), i18n("Index File Error") );
735 int fileModTime
= atoi( buf
);
737 // Read file record number.
738 if ( !fgets( buf
, 4096, fptr
) ) {
739 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading file record number failed." ), i18n("Index File Error") );
742 int fileRecord
= atoi( buf
);
744 if ( tmpFileName
.length() > 0 ) {
745 archive
->addFile( tmpFileSize
, tmpFileMTime
, tmpFileStartRecord
, fileRecord
, tmpFileName
);
748 tmpFileName
= fileName
.copy();
749 tmpFileSize
= fileSize
;
750 tmpFileMTime
= fileModTime
;
751 tmpFileStartRecord
= fileRecord
;
754 if ( tmpFileName
.length() > 0 ) {
755 archive
->addFile( tmpFileSize
, tmpFileMTime
, tmpFileStartRecord
, archive
->getEndBlock() * ( Options::instance()->getTapeBlockSize() / 512 ), tmpFileName
);
760 void Tape::readVersion2Index( FILE* fptr
)
762 fseek( fptr
, 0, SEEK_CUR
);
767 if ( !fgets( buf
, 4096, fptr
) ) {
768 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading tape ID failed." ), i18n("Index File Error") );
771 QByteArray tapeID
= buf
;
772 tapeID
.truncate( tapeID
.length() - 1 );
773 if ( tapeID
!= _id
) {
774 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Tape ID on tape does not match tape ID in index file." ), i18n("Index File Error") );
778 // Read creation time.
779 if ( !fgets( buf
, 4096, fptr
) ) {
780 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading creation time failed." ), i18n("Index File Error") );
783 _ctime
= atoi( buf
);
785 // Read modification time.
786 if ( !fgets( buf
, 4096, fptr
) ) {
787 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading modification time failed." ), i18n("Index File Error") );
790 _mtime
= atoi( buf
);
793 if ( !fgets( buf
, 4096, fptr
) ) {
794 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading tape name failed." ), i18n("Index File Error") );
798 _name
.truncate( _name
.length() - 1 );
801 if ( !fgets( buf
, 4096, fptr
) ) {
802 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading tape size failed." ), i18n("Index File Error") );
807 // Read number of archives.
808 if ( !fgets( buf
, 4096, fptr
) ) {
809 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading archive count failed." ), i18n("Index File Error") );
812 int numArchives
= atoi( buf
);
815 for ( ; numArchives
; numArchives
-- ) {
816 fread( &ival
, sizeof( ival
), 1, fptr
);
817 _children
.append( new Archive( this, fptr
, ival
) );
821 void Tape::readVersion3Index( FILE* fptr
)
823 fseek( fptr
, 0, SEEK_CUR
);
829 if ( !fgets( buf
, 4096, fptr
) ) {
830 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading tape ID failed." ), i18n("Index File Error") );
833 QByteArray tapeID
= buf
;
834 tapeID
.truncate( tapeID
.length() - 1 );
835 if ( tapeID
!= _id
) {
836 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Tape ID on tape does not match tape ID in index file." ), i18n("Index File Error") );
840 // Read creation time.
841 fread( &_ctime
, sizeof( _ctime
), 1, fptr
);
843 // Read modification time.
844 fread( &_mtime
, sizeof( _mtime
), 1, fptr
);
847 fread( &_size
, sizeof( _size
), 1, fptr
);
850 fread( buf
, sizeof( char ), 4096, fptr
);
853 // Read number of archives.
855 fread( &numArchives
, sizeof( numArchives
), 1, fptr
);
858 for ( ; numArchives
; numArchives
-- ) {
859 fread( &ival
, sizeof( ival
), 1, fptr
);
860 _children
.append( new Archive( this, fptr
, ival
) );
864 void Tape::readVersion4Index( FILE* fptr
)
866 fseek( fptr
, 0, SEEK_CUR
);
872 if ( !fgets( buf
, 4096, fptr
) ) {
873 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Reading tape ID failed." ), i18n("Index File Error") );
876 QByteArray tapeID
= buf
;
877 tapeID
.truncate( tapeID
.length() - 1 );
878 if ( tapeID
!= _id
) {
879 KMessageBox::error( KDatMainWindow::getInstance(), i18n( "Tape ID on tape does not match tape ID in index file." ), i18n("Index File Error") );
883 // Read creation time.
884 fread( &_ctime
, sizeof( _ctime
), 1, fptr
);
886 // Read modification time.
887 fread( &_mtime
, sizeof( _mtime
), 1, fptr
);
890 fread( &_size
, sizeof( _size
), 1, fptr
);
893 fread( buf
, sizeof( char ), 4096, fptr
);
896 // Read number of archives.
898 fread( &numArchives
, sizeof( numArchives
), 1, fptr
);
901 for ( ; numArchives
; numArchives
-- ) {
902 fread( &ival
, sizeof( ival
), 1, fptr
);
903 _children
.append( new Archive( this, fptr
, ival
) );
908 printf("Read contents of archive file \"%s\". %s %d\n",
909 _name
.toLatin1(), __FILE__
, __LINE__
);
914 void Tape::calcRanges()
916 Q3PtrListIterator
<Archive
> it( getChildren() );
917 for ( ; it
.current(); ++it
) {
918 it
.current()->calcRanges();