[Libreoffice-commits] .: xmlsecurity/source

Olivier Hallot ohallot at kemper.freedesktop.org
Sat Jan 28 03:58:42 PST 2012


 xmlsecurity/source/component/documentdigitalsignatures.cxx |   22 ++++++-------
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx     |    6 +--
 xmlsecurity/source/dialogs/resourcemanager.cxx             |   10 ++---
 xmlsecurity/source/helper/documentsignaturehelper.cxx      |    4 +-
 xmlsecurity/source/helper/xmlsignaturehelper2.cxx          |    6 +--
 xmlsecurity/source/helper/xsecctl.cxx                      |   10 ++---
 xmlsecurity/source/xmlsec/nss/nssinitializer.cxx           |    4 +-
 7 files changed, 31 insertions(+), 31 deletions(-)

New commits:
commit 7c4807bfc066772acf162546468afff6cd81a0d1
Author: Olivier Hallot <olivier.hallot at alta.org.br>
Date:   Sat Jan 28 09:56:30 2012 -0200

    Fix for fdo43460 Part LV getLength() to isEmpty()
    
    Part LV
    Modules
    xmlsecurity

diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 8f70cdd..a55a874 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -98,7 +98,7 @@ void DocumentDigitalSignatures::initialize( const Sequence< Any >& aArguments)
     //the Version is supported as of ODF1.2, so for and 1.1 document or older we will receive the
     //an empty string. In this case we set it to ODFVER_010_TEXT. Then we can later check easily
     //if initialize was called. Only then m_sODFVersion.getLength() is greater than 0
-    if (m_sODFVersion.getLength() == 0)
+    if (m_sODFVersion.isEmpty())
         m_sODFVersion = ODFVER_010_TEXT;
 }
 
