Permalink
Browse files

xmlBufLength() is not exported by libxml2, use xmlBufUse() instead

  • Loading branch information...
scoder committed Mar 29, 2013
1 parent 3cdcb4f commit 3b661503609314af8ae1ba23501cca901e21cae3
Showing with 20 additions and 4 deletions.
  1. +16 −0 CHANGES.txt
  2. +1 −1 src/lxml/includes/etree_defs.h
  3. +1 −1 src/lxml/includes/tree.pxd
  4. +2 −2 src/lxml/serializer.pxi
View
@@ -2,6 +2,22 @@
lxml changelog
==============
+Under development
+=================
+
+Features added
+--------------
+
+Bugs fixed
+----------
+
+* Replace illegal usage of ``xmlBufLength()`` in libxml2 2.9.0 by
+ properly exported API function ``xmlBufUse()``.
+
+Other changes
+-------------
+
+
3.1.1 (2013-03-29)
==================
@@ -172,7 +172,7 @@
#ifndef LIBXML2_NEW_BUFFER
typedef xmlBuffer xmlBuf;
# define xmlBufContent(buf) xmlBufferContent(buf)
-# define xmlBufLength(buf) xmlBufferLength(buf)
+# define xmlBufUse(buf) xmlBufferLength(buf)
#endif
/* libexslt 1.1.25+ support EXSLT functions in XPath */
@@ -364,7 +364,7 @@ cdef extern from "libxml/tree.h":
cdef const_xmlChar* xmlBufferContent(xmlBuffer* buf) nogil
cdef int xmlBufferLength(xmlBuffer* buf) nogil
cdef const_xmlChar* xmlBufContent(xmlBuf* buf) nogil # new in libxml2 2.9
- cdef size_t xmlBufLength(xmlBuf* buf) nogil # new in libxml2 2.9
+ cdef size_t xmlBufUse(xmlBuf* buf) nogil # new in libxml2 2.9
cdef int xmlKeepBlanksDefault(int val) nogil
cdef xmlChar* xmlNodeGetBase(xmlDoc* doc, xmlNode* node) nogil
cdef void xmlNodeSetBase(xmlNode* node, const_xmlChar* uri) nogil
View
@@ -134,10 +134,10 @@ cdef _tostring(_Element element, encoding, doctype, method,
try:
if encoding is _unicode:
result = (<unsigned char*>tree.xmlBufContent(
- c_result_buffer))[:tree.xmlBufLength(c_result_buffer)].decode('UTF-8')
+ c_result_buffer))[:tree.xmlBufUse(c_result_buffer)].decode('UTF-8')
else:
result = <bytes>(<unsigned char*>tree.xmlBufContent(
- c_result_buffer))[:tree.xmlBufLength(c_result_buffer)]
+ c_result_buffer))[:tree.xmlBufUse(c_result_buffer)]
finally:
error_result = tree.xmlOutputBufferClose(c_buffer)
if error_result < 0:

0 comments on commit 3b66150

Please sign in to comment.