blautenb 2003/05/22 04:42:06
Modified: c/src/canon XSECC14n20010315.cpp
c/src/framework XSECW32Config.hpp
c/src/tools/xtest xtest.cpp
c/src/utils XSECSafeBufferFormatter.cpp
c/src/utils/winutils XSECURIResolverGenericWin32.cpp
Log:
Updates so Windows version will compile with Xerces 2.3
Revision Changes Path
1.8 +7 -1 xml-security/c/src/canon/XSECC14n20010315.cpp
Index: XSECC14n20010315.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/canon/XSECC14n20010315.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XSECC14n20010315.cpp 23 Apr 2003 07:34:17 -0000 1.7
+++ XSECC14n20010315.cpp 22 May 2003 11:42:06 -0000 1.8
@@ -70,6 +70,7 @@
*/
//XSEC includes
+#include <xsec/framework/XSECDefs.hpp>
#include <xsec/canon/XSECC14n20010315.hpp>
#include <xsec/framework/XSECException.hpp>
#include <xsec/utils/XSECDOMUtils.hpp>
@@ -357,8 +358,13 @@
c14ntarget = new c14nFormatTarget();
c14ntarget->setBuffer(&formatBuffer);
+#if defined(XSEC_XERCES_FORMATTER_REQUIRES_VERSION)
+ formatter = new XMLFormatter("UTF-8", 0, c14ntarget,
XMLFormatter::NoEscapes,
+
XMLFormatter::UnRep_CharRef);
+#else
formatter = new XMLFormatter("UTF-8", c14ntarget,
XMLFormatter::NoEscapes,
XMLFormatter::UnRep_CharRef);
+#endif
formatBuffer.setBufferType(safeBuffer::BUFFER_CHAR);
// Set up for first attribute list
1.9 +24 -2 xml-security/c/src/framework/XSECW32Config.hpp
Index: XSECW32Config.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/framework/XSECW32Config.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XSECW32Config.hpp 23 Apr 2003 10:11:50 -0000 1.8
+++ XSECW32Config.hpp 22 May 2003 11:42:06 -0000 1.9
@@ -70,19 +70,41 @@
*
*/
+#include <xercesc/util/XercesVersion.hpp>
+
#define XSEC_VERSION "0.2.0"
#define XSEC_VERSION_MAJOR 0
#define XSEC_VERSION_MEDIUM 2
#define XSEC_VERSION_MINOR 0
/*
+ * Because we don't have a configure script, we need to rely on version
+ * numbers to understand library idiosycracies
+ */
+
+#if (XERCES_VERSION_MAJOR >= 2) && (XERCES_VERSION_MINOR >= 3)
+/*
+ * As of version 2.3, xerces requires a version parameter in XMLFormatter
+ * constructors
+ */
+# define XSEC_XERCES_FORMATTER_REQUIRES_VERSION 1
+#else
+/*
+ * In version 2.2, the XMLUri class was broken for relative URI
de-referencing
+ */
+# define XSEC_XERCES_BROKEN_XMLURI 1
+#endif
+
+
+
+/*
* The following defines whether Xalan integration is required.
*
* Xalan is used for XSLT and complex XPath processing.
* Activate this #define if Xalan is not required (or desired)
*/
-/* #define XSEC_NO_XALAN */
+#define XSEC_NO_XALAN
/*
* Define presence of cryptographic providers
1.10 +12 -11 xml-security/c/src/tools/xtest/xtest.cpp
Index: xtest.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/tools/xtest/xtest.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- xtest.cpp 22 May 2003 11:25:26 -0000 1.9
+++ xtest.cpp 22 May 2003 11:42:06 -0000 1.10
@@ -192,7 +192,8 @@
chLatin_E,
chLatin_C,
chSpace,
- chSpace
+ chSpace,
+ chNull
};
@@ -355,16 +356,10 @@
ce = ref[6]->appendCanonicalizationTransform(CANON_C14NE_COM);
ce->addInclusiveNamespace("foo");
- ref[7] = sig->createReference(MAKE_UNICODE_STRING(""));
- sig->setXPFNSPrefix(MAKE_UNICODE_STRING("xpf"));
- DSIGTransformXPathFilter * xpf =
ref[7]->appendXPathFilterTransform();
- xpf->appendFilter(FILTER_INTERSECT,
MAKE_UNICODE_STRING("//ADoc/category"));
-
-
#ifdef XSEC_NO_XALAN
cerr << "WARNING : No testing of XPath being performed as Xalan
not present" << endl;
- refCount = 8;
+ refCount = 7;
#else
/*
@@ -372,6 +367,11 @@
*/
+ ref[7] = sig->createReference(MAKE_UNICODE_STRING(""));
+ sig->setXPFNSPrefix(MAKE_UNICODE_STRING("xpf"));
+ DSIGTransformXPathFilter * xpf =
ref[7]->appendXPathFilterTransform();
+ xpf->appendFilter(FILTER_INTERSECT,
MAKE_UNICODE_STRING("//ADoc/category"));
+
ref[8] = sig->createReference(MAKE_UNICODE_STRING(""));
/*
ref[5]->appendXPathTransform("ancestor-or-self::dsig:Signature",
"xmlns:dsig=http://www.w3.org/2000/09/xmldsig#"); */
@@ -409,7 +409,8 @@
* Validate the reference hash values from known good
*/
- for (int i = 0; i < refCount; ++i) {
+ int i;
+ for (i = 0; i < refCount; ++i) {
cerr << "Calculating hash for reference " << i << " ...
";
@@ -549,7 +550,7 @@
int nki = kil->getSize();
cerr << "Checking Distinguished name is decoded correctly ... ";
- for (int i = 0; i < nki; ++i) {
+ for (i = 0; i < nki; ++i) {
if (kil->item(i)->getKeyInfoType() ==
DSIGKeyInfo::KEYINFO_X509) {
1.4 +17 -2 xml-security/c/src/utils/XSECSafeBufferFormatter.cpp
Index: XSECSafeBufferFormatter.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/utils/XSECSafeBufferFormatter.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSECSafeBufferFormatter.cpp 22 Feb 2003 08:47:26 -0000 1.3
+++ XSECSafeBufferFormatter.cpp 22 May 2003 11:42:06 -0000 1.4
@@ -117,11 +117,18 @@
XSECnew(sbf, sbFormatTarget());
sbf->setBuffer(&formatBuffer);
+#if defined(XSEC_XERCES_FORMATTER_REQUIRES_VERSION)
XSECnew(formatter, XMLFormatter(outEncoding,
+ 0,
sbf,
escapeFlags,
unrepFlags));
-
+#else
+ XSECnew(formatter, XMLFormatter(outEncoding,
+ sbf,
+
escapeFlags,
+
unrepFlags));
+#endif
}
@@ -136,10 +143,18 @@
XSECnew(sbf, sbFormatTarget());
sbf->setBuffer(&formatBuffer);
+#if defined(XSEC_XERCES_FORMATTER_REQUIRES_VERSION)
+ XSECnew(formatter, XMLFormatter(outEncoding,
+ 0,
+ sbf,
+
escapeFlags,
+
unrepFlags));
+#else
XSECnew(formatter, XMLFormatter(outEncoding,
sbf,
escapeFlags,
unrepFlags));
+#endif
}
1.4 +7 -2
xml-security/c/src/utils/winutils/XSECURIResolverGenericWin32.cpp
Index: XSECURIResolverGenericWin32.cpp
===================================================================
RCS file:
/home/cvs/xml-security/c/src/utils/winutils/XSECURIResolverGenericWin32.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSECURIResolverGenericWin32.cpp 10 May 2003 07:23:36 -0000 1.3
+++ XSECURIResolverGenericWin32.cpp 22 May 2003 11:42:06 -0000 1.4
@@ -71,6 +71,9 @@
* $Id$
*
* $Log$
+ * Revision 1.4 2003/05/22 11:42:06 blautenb
+ * Updates so Windows version will compile with Xerces 2.3
+ *
* Revision 1.3 2003/05/10 07:23:36 blautenb
* Updates to support anonymous references
*
@@ -168,9 +171,11 @@
if (mp_baseURI != NULL) {
XMLUri * turi;
-#if XERCES_VERSION_MAJOR == 2 && XERCES_VERSION_MINOR < 3
+#if defined(XSEC_XERCES_BROKEN_XMLURI)
// XMLUri relative paths are broken, so we need to strip out
".."
+ // Doesn't fix the whole problem, but gets us somewhere
+
XMLCh * b = XMLString::replicate(mp_baseURI);
ArrayJanitor<XMLCh> j_b(b);
XMLCh * r = XMLString::replicate(uri);