2014-01-25 05:21:23 -04:00
|
|
|
/*[clinic input]
|
|
|
|
preserve
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
PyDoc_STRVAR(binascii_a2b_uu__doc__,
|
2014-02-09 02:15:29 -04:00
|
|
|
"a2b_uu($module, data, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2014-01-25 05:21:23 -04:00
|
|
|
"Decode a line of uuencoded data.");
|
|
|
|
|
|
|
|
#define BINASCII_A2B_UU_METHODDEF \
|
2015-04-03 18:12:11 -03:00
|
|
|
{"a2b_uu", (PyCFunction)binascii_a2b_uu, METH_O, binascii_a2b_uu__doc__},
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_a2b_uu_impl(PyObject *module, Py_buffer *data);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_a2b_uu(PyObject *module, PyObject *arg)
|
2014-01-25 05:21:23 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
2014-01-26 11:41:58 -04:00
|
|
|
Py_buffer data = {NULL, NULL};
|
2014-01-25 05:21:23 -04:00
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "O&:a2b_uu", ascii_buffer_converter, &data)) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:49:49 -04:00
|
|
|
return_value = binascii_a2b_uu_impl(module, &data);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
exit:
|
2014-01-26 11:41:58 -04:00
|
|
|
/* Cleanup for data */
|
|
|
|
if (data.obj)
|
|
|
|
PyBuffer_Release(&data);
|
|
|
|
|
2014-01-25 05:21:23 -04:00
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(binascii_b2a_uu__doc__,
|
2014-02-09 02:15:29 -04:00
|
|
|
"b2a_uu($module, data, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2014-01-25 05:21:23 -04:00
|
|
|
"Uuencode line of data.");
|
|
|
|
|
|
|
|
#define BINASCII_B2A_UU_METHODDEF \
|
2015-04-03 18:12:11 -03:00
|
|
|
{"b2a_uu", (PyCFunction)binascii_b2a_uu, METH_O, binascii_b2a_uu__doc__},
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_b2a_uu_impl(PyObject *module, Py_buffer *data);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_b2a_uu(PyObject *module, PyObject *arg)
|
2014-01-25 05:21:23 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "y*:b2a_uu", &data)) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
return_value = binascii_b2a_uu_impl(module, &data);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2014-01-25 05:21:23 -04:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(binascii_a2b_base64__doc__,
|
2014-02-09 02:15:29 -04:00
|
|
|
"a2b_base64($module, data, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2014-01-25 05:21:23 -04:00
|
|
|
"Decode a line of base64 data.");
|
|
|
|
|
|
|
|
#define BINASCII_A2B_BASE64_METHODDEF \
|
2015-04-03 18:12:11 -03:00
|
|
|
{"a2b_base64", (PyCFunction)binascii_a2b_base64, METH_O, binascii_a2b_base64__doc__},
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_a2b_base64_impl(PyObject *module, Py_buffer *data);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_a2b_base64(PyObject *module, PyObject *arg)
|
2014-01-25 05:21:23 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
2014-01-26 11:41:58 -04:00
|
|
|
Py_buffer data = {NULL, NULL};
|
2014-01-25 05:21:23 -04:00
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "O&:a2b_base64", ascii_buffer_converter, &data)) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:49:49 -04:00
|
|
|
return_value = binascii_a2b_base64_impl(module, &data);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
exit:
|
2014-01-26 11:41:58 -04:00
|
|
|
/* Cleanup for data */
|
|
|
|
if (data.obj)
|
|
|
|
PyBuffer_Release(&data);
|
|
|
|
|
2014-01-25 05:21:23 -04:00
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(binascii_b2a_base64__doc__,
|
2017-05-01 02:12:07 -03:00
|
|
|
"b2a_base64($module, data, /, *, newline=True)\n"
|
2014-02-09 02:15:29 -04:00
|
|
|
"--\n"
|
|
|
|
"\n"
|
2014-01-25 05:21:23 -04:00
|
|
|
"Base64-code line of data.");
|
|
|
|
|
|
|
|
#define BINASCII_B2A_BASE64_METHODDEF \
|
2016-09-10 00:00:13 -03:00
|
|
|
{"b2a_base64", (PyCFunction)binascii_b2a_base64, METH_FASTCALL, binascii_b2a_base64__doc__},
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 12:20:03 -03:00
|
|
|
binascii_b2a_base64_impl(PyObject *module, Py_buffer *data, int newline);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-09-10 00:00:13 -03:00
|
|
|
binascii_b2a_base64(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2014-01-25 05:21:23 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
2017-05-01 02:12:07 -03:00
|
|
|
static const char * const _keywords[] = {"", "newline", NULL};
|
2016-08-14 04:52:18 -03:00
|
|
|
static _PyArg_Parser _parser = {"y*|$i:b2a_base64", _keywords, 0};
|
2014-01-25 05:21:23 -04:00
|
|
|
Py_buffer data = {NULL, NULL};
|
2015-10-11 06:01:02 -03:00
|
|
|
int newline = 1;
|
2014-01-25 05:21:23 -04:00
|
|
|
|
2017-01-16 20:29:01 -04:00
|
|
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &newline)) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-10-11 06:01:02 -03:00
|
|
|
return_value = binascii_b2a_base64_impl(module, &data, newline);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2014-01-25 05:21:23 -04:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(binascii_a2b_hqx__doc__,
|
2014-02-09 02:15:29 -04:00
|
|
|
"a2b_hqx($module, data, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2014-01-25 05:21:23 -04:00
|
|
|
"Decode .hqx coding.");
|
|
|
|
|
|
|
|
#define BINASCII_A2B_HQX_METHODDEF \
|
2015-04-03 18:12:11 -03:00
|
|
|
{"a2b_hqx", (PyCFunction)binascii_a2b_hqx, METH_O, binascii_a2b_hqx__doc__},
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_a2b_hqx_impl(PyObject *module, Py_buffer *data);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_a2b_hqx(PyObject *module, PyObject *arg)
|
2014-01-25 05:21:23 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
2014-01-26 11:41:58 -04:00
|
|
|
Py_buffer data = {NULL, NULL};
|
2014-01-25 05:21:23 -04:00
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "O&:a2b_hqx", ascii_buffer_converter, &data)) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:49:49 -04:00
|
|
|
return_value = binascii_a2b_hqx_impl(module, &data);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
exit:
|
2014-01-26 11:41:58 -04:00
|
|
|
/* Cleanup for data */
|
|
|
|
if (data.obj)
|
|
|
|
PyBuffer_Release(&data);
|
|
|
|
|
2014-01-25 05:21:23 -04:00
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(binascii_rlecode_hqx__doc__,
|
2014-02-09 02:15:29 -04:00
|
|
|
"rlecode_hqx($module, data, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2014-01-25 05:21:23 -04:00
|
|
|
"Binhex RLE-code binary data.");
|
|
|
|
|
|
|
|
#define BINASCII_RLECODE_HQX_METHODDEF \
|
2015-04-03 18:12:11 -03:00
|
|
|
{"rlecode_hqx", (PyCFunction)binascii_rlecode_hqx, METH_O, binascii_rlecode_hqx__doc__},
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_rlecode_hqx_impl(PyObject *module, Py_buffer *data);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_rlecode_hqx(PyObject *module, PyObject *arg)
|
2014-01-25 05:21:23 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "y*:rlecode_hqx", &data)) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
return_value = binascii_rlecode_hqx_impl(module, &data);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2014-01-25 05:21:23 -04:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(binascii_b2a_hqx__doc__,
|
2014-02-09 02:15:29 -04:00
|
|
|
"b2a_hqx($module, data, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2014-01-25 05:21:23 -04:00
|
|
|
"Encode .hqx data.");
|
|
|
|
|
|
|
|
#define BINASCII_B2A_HQX_METHODDEF \
|
2015-04-03 18:12:11 -03:00
|
|
|
{"b2a_hqx", (PyCFunction)binascii_b2a_hqx, METH_O, binascii_b2a_hqx__doc__},
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_b2a_hqx_impl(PyObject *module, Py_buffer *data);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_b2a_hqx(PyObject *module, PyObject *arg)
|
2014-01-25 05:21:23 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "y*:b2a_hqx", &data)) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
return_value = binascii_b2a_hqx_impl(module, &data);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2014-01-25 05:21:23 -04:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(binascii_rledecode_hqx__doc__,
|
2014-02-09 02:15:29 -04:00
|
|
|
"rledecode_hqx($module, data, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2014-01-25 05:21:23 -04:00
|
|
|
"Decode hexbin RLE-coded string.");
|
|
|
|
|
|
|
|
#define BINASCII_RLEDECODE_HQX_METHODDEF \
|
2015-04-03 18:12:11 -03:00
|
|
|
{"rledecode_hqx", (PyCFunction)binascii_rledecode_hqx, METH_O, binascii_rledecode_hqx__doc__},
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_rledecode_hqx_impl(PyObject *module, Py_buffer *data);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_rledecode_hqx(PyObject *module, PyObject *arg)
|
2014-01-25 05:21:23 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "y*:rledecode_hqx", &data)) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
return_value = binascii_rledecode_hqx_impl(module, &data);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2014-01-25 05:21:23 -04:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(binascii_crc_hqx__doc__,
|
2014-02-09 02:15:29 -04:00
|
|
|
"crc_hqx($module, data, crc, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2016-12-24 03:36:44 -04:00
|
|
|
"Compute CRC-CCITT incrementally.");
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
#define BINASCII_CRC_HQX_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"crc_hqx", (PyCFunction)binascii_crc_hqx, METH_FASTCALL, binascii_crc_hqx__doc__},
|
2014-01-25 05:21:23 -04:00
|
|
|
|
2015-04-20 03:26:49 -03:00
|
|
|
static unsigned int
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_crc_hqx_impl(PyObject *module, Py_buffer *data, unsigned int crc);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
binascii_crc_hqx(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2014-01-25 05:21:23 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
2015-04-20 03:26:49 -03:00
|
|
|
unsigned int crc;
|
|
|
|
unsigned int _return_value;
|
2014-01-25 05:21:23 -04:00
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*I:crc_hqx",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &crc)) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("crc_hqx", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
_return_value = binascii_crc_hqx_impl(module, &data, crc);
|
2016-06-09 10:16:06 -03:00
|
|
|
if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-04-20 03:26:49 -03:00
|
|
|
return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2014-01-25 05:21:23 -04:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(binascii_crc32__doc__,
|
2014-02-09 02:15:29 -04:00
|
|
|
"crc32($module, data, crc=0, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2014-01-25 05:21:23 -04:00
|
|
|
"Compute CRC-32 incrementally.");
|
|
|
|
|
|
|
|
#define BINASCII_CRC32_METHODDEF \
|
2017-01-16 20:35:17 -04:00
|
|
|
{"crc32", (PyCFunction)binascii_crc32, METH_FASTCALL, binascii_crc32__doc__},
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static unsigned int
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_crc32_impl(PyObject *module, Py_buffer *data, unsigned int crc);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2017-01-16 20:35:17 -04:00
|
|
|
binascii_crc32(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2014-01-25 05:21:23 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
unsigned int crc = 0;
|
|
|
|
unsigned int _return_value;
|
|
|
|
|
2017-01-16 20:35:17 -04:00
|
|
|
if (!_PyArg_ParseStack(args, nargs, "y*|I:crc32",
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, &crc)) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2017-01-16 20:35:17 -04:00
|
|
|
|
|
|
|
if (!_PyArg_NoStackKeywords("crc32", kwnames)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
_return_value = binascii_crc32_impl(module, &data, crc);
|
2016-06-09 10:16:06 -03:00
|
|
|
if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
return_value = PyLong_FromUnsignedLong((unsigned long)_return_value);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2014-01-25 05:21:23 -04:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(binascii_b2a_hex__doc__,
|
2014-02-09 02:15:29 -04:00
|
|
|
"b2a_hex($module, data, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2014-01-25 05:21:23 -04:00
|
|
|
"Hexadecimal representation of binary data.\n"
|
|
|
|
"\n"
|
|
|
|
"The return value is a bytes object. This function is also\n"
|
|
|
|
"available as \"hexlify()\".");
|
|
|
|
|
|
|
|
#define BINASCII_B2A_HEX_METHODDEF \
|
2015-04-03 18:12:11 -03:00
|
|
|
{"b2a_hex", (PyCFunction)binascii_b2a_hex, METH_O, binascii_b2a_hex__doc__},
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_b2a_hex_impl(PyObject *module, Py_buffer *data);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_b2a_hex(PyObject *module, PyObject *arg)
|
2014-01-25 05:21:23 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "y*:b2a_hex", &data)) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
return_value = binascii_b2a_hex_impl(module, &data);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2014-01-25 05:21:23 -04:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2015-01-20 15:59:46 -04:00
|
|
|
PyDoc_STRVAR(binascii_hexlify__doc__,
|
|
|
|
"hexlify($module, data, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Hexadecimal representation of binary data.\n"
|
|
|
|
"\n"
|
|
|
|
"The return value is a bytes object.");
|
|
|
|
|
|
|
|
#define BINASCII_HEXLIFY_METHODDEF \
|
2015-04-03 18:12:11 -03:00
|
|
|
{"hexlify", (PyCFunction)binascii_hexlify, METH_O, binascii_hexlify__doc__},
|
2015-01-20 15:59:46 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_hexlify_impl(PyObject *module, Py_buffer *data);
|
2015-01-20 15:59:46 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_hexlify(PyObject *module, PyObject *arg)
|
2015-01-20 15:59:46 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "y*:hexlify", &data)) {
|
2015-01-20 15:59:46 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-01-20 15:59:46 -04:00
|
|
|
return_value = binascii_hexlify_impl(module, &data);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2015-01-20 15:59:46 -04:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-01-20 15:59:46 -04:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2014-01-25 05:21:23 -04:00
|
|
|
PyDoc_STRVAR(binascii_a2b_hex__doc__,
|
2014-02-09 02:15:29 -04:00
|
|
|
"a2b_hex($module, hexstr, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2014-01-25 05:21:23 -04:00
|
|
|
"Binary data of hexadecimal representation.\n"
|
|
|
|
"\n"
|
|
|
|
"hexstr must contain an even number of hex digits (upper or lower case).\n"
|
|
|
|
"This function is also available as \"unhexlify()\".");
|
|
|
|
|
|
|
|
#define BINASCII_A2B_HEX_METHODDEF \
|
2015-04-03 18:12:11 -03:00
|
|
|
{"a2b_hex", (PyCFunction)binascii_a2b_hex, METH_O, binascii_a2b_hex__doc__},
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_a2b_hex_impl(PyObject *module, Py_buffer *hexstr);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_a2b_hex(PyObject *module, PyObject *arg)
|
2014-01-25 05:21:23 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
2014-01-26 11:41:58 -04:00
|
|
|
Py_buffer hexstr = {NULL, NULL};
|
2014-01-25 05:21:23 -04:00
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "O&:a2b_hex", ascii_buffer_converter, &hexstr)) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
return_value = binascii_a2b_hex_impl(module, &hexstr);
|
|
|
|
|
|
|
|
exit:
|
2014-01-26 11:41:58 -04:00
|
|
|
/* Cleanup for hexstr */
|
|
|
|
if (hexstr.obj)
|
|
|
|
PyBuffer_Release(&hexstr);
|
|
|
|
|
2014-01-25 05:21:23 -04:00
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2015-01-20 15:59:46 -04:00
|
|
|
PyDoc_STRVAR(binascii_unhexlify__doc__,
|
|
|
|
"unhexlify($module, hexstr, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Binary data of hexadecimal representation.\n"
|
|
|
|
"\n"
|
|
|
|
"hexstr must contain an even number of hex digits (upper or lower case).");
|
|
|
|
|
|
|
|
#define BINASCII_UNHEXLIFY_METHODDEF \
|
2015-04-03 18:12:11 -03:00
|
|
|
{"unhexlify", (PyCFunction)binascii_unhexlify, METH_O, binascii_unhexlify__doc__},
|
2015-01-20 15:59:46 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_unhexlify_impl(PyObject *module, Py_buffer *hexstr);
|
2015-01-20 15:59:46 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_unhexlify(PyObject *module, PyObject *arg)
|
2015-01-20 15:59:46 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
Py_buffer hexstr = {NULL, NULL};
|
|
|
|
|
2016-06-09 10:16:06 -03:00
|
|
|
if (!PyArg_Parse(arg, "O&:unhexlify", ascii_buffer_converter, &hexstr)) {
|
2015-01-20 15:59:46 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2015-01-20 15:59:46 -04:00
|
|
|
return_value = binascii_unhexlify_impl(module, &hexstr);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for hexstr */
|
|
|
|
if (hexstr.obj)
|
|
|
|
PyBuffer_Release(&hexstr);
|
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
2014-01-25 05:21:23 -04:00
|
|
|
PyDoc_STRVAR(binascii_a2b_qp__doc__,
|
2014-02-09 02:15:29 -04:00
|
|
|
"a2b_qp($module, /, data, header=False)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2014-01-25 05:21:23 -04:00
|
|
|
"Decode a string of qp-encoded data.");
|
|
|
|
|
|
|
|
#define BINASCII_A2B_QP_METHODDEF \
|
2016-09-10 00:00:13 -03:00
|
|
|
{"a2b_qp", (PyCFunction)binascii_a2b_qp, METH_FASTCALL, binascii_a2b_qp__doc__},
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_a2b_qp_impl(PyObject *module, Py_buffer *data, int header);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-09-10 00:00:13 -03:00
|
|
|
binascii_a2b_qp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2014-01-25 05:21:23 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
2016-08-14 04:52:18 -03:00
|
|
|
static const char * const _keywords[] = {"data", "header", NULL};
|
|
|
|
static _PyArg_Parser _parser = {"O&|i:a2b_qp", _keywords, 0};
|
2014-01-26 11:41:58 -04:00
|
|
|
Py_buffer data = {NULL, NULL};
|
2014-01-25 05:21:23 -04:00
|
|
|
int header = 0;
|
|
|
|
|
2017-01-16 20:29:01 -04:00
|
|
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
2016-06-09 10:16:06 -03:00
|
|
|
ascii_buffer_converter, &data, &header)) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:49:49 -04:00
|
|
|
return_value = binascii_a2b_qp_impl(module, &data, header);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
exit:
|
2014-01-26 11:41:58 -04:00
|
|
|
/* Cleanup for data */
|
|
|
|
if (data.obj)
|
|
|
|
PyBuffer_Release(&data);
|
|
|
|
|
2014-01-25 05:21:23 -04:00
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
PyDoc_STRVAR(binascii_b2a_qp__doc__,
|
2014-02-09 02:15:29 -04:00
|
|
|
"b2a_qp($module, /, data, quotetabs=False, istext=True, header=False)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
2014-01-25 05:21:23 -04:00
|
|
|
"Encode a string using quoted-printable encoding.\n"
|
|
|
|
"\n"
|
|
|
|
"On encoding, when istext is set, newlines are not encoded, and white\n"
|
|
|
|
"space at end of lines is. When istext is not set, \\r and \\n (CR/LF)\n"
|
|
|
|
"are both encoded. When quotetabs is set, space and tabs are encoded.");
|
|
|
|
|
|
|
|
#define BINASCII_B2A_QP_METHODDEF \
|
2016-09-10 00:00:13 -03:00
|
|
|
{"b2a_qp", (PyCFunction)binascii_b2a_qp, METH_FASTCALL, binascii_b2a_qp__doc__},
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-07-07 11:35:15 -03:00
|
|
|
binascii_b2a_qp_impl(PyObject *module, Py_buffer *data, int quotetabs,
|
2015-04-14 19:07:59 -03:00
|
|
|
int istext, int header);
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
static PyObject *
|
2016-09-10 00:00:13 -03:00
|
|
|
binascii_b2a_qp(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
|
2014-01-25 05:21:23 -04:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
2016-08-14 04:52:18 -03:00
|
|
|
static const char * const _keywords[] = {"data", "quotetabs", "istext", "header", NULL};
|
|
|
|
static _PyArg_Parser _parser = {"y*|iii:b2a_qp", _keywords, 0};
|
2014-01-25 05:21:23 -04:00
|
|
|
Py_buffer data = {NULL, NULL};
|
|
|
|
int quotetabs = 0;
|
|
|
|
int istext = 1;
|
|
|
|
int header = 0;
|
|
|
|
|
2017-01-16 20:29:01 -04:00
|
|
|
if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
|
2016-06-09 10:16:06 -03:00
|
|
|
&data, "etabs, &istext, &header)) {
|
2014-01-25 05:21:23 -04:00
|
|
|
goto exit;
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
return_value = binascii_b2a_qp_impl(module, &data, quotetabs, istext, header);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for data */
|
2016-06-09 10:16:06 -03:00
|
|
|
if (data.obj) {
|
2014-01-25 05:21:23 -04:00
|
|
|
PyBuffer_Release(&data);
|
2016-06-09 10:16:06 -03:00
|
|
|
}
|
2014-01-25 05:21:23 -04:00
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
2017-05-01 02:12:07 -03:00
|
|
|
/*[clinic end generated code: output=35821bce7e0e4714 input=a9049054013a1b77]*/
|