diff options
| author | 2013-03-19 17:13:20 +0100 | |
|---|---|---|
| committer | 2013-03-19 17:13:20 +0100 | |
| commit | ef7347435a77a97444e61a52ce9305c3924d2df6 (patch) | |
| tree | 077487f17abfcc127b4c097c3d9017df633930ca | |
| parent | 1f14105b2841dc73b1d459ba0b83e18785766ef8 (diff) | |
| download | libplist-ef7347435a77a97444e61a52ce9305c3924d2df6.tar.gz libplist-ef7347435a77a97444e61a52ce9305c3924d2df6.tar.bz2 | |
cython: use uint64_t instead of int for Integer get_value and __repr__
| -rw-r--r-- | cython/plist.pxd | 6 | ||||
| -rw-r--r-- | cython/plist.pyx | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/cython/plist.pxd b/cython/plist.pxd index d7c70bd..c504599 100644 --- a/cython/plist.pxd +++ b/cython/plist.pxd | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | from libc.stdint cimport * | ||
| 2 | |||
| 1 | cdef extern from "plist/plist.h": | 3 | cdef extern from "plist/plist.h": |
| 2 | ctypedef void *plist_t | 4 | ctypedef void *plist_t |
| 3 | ctypedef void *plist_dict_iter | 5 | ctypedef void *plist_dict_iter |
| @@ -14,10 +16,10 @@ cdef class Node: | |||
| 14 | cdef class Bool(Node): | 16 | cdef class Bool(Node): |
| 15 | cpdef set_value(self, object value) | 17 | cpdef set_value(self, object value) |
| 16 | cpdef bint get_value(self) | 18 | cpdef bint get_value(self) |
| 17 | 19 | ||
| 18 | cdef class Integer(Node): | 20 | cdef class Integer(Node): |
| 19 | cpdef set_value(self, object value) | 21 | cpdef set_value(self, object value) |
| 20 | cpdef int get_value(self) | 22 | cpdef uint64_t get_value(self) |
| 21 | 23 | ||
| 22 | cdef class Key(Node): | 24 | cdef class Key(Node): |
| 23 | cpdef set_value(self, object value) | 25 | cpdef set_value(self, object value) |
diff --git a/cython/plist.pyx b/cython/plist.pyx index dce5bec..09c0bbc 100644 --- a/cython/plist.pyx +++ b/cython/plist.pyx | |||
| @@ -180,7 +180,7 @@ cdef class Integer(Node): | |||
| 180 | self._c_node = plist_new_uint(int(value)) | 180 | self._c_node = plist_new_uint(int(value)) |
| 181 | 181 | ||
| 182 | def __repr__(self): | 182 | def __repr__(self): |
| 183 | cdef int i = self.get_value() | 183 | cdef uint64_t i = self.get_value() |
| 184 | return '<Integer: %s>' % i | 184 | return '<Integer: %s>' % i |
| 185 | 185 | ||
| 186 | def __int__(self): | 186 | def __int__(self): |
| @@ -207,7 +207,7 @@ cdef class Integer(Node): | |||
| 207 | cpdef set_value(self, object value): | 207 | cpdef set_value(self, object value): |
| 208 | plist_set_uint_val(self._c_node, int(value)) | 208 | plist_set_uint_val(self._c_node, int(value)) |
| 209 | 209 | ||
| 210 | cpdef int get_value(self): | 210 | cpdef uint64_t get_value(self): |
| 211 | cdef uint64_t value | 211 | cdef uint64_t value |
| 212 | plist_get_uint_val(self._c_node, &value) | 212 | plist_get_uint_val(self._c_node, &value) |
| 213 | return value | 213 | return value |
