Commit 2faa3797 authored by Fathi Boudra's avatar Fathi Boudra
Browse files

SVN_SILENT

apply kdelibs astyle script from kdesdk
parent 5ef6ec1f
This diff is collapsed.
......@@ -15,9 +15,9 @@
* *
***************************************************************************/
/* This file is heavily based on tar.h from kdebase
* (c) David Faure <faure@kde.org>
*/
/* This file is heavily based on tar.h from kdebase
* (c) David Faure <faure@kde.org>
*/
#ifndef ISO_H
#define ISO_H
......@@ -34,18 +34,18 @@ class KIso;
class kio_isoProtocol : public KIO::SlaveBase
{
public:
kio_isoProtocol( const QByteArray &pool, const QByteArray &app );
kio_isoProtocol(const QByteArray &pool, const QByteArray &app);
virtual ~kio_isoProtocol();
virtual void listDir( const KUrl & url );
virtual void stat( const KUrl & url );
virtual void get( const KUrl & url );
virtual void listDir(const KUrl & url);
virtual void stat(const KUrl & url);
virtual void get(const KUrl & url);
protected:
void getFile( const KIsoFile *isoFileEntry, const QString &path );
void createUDSEntry( const KArchiveEntry * isoEntry, KIO::UDSEntry & entry );
bool checkNewFile( QString fullPath, QString & path, int startsec );
QString getPath( const KUrl & url );
void getFile(const KIsoFile *isoFileEntry, const QString &path);
void createUDSEntry(const KArchiveEntry * isoEntry, KIO::UDSEntry & entry);
bool checkNewFile(QString fullPath, QString & path, int startsec);
QString getPath(const KUrl & url);
KIso * m_isoFile;
time_t m_mtime;
......
This diff is collapsed.
......@@ -15,9 +15,9 @@
* *
***************************************************************************/
/* This file is heavily based on ktar.h from kdelibs
* (c) Torben Weis <weis@kde.org>, David Faure <faure@kde.org>
*/
/* This file is heavily based on ktar.h from kdelibs
* (c) Torben Weis <weis@kde.org>, David Faure <faure@kde.org>
*/
#ifndef KISO_H
#define KISO_H
......@@ -49,7 +49,7 @@ public:
* Do not use application/x-tgz or so. Only the compression layer !
* If the mimetype is omitted, it will be determined from the filename.
*/
KIso( const QString& filename, const QString & mimetype = QString() );
KIso(const QString& filename, const QString & mimetype = QString());
/**
* Creates an instance that operates on the given device.
......@@ -57,7 +57,7 @@ public:
* WARNING: don't assume that giving a QFile here will decompress the file,
* in case it's compressed!
*/
KIso( QIODevice * dev );
KIso(QIODevice * dev);
/**
* If the .iso is still opened, then it will be
......@@ -69,18 +69,24 @@ public:
* The name of the os file, as passed to the constructor
* Null if you used the QIODevice constructor.
*/
QString fileName() { return m_filename; }
bool writeDir( const QString& , const QString& , const QString&, mode_t, time_t, time_t, time_t );
bool writeSymLink(const QString &, const QString &, const QString &, const QString &, mode_t, time_t, time_t, time_t );
bool prepareWriting( const QString& , const QString& , const QString& , qint64, mode_t, time_t, time_t, time_t );
bool finishWriting( qint64 );
void setStartSec(int startsec) { m_startsec = startsec; }
int startSec() { return m_startsec; }
bool showhidden,showrr;
int level,joliet;
QString fileName() {
return m_filename;
}
bool writeDir(const QString& , const QString& , const QString&, mode_t, time_t, time_t, time_t);
bool writeSymLink(const QString &, const QString &, const QString &, const QString &, mode_t, time_t, time_t, time_t);
bool prepareWriting(const QString& , const QString& , const QString& , qint64, mode_t, time_t, time_t, time_t);
bool finishWriting(qint64);
void setStartSec(int startsec) {
m_startsec = startsec;
}
int startSec() {
return m_startsec;
}
bool showhidden, showrr;
int level, joliet;
KIsoDirectory *dirent;
protected:
/**
......@@ -90,25 +96,25 @@ protected:
*
*/
void readParams();
virtual bool openArchive( QIODevice::OpenMode mode );
virtual bool openArchive(QIODevice::OpenMode mode);
virtual bool closeArchive();
virtual bool doWriteDir( const QString&, const QString&, const QString&, mode_t, time_t, time_t, time_t );
virtual bool doWriteSymLink(const QString &, const QString &, const QString &, const QString &, mode_t, time_t, time_t, time_t );
virtual bool doPrepareWriting( const QString& , const QString& , const QString& , qint64, mode_t, time_t, time_t, time_t );
virtual bool doFinishWriting( qint64 );
virtual bool doWriteDir(const QString&, const QString&, const QString&, mode_t, time_t, time_t, time_t);
virtual bool doWriteSymLink(const QString &, const QString &, const QString &, const QString &, mode_t, time_t, time_t, time_t);
virtual bool doPrepareWriting(const QString& , const QString& , const QString& , qint64, mode_t, time_t, time_t, time_t);
virtual bool doFinishWriting(qint64);
private:
/**
* @internal
*/
void addBoot(struct el_torito_boot_descriptor* bootdesc);
void prepareDevice( const QString & filename, const QString & mimetype, bool forced = false );
void prepareDevice(const QString & filename, const QString & mimetype, bool forced = false);
int m_startsec;
QString m_filename;
protected:
virtual void virtual_hook( int id, void* data );
virtual void virtual_hook(int id, void* data);
private:
class KIsoPrivate;
......
......@@ -17,15 +17,17 @@
#include "kisodirectory.h"
KIsoDirectory::KIsoDirectory( KArchive* archive, const QString& name, int access,
int date, int adate, int cdate, const QString& user, const QString& group,
const QString& symlink) :
KArchiveDirectory(archive, name, access, date, user, group, symlink) {
KIsoDirectory::KIsoDirectory(KArchive* archive, const QString& name, int access,
int date, int adate, int cdate, const QString& user, const QString& group,
const QString& symlink) :
KArchiveDirectory(archive, name, access, date, user, group, symlink)
{
m_adate=adate;
m_cdate=cdate;
m_adate = adate;
m_cdate = cdate;
}
KIsoDirectory::~KIsoDirectory(){
KIsoDirectory::~KIsoDirectory()
{
}
......@@ -25,14 +25,19 @@
*@author Szombathelyi Gyrgy
*/
class KIsoDirectory : public KArchiveDirectory {
public:
KIsoDirectory( KArchive* archive, const QString& name, int access, int date,
int adate,int cdate, const QString& user, const QString& group,
const QString& symlink);
class KIsoDirectory : public KArchiveDirectory
{
public:
KIsoDirectory(KArchive* archive, const QString& name, int access, int date,
int adate, int cdate, const QString& user, const QString& group,
const QString& symlink);
~KIsoDirectory();
int adate() const { return m_adate; }
int cdate() const { return m_cdate; }
int adate() const {
return m_adate;
}
int cdate() const {
return m_cdate;
}
private:
int m_adate, m_cdate;
};
......
......@@ -18,36 +18,39 @@
#include "kisofile.h"
#include <kdebug.h>
KIsoFile::KIsoFile( KArchive* archive, const QString& name, int access,
int date, int adate,int cdate, const QString& user, const QString& group,
const QString& symlink,long long pos, long long size) :
KArchiveFile(archive, name, access, date, user, group, symlink, pos, size) {
KIsoFile::KIsoFile(KArchive* archive, const QString& name, int access,
int date, int adate, int cdate, const QString& user, const QString& group,
const QString& symlink, long long pos, long long size) :
KArchiveFile(archive, name, access, date, user, group, symlink, pos, size)
{
m_adate=adate;
m_cdate=cdate;
m_algo[0]=0;m_algo[1]=0;m_parms[0]=0;m_parms[1]=0;m_realsize=0;
m_adate = adate;
m_cdate = cdate;
m_algo[0] = 0;m_algo[1] = 0;m_parms[0] = 0;m_parms[1] = 0;m_realsize = 0;
}
KIsoFile::~KIsoFile(){
KIsoFile::~KIsoFile()
{
}
void KIsoFile::setZF(char algo[2],char parms[2],long long realsize) {
m_algo[0]=algo[0];m_algo[1]=algo[1];
m_parms[0]=parms[0];m_parms[1]=parms[1];
m_realsize=realsize;
void KIsoFile::setZF(char algo[2], char parms[2], long long realsize)
{
m_algo[0] = algo[0];m_algo[1] = algo[1];
m_parms[0] = parms[0];m_parms[1] = parms[1];
m_realsize = realsize;
}
QByteArray KIsoFile::data(long long pos, int count) const {
QByteArray KIsoFile::data(long long pos, int count) const
{
QByteArray r;
int rlen;
if ( archive()->device()->seek(position()+pos) ) {
r.resize( ((pos+count) < size()) ? count : size()-pos);
if( r.size() )
{
rlen=archive()->device()->read( r.data(), r.size() );
if (rlen ==- 1) r.resize(0);
if (archive()->device()->seek(position() + pos)) {
r.resize(((pos + count) < size()) ? count : size() - pos);
if (r.size()) {
rlen = archive()->device()->read(r.data(), r.size());
if (rlen == - 1) r.resize(0);
else if (rlen != (int)r.size()) r.resize(rlen);
}
}
......
......@@ -25,22 +25,29 @@
*@author Szombathelyi Gy�gy
*/
class KIsoFile : public KArchiveFile {
public:
KIsoFile( KArchive* archive, const QString& name, int access, int date,
int adate,int cdate, const QString& user, const QString& group,
const QString& symlink, long long pos, long long size);
class KIsoFile : public KArchiveFile
{
public:
KIsoFile(KArchive* archive, const QString& name, int access, int date,
int adate, int cdate, const QString& user, const QString& group,
const QString& symlink, long long pos, long long size);
~KIsoFile();
void setZF(char algo[2],char parms[2],long long realsize);
int adate() const { return m_adate; }
int cdate() const { return m_cdate; }
long long realsize() const { return m_realsize; }
void setZF(char algo[2], char parms[2], long long realsize);
int adate() const {
return m_adate;
}
int cdate() const {
return m_cdate;
}
long long realsize() const {
return m_realsize;
}
virtual QByteArray data(long long pos, int count) const;
private:
/* hide this member function, it's broken by design, because the full
data often requires too much memory */
char m_algo[2],m_parms[2];
char m_algo[2], m_parms[2];
long long m_realsize;
int m_adate, m_cdate;
long long m_curpos;
......
......@@ -16,9 +16,9 @@
#ifdef ARCH_X86
inline static unsigned short ByteSwap16(unsigned short x)
{
__asm("xchgb %b0,%h0" :
"=q" (x) :
"0" (x));
__asm("xchgb %b0,%h0" :
"=q"(x) :
"0"(x));
return x;
}
#define bswap_16(x) ByteSwap16(x)
......@@ -26,51 +26,52 @@ inline static unsigned short ByteSwap16(unsigned short x)
inline static unsigned int ByteSwap32(unsigned int x)
{
#if __CPU__ > 386
__asm("bswap %0":
"=r" (x) :
__asm("bswap %0":
"=r"(x) :
#else
__asm("xchgb %b0,%h0\n"
" rorl $16,%0\n"
" xchgb %b0,%h0":
"=q" (x) :
__asm("xchgb %b0,%h0\n"
" rorl $16,%0\n"
" xchgb %b0,%h0":
"=q"(x) :
#endif
"0" (x));
return x;
}
"0"(x));
return x;
}
#define bswap_32(x) ByteSwap32(x)
inline static unsigned long long int ByteSwap64(unsigned long long int x)
inline static unsigned long long int ByteSwap64(unsigned long long int x)
{
register union { __extension__ unsigned long long int __ll;
unsigned int __l[2]; } __x;
asm("xchgl %0,%1":
"=r"(__x.__l[0]),"=r"(__x.__l[1]):
"0"(bswap_32((unsigned long)x)),"1"(bswap_32((unsigned long)(x>>32))));
return __x.__ll;
register union { __extension__ unsigned long long int __ll;
unsigned int __l[2];
} __x;
asm("xchgl %0,%1":
"=r"(__x.__l[0]), "=r"(__x.__l[1]):
"0"(bswap_32((unsigned long)x)), "1"(bswap_32((unsigned long)(x >> 32))));
return __x.__ll;
}
#define bswap_64(x) ByteSwap64(x)
#else
#define bswap_16(x) (((x) & 0x00ff) << 8 | ((x) & 0xff00) >> 8)
/* code from bits/byteswap.h (C) 1997, 1998 Free Software Foundation, Inc. */
#define bswap_32(x) \
((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
#define bswap_64(x) \
(__extension__ \
({ union { __extension__ unsigned long long int __ll; \
unsigned int __l[2]; } __w, __r; \
__w.__ll = (x); \
__r.__l[0] = bswap_32 (__w.__l[1]); \
__r.__l[1] = bswap_32 (__w.__l[0]); \
__r.__ll; }))
#endif /* !ARCH_X86 */
(__extension__ \
({ union { __extension__ unsigned long long int __ll; \
unsigned int __l[2]; } __w, __r; \
__w.__ll = (x); \
__r.__l[0] = bswap_32 (__w.__l[1]); \
__r.__l[1] = bswap_32 (__w.__l[0]); \
__r.__ll; }))
#endif /* !ARCH_X86 */
#endif /* !HAVE_BYTESWAP_H */
#endif /* !HAVE_BYTESWAP_H */
/*
be2me ... BigEndian to MachineEndian
......
......@@ -6,58 +6,58 @@
#define EL_TORITO_ID "EL TORITO SPECIFICATION\0\0\0\0\0\0\0\0\0"
struct el_torito_boot_descriptor {
char type [ISODCL ( 1, 1)]; /* 711 */
char id [ISODCL ( 2, 6)];
char version [ISODCL ( 7, 7)]; /* 711 */
char system_id [ISODCL ( 8, 39)]; /* achars */
char unused [ISODCL ( 40, 71)];
char boot_catalog [ISODCL ( 72, 75)]; /* 731 */
char type [ISODCL(1, 1)]; /* 711 */
char id [ISODCL(2, 6)];
char version [ISODCL(7, 7)]; /* 711 */
char system_id [ISODCL(8, 39)]; /* achars */
char unused [ISODCL(40, 71)];
char boot_catalog [ISODCL(72, 75)]; /* 731 */
};
struct validation_entry {
char type [ISODCL ( 1, 1)]; /* 1 */
char platform [ISODCL ( 2, 2)];
char unused [ISODCL ( 3, 4)];
char id [ISODCL ( 5, 28)];
char cheksum [ISODCL ( 29, 30)];
char key [ISODCL ( 31, 31)]; /* 0x55 */
char key2 [ISODCL ( 32, 32)]; /* 0xaa */
};
char type [ISODCL(1, 1)]; /* 1 */
char platform [ISODCL(2, 2)];
char unused [ISODCL(3, 4)];
char id [ISODCL(5, 28)];
char cheksum [ISODCL(29, 30)];
char key [ISODCL(31, 31)]; /* 0x55 */
char key2 [ISODCL(32, 32)]; /* 0xaa */
};
struct default_entry {
char bootid [ISODCL ( 1, 1)];
char media [ISODCL ( 2, 2)];
char loadseg [ISODCL ( 3, 4)];
char systype [ISODCL ( 5, 5)];
char unused [ISODCL ( 6, 6)];
char seccount [ISODCL ( 7, 8)];
char start [ISODCL ( 9, 12)];
char unused2 [ISODCL ( 13, 32)];
char bootid [ISODCL(1, 1)];
char media [ISODCL(2, 2)];
char loadseg [ISODCL(3, 4)];
char systype [ISODCL(5, 5)];
char unused [ISODCL(6, 6)];
char seccount [ISODCL(7, 8)];
char start [ISODCL(9, 12)];
char unused2 [ISODCL(13, 32)];
};
struct section_header {
char headerid [ISODCL ( 1, 1)];
char platform [ISODCL ( 2, 2)];
char entries [ISODCL ( 3, 4)];
char id [ISODCL ( 5, 32)];
char headerid [ISODCL(1, 1)];
char platform [ISODCL(2, 2)];
char entries [ISODCL(3, 4)];
char id [ISODCL(5, 32)];
};
struct section_entry {
char bootid [ISODCL ( 1, 1)];
char media [ISODCL ( 2, 2)];
char loadseg [ISODCL ( 3, 4)];
char systype [ISODCL ( 5, 5)];
char unused [ISODCL ( 6, 6)];
char seccount [ISODCL ( 7, 8)];
char start [ISODCL ( 9, 12)];
char selcrit [ISODCL ( 13, 13)];
char vendor_selcrit [ISODCL ( 14, 32)];
char bootid [ISODCL(1, 1)];
char media [ISODCL(2, 2)];
char loadseg [ISODCL(3, 4)];
char systype [ISODCL(5, 5)];
char unused [ISODCL(6, 6)];
char seccount [ISODCL(7, 8)];
char start [ISODCL(9, 12)];
char selcrit [ISODCL(13, 13)];
char vendor_selcrit [ISODCL(14, 32)];
};
struct section_entry_ext {
char extid [ISODCL ( 1, 1)];
char extrec [ISODCL ( 2, 2)];
char vendor_selcrit [ISODCL ( 3, 32)];
char extid [ISODCL(1, 1)];
char extrec [ISODCL(2, 2)];
char vendor_selcrit [ISODCL(3, 32)];
};
#endif
......@@ -27,10 +27,10 @@
#define ISODCL(from, to) (to - from + 1)
struct iso_volume_descriptor {
char type[ISODCL(1,1)]; /* 711 */
char id[ISODCL(2,6)];
char version[ISODCL(7,7)];
char data[ISODCL(8,2048)];
char type[ISODCL(1,1)]; /* 711 */
char id[ISODCL(2,6)];
char version[ISODCL(7,7)];
char data[ISODCL(8,2048)];
};
/* volume descriptor types */
......@@ -42,134 +42,134 @@ struct iso_volume_descriptor {
#define ISO_STANDARD_ID "CD001"
struct iso_primary_descriptor {
char type [ISODCL ( 1, 1)]; /* 711 */
char id [ISODCL ( 2, 6)];
char version [ISODCL ( 7, 7)]; /* 711 */
char unused1 [ISODCL ( 8, 8)];
char system_id [ISODCL ( 9, 40)]; /* achars */
char volume_id [ISODCL ( 41, 72)]; /* dchars */
char unused2 [ISODCL ( 73, 80)];
char volume_space_size [ISODCL ( 81, 88)]; /* 733 */
char unused3 [ISODCL ( 89, 120)];
char volume_set_size [ISODCL (121, 124)]; /* 723 */
char volume_sequence_number [ISODCL (125, 128)]; /* 723 */
char logical_block_size [ISODCL (129, 132)]; /* 723 */
char path_table_size [ISODCL (133, 140)]; /* 733 */
char type_l_path_table [ISODCL (141, 144)]; /* 731 */
char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */
char type_m_path_table [ISODCL (149, 152)]; /* 732 */
char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */
char root_directory_record [ISODCL (157, 190)]; /* 9.1 */
char volume_set_id [ISODCL (191, 318)]; /* dchars */
char publisher_id [ISODCL (319, 446)]; /* achars */
char preparer_id [ISODCL (447, 574)]; /* achars */
char application_id [ISODCL (575, 702)]; /* achars */
char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */
char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */
char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */
char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */
char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */
char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */
char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */
char file_structure_version [ISODCL (882, 882)]; /* 711 */
char unused4 [ISODCL (883, 883)];
char application_data [ISODCL (884, 1395)];
char unused5 [ISODCL (1396, 2048)];
char type [ISODCL(1, 1)]; /* 711 */
char id [ISODCL(2, 6)];
char version [ISODCL(7, 7)]; /* 711 */
char unused1 [ISODCL(8, 8)];
char system_id [ISODCL(9, 40)]; /* achars */
char volume_id [ISODCL(41, 72)]; /* dchars */
char unused2 [ISODCL(73, 80)];
char volume_space_size [ISODCL(81, 88)]; /* 733 */
char unused3 [ISODCL(89, 120)];
char volume_set_size [ISODCL(121, 124)]; /* 723 */
char volume_sequence_number [ISODCL(125, 128)]; /* 723 */
char logical_block_size [ISODCL(129, 132)]; /* 723 */
char path_table_size [ISODCL(133, 140)]; /* 733 */
char type_l_path_table [ISODCL(141, 144)]; /* 731 */
char opt_type_l_path_table [ISODCL(145, 148)]; /* 731 */
char type_m_path_table [ISODCL(149, 152)]; /* 732 */
char opt_type_m_path_table [ISODCL(153, 156)]; /* 732 */
char root_directory_record [ISODCL(157, 190)]; /* 9.1 */
char volume_set_id [ISODCL(191, 318)]; /* dchars */
char publisher_id [ISODCL(319, 446)]; /* achars */
char preparer_id [ISODCL(447, 574)]; /* achars */
char application_id [ISODCL(575, 702)]; /* achars */