Revision: 30657
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30657
Author:   nexyon
Date:     2010-07-23 17:13:06 +0200 (Fri, 23 Jul 2010)

Log Message:
-----------
Changed the fix for string literal warnings to dynamic casts, patch for one 
function sent to python devs the other won't be patched according to the devs 
in IRC.

Modified Paths:
--------------
    branches/soc-2010-nexyon/intern/audaspace/Python/AUD_PyAPI.cpp

Modified: branches/soc-2010-nexyon/intern/audaspace/Python/AUD_PyAPI.cpp
===================================================================
--- branches/soc-2010-nexyon/intern/audaspace/Python/AUD_PyAPI.cpp      
2010-07-23 14:46:31 UTC (rev 30656)
+++ branches/soc-2010-nexyon/intern/audaspace/Python/AUD_PyAPI.cpp      
2010-07-23 15:13:06 UTC (rev 30657)
@@ -64,24 +64,6 @@
 
 #define PY_MODULE_ADD_CONSTANT(module, name) PyModule_AddIntConstant(module, 
#name, name)
 
-static inline int APyArg_ParseTupleAndKeywords(PyObject * o1, PyObject * o2, 
const char * f, const char ** k, ...)
-{
-       va_list ap;
-       va_start(ap, k);
-       int result = PyArg_ParseTupleAndKeywords(o1, o2, f, const_cast<char 
**>(k), ap);
-       va_end(ap);
-       return result;
-}
-
-static inline PyObject* APyObject_CallMethod(PyObject *o, const char *m, const 
char *f, ...)
-{
-       va_list ap;
-       va_start(ap, f);
-       PyObject* result = PyObject_CallMethod(o, const_cast<char *>(m), 
const_cast<char *>(f), ap);
-       va_end(ap);
-       return result;
-}
-
 // ====================================================================
 
 static PyObject* AUDError;
@@ -108,7 +90,7 @@
                static const char *kwlist[] = {"filename", NULL};
                const char* filename = NULL;
 
