Kaydet (Commit) 363c1ede authored tarafından Miklos Vajna's avatar Miklos Vajna

package: kill RTL_CONSTASCII_USTRINGPARAM in zipapi

Change-Id: Ic53f613cfaa5bd4affd0c27b5ed4ed20536ee055
üst 38d446da
...@@ -64,14 +64,14 @@ sal_Int64 SAL_CALL ByteGrabber::seek( sal_Int64 location ) ...@@ -64,14 +64,14 @@ sal_Int64 SAL_CALL ByteGrabber::seek( sal_Int64 location )
{ {
sal_Int64 nLen = xSeek->getLength(); sal_Int64 nLen = xSeek->getLength();
if ( location < 0 || location > nLen ) if ( location < 0 || location > nLen )
throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >(), 1 ); throw lang::IllegalArgumentException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >(), 1 );
if (location > nLen ) if (location > nLen )
location = nLen; location = nLen;
xSeek->seek( location ); xSeek->seek( location );
return location; return location;
} }
else else
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
} }
sal_Int64 SAL_CALL ByteGrabber::getPosition( ) sal_Int64 SAL_CALL ByteGrabber::getPosition( )
...@@ -81,7 +81,7 @@ sal_Int64 SAL_CALL ByteGrabber::getPosition( ) ...@@ -81,7 +81,7 @@ sal_Int64 SAL_CALL ByteGrabber::getPosition( )
if (xSeek.is() ) if (xSeek.is() )
return xSeek->getPosition(); return xSeek->getPosition();
else else
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
} }
sal_Int64 SAL_CALL ByteGrabber::getLength( ) sal_Int64 SAL_CALL ByteGrabber::getLength( )
...@@ -91,7 +91,7 @@ sal_Int64 SAL_CALL ByteGrabber::getLength( ) ...@@ -91,7 +91,7 @@ sal_Int64 SAL_CALL ByteGrabber::getLength( )
if (xSeek.is() ) if (xSeek.is() )
return xSeek->getLength(); return xSeek->getLength();
else else
throw io::IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
} }
ByteGrabber& ByteGrabber::operator >> (sal_Int8& rInt8) ByteGrabber& ByteGrabber::operator >> (sal_Int8& rInt8)
......
...@@ -230,15 +230,15 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa ...@@ -230,15 +230,15 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa
if ( nRead > nRequestedBytes ) if ( nRead > nRequestedBytes )
throw RuntimeException( throw RuntimeException(
OUString( RTL_CONSTASCII_USTRINGPARAM( "Should not be possible to read more then requested!" ) ), "Should not be possible to read more then requested!",
Reference< XInterface >() ); Reference< XInterface >() );
if ( maInflater.finished() || maInflater.getLastInflateError() ) if ( maInflater.finished() || maInflater.getLastInflateError() )
throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "The stream seems to be broken!" ) ), throw ZipIOException("The stream seems to be broken!",
Reference< XInterface >() ); Reference< XInterface >() );
if ( maInflater.needsDictionary() ) if ( maInflater.needsDictionary() )
throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "Dictionaries are not supported!" ) ), throw ZipIOException("Dictionaries are not supported!",
Reference< XInterface >() ); Reference< XInterface >() );
sal_Int32 nDiff = static_cast< sal_Int32 >( mnZipEnd - mnZipCurrent ); sal_Int32 nDiff = static_cast< sal_Int32 >( mnZipEnd - mnZipCurrent );
...@@ -253,7 +253,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa ...@@ -253,7 +253,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa
sal_Int32 nZipRead = mxZipStream->readBytes( maCompBuffer, nToRead ); sal_Int32 nZipRead = mxZipStream->readBytes( maCompBuffer, nToRead );
if ( nZipRead < nToRead ) if ( nZipRead < nToRead )
throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "No expected data!" ) ), throw ZipIOException("No expected data!",
Reference< XInterface >() ); Reference< XInterface >() );
mnZipCurrent += nZipRead; mnZipCurrent += nZipRead;
...@@ -280,7 +280,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa ...@@ -280,7 +280,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa
} }
else else
{ {
throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "The stream seems to be broken!" ) ), throw ZipIOException("The stream seems to be broken!",
Reference< XInterface >() ); Reference< XInterface >() );
} }
} }
...@@ -297,7 +297,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa ...@@ -297,7 +297,7 @@ sal_Int32 SAL_CALL XUnbufferedStream::readBytes( Sequence< sal_Int8 >& aData, sa
maCRC.update( aData ); maCRC.update( aData );
if ( mnZipSize + maHeader.getLength() == mnMyCurrent && maCRC.getValue() != maEntry.nCrc ) if ( mnZipSize + maHeader.getLength() == mnMyCurrent && maCRC.getValue() != maEntry.nCrc )
throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "The stream seems to be broken!" ) ), throw ZipIOException("The stream seems to be broken!",
Reference< XInterface >() ); Reference< XInterface >() );
} }
} }
......
...@@ -76,7 +76,7 @@ ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference ...@@ -76,7 +76,7 @@ ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference
if ( readCEN() == -1 ) if ( readCEN() == -1 )
{ {
aEntries.clear(); aEntries.clear();
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "stream data looks to be broken" ) ), uno::Reference < XInterface > () ); throw ZipException( "stream data looks to be broken", uno::Reference < XInterface > () );
} }
} }
} }
...@@ -102,7 +102,7 @@ ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference ...@@ -102,7 +102,7 @@ ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference
else if ( readCEN() == -1 ) else if ( readCEN() == -1 )
{ {
aEntries.clear(); aEntries.clear();
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "stream data looks to be broken" ) ), uno::Reference < XInterface > () ); throw ZipException("stream data looks to be broken", uno::Reference < XInterface > () );
} }
} }
} }
...@@ -131,7 +131,7 @@ uno::Reference< xml::crypto::XDigestContext > ZipFile::StaticGetDigestContextFor ...@@ -131,7 +131,7 @@ uno::Reference< xml::crypto::XDigestContext > ZipFile::StaticGetDigestContextFor
xFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW ); xFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
uno::Reference< xml::crypto::XDigestContextSupplier > xDigestContextSupplier( uno::Reference< xml::crypto::XDigestContextSupplier > xDigestContextSupplier(
xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.crypto.NSSInitializer" ) ) ), xFactory->createInstance("com.sun.star.xml.crypto.NSSInitializer"),
uno::UNO_QUERY_THROW ); uno::UNO_QUERY_THROW );
xDigestContext.set( xDigestContextSupplier->getDigestContext( xEncryptionData->m_nCheckAlg, uno::Sequence< beans::NamedValue >() ), uno::UNO_SET_THROW ); xDigestContext.set( xDigestContextSupplier->getDigestContext( xEncryptionData->m_nCheckAlg, uno::Sequence< beans::NamedValue >() ), uno::UNO_SET_THROW );
...@@ -150,7 +150,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un ...@@ -150,7 +150,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un
{ {
if (xEncryptionData->m_nDerivedKeySize < 0) if (xEncryptionData->m_nDerivedKeySize < 0)
{ {
throw ZipIOException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid derived key length!") ), throw ZipIOException("Invalid derived key length!",
uno::Reference< XInterface >() ); uno::Reference< XInterface >() );
} }
...@@ -163,7 +163,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un ...@@ -163,7 +163,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un
xEncryptionData->m_aSalt.getLength(), xEncryptionData->m_aSalt.getLength(),
xEncryptionData->m_nIterationCount ) ) xEncryptionData->m_nIterationCount ) )
{ {
throw ZipIOException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Can not create derived key!") ), throw ZipIOException("Can not create derived key!",
uno::Reference< XInterface >() ); uno::Reference< XInterface >() );
} }
...@@ -174,7 +174,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un ...@@ -174,7 +174,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un
xFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW ); xFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
uno::Reference< xml::crypto::XCipherContextSupplier > xCipherContextSupplier( uno::Reference< xml::crypto::XCipherContextSupplier > xCipherContextSupplier(
xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.crypto.NSSInitializer" ) ) ), xFactory->createInstance("com.sun.star.xml.crypto.NSSInitializer"),
uno::UNO_QUERY_THROW ); uno::UNO_QUERY_THROW );
xResult = xCipherContextSupplier->getCipherContext( xEncryptionData->m_nEncAlg, aDerivedKey, xEncryptionData->m_aInitVector, bEncrypt, uno::Sequence< beans::NamedValue >() ); xResult = xCipherContextSupplier->getCipherContext( xEncryptionData->m_nEncAlg, aDerivedKey, xEncryptionData->m_aInitVector, bEncrypt, uno::Sequence< beans::NamedValue >() );
...@@ -185,7 +185,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un ...@@ -185,7 +185,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un
} }
else else
{ {
throw ZipIOException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown cipher algorithm is requested!") ), throw ZipIOException("Unknown cipher algorithm is requested!",
uno::Reference< XInterface >() ); uno::Reference< XInterface >() );
} }
} }
...@@ -386,15 +386,15 @@ uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const uno::R ...@@ -386,15 +386,15 @@ uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const uno::R
throw ( packages::WrongPasswordException, ZipIOException, RuntimeException ) throw ( packages::WrongPasswordException, ZipIOException, RuntimeException )
{ {
if ( !rData.is() ) if ( !rData.is() )
throw ZipIOException( OUString(RTL_CONSTASCII_USTRINGPARAM( "Encrypted stream without encryption data!\n" )), throw ZipIOException("Encrypted stream without encryption data!\n",
uno::Reference< XInterface >() ); uno::Reference< XInterface >() );
if ( !rData->m_aKey.getLength() ) if ( !rData->m_aKey.getLength() )
throw packages::WrongPasswordException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); throw packages::WrongPasswordException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
uno::Reference< XSeekable > xSeek( xStream, UNO_QUERY ); uno::Reference< XSeekable > xSeek( xStream, UNO_QUERY );
if ( !xSeek.is() ) if ( !xSeek.is() )
throw ZipIOException( OUString(RTL_CONSTASCII_USTRINGPARAM( "The stream must be seekable!\n" )), throw ZipIOException("The stream must be seekable!\n",
uno::Reference< XInterface >() ); uno::Reference< XInterface >() );
...@@ -417,7 +417,7 @@ uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const uno::R ...@@ -417,7 +417,7 @@ uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const uno::R
xStream->readBytes( aReadBuffer, nSize ); xStream->readBytes( aReadBuffer, nSize );
if ( !StaticHasValidPassword( xFactory, aReadBuffer, rData ) ) if ( !StaticHasValidPassword( xFactory, aReadBuffer, rData ) )
throw packages::WrongPasswordException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); throw packages::WrongPasswordException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
} }
return new XUnbufferedStream( xFactory, xStream, rData ); return new XUnbufferedStream( xFactory, xStream, rData );
...@@ -584,14 +584,14 @@ uno::Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry ...@@ -584,14 +584,14 @@ uno::Reference< XInputStream > SAL_CALL ZipFile::getDataStream( ZipEntry& rEntry
// in case no digest is provided there is no way // in case no digest is provided there is no way
// to detect password correctness // to detect password correctness
if ( !rData.is() ) if ( !rData.is() )
throw ZipException( OUString(RTL_CONSTASCII_USTRINGPARAM( "Encrypted stream without encryption data!\n" )), throw ZipException("Encrypted stream without encryption data!\n",
uno::Reference< XInterface >() ); uno::Reference< XInterface >() );
// if we have a digest, then this file is an encrypted one and we should // if we have a digest, then this file is an encrypted one and we should
// check if we can decrypt it or not // check if we can decrypt it or not
OSL_ENSURE( rData->m_aDigest.getLength(), "Can't detect password correctness without digest!\n" ); OSL_ENSURE( rData->m_aDigest.getLength(), "Can't detect password correctness without digest!\n" );
if ( rData->m_aDigest.getLength() && !hasValidPassword ( rEntry, rData ) ) if ( rData->m_aDigest.getLength() && !hasValidPassword ( rEntry, rData ) )
throw packages::WrongPasswordException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); throw packages::WrongPasswordException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
} }
else else
bNeedRawStream = ( rEntry.nMethod == STORED ); bNeedRawStream = ( rEntry.nMethod == STORED );
...@@ -630,7 +630,7 @@ uno::Reference< XInputStream > SAL_CALL ZipFile::getWrappedRawStream( ...@@ -630,7 +630,7 @@ uno::Reference< XInputStream > SAL_CALL ZipFile::getWrappedRawStream(
::osl::MutexGuard aGuard( m_aMutex ); ::osl::MutexGuard aGuard( m_aMutex );
if ( !rData.is() ) if ( !rData.is() )
throw packages::NoEncryptionException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); throw packages::NoEncryptionException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
if ( rEntry.nOffset <= 0 ) if ( rEntry.nOffset <= 0 )
readLOC( rEntry ); readLOC( rEntry );
...@@ -651,7 +651,7 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry ) ...@@ -651,7 +651,7 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry )
aGrabber >> nTestSig; aGrabber >> nTestSig;
if (nTestSig != LOCSIG) if (nTestSig != LOCSIG)
throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid LOC header (bad signature") ), uno::Reference < XInterface > () ); throw ZipIOException("Invalid LOC header (bad signature)", uno::Reference < XInterface > () );
aGrabber >> nVersion; aGrabber >> nVersion;
aGrabber >> nFlag; aGrabber >> nFlag;
aGrabber >> nHow; aGrabber >> nHow;
...@@ -702,7 +702,7 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry ) ...@@ -702,7 +702,7 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry )
} }
if ( bBroken && !bRecoveryMode ) if ( bBroken && !bRecoveryMode )
throw ZipIOException( OUString( RTL_CONSTASCII_USTRINGPARAM( "The stream seems to be broken!" ) ), throw ZipIOException("The stream seems to be broken!",
uno::Reference< XInterface >() ); uno::Reference< XInterface >() );
return sal_True; return sal_True;
...@@ -737,17 +737,17 @@ sal_Int32 ZipFile::findEND( ) ...@@ -737,17 +737,17 @@ sal_Int32 ZipFile::findEND( )
} }
catch ( IllegalArgumentException& ) catch ( IllegalArgumentException& )
{ {
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () ); throw ZipException("Zip END signature not found!", uno::Reference < XInterface > () );
} }
catch ( NotConnectedException& ) catch ( NotConnectedException& )
{ {
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () ); throw ZipException("Zip END signature not found!", uno::Reference < XInterface > () );
} }
catch ( BufferSizeExceededException& ) catch ( BufferSizeExceededException& )
{ {
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () ); throw ZipException("Zip END signature not found!", uno::Reference < XInterface > () );
} }
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () ); throw ZipException("Zip END signature not found!", uno::Reference < XInterface > () );
} }
sal_Int32 ZipFile::readCEN() sal_Int32 ZipFile::readCEN()
...@@ -768,25 +768,25 @@ sal_Int32 ZipFile::readCEN() ...@@ -768,25 +768,25 @@ sal_Int32 ZipFile::readCEN()
aGrabber >> nCenOff; aGrabber >> nCenOff;
if ( nTotal * CENHDR > nCenLen ) if ( nTotal * CENHDR > nCenLen )
throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "invalid END header (bad entry count)") ), uno::Reference < XInterface > () ); throw ZipException("invalid END header (bad entry count)", uno::Reference < XInterface > () );
if ( nTotal > ZIP_MAXENTRIES ) if ( nTotal > ZIP_MAXENTRIES )
throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "too many entries in ZIP File") ), uno::Reference < XInterface > () ); throw ZipException("too many entries in ZIP File", uno::Reference < XInterface > () );
if ( nCenLen < 0 || nCenLen > nEndPos ) if ( nCenLen < 0 || nCenLen > nEndPos )
throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid END header (bad central directory size)") ), uno::Reference < XInterface > () ); throw ZipException("Invalid END header (bad central directory size)", uno::Reference < XInterface > () );
nCenPos = nEndPos - nCenLen; nCenPos = nEndPos - nCenLen;
if ( nCenOff < 0 || nCenOff > nCenPos ) if ( nCenOff < 0 || nCenOff > nCenPos )
throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid END header (bad central directory size)") ), uno::Reference < XInterface > () ); throw ZipException("Invalid END header (bad central directory size)", uno::Reference < XInterface > () );
nLocPos = nCenPos - nCenOff; nLocPos = nCenPos - nCenOff;
aGrabber.seek( nCenPos ); aGrabber.seek( nCenPos );
Sequence < sal_Int8 > aCENBuffer ( nCenLen ); Sequence < sal_Int8 > aCENBuffer ( nCenLen );
sal_Int64 nRead = aGrabber.readBytes ( aCENBuffer, nCenLen ); sal_Int64 nRead = aGrabber.readBytes ( aCENBuffer, nCenLen );
if ( static_cast < sal_Int64 > ( nCenLen ) != nRead ) if ( static_cast < sal_Int64 > ( nCenLen ) != nRead )
throw ZipException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Error reading CEN into memory buffer!") ), uno::Reference < XInterface > () ); throw ZipException ("Error reading CEN into memory buffer!", uno::Reference < XInterface > () );
MemoryByteGrabber aMemGrabber ( aCENBuffer ); MemoryByteGrabber aMemGrabber ( aCENBuffer );
...@@ -798,19 +798,19 @@ sal_Int32 ZipFile::readCEN() ...@@ -798,19 +798,19 @@ sal_Int32 ZipFile::readCEN()
{ {
aMemGrabber >> nTestSig; aMemGrabber >> nTestSig;
if ( nTestSig != CENSIG ) if ( nTestSig != CENSIG )
throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (bad signature)") ), uno::Reference < XInterface > () ); throw ZipException("Invalid CEN header (bad signature)", uno::Reference < XInterface > () );
aMemGrabber.skipBytes ( 2 ); aMemGrabber.skipBytes ( 2 );
aMemGrabber >> aEntry.nVersion; aMemGrabber >> aEntry.nVersion;
if ( ( aEntry.nVersion & 1 ) == 1 ) if ( ( aEntry.nVersion & 1 ) == 1 )
throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (encrypted entry)") ), uno::Reference < XInterface > () ); throw ZipException("Invalid CEN header (encrypted entry)", uno::Reference < XInterface > () );
aMemGrabber >> aEntry.nFlag; aMemGrabber >> aEntry.nFlag;
aMemGrabber >> aEntry.nMethod; aMemGrabber >> aEntry.nMethod;
if ( aEntry.nMethod != STORED && aEntry.nMethod != DEFLATED) if ( aEntry.nMethod != STORED && aEntry.nMethod != DEFLATED)
throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Invalid CEN header (bad compression method)") ), uno::Reference < XInterface > () ); throw ZipException("Invalid CEN header (bad compression method)", uno::Reference < XInterface > () );
aMemGrabber >> aEntry.nTime; aMemGrabber >> aEntry.nTime;
aMemGrabber >> aEntry.nCrc; aMemGrabber >> aEntry.nCrc;
...@@ -826,13 +826,13 @@ sal_Int32 ZipFile::readCEN() ...@@ -826,13 +826,13 @@ sal_Int32 ZipFile::readCEN()
aEntry.nOffset *= -1; aEntry.nOffset *= -1;
if ( aEntry.nPathLen < 0 ) if ( aEntry.nPathLen < 0 )
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected name length" ) ), uno::Reference < XInterface > () ); throw ZipException("unexpected name length", uno::Reference < XInterface > () );
if ( nCommentLen < 0 ) if ( nCommentLen < 0 )
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected comment length" ) ), uno::Reference < XInterface > () ); throw ZipException("unexpected comment length", uno::Reference < XInterface > () );
if ( aEntry.nExtraLen < 0 ) if ( aEntry.nExtraLen < 0 )
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "unexpected extra header info length") ), uno::Reference < XInterface > () ); throw ZipException("unexpected extra header info length", uno::Reference < XInterface > () );
// read always in UTF8, some tools seem not to set UTF8 bit // read always in UTF8, some tools seem not to set UTF8 bit
aEntry.sPath = rtl::OUString::intern ( (sal_Char *) aMemGrabber.getCurrentPos(), aEntry.sPath = rtl::OUString::intern ( (sal_Char *) aMemGrabber.getCurrentPos(),
...@@ -840,14 +840,14 @@ sal_Int32 ZipFile::readCEN() ...@@ -840,14 +840,14 @@ sal_Int32 ZipFile::readCEN()
RTL_TEXTENCODING_UTF8 ); RTL_TEXTENCODING_UTF8 );
if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( aEntry.sPath, sal_True ) ) if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( aEntry.sPath, sal_True ) )
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip entry has an invalid name.") ), uno::Reference < XInterface > () ); throw ZipException("Zip entry has an invalid name.", uno::Reference < XInterface > () );
aMemGrabber.skipBytes( aEntry.nPathLen + aEntry.nExtraLen + nCommentLen ); aMemGrabber.skipBytes( aEntry.nPathLen + aEntry.nExtraLen + nCommentLen );
aEntries[aEntry.sPath] = aEntry; aEntries[aEntry.sPath] = aEntry;
} }
if (nCount != nTotal) if (nCount != nTotal)
throw ZipException(OUString( RTL_CONSTASCII_USTRINGPARAM ( "Count != Total") ), uno::Reference < XInterface > () ); throw ZipException("Count != Total", uno::Reference < XInterface > () );
} }
catch ( IllegalArgumentException & ) catch ( IllegalArgumentException & )
{ {
...@@ -1020,15 +1020,15 @@ sal_Int32 ZipFile::recover() ...@@ -1020,15 +1020,15 @@ sal_Int32 ZipFile::recover()
} }
catch ( IllegalArgumentException& ) catch ( IllegalArgumentException& )
{ {
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () ); throw ZipException("Zip END signature not found!", uno::Reference < XInterface > () );
} }
catch ( NotConnectedException& ) catch ( NotConnectedException& )
{ {
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () ); throw ZipException("Zip END signature not found!", uno::Reference < XInterface > () );
} }
catch ( BufferSizeExceededException& ) catch ( BufferSizeExceededException& )
{ {
throw ZipException( OUString( RTL_CONSTASCII_USTRINGPARAM ( "Zip END signature not found!") ), uno::Reference < XInterface > () ); throw ZipException("Zip END signature not found!", uno::Reference < XInterface > () );
} }
} }
......
...@@ -304,7 +304,7 @@ void ZipOutputStream::writeCEN( const ZipEntry &rEntry ) ...@@ -304,7 +304,7 @@ void ZipOutputStream::writeCEN( const ZipEntry &rEntry )
throw(IOException, RuntimeException) throw(IOException, RuntimeException)
{ {
if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( rEntry.sPath, sal_True ) ) if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( rEntry.sPath, sal_True ) )
throw IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected character is used in file name." ) ), uno::Reference< XInterface >() ); throw IOException("Unexpected character is used in file name.", uno::Reference< XInterface >() );
::rtl::OString sUTF8Name = ::rtl::OUStringToOString( rEntry.sPath, RTL_TEXTENCODING_UTF8 ); ::rtl::OString sUTF8Name = ::rtl::OUStringToOString( rEntry.sPath, RTL_TEXTENCODING_UTF8 );
sal_Int16 nNameLength = static_cast < sal_Int16 > ( sUTF8Name.getLength() ); sal_Int16 nNameLength = static_cast < sal_Int16 > ( sUTF8Name.getLength() );
...@@ -353,7 +353,7 @@ sal_Int32 ZipOutputStream::writeLOC( const ZipEntry &rEntry ) ...@@ -353,7 +353,7 @@ sal_Int32 ZipOutputStream::writeLOC( const ZipEntry &rEntry )
throw(IOException, RuntimeException) throw(IOException, RuntimeException)
{ {
if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( rEntry.sPath, sal_True ) ) if ( !::comphelper::OStorageHelper::IsValidZipEntryFileName( rEntry.sPath, sal_True ) )
throw IOException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected character is used in file name." ) ), uno::Reference< XInterface >() ); throw IOException("Unexpected character is used in file name.", uno::Reference< XInterface >() );
::rtl::OString sUTF8Name = ::rtl::OUStringToOString( rEntry.sPath, RTL_TEXTENCODING_UTF8 ); ::rtl::OString sUTF8Name = ::rtl::OUStringToOString( rEntry.sPath, RTL_TEXTENCODING_UTF8 );
sal_Int16 nNameLength = static_cast < sal_Int16 > ( sUTF8Name.getLength() ); sal_Int16 nNameLength = static_cast < sal_Int16 > ( sUTF8Name.getLength() );
......
...@@ -31,7 +31,7 @@ uno::Reference< xml::crypto::XCipherContext > BlowfishCFB8CipherContext::Create( ...@@ -31,7 +31,7 @@ uno::Reference< xml::crypto::XCipherContext > BlowfishCFB8CipherContext::Create(
::rtl::Reference< BlowfishCFB8CipherContext > xResult = new BlowfishCFB8CipherContext(); ::rtl::Reference< BlowfishCFB8CipherContext > xResult = new BlowfishCFB8CipherContext();
xResult->m_pCipher = rtl_cipher_create( rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream ); xResult->m_pCipher = rtl_cipher_create( rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream );
if ( !xResult->m_pCipher ) if ( !xResult->m_pCipher )
throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Can not create cipher!")), throw uno::RuntimeException("Can not create cipher!",
uno::Reference< XInterface >() ); uno::Reference< XInterface >() );
if ( rtl_Cipher_E_None != rtl_cipher_init( if ( rtl_Cipher_E_None != rtl_cipher_init(
...@@ -42,7 +42,7 @@ uno::Reference< xml::crypto::XCipherContext > BlowfishCFB8CipherContext::Create( ...@@ -42,7 +42,7 @@ uno::Reference< xml::crypto::XCipherContext > BlowfishCFB8CipherContext::Create(
reinterpret_cast< const sal_uInt8* >( aInitVector.getConstArray() ), reinterpret_cast< const sal_uInt8* >( aInitVector.getConstArray() ),
aInitVector.getLength() ) ) aInitVector.getLength() ) )
{ {
throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Can not initialize cipher!") ), throw uno::RuntimeException("Can not initialize cipher!",
uno::Reference< XInterface >() ); uno::Reference< XInterface >() );
} }
...@@ -89,7 +89,7 @@ uno::Sequence< sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::convertWithCipherC ...@@ -89,7 +89,7 @@ uno::Sequence< sal_Int8 > SAL_CALL BlowfishCFB8CipherContext::convertWithCipherC
if ( rtl_Cipher_E_None != nError ) if ( rtl_Cipher_E_None != nError )
{ {
throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Can not decrypt/encrypt with cipher!") ), throw uno::RuntimeException("Can not decrypt/encrypt with cipher!",
uno::Reference< uno::XInterface >() ); uno::Reference< uno::XInterface >() );
} }
......
...@@ -31,7 +31,7 @@ uno::Reference< xml::crypto::XDigestContext > SHA1DigestContext::Create() ...@@ -31,7 +31,7 @@ uno::Reference< xml::crypto::XDigestContext > SHA1DigestContext::Create()
::rtl::Reference< SHA1DigestContext > xResult = new SHA1DigestContext(); ::rtl::Reference< SHA1DigestContext > xResult = new SHA1DigestContext();
xResult->m_pDigest = rtl_digest_createSHA1(); xResult->m_pDigest = rtl_digest_createSHA1();
if ( !xResult->m_pDigest ) if ( !xResult->m_pDigest )
throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Can not create cipher!") ), throw uno::RuntimeException("Can not create cipher!",
uno::Reference< XInterface >() ); uno::Reference< XInterface >() );
return uno::Reference< xml::crypto::XDigestContext >( xResult.get() ); return uno::Reference< xml::crypto::XDigestContext >( xResult.get() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment