chiark
/
gitweb
/
~mdw
/
catacomb-python
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch '1.2.x' into 1.3.x
[catacomb-python]
/
buffer.c
diff --git
a/buffer.c
b/buffer.c
index ac3e56be66e130bee408eddd7b7267b8a9eca88c..5b7bb64692a4530d9ef05671185351001096942f 100644
(file)
--- a/
buffer.c
+++ b/
buffer.c
@@
-55,9
+55,9
@@
static PyObject *rbuf_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
char *p, *q;
Py_ssize_t n;
buf_pyobj *me = 0;
char *p, *q;
Py_ssize_t n;
buf_pyobj *me = 0;
- static c
har *
kwlist[] = { "data", 0 };
+ static c
onst char *const
kwlist[] = { "data", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#:new",
kwlist
, &p, &n))
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#:new",
KWLIST
, &p, &n))
goto end;
q = xmalloc(n);
memcpy(q, p, n);
goto end;
q = xmalloc(n);
memcpy(q, p, n);
@@
-172,9
+172,9
@@
end:
static PyObject *rbmeth_getecpt(PyObject *me, PyObject *arg, PyObject *kw)
{
PyObject *cobj = Py_None;
static PyObject *rbmeth_getecpt(PyObject *me, PyObject *arg, PyObject *kw)
{
PyObject *cobj = Py_None;
- static c
har *
kwlist[] = { "curve", 0 };
+ static c
onst char *const
kwlist[] = { "curve", 0 };
ec pt = EC_INIT;
ec pt = EC_INIT;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "|O:getecpt",
kwlist
, &cobj))
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "|O:getecpt",
KWLIST
, &cobj))
goto end;
if (cobj == Py_None) cobj = (PyObject *)ecpt_pytype;
if (!PyType_Check(cobj) ||
goto end;
if (cobj == Py_None) cobj = (PyObject *)ecpt_pytype;
if (!PyType_Check(cobj) ||
@@
-309,7
+309,7
@@
static PyTypeObject rbuf_pytype_skel = {
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
-
"A
read buffer.",
+
"ReadBuffer(STR): a
read buffer.",
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
@@
-355,9
+355,9
@@
static PyObject *wbuf_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
char *p;
size_t n = 64;
buf_pyobj *me = 0;
char *p;
size_t n = 64;
buf_pyobj *me = 0;
- static c
har *
kwlist[] = { "size", 0 };
+ static c
onst char *const
kwlist[] = { "size", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "|O&:new",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "|O&:new",
KWLIST
,
convszt, &n))
goto end;
me = (buf_pyobj *)ty->tp_alloc(ty, 0);
convszt, &n))
goto end;
me = (buf_pyobj *)ty->tp_alloc(ty, 0);
@@
-486,9
+486,13
@@
static PyObject *wbmeth_putgeraw(PyObject *me, PyObject *arg)
static PyObject *wbget_size(PyObject *me, void *hunoz)
{ return (PyInt_FromLong(BLEN(BUF_B(me)))); }
static PyObject *wbget_size(PyObject *me, void *hunoz)
{ return (PyInt_FromLong(BLEN(BUF_B(me)))); }
+static PyObject *wbget_contents(PyObject *me, void *hunoz)
+ { return (bytestring_pywrap(BBASE(BUF_B(me)), BLEN(BUF_B(me)))); }
+
static PyGetSetDef wbuf_pygetset[] = {
#define GETSETNAME(op, name) wb##op##_##name
GET (size, "WBUF.size -> SIZE")
static PyGetSetDef wbuf_pygetset[] = {
#define GETSETNAME(op, name) wb##op##_##name
GET (size, "WBUF.size -> SIZE")
+ GET (contents, "WBUF.contents -> STR")
#undef GETSETNAME
{ 0 }
};
#undef GETSETNAME
{ 0 }
};
@@
-545,7
+549,7
@@
static PyTypeObject wbuf_pytype_skel = {
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
Py_TPFLAGS_BASETYPE,
/* @tp_doc@ */
-
"A
write buffer.",
+
"WriteBuffer([size = ?]): a
write buffer.",
0, /* @tp_traverse@ */
0, /* @tp_clear@ */
0, /* @tp_traverse@ */
0, /* @tp_clear@ */