[PATCH 12/12] RTL_CONSTASCII_USTRINGPARAM in components - xmlsecurity- helpd

pjacquod pjacquod at alumni.ethz.ch
Tue Nov 16 11:26:46 PST 2010


remove rtl::oustring::createfromascii("foo") and code clean up:
suppression of commented out code
---
 xmlsecurity/source/helper/xmlsignaturehelper.cxx |   37 +---------
 xmlsecurity/source/helper/xsecctl.cxx            |   81 +---------------------
 xmlsecurity/source/helper/xsecctl.hxx            |   17 -----
 xmlsecurity/source/helper/xsecparser.cxx         |   33 ++-------
 xmlsecurity/source/helper/xsecparser.hxx         |    2 -
 xmlsecurity/source/helper/xsecverify.cxx         |    8 --
 6 files changed, 9 insertions(+), 169 deletions(-)

diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index b46d8ba..baeee83 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -170,11 +170,6 @@ void XMLSignatureHelper::SetX509Certificate(
 
 void XMLSignatureHelper::SetDateTime( sal_Int32 nSecurityId, const Date& rDate, const Time& rTime )
 {
-    /*
-    rtl::OUString aDate = String::CreateFromInt32( rDate.GetDate() );
-    rtl::OUString aTime = String::CreateFromInt32( rTime.GetTime() );
-    mpXSecController->setDateTime( nSecurityId, aDate, aTime );
-    */
     ::com::sun::star::util::DateTime stDateTime;
     stDateTime.HundredthSeconds = (::sal_uInt16)rTime.Get100Sec();
     stDateTime.Seconds = (::sal_uInt16)rTime.GetSec();
@@ -261,16 +256,10 @@ bool XMLSignatureHelper::CreateAndWriteSignature( const uno::Reference< xml::sax
     /*
      * create a signature listener
      */
-/*
-    ImplXMLSignatureListener* pSignatureListener = new ImplXMLSignatureListener( 
-                                                    LINK( this, XMLSignatureHelper, SignatureCreationResultListener ),
-                                                    LINK( this, XMLSignatureHelper, SignatureVerifyResultListener ),
-                                                    LINK( this, XMLSignatureHelper, StartVerifySignatureElement ) );
-*/
+
     /*
      * configure the signature creation listener
      */
-    //mpXSecController->setSignatureCreationResultListener( pSignatureListener );
 
     /*
      * write signatures
@@ -283,7 +272,6 @@ bool XMLSignatureHelper::CreateAndWriteSignature( const uno::Reference< xml::sax
     /*
      * clear up the signature creation listener
      */
-    //mpXSecController->setSignatureCreationResultListener( NULL );
     
     return !mbError;
 }
@@ -310,7 +298,6 @@ bool XMLSignatureHelper::ReadAndVerifySignature( const com::sun::star::uno::Refe
      * prepare ParserInputSrouce 
      */
     xml::sax::InputSource aParserInput;
-    // aParserInput.sSystemId = ouName;
     aParserInput.aInputStream = xInputStream;
 
     /*
@@ -319,7 +306,7 @@ bool XMLSignatureHelper::ReadAndVerifySignature( const com::sun::star::uno::Refe
     uno::Reference< lang::XMultiComponentFactory > xMCF( mxCtx->getServiceManager() );
     uno::Reference< xml::sax::XParser > xParser(
         xMCF->createInstanceWithContext(
-            rtl::OUString::createFromAscii("com.sun.star.xml.sax.Parser"), mxCtx ),
+            rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ), mxCtx ),
         uno::UNO_QUERY );
 
     DBG_ASSERT( xParser.is(), "Can't create parser" );
@@ -341,7 +328,6 @@ bool XMLSignatureHelper::ReadAndVerifySignature( const com::sun::star::uno::Refe
     /*
      * configure the signature verify listener
      */
-    //mpXSecController->setSignatureVerifyResultListener( pSignatureListener );
     
     /*
      * setup the connection:
@@ -382,7 +368,6 @@ bool XMLSignatureHelper::ReadAndVerifySignature( const com::sun::star::uno::Refe
     /*
      * clear up the signature verify listener
      */
-    //mpXSecController->setSignatureVerifyResultListener( NULL );
 
     /*
      * release the signature reader
@@ -418,24 +403,6 @@ sal_Int32 XMLSignatureHelper::GetSecurityEnvironmentNumber()
 }
 
 
-/*
-void XMLSignatureHelper::createSecurityContext( rtl::OUString tokenPath )
-{
-    if ( !mxSEInitializer.is() )
-        ImplCreateSEInitializer();
-
-    mxSecurityContext = mxSEInitializer->createSecurityContext(tokenPath);
-}
-
-void XMLSignatureHelper::freeSecurityContext()
-{
-    if ( !mxSEInitializer.is() )
-        ImplCreateSEInitializer();
-
-    mxSEInitializer->freeSecurityContext( mxSecurityContext );
-}
-*/
-
 IMPL_LINK( XMLSignatureHelper, SignatureCreationResultListener, XMLSignatureCreationResult*, pResult )
 {
     maCreationResults.insert( maCreationResults.begin() + maCreationResults.size(), *pResult );
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx
index 864d6de..33c7fde 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -1365,46 +1365,6 @@ SignatureInformations XSecController::getSignatureInformations() const
 /*
  * XFastPropertySet 
  */
-/*
-void SAL_CALL XSecController::setFastPropertyValue(
-    sal_Int32 nHandle,
-    const cssu::Any& aValue )
-    throw (	cssb::UnknownPropertyException,
-        cssb::PropertyVetoException,
-        cssl::IllegalArgumentException,
-        cssl::WrappedTargetException,
-        cssu::RuntimeException)
-{
-    sal_Int32 nIndex = getFastPropertyIndex(nHandle);
-    if (nIndex == -1)
-    {
-        m_vFastPropertyIndexs.push_back( nHandle );
-        m_vFastPropertyValues.push_back( aValue );
-    }
-    else
-    {
-        m_vFastPropertyValues[nIndex] = aValue;
-    }
-}
-    
-cssu::Any SAL_CALL XSecController::getFastPropertyValue(
-    sal_Int32 nHandle )
-    throw (
-        cssb::UnknownPropertyException,
-        cssl::WrappedTargetException,
-        cssu::RuntimeException)
-{
-    cssu::Any aValue;
-
-    sal_Int32 nIndex = getFastPropertyIndex(nHandle);
-    if (nIndex != -1)
-    {
-        aValue = m_vFastPropertyValues[nIndex];
-    }
-    
-    return aValue;
-}
-*/
 
 /*
  * XSAXEventKeeperStatusChangeListener
@@ -1413,13 +1373,6 @@ cssu::Any SAL_CALL XSecController::getFastPropertyValue(
 void SAL_CALL XSecController::blockingStatusChanged( sal_Bool isBlocking )
     throw (cssu::RuntimeException)
 {
-    /*
-    showMessageBox( rtl::OUString::createFromAscii((isBlocking?
-                        "Blocking Status => TRUE":
-                        "Blocking Status => FALSE")),
-            rtl::OUString::createFromAscii("SAXEventKeeper Status"));
-    */
-
     this->m_bIsBlocking = isBlocking;
     checkChainingStatus();
 }
@@ -1428,13 +1381,6 @@ void SAL_CALL XSecController::collectionStatusChanged(
     sal_Bool isInsideCollectedElement )
     throw (cssu::RuntimeException)
 {
-    /*
-    showMessageBox(	rtl::OUString::createFromAscii((isInsideCollectedElement?
-                        "Collection Status => TRUE":
-                        "Collection Status => FALSE")),
-            rtl::OUString::createFromAscii("SAXEventKeeper Status"));
-    */
-        
     this->m_bIsCollectingElement = isInsideCollectedElement;
     checkChainingStatus();
 }
@@ -1442,12 +1388,7 @@ void SAL_CALL XSecController::collectionStatusChanged(
 void SAL_CALL XSecController::bufferStatusChanged( sal_Bool /*isBufferEmpty*/)
     throw (cssu::RuntimeException)
 {
-    /*
-    showMessageBox(	rtl::OUString::createFromAscii((isBufferEmpty?
-                        "Buffer Empty => TRUE":
-                        "Buffer Empty => FALSE")),
-            rtl::OUString::createFromAscii("SAXEventKeeper Status"));
-    */
+
 }
 
 /*
@@ -1461,16 +1402,6 @@ void SAL_CALL XSecController::signatureCreated( sal_Int32 securityId, com::sun::
 
     SignatureInformation& signatureInfor = m_vInternalSignatureInformations[index].signatureInfor;
     
-    /*
-    if (nResult == cssxc::sax::SignatureCreationResult_CREATIONSUCCEED)
-    {
-        signatureInfor.nStatus = STATUS_CREATION_SUCCEED;
-    }
-    else
-    {
-        signatureInfor.nStatus = STATUS_CREATION_FAIL;
-    } 
-    */
     signatureInfor.nStatus = nResult;
 }
 
@@ -1485,16 +1416,6 @@ void SAL_CALL XSecController::signatureVerified( sal_Int32 securityId, com::sun:
 
     SignatureInformation& signatureInfor = m_vInternalSignatureInformations[index].signatureInfor;
     
-    /*
-    if (nResult == cssxc::sax::SignatureVerifyResult_VERIFYSUCCEED)
-    {
-        signatureInfor.nStatus = STATUS_VERIFY_SUCCEED;
-    }
-    else
-    {
-        signatureInfor.nStatus = STATUS_VERIFY_FAIL;
-    }
-    */
     signatureInfor.nStatus = nResult;
 }
 
diff --git a/xmlsecurity/source/helper/xsecctl.hxx b/xmlsecurity/source/helper/xsecctl.hxx
index 73d6e0d..5d6135c 100644
--- a/xmlsecurity/source/helper/xsecctl.hxx
+++ b/xmlsecurity/source/helper/xsecctl.hxx
@@ -532,23 +532,6 @@ public:
     /*
      * XFastPropertySet
      */
-    /*
-    virtual void SAL_CALL setFastPropertyValue(
-        sal_Int32 nHandle,
-        const com::sun::star::uno::Any& aValue )
-        throw (
-            com::sun::star::beans::UnknownPropertyException,
-            com::sun::star::beans::PropertyVetoException,
-            com::sun::star::lang::IllegalArgumentException,
-            com::sun::star::lang::WrappedTargetException,
-            com::sun::star::uno::RuntimeException);
-    virtual com::sun::star::uno::Any SAL_CALL getFastPropertyValue(
-        sal_Int32 nHandle )
-        throw (
-            com::sun::star::beans::UnknownPropertyException,
-            com::sun::star::lang::WrappedTargetException,
-            com::sun::star::uno::RuntimeException);
-    */
 
     /*
      * XSAXEventKeeperStatusChangeListener
diff --git a/xmlsecurity/source/helper/xsecparser.cxx b/xmlsecurity/source/helper/xsecparser.cxx
index 57b559e..d2d95f1 100644
--- a/xmlsecurity/source/helper/xsecparser.cxx
+++ b/xmlsecurity/source/helper/xsecparser.cxx
@@ -75,7 +75,6 @@ void SAL_CALL XSecParser::startDocument(  )
     m_bInSignatureValue = false;
     m_bInDigestValue = false;
     m_bInDate = false;
-    //m_bInTime = false;
     
     if (m_xNextHandler.is())
     {
@@ -152,27 +151,27 @@ void SAL_CALL XSecParser::startElement(
             }
             else if (aName == rtl::OUString(RTL_ASCII_USTRINGPARAM(TAG_X509ISSUERNAME)))
             {
-            m_ouX509IssuerName = rtl::OUString::createFromAscii("");
+            m_ouX509IssuerName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("") );
             m_bInX509IssuerName = true;
             }
             else if (aName == rtl::OUString(RTL_ASCII_USTRINGPARAM(TAG_X509SERIALNUMBER)))
             {
-            m_ouX509SerialNumber = rtl::OUString::createFromAscii("");
+            m_ouX509SerialNumber = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("") );
             m_bInX509SerialNumber = true;
             }
             else if (aName == rtl::OUString(RTL_ASCII_USTRINGPARAM(TAG_X509CERTIFICATE)))
             {
-            m_ouX509Certificate = rtl::OUString::createFromAscii("");
+            m_ouX509Certificate = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("") );
             m_bInX509Certificate = true;
             }
             else if (aName == rtl::OUString(RTL_ASCII_USTRINGPARAM(TAG_SIGNATUREVALUE)))
             {
-            m_ouSignatureValue = rtl::OUString::createFromAscii("");
+            m_ouSignatureValue = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("") );
                 m_bInSignatureValue = true;
             }
             else if (aName == rtl::OUString(RTL_ASCII_USTRINGPARAM(TAG_DIGESTVALUE)))
             {
-            m_ouDigestValue = rtl::OUString::createFromAscii("");
+            m_ouDigestValue = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("") );
                 m_bInDigestValue = true;
             }
             else if ( aName == rtl::OUString(RTL_ASCII_USTRINGPARAM(TAG_SIGNATUREPROPERTY)) )
@@ -186,16 +185,9 @@ void SAL_CALL XSecParser::startElement(
                         +rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":"))
                         +rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(TAG_DATE)))
             {
-            m_ouDate = rtl::OUString::createFromAscii("");
+            m_ouDate = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("") );
                 m_bInDate = true;
             }
-            /*
-            else if (aName == rtl::OUString(RTL_ASCII_USTRINGPARAM(TAG_TIME)))
-            {
-            m_ouTime = rtl::OUString::createFromAscii("");
-                m_bInTime = true;
-            }
-            */
             
         if (m_xNextHandler.is())
         {
@@ -271,13 +263,6 @@ void SAL_CALL XSecParser::endElement( const rtl::OUString& aName )
             m_pXSecController->setDate( m_ouDate );
                 m_bInDate = false;
         }
-        /*
-        else if ( aName == rtl::OUString(RTL_ASCII_USTRINGPARAM(TAG_TIME)) )
-        {
-            m_pXSecController->setTime( m_ouTime );
-                m_bInTime = false;
-        }
-        */
 
         if (m_xNextHandler.is())
         {
@@ -327,12 +312,6 @@ void SAL_CALL XSecParser::characters( const rtl::OUString& aChars )
     {
         m_ouDate += aChars;
     }
-    /*
-    else if (m_bInTime)
-    {
-        m_ouTime += aChars;
-    } 
-    */
     
     if (m_xNextHandler.is())
     {
diff --git a/xmlsecurity/source/helper/xsecparser.hxx b/xmlsecurity/source/helper/xsecparser.hxx
index 931f098..558fc28 100644
--- a/xmlsecurity/source/helper/xsecparser.hxx
+++ b/xmlsecurity/source/helper/xsecparser.hxx
@@ -76,7 +76,6 @@ private:
     rtl::OUString m_ouDigestValue;
     rtl::OUString m_ouSignatureValue;
     rtl::OUString m_ouDate;
-    //rtl::OUString m_ouTime;
 
     /*
      * whether inside a particular element
@@ -87,7 +86,6 @@ private:
     bool m_bInDigestValue;
     bool m_bInSignatureValue;
     bool m_bInDate;
-    //bool m_bInTime;
     
     /*
      * the XSecController collaborating with XSecParser
diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx
index 000f0d4..a55e4fc 100644
--- a/xmlsecurity/source/helper/xsecverify.cxx
+++ b/xmlsecurity/source/helper/xsecverify.cxx
@@ -220,14 +220,6 @@ void XSecController::setDate( rtl::OUString& ouDate )
     isi.signatureInfor.ouDateTime = ouDate;
 }
 
-/*
-void XSecController::setTime( rtl::OUString& ouTime )
-{
-    InternalSignatureInformation &isi = m_vInternalSignatureInformations[m_vInternalSignatureInformations.size()-1];
-    isi.signatureInfor.ouTime = ouTime;
-}
-*/
-
 void XSecController::setId( rtl::OUString& ouId )
 {
     InternalSignatureInformation &isi = m_vInternalSignatureInformations[m_vInternalSignatureInformations.size()-1];
-- 
1.7.1


--------------070404010103070100050404--


More information about the LibreOffice mailing list