Re: [xml] c14n 1.1 support (patch)



On Thu, Jun 25, 2009 at 01:10:45PM -0700, Aleksey Sanin wrote:
Daniel,

  Hi Aleksey,

thanks for the patch, sorry for the delay, I was really focused
on work stuff :-\

Please find attached a patch that adds support for the new
version of c14n (http://www.w3.org/TR/xml-c14n11/). I am
getting questions about it in the xmlsec mailing list and
I finally decided to implement it. I would greatly appreciate
if you can accept this patch and push it into the gnome git
repository (note, that there are some new files/folders added
for the new test cases).

  Okay, I looked at it, and I had a couple of small problems

paphio:~/XML -> git apply < 0001-adding-c14n-v1.1-support.patch
<stdin>:198: trailing whitespace.
       xmlns:b="http://www.ietf.org"; 
warning: 1 line adds whitespace errors.
paphio:~/XML -> git apply < 0002-adding-c14n-v1.1-support.patch
<stdin>:42: trailing whitespace.
    
<stdin>:98: trailing whitespace.
 *          
<stdin>:109: trailing whitespace.
    return ((attr->ns != NULL) && 
<stdin>:166: trailing whitespace.
{    
<stdin>:197: trailing whitespace.
            } 
warning: squelched 53 whitespace errors
warning: 58 lines add whitespace errors.
paphio:~/XML ->

  I don't know if this is nasty or not, but git decided to remove some
white spaces, which I'm afraid may change the output of the test, so
please double check... I also got a few similar warnings with patch 0003
and 004 in the second tarball. On the other hand, the regression tests
look fine, but double checking still a good idea IMHO :-)

+++ b/include/libxml/c14n.h
@@ -52,11 +52,22 @@ extern "C" {
  *    ...
  */
 
+/*
+ * xmlC14NMode:
+ * 
+ * Predefined values for C14N modes
+ *
+ */
+typedef enum {
+    XML_C14N_1_0            = 0,    /* Origianal C14N 1.0 spec */
+    XML_C14N_EXCLUSIVE_1_0  = 1,    /* Exclusive C14N 1.0 spec */
+    XML_C14N_1_1            = 2     /* C14N 1.1 spec */
+} xmlC14NMode;
 
 XMLPUBFUN int XMLCALL
                xmlC14NDocSaveTo        (xmlDocPtr doc,
                                         xmlNodeSetPtr nodes,
-                                        int exclusive,
+                                        xmlC14NMode mode,
                                         xmlChar **inclusive_ns_prefixes,
                                         int with_comments,
                                         xmlOutputBufferPtr buf);

  that one is more serious, that's an ABI breakage, unfortunately we
can't do that, the C standard doesn't define the size of an enum :-(
so we can't guarantee that xmlC14NDocSaveTo signature doesn't change
here, we need to keep an int parameter. I modified the signature to be

XMLPUBFUN int XMLCALL
                xmlC14NDocSaveTo        (xmlDocPtr doc,
                                         xmlNodeSetPtr nodes,
                                         int mode, /* a xmlC14NMode */
                                         xmlChar **inclusive_ns_prefixes,
                                         int with_comments,
                                         xmlOutputBufferPtr buf);

IMHO that doesn't change anything except maybe a bit of type checking

  I commited the result, I guess it should be very close to what you had
in your tree, but like you I'm learning git so please double check the
code in git is actually what you expected :-) (module the small API
change).

   thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]