From cb64711136fff661f60d679db1e391866cc6fe10 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Mon, 27 Jan 2014 22:51:45 +0100 Subject: Don't use OSL_LOG_PREFIX when throwing exceptions in non-debug builds. Using OSL_LOG_PREFIX in the exceptions is not a good idea; it blows the size of the string literals tremendously - full build path for every line that uses that, including the line. Let's not remove it for good, but hide it for non-debug builds (OSL_DEBUG_LEVEL == 0) so that anybody who would like to use this during debugging could still do (but I doubt it has any value for anybody). Change-Id: Icc8db95ae0862671a206e681f92c60cdf51ffc32 --- package/source/manifest/ManifestExport.cxx | 14 ++++++++++---- package/source/manifest/ManifestWriter.cxx | 8 +++++++- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'package/source/manifest') diff --git a/package/source/manifest/ManifestExport.cxx b/package/source/manifest/ManifestExport.cxx index 7e55a28147d9..0572cf73f0bc 100644 --- a/package/source/manifest/ManifestExport.cxx +++ b/package/source/manifest/ManifestExport.cxx @@ -35,6 +35,12 @@ using namespace ::com::sun::star; +#if OSL_DEBUG_LEVEL > 0 +#define THROW_WHERE SAL_WHERE +#else +#define THROW_WHERE "" +#endif + ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHandler, const uno::Sequence< uno::Sequence < beans::PropertyValue > >& rManList ) { const OUString sFileEntryElement ( ELEMENT_FILE_ENTRY ); @@ -257,7 +263,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHa else if ( nDigestAlgID == xml::crypto::DigestID::SHA1_1K ) sChecksumType = sSHA1_1k_Name; else - throw uno::RuntimeException( OSL_LOG_PREFIX "Unexpected digest algorithm is provided!", uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( THROW_WHERE "Unexpected digest algorithm is provided!", uno::Reference< uno::XInterface >() ); pNewAttrList->AddAttribute ( sChecksumTypeAttribute, sCdataAttribute, sChecksumType ); *pDigest >>= aSequence; @@ -280,7 +286,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHa { OSL_ENSURE( nDerivedKeySize, "Unexpected key size is provided!" ); if ( nDerivedKeySize != 32 ) - throw uno::RuntimeException( OSL_LOG_PREFIX "Unexpected key size is provided!", uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( THROW_WHERE "Unexpected key size is provided!", uno::Reference< uno::XInterface >() ); sEncAlgName = sAES256_URL; } @@ -289,7 +295,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHa sEncAlgName = sBlowfish_Name; } else - throw uno::RuntimeException( OSL_LOG_PREFIX "Unexpected encryption algorithm is provided!", uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( THROW_WHERE "Unexpected encryption algorithm is provided!", uno::Reference< uno::XInterface >() ); pNewAttrList->AddAttribute ( sAlgorithmNameAttribute, sCdataAttribute, sEncAlgName ); @@ -353,7 +359,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > xHa sStartKeySize = aBuffer.makeStringAndClear(); } else - throw uno::RuntimeException( OSL_LOG_PREFIX "Unexpected start key algorithm is provided!", uno::Reference< uno::XInterface >() ); + throw uno::RuntimeException( THROW_WHERE "Unexpected start key algorithm is provided!", uno::Reference< uno::XInterface >() ); pNewAttrList->AddAttribute ( sStartKeyGenerationNameAttribute, sCdataAttribute, sStartKeyAlg ); pNewAttrList->AddAttribute ( sKeySizeAttribute, sCdataAttribute, sStartKeySize ); diff --git a/package/source/manifest/ManifestWriter.cxx b/package/source/manifest/ManifestWriter.cxx index 7d69b37261b6..2c32bc994d68 100644 --- a/package/source/manifest/ManifestWriter.cxx +++ b/package/source/manifest/ManifestWriter.cxx @@ -41,6 +41,12 @@ using namespace ::com::sun::star::packages; using namespace ::com::sun::star::xml::sax; using namespace ::com::sun::star::packages::manifest; +#if OSL_DEBUG_LEVEL > 0 +#define THROW_WHERE SAL_WHERE +#else +#define THROW_WHERE "" +#endif + ManifestWriter::ManifestWriter( const Reference < XComponentContext > & xContext ) : m_xContext ( xContext ) { @@ -60,7 +66,7 @@ void SAL_CALL ManifestWriter::writeManifestSequence( const Reference< XOutputStr } catch( SAXException& ) { - throw RuntimeException( OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() ); + throw RuntimeException( THROW_WHERE, uno::Reference< uno::XInterface >() ); } } -- cgit