File gcc-14.patch of Package cwiid
Index: cwiid/wminput/py_plugin.c
===================================================================
--- cwiid.orig/wminput/py_plugin.c
+++ cwiid/wminput/py_plugin.c
@@ -56,20 +56,20 @@
/* TODO: improve error checking */
struct py_plugin {
- PyVarObject *PyInfo;
- PyVarObject *handle;
- PyVarObject *init;
- PyVarObject *exec;
+ PyObject *PyInfo;
+ PyObject *handle;
+ PyObject *init;
+ PyObject *exec;
};
-static PyVarObject *PyCWiidModule = NULL;
-static PyVarObject *PySysModule = NULL;
-static PyVarObject *PyPath = NULL;
-static PyVarObject *PyWiimote = NULL;
-static PyVarObject *(*ConvertMesgArray)(int, union cwiid_mesg[]);
+static PyObject *PyCWiidModule = NULL;
+static PyObject *PySysModule = NULL;
+static PyObject *PyPath = NULL;
+static PyObject *PyWiimote = NULL;
+static PyObject *(*ConvertMesgArray)(int, union cwiid_mesg[]);
-static int py_plugin_info(struct plugin *, PyVarObject *);
-static PyVarObject *set_rpt_mode(PyVarObject *, PyVarObject *, PyVarObject *);
+static int py_plugin_info(struct plugin *, PyObject *);
+static PyObject *set_rpt_mode(PyObject *, PyObject *, PyObject *);
#define WMPLUGIN_CONST_MACRO(a) {#a, WMPLUGIN_##a}
static struct {
@@ -106,7 +106,7 @@ static struct PyModuleDef moduledef = {
int py_init(void)
{
- PyVarObject *PyObj, *PyWmPluginModule;
+ PyObject *PyObj, *PyWmPluginModule;
int i;
Py_InitializeEx(0);
@@ -131,7 +131,7 @@ int py_init(void)
PyErr_Print();
goto ERR_HND;
}
- PyCapsule_GetPointer(PyObj,ConvertMesgArray);
+ PyCapsule_GetPointer(PyObj,"ConvertMesgArray");
Py_DECREF(PyObj);
/* note: PyWmPluginModule is a borrowed reference - do not decref */
@@ -174,7 +174,7 @@ ERR_HND:
int py_wiimote(cwiid_wiimote_t *wiimote)
{
- PyVarObject *PyWiimoteType, *PyCObject, *PyArgs;
+ PyObject *PyWiimoteType, *PyCObject, *PyArgs;
if (!(PyWiimoteType = PyObject_GetAttrString(PyCWiidModule, "Wiimote"))) {
PyErr_Print();
@@ -224,9 +224,9 @@ void py_deinit(void)
int py_plugin_open(struct plugin *plugin, char *dir)
{
- PyVarObject *handle, *info;
- PyVarObject *PyStr;
- PyVarObject *PyErrType, *PyErr, *PyTraceback;
+ PyObject *handle, *info;
+ PyObject *PyStr;
+ PyObject *PyErrType, *PyErr, *PyTraceback;
if (!(PyStr = PyBytes_FromString(dir))) {
PyErr_Print();
@@ -307,15 +307,15 @@ int py_plugin_open(struct plugin *plugin
}
if (!PyCallable_Check(info)) {
wminput_err("Unable to load plugin info function: not callable");
- Py_DECREF((PyVarObject *)info);
+ Py_DECREF((PyObject *)info);
goto ERR_HND;
}
if (py_plugin_info(plugin, info)) {
wminput_err("Error on python_info");
- Py_DECREF((PyVarObject *)info);
+ Py_DECREF((PyObject *)info);
goto ERR_HND;
}
- Py_DECREF((PyVarObject *)info);
+ Py_DECREF((PyObject *)info);
((struct py_plugin *) plugin->p)->handle = handle;
@@ -352,10 +352,10 @@ void py_plugin_close(struct plugin *plug
free(plugin->p);
}
-static int py_plugin_info(struct plugin *plugin, PyVarObject *info)
+static int py_plugin_info(struct plugin *plugin, PyObject *info)
{
- PyVarObject *PyButtonInfo, *PyAxisInfo, *PyParamInfo;
- PyVarObject *PyObj;
+ PyObject *PyButtonInfo, *PyAxisInfo, *PyParamInfo;
+ PyObject *PyObj;
int i;
if (!(((struct py_plugin *)plugin->p)->PyInfo =
@@ -448,7 +448,7 @@ ERR_HND:
int py_plugin_init(struct plugin *plugin, int id)
{
- PyVarObject *PyArgs;
+ PyObject *PyArgs;
if (!(PyArgs = Py_BuildValue("(i,O)", id, PyWiimote))) {
PyErr_Print();
@@ -469,7 +469,7 @@ int py_plugin_init(struct plugin *plugin
int py_plugin_exec(struct plugin *plugin, int mesg_count,
union cwiid_mesg mesg[])
{
- PyVarObject *PyArgs, *PyMesg, *PyData, *PyButtonData, *PyAxisData, *PyObj;
+ PyObject *PyArgs, *PyMesg, *PyData, *PyButtonData, *PyAxisData, *PyObj;
int i;
if (!(PyMesg = ConvertMesgArray(mesg_count, mesg))) {
@@ -568,7 +568,7 @@ int py_plugin_exec(struct plugin *plugin
int py_plugin_param_int(struct plugin *plugin, int i, int value)
{
- PyVarObject *PyObj;
+ PyObject *PyObj;
switch (plugin->info->param_info[i].type) {
case WMPLUGIN_PARAM_INT:
@@ -596,7 +596,7 @@ int py_plugin_param_int(struct plugin *p
int py_plugin_param_float(struct plugin *plugin, int i, float value)
{
- PyVarObject *PyObj;
+ PyObject *PyObj;
switch (plugin->info->param_info[i].type) {
case WMPLUGIN_PARAM_INT:
@@ -624,7 +624,7 @@ int py_plugin_param_float(struct plugin
return 0;
}
-static PyVarObject *set_rpt_mode(PyVarObject *self, PyVarObject *args, PyVarObject *kwds)
+static PyObject *set_rpt_mode(PyObject *self, PyObject *args, PyObject *kwds)
{
static char *kwlist[] = {"id", "rpt_mode", NULL};
int id, rpt_mode;
Index: cwiid/wminput/plugins/led/led.c
===================================================================
--- cwiid.orig/wminput/plugins/led/led.c
+++ cwiid/wminput/plugins/led/led.c
@@ -72,7 +72,7 @@ struct wmplugin_data *wmplugin_exec(int
{
int i;
uint8_t button;
- struct cwiid_btn_message *btn_mesg;
+ CWIID_BTN_MESG *btn_mesg;
uint8_t led_state = (Led1 ? CWIID_LED1_ON : 0)
| (Led2 ? CWIID_LED2_ON : 0)
@@ -83,7 +83,7 @@ struct wmplugin_data *wmplugin_exec(int
btn_mesg = NULL;
for (i=0; i < mesg_count; i++) {
if (mesg[i].type == CWIID_MESG_BTN) {
- btn_mesg = &mesg[i].btn_mesg;
+ btn_mesg = &(mesg[i].btn_mesg);
button = mesg[i].btn_mesg.buttons;
}
}
Index: cwiid/libcwiid/cwiid.h
===================================================================
--- cwiid.orig/libcwiid/cwiid.h
+++ cwiid/libcwiid/cwiid.h
@@ -177,6 +177,8 @@ struct cwiid_status_mesg {
enum cwiid_ext_type ext_type;
};
+typedef struct cwiid_btn_mesg CWIID_BTN_MESG;
+
struct cwiid_btn_mesg {
enum cwiid_mesg_type type;
uint16_t buttons;
@@ -236,7 +238,7 @@ struct cwiid_error_mesg {
union cwiid_mesg {
enum cwiid_mesg_type type;
struct cwiid_status_mesg status_mesg;
- struct cwiid_btn_mesg btn_mesg;
+ CWIID_BTN_MESG btn_mesg;
struct cwiid_acc_mesg acc_mesg;
struct cwiid_ir_mesg ir_mesg;
struct cwiid_nunchuk_mesg nunchuk_mesg;