| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | $NetBSD: patch-lasso-xml-tools.c,v 1.4 2012/11/07 15:31:23 joerg Exp $ | | 1 | $NetBSD: patch-lasso-xml-tools.c,v 1.5 2012/12/15 15:29:28 manu Exp $ |
2 | | | 2 | |
3 | Patch from upstream to support libxml >= 2.9.0. From commit message: | | 3 | Patch from upstream to support libxml >= 2.9.0. From commit message: |
4 | | | 4 | |
5 | Libxml stopped exposing the internal of the xmlOutputBuffer structure; | | 5 | Libxml stopped exposing the internal of the xmlOutputBuffer structure; |
6 | it was replace by proper use of the API and of the xmlBuffer structure. | | 6 | it was replace by proper use of the API and of the xmlBuffer structure. |
7 | | | 7 | |
8 | There could be regression for older version of libxml as some functions | | 8 | There could be regression for older version of libxml as some functions |
9 | appeared in recent version of libxml; but the reference API document | | 9 | appeared in recent version of libxml; but the reference API document |
10 | does not give any introduction date for functions so it's hard to be | | 10 | does not give any introduction date for functions so it's hard to be |
11 | sure. | | 11 | sure. |
12 | | | 12 | |
13 | Don't use nested functions. | | 13 | Don't use nested functions. |
14 | | | 14 | |
| @@ -61,27 +61,27 @@ index c4b3c8a..cda8775 100644 | | | @@ -61,27 +61,27 @@ index c4b3c8a..cda8775 100644 |
61 | - xmlNodeDumpOutput(buf, NULL, xmlnode, 0, 0, "utf-8"); | | 61 | - xmlNodeDumpOutput(buf, NULL, xmlnode, 0, 0, "utf-8"); |
62 | - xmlOutputBufferFlush(buf); | | 62 | - xmlOutputBufferFlush(buf); |
63 | - buffer = buf->conv ? buf->conv->content : buf->buffer->content; | | 63 | - buffer = buf->conv ? buf->conv->content : buf->buffer->content; |
64 | - | | 64 | - |
65 | - xmlFreeNode(xmlnode); | | 65 | - xmlFreeNode(xmlnode); |
66 | - xmlnode = NULL; | | 66 | - xmlnode = NULL; |
67 | - | | 67 | - |
68 | - in_len = strlen((char*)buffer); | | 68 | - in_len = strlen((char*)buffer); |
69 | + buffer = xmlBufferCreate(); | | 69 | + buffer = xmlBufferCreate(); |
70 | + output_buffer = xmlOutputBufferCreateBuffer(buffer, NULL); | | 70 | + output_buffer = xmlOutputBufferCreateBuffer(buffer, NULL); |
71 | + xmlNodeDumpOutput(output_buffer, NULL, xmlnode, 0, 0, NULL); | | 71 | + xmlNodeDumpOutput(output_buffer, NULL, xmlnode, 0, 0, NULL); |
72 | + xmlOutputBufferClose(output_buffer); | | 72 | + xmlOutputBufferClose(output_buffer); |
73 | + xmlBufferAdd(buffer, BAD_CAST "", 1); | | 73 | + xmlBufferAdd(buffer, BAD_CAST "", 1); |
74 | + lasso_release_xml_node(xmlnode); | | 74 | + |
75 | + in_len = strlen((char*)xmlBufferContent(buffer)); | | 75 | + in_len = strlen((char*)xmlBufferContent(buffer)); |
76 | ret = g_malloc(in_len * 2); | | 76 | ret = g_malloc(in_len * 2); |
77 | /* deflating should never increase the required size but we are | | 77 | /* deflating should never increase the required size but we are |
78 | * more conservative than that. Twice the size should be | | 78 | * more conservative than that. Twice the size should be |
79 | * enough. */ | | 79 | * enough. */ |
80 | | | 80 | |
81 | - stream.next_in = buffer; | | 81 | - stream.next_in = buffer; |
82 | + stream.next_in = (xmlChar*)xmlBufferContent(buffer); | | 82 | + stream.next_in = (xmlChar*)xmlBufferContent(buffer); |
83 | stream.avail_in = in_len; | | 83 | stream.avail_in = in_len; |
84 | stream.next_out = ret; | | 84 | stream.next_out = ret; |
85 | stream.avail_out = in_len * 2; | | 85 | stream.avail_out = in_len * 2; |
86 | @@ -1097,6 +1091,7 @@ lasso_node_build_deflated_query(LassoNod | | 86 | @@ -1097,6 +1091,7 @@ lasso_node_build_deflated_query(LassoNod |
87 | rc = deflateEnd(&stream); | | 87 | rc = deflateEnd(&stream); |