@@ -107,7 +107,7 @@ sal_Bool DocumentDigitalSignatures::signDocumentContent(
     const Reference< css::io::XStream >& xSignStream)
         throw (RuntimeException)
 {
-    OSL_ENSURE(m_sODFVersion.getLength(), "DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
+    OSL_ENSURE(!m_sODFVersion.isEmpty(), "DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
     return ImplViewSignatures( rxStorage, xSignStream, SignatureModeDocumentContent, false );
 }
 
@@ -116,7 +116,7 @@ DocumentDigitalSignatures::verifyDocumentContentSignatures(
     const Reference< css::embed::XStorage >& rxStorage,
     const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException)
 {
-    OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
+    OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
     return ImplVerifySignatures( rxStorage, xSignInStream, SignatureModeDocumentContent );
 }
 
@@ -124,7 +124,7 @@ void DocumentDigitalSignatures::showDocumentContentSignatures(
     const Reference< css::embed::XStorage >& rxStorage,
     const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException)
 {
-    OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
+    OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
     ImplViewSignatures( rxStorage, xSignInStream, SignatureModeDocumentContent, true );
 }
 
@@ -138,7 +138,7 @@ sal_Bool DocumentDigitalSignatures::signScriptingContent(
     const Reference< css::embed::XStorage >& rxStorage,
     const Reference< css::io::XStream >& xSignStream ) throw (RuntimeException)
 {
-    OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
+    OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
     OSL_ENSURE(m_nArgumentsCount == 2, "DocumentDigitalSignatures: Service was not initialized properly");
     return ImplViewSignatures( rxStorage, xSignStream, SignatureModeMacros, false );
 }
@@ -148,7 +148,7 @@ DocumentDigitalSignatures::verifyScriptingContentSignatures(
     const Reference< css::embed::XStorage >& rxStorage,
     const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException)
 {
-    OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
+    OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
     return ImplVerifySignatures( rxStorage, xSignInStream, SignatureModeMacros );
 }
 
@@ -156,7 +156,7 @@ void DocumentDigitalSignatures::showScriptingContentSignatures(
     const Reference< css::embed::XStorage >& rxStorage,
     const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException)
 {
-    OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
+    OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
     ImplViewSignatures( rxStorage, xSignInStream, SignatureModeMacros, true );
 }
 
@@ -171,7 +171,7 @@ sal_Bool DocumentDigitalSignatures::signPackage(
     const Reference< css::embed::XStorage >& rxStorage,
     const Reference< css::io::XStream >& xSignStream  ) throw (RuntimeException)
 {
-    OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
+    OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
     return ImplViewSignatures( rxStorage, xSignStream, SignatureModePackage, false );
 }
 
@@ -180,7 +180,7 @@ DocumentDigitalSignatures::verifyPackageSignatures(
     const Reference< css::embed::XStorage >& rxStorage,
     const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException)
 {
-    OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
+    OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
     return ImplVerifySignatures( rxStorage, xSignInStream, SignatureModePackage );
 }
 
@@ -188,7 +188,7 @@ void DocumentDigitalSignatures::showPackageSignatures(
     const Reference< css::embed::XStorage >& rxStorage,
     const Reference< css::io::XInputStream >& xSignInStream ) throw (RuntimeException)
 {
-    OSL_ENSURE(m_sODFVersion.getLength(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
+    OSL_ENSURE(!m_sODFVersion.isEmpty(),"DocumentDigitalSignatures: ODF Version not set, assuming minimum 1.2");
     ImplViewSignatures( rxStorage, xSignInStream, SignatureModePackage, true );
 }
 
@@ -311,7 +311,7 @@ DocumentDigitalSignatures::ImplVerifySignatures(
             const SignatureInformation& rInfo = aSignInfos[n];
             css::security::DocumentSignatureInformation& rSigInfo = arInfos[n];
 
-            if (rInfo.ouX509Certificate.getLength())
+            if (!rInfo.ouX509Certificate.isEmpty())
                rSigInfo.Signer = xSecEnv->createCertificateFromAscii( rInfo.ouX509Certificate ) ;
             if (!rSigInfo.Signer.is())
                 rSigInfo.Signer = xSecEnv->getCertificate( rInfo.ouX509IssuerName, xSerialNumberAdapter->toSequence( rInfo.ouX509SerialNumber ) );
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 5f2870f..7a8a2d4 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -441,7 +441,7 @@ IMPL_LINK( DigitalSignaturesDialog, AddButtonHdl, Button*, EMPTYARG )
                 return -1;
             }
             rtl::OUString aCertSerial = xSerialNumberAdapter->toString( xCert->getSerialNumber() );
-            if ( !aCertSerial.getLength() )
+            if ( aCertSerial.isEmpty() )
             {
                 OSL_FAIL( "Error in Certificate, problem with serial number!" );
                 return -1;
@@ -602,7 +602,7 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
 
             const SignatureInformation& rInfo = maCurrentSignatureInformations[n];
             //First we try to get the certificate which is embedded in the XML Signature
-            if (rInfo.ouX509Certificate.getLength())
+            if (!rInfo.ouX509Certificate.isEmpty())
                 xCert = xSecEnv->createCertificateFromAscii(rInfo.ouX509Certificate);
             else {
                 //There must be an embedded certificate because we use it to get the
@@ -752,7 +752,7 @@ void DigitalSignaturesDialog::ImplShowSignaturesDetails()
             ::com::sun::star::security::SerialNumberAdapter::create(mxCtx);
         // Use Certificate from doc, not from key store
         uno::Reference< dcss::security::XCertificate > xCert;
-        if (rInfo.ouX509Certificate.getLength())
+        if (!rInfo.ouX509Certificate.isEmpty())
             xCert = xSecEnv->createCertificateFromAscii(rInfo.ouX509Certificate);
         //fallback if no certificate is embedded, get if from store
         if (!xCert.is())
diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx b/xmlsecurity/source/dialogs/resourcemanager.cxx
index becb5af..79ca62a 100644
--- a/xmlsecurity/source/dialogs/resourcemanager.cxx
+++ b/xmlsecurity/source/dialogs/resourcemanager.cxx
@@ -195,7 +195,7 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString)
                 //then we have reached the end of the value
                 if (!bInValue)
                 {
-                    OSL_ASSERT(sType.getLength());
+                    OSL_ASSERT(!sType.isEmpty());
                     retVal.push_back(make_pair(sType, sbufValue.makeStringAndClear()));
                     sType = OUString();
                     //The next char is the start of the new type
@@ -218,7 +218,7 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString)
         }
         if (sbufValue.getLength())
         {
-            OSL_ASSERT(sType.getLength());
+            OSL_ASSERT(!sType.isEmpty());
             retVal.push_back(make_pair(sType, sbufValue.makeStringAndClear()));
         }
         return retVal;
@@ -290,7 +290,7 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString)
                 //then we have reached the end of the value
                 if (!bInValue)
                 {
-                    OSL_ASSERT(sType.getLength());
+                    OSL_ASSERT(!sType.isEmpty());
                     retVal.push_back(make_pair(sType, sbufValue.makeStringAndClear()));
                     sType = OUString();
                     //The next char is the start of the new type
@@ -316,7 +316,7 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString)
         }
         if (sbufValue.getLength())
         {
-            OSL_ASSERT(sType.getLength());
+            OSL_ASSERT(!sType.isEmpty());
             retVal.push_back(make_pair(sType, sbufValue.makeStringAndClear()));
         }
         return retVal;
@@ -342,7 +342,7 @@ vector< pair< OUString, OUString> > parseDN(const OUString& rRawString)
                     break;
                 }
             }
