From: Florian Forster Date: Mon, 7 Dec 2009 14:39:43 +0000 (+0100) Subject: src/pyvalues.c: Cast `void *' to a int that's guaranteed to be big enough. X-Git-Tag: collectd-4.9.0~35^2~6 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=cc9557db6a969c871489670c1e841701b23fc919;p=collectd.git src/pyvalues.c: Cast `void *' to a int that's guaranteed to be big enough. For some weird reason `int' is only 4 bytes long on x86_64, so casting `void *' to `int' results in compiler warnings / errors. --- diff --git a/src/pyvalues.c b/src/pyvalues.c index 9542a40b..da7c21d3 100644 --- a/src/pyvalues.c +++ b/src/pyvalues.c @@ -91,7 +91,7 @@ static PyMemberDef PluginData_members[] = { }; static PyObject *PluginData_getstring(PyObject *self, void *data) { - const char *value = ((char *) self) + (int) data; + const char *value = ((char *) self) + (intptr_t) data; return PyString_FromString(value); } @@ -106,7 +106,7 @@ static int PluginData_setstring(PyObject *self, PyObject *value, void *data) { } new = PyString_AsString(value); if (new == NULL) return -1; - old = ((char *) self) + (int) data; + old = ((char *) self) + (intptr_t) data; sstrncpy(old, new, DATA_MAX_NAME_LEN); return 0; } @@ -127,7 +127,7 @@ static int PluginData_settype(PyObject *self, PyObject *value, void *data) { return -1; } - old = ((char *) self) + (int) data; + old = ((char *) self) + (intptr_t) data; sstrncpy(old, new, DATA_MAX_NAME_LEN); return 0; } @@ -677,7 +677,7 @@ static int Notification_setstring(PyObject *self, PyObject *value, void *data) { } new = PyString_AsString(value); if (new == NULL) return -1; - old = ((char *) self) + (int) data; + old = ((char *) self) + (intptr_t) data; sstrncpy(old, new, NOTIF_MAX_MSG_LEN); return 0; }