Fix compilation warnings and a couple of errors due to GCC -pedantic flags

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1329 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2008-11-08 21:17:11 +00:00
parent 61df7cd551
commit 99135b1237
39 changed files with 77 additions and 188 deletions

View file

@ -240,11 +240,10 @@ $ac_distutils_result])
LIBS="$ac_save_LIBS $PYTHON_LDFLAGS"
CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
AC_LANG_PUSH([C])
AC_TRY_LINK(AC_LANG_PROGRAM([
#include <Python.h>
],[
Py_Initialize();
]),[pythonexists=yes],[pythonexists=no])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[#include <Python.h>]],
[[Py_Initialize();]])
],[pythonexists=yes],[pythonexists=no])
AC_LANG_POP([C])
# turn back to default flags
CPPFLAGS="$ac_save_CPPFLAGS"

View file

@ -91,12 +91,12 @@ PythonCPUPolicy::PythonCPUPolicy(const char* name) throw(MalformedPolicyExceptio
PythonCPUPolicy::~PythonCPUPolicy()
{
if (_adapter) Py_DECREF(_adapter);
if (_adapter) { Py_DECREF(_adapter); }
// We keep this alive until dtor time, because
// the user may have defined some static global-space
// variables and they make use of them.
if (_upolicy_dict) Py_DECREF(_upolicy_dict);
if (_upolicy_dict) { Py_DECREF(_upolicy_dict); }
}
void
@ -135,7 +135,7 @@ PythonCPUPolicy::configure() throw(UserInterruptException, MalformedPolicyExcept
Glib::RecMutex::Lock lock(_mtx);;
set_callback_policy(const_cast<PythonCPUPolicy*>(this));
PyObject* retval = PyObject_CallMethod(_adapter, "async_configure", NULL);
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("async_configure"), NULL);
Py_DECREF(retval);
wait_unlock();
@ -150,7 +150,7 @@ PythonCPUPolicy::sort_queue() const throw(UserInterruptException, MalformedPolic
Glib::RecMutex::Lock lock(_mtx);;
set_callback_policy(const_cast<PythonCPUPolicy*>(this));
PyObject* retval = PyObject_CallMethod(_adapter, "async_sort_queue", NULL);
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("async_sort_queue"), NULL);
// Do minimal debugging
if (!retval) PyErr_Print();
@ -181,13 +181,13 @@ PythonCPUPolicy::is_pre_emptive() const throw(UserInterruptException, MalformedP
Glib::RecMutex::Lock lock(_mtx);;
set_callback_policy(const_cast<PythonCPUPolicy*>(this));
PyObject* retval = PyObject_CallMethod(_adapter, "async_is_preemptive", NULL);
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("async_is_preemptive"), NULL);
Py_DECREF(retval);
wait_unlock();
// Parse return value stored in global Python object
retval = PyObject_CallMethod(_adapter, "get_return_value", NULL);
retval = PyObject_CallMethod(_adapter, const_cast<char*>("get_return_value"), NULL);
assert(retval);
bool ret = PyObject_IsTrue(retval);
Py_DECREF(retval);
@ -203,7 +203,7 @@ PythonCPUPolicy::get_time_slice() const throw(UserInterruptException, MalformedP
Glib::RecMutex::Lock lock(_mtx);;
set_callback_policy(const_cast<PythonCPUPolicy*>(this));
PyObject* retval = PyObject_CallMethod(_adapter, "async_get_time_slice", NULL);
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("async_get_time_slice"), NULL);
// Do minimal debugging
if (!retval) PyErr_Print();
@ -212,7 +212,7 @@ PythonCPUPolicy::get_time_slice() const throw(UserInterruptException, MalformedP
wait_unlock();
// Parse return value stored in global Python object
retval = PyObject_CallMethod(_adapter, "get_return_value", NULL);
retval = PyObject_CallMethod(_adapter, const_cast<char*>("get_return_value"), NULL);
assert(retval);
long tmp = PyInt_AsLong(retval);
Py_DECREF(retval);
@ -239,7 +239,7 @@ PythonCPUPolicy::wait_unlock() const throw(UserInterruptException, MalformedPoli
Glib::usleep(wait_for); // hack'a'ton! magggggiccc nummmbeeerrrrrs!!
Py_BLOCK_THREADS;
PyObject* retval = PyObject_CallMethod(_adapter, "mutex_test_lock", NULL);
PyObject* retval = PyObject_CallMethod(_adapter, const_cast<char*>("mutex_test_lock"), NULL);
assert(retval);
still_locked = PyObject_IsTrue(retval);
Py_DECREF(retval);
@ -263,7 +263,7 @@ PythonCPUPolicy::wait_unlock() const throw(UserInterruptException, MalformedPoli
// check if there were unhandled exception in the user-defined code
PyObject* pException = PyObject_CallMethod(_adapter, "get_last_exception", NULL);
PyObject* pException = PyObject_CallMethod(_adapter, const_cast<char*>("get_last_exception"), NULL);
if(pException != NULL)
{
@ -325,9 +325,9 @@ PythonCPUPolicy::get_exception_information()
else
msg = string(_("no available information for this error"));
if (pType != NULL) Py_DECREF(pType);
if (pValue != NULL) Py_DECREF(pValue);
if (pTraceback != NULL) Py_DECREF(pTraceback);
if (pType != NULL) { Py_DECREF(pType); }
if (pValue != NULL) { Py_DECREF(pValue); }
if (pTraceback != NULL) { Py_DECREF(pTraceback); }
PyErr_Clear();