From 5979ffcdd987ec150d4e1ce70d05dd63830cbbd6 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Sun, 3 Dec 2006 11:55:08 +0000 Subject: [PATCH] - Fix warnings by includin Python.h first - Fix warnings by passing a pointer to something not an int wrapped in a pointer for some functions --- acl.c | 23 +++++++++++++++-------- setup.py | 0 2 files changed, 15 insertions(+), 8 deletions(-) mode change 100644 => 100755 setup.py diff --git a/acl.c b/acl.c index 69ef98f..e4248a6 100644 --- a/acl.c +++ b/acl.c @@ -1,8 +1,8 @@ +#include + #include #include -#include - #ifdef HAVE_LINUX #include "os_linux.c" #endif @@ -20,6 +20,10 @@ staticforward PyTypeObject Permset_Type; static PyObject* Permset_new(PyTypeObject* type, PyObject* args, PyObject *keywds); #endif +static acl_perm_t holder_ACL_EXECUTE = ACL_EXECUTE; +static acl_perm_t holder_ACL_READ = ACL_READ; +static acl_perm_t holder_ACL_WRITE = ACL_WRITE; + typedef struct { PyObject_HEAD acl_t acl; @@ -746,7 +750,7 @@ static PyObject* Permset_clear(PyObject* obj, PyObject* args) { static PyObject* Permset_get_right(PyObject *obj, void* arg) { Permset_Object *self = (Permset_Object*) obj; - if(get_perm(self->permset, (int)arg)) { + if(get_perm(self->permset, *(acl_perm_t*)arg)) { Py_INCREF(Py_True); return Py_True; } else { @@ -766,9 +770,9 @@ static int Permset_set_right(PyObject* obj, PyObject* value, void* arg) { } on = PyInt_AsLong(value); if(on) - nerr = acl_add_perm(self->permset, (int)arg); + nerr = acl_add_perm(self->permset, *(acl_perm_t*)arg); else - nerr = acl_delete_perm(self->permset, (int)arg); + nerr = acl_delete_perm(self->permset, *(acl_perm_t*)arg); if(nerr == -1) { PyErr_SetFromErrno(PyExc_IOError); return -1; @@ -1093,9 +1097,12 @@ static char __Permset_write_doc__[] = \ /* Permset getset */ static PyGetSetDef Permset_getsets[] = { - {"execute", Permset_get_right, Permset_set_right, __Permset_execute_doc__, (void*)ACL_EXECUTE}, - {"read", Permset_get_right, Permset_set_right, __Permset_read_doc__, (void*)ACL_READ}, - {"write", Permset_get_right, Permset_set_right, __Permset_write_doc__, (void*)ACL_WRITE}, + {"execute", Permset_get_right, Permset_set_right, \ + __Permset_execute_doc__, &holder_ACL_EXECUTE}, + {"read", Permset_get_right, Permset_set_right, \ + __Permset_read_doc__, &holder_ACL_READ}, + {"write", Permset_get_right, Permset_set_right, \ + __Permset_write_doc__, &holder_ACL_WRITE}, {NULL} }; diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 -- 2.39.5