Skip to content

Commit

Permalink
Merge pull request #49 – Fix several compiler warnings and make warni…
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Viktorin authored and GitHub committed Nov 29, 2017
2 parents 0ec9b74 + 5b2d2f9 commit 773defa
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ matrix:
- python: 3.6
env: TOXENV=doc

env:
global:
# -Wno-int-in-bool-context: don't complain about PyMem_MALLOC()
# -Werror: turn all warnings into fatal errors
- CFLAGS="-Wno-int-in-bool-context -Werror"
# pass CFLAGS and WITH_GCOV to tox tasks
- TOX_TESTENV_PASSENV="CFLAGS WITH_GCOV"

install:
- pip install "pip>=7.1.0"
- pip install tox-travis tox codecov coverage
Expand Down
9 changes: 6 additions & 3 deletions Modules/LDAPObject.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ Tuple_to_LDAPMod( PyObject* tup, int no_op )
Py_ssize_t i, len, nstrs;

if (!PyTuple_Check(tup)) {
return LDAPerror_TypeError("expected a tuple", tup);
LDAPerror_TypeError("expected a tuple", tup);
return NULL;
}

if (no_op) {
Expand Down Expand Up @@ -205,13 +206,15 @@ List_to_LDAPMods( PyObject *list, int no_op ) {
PyObject *item;

if (!PySequence_Check(list)) {
return LDAPerror_TypeError("expected list of tuples", list);
LDAPerror_TypeError("expected list of tuples", list);
return NULL;
}

len = PySequence_Length(list);

if (len < 0) {
return LDAPerror_TypeError("expected list of tuples", list);
LDAPerror_TypeError("expected list of tuples", list);
return NULL;
}

lms = PyMem_NEW(LDAPMod *, len + 1);
Expand Down
4 changes: 3 additions & 1 deletion Modules/ldapcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "LDAPObject.h"
#include "ldapcontrol.h"
#include "berval.h"
#include "constants.h"

#include "lber.h"

Expand Down Expand Up @@ -71,7 +72,8 @@ Tuple_to_LDAPControl( PyObject* tup )
Py_ssize_t len;

if (!PyTuple_Check(tup)) {
return LDAPerror_TypeError("expected a tuple", tup);
LDAPerror_TypeError("expected a tuple", tup);
return NULL;
}

if (!PyArg_ParseTuple( tup, "sbO", &oid, &iscritical, &bytes ))
Expand Down
2 changes: 1 addition & 1 deletion Modules/ldapmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static PyMethodDef methods[] = {


/* Common initialization code */
PyObject* init_ldap_module()
PyObject* init_ldap_module(void)
{
PyObject *m, *d;

Expand Down

0 comments on commit 773defa

Please sign in to comment.