patch [#24576] aud.Handle.status return bool
authorCampbell Barton <ideasman42@gmail.com>
Sun, 7 Nov 2010 04:34:27 +0000 (04:34 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 7 Nov 2010 04:34:27 +0000 (04:34 +0000)
from Dan Eicher (dna), no functional changes, just return bool rather then int types.

intern/audaspace/Python/AUD_PyAPI.cpp

index b0c55d5856eb6e9a92e97ae19f90db65d0b067e5..d3f42419494aa4034a1539929e0182dd5a7a1636 100644 (file)
@@ -1044,18 +1044,13 @@ Handle_pause(Handle *self)
 
        try
        {
-               if(device->device->pause(self->handle))
-               {
-                       Py_RETURN_TRUE;
-               }
+               return PyBool_FromLong((long)device->device->pause(self->handle));
        }
        catch(AUD_Exception& e)
        {
                PyErr_SetString(AUDError, e.str);
                return NULL;
        }
-
-       Py_RETURN_FALSE;
 }
 
 PyDoc_STRVAR(M_aud_Handle_resume_doc,
@@ -1071,18 +1066,13 @@ Handle_resume(Handle *self)
 
        try
        {
-               if(device->device->resume(self->handle))
-               {
-                       Py_RETURN_TRUE;
-               }
+               return PyBool_FromLong((long)device->device->resume(self->handle));
        }
        catch(AUD_Exception& e)
        {
                PyErr_SetString(AUDError, e.str);
                return NULL;
        }
-
-       Py_RETURN_FALSE;
 }
 
 PyDoc_STRVAR(M_aud_Handle_stop_doc,
@@ -1099,18 +1089,13 @@ Handle_stop(Handle *self)
 
        try
        {
-               if(device->device->stop(self->handle))
-               {
-                       Py_RETURN_TRUE;
-               }
+               return PyBool_FromLong((long)device->device->stop(self->handle));
        }
        catch(AUD_Exception& e)
        {
                PyErr_SetString(AUDError, e.str);
                return NULL;
        }
-
-       Py_RETURN_FALSE;
 }
 
 static PyMethodDef Handle_methods[] = {
@@ -1185,14 +1170,7 @@ Handle_get_keep(Handle *self, void* nothing)
 
        try
        {
-               if(device->device->getKeep(self->handle))
-               {
-                       Py_RETURN_TRUE;
-               }
-               else
-               {
-                       Py_RETURN_FALSE;
-               }
+               return PyBool_FromLong((long)device->device->getKeep(self->handle));
        }
        catch(AUD_Exception& e)
        {
@@ -1237,7 +1215,7 @@ Handle_get_status(Handle *self, void* nothing)
 
        try
        {
-               return Py_BuildValue("i", device->device->getStatus(self->handle));
+               return PyBool_FromLong((long)device->device->getStatus(self->handle));
        }
        catch(AUD_Exception& e)
        {
@@ -1568,14 +1546,7 @@ Handle_get_relative(Handle *self, void* nothing)
                AUD_I3DDevice* device = dynamic_cast<AUD_I3DDevice*>(dev->device);
                if(device)
                {
-                       if(device->isRelative(self->handle))
-                       {
-                               Py_RETURN_TRUE;
-                       }
-                       else
-                       {
-                               Py_RETURN_FALSE;
-                       }
+                       return PyBool_FromLong((long)device->isRelative(self->handle));
                }
                else
                {