You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ka...@apache.org on 2007/02/16 10:31:35 UTC

svn commit: r508356 - /webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c

Author: kaushalye
Date: Fri Feb 16 01:31:34 2007
New Revision: 508356

URL: http://svn.apache.org/viewvc?view=rev&rev=508356
Log:
Applying patch sent for JIRA AXIS2C-511.

oxs_c14n_apply and oxs_c14n_apply_stream are modified to allow NULL for the doc parameter.


Modified:
    webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c?view=diff&rev=508356&r1=508355&r2=508356
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/c14n/c14n.c Fri Feb 16 01:31:34 2007
@@ -50,6 +50,10 @@
 #define c14n_ns_stack_get_default(ctx) \
         ((ctx)->ns_stack->def_ns)
 
+#define C14N_GET_ROOT_NODE_FROM_DOC_OR_NODE(doc, node, ctx) \
+    ((doc) ? AXIOM_DOCUMENT_GET_ROOT_ELEMENT((axiom_document_t *)(doc), \
+        (ctx)->env) : c14n_get_root_node((node), (ctx))) 
+
 
 typedef struct c14n_ns_stack {
     int head; /*index of the currnt stack TOP*/
@@ -367,6 +371,12 @@
     const c14n_ctx_t *ctx
     );
 
+static axiom_node_t*
+c14n_get_root_node(
+    const axiom_node_t *node,
+    const c14n_ctx_t *ctx
+    );
+
 /*static axis2_bool_t
 c14n_in_nodeset(
     const axiom_node_t *node,
@@ -436,6 +446,23 @@
     return AXIS2_SUCCESS;
 }*/
 
+static axiom_node_t*
+c14n_get_root_node(
+    const axiom_node_t *node,
+    const c14n_ctx_t *ctx
+    )
+{
+    const axiom_node_t *parent;
+    const axiom_node_t *prv_parent;
+
+    parent = node;
+    while (parent)
+    {
+        prv_parent = parent;
+        parent = AXIOM_NODE_GET_PARENT((axiom_node_t *)parent, ctx->env);
+    }
+    return (axiom_node_t *)prv_parent;
+}
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_c14n_apply_stream(
@@ -460,9 +487,9 @@
 
     if (ctx && ctx->outstream)
     {
-
-        root_node = AXIOM_DOCUMENT_GET_ROOT_ELEMENT((axiom_document_t *)doc,
-                env); 
+        root_node = C14N_GET_ROOT_NODE_FROM_DOC_OR_NODE(doc, node, ctx);
+        /*root_node = AXIOM_DOCUMENT_GET_ROOT_ELEMENT((axiom_document_t *)doc,
+                ctx->env); */
 
         /* shouldn't the called method's document be const?*/
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org