Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings while building _mysql.so #9

Merged
merged 1 commit into from
Oct 12, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions _mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ PERFORMANCE OF THIS SOFTWARE.
#include "mysql.h"
#include "mysqld_error.h"

#ifdef HAVE_WCSCOLL
#undef HAVE_WCSCOLL
#endif
#ifdef SIZEOF_SIZE_T
#undef SIZEOF_SIZE_T
#endif

#include "Python.h"
#if PY_MAJOR_VERSION >= 3
#define IS_PY3K
Expand Down Expand Up @@ -1352,9 +1359,9 @@ _mysql_field_to_python(
unsigned long length,
MYSQL_FIELD *field)
{
int field_type = field->type;
PyObject *v;
#ifdef IS_PY3K
int field_type = field->type;
// Return bytes for binary and string types.
int binary = 0;
if (field_type == FIELD_TYPE_TINY_BLOB ||
Expand All @@ -1368,7 +1375,6 @@ _mysql_field_to_python(
#endif
if (rowitem) {
if (converter != Py_None) {
const char *fmt = "s#";
v = PyObject_CallFunction(converter,
#ifdef IS_PY3K
binary ? "y#" : "s#",
Expand Down Expand Up @@ -1569,7 +1575,7 @@ _mysql_ResultObject_fetch_row(
&maxrows, &how))
return NULL;
check_result_connection(self);
if (how < 0 || how >= sizeof(row_converters)) {
if (how >= sizeof(row_converters)) {
PyErr_SetString(PyExc_ValueError, "how out of range");
return NULL;
}
Expand Down Expand Up @@ -1974,7 +1980,6 @@ _mysql_ConnectionObject_query(
{
char *query;
int len, r;
MYSQL *mysql = &(self->connection);
if (!PyArg_ParseTuple(args, "s#:query", &query, &len)) return NULL;
check_connection(self);

Expand Down Expand Up @@ -2018,8 +2023,7 @@ static PyObject *
_mysql_ConnectionObject_read_query_result(
_mysql_ConnectionObject *self)
{
char *query;
int len, r;
int r;
MYSQL *mysql = &(self->connection);
check_connection(self);

Expand Down Expand Up @@ -2663,7 +2667,7 @@ _mysql_ConnectionObject_getattro(
if (strcmp(cname, "closed") == 0)
return PyInt_FromLong((long)!(self->open));

return PyObject_GenericGetAttr(self, name);
return PyObject_GenericGetAttr((PyObject *)self, name);
}

static int
Expand All @@ -2677,7 +2681,7 @@ _mysql_ConnectionObject_setattro(
"can't delete connection attributes");
return -1;
}
return PyObject_GenericSetAttr(self, name, v);
return PyObject_GenericSetAttr((PyObject *)self, name, v);
}

static int
Expand All @@ -2691,7 +2695,7 @@ _mysql_ResultObject_setattro(
"can't delete connection attributes");
return -1;
}
return PyObject_GenericSetAttr(self, name, v);
return PyObject_GenericSetAttr((PyObject *)self, name, v);
}

PyTypeObject _mysql_ConnectionObject_Type = {
Expand Down