+ Reply to Thread
Results 1 to 12 of 12

Thread: Qt Wrapper for bzip2

  1. #1
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    198
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Post Qt Wrapper for bzip2

    Who have Qt Wrapper for bzip2 ?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,368
    Thanks
    19
    Thanked 992 Times in 903 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Qt Wrapper for bzip2

    have a look at QuaZIP.

  3. #3
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    198
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Unhappy Re: Qt Wrapper for bzip2

    that just for zip. And for unzip is very slow on Linux.

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,368
    Thanks
    19
    Thanked 992 Times in 903 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Qt Wrapper for bzip2

    Quote Originally Posted by wirasto View Post
    that just for zip. And for unzip is very slow on Linux.
    Well it uses the zlib library which is standard at Linux (Used by Apache, dpkg, git, Subversion, OpenSSL and may more...). And the speed is just fine for me but if you disagree then grab the C sources of bzip and go ahead coding your own wrapper.

  5. #5
    Join Date
    Sep 2009
    Location
    Tashkent, Uzbekistan
    Posts
    107
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt Wrapper for bzip2

    Sorry Lykurg, but you are wrong. ZLib and BZip2 are different algorithms and uses different libraries.
    Wirasto, as far as I know there is no BZip2 wrapper for Qt. But you can use zlib wrapper as a pattern or take bzip2 source code and reimplement the algorithm as Qt class by yourself. The only question - please share that I think a lot of people will appreciate that.

    Regards,
    -- tanuki

  6. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 346 Times in 332 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Wrapper for bzip2

    I think Lykurg meant "Use ZIP which does have a Qt wrapper and used in many programs, or write your own wrapper for bzip". Heck, you could probably use most of the wrapper of zip for bzip, as they share a lot in common (apart from the obvious things like the actual algorithm, which will be in a seperate library anyway)

  7. #7
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    198
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question Re: Qt Wrapper for bzip2

    this code form QuaZIP unzip sample

    Qt Code:
    1. // Slow like hell (on GNU/Linux at least), but it is not my fault.
    2. // Not ZIP/UNZIP package's fault either.
    3. // The slowest thing here is out.putChar(c).
    4. while(file.getChar(&c)) out.putChar(c);
    To copy to clipboard, switch view to plain text mode 

    How to change that code with Qt function ?

  8. #8
    Join Date
    Sep 2009
    Location
    Tashkent, Uzbekistan
    Posts
    107
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt Wrapper for bzip2

    How to change that code with Qt function ?
    Use QByteArray and block operations.

  9. #9
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 346 Times in 332 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Wrapper for bzip2

    Quote Originally Posted by wirasto View Post
    Qt Code:
    1. while(file.getChar(&c)) out.putChar(c);
    To copy to clipboard, switch view to plain text mode 

    How to change that code with Qt function ?
    First thing I'd say is: WHY is it written like that? The comment seems to imply there was no alternative, which I find suprising. Are 'file' and 'out' internal classes for some reason? In which case you probably can't change it easily. If it's standard i/o however, then I'd find the end and read it in blocks which would be MUCH faster.

    I'd probably use:
    QByteArray QIODevice::read ( qint64 maxSize )
    write ( const QByteArray & byteArray )

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    31,811
    Thanks
    3
    Thanked 4,772 Times in 4,570 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Blog Entries
    4
    Wiki edits
    10

    Default Re: Qt Wrapper for bzip2

    I'm assuming "file" is a zip device and there is a chance it needs to be read byte by byte. In that case the only thing you can do is read byte by byte but then write block by block. If "out" is a zip device then of course you need to reverse what I've written here (i.e. read block by block and write byte by byte).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    198
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question Re: Qt Wrapper for bzip2

    Read byte by byte and write block by block ? I don't get what is your mean. Can you give me a sample code how to do that ?

  12. #12
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 346 Times in 332 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Wrapper for bzip2

    Read into a QByteArray, and then write() that entire byte array when the size is >= a certain amount.

+ Reply to Thread

Similar Threads

  1. Randomized Encryption Wrapper
    By wswartzendruber in forum Qt Programming
    Replies: 0
    Last Post: 27th July 2009, 15:26
  2. Installing a wrapper.
    By afflictedd2 in forum Installation and Deployment
    Replies: 3
    Last Post: 17th February 2009, 18:28
  3. wrapper of methods
    By mickey in forum General Programming
    Replies: 8
    Last Post: 15th August 2008, 16:33
  4. very simple and basic FAM/Gamin wrapper for qt
    By momesana in forum Qt-based Software
    Replies: 0
    Last Post: 8th April 2008, 13:46
  5. V4L Qt wrapper
    By scarvenger in forum Qt Programming
    Replies: 1
    Last Post: 6th May 2007, 16:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts