https://issues.shibboleth.net/jira/browse/SSPCPP-392
authorScott Cantor <cantor.2@osu.edu>
Mon, 12 Sep 2011 15:52:18 +0000 (15:52 +0000)
committerScott Cantor <cantor.2@osu.edu>
Mon, 12 Sep 2011 15:52:18 +0000 (15:52 +0000)
xmltooling/XMLObjectBuilder.cpp
xmltooling/base.h
xmltooling/util/DateTime.cpp
xmltooling/util/XMLHelper.h

index 052f80f..ec08c16 100644 (file)
@@ -55,8 +55,9 @@ XMLObject* XMLObjectBuilder::buildFromQName(const QName& q) const
 
 XMLObject* XMLObjectBuilder::buildFromElement(DOMElement* element, bool bindDocument) const
 {
+    auto_ptr<QName> schemaType(XMLHelper::getXSIType(element));
     auto_ptr<XMLObject> ret(
-        buildObject(element->getNamespaceURI(),element->getLocalName(),element->getPrefix(),XMLHelper::getXSIType(element))
+        buildObject(element->getNamespaceURI(),element->getLocalName(),element->getPrefix(),schemaType.get())
         );
     ret->unmarshall(element,bindDocument);
     return ret.release();
index 0626e81..f160c72 100644 (file)
  */
 #define PROC_QNAME_ATTRIB(proper,ucase,namespaceURI) \
     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
-        set##proper(XMLHelper::getAttributeValueAsQName(attribute)); \
+        auto_ptr<xmltooling::QName> q(XMLHelper::getAttributeValueAsQName(attribute)); \
+        set##proper(q.get()); \
         return; \
     }
 
index 79011ff..64fe2eb 100644 (file)
@@ -31,6 +31,7 @@
  */
 
 #include "internal.h"
+#include "unicode.h"
 #include "util/DateTime.h"
 
 #ifndef WIN32
@@ -1315,18 +1316,17 @@ double DateTime::parseMiliSecond(const int start, const int end) const
     XMLString::copyNString(miliSecData, &(fBuffer[start-1]), miliSecLen);
     *(miliSecData + miliSecLen) = chNull;
 
-    char *nptr = XMLString::transcode(miliSecData);
-    ArrayJanitor<char> jan(nptr);
-    size_t   strLen = strlen(nptr);
+    auto_ptr_char nptr(miliSecData);
+    size_t   strLen = strlen(nptr.get());
     char *endptr = 0;
     errno = 0;
 
     //printf("milisec=<%s>\n", nptr);
 
-    double retVal = strtod(nptr, &endptr);
+    double retVal = strtod(nptr.get(), &endptr);
 
     // check if all chars are valid char
-    if ( (endptr - nptr) != strLen)
+    if ( (endptr - nptr.get()) != strLen)
         throw XMLParserException("Invalid non-numeric characters.");
 
     // we don't check underflow occurs since
index 8801e8f..2fbbb3d 100644 (file)
@@ -104,6 +104,7 @@ namespace xmltooling {
 
         /**
          * Gets the XSI type for a given element if it has one.
+         * <p>The caller is responsible for freeing the result.
          *
          * @param e the element
          * @return the type or null
@@ -158,6 +159,7 @@ namespace xmltooling {
         /**
          * @deprecated
          * Constructs a QName from an attribute's value.
+         * <p>The caller is responsible for freeing the result.
          *
          * @param attribute the attribute with a QName value
          * @return a QName from an attribute's value, or null if the given attribute is null
@@ -166,6 +168,7 @@ namespace xmltooling {
 
         /**
          * Constructs a QName from a node's value.
+         * <p>The caller is responsible for freeing the result.
          *
          * @param domNode the DOM node with a QName value
          * @return a QName from a node's value, or null if the given node has no value