mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-27 02:20:31 +00:00
bbf6d9b026
Bugfix for feeds - removed categories related and up - load new books now working - category random now working login page is free of non accessible elements boolean custom column is vivible in UI books with only with certain languages can be shown book shelfs can be deleted from UI Anonymous user view is more resticted Added browse of series in sidebar Dependencys in vendor folder are updated to newer versions (licencs files are now present) Bugfix editing Authors names Made upload on windows working
53 lines
1.0 KiB
C
53 lines
1.0 KiB
C
#define PY_SSIZE_T_CLEAN
|
|
#include <Python.h>
|
|
|
|
static PyObject* websocket_mask(PyObject* self, PyObject* args) {
|
|
const char* mask;
|
|
Py_ssize_t mask_len;
|
|
const char* data;
|
|
Py_ssize_t data_len;
|
|
Py_ssize_t i;
|
|
PyObject* result;
|
|
char* buf;
|
|
|
|
if (!PyArg_ParseTuple(args, "s#s#", &mask, &mask_len, &data, &data_len)) {
|
|
return NULL;
|
|
}
|
|
|
|
result = PyBytes_FromStringAndSize(NULL, data_len);
|
|
if (!result) {
|
|
return NULL;
|
|
}
|
|
buf = PyBytes_AsString(result);
|
|
for (i = 0; i < data_len; i++) {
|
|
buf[i] = data[i] ^ mask[i % 4];
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
static PyMethodDef methods[] = {
|
|
{"websocket_mask", websocket_mask, METH_VARARGS, ""},
|
|
{NULL, NULL, 0, NULL}
|
|
};
|
|
|
|
#if PY_MAJOR_VERSION >= 3
|
|
static struct PyModuleDef speedupsmodule = {
|
|
PyModuleDef_HEAD_INIT,
|
|
"speedups",
|
|
NULL,
|
|
-1,
|
|
methods
|
|
};
|
|
|
|
PyMODINIT_FUNC
|
|
PyInit_speedups() {
|
|
return PyModule_Create(&speedupsmodule);
|
|
}
|
|
#else // Python 2.x
|
|
PyMODINIT_FUNC
|
|
initspeedups() {
|
|
Py_InitModule("tornado.speedups", methods);
|
|
}
|
|
#endif
|