Skip to content

Commit

Permalink
#3031 remove unused oudated code
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed May 31, 2021
1 parent 32e3820 commit 4eb9e4d
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions xpra/buffers/buffers.c
@@ -1,34 +1,15 @@
/**
* This file is part of Xpra.
* Copyright (C) 2014 Antoine Martin <antoine@xpra.org>
* Copyright (C) 2014-2021 Antoine Martin <antoine@xpra.org>
* Xpra is released under the terms of the GNU GPL v2, or, at your option, any
* later version. See the file COPYING for details.
*/

#include "Python.h"

//Before Python 3.3, use PyMemoryView_FromBuffer
//MAJOR<<24 + MINOR<<16 + MICRO<<8
#if PY_VERSION_HEX<=0x3030000
PyObject *_memory_as_pybuffer(void *ptr, Py_ssize_t buf_len, int readonly) {
Py_buffer pybuf;
Py_ssize_t shape[] = {buf_len};
int ret;
if (readonly)
ret = PyBuffer_FillInfo(&pybuf, NULL, ptr, buf_len, 0, PyBUF_SIMPLE);
else
ret = PyBuffer_FillInfo(&pybuf, NULL, ptr, buf_len, 0, PyBUF_WRITABLE);
if (ret!=0)
return NULL;
pybuf.format = "B";
pybuf.shape = shape;
return PyMemoryView_FromBuffer(&pybuf);
}
#else
PyObject *_memory_as_pybuffer(void *ptr, Py_ssize_t buf_len, int readonly) {
return PyMemoryView_FromMemory(ptr, buf_len, readonly);
}
#endif

int _object_as_buffer(PyObject *obj, const void ** buffer, Py_ssize_t * buffer_len) {
Py_buffer *rpybuf;
Expand Down

0 comments on commit 4eb9e4d

Please sign in to comment.