From kde-core-devel Tue Dec 10 14:32:31 2002 From: Nicolas Goutte Date: Tue, 10 Dec 2002 14:32:31 +0000 To: kde-core-devel Subject: Re: KZip: cannot read small ZIP files X-MARC-Message: https://marc.info/?l=kde-core-devel&m=103953088927686 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--------------Boundary-00=_72RWHE5ZNBQ9HW4SZ3KD" --------------Boundary-00=_72RWHE5ZNBQ9HW4SZ3KD Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Attached is a patch for the file kdelibs/kio/kio/kzip.cpp (for KDE_3_1_BR= ANCH) The patch solves the problem that some files created by zip could not be=20 opened. It also changes three similar kdWarnings to separate one from the= =20 other. The problem was that a test used a boolean and (&&) instead of a bit-wise= and=20 (&) I cannot test if OpenOffice's ZIP files are still read correctly after th= is=20 patch. I can commit the patch to the KDE_3_1_BRANCH but somebody should port it = to=20 HEAD please. Thank you in advance! Have a nice day/evening/night! --------------Boundary-00=_72RWHE5ZNBQ9HW4SZ3KD Content-Type: text/plain; charset="us-ascii"; name="patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="patch.txt" Index: kzip.cpp =================================================================== RCS file: /home/kde/kdelibs/kio/kio/kzip.cpp,v retrieving revision 1.20 diff -u -r1.20 kzip.cpp --- kzip.cpp 19 Nov 2002 12:08:27 -0000 1.20 +++ kzip.cpp 10 Dec 2002 14:25:50 -0000 @@ -172,7 +172,7 @@ if (n < 4) { - kdWarning(7040) << "Invalid ZIP file. Unexpected end of file." << endl; + kdWarning(7040) << "Invalid ZIP file. Unexpected end of file. (#1)" << endl; return false; } @@ -189,7 +189,7 @@ // the file and we look for the signature 'PK\7\8'. dev->readBlock( buffer, 2 ); - if ( buffer[0] && 8 ) + if ( buffer[0] & 8 ) { bool foundSignature = false; @@ -198,7 +198,7 @@ n = dev->readBlock( buffer, 1 ); if (n < 1) { - kdWarning(7040) << "Invalid ZIP file. Unexpected end of file." << endl; + kdWarning(7040) << "Invalid ZIP file. Unexpected end of file. (#2)" << endl; return false; } @@ -208,7 +208,7 @@ n = dev->readBlock( buffer, 3 ); if (n < 3) { - kdWarning(7040) << "Invalid ZIP file. Unexpected end of file." << endl; + kdWarning(7040) << "Invalid ZIP file. Unexpected end of file. (#3)" << endl; return false; } --------------Boundary-00=_72RWHE5ZNBQ9HW4SZ3KD--