Permalink
Browse files

fix some more C compiler warnings in lxml.objectify

  • Loading branch information...
scoder committed Jul 31, 2012
1 parent a8434a8 commit da1b53c2cd81ad04b67bcfff69ed4afbe7a33252
Showing with 4 additions and 7 deletions.
  1. +2 −2 src/lxml/lxml.objectify.pyx
  2. +2 −5 src/lxml/objectpath.pxi
@@ -5,7 +5,7 @@ XML. It is based on `lxml.etree`.
from lxml.includes.etreepublic cimport _Document, _Element, ElementBase, ElementClassLookup
from lxml.includes.etreepublic cimport elementFactory, import_lxml__etree, textOf, pyunicode
from lxml.includes.tree cimport xmlChar, const_xmlChar, _xcstr
-from lxml.python cimport callable, _cstr
+from lxml.python cimport callable
from lxml cimport python
from lxml.includes cimport tree
@@ -37,7 +37,7 @@ cdef tuple IGNORABLE_ERRORS = (ValueError, TypeError)
cdef object is_special_method = re.compile(u'__.*__$').match
cdef object _typename(object t):
- cdef char* s
+ cdef const_char* c_name
c_name = python._fqtypename(t)
s = cstring_h.strrchr(c_name, c'.')
if s is not NULL:
View
@@ -132,9 +132,6 @@ cdef _parseObjectPathString(path):
cdef _parseObjectPathList(path):
u"""Parse object path sequence into a (ns, name, index) list.
"""
- cdef xmlChar* index_pos
- cdef xmlChar* index_end
- cdef unsigned char* c_name
cdef list new_path = []
for item in path:
item = item.strip()
@@ -144,15 +141,15 @@ cdef _parseObjectPathList(path):
index = 0
else:
ns, name = cetree.getNsTag(item)
- c_name = <unsigned char*>_cstr(name)
+ c_name = _xcstr(name)
index_pos = tree.xmlStrchr(c_name, c'[')
if index_pos is NULL:
index = 0
else:
index_end = tree.xmlStrchr(index_pos + 1, c']')
if index_end is NULL:
raise ValueError, u"index must be enclosed in []"
- index = int((<unsigned char*>index_pos)[1:index_end - index_pos])
+ index = int(index_pos[1:index_end - index_pos])
if python.PyList_GET_SIZE(new_path) == 0 and index != 0:
raise ValueError, u"index not allowed on root node"
name = <bytes>c_name[:index_pos - c_name]

0 comments on commit da1b53c

Please sign in to comment.