libwebp.py: update to swig 3.0.12

fixes use with python 3

Change-Id: I4035c1c93e9f6551dd2e7e57da7d4ffd42ca06ce
This commit is contained in:
James Zern 2019-08-31 19:20:58 -07:00
parent 0e48d889eb
commit 601ef17cf6
3 changed files with 93 additions and 61 deletions

View File

@ -1,14 +1,9 @@
# Lint as: python2, python3
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.10
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_import_helper():
@ -31,10 +26,10 @@ elif _swig_python_version_info >= (2, 6, 0):
except ImportError:
import _libwebp
return _libwebp
if fp is not None:
try:
_mod = imp.load_module('_libwebp', fp, pathname, description)
finally:
if fp is not None:
fp.close()
return _mod
_libwebp = swig_import_helper()
@ -42,6 +37,7 @@ elif _swig_python_version_info >= (2, 6, 0):
else:
import _libwebp
del _swig_python_version_info
try:
_swig_property = property
except NameError:

View File

@ -32,6 +32,9 @@
#ifdef SWIGPYTHON
%module(package="com.google.webp") libwebp
%begin %{
#define SWIG_PYTHON_STRICT_BYTE_CHAR
%}
#else
%module libwebp
#endif /* SWIGPYTHON */

View File

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.10
* Version 3.0.12
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
@ -8,6 +8,9 @@
* interface file instead.
* ----------------------------------------------------------------------------- */
#define SWIG_PYTHON_STRICT_BYTE_CHAR
#ifndef SWIGPYTHON
#define SWIGPYTHON
@ -749,6 +752,7 @@ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
#define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
#define PyString_Check(name) PyBytes_Check(name)
#define PyString_FromString(x) PyUnicode_FromString(x)
#define PyString_FromStringAndSize(x, y) PyBytes_FromStringAndSize(x, y)
#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
#define PyString_AsString(str) PyBytes_AsString(str)
#define PyString_Size(str) PyBytes_Size(str)
@ -952,6 +956,7 @@ typedef destructor freefunc;
#if PY_VERSION_HEX < 0x03020000
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
#define Py_hash_t long
#endif
/* -----------------------------------------------------------------------------
@ -1607,6 +1612,14 @@ SwigPyObject_repr(SwigPyObject *v, PyObject *args)
return repr;
}
/* We need a version taking two PyObject* parameters so it's a valid
* PyCFunction to use in swigobject_methods[]. */
SWIGRUNTIME PyObject *
SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
{
return SwigPyObject_repr((SwigPyObject*)v);
}
SWIGRUNTIME int
SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
{
@ -1736,11 +1749,7 @@ SwigPyObject_append(PyObject* v, PyObject* next)
}
SWIGRUNTIME PyObject*
#ifdef METH_NOARGS
SwigPyObject_next(PyObject* v)
#else
SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
#endif
{
SwigPyObject *sobj = (SwigPyObject *) v;
if (sobj->next) {
@ -1775,6 +1784,20 @@ SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
return SWIG_Py_Void();
}
#ifdef METH_NOARGS
static PyObject*
SwigPyObject_disown2(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
{
return SwigPyObject_disown(v);
}
static PyObject*
SwigPyObject_acquire2(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
{
return SwigPyObject_acquire(v);
}
#endif
SWIGINTERN PyObject*
SwigPyObject_own(PyObject *v, PyObject *args)
{
@ -1815,12 +1838,12 @@ SwigPyObject_own(PyObject *v, PyObject *args)
#ifdef METH_O
static PyMethodDef
swigobject_methods[] = {
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"},
{(char *)"disown", (PyCFunction)SwigPyObject_disown2, METH_NOARGS, (char *)"releases ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire2,METH_NOARGS, (char *)"acquires ownership of the pointer"},
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"},
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
{(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"},
{(char *)"__repr__",(PyCFunction)SwigPyObject_repr2, METH_NOARGS, (char *)"returns object representation"},
{0, 0, 0, 0}
};
#else
@ -1900,7 +1923,6 @@ SwigPyObject_TypeOnce(void) {
static int type_init = 0;
if (!type_init) {
const PyTypeObject tmp = {
/* PyObject header changed in Python 3 */
#if PY_VERSION_HEX >= 0x03000000
PyVarObject_HEAD_INIT(NULL, 0)
#else
@ -2092,7 +2114,6 @@ SwigPyPacked_TypeOnce(void) {
static int type_init = 0;
if (!type_init) {
const PyTypeObject tmp = {
/* PyObject header changed in Python 3 */
#if PY_VERSION_HEX>=0x03000000
PyVarObject_HEAD_INIT(NULL, 0)
#else
@ -3011,7 +3032,7 @@ static swig_module_info swig_module = {swig_types, 3, 0, 0, 0, 0};
#endif
#define SWIG_name "_libwebp"
#define SWIGVERSION 0x030010
#define SWIGVERSION 0x030012
#define SWIG_VERSION SWIGVERSION
@ -3086,7 +3107,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
if (*alloc == SWIG_NEWOBJ)
#endif
{
*cptr = (char *)memcpy((char *)malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
*cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
*alloc = SWIG_NEWOBJ;
} else {
*cptr = cstr;
@ -3124,7 +3145,7 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) {
if (cptr) {
if (alloc) *alloc = SWIG_NEWOBJ;
*cptr = (char *)memcpy((char *)malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
*cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
}
if (psize) *psize = len + 1;
@ -3161,7 +3182,7 @@ SWIG_AsVal_double (PyObject *obj, double *val)
return SWIG_OK;
#if PY_VERSION_HEX < 0x03000000
} else if (PyInt_Check(obj)) {
if (val) *val = PyInt_AsLong(obj);
if (val) *val = (double) PyInt_AsLong(obj);
return SWIG_OK;
#endif
} else if (PyLong_Check(obj)) {
@ -3324,6 +3345,8 @@ SWIG_AsVal_unsigned_SS_long_SS_long (PyObject *obj, unsigned long long *val)
const double mant_max = 1LL << DBL_MANT_DIG;
double d;
res = SWIG_AsVal_double (obj,&d);
if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, 0, mant_max))
return SWIG_OverflowError;
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) {
if (val) *val = (unsigned long long)(d);
return SWIG_AddCast(res);
@ -3547,11 +3570,25 @@ SWIG_AsVal_int (PyObject * obj, int *val)
/* Getting isfinite working pre C99 across multiple platforms is non-trivial. Users can provide SWIG_isfinite on older platforms. */
#ifndef SWIG_isfinite
/* isfinite() is a macro for C99, but a function in namespace std for C++11. */
/* isfinite() is a macro for C99 */
# if defined(isfinite)
# define SWIG_isfinite(X) (isfinite(X))
# elif defined __cplusplus && __cplusplus >= 201103L
# define SWIG_isfinite(X) (std::isfinite(X))
/* Use a template so that this works whether isfinite() is std::isfinite() or
* in the global namespace. The reality seems to vary between compiler
* versions.
*
* Make sure namespace std exists to avoid compiler warnings.
*
* extern "C++" is required as this fragment can end up inside an extern "C" { } block
*/
namespace std { }
extern "C++" template<typename T>
inline int SWIG_isfinite_func(T x) {
using namespace std;
return isfinite(x);
}
# define SWIG_isfinite(X) (SWIG_isfinite_func(X))
# elif defined(_MSC_VER)
# define SWIG_isfinite(X) (_finite(X))
# elif defined(__sun) && defined(__SVR4)
@ -4851,23 +4888,23 @@ fail:
static PyMethodDef SwigMethods[] = {
{ (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL},
{ (char *)"WebPGetDecoderVersion", _wrap_WebPGetDecoderVersion, METH_VARARGS, (char *)"WebPGetDecoderVersion() -> int"},
{ (char *)"WebPGetInfo", _wrap_WebPGetInfo, METH_VARARGS, (char *)"WebPGetInfo(uint8_t data) -> (width, height)"},
{ (char *)"WebPDecodeRGB", _wrap_WebPDecodeRGB, METH_VARARGS, (char *)"WebPDecodeRGB(uint8_t data) -> (rgb, width, height)"},
{ (char *)"WebPDecodeRGBA", _wrap_WebPDecodeRGBA, METH_VARARGS, (char *)"WebPDecodeRGBA(uint8_t data) -> (rgb, width, height)"},
{ (char *)"WebPDecodeARGB", _wrap_WebPDecodeARGB, METH_VARARGS, (char *)"WebPDecodeARGB(uint8_t data) -> (rgb, width, height)"},
{ (char *)"WebPDecodeBGR", _wrap_WebPDecodeBGR, METH_VARARGS, (char *)"WebPDecodeBGR(uint8_t data) -> (rgb, width, height)"},
{ (char *)"WebPDecodeBGRA", _wrap_WebPDecodeBGRA, METH_VARARGS, (char *)"WebPDecodeBGRA(uint8_t data) -> (rgb, width, height)"},
{ (char *)"WebPGetEncoderVersion", _wrap_WebPGetEncoderVersion, METH_VARARGS, (char *)"WebPGetEncoderVersion() -> int"},
{ (char *)"wrap_WebPEncodeRGB", _wrap_wrap_WebPEncodeRGB, METH_VARARGS, (char *)"private, do not call directly."},
{ (char *)"wrap_WebPEncodeBGR", _wrap_wrap_WebPEncodeBGR, METH_VARARGS, (char *)"private, do not call directly."},
{ (char *)"wrap_WebPEncodeRGBA", _wrap_wrap_WebPEncodeRGBA, METH_VARARGS, (char *)"private, do not call directly."},
{ (char *)"wrap_WebPEncodeBGRA", _wrap_wrap_WebPEncodeBGRA, METH_VARARGS, (char *)"private, do not call directly."},
{ (char *)"wrap_WebPEncodeLosslessRGB", _wrap_wrap_WebPEncodeLosslessRGB, METH_VARARGS, (char *)"private, do not call directly."},
{ (char *)"wrap_WebPEncodeLosslessBGR", _wrap_wrap_WebPEncodeLosslessBGR, METH_VARARGS, (char *)"private, do not call directly."},
{ (char *)"wrap_WebPEncodeLosslessRGBA", _wrap_wrap_WebPEncodeLosslessRGBA, METH_VARARGS, (char *)"private, do not call directly."},
{ (char *)"wrap_WebPEncodeLosslessBGRA", _wrap_wrap_WebPEncodeLosslessBGRA, METH_VARARGS, (char *)"private, do not call directly."},
{ "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New, METH_O, NULL},
{ "WebPGetDecoderVersion", _wrap_WebPGetDecoderVersion, METH_VARARGS, (char *)"WebPGetDecoderVersion() -> int"},
{ "WebPGetInfo", _wrap_WebPGetInfo, METH_VARARGS, (char *)"WebPGetInfo(uint8_t data) -> (width, height)"},
{ "WebPDecodeRGB", _wrap_WebPDecodeRGB, METH_VARARGS, (char *)"WebPDecodeRGB(uint8_t data) -> (rgb, width, height)"},
{ "WebPDecodeRGBA", _wrap_WebPDecodeRGBA, METH_VARARGS, (char *)"WebPDecodeRGBA(uint8_t data) -> (rgb, width, height)"},
{ "WebPDecodeARGB", _wrap_WebPDecodeARGB, METH_VARARGS, (char *)"WebPDecodeARGB(uint8_t data) -> (rgb, width, height)"},
{ "WebPDecodeBGR", _wrap_WebPDecodeBGR, METH_VARARGS, (char *)"WebPDecodeBGR(uint8_t data) -> (rgb, width, height)"},
{ "WebPDecodeBGRA", _wrap_WebPDecodeBGRA, METH_VARARGS, (char *)"WebPDecodeBGRA(uint8_t data) -> (rgb, width, height)"},
{ "WebPGetEncoderVersion", _wrap_WebPGetEncoderVersion, METH_VARARGS, (char *)"WebPGetEncoderVersion() -> int"},
{ "wrap_WebPEncodeRGB", _wrap_wrap_WebPEncodeRGB, METH_VARARGS, (char *)"private, do not call directly."},
{ "wrap_WebPEncodeBGR", _wrap_wrap_WebPEncodeBGR, METH_VARARGS, (char *)"private, do not call directly."},
{ "wrap_WebPEncodeRGBA", _wrap_wrap_WebPEncodeRGBA, METH_VARARGS, (char *)"private, do not call directly."},
{ "wrap_WebPEncodeBGRA", _wrap_wrap_WebPEncodeBGRA, METH_VARARGS, (char *)"private, do not call directly."},
{ "wrap_WebPEncodeLosslessRGB", _wrap_wrap_WebPEncodeLosslessRGB, METH_VARARGS, (char *)"private, do not call directly."},
{ "wrap_WebPEncodeLosslessBGR", _wrap_wrap_WebPEncodeLosslessBGR, METH_VARARGS, (char *)"private, do not call directly."},
{ "wrap_WebPEncodeLosslessRGBA", _wrap_wrap_WebPEncodeLosslessRGBA, METH_VARARGS, (char *)"private, do not call directly."},
{ "wrap_WebPEncodeLosslessBGRA", _wrap_wrap_WebPEncodeLosslessBGRA, METH_VARARGS, (char *)"private, do not call directly."},
{ NULL, NULL, 0, NULL }
};
@ -5271,7 +5308,6 @@ extern "C" {
static int type_init = 0;
if (!type_init) {
const PyTypeObject tmp = {
/* PyObject header changed in Python 3 */
#if PY_VERSION_HEX >= 0x03000000
PyVarObject_HEAD_INIT(NULL, 0)
#else
@ -5433,9 +5469,9 @@ extern "C" {
char *ndoc = (char*)malloc(ldoc + lptr + 10);
if (ndoc) {
char *buff = ndoc;
strncpy(buff, methods[i].ml_doc, ldoc);
memcpy(buff, methods[i].ml_doc, ldoc);
buff += ldoc;
strncpy(buff, "swig_ptr: ", 10);
memcpy(buff, "swig_ptr: ", 10);
buff += 10;
SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
methods[i].ml_doc = ndoc;
@ -5497,19 +5533,19 @@ SWIG_init(void) {
(char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
};
static SwigPyGetSet thisown_getset_closure = {
(PyCFunction) SwigPyObject_own,
(PyCFunction) SwigPyObject_own
SwigPyObject_own,
SwigPyObject_own
};
static PyGetSetDef thisown_getset_def = {
(char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
};
PyObject *metatype_args;
PyTypeObject *builtin_pytype;
int builtin_base_count;
swig_type_info *builtin_basetype;
PyObject *tuple;
PyGetSetDescrObject *static_getset;
PyTypeObject *metatype;
PyTypeObject *swigpyobject;
SwigPyClientData *cd;
PyObject *public_interface, *public_symbol;
PyObject *this_descr;
@ -5524,14 +5560,9 @@ SWIG_init(void) {
(void)static_getset;
(void)self;
/* metatype is used to implement static member variables. */
metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type);
assert(metatype_args);
metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL);
/* Metaclass is used to implement static member variables */
metatype = SwigPyObjectType();
assert(metatype);
Py_DECREF(metatype_args);
metatype->tp_setattro = (setattrofunc) &SwigPyObjectType_setattro;
assert(PyType_Ready(metatype) >= 0);
#endif
/* Fix SwigMethods to carry the callback ptrs when needed */
@ -5549,13 +5580,15 @@ SWIG_init(void) {
SWIG_InitializeModule(0);
#ifdef SWIGPYTHON_BUILTIN
swigpyobject = SwigPyObject_TypeOnce();
SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
assert(SwigPyObject_stype);
cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
if (!cd) {
SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
SwigPyObject_clientdata.pytype = SwigPyObject_TypeOnce();
} else if (SwigPyObject_TypeOnce()->tp_basicsize != cd->pytype->tp_basicsize) {
SwigPyObject_clientdata.pytype = swigpyobject;
} else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) {
PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
# if PY_VERSION_HEX >= 0x03000000
return NULL;