[cpp-opensaml] branch master updated: CPPXT-126 Move Xml Encoding into xmltooling::XMLHelper

Rod Widdowson rdw at steadingsoftware.com
Fri Jan 26 04:51:47 EST 2018


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository cpp-opensaml.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-opensaml.git;a=commit;h=51f2316ed554c487954b3b43478916a6e4fb2f47

The following commit(s) were added to refs/heads/master by this push:
       new  51f2316   CPPXT-126  Move Xml Encoding into xmltooling::XMLHelper
51f2316 is described below

commit 51f2316ed554c487954b3b43478916a6e4fb2f47
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri Jan 26 09:51:38 2018 +0000

    CPPXT-126  Move Xml Encoding into xmltooling::XMLHelper
    
    https://issues.shibboleth.net/jira/browse/CPPXT-126
---
 saml/saml2/metadata/impl/XMLMetadataProvider.cpp | 26 ++----------------------
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/saml/saml2/metadata/impl/XMLMetadataProvider.cpp b/saml/saml2/metadata/impl/XMLMetadataProvider.cpp
index 13d0348..122203e 100644
--- a/saml/saml2/metadata/impl/XMLMetadataProvider.cpp
+++ b/saml/saml2/metadata/impl/XMLMetadataProvider.cpp
@@ -107,28 +107,6 @@ namespace opensaml {
         static const XMLCh minRefreshDelay[] =      UNICODE_LITERAL_15(m,i,n,R,e,f,r,e,s,h,D,e,l,a,y);
         static const XMLCh refreshDelayFactor[] =   UNICODE_LITERAL_18(r,e,f,r,e,s,h,D,e,l,a,y,F,a,c,t,o,r);
 
-        // TODO: need to move this into xmltooling as a utility function
-        static void xml_encode(ostream& os, const char* start)
-        {
-            size_t pos;
-            while (start && *start) {
-                pos = strcspn(start, "\"<>&");
-                if (pos > 0) {
-                    os.write(start,pos);
-                    start += pos;
-                }
-                else {
-                    switch (*start) {
-                        case '"':   os << """;     break;
-                        case '<':   os << "<";       break;
-                        case '>':   os << ">";       break;
-                        case '&':   os << "&";      break;
-                        default:    os << *start;
-                    }
-                    start++;
-                }
-            }
-        }
     };
 };
 
@@ -370,11 +348,11 @@ void XMLMetadataProvider::outputStatus(ostream& os) const
     os << "<MetadataProvider";
 
     if (getId() && *getId()) {
-        os << " id='"; xml_encode(os, getId()); os << "'";
+        os << " id='"; XMLHelper::encode(os, getId()); os << "'";
     }
 
     if (!m_source.empty()) {
-        os << " source='"; xml_encode(os, m_source.c_str()); os << "'";
+        os << " source='";  XMLHelper::encode(os, m_source.c_str()); os << "'";
     }
 
     if (m_lastUpdate > 0) {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list