Re: [xml] c14n 1.1 support (patch)
Hi, Aleksey Sanin wrote: 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). it's usually a good idea to put patches into the bug tracker so that they do not get lost in the e-mail backscroll buffer. Stefan ___ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml
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/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ ___ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml
Re: [xml] c14n 1.1 support (patch)
thanks for the patch, sorry for the delay, I was really focused on work stuff :-\ No worries, I know how it works :) 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 :-) Will take a look. I believe this is a known problem with git patches produced with cygwin (this is what I was using). 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 :-( Yeah, I wasn't sure about that one myself. Thanks for fixing it! 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 again, I'll take a look later today and let you know. Best, Aleksey ___ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml
Re: [xml] c14n 1.1 support (patch)
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 again, I'll take a look later today and let you know. There were few more places where my original patch changed the ABI (int - enum). Please find attached a patch that fixes these places and also adds a check that int is actually enum :) Thanks again for your help! Aleksey From 5bd0ec467b4bf6f5ea33ec445feb7db95dca3ef6 Mon Sep 17 00:00:00 2001 From: Aleksey Sanin alek...@aleksey.com Date: Thu, 9 Jul 2009 08:38:17 -0700 Subject: [PATCH] c14n11: fix other ABI changes --- c14n.c| 24 +++- include/libxml/c14n.h |6 +++--- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/c14n.c b/c14n.c index 53a19c1..5c6c456 100644 --- a/c14n.c +++ b/c14n.c @@ -1863,10 +1863,11 @@ xmlC14NNewCtx(xmlDocPtr doc, */ int xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, -void* user_data, xmlC14NMode mode, xmlChar **inclusive_ns_prefixes, +void* user_data, int mode, xmlChar **inclusive_ns_prefixes, int with_comments, xmlOutputBufferPtr buf) { xmlC14NCtxPtr ctx; +xmlC14NMode c14n_mode = XML_C14N_1_0; int ret; if ((buf == NULL) || (doc == NULL)) { @@ -1874,6 +1875,19 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, return (-1); } +/* for backward compatibility, we have to have mode as int + and here we check that user gives valid value */ +switch(mode) { +case XML_C14N_1_0: +case XML_C14N_EXCLUSIVE_1_0: +case XML_C14N_1_1: + c14n_mode = (xmlC14NMode)mode; + break; +default: +xmlC14NErrParam(invalid mode for executing c14n); +return (-1); +} + /* * Validate the encoding output buffer encoding */ @@ -1884,8 +1898,8 @@ xmlC14NExecute(xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, } ctx = xmlC14NNewCtx(doc, is_visible_callback, user_data, - mode, inclusive_ns_prefixes, -with_comments, buf); + c14n_mode, inclusive_ns_prefixes, +with_comments, buf); if (ctx == NULL) { xmlC14NErr(NULL, (xmlNodePtr) doc, XML_C14N_CREATE_CTXT, xmlC14NExecute: unable to create C14N context\n); @@ -1986,7 +2000,7 @@ xmlC14NDocSaveTo(xmlDocPtr doc, xmlNodeSetPtr nodes, */ int xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes, - xmlC14NMode mode, xmlChar ** inclusive_ns_prefixes, + int mode, xmlChar ** inclusive_ns_prefixes, int with_comments, xmlChar ** doc_txt_ptr) { int ret; @@ -2057,7 +2071,7 @@ xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes, */ int xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes, - xmlC14NMode mode, xmlChar ** inclusive_ns_prefixes, + int mode, xmlChar ** inclusive_ns_prefixes, int with_comments, const char *filename, int compression) { xmlOutputBufferPtr buf; diff --git a/include/libxml/c14n.h b/include/libxml/c14n.h index e99b144..3011af7 100644 --- a/include/libxml/c14n.h +++ b/include/libxml/c14n.h @@ -75,7 +75,7 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlC14NDocDumpMemory(xmlDocPtr doc, xmlNodeSetPtr nodes, -xmlC14NMode mode, +int mode, /* a xmlC14NMode */ xmlChar **inclusive_ns_prefixes, int with_comments, xmlChar **doc_txt_ptr); @@ -83,7 +83,7 @@ XMLPUBFUN int XMLCALL XMLPUBFUN int XMLCALL xmlC14NDocSave (xmlDocPtr doc, xmlNodeSetPtr nodes, -xmlC14NMode mode, +int mode, /* a xmlC14NMode */ xmlChar **inclusive_ns_prefixes, int with_comments, const char* filename, @@ -111,7 +111,7 @@ XMLPUBFUN int XMLCALL xmlC14NExecute (xmlDocPtr doc, xmlC14NIsVisibleCallback is_visible_callback, void* user_data, -xmlC14NMode mode, +int mode, /* a xmlC14NMode */ xmlChar **inclusive_ns_prefixes, int with_comments,
Re: [xml] c14n 1.1 support (patch)
Thanks for committing it! Aleksey Daniel Veillard wrote: On Thu, Jul 09, 2009 at 08:42:12AM -0700, Aleksey Sanin wrote: 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 again, I'll take a look later today and let you know. There were few more places where my original patch changed the ABI (int - enum). Please find attached a patch that fixes these places and also adds a check that int is actually enum :) Thanks again for your help! Oops right I didn't see those ! Applied and commited, thanks ! Daniel ___ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml
[xml] c14n 1.1 support (patch)
Daniel, 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). Thank you in advance, Aleksey Sanin c14n11.diff.gz Description: GNU Zip compressed data ___ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml
Re: [xml] c14n 1.1 support (patch)
Please ignore the previous patch, it is incomplete. This is the correct one. Sorry, still learning git :) Aleksey Aleksey Sanin wrote: Daniel, 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). Thank you in advance, Aleksey Sanin ___ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml c14n-11.tar.gz Description: GNU Zip compressed data ___ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml
Re: [xml] c14n 1.1 support (patch)
And one more patch that adds extra test vectors and speeds up code a little bit. Aleksey Aleksey Sanin wrote: Please ignore the previous patch, it is incomplete. This is the correct one. Sorry, still learning git :) Aleksey Aleksey Sanin wrote: Daniel, 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). Thank you in advance, Aleksey Sanin ___ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml ___ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml c14n11-2nd.tar.gz Description: GNU Zip compressed data ___ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml