cdef _assoc_entry *e
cdef atom *a
a = ATOM_A(atom_pyintern(key))
- PyObject_AsReadBuffer(key, &p, &n)
+ PyObject_AsReadBuffer(key, <cvp *>&p, &n)
if f:
f[0] = 0
e = <_assoc_entry *>assoc_find(&me._t, a, PSIZEOF(e), f)
raise ValueError, 'Encoding finished'
DCREATE(&d)
try:
- PyObject_AsReadBuffer(text, &p, &len)
+ PyObject_AsReadBuffer(text, <cvp *>&p, &len)
code(me.c, p, len, &d)
if finishp:
code(me.c, NULL, 0, &d)
cdef dstr d
DCREATE(&d)
try:
- PyObject_AsReadBuffer(text, &p, &len)
+ PyObject_AsReadBuffer(text, <cvp *>&p, &len)
_%PREFIX%_encode(&me.ctx, p, len, &d)
rc = PyString_FromStringAndSize(d.buf, d.len)
finally:
cdef dstr d
DCREATE(&d)
try:
- PyObject_AsReadBuffer(text, &p, &len)
+ PyObject_AsReadBuffer(text, <cvp *>&p, &len)
_%PREFIX%_decode(&me.ctx, p, len, &d)
rc = PyString_FromStringAndSize(d.buf, d.len)
finally:
def chunk(me, data):
cdef void *p
cdef Py_ssize_t n
- PyObject_AsReadBuffer(data, &p, &n)
+ PyObject_AsReadBuffer(data, <cvp *>&p, &n)
me._a = c_crc32(me._a, p, n)
return me
def done(me):
cdef void *p
cdef Py_ssize_t n
cdef uint32 c
- PyObject_AsReadBuffer(data, &p, &n)
+ PyObject_AsReadBuffer(data, <cvp *>&p, &n)
c = c_crc32(0, p, n)
return _u32(c)
cdef extern from 'grim.h':
int PSIZEOF(void *x)
+ ctypedef void *cvp
###----- That's all, folks --------------------------------------------------
cdef void *p
cdef Py_ssize_t len
cdef int rc
- PyObject_AsReadBuffer(buffer, &p, &len)
+ PyObject_AsReadBuffer(buffer, <cvp *>&p, &len)
rc = fdpass_send(_getfd(sock), _getfd(file), p, len)
if rc < 0:
_oserror()
/*----- Utilities ---------------------------------------------------------*/
#define PSIZEOF(x) sizeof(*x)
+typedef const void *cvp;
#define RETURN_OBJ(obj) do { Py_INCREF(obj); return (obj); } while (0)
#define RETURN_ME RETURN_OBJ(me)
cdef unsigned char *p
cdef unsigned char *q
cdef size_t n
- PyObject_AsReadBuffer(str, <void **>&p, &len)
+ PyObject_AsReadBuffer(str, <cvp *>&p, &len)
while len > 0:
n = pkbuf_free(&me.pk, &q)
if n > len:
else:
r = pb.packet(PyString_FromStringAndSize(<char *>p, n))
if r is not None:
- PyObject_AsReadBuffer(r, &rp, &rn)
+ PyObject_AsReadBuffer(r, <cvp *>&rp, &rn)
if rn > n:
raise ValueError, 'remaining buffer too large'
if rn:
else:
r = pb.packet(PyString_FromStringAndSize(<char *>p, n))
if r is not None:
- PyObject_AsReadBuffer(r, &rp, &rn)
+ PyObject_AsReadBuffer(r, <cvp *>&rp, &rn)
if rn > n:
raise ValueError, 'remaining buffer too large'
if rn:
cdef void *p
cdef Py_ssize_t n
cdef _sym_entry *e
- PyObject_AsReadBuffer(key, &p, &n)
+ PyObject_AsReadBuffer(key, <cvp *>&p, &n)
if f:
f[0] = 0
e = <_sym_entry *>sym_find(&me._t, <char *>p, n, PSIZEOF(e), f)
def chunk(me, data):
cdef void *p
cdef Py_ssize_t n
- PyObject_AsReadBuffer(data, &p, &n)
+ PyObject_AsReadBuffer(data, <cvp *>&p, &n)
me._a = unihash_hash(me._i, me._a, p, n)
def done(me):
return _u32(me._a)