rand.c: More `Py_ssize_t' fixes.
[catacomb-python] / buffer.c
index 27eafd1..ac3e56b 100644 (file)
--- a/buffer.c
+++ b/buffer.c
@@ -262,14 +262,14 @@ static PyMethodDef rbuf_pymethods[] = {
     METH(getu##w, "RBUF.getu" #w "() -> INT")
   DOUINTCONV(RBMETH_DECL_GETU_)
 #define RBMETH_DECL_GETBLK_(n, W, w)                                   \
-    METH(getblk##w, "RBUF.getblk" #w "() -> INT")
+    METH(getblk##w, "RBUF.getblk" #w "() -> BYTES")
   BUF_DOSUFFIXES(RBMETH_DECL_GETBLK_)
 #define RBMETH_DECL_GETBUF_(n, W, w)                                   \
-    METH(getbuf##w, "RBUF.getbuf" #w "() -> INT")
+    METH(getbuf##w, "RBUF.getbuf" #w "() -> RBUF'")
   BUF_DOSUFFIXES(RBMETH_DECL_GETBUF_)
   METH (getmp,                 "RBUF.getmp() -> X")
   METH (getgf,                 "RBUF.getgf() -> X")
-  KWMETH(getecpt,              "RBUF.getecpt(curve = None) -> P")
+  KWMETH(getecpt,              "RBUF.getecpt([curve = None]) -> P")
   METH (getecptraw,            "RBUF.getecptraw(CURVE) -> P")
   METH (getge,                 "RBUF.getge(GROUP) -> X")
   METH (getgeraw,              "RBUF.getgeraw(GROUP) -> X")
@@ -446,8 +446,7 @@ static PyObject *wbmeth_putecpt(PyObject *me, PyObject *arg)
 {
   ec pt = EC_INIT;
   if (!PyArg_ParseTuple(arg, "O&:putecpt", convecpt, &pt)) return (0);
-  if (EC_ATINF(&pt)) ensure(me, 2);
-  else ensure(me, 4 + mp_octets(pt.x) + mp_octets(pt.y));
+  ensure(me, EC_ATINF(&pt) ? 2 : 6 + mp_octets(pt.x) + mp_octets(pt.y));
   buf_putec(BUF_B(me), &pt); assert(BOK(BUF_B(me)));
   EC_DESTROY(&pt);
   RETURN_ME;
@@ -506,7 +505,7 @@ static PyMethodDef wbuf_pymethods[] = {
   BUF_DOSUFFIXES(WBMETH_DECL_PUTBLK_)
   METH (putmp,                 "WBUF.putmp(X)")
   METH (putgf,                 "WBUF.putgf(X)")
-  KWMETH(putecpt,              "WBUF.putecpt(P)")
+  METH (putecpt,               "WBUF.putecpt(P)")
   METH (putecptraw,            "WBUF.putecptraw(P)")
   METH (putge,                 "WBUF.putge(X)")
   METH (putgeraw,              "WBUF.putgeraw(X)")