2000-11-13 06:38:03 -06:00
/*************************************************************************
*
* $ RCSfile : ZipFile . cxx , v $
*
2000-12-13 10:00:47 -06:00
* $ Revision : 1.13 $
2000-11-13 06:38:03 -06:00
*
2000-12-13 10:00:47 -06:00
* last change : $ Author : mtg $ $ Date : 2000 - 12 - 13 17 : 00 : 43 $
2000-11-13 06:38:03 -06:00
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc . , October , 2000
*
* GNU Lesser General Public License Version 2.1
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* Copyright 2000 by Sun Microsystems , Inc .
* 901 San Antonio Road , Palo Alto , CA 94303 , USA
*
* This library is free software ; you can redistribute it and / or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1 , as published by the Free Software Foundation .
*
* This library is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* Lesser General Public License for more details .
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library ; if not , write to the Free Software
* Foundation , Inc . , 59 Temple Place , Suite 330 , Boston ,
* MA 02111 - 1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 ( the " License " ) ; You may not use this file
* except in compliance with the License . You may obtain a copy of the
* License at http : //www.openoffice.org/license.html.
*
* Software provided under this License is provided on an " AS IS " basis ,
* WITHOUT WARRANTY OF ANY KIND , EITHER EXPRESSED OR IMPLIED , INCLUDING ,
* WITHOUT LIMITATION , WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS ,
* MERCHANTABLE , FIT FOR A PARTICULAR PURPOSE , OR NON - INFRINGING .
* See the License for the specific provisions governing your rights and
* obligations concerning the Software .
*
* The Initial Developer of the Original Code is : Sun Microsystems , Inc .
*
* Copyright : 2000 by Sun Microsystems , Inc .
*
* All Rights Reserved .
*
* Contributor ( s ) : _______________________________________
*
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# ifndef _ZIP_FILE_HXX
# include "ZipFile.hxx"
# endif
using namespace rtl ;
using namespace com : : sun : : star ;
using namespace com : : sun : : star : : package : : ZipConstants ;
/** This class is used to read entries from a zip file
*/
ZipFile : : ZipFile ( uno : : Reference < io : : XInputStream > & xInput )
2000-12-04 04:30:09 -06:00
throw ( io : : IOException , package : : ZipException , uno : : RuntimeException )
2000-11-13 06:38:03 -06:00
: xStream ( xInput )
, aGrabber ( xInput )
{
readCEN ( ) ;
}
2000-12-13 10:00:47 -06:00
ZipFile : : ZipFile ( uno : : Reference < io : : XInputStream > & xInput , sal_Bool bInitialise )
2000-12-04 04:30:09 -06:00
throw ( io : : IOException , package : : ZipException , uno : : RuntimeException )
: xStream ( xInput )
, aGrabber ( xInput )
{
if ( bInitialise )
readCEN ( ) ;
}
2000-12-13 10:00:47 -06:00
void ZipFile : : setInputStream ( uno : : Reference < io : : XInputStream > xNewStream )
{
xStream = xNewStream ;
aGrabber . setInputStream ( xStream ) ;
}
2000-11-28 20:21:56 -06:00
void ZipFile : : updateFromManList ( std : : vector < ManifestEntry * > & rManList )
{
sal_Int32 i = 0 , nSize = rManList . size ( ) ;
aEntries . clear ( ) ;
2000-12-13 10:00:47 -06:00
package : : ZipEntry * pEntry = & rManList [ i ] - > aEntry ;
2000-11-28 20:21:56 -06:00
for ( ; i < nSize ; i + + )
{
2000-12-13 10:00:47 -06:00
// This is a bitwise copy, = is not an overloaded operator
// I'm not sure how evil this is in this case...
aEntries [ pEntry - > sName ] = * pEntry ; //rManList[i]->aEntry;
/*
2000-11-28 20:21:56 -06:00
package : : ZipEntry * pEntry = new package : : ZipEntry ;
2000-12-13 10:00:47 -06:00
pEntry - > nVersion = rManList [ i ] - > aEntry . nVersion ;
pEntry - > nFlag = rManList [ i ] - > aEntry . nFlag ;
pEntry - > nMethod = rManList [ i ] - > aEntry . nMethod ;
pEntry - > nTime = rManList [ i ] - > aEntry . nTime ;
pEntry - > nCrc = rManList [ i ] - > aEntry . nCrc ;
pEntry - > nCompressedSize = rManList [ i ] - > aEntry . nCompressedSize ;
pEntry - > nSize = rManList [ i ] - > aEntry . nSize ;
pEntry - > nOffset = rManList [ i ] - > aEntry . nOffset ;
pEntry - > sName = rManList [ i ] - > aEntry . sName ;
pEntry - > extra = rManList [ i ] - > aEntry . extra ;
pEntry - > sComment = rManList [ i ] - > aEntry . sComment ;
2000-11-28 20:21:56 -06:00
aEntries [ pEntry - > sName ] = * pEntry ;
2000-12-13 10:00:47 -06:00
*/
2000-11-28 20:21:56 -06:00
}
}
2000-11-13 06:38:03 -06:00
ZipFile : : ~ ZipFile ( )
{
}
2000-12-04 04:30:09 -06:00
2000-11-24 03:34:27 -06:00
void SAL_CALL ZipFile : : close ( )
throw ( io : : IOException , uno : : RuntimeException )
2000-11-13 06:38:03 -06:00
{
}
2000-11-24 03:34:27 -06:00
uno : : Reference < container : : XEnumeration > SAL_CALL ZipFile : : entries ( )
throw ( uno : : RuntimeException )
2000-11-13 06:38:03 -06:00
{
2000-12-04 04:30:09 -06:00
uno : : Reference < container : : XEnumeration > xEnumRef = new ZipEnumeration ( aEntries ) ;
2000-11-13 06:38:03 -06:00
return xEnumRef ;
}
2000-12-04 04:30:09 -06:00
2000-11-24 03:34:27 -06:00
: : rtl : : OUString SAL_CALL ZipFile : : getName ( )
throw ( uno : : RuntimeException )
2000-11-13 06:38:03 -06:00
{
return sName ;
}
2000-12-04 04:30:09 -06:00
2000-11-24 03:34:27 -06:00
sal_Int32 SAL_CALL ZipFile : : getSize ( )
throw ( uno : : RuntimeException )
2000-11-13 06:38:03 -06:00
{
2000-11-28 20:21:56 -06:00
return aEntries . size ( ) ;
2000-11-13 06:38:03 -06:00
}
2000-11-24 03:34:27 -06:00
uno : : Type SAL_CALL ZipFile : : getElementType ( )
throw ( uno : : RuntimeException )
2000-11-13 06:38:03 -06:00
{
return : : getCppuType ( ( package : : ZipEntry * ) 0 ) ;
}
2000-12-04 04:30:09 -06:00
2000-11-24 03:34:27 -06:00
sal_Bool SAL_CALL ZipFile : : hasElements ( )
throw ( uno : : RuntimeException )
2000-11-13 06:38:03 -06:00
{
2000-11-28 20:21:56 -06:00
return ( aEntries . size ( ) > 0 ) ;
2000-11-13 06:38:03 -06:00
}
2000-11-24 03:34:27 -06:00
uno : : Any SAL_CALL ZipFile : : getByName ( const : : rtl : : OUString & aName )
throw ( container : : NoSuchElementException , lang : : WrappedTargetException , uno : : RuntimeException )
2000-11-13 06:38:03 -06:00
{
uno : : Any aAny ;
2000-11-28 20:21:56 -06:00
if ( ! aEntries . count ( sName ) )
throw container : : NoSuchElementException ( ) ;
EntryHash : : const_iterator aCI = aEntries . find ( sName ) ;
aAny < < = ( * aCI ) . second ;
2000-11-13 06:38:03 -06:00
return aAny ;
}
2000-12-04 04:30:09 -06:00
2000-11-24 03:34:27 -06:00
uno : : Sequence < : : rtl : : OUString > SAL_CALL ZipFile : : getElementNames ( )
throw ( uno : : RuntimeException )
2000-11-13 06:38:03 -06:00
{
2000-11-28 20:21:56 -06:00
sal_uInt32 i = 0 , nSize = aEntries . size ( ) ;
OUString * pNames = new OUString [ aEntries . size ( ) ] ;
for ( EntryHash : : const_iterator aIterator = aEntries . begin ( ) ; aIterator ! = aEntries . end ( ) ; aIterator + + , i + + )
pNames [ i ] = ( * aIterator ) . first ;
return uno : : Sequence < OUString > ( pNames , nSize ) ;
2000-11-13 06:38:03 -06:00
}
2000-12-04 04:30:09 -06:00
2000-11-24 03:34:27 -06:00
sal_Bool SAL_CALL ZipFile : : hasByName ( const : : rtl : : OUString & aName )
throw ( uno : : RuntimeException )
2000-11-13 06:38:03 -06:00
{
2000-11-28 20:21:56 -06:00
return aEntries . count ( aName ) ;
2000-11-13 06:38:03 -06:00
}
2000-12-04 04:30:09 -06:00
2000-11-24 03:34:27 -06:00
uno : : Reference < io : : XInputStream > SAL_CALL ZipFile : : getInputStream ( const package : : ZipEntry & rEntry )
2000-12-13 10:00:47 -06:00
throw ( io : : IOException , package : : ZipException , uno : : RuntimeException )
2000-11-13 06:38:03 -06:00
{
sal_Int64 nEnd = rEntry . nCompressedSize = = 0 ? rEntry . nSize : rEntry . nCompressedSize ;
if ( rEntry . nOffset < = 0 )
readLOC ( rEntry ) ;
sal_Int64 nBegin = rEntry . nOffset ;
nEnd + = nBegin ;
2000-12-04 04:30:09 -06:00
uno : : Reference < io : : XInputStream > xStreamRef = new EntryInputStream ( xStream , nBegin , nEnd , 1024 , rEntry . nSize , rEntry . nMethod = = DEFLATED ) ;
2000-11-13 06:38:03 -06:00
return xStreamRef ;
}
2000-12-04 04:30:09 -06:00
2000-12-13 10:00:47 -06:00
sal_uInt32 SAL_CALL ZipFile : : getHeader ( const package : : ZipEntry & rEntry )
throw ( io : : IOException , package : : ZipException , uno : : RuntimeException )
{
uno : : Sequence < sal_Int8 > aSequence ( 4 ) ;
try
{
if ( rEntry . nOffset < = 0 )
readLOC ( rEntry ) ;
}
catch ( package : : ZipException & )
{
VOS_ENSURE ( 0 , " Zip file bug! " ) ;
return 0 ;
}
aGrabber . seek ( rEntry . nOffset ) ;
if ( rEntry . nMethod = = STORED )
{
if ( xStream - > readBytes ( aSequence , 4 ) < 4 )
return 0 ;
}
else if ( rEntry . nMethod = = DEFLATED )
{
uno : : Reference < io : : XInputStream > xEntryStream = getInputStream ( rEntry ) ;
if ( xEntryStream - > readBytes ( aSequence , 4 ) < 4 )
return 0 ;
/*
Inflater aInflater ( sal_True ) ;
sal_Int32 nSize = rEntry . nCompressedSize < 50 ? rEntry . nCompressedSize : 50 ;
uno : : Sequence < sal_Int8 > aCompSeq ( nSize ) ;
if ( xStream - > readBytes ( aCompSeq , nSize ) < nSize )
return 0 ;
aInflater . setInput ( aCompSeq ) ;
aInflater . doInflate ( aSequence ) ;
aInflater . end ( ) ;
*/
}
return ( static_cast < sal_uInt32 >
( static_cast < sal_uInt8 > ( aSequence [ 0 ] & 0xFF )
| static_cast < sal_uInt8 > ( aSequence [ 1 ] & 0xFF ) < < 8
| static_cast < sal_uInt8 > ( aSequence [ 2 ] & 0xFF ) < < 16
| static_cast < sal_uInt8 > ( aSequence [ 3 ] & 0xFF ) < < 24 ) ) ;
}
uno : : Reference < io : : XInputStream > SAL_CALL ZipFile : : getRawStream ( const package : : ZipEntry & rEntry )
throw ( io : : IOException , package : : ZipException , uno : : RuntimeException )
{
sal_Int64 nSize = rEntry . nMethod = = DEFLATED ? rEntry . nCompressedSize : rEntry . nSize ;
if ( rEntry . nOffset < = 0 )
readLOC ( rEntry ) ;
sal_Int64 nBegin = rEntry . nOffset ;
uno : : Reference < io : : XInputStream > xStreamRef = new EntryInputStream ( xStream , nBegin , nSize + nBegin , 1024 , nSize , sal_False ) ;
return xStreamRef ;
}
2000-11-13 06:38:03 -06:00
sal_Bool ZipFile : : readLOC ( const package : : ZipEntry & rEntry )
2000-12-04 04:30:09 -06:00
throw ( io : : IOException , package : : ZipException , uno : : RuntimeException )
2000-11-13 06:38:03 -06:00
{
sal_uInt32 nTestSig , nTime , nCRC , nSize , nCompressedSize ;
sal_uInt16 nVersion , nFlag , nHow , nNameLen , nExtraLen ;
sal_Int32 nPos = - rEntry . nOffset ;
aGrabber . seek ( nPos ) ;
aGrabber > > nTestSig ;
if ( nTestSig ! = LOCSIG )
2000-12-08 06:40:03 -06:00
throw package : : ZipException ( OUString : : createFromAscii ( " Invalid LOC header (bad signature " ) , uno : : Reference < uno : : XInterface > ( ) ) ;
2000-11-13 06:38:03 -06:00
aGrabber > > nVersion ;
aGrabber > > nFlag ;
aGrabber > > nHow ;
aGrabber > > nTime ;
aGrabber > > nCRC ;
aGrabber > > nCompressedSize ;
aGrabber > > nSize ;
aGrabber > > nNameLen ;
aGrabber > > nExtraLen ;
package : : ZipEntry * pNonConstEntry = const_cast < package : : ZipEntry * > ( & rEntry ) ;
2000-12-01 04:39:30 -06:00
pNonConstEntry - > nOffset = static_cast < sal_Int32 > ( aGrabber . getPosition ( ) ) + nNameLen + nExtraLen ;
2000-11-13 06:38:03 -06:00
return sal_True ;
}
sal_Int32 ZipFile : : findEND ( )
2000-12-04 04:30:09 -06:00
throw ( io : : IOException , package : : ZipException , uno : : RuntimeException )
2000-11-13 06:38:03 -06:00
{
2000-12-01 03:50:49 -06:00
sal_Int32 nLength = 0 , nPos = 0 ;
2000-11-21 10:57:07 -06:00
uno : : Sequence < sal_Int8 > aByteSeq ;
2000-12-01 03:50:49 -06:00
nLength = nPos = static_cast < sal_Int32 > ( aGrabber . getLength ( ) ) ;
2000-12-04 04:30:09 -06:00
2000-11-29 06:47:18 -06:00
if ( nLength = = 0 )
return - 1 ;
2000-12-04 04:30:09 -06:00
//throw (package::ZipException( OUString::createFromAscii("Trying to find Zip END signature in a zero length file!"), uno::Reference < uno::XInterface> () ));
2000-11-13 06:38:03 -06:00
aGrabber . seek ( nLength ) ;
while ( nLength - nPos < 0xFFFF )
{
2000-11-21 10:57:07 -06:00
sal_uInt32 nCount = 0xFFFF - ( nLength - nPos ) ;
2000-11-13 06:38:03 -06:00
if ( nCount > ENDHDR )
nCount = ENDHDR ;
nPos - = nCount ;
for ( sal_uInt16 i = 0 ; i < nCount ; i + + )
{
sal_uInt32 nTest = 0 , nFoo = ENDSIG ;
aGrabber . seek ( nPos + i ) ;
aGrabber > > nTest ;
if ( nTest = = ENDSIG )
{
sal_uInt16 nCommentLength ;
2000-12-01 03:50:49 -06:00
sal_Int32 nEndPos = nPos + i ;
2000-11-13 06:38:03 -06:00
aGrabber . seek ( nEndPos + ENDCOM ) ;
aGrabber > > nCommentLength ;
if ( nEndPos + ENDHDR + nCommentLength = = nLength )
{
if ( nCommentLength > 0 )
{
aByteSeq . realloc ( nCommentLength + 1 ) ;
aGrabber . readBytes ( uno : : Sequence < sal_Int8 > ( aByteSeq . getArray ( ) , nCommentLength ) , nCommentLength ) ;
aByteSeq [ nCommentLength ] = ' \0 ' ;
sComment = OUString ( ( sal_Char * ) aByteSeq . getConstArray ( ) , nCommentLength + 1 , RTL_TEXTENCODING_ASCII_US ) ;
}
return nPos + i ;
}
}
}
}
2000-12-08 06:40:03 -06:00
throw package : : ZipException ( OUString : : createFromAscii ( " Zip END signature not found! " ) , uno : : Reference < uno : : XInterface > ( ) ) ;
2000-11-13 06:38:03 -06:00
}
sal_Int32 ZipFile : : readCEN ( )
2000-12-04 04:30:09 -06:00
throw ( io : : IOException , package : : ZipException , uno : : RuntimeException )
2000-11-13 06:38:03 -06:00
{
2000-12-01 03:50:49 -06:00
sal_Int32 nEndPos , nLocPos ;
2000-11-28 20:21:56 -06:00
sal_Int16 nCount , nTotal ;
2000-12-01 03:50:49 -06:00
sal_Int32 nCenLen , nCenPos , nCenOff ;
2000-11-13 06:38:03 -06:00
nEndPos = findEND ( ) ;
2000-11-29 06:47:18 -06:00
if ( nEndPos = = - 1 )
return - 1 ;
2000-11-13 06:38:03 -06:00
aGrabber . seek ( nEndPos + ENDTOT ) ;
aGrabber > > nTotal ;
aGrabber > > nCenLen ;
aGrabber > > nCenOff ;
if ( nTotal < 0 | | nTotal * CENHDR > nCenLen )
2000-12-08 06:40:03 -06:00
throw package : : ZipException ( OUString : : createFromAscii ( " invalid END header (bad entry count) " ) , uno : : Reference < uno : : XInterface > ( ) ) ;
2000-11-13 06:38:03 -06:00
2000-12-04 04:30:09 -06:00
if ( nTotal > ZIP_MAXENTRIES )
2000-12-08 06:40:03 -06:00
throw package : : ZipException ( OUString : : createFromAscii ( " too many entries in ZIP File " ) , uno : : Reference < uno : : XInterface > ( ) ) ;
2000-11-13 06:38:03 -06:00
if ( nCenLen < 0 | | nCenLen > nEndPos )
2000-12-08 06:40:03 -06:00
throw package : : ZipException ( OUString : : createFromAscii ( " Invalid END header (bad central directory size) " ) , uno : : Reference < uno : : XInterface > ( ) ) ;
2000-12-04 04:30:09 -06:00
2000-11-13 06:38:03 -06:00
nCenPos = nEndPos - nCenLen ;
if ( nCenOff < 0 | | nCenOff > nCenPos )
2000-12-08 06:40:03 -06:00
throw package : : ZipException ( OUString : : createFromAscii ( " Invalid END header (bad central directory size) " ) , uno : : Reference < uno : : XInterface > ( ) ) ;
2000-11-13 06:38:03 -06:00
2000-12-04 04:30:09 -06:00
nLocPos = nCenPos - nCenOff ;
2000-11-13 06:38:03 -06:00
aGrabber . seek ( nCenPos ) ;
2000-12-04 04:30:09 -06:00
2000-12-13 10:00:47 -06:00
package : : ZipEntry * pEntry = new package : : ZipEntry ;
2000-11-13 06:38:03 -06:00
for ( nCount = 0 ; nCount < nTotal ; nCount + + )
{
sal_Int32 nTestSig , nCRC , nCompressedSize , nTime , nSize , nExtAttr , nOffset ;
sal_Int16 nVerMade , nVersion , nFlag , nHow , nNameLen , nExtraLen , nCommentLen ;
sal_Int16 nDisk , nIntAttr ;
2000-12-04 04:30:09 -06:00
2000-11-13 06:38:03 -06:00
if ( aGrabber . getPosition ( ) - nCenPos + CENHDR > nCenLen )
2000-12-08 06:40:03 -06:00
throw package : : ZipException ( OUString : : createFromAscii ( " Invalid CEN header (bad header size check 1) " ) , uno : : Reference < uno : : XInterface > ( ) ) ;
2000-12-04 04:30:09 -06:00
2000-11-13 06:38:03 -06:00
aGrabber > > nTestSig ;
if ( nTestSig ! = CENSIG )
2000-12-08 06:40:03 -06:00
throw package : : ZipException ( OUString : : createFromAscii ( " Invalid CEN header (bad signature) " ) , uno : : Reference < uno : : XInterface > ( ) ) ;
2000-12-04 04:30:09 -06:00
2000-11-13 06:38:03 -06:00
aGrabber > > nVerMade ;
aGrabber > > nVersion ;
if ( ( nVersion & 1 ) = = 1 )
2000-12-08 06:40:03 -06:00
throw package : : ZipException ( OUString : : createFromAscii ( " Invalid CEN header (encrypted entry) " ) , uno : : Reference < uno : : XInterface > ( ) ) ;
2000-12-04 04:30:09 -06:00
2000-11-13 06:38:03 -06:00
aGrabber > > nFlag ;
aGrabber > > nHow ;
if ( nHow ! = STORED & & nHow ! = DEFLATED )
2000-12-08 06:40:03 -06:00
throw package : : ZipException ( OUString : : createFromAscii ( " Invalid CEN header (bad compression method) " ) , uno : : Reference < uno : : XInterface > ( ) ) ;
2000-12-04 04:30:09 -06:00
2000-11-13 06:38:03 -06:00
aGrabber > > nTime ;
aGrabber > > nCRC ;
aGrabber > > nCompressedSize ;
aGrabber > > nSize ;
aGrabber > > nNameLen ;
aGrabber > > nExtraLen ;
aGrabber > > nCommentLen ;
aGrabber > > nDisk ;
aGrabber > > nIntAttr ;
aGrabber > > nExtAttr ;
aGrabber > > nOffset ;
if ( aGrabber . getPosition ( ) - nCenPos + nNameLen + nExtraLen + nCommentLen > nCenLen )
2000-12-08 06:40:03 -06:00
throw package : : ZipException ( OUString : : createFromAscii ( " Invalid CEN header (bad header siez check 2) " ) , uno : : Reference < uno : : XInterface > ( ) ) ;
2000-12-04 04:30:09 -06:00
2000-11-13 06:38:03 -06:00
if ( nNameLen > ZIP_MAXNAMELEN )
2000-12-08 06:40:03 -06:00
throw package : : ZipException ( OUString : : createFromAscii ( " name length exceeds 512 bytes " ) , uno : : Reference < uno : : XInterface > ( ) ) ;
2000-12-04 04:30:09 -06:00
2000-11-13 06:38:03 -06:00
if ( nExtraLen > ZIP_MAXEXTRA )
2000-12-08 06:40:03 -06:00
throw package : : ZipException ( OUString : : createFromAscii ( " extra header info exceeds 256 bytes " ) , uno : : Reference < uno : : XInterface > ( ) ) ;
2000-11-13 06:38:03 -06:00
pEntry - > nTime = nTime ;
pEntry - > nCrc = nCRC ;
pEntry - > nSize = nSize ;
pEntry - > nCompressedSize = nCompressedSize ;
pEntry - > nMethod = nHow ;
pEntry - > nFlag = nFlag ;
pEntry - > nVersion = nVersion ;
pEntry - > nOffset = nOffset + nLocPos ;
pEntry - > nOffset * = - 1 ;
2000-11-23 07:15:52 -06:00
/*
2000-11-13 06:38:03 -06:00
if ( nHow = = STORED )
pEntry - > nCompressedSize = 0 ;
2000-11-23 07:15:52 -06:00
*/
2000-11-13 06:38:03 -06:00
uno : : Sequence < sal_Int8 > aSequence ( nNameLen ) ;
aGrabber . readBytes ( aSequence , nNameLen ) ;
pEntry - > sName = OUString ( ( sal_Char * ) aSequence . getConstArray ( ) , nNameLen , RTL_TEXTENCODING_ASCII_US ) ;
aGrabber . seek ( aGrabber . getPosition ( ) + nExtraLen ) ;
if ( nCommentLen > 0 )
{
uno : : Sequence < sal_Int8 > aCommentSeq ( nCommentLen ) ;
aGrabber . readBytes ( aCommentSeq , nCommentLen ) ;
pEntry - > sComment = OUString ( ( sal_Char * ) aCommentSeq . getConstArray ( ) , nNameLen , RTL_TEXTENCODING_ASCII_US ) ;
}
2000-11-28 20:21:56 -06:00
aEntries [ pEntry - > sName ] = * pEntry ;
2000-11-13 06:38:03 -06:00
}
2000-12-13 10:00:47 -06:00
delete pEntry ;
2000-11-13 06:38:03 -06:00
if ( nCount ! = nTotal )
2000-12-08 06:40:03 -06:00
throw package : : ZipException ( OUString : : createFromAscii ( " Count != Total " ) , uno : : Reference < uno : : XInterface > ( ) ) ;
2000-12-04 04:30:09 -06:00
2000-11-13 06:38:03 -06:00
return nCenPos ;
}