-            if (retVal.getLength())
+            if (!retVal.isEmpty())
                 break;
         }
         return retVal;
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index f37dfaa..7523bf1 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -113,7 +113,7 @@ void ImplFillElementList(
             ::rtl::OUString sEncName = ::rtl::Uri::encode(
                 pNames[n], rtl_UriCharClassRelSegment,
                 rtl_UriEncodeStrict, RTL_TEXTENCODING_UTF8);
-            if (sEncName.getLength() == 0 && pNames[n].getLength() != 0)
+            if (sEncName.isEmpty() && !pNames[n].isEmpty())
                 throw css::uno::Exception(::rtl::OUString(
                 RTL_CONSTASCII_USTRINGPARAM("Failed to encode element name of XStorage")), 0);
 
@@ -168,7 +168,7 @@ DocumentSignatureAlgorithm
 DocumentSignatureHelper::getDocumentAlgorithm(
     const ::rtl::OUString & sODFVersion, const SignatureInformation & sigInfo)
 {
-    OSL_ASSERT(sODFVersion.getLength());
+    OSL_ASSERT(!sODFVersion.isEmpty());
     DocumentSignatureAlgorithm mode = OOo3_2Document;
     if (!isOOo3_2_Signature(sigInfo))
     {
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper2.cxx b/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
index bcb183c..2a03439 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper2.cxx
@@ -193,7 +193,7 @@ uno::Reference< io::XInputStream > SAL_CALL UriBindingHelper::getUriBinding( con
 
 uno::Reference < io::XInputStream > UriBindingHelper::OpenInputStream( const uno::Reference < embed::XStorage >& rxStore, const rtl::OUString& rURI )
 {
-    OSL_ASSERT(rURI.getLength());
+    OSL_ASSERT(!rURI.isEmpty());
     uno::Reference < io::XInputStream > xInStream;
 
     sal_Int32 nSepPos = rURI.indexOf( '/' );
@@ -203,7 +203,7 @@ uno::Reference < io::XInputStream > UriBindingHelper::OpenInputStream( const uno
         // MBA with think about a better API...
         const ::rtl::OUString sName = ::rtl::Uri::decode(
             rURI, rtl_UriDecodeStrict, rtl_UriCharClassRelSegment);
-        if (sName.getLength() == 0 && rURI.getLength() != 0)
+        if (sName.isEmpty() && !rURI.isEmpty())
             throw uno::Exception(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
             "Could not decode URI for stream element.")), 0);
 
@@ -217,7 +217,7 @@ uno::Reference < io::XInputStream > UriBindingHelper::OpenInputStream( const uno
     {
         const rtl::OUString aStoreName = ::rtl::Uri::decode(
             rURI.copy( 0, nSepPos ), rtl_UriDecodeStrict, rtl_UriCharClassRelSegment);
-        if (aStoreName.getLength() == 0 && rURI.getLength() != 0)
+        if (aStoreName.isEmpty() && !rURI.isEmpty())
             throw uno::Exception(
             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
             "Could not decode URI for stream element.")), 0);
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx
index 8804c34..fdec39e 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -220,7 +220,7 @@ sal_Bool XSecController::convertDateTime( com::sun::star::util::DateTime& rDateT
             nDateTokens++;
         pStr++;
     }
-    if ( nDateTokens > 3 || aDateStr.getLength() == 0 )
+    if ( nDateTokens > 3 || aDateStr.isEmpty() )
         bSuccess = sal_False;
     else
     {
@@ -235,7 +235,7 @@ sal_Bool XSecController::convertDateTime( com::sun::star::util::DateTime& rDateT
                 bSuccess = sal_False;
     }
 
-    if ( aTimeStr.getLength() > 0 )           // time is optional
+    if ( !aTimeStr.isEmpty() )           // time is optional
     {
         pStr = aTimeStr.getStr();
         sal_Int32 nTimeTokens = 1;
@@ -1008,7 +1008,7 @@ void XSecController::exportSignature(
         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ATTR_XMLNS)),
         rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(NS_XMLDSIG)));
 
-    if (signatureInfo.ouSignatureId.getLength()>0)
+    if (!signatureInfo.ouSignatureId.isEmpty())
     {
         pAttributeList->AddAttribute(
             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ATTR_ID)),
@@ -1151,7 +1151,7 @@ void XSecController::exportSignature(
                 xDocumentHandler->endElement( tag_X509IssuerSerial );
 
                 /* Write X509Certificate element */
-                if (signatureInfo.ouX509Certificate.getLength()>0)
+                if (!signatureInfo.ouX509Certificate.isEmpty())
                 {
                     xDocumentHandler->startElement(
                         tag_X509Certificate,
@@ -1210,7 +1210,7 @@ void XSecController::exportSignature(
                     //milli seconds (document was signed by an application other than OOo)
                     //and the converted time is written back, then the string looks different
                     //and the signature is broken.
-                    if (signatureInfo.ouDateTime.getLength() > 0)
+                    if (!signatureInfo.ouDateTime.isEmpty())
                         buffer = signatureInfo.ouDateTime;
                     else
                         convertDateTime( buffer, signatureInfo.stDateTime );
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
index 0e2553d..8fe4441 100644
--- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -208,7 +208,7 @@ void deleteRootsModule()
             {
                 ::rtl::OUString profile = xMozillaBootstrap->getDefaultProfile(productTypes[i]);
 
-                if (profile != NULL && profile.getLength()>0)
+                if (profile != NULL && !profile.isEmpty())
                 {
                     ::rtl::OUString sProfilePath = xMozillaBootstrap->getProfilePath( productTypes[i], profile );
                     sResult = ::rtl::OUStringToOString( sProfilePath, osl_getThreadTextEncoding() );
@@ -261,7 +261,7 @@ bool nsscrypto_initialize( const css::uno::Reference< css::lang::XMultiServiceFa
     PR_Init( PR_USER_THREAD, PR_PRIORITY_NORMAL, 1 ) ;
 
     // there might be no profile
-    if ( sCertDir.getLength() > 0 )
+    if ( !sCertDir.isEmpty() )
     {
         if( NSS_InitReadWrite( sCertDir.getStr() ) != SECSuccess )
         {


More information about the Libreoffice-commits mailing list