Skip to content

Commit

Permalink
xmlBufLength() is not exported by libxml2, use xmlBufUse() instead
Browse files Browse the repository at this point in the history
  • Loading branch information
scoder committed Mar 29, 2013
1 parent 3cdcb4f commit 3b66150
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
16 changes: 16 additions & 0 deletions CHANGES.txt
Expand Up @@ -2,6 +2,22 @@
lxml changelog 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) 3.1.1 (2013-03-29)
================== ==================


Expand Down
2 changes: 1 addition & 1 deletion src/lxml/includes/etree_defs.h
Expand Up @@ -172,7 +172,7 @@
#ifndef LIBXML2_NEW_BUFFER #ifndef LIBXML2_NEW_BUFFER
typedef xmlBuffer xmlBuf; typedef xmlBuffer xmlBuf;
# define xmlBufContent(buf) xmlBufferContent(buf) # define xmlBufContent(buf) xmlBufferContent(buf)
# define xmlBufLength(buf) xmlBufferLength(buf) # define xmlBufUse(buf) xmlBufferLength(buf)
#endif #endif


/* libexslt 1.1.25+ support EXSLT functions in XPath */ /* libexslt 1.1.25+ support EXSLT functions in XPath */
Expand Down
2 changes: 1 addition & 1 deletion src/lxml/includes/tree.pxd
Expand Up @@ -364,7 +364,7 @@ cdef extern from "libxml/tree.h":
cdef const_xmlChar* xmlBufferContent(xmlBuffer* buf) nogil cdef const_xmlChar* xmlBufferContent(xmlBuffer* buf) nogil
cdef int xmlBufferLength(xmlBuffer* buf) nogil cdef int xmlBufferLength(xmlBuffer* buf) nogil
cdef const_xmlChar* xmlBufContent(xmlBuf* buf) nogil # new in libxml2 2.9 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 int xmlKeepBlanksDefault(int val) nogil
cdef xmlChar* xmlNodeGetBase(xmlDoc* doc, xmlNode* node) nogil cdef xmlChar* xmlNodeGetBase(xmlDoc* doc, xmlNode* node) nogil
cdef void xmlNodeSetBase(xmlNode* node, const_xmlChar* uri) nogil cdef void xmlNodeSetBase(xmlNode* node, const_xmlChar* uri) nogil
Expand Down
4 changes: 2 additions & 2 deletions src/lxml/serializer.pxi
Expand Up @@ -134,10 +134,10 @@ cdef _tostring(_Element element, encoding, doctype, method,
try: try:
if encoding is _unicode: if encoding is _unicode:
result = (<unsigned char*>tree.xmlBufContent( 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: else:
result = <bytes>(<unsigned char*>tree.xmlBufContent( result = <bytes>(<unsigned char*>tree.xmlBufContent(
c_result_buffer))[:tree.xmlBufLength(c_result_buffer)] c_result_buffer))[:tree.xmlBufUse(c_result_buffer)]
finally: finally:
error_result = tree.xmlOutputBufferClose(c_buffer) error_result = tree.xmlOutputBufferClose(c_buffer)
if error_result < 0: if error_result < 0:
Expand Down

0 comments on commit 3b66150

Please sign in to comment.