diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-05-06 09:24:01 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-05-06 09:24:01 +0200 |
commit | 3155a8e60f64f88e8abb5a6877cb2fa55986402e (patch) | |
tree | aed80351d129af1bc26b6443dc285ec16b45b673 | |
parent | 5aa9cfedc3e1e2f191a3fc86342dd851e5ef3d3f (diff) |
xmlsecurity: drop no longer needed RTL_ASCII_USTRINGPARAM macro
Change-Id: Ia08688ef3c262ba4379213231032c73404ae748b
-rw-r--r-- | xmlsecurity/source/helper/xsecctl.hxx | 2 | ||||
-rw-r--r-- | xmlsecurity/source/helper/xsecparser.cxx | 56 | ||||
-rw-r--r-- | xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx | 55 |
3 files changed, 51 insertions, 62 deletions
diff --git a/xmlsecurity/source/helper/xsecctl.hxx b/xmlsecurity/source/helper/xsecctl.hxx index 40f47aceeda7..48f0a7822247 100644 --- a/xmlsecurity/source/helper/xsecctl.hxx +++ b/xmlsecurity/source/helper/xsecctl.hxx @@ -108,8 +108,6 @@ #define INITIALIZED 1 #define FAILTOINITIALIZED 2 -#define RTL_ASCII_USTRINGPARAM( asciiStr ) asciiStr, strlen( asciiStr ), RTL_TEXTENCODING_ASCII_US - // forward declaration class XSecParser; diff --git a/xmlsecurity/source/helper/xsecparser.cxx b/xmlsecurity/source/helper/xsecparser.cxx index 85557a149831..230789cb1cab 100644 --- a/xmlsecurity/source/helper/xsecparser.cxx +++ b/xmlsecurity/source/helper/xsecparser.cxx @@ -27,8 +27,6 @@ namespace cssu = com::sun::star::uno; namespace cssxs = com::sun::star::xml::sax; -#define RTL_ASCII_USTRINGPARAM( asciiStr ) asciiStr, strlen( asciiStr ), RTL_TEXTENCODING_ASCII_US - XSecParser::XSecParser( XSecController* pXSecController, const cssu::Reference< cssxs::XDocumentHandler >& xNextHandler ) @@ -40,13 +38,11 @@ XSecParser::XSecParser( OUString XSecParser::getIdAttr(const cssu::Reference< cssxs::XAttributeList >& xAttribs ) { - OUString ouIdAttr = xAttribs->getValueByName( - OUString(RTL_ASCII_USTRINGPARAM("id"))); + OUString ouIdAttr = xAttribs->getValueByName(OUString("id")); if (ouIdAttr == NULL) { - ouIdAttr = xAttribs->getValueByName( - OUString(RTL_ASCII_USTRINGPARAM("Id"))); + ouIdAttr = xAttribs->getValueByName(OUString("Id")); } return ouIdAttr; @@ -93,7 +89,7 @@ void SAL_CALL XSecParser::startElement( m_pXSecController->collectToVerify( ouIdAttr ); } - if ( aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_SIGNATURE)) ) + if ( aName == TAG_SIGNATURE ) { m_pXSecController->addSignature(); if (ouIdAttr != NULL) @@ -101,9 +97,9 @@ void SAL_CALL XSecParser::startElement( m_pXSecController->setId( ouIdAttr ); } } - else if ( aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_REFERENCE)) ) + else if ( aName == TAG_REFERENCE ) { - OUString ouUri = xAttribs->getValueByName(OUString(RTL_ASCII_USTRINGPARAM(ATTR_URI))); + OUString ouUri = xAttribs->getValueByName(ATTR_URI); DBG_ASSERT( ouUri != NULL, "URI == NULL" ); if (ouUri.startsWith(CHAR_FRAGMENT)) @@ -122,13 +118,13 @@ void SAL_CALL XSecParser::startElement( m_bReferenceUnresolved = true; } } - else if (aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_TRANSFORM))) + else if (aName == TAG_TRANSFORM) { if ( m_bReferenceUnresolved ) { - OUString ouAlgorithm = xAttribs->getValueByName(OUString(RTL_ASCII_USTRINGPARAM(ATTR_ALGORITHM))); + OUString ouAlgorithm = xAttribs->getValueByName(ATTR_ALGORITHM); - if (ouAlgorithm != NULL && ouAlgorithm == OUString(RTL_ASCII_USTRINGPARAM(ALGO_C14N))) + if (ouAlgorithm != NULL && ouAlgorithm == ALGO_C14N) /* * a xml stream */ @@ -138,41 +134,39 @@ void SAL_CALL XSecParser::startElement( } } } - else if (aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_X509ISSUERNAME))) + else if (aName == TAG_X509ISSUERNAME) { m_ouX509IssuerName = OUString(); m_bInX509IssuerName = true; } - else if (aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_X509SERIALNUMBER))) + else if (aName == TAG_X509SERIALNUMBER) { m_ouX509SerialNumber = OUString(); m_bInX509SerialNumber = true; } - else if (aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_X509CERTIFICATE))) + else if (aName == TAG_X509CERTIFICATE) { m_ouX509Certificate = OUString(); m_bInX509Certificate = true; } - else if (aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_SIGNATUREVALUE))) + else if (aName == TAG_SIGNATUREVALUE) { m_ouSignatureValue = OUString(); m_bInSignatureValue = true; } - else if (aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_DIGESTVALUE))) + else if (aName == TAG_DIGESTVALUE) { - m_ouDigestValue = OUString(); + m_ouDigestValue = ""; m_bInDigestValue = true; } - else if ( aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_SIGNATUREPROPERTY)) ) + else if ( aName == TAG_SIGNATUREPROPERTY ) { if (ouIdAttr != NULL) { m_pXSecController->setPropertyId( ouIdAttr ); } } - else if (aName == OUString(RTL_CONSTASCII_USTRINGPARAM(NSTAG_DC)) - +OUString(":") - +OUString(RTL_CONSTASCII_USTRINGPARAM(TAG_DATE))) + else if (aName == NSTAG_DC ":" TAG_DATE) { m_ouDate = OUString(); m_bInDate = true; @@ -204,11 +198,11 @@ void SAL_CALL XSecParser::endElement( const OUString& aName ) { try { - if (aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_DIGESTVALUE))) + if (aName == TAG_DIGESTVALUE) { m_bInDigestValue = false; } - else if ( aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_REFERENCE)) ) + else if ( aName == TAG_REFERENCE ) { if ( m_bReferenceUnresolved ) /* @@ -221,33 +215,31 @@ void SAL_CALL XSecParser::endElement( const OUString& aName ) m_pXSecController->setDigestValue( m_ouDigestValue ); } - else if ( aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_SIGNEDINFO)) ) + else if ( aName == TAG_SIGNEDINFO ) { m_pXSecController->setReferenceCount(); } - else if ( aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_SIGNATUREVALUE)) ) + else if ( aName == TAG_SIGNATUREVALUE ) { m_pXSecController->setSignatureValue( m_ouSignatureValue ); m_bInSignatureValue = false; } - else if (aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_X509ISSUERNAME))) + else if (aName == TAG_X509ISSUERNAME) { m_pXSecController->setX509IssuerName( m_ouX509IssuerName ); m_bInX509IssuerName = false; } - else if (aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_X509SERIALNUMBER))) + else if (aName == TAG_X509SERIALNUMBER) { m_pXSecController->setX509SerialNumber( m_ouX509SerialNumber ); m_bInX509SerialNumber = false; } - else if (aName == OUString(RTL_ASCII_USTRINGPARAM(TAG_X509CERTIFICATE))) + else if (aName == TAG_X509CERTIFICATE) { m_pXSecController->setX509Certificate( m_ouX509Certificate ); m_bInX509Certificate = false; } - else if (aName == OUString(RTL_CONSTASCII_USTRINGPARAM(NSTAG_DC)) - +OUString(":") - +OUString(RTL_CONSTASCII_USTRINGPARAM(TAG_DATE))) + else if (aName == NSTAG_DC ":" TAG_DATE) { m_pXSecController->setDate( m_ouDate ); m_bInDate = false; diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx index 6e5159734367..853bbc63ccad 100644 --- a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx +++ b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx @@ -48,8 +48,7 @@ namespace cssxw = com::sun::star::xml::wrapper; #define STRXMLNS "xmlns" -#define RTL_ASCII_USTRINGPARAM( asciiStr ) asciiStr, strlen( asciiStr ), RTL_TEXTENCODING_ASCII_US -#define RTL_UTF8_USTRINGPARAM( asciiStr ) asciiStr, strlen( asciiStr ), RTL_TEXTENCODING_UTF8 +#define C2U( asciiStr ) asciiStr, strlen( asciiStr ), RTL_TEXTENCODING_UTF8 /* used by the recursiveDelete method */ #define NODE_REMOVED 0 @@ -64,7 +63,7 @@ XMLDocumentWrapper_XmlSecImpl::XMLDocumentWrapper_XmlSecImpl( ) /* * creates the virtual root element */ - saxHelper.startElement(OUString(RTL_UTF8_USTRINGPARAM( "root" )), cssu::Sequence<cssxcsax::XMLAttribute>()); + saxHelper.startElement(OUString(C2U( "root" )), cssu::Sequence<cssxcsax::XMLAttribute>()); m_pRootElement = saxHelper.getCurrentNode(); m_pCurrentElement = m_pRootElement; @@ -221,16 +220,16 @@ void XMLDocumentWrapper_XmlSecImpl::sendStartElement( if (pNsDef->prefix == NULL) { pAttributeList->AddAttribute( - OUString(RTL_UTF8_USTRINGPARAM( STRXMLNS )), - OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)pNsHref ))); + OUString(C2U( STRXMLNS )), + OUString(C2U( (sal_Char*)pNsHref ))); } else { pAttributeList->AddAttribute( - OUString(RTL_UTF8_USTRINGPARAM( STRXMLNS )) - +OUString(RTL_UTF8_USTRINGPARAM( ":" )) - +OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)pNsPrefix )), - OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)pNsHref ))); + OUString(C2U( STRXMLNS )) + +OUString(C2U( ":" )) + +OUString(C2U( (sal_Char*)pNsPrefix )), + OUString(C2U( (sal_Char*)pNsHref ))); } pNsDef = pNsDef->next; @@ -246,18 +245,18 @@ void XMLDocumentWrapper_XmlSecImpl::sendStartElement( OUString ouAttrName; if (pAttrNs == NULL) { - ouAttrName = OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)pAttrName )); + ouAttrName = OUString(C2U( (sal_Char*)pAttrName )); } else { - ouAttrName = OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)pAttrNs->prefix)) - +OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)":" )) - +OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)pAttrName )); + ouAttrName = OUString(C2U( (sal_Char*)pAttrNs->prefix)) + +OUString(C2U( (sal_Char*)":" )) + +OUString(C2U( (sal_Char*)pAttrName )); } pAttributeList->AddAttribute( ouAttrName, - OUString(RTL_UTF8_USTRINGPARAM( (sal_Char*)(pAttr->children->content)))); + OUString(C2U( (sal_Char*)(pAttr->children->content)))); pAttr = pAttr->next; } @@ -266,12 +265,12 @@ void XMLDocumentWrapper_XmlSecImpl::sendStartElement( if (xHandler.is()) { xHandler->startElement( - OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(sNodeName.getStr())) )), + OUString(C2U ( ((sal_Char*)(sNodeName.getStr())) )), xAttrList); } xHandler2->startElement( - OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(sNodeName.getStr())) )), + OUString(C2U ( ((sal_Char*)(sNodeName.getStr())) )), xAttrList); } @@ -313,10 +312,10 @@ void XMLDocumentWrapper_XmlSecImpl::sendEndElement( if (xHandler.is()) { - xHandler->endElement(OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(sNodeName.getStr())) ))); + xHandler->endElement(OUString(C2U ( ((sal_Char*)(sNodeName.getStr())) ))); } - xHandler2->endElement(OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(sNodeName.getStr())) ))); + xHandler2->endElement(OUString(C2U ( ((sal_Char*)(sNodeName.getStr())) ))); } void XMLDocumentWrapper_XmlSecImpl::sendNode( @@ -363,23 +362,23 @@ void XMLDocumentWrapper_XmlSecImpl::sendNode( { if (xHandler.is()) { - xHandler->characters(OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(pNode->content)) ))); + xHandler->characters(OUString(C2U ( ((sal_Char*)(pNode->content)) ))); } - xHandler2->characters(OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(pNode->content)) ))); + xHandler2->characters(OUString(C2U ( ((sal_Char*)(pNode->content)) ))); } else if (type == XML_PI_NODE) { if (xHandler.is()) { xHandler->processingInstruction( - OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(pNode->name)) )), - OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(pNode->content)) ))); + OUString(C2U ( ((sal_Char*)(pNode->name)) )), + OUString(C2U ( ((sal_Char*)(pNode->content)) ))); } xHandler2->processingInstruction( - OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(pNode->name)) )), - OUString(RTL_UTF8_USTRINGPARAM ( ((sal_Char*)(pNode->content)) ))); + OUString(C2U ( ((sal_Char*)(pNode->name)) )), + OUString(C2U ( ((sal_Char*)(pNode->content)) ))); } } @@ -745,7 +744,7 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::removeCurrentElement( ) */ saxHelper.endElement( OUString( - RTL_UTF8_USTRINGPARAM ( + C2U ( (sal_Char*)(pOldCurrentElement->name) ))); m_pCurrentElement = saxHelper.getCurrentNode(); @@ -780,7 +779,7 @@ OUString SAL_CALL XMLDocumentWrapper_XmlSecImpl::getNodeName( const cssu::Refere throw (cssu::RuntimeException) { xmlNodePtr pNode = checkElement(node); - return OUString(RTL_UTF8_USTRINGPARAM ( (sal_Char*)pNode->name )); + return OUString(C2U ( (sal_Char*)pNode->name )); } void SAL_CALL XMLDocumentWrapper_XmlSecImpl::clearUselessData( @@ -1055,7 +1054,7 @@ void SAL_CALL XMLDocumentWrapper_XmlSecImpl::_setDocumentLocator( sal_Int32 /*co OUString XMLDocumentWrapper_XmlSecImpl_getImplementationName () throw (cssu::RuntimeException) { - return OUString ( RTL_ASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) ); + return OUString ( IMPLEMENTATION_NAME ); } sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl_supportsService( const OUString& ServiceName ) @@ -1069,7 +1068,7 @@ cssu::Sequence< OUString > SAL_CALL XMLDocumentWrapper_XmlSecImpl_getSupportedSe { cssu::Sequence < OUString > aRet(1); OUString* pArray = aRet.getArray(); - pArray[0] = OUString ( RTL_ASCII_USTRINGPARAM ( SERVICE_NAME ) ); + pArray[0] = OUString ( SERVICE_NAME ); return aRet; } #undef SERVICE_NAME |