-               if(!APyArg_ParseTupleAndKeywords(args, kwds, "|s", kwlist, 
&filename))
+               if(!PyArg_ParseTupleAndKeywords(args, kwds, "|s", 
const_cast<char**>(kwlist), &filename))
                {
                        Py_DECREF(self);
                        return NULL;
@@ -981,7 +963,7 @@
 static PyObject *
 Handle_pause(Handle *self)
 {
-       return APyObject_CallMethod(self->device, "_pause", "(O)", self);
+       return PyObject_CallMethod(self->device, const_cast<char*>("_pause"), 
const_cast<char*>("(O)"), self);
 }
 
 PyDoc_STRVAR(M_aud_Handle_resume_doc,
@@ -990,7 +972,7 @@
 static PyObject *
 Handle_resume(Handle *self)
 {
-       return APyObject_CallMethod(self->device, "_resume", "(O)", self);
+       return PyObject_CallMethod(self->device, const_cast<char*>("_resume"), 
const_cast<char*>("(O)"), self);
 }
 
 PyDoc_STRVAR(M_aud_Handle_stop_doc,
@@ -999,7 +981,7 @@
 static PyObject *
 Handle_stop(Handle *self)
 {
-       return APyObject_CallMethod(self->device, "_stop", "(O)", self);
+       return PyObject_CallMethod(self->device, const_cast<char*>("_stop"), 
const_cast<char*>("(O)"), self);
 }
 
 PyDoc_STRVAR(M_aud_Handle_update_doc,
@@ -1008,7 +990,7 @@
 static PyObject *
 Handle_update(Handle *self, PyObject *data)
 {
-       return APyObject_CallMethod(self->device, "_update_source", "(OO)", 
self, data);
+       return PyObject_CallMethod(self->device, 
const_cast<char*>("_update_source"), const_cast<char*>("(OO)"), self, data);
 }
 
 static PyMethodDef Handle_methods[] = {
@@ -1033,13 +1015,13 @@
 static PyObject *
 Handle_get_position(Handle *self, void* nothing)
 {
-       return APyObject_CallMethod(self->device, "_get_position", "(O)", self);
+       return PyObject_CallMethod(self->device, 
const_cast<char*>("_get_position"), const_cast<char*>("(O)"), self);
 }
 
 static int
 Handle_set_position(Handle *self, PyObject* args, void* nothing)
 {
-       PyObject* result = APyObject_CallMethod(self->device, "_seek", "(OO)", 
self, args);
+       PyObject* result = PyObject_CallMethod(self->device, 
const_cast<char*>("_seek"), const_cast<char*>("(OO)"), self, args);
        if(result)
        {
                Py_DECREF(result);
@@ -1054,7 +1036,7 @@
 static int
 Handle_set_keep(Handle *self, PyObject* args, void* nothing)
 {
-       PyObject* result = APyObject_CallMethod(self->device, "_set_keep", 
"(OO)", self, args);
+       PyObject* result = PyObject_CallMethod(self->device, 
const_cast<char*>("_set_keep"), const_cast<char*>("(OO)"), self, args);
        if(result)
        {
                Py_DECREF(result);
@@ -1069,7 +1051,7 @@
 static PyObject *
 Handle_get_status(Handle *self, void* nothing)
 {
-       return APyObject_CallMethod(self->device, "_get_status", "(O)", self);
+       return PyObject_CallMethod(self->device, 
const_cast<char*>("_get_status"), const_cast<char*>("(O)"), self);
 }
 
 PyDoc_STRVAR(M_aud_Handle_volume_doc,
@@ -1078,13 +1060,13 @@
 static PyObject *
 Handle_get_volume(Handle *self, void* nothing)
 {
-       return APyObject_CallMethod(self->device, "_get_volume", "(O)", self);
+       return PyObject_CallMethod(self->device, 
const_cast<char*>("_get_volume"), const_cast<char*>("(O)"), self);
 }
 
 static int
 Handle_set_volume(Handle *self, PyObject* args, void* nothing)
 {
-       PyObject* result = APyObject_CallMethod(self->device, "_set_volume", 
"(OO)", self, args);
+       PyObject* result = PyObject_CallMethod(self->device, 
const_cast<char*>("_set_volume"), const_cast<char*>("(OO)"), self, args);
        if(result)
        {
                Py_DECREF(result);
@@ -1099,7 +1081,7 @@
 static int
 Handle_set_pitch(Handle *self, PyObject* args, void* nothing)
 {
-       PyObject* result = APyObject_CallMethod(self->device, "_set_pitch", 
"(OO)", self, args);
+       PyObject* result = PyObject_CallMethod(self->device, 
const_cast<char*>("_set_pitch"), const_cast<char*>("(OO)"), self, args);
        if(result)
        {
                Py_DECREF(result);
@@ -1114,7 +1096,7 @@
 static int
 Handle_set_loop_count(Handle *self, PyObject* args, void* nothing)
 {
-       PyObject* result = APyObject_CallMethod(self->device, 
"_set_loop_count", "(OO)", self, args);
+       PyObject* result = PyObject_CallMethod(self->device, 
const_cast<char*>("_set_loop_count"), const_cast<char*>("(OO)"), self, args);
        if(result)
        {
                Py_DECREF(result);
@@ -1129,13 +1111,13 @@
 static PyObject *
 Handle_get_relative(Handle *self, void* nothing)
 {
-       return APyObject_CallMethod(self->device, "_is_relative", "(O)", self);
+       return PyObject_CallMethod(self->device, 
const_cast<char*>("_is_relative"), const_cast<char*>("(O)"), self);
 }
 
 static int
 Handle_set_relative(Handle *self, PyObject* args, void* nothing)
 {
-       PyObject* result = APyObject_CallMethod(self->device, "_set_relative", 
"(OO)", self, args);
+       PyObject* result = PyObject_CallMethod(self->device, 
const_cast<char*>("_set_relative"), const_cast<char*>("(OO)"), self, args);
        if(result)
        {
                Py_DECREF(result);
@@ -1150,13 +1132,13 @@
 static PyObject *
 Handle_get_min_gain(Handle *self, void* nothing)
 {
-       return APyObject_CallMethod(self->device, "_get_min_gain", "(O)", self);
+       return PyObject_CallMethod(self->device, 
const_cast<char*>("_get_min_gain"), const_cast<char*>("(O)"), self);
 }
 
 static int
 Handle_set_min_gain(Handle *self, PyObject* args, void* nothing)
 {
-       PyObject* result = APyObject_CallMethod(self->device, "_set_min_gain", 
"(OO)", self, args);
+       PyObject* result = PyObject_CallMethod(self->device, 
const_cast<char*>("_set_min_gain"), const_cast<char*>("(OO)"), self, args);
        if(result)
        {
                Py_DECREF(result);
@@ -1171,13 +1153,13 @@
 static PyObject *
 Handle_get_max_gain(Handle *self, void* nothing)
 {
-       return APyObject_CallMethod(self->device, "_get_max_gain", "(O)", self);
+       return PyObject_CallMethod(self->device, 
const_cast<char*>("_get_max_gain"), const_cast<char*>("(O)"), self);
 }
 
 static int
 Handle_set_max_gain(Handle *self, PyObject* args, void* nothing)
 {
-       PyObject* result = APyObject_CallMethod(self->device, "_set_max_gain", 
"(OO)", self, args);
+       PyObject* result = PyObject_CallMethod(self->device, 
const_cast<char*>("_set_max_gain"), const_cast<char*>("(OO)"), self, args);
        if(result)
        {
                Py_DECREF(result);
@@ -1192,13 +1174,13 @@
 static PyObject *
 Handle_get_reference_distance(Handle *self, void* nothing)
 {
-       return APyObject_CallMethod(self->device, "_get_reference_distance", 
"(O)", self);
+       return PyObject_CallMethod(self->device, 
const_cast<char*>("_get_reference_distance"), const_cast<char*>("(O)"), self);
 }
 
 static int
 Handle_set_reference_distance(Handle *self, PyObject* args, void* nothing)
 {
-       PyObject* result = APyObject_CallMethod(self->device, 
"_set_reference_distance", "(OO)", self, args);
+       PyObject* result = PyObject_CallMethod(self->device, 
const_cast<char*>("_set_reference_distance"), const_cast<char*>("(OO)"), self, 
args);
        if(result)
        {
                Py_DECREF(result);
@@ -1213,13 +1195,13 @@
 static PyObject *
 Handle_get_max_distance(Handle *self, void* nothing)
 {
-       return APyObject_CallMethod(self->device, "_get_max_distance", "(O)", 
self);
+       return PyObject_CallMethod(self->device, 
const_cast<char*>("_get_max_distance"), const_cast<char*>("(O)"), self);
 }
 
 static int
 Handle_set_max_distance(Handle *self, PyObject* args, void* nothing)
 {
-       PyObject* result = APyObject_CallMethod(self->device, 
"_set_max_distance", "(OO)", self, args);
+       PyObject* result = PyObject_CallMethod(self->device, 
const_cast<char*>("_set_max_distance"), const_cast<char*>("(OO)"), self, args);
        if(result)
        {
                Py_DECREF(result);
@@ -1234,13 +1216,13 @@
 static PyObject *
 Handle_get_rolloff_factor(Handle *self, void* nothing)
 {
-       return APyObject_CallMethod(self->device, "_get_rolloff_factor", "(O)", 
self);
+       return PyObject_CallMethod(self->device, 
const_cast<char*>("_get_rolloff_factor"), const_cast<char*>("(O)"), self);
 }
 
 static int
 Handle_set_rolloff_factor(Handle *self, PyObject* args, void* nothing)
 {
-       PyObject* result = APyObject_CallMethod(self->device, 
"_set_rolloff_factor", "(OO)", self, args);
+       PyObject* result = PyObject_CallMethod(self->device, 
const_cast<char*>("_set_rolloff_factor"), const_cast<char*>("(OO)"), self, 
args);
        if(result)
        {
                Py_DECREF(result);
@@ -1255,13 +1237,13 @@
 static PyObject *
 Handle_get_cone_inner_angle(Handle *self, void* nothing)
 {
-       return APyObject_CallMethod(self->device, "_get_cone_inner_angle", 
"(O)", self);
+       return PyObject_CallMethod(self->device, 
const_cast<char*>("_get_cone_inner_angle"), const_cast<char*>("(O)"), self);
 }
 
 static int
 Handle_set_cone_inner_angle(Handle *self, PyObject* args, void* nothing)
 {
-       PyObject* result = APyObject_CallMethod(self->device, 
"_set_cone_inner_angle", "(OO)", self, args);
+       PyObject* result = PyObject_CallMethod(self->device, 
const_cast<char*>("_set_cone_inner_angle"), const_cast<char*>("(OO)"), self, 
args);
        if(result)
        {
                Py_DECREF(result);
@@ -1276,13 +1258,13 @@
 static PyObject *
 Handle_get_cone_outer_angle(Handle *self, void* nothing)
 {
-       return APyObject_CallMethod(self->device, "_get_cone_outer_angle", 
"(O)", self);
+       return PyObject_CallMethod(self->device, 
const_cast<char*>("_get_cone_outer_angle"), const_cast<char*>("(O)"), self);
 }
 
 static int
 Handle_set_cone_outer_angle(Handle *self, PyObject* args, void* nothing)
 {
-       PyObject* result = APyObject_CallMethod(self->device, 
"_set_cone_outer_angle", "(OO)", self, args);
+       PyObject* result = PyObject_CallMethod(self->device, 
const_cast<char*>("_set_cone_outer_angle"), const_cast<char*>("(OO)"), self, 
args);
        if(result)
        {

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to