summaryrefslogtreecommitdiffstats
path: root/xmlsecurity/source/helper/xsecparser.cxx
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2016-10-28 01:02:08 +0300
committerTor Lillqvist <tml@collabora.com>2016-10-28 08:27:43 +0300
commitd1111863835fe25edb6e15961d41fa2305e9b734 (patch)
tree0df568f15e85a2f46144141cdcaef039f6db5fb9 /xmlsecurity/source/helper/xsecparser.cxx
parentUpdated core (diff)
downloadcore-d1111863835fe25edb6e15961d41fa2305e9b734.tar.gz
core-d1111863835fe25edb6e15961d41fa2305e9b734.zip
Bin unnecessary TAG_ and ATTR_ macros and expand in-place
They just make grepping harder, and don't really avoid a risk of mistyping. For instance, there were both TAG_TRANSFORM and TAG_TRANSFORMS (with values "Transform" and "Transforms"), so if you think you are likely to misspell "Transforms" as "Transform", you are as likely to misspell TAG_TRANSFORMS as TAG_TRANSFORM. Typos affecting generated XML should be catched by unit tests anyway. Some of the (newer) code here is already in this style, using string literals directly for tags and attributes, so this change just makes the style more uniform. I did not touch the macros that have long URIs as value. For them there is some usefulness in having the shorter macros in the code. (But the names of the ALGO_* macros are not consistently constructed from the URIs.) Change-Id: I9130395f45fafc13fb2a6ac47e98177647e27cf9
Diffstat (limited to 'xmlsecurity/source/helper/xsecparser.cxx')
-rw-r--r--xmlsecurity/source/helper/xsecparser.cxx44
1 files changed, 22 insertions, 22 deletions
diff --git a/xmlsecurity/source/helper/xsecparser.cxx b/xmlsecurity/source/helper/xsecparser.cxx
index cd9937623246..ddc689a63793 100644
--- a/xmlsecurity/source/helper/xsecparser.cxx
+++ b/xmlsecurity/source/helper/xsecparser.cxx
@@ -96,7 +96,7 @@ void SAL_CALL XSecParser::startElement(
m_pXSecController->collectToVerify( ouIdAttr );
}
- if ( aName == TAG_SIGNATURE )
+ if ( aName == "Signature" )
{
m_pXSecController->addSignature();
if (ouIdAttr != nullptr)
@@ -104,9 +104,9 @@ void SAL_CALL XSecParser::startElement(
m_pXSecController->setId( ouIdAttr );
}
}
- else if ( aName == TAG_REFERENCE )
+ else if ( aName == "Reference" )
{
- OUString ouUri = xAttribs->getValueByName(ATTR_URI);
+ OUString ouUri = xAttribs->getValueByName("URI");
SAL_WARN_IF( ouUri == nullptr, "xmlsecurity.helper", "URI == NULL" );
if (ouUri.startsWith("#"))
@@ -125,11 +125,11 @@ void SAL_CALL XSecParser::startElement(
m_bReferenceUnresolved = true;
}
}
- else if (aName == TAG_TRANSFORM)
+ else if (aName == "Transform")
{
if ( m_bReferenceUnresolved )
{
- OUString ouAlgorithm = xAttribs->getValueByName(ATTR_ALGORITHM);
+ OUString ouAlgorithm = xAttribs->getValueByName("Algorithm");
if (ouAlgorithm != nullptr && ouAlgorithm == ALGO_C14N)
/*
@@ -141,44 +141,44 @@ void SAL_CALL XSecParser::startElement(
}
}
}
- else if (aName == TAG_X509ISSUERNAME)
+ else if (aName == "X509IssuerName")
{
m_ouX509IssuerName.clear();
m_bInX509IssuerName = true;
}
- else if (aName == TAG_X509SERIALNUMBER)
+ else if (aName == "X509SerialNumber")
{
m_ouX509SerialNumber.clear();
m_bInX509SerialNumber = true;
}
- else if (aName == TAG_X509CERTIFICATE)
+ else if (aName == "X509Certificate")
{
m_ouX509Certificate.clear();
m_bInX509Certificate = true;
}
- else if (aName == TAG_SIGNATUREVALUE)
+ else if (aName == "SignatureValue")
{
m_ouSignatureValue.clear();
m_bInSignatureValue = true;
}
- else if (aName == TAG_DIGESTVALUE)
+ else if (aName == "DigestValue")
{
m_ouDigestValue.clear();
m_bInDigestValue = true;
}
- else if ( aName == TAG_SIGNATUREPROPERTY )
+ else if ( aName == "SignatureProperty" )
{
if (ouIdAttr != nullptr)
{
m_pXSecController->setPropertyId( ouIdAttr );
}
}
- else if (aName == NSTAG_DC ":" TAG_DATE)
+ else if (aName == "dc:date")
{
m_ouDate.clear();
m_bInDate = true;
}
- else if (aName == NSTAG_DC ":" TAG_DESCRIPTION)
+ else if (aName == "dc:description")
{
m_ouDescription.clear();
m_bInDescription = true;
@@ -209,11 +209,11 @@ void SAL_CALL XSecParser::endElement( const OUString& aName )
{
try
{
- if (aName == TAG_DIGESTVALUE)
+ if (aName == "DigestValue")
{
m_bInDigestValue = false;
}
- else if ( aName == TAG_REFERENCE )
+ else if ( aName == "Reference" )
{
if ( m_bReferenceUnresolved )
/*
@@ -226,36 +226,36 @@ void SAL_CALL XSecParser::endElement( const OUString& aName )
m_pXSecController->setDigestValue( m_ouDigestValue );
}
- else if ( aName == TAG_SIGNEDINFO )
+ else if ( aName == "SignedInfo" )
{
m_pXSecController->setReferenceCount();
}
- else if ( aName == TAG_SIGNATUREVALUE )
+ else if ( aName == "SignatureValue" )
{
m_pXSecController->setSignatureValue( m_ouSignatureValue );
m_bInSignatureValue = false;
}
- else if (aName == TAG_X509ISSUERNAME)
+ else if (aName == "X509IssuerName")
{
m_pXSecController->setX509IssuerName( m_ouX509IssuerName );
m_bInX509IssuerName = false;
}
- else if (aName == TAG_X509SERIALNUMBER)
+ else if (aName == "X509SerialNumber")
{
m_pXSecController->setX509SerialNumber( m_ouX509SerialNumber );
m_bInX509SerialNumber = false;
}
- else if (aName == TAG_X509CERTIFICATE)
+ else if (aName == "X509Certificate")
{
m_pXSecController->setX509Certificate( m_ouX509Certificate );
m_bInX509Certificate = false;
}
- else if (aName == NSTAG_DC ":" TAG_DATE)
+ else if (aName == "dc:date")
{
m_pXSecController->setDate( m_ouDate );
m_bInDate = false;
}
- else if (aName == NSTAG_DC ":" TAG_DESCRIPTION)
+ else if (aName == "dc:description")
{
m_pXSecController->setDescription( m_ouDescription );
m_bInDescription = false;