diff options
23 files changed, 198 insertions, 168 deletions
diff --git a/source/blender/blenkernel/BKE_utildefines.h b/source/blender/blenkernel/BKE_utildefines.h index 5a6a151afee..7450e31e263 100644 --- a/source/blender/blenkernel/BKE_utildefines.h +++ b/source/blender/blenkernel/BKE_utildefines.h @@ -44,6 +44,12 @@ #define STRINGIFY_ARG(x) #x #define STRINGIFY(x) STRINGIFY_ARG(x) +#ifdef __GNUC__ +# define UNUSED(x) x __attribute__((__unused__)) +#else +# define UNUSED(x) x +#endif + /* these values need to be hardcoded in structs, dna does not recognize defines */ /* also defined in DNA_space_types.h */ #ifndef FILE_MAXDIR diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index 9dac409226b..c5431005b18 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -557,7 +557,7 @@ static int write_derivedmesh_stl(FILE *fpSTL, Object *ob, DerivedMesh *dm) return numfacets; } -static int write_object_stl(FILE *fpSTL, Scene *scene, Object *ob, Mesh *me) +static int write_object_stl(FILE *fpSTL, Scene *scene, Object *ob) { int numfacets = 0; DerivedMesh *dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH); @@ -572,7 +572,6 @@ static int write_object_stl(FILE *fpSTL, Scene *scene, Object *ob, Mesh *me) void write_stl(Scene *scene, char *str) { Object *ob; - Mesh *me; Base *base; FILE *fpSTL; int numfacets = 0; @@ -605,9 +604,8 @@ void write_stl(Scene *scene, char *str) if (base->flag & SELECT) { ob = base->object; if (ob->type == OB_MESH) { - me = ob->data; - if (me) - numfacets += write_object_stl(fpSTL, scene, ob, me); + if(ob->data) + numfacets += write_object_stl(fpSTL, scene, ob); } } base= base->next; @@ -978,7 +976,7 @@ static int all_digits(char *str) return 1; } -static int dxf_get_layer_col(char *layer) +static int dxf_get_layer_col(char *UNUSED(layer)) { return 1; } @@ -1016,8 +1014,8 @@ static void myfgets(char *str, int len, FILE *fp) /* three types of enters, \n \r and \r\n */ if(c == '\n') break; if(c=='\r') { - c= getc(dxf_fp); // read the linefeed from stream - if(c != 10) ungetc(c, dxf_fp); // put back, if it's not one... + c= getc(fp); // read the linefeed from stream + if(c != 10) ungetc(c, fp); // put back, if it's not one... break; } } diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c index 9d865b1c63e..c64be00093c 100644 --- a/source/blender/python/generic/IDProp.c +++ b/source/blender/python/generic/IDProp.c @@ -24,6 +24,7 @@ */ #include "BKE_idprop.h" +#include "BKE_utildefines.h" #include "IDProp.h" #include "MEM_guardedalloc.h" @@ -177,12 +178,12 @@ int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value) return 0; } -PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *bleh) +PyObject *BPy_IDGroup_GetName(BPy_IDProperty *self, void *UNUSED(closure)) { return PyUnicode_FromString(self->prop->name); } -static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *bleh) +static int BPy_IDGroup_SetName(BPy_IDProperty *self, PyObject *value, void *UNUSED(closure)) { char *st; if (!PyUnicode_Check(value)) { @@ -860,7 +861,7 @@ PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent) static PyObject *IDArray_repr(BPy_IDArray *self) { - return PyUnicode_FromString("(ID Array)"); + return PyUnicode_FromFormat("(ID Array [%d])", self->prop->len); } @@ -1071,7 +1072,7 @@ static PyObject *IDGroup_Iter_iterself(PyObject *self) static PyObject *IDGroup_Iter_repr(BPy_IDGroup_Iter *self) { - return PyUnicode_FromString("(ID Property Group)"); + return PyUnicode_FromFormat("(ID Property Group Iter \"%s\")", self->group->prop->name); } static PyObject *BPy_Group_Iter_Next(BPy_IDGroup_Iter *self) diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index 8ac2107f8d2..86b7bc522fe 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -35,6 +35,8 @@ #include <GL/glew.h> #include "MEM_guardedalloc.h" +#include "BKE_utildefines.h" + static char Method_Buffer_doc[] = "(type, dimensions, [template]) - Create a new Buffer object\n\n\ (type) - The format to store data in\n\ @@ -51,7 +53,7 @@ For example, passing [100, 100] will create a 2 dimensional\n\ square buffer. Passing [16, 16, 32] will create a 3 dimensional\n\ buffer which is twice as deep as it is wide or high."; -static PyObject *Method_Buffer( PyObject * self, PyObject * args ); +static PyObject *Method_Buffer( PyObject * self, PyObject *args ); /* Buffer sequence methods */ @@ -99,7 +101,7 @@ PyTypeObject BGL_bufferType = { /* #ifndef __APPLE__ */ #define BGL_Wrap(nargs, funcname, ret, arg_list) \ -static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\ +static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\ arg_def##nargs arg_list; \ ret_def_##ret; \ if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\ @@ -108,7 +110,7 @@ static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\ } #define BGLU_Wrap(nargs, funcname, ret, arg_list) \ -static PyObject *Method_##funcname (PyObject *self, PyObject *args) {\ +static PyObject *Method_##funcname (PyObject *UNUSED(self), PyObject *args) {\ arg_def##nargs arg_list; \ ret_def_##ret; \ if(!PyArg_ParseTuple(args, arg_str##nargs arg_list, arg_ref##nargs arg_list)) return NULL;\ @@ -181,7 +183,7 @@ Buffer *BGL_MakeBuffer(int type, int ndimensions, int *dimensions, void *initbuf } #define MAX_DIMENSIONS 256 -static PyObject *Method_Buffer (PyObject *self, PyObject *args) +static PyObject *Method_Buffer (PyObject *UNUSED(self), PyObject *args) { PyObject *length_ob= NULL, *template= NULL; Buffer *buffer; diff --git a/source/blender/python/generic/blf_api.c b/source/blender/python/generic/blf_api.c index a5f5f8815c7..66d8cdd923a 100644 --- a/source/blender/python/generic/blf_api.c +++ b/source/blender/python/generic/blf_api.c @@ -26,6 +26,7 @@ #include "blf_api.h" #include "../../blenfont/BLF_api.h" +#include "BKE_utildefines.h" static char py_blf_position_doc[] = ".. function:: position(fontid, x, y, z)\n" @@ -41,7 +42,7 @@ static char py_blf_position_doc[] = " :arg z: Z axis position to draw the text.\n" " :type z: float\n"; -static PyObject *py_blf_position(PyObject *self, PyObject *args) +static PyObject *py_blf_position(PyObject *UNUSED(self), PyObject *args) { int fontid; float x, y, z; @@ -67,7 +68,7 @@ static char py_blf_size_doc[] = " :arg dpi: dots per inch value to use for drawing.\n" " :type dpi: int\n"; -static PyObject *py_blf_size(PyObject *self, PyObject *args) +static PyObject *py_blf_size(PyObject *UNUSED(self), PyObject *args) { int fontid, size, dpi; @@ -90,7 +91,7 @@ static char py_blf_aspect_doc[] = " :arg aspect: The aspect ratio for text drawing to use.\n" " :type aspect: float\n"; -static PyObject *py_blf_aspect(PyObject *self, PyObject *args) +static PyObject *py_blf_aspect(PyObject *UNUSED(self), PyObject *args) { float aspect; int fontid; @@ -114,7 +115,7 @@ static char py_blf_blur_doc[] = " :arg radius: The radius for blurring text (in pixels).\n" " :type radius: int\n"; -static PyObject *py_blf_blur(PyObject *self, PyObject *args) +static PyObject *py_blf_blur(PyObject *UNUSED(self), PyObject *args) { int blur, fontid; @@ -137,7 +138,7 @@ static char py_blf_draw_doc[] = " :arg text: the text to draw.\n" " :type text: string\n"; -static PyObject *py_blf_draw(PyObject *self, PyObject *args) +static PyObject *py_blf_draw(PyObject *UNUSED(self), PyObject *args) { char *text; int fontid; @@ -162,7 +163,7 @@ static char py_blf_dimensions_doc[] = " :return: the width and height of the text.\n" " :rtype: tuple of 2 floats\n"; -static PyObject *py_blf_dimensions(PyObject *self, PyObject *args) +static PyObject *py_blf_dimensions(PyObject *UNUSED(self), PyObject *args) { char *text; float r_width, r_height; @@ -196,7 +197,7 @@ static char py_blf_clipping_doc[] = " :arg ymax: Clip the drawing area by these bounds.\n" " :type ymax: float\n"; -static PyObject *py_blf_clipping(PyObject *self, PyObject *args) +static PyObject *py_blf_clipping(PyObject *UNUSED(self), PyObject *args) { float xmin, ymin, xmax, ymax; int fontid; @@ -219,7 +220,7 @@ static char py_blf_disable_doc[] = " :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n" " :type option: int\n"; -static PyObject *py_blf_disable(PyObject *self, PyObject *args) +static PyObject *py_blf_disable(PyObject *UNUSED(self), PyObject *args) { int option, fontid; @@ -241,7 +242,7 @@ static char py_blf_enable_doc[] = " :arg option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n" " :type option: int\n"; -static PyObject *py_blf_enable(PyObject *self, PyObject *args) +static PyObject *py_blf_enable(PyObject *UNUSED(self), PyObject *args) { int option, fontid; @@ -263,7 +264,7 @@ static char py_blf_rotation_doc[] = " :arg angle: The angle for text drawing to use.\n" " :type angle: float\n"; -static PyObject *py_blf_rotation(PyObject *self, PyObject *args) +static PyObject *py_blf_rotation(PyObject *UNUSED(self), PyObject *args) { float angle; int fontid; @@ -294,7 +295,7 @@ static char py_blf_shadow_doc[] = " :arg a: Shadow color (alpha channel 0.0 - 1.0).\n" " :type a: float\n"; -static PyObject *py_blf_shadow(PyObject *self, PyObject *args) +static PyObject *py_blf_shadow(PyObject *UNUSED(self), PyObject *args) { int level, fontid; float r, g, b, a; @@ -324,7 +325,7 @@ static char py_blf_shadow_offset_doc[] = " :arg y: Horizontal shadow offset value in pixels.\n" " :type y: float\n"; -static PyObject *py_blf_shadow_offset(PyObject *self, PyObject *args) +static PyObject *py_blf_shadow_offset(PyObject *UNUSED(self), PyObject *args) { int x, y, fontid; @@ -346,7 +347,7 @@ static char py_blf_load_doc[] = " :return: the new font's fontid or -1 if there was an error.\n" " :rtype: integer\n"; -static PyObject *py_blf_load(PyObject *self, PyObject *args) +static PyObject *py_blf_load(PyObject *UNUSED(self), PyObject *args) { char* filename; diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index 394c388394a..568cef0f676 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -30,6 +30,7 @@ #include "DNA_text_types.h" #include "MEM_guardedalloc.h" +#include "BKE_utildefines.h" /* UNUSED */ #include "BKE_text.h" /* txt_to_buf */ #include "BKE_main.h" #include "BKE_global.h" /* grr, only for G.sce */ @@ -191,7 +192,7 @@ PyObject *bpy_text_reimport( PyObject *module, int *found ) } -static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * kw) +static PyObject *blender_import(PyObject *UNUSED(self), PyObject *args, PyObject * kw) { PyObject *exception, *err, *tb; char *name; @@ -244,7 +245,7 @@ static PyObject *blender_import( PyObject * self, PyObject * args, PyObject * k * our reload() module, to handle reloading in-memory scripts */ -static PyObject *blender_reload( PyObject * self, PyObject * module ) +static PyObject *blender_reload(PyObject *UNUSED(self), PyObject * module) { PyObject *exception, *err, *tb; PyObject *newmodule = NULL; diff --git a/source/blender/python/generic/geometry.c b/source/blender/python/generic/geometry.c index 0e98760314d..e0583cc0028 100644 --- a/source/blender/python/generic/geometry.c +++ b/source/blender/python/generic/geometry.c @@ -60,7 +60,7 @@ static char M_Geometry_BezierInterp_doc[] = ""; //---------------------------------INTERSECTION FUNCTIONS-------------------- //----------------------------------geometry.Intersect() ------------------- -static PyObject *M_Geometry_Intersect( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_Intersect(PyObject *UNUSED(self), PyObject* args) { VectorObject *ray, *ray_off, *vec1, *vec2, *vec3; float dir[3], orig[3], v1[3], v2[3], v3[3], e1[3], e2[3], pvec[3], tvec[3], qvec[3]; @@ -133,7 +133,7 @@ static PyObject *M_Geometry_Intersect( PyObject * self, PyObject * args ) } //----------------------------------geometry.LineIntersect() ------------------- /* Line-Line intersection using algorithm from mathworld.wolfram.com */ -static PyObject *M_Geometry_LineIntersect( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_LineIntersect(PyObject *UNUSED(self), PyObject* args) { PyObject * tuple; VectorObject *vec1, *vec2, *vec3, *vec4; @@ -201,7 +201,7 @@ static PyObject *M_Geometry_LineIntersect( PyObject * self, PyObject * args ) //---------------------------------NORMALS FUNCTIONS-------------------- //----------------------------------geometry.QuadNormal() ------------------- -static PyObject *M_Geometry_QuadNormal( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_QuadNormal(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec1; VectorObject *vec2; @@ -252,7 +252,7 @@ static PyObject *M_Geometry_QuadNormal( PyObject * self, PyObject * args ) } //----------------------------geometry.TriangleNormal() ------------------- -static PyObject *M_Geometry_TriangleNormal( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_TriangleNormal(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec1, *vec2, *vec3; float v1[3], v2[3], v3[3], e1[3], e2[3], n[3]; @@ -289,7 +289,7 @@ static PyObject *M_Geometry_TriangleNormal( PyObject * self, PyObject * args ) //--------------------------------- AREA FUNCTIONS-------------------- //----------------------------------geometry.TriangleArea() ------------------- -static PyObject *M_Geometry_TriangleArea( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_TriangleArea(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec1, *vec2, *vec3; float v1[3], v2[3], v3[3]; @@ -335,7 +335,7 @@ static PyObject *M_Geometry_TriangleArea( PyObject * self, PyObject * args ) /*----------------------------------geometry.PolyFill() -------------------*/ /* PolyFill function, uses Blenders scanfill to fill multiple poly lines */ -static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq ) +static PyObject *M_Geometry_PolyFill(PyObject *UNUSED(self), PyObject * polyLineSeq ) { PyObject *tri_list; /*return this list of tri's */ PyObject *polyLine, *polyVec; @@ -450,7 +450,7 @@ static PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * polyLineSeq ) } -static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_LineIntersect2D(PyObject *UNUSED(self), PyObject* args) { VectorObject *line_a1, *line_a2, *line_b1, *line_b2; float a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y, xi, yi, a1,a2,b1,b2, newvec[2]; @@ -548,7 +548,7 @@ static PyObject *M_Geometry_LineIntersect2D( PyObject * self, PyObject * args ) Py_RETURN_NONE; } -static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_ClosestPointOnLine(PyObject *UNUSED(self), PyObject* args) { VectorObject *pt, *line_1, *line_2; float pt_in[3], pt_out[3], l1[3], l2[3]; @@ -586,7 +586,7 @@ static PyObject *M_Geometry_ClosestPointOnLine( PyObject * self, PyObject * args return ret; } -static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_PointInTriangle2D(PyObject *UNUSED(self), PyObject* args) { VectorObject *pt_vec, *tri_p1, *tri_p2, *tri_p3; @@ -606,7 +606,7 @@ static PyObject *M_Geometry_PointInTriangle2D( PyObject * self, PyObject * args return PyLong_FromLong(isect_point_tri_v2(pt_vec->vec, tri_p1->vec, tri_p2->vec, tri_p3->vec)); } -static PyObject *M_Geometry_PointInQuad2D( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_PointInQuad2D(PyObject *UNUSED(self), PyObject* args) { VectorObject *pt_vec, *quad_p1, *quad_p2, *quad_p3, *quad_p4; @@ -690,7 +690,7 @@ static void boxPack_ToPyObject(PyObject * value, boxPack **boxarray) } -static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * boxlist ) +static PyObject *M_Geometry_BoxPack2D(PyObject *UNUSED(self), PyObject * boxlist ) { boxPack *boxarray = NULL; float tot_width, tot_height; @@ -718,7 +718,7 @@ static PyObject *M_Geometry_BoxPack2D( PyObject * self, PyObject * boxlist ) return Py_BuildValue( "ff", tot_width, tot_height); } -static PyObject *M_Geometry_BezierInterp( PyObject * self, PyObject * args ) +static PyObject *M_Geometry_BezierInterp(PyObject *UNUSED(self), PyObject* args) { VectorObject *vec_k1, *vec_h1, *vec_k2, *vec_h2; int resolu; @@ -767,7 +767,7 @@ static PyObject *M_Geometry_BezierInterp( PyObject * self, PyObject * args ) return list; } -static PyObject *M_Geometry_BarycentricTransform(PyObject * self, PyObject * args) +static PyObject *M_Geometry_BarycentricTransform(PyObject *UNUSED(self), PyObject *args) { VectorObject *vec_pt; VectorObject *vec_t1_tar, *vec_t2_tar, *vec_t3_tar; diff --git a/source/blender/python/generic/mathutils.c b/source/blender/python/generic/mathutils.c index e81bc0cf239..540a9831dce 100644 --- a/source/blender/python/generic/mathutils.c +++ b/source/blender/python/generic/mathutils.c @@ -61,6 +61,8 @@ #include "BLI_math.h" +#include "BKE_utildefines.h" + //-------------------------DOC STRINGS --------------------------- static char M_Mathutils_doc[] = "This module provides access to matrices, eulers, quaternions and vectors."; @@ -203,7 +205,7 @@ int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index) /* BaseMathObject generic functions for all mathutils types */ char BaseMathObject_Owner_doc[] = "The item this is wrapping or None (readonly)."; -PyObject *BaseMathObject_getOwner( BaseMathObject * self, void *type ) +PyObject *BaseMathObject_getOwner(BaseMathObject *UNUSED(self), void *UNUSED(type)) { PyObject *ret= self->cb_user ? self->cb_user : Py_None; Py_INCREF(ret); @@ -211,7 +213,7 @@ PyObject *BaseMathObject_getOwner( BaseMathObject * self, void *type ) } char BaseMathObject_Wrapped_doc[] = "True when this object wraps external data (readonly).\n\n:type: boolean"; -PyObject *BaseMathObject_getWrapped( BaseMathObject *self, void *type ) +PyObject *BaseMathObject_getWrapped(BaseMathObject *UNUSED(self), void *UNUSED(type)) { return PyBool_FromLong((self->wrapped == Py_WRAP) ? 1:0); } diff --git a/source/blender/python/generic/mathutils_color.c b/source/blender/python/generic/mathutils_color.c index 57d2838238c..8380adef496 100644 --- a/source/blender/python/generic/mathutils_color.c +++ b/source/blender/python/generic/mathutils_color.c @@ -31,10 +31,15 @@ //----------------------------------mathutils.Color() ------------------- //makes a new color for you to play with -static PyObject *Color_new(PyTypeObject * type, PyObject * args, PyObject * kwargs) +static PyObject *Color_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) { float col[3]= {0.0f, 0.0f, 0.0f}; + if(kwds && PyDict_Size(kwds)) { + PyErr_SetString(PyExc_TypeError, "mathutils.Color(): takes no keyword args"); + return NULL; + } + switch(PyTuple_GET_SIZE(args)) { case 0: break; @@ -83,7 +88,7 @@ static char Color_copy_doc[] = "\n" " .. note:: use this to get a copy of a wrapped color with no reference to the original data.\n"; -static PyObject *Color_copy(ColorObject * self, PyObject *args) +static PyObject *Color_copy(ColorObject *self) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -158,7 +163,7 @@ static PyObject* Color_richcmpr(PyObject *objectA, PyObject *objectB, int compar //---------------------SEQUENCE PROTOCOLS------------------------ //----------------------------len(object)------------------------ //sequence length -static int Color_len(ColorObject * self) +static int Color_len(ColorObject *UNUSED(self)) { return COLOR_SIZE; } @@ -394,7 +399,7 @@ static int Color_setChannelHSV(ColorObject * self, PyObject * value, void * type } /* color channel (HSV), color.h/s/v */ -static PyObject *Color_getHSV(ColorObject * self, void *type) +static PyObject *Color_getHSV(ColorObject * self, void *UNUSED(closure)) { float hsv[3]; PyObject *ret; @@ -411,7 +416,7 @@ static PyObject *Color_getHSV(ColorObject * self, void *type) return ret; } -static int Color_setHSV(ColorObject * self, PyObject * value, void * type) +static int Color_setHSV(ColorObject * self, PyObject * value, void *UNUSED(closure)) { float hsv[3]; @@ -452,8 +457,8 @@ static PyGetSetDef Color_getseters[] = { //-----------------------METHOD DEFINITIONS ---------------------- static struct PyMethodDef Color_methods[] = { - {"__copy__", (PyCFunction) Color_copy, METH_VARARGS, Color_copy_doc}, - {"copy", (PyCFunction) Color_copy, METH_VARARGS, Color_copy_doc}, + {"__copy__", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc}, + {"copy", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c index f85578dd31d..c7091347493 100644 --- a/source/blender/python/generic/mathutils_euler.c +++ b/source/blender/python/generic/mathutils_euler.c @@ -39,7 +39,7 @@ //----------------------------------mathutils.Euler() ------------------- //makes a new euler for you to play with -static PyObject *Euler_new(PyTypeObject * type, PyObject * args, PyObject * kwargs) +static PyObject *Euler_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) { PyObject *seq= NULL; char *order_str= NULL; @@ -47,6 +47,11 @@ static PyObject *Euler_new(PyTypeObject * type, PyObject * args, PyObject * kwar float eul[EULER_SIZE]= {0.0f, 0.0f, 0.0f}; short order= EULER_ORDER_XYZ; + if(kwds && PyDict_Size(kwds)) { + PyErr_SetString(PyExc_TypeError, "mathutils.Euler(): takes no keyword args"); + return NULL; + } + if(!PyArg_ParseTuple(args, "|Os:mathutils.Euler", &seq, &order_str)) return NULL; @@ -313,7 +318,7 @@ static char Euler_copy_doc[] = "\n" " .. note:: use this to get a copy of a wrapped euler with no reference to the original data.\n"; -static PyObject *Euler_copy(EulerObject * self, PyObject *args) +static PyObject *Euler_copy(EulerObject *self) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -388,7 +393,7 @@ static PyObject* Euler_richcmpr(PyObject *objectA, PyObject *objectB, int compar //---------------------SEQUENCE PROTOCOLS------------------------ //----------------------------len(object)------------------------ //sequence length -static int Euler_len(EulerObject * self) +static int Euler_len(EulerObject *UNUSED(self)) { return EULER_SIZE; } @@ -411,7 +416,7 @@ static PyObject *Euler_item(EulerObject * self, int i) } //----------------------------object[]------------------------- //sequence accessor (set) -static int Euler_ass_item(EulerObject * self, int i, PyObject * value) +static int Euler_ass_item(EulerObject * self, int i, PyObject *value) { float f = PyFloat_AsDouble(value); @@ -577,18 +582,18 @@ static PyMappingMethods Euler_AsMapping = { /* * euler axis, euler.x/y/z */ -static PyObject *Euler_getAxis( EulerObject * self, void *type ) +static PyObject *Euler_getAxis(EulerObject *self, void *type ) { return Euler_item(self, GET_INT_FROM_POINTER(type)); } -static int Euler_setAxis( EulerObject * self, PyObject * value, void * type ) +static int Euler_setAxis(EulerObject *self, PyObject *value, void *type) { return Euler_ass_item(self, GET_INT_FROM_POINTER(type), value); } /* rotation order */ -static PyObject *Euler_getOrder(EulerObject *self, void *type) +static PyObject *Euler_getOrder(EulerObject *self, void *UNUSED(closure)) { const char order[][4] = {"XYZ", "XZY", "YXZ", "YZX", "ZXY", "ZYX"}; @@ -598,7 +603,7 @@ static PyObject *Euler_getOrder(EulerObject *self, void *type) return PyUnicode_FromString(order[self->order-EULER_ORDER_XYZ]); } -static int Euler_setOrder( EulerObject * self, PyObject * value, void * type ) +static int Euler_setOrder(EulerObject *self, PyObject *value, void *UNUSED(closure)) { char *order_str= _PyUnicode_AsString(value); short order= euler_order_from_string(order_str, "euler.order"); @@ -634,8 +639,8 @@ static struct PyMethodDef Euler_methods[] = { {"to_quat", (PyCFunction) Euler_ToQuat, METH_NOARGS, Euler_ToQuat_doc}, {"rotate_axis", (PyCFunction) Euler_rotate_axis, METH_VARARGS, Euler_rotate_axis_doc}, {"make_compatible", (PyCFunction) Euler_MakeCompatible, METH_O, Euler_MakeCompatible_doc}, - {"__copy__", (PyCFunction) Euler_copy, METH_VARARGS, Euler_copy_doc}, - {"copy", (PyCFunction) Euler_copy, METH_VARARGS, Euler_copy_doc}, + {"__copy__", (PyCFunction) Euler_copy, METH_NOARGS, Euler_copy_doc}, + {"copy", (PyCFunction) Euler_copy, METH_NOARGS, Euler_copy_doc}, {NULL, NULL, 0, NULL} }; diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c index 3b8c7d3122a..9476e8127b6 100644 --- a/source/blender/python/generic/mathutils_matrix.c +++ b/source/blender/python/generic/mathutils_matrix.c @@ -108,7 +108,7 @@ Mathutils_Callback mathutils_matrix_vector_cb = { //----------------------------------mathutils.Matrix() ----------------- //mat is a 1D array of floats - row[0][0],row[0][1], row[1][0], etc. //create a new matrix type -static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +static PyObject *Matrix_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) { PyObject *argObject, *m, *s; MatrixObject *mat; @@ -117,6 +117,11 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; float scalar; + if(kwds && PyDict_Size(kwds)) { + PyErr_SetString(PyExc_TypeError, "mathutils.Matrix(): takes no keyword args"); + return NULL; + } + argSize = PyTuple_GET_SIZE(args); if(argSize > MATRIX_MAX_DIM) { //bad arg nums PyErr_SetString(PyExc_AttributeError, "mathutils.Matrix(): expects 0-4 numeric sequences of the same size\n"); @@ -1142,7 +1147,7 @@ static char Matrix_copy_doc[] = " :return: an instance of itself\n" " :rtype: :class:`Matrix`\n"; -PyObject *Matrix_copy(MatrixObject * self) +PyObject *Matrix_copy(MatrixObject *self) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -1680,17 +1685,17 @@ static PyNumberMethods Matrix_NumMethods = { 0, /* nb_index */ }; -static PyObject *Matrix_getRowSize( MatrixObject * self, void *type ) +static PyObject *Matrix_getRowSize(MatrixObject *self, void *UNUSED(closure)) { return PyLong_FromLong((long) self->rowSize); } -static PyObject *Matrix_getColSize( MatrixObject * self, void *type ) +static PyObject *Matrix_getColSize(MatrixObject *self, void *UNUSED(closure)) { return PyLong_FromLong((long) self->colSize); } -static PyObject *Matrix_getMedianScale( MatrixObject * self, void *type ) +static PyObject *Matrix_getMedianScale(MatrixObject *self, void *UNUSED(closure)) { float mat[3][3]; @@ -1710,7 +1715,7 @@ static PyObject *Matrix_getMedianScale( MatrixObject * self, void *type ) return PyFloat_FromDouble(mat3_to_scale(mat)); } -static PyObject *Matrix_getIsNegative( MatrixObject * self, void *type ) +static PyObject *Matrix_getIsNegative(MatrixObject *self, void *UNUSED(closure)) { if(!BaseMath_ReadCallback(self)) return NULL; diff --git a/source/blender/python/generic/mathutils_quat.c b/source/blender/python/generic/mathutils_quat.c index 553844b6ee5..37f20ebbe31 100644 --- a/source/blender/python/generic/mathutils_quat.c +++ b/source/blender/python/generic/mathutils_quat.c @@ -352,7 +352,7 @@ static char Quaternion_copy_doc[] = "\n" " .. note:: use this to get a copy of a wrapped quaternion with no reference to the original data.\n"; -static PyObject *Quaternion_copy(QuaternionObject * self) +static PyObject *Quaternion_copy(QuaternionObject *self) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -429,7 +429,7 @@ static PyObject* Quaternion_richcmpr(PyObject *objectA, PyObject *objectB, int c //---------------------SEQUENCE PROTOCOLS------------------------ //----------------------------len(object)------------------------ //sequence length -static int Quaternion_len(QuaternionObject * self) +static int Quaternion_len(QuaternionObject *UNUSED(self)) { return QUAT_SIZE; } @@ -772,7 +772,7 @@ static int Quaternion_setAxis( QuaternionObject * self, PyObject * value, void * return Quaternion_ass_item(self, GET_INT_FROM_POINTER(type), value); } -static PyObject *Quaternion_getMagnitude( QuaternionObject * self, void *type ) +static PyObject *Quaternion_getMagnitude(QuaternionObject * self, void *UNUSED(closure)) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -780,7 +780,7 @@ static PyObject *Quaternion_getMagnitude( QuaternionObject * self, void *type ) return PyFloat_FromDouble(sqrt(dot_qtqt(self->quat, self->quat))); } -static PyObject *Quaternion_getAngle( QuaternionObject * self, void *type ) +static PyObject *Quaternion_getAngle(QuaternionObject * self, void *UNUSED(closure)) { if(!BaseMath_ReadCallback(self)) return NULL; @@ -788,7 +788,7 @@ static PyObject *Quaternion_getAngle( QuaternionObject * self, void *type ) return PyFloat_FromDouble(2.0 * (saacos(self->quat[0]))); } -static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void * type) +static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void *UNUSED(closure)) { float axis[3]; float angle; @@ -821,7 +821,7 @@ static int Quaternion_setAngle(QuaternionObject * self, PyObject * value, void * return 0; } -static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *type) +static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *UNUSED(closure)) { float axis[3]; float angle; @@ -842,7 +842,7 @@ static PyObject *Quaternion_getAxisVec(QuaternionObject *self, void *type) return (PyObject *) newVectorObject(axis, 3, Py_NEW, NULL); } -static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *type) +static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void *UNUSED(closure)) { float axis[3]; float angle; @@ -872,12 +872,17 @@ static int Quaternion_setAxisVec(QuaternionObject *self, PyObject *value, void * } //----------------------------------mathutils.Quaternion() -------------- -static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +static PyObject *Quaternion_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds) { PyObject *seq= NULL; float angle = 0.0f; float quat[QUAT_SIZE]= {0.0f, 0.0f, 0.0f, 0.0f}; + if(kwds && PyDict_Size(kwds)) { + PyErr_SetString(PyExc_TypeError, "mathutils.Quaternion(): takes no keyword args"); + return NULL; + } + if(!PyArg_ParseTuple(args, "|Of:mathutils.Quaternion", &seq, &angle)) return NULL; diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c index 1fe2518c6ef..84f41b6e66a 100644 --- a/source/blender/python/generic/mathutils_vector.c +++ b/source/blender/python/generic/mathutils_vector.c @@ -45,7 +45,7 @@ static PyObject *Vector_ToTupleExt(VectorObject *self, int ndigits); //----------------------------------mathutils.Vector() ------------------ // Supports 2D, 3D, and 4D vector objects both int and float values // accepted. Mixed float and int values accepted. Ints are parsed to float -static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +static PyObject *Vector_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { float vec[4]= {0.0f, 0.0f, 0.0f, 0.0f}; int size= 3; /* default to a 3D vector */ @@ -1445,7 +1445,7 @@ static int Vector_setAxis(VectorObject *self, PyObject * value, void * type ) } /* vector.length */ -static PyObject *Vector_getLength(VectorObject *self, void *type ) +static PyObject *Vector_getLength(VectorObject *self, void *UNUSED(closure)) { double dot = 0.0f; int i; diff --git a/source/blender/python/generic/noise.c b/source/blender/python/generic/noise.c index 4a09cbb58d8..a9bbc016a54 100644 --- a/source/blender/python/generic/noise.c +++ b/source/blender/python/generic/noise.c @@ -39,6 +39,8 @@ #include "BLI_blenlib.h" #include "DNA_texture_types.h" + +#include "BKE_utildefines.h" /*-----------------------------------------*/ /* 'mersenne twister' random number generator */ @@ -207,12 +209,12 @@ static void randuvec(float v[3]) v[2] = 1.f; } -static PyObject *Noise_random(PyObject * self) +static PyObject *Noise_random(PyObject *UNUSED(self)) { return PyFloat_FromDouble(frand()); } -static PyObject *Noise_random_unit_vector(PyObject * self) +static PyObject *Noise_random_unit_vector(PyObject *UNUSED(self)) { float v[3] = {0.0f, 0.0f, 0.0f}; randuvec(v); @@ -223,7 +225,7 @@ static PyObject *Noise_random_unit_vector(PyObject * self) /* Random seed init. Only used for MT random() & randuvec() */ -static PyObject *Noise_seed_set(PyObject * self, PyObject * args) +static PyObject *Noise_seed_set(PyObject *UNUSED(self), PyObject *args) { int s; if(!PyArg_ParseTuple(args, "i:seed_set", &s)) @@ -236,7 +238,7 @@ static PyObject *Noise_seed_set(PyObject * self, PyObject * args) /* General noise */ -static PyObject *Noise_noise(PyObject * self, PyObject * args) +static PyObject *Noise_noise(PyObject *UNUSED(self), PyObject *args) { float x, y, z; int nb = 1; @@ -260,7 +262,7 @@ static void noise_vector(float x, float y, float z, int nb, float v[3]) nb) - 1.0); } -static PyObject *Noise_vector(PyObject * self, PyObject * args) +static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, v[3]; int nb = 1; @@ -296,7 +298,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb, return out; } -static PyObject *Noise_turbulence(PyObject * self, PyObject * args) +static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args) { float x, y, z; int oct, hd, nb = 1; @@ -340,7 +342,7 @@ static void vTurb(float x, float y, float z, int oct, int hard, int nb, } } -static PyObject *Noise_turbulence_vector(PyObject * self, PyObject * args) +static PyObject *Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, v[3]; int oct, hd, nb = 1; @@ -355,7 +357,7 @@ static PyObject *Noise_turbulence_vector(PyObject * self, PyObject * args) /* F. Kenton Musgrave's fractal functions */ -static PyObject *Noise_fractal(PyObject * self, PyObject * args) +static PyObject *Noise_fractal(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct; int nb = 1; @@ -366,7 +368,7 @@ static PyObject *Noise_fractal(PyObject * self, PyObject * args) /*------------------------------------------------------------------------*/ -static PyObject *Noise_multi_fractal(PyObject * self, PyObject * args) +static PyObject *Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct; int nb = 1; @@ -378,7 +380,7 @@ static PyObject *Noise_multi_fractal(PyObject * self, PyObject * args) /*------------------------------------------------------------------------*/ -static PyObject *Noise_vl_vector(PyObject * self, PyObject * args) +static PyObject *Noise_vl_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, d; int nt1 = 1, nt2 = 1; @@ -389,7 +391,7 @@ static PyObject *Noise_vl_vector(PyObject * self, PyObject * args) /*-------------------------------------------------------------------------*/ -static PyObject *Noise_hetero_terrain(PyObject * self, PyObject * args) +static PyObject *Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct, ofs; int nb = 1; @@ -401,7 +403,7 @@ static PyObject *Noise_hetero_terrain(PyObject * self, PyObject * args) /*-------------------------------------------------------------------------*/ -static PyObject *Noise_hybrid_multi_fractal(PyObject * self, PyObject * args) +static PyObject *Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct, ofs, gn; int nb = 1; @@ -413,7 +415,7 @@ static PyObject *Noise_hybrid_multi_fractal(PyObject * self, PyObject * args) /*------------------------------------------------------------------------*/ -static PyObject *Noise_ridged_multi_fractal(PyObject * self, PyObject * args) +static PyObject *Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *args) { float x, y, z, H, lac, oct, ofs, gn; int nb = 1; @@ -424,7 +426,7 @@ static PyObject *Noise_ridged_multi_fractal(PyObject * self, PyObject * args) /*-------------------------------------------------------------------------*/ -static PyObject *Noise_voronoi(PyObject * self, PyObject * args) +static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args) { float x, y, z, da[4], pa[12]; int dtype = 0; @@ -441,7 +443,7 @@ static PyObject *Noise_voronoi(PyObject * self, PyObject * args) /*-------------------------------------------------------------------------*/ -static PyObject *Noise_cell(PyObject * self, PyObject * args) +static PyObject *Noise_cell(PyObject *UNUSED(self), PyObject *args) { float x, y, z; if(!PyArg_ParseTuple(args, "(fff):cell", &x, &y, &z)) @@ -452,7 +454,7 @@ static PyObject *Noise_cell(PyObject * self, PyObject * args) /*--------------------------------------------------------------------------*/ -static PyObject *Noise_cell_vector(PyObject * self, PyObject * args) +static PyObject *Noise_cell_vector(PyObject *UNUSED(self), PyObject *args) { float x, y, z, ca[3]; if(!PyArg_ParseTuple(args, "(fff):cell_vector", &x, &y, &z)) @@ -603,22 +605,22 @@ look like anything from an earthquake to a very nervous or maybe even drunk came /* Just in case, declarations for a header file */ /* -static PyObject *Noise_random(PyObject *self); -static PyObject *Noise_random_unit_vector(PyObject *self); -static PyObject *Noise_seed_set(PyObject *self, PyObject *args); -static PyObject *Noise_noise(PyObject *self, PyObject *args); -static PyObject *Noise_vector(PyObject *self, PyObject *args); -static PyObject *Noise_turbulence(PyObject *self, PyObject *args); -static PyObject *Noise_turbulence_vector(PyObject *self, PyObject *args); -static PyObject *Noise_fractal(PyObject *self, PyObject *args); -static PyObject *Noise_multi_fractal(PyObject *self, PyObject *args); -static PyObject *Noise_vl_vector(PyObject *self, PyObject *args); -static PyObject *Noise_hetero_terrain(PyObject *self, PyObject *args); -static PyObject *Noise_hybrid_multi_fractal(PyObject *self, PyObject *args); -static PyObject *Noise_ridged_multi_fractal(PyObject *self, PyObject *args); -static PyObject *Noise_voronoi(PyObject *self, PyObject *args); -static PyObject *Noise_cell(PyObject *self, PyObject *args); -static PyObject *Noise_cell_vector(PyObject *self, PyObject *args); +static PyObject *Noise_random(PyObject *UNUSED(self)); +static PyObject *Noise_random_unit_vector(PyObject *UNUSED(self)); +static PyObject *Noise_seed_set(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_noise(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_fractal(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_vl_vector(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_cell(PyObject *UNUSED(self), PyObject *args); +static PyObject *Noise_cell_vector(PyObject *UNUSED(self), PyObject *args); */ static PyMethodDef NoiseMethods[] = { diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 69b5faceca0..afcf7e757e6 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -34,7 +34,9 @@ #include "BLI_path_util.h" #include "BLI_bpath.h" - + +#include "BKE_utildefines.h" + /* external util modules */ #include "../generic/geometry.h" #include "../generic/bgl.h" @@ -51,7 +53,7 @@ static char bpy_script_paths_doc[] = " :return: (system, user) strings will be empty when not found.\n" " :rtype: tuple of strigs\n"; -PyObject *bpy_script_paths(PyObject *self) +PyObject *bpy_script_paths(PyObject *UNUSED(self)) { PyObject *ret= PyTuple_New(2); char *path; @@ -73,7 +75,7 @@ static char bpy_blend_paths_doc[] = " :type absolute: boolean\n" " :return: path list.\n" " :rtype: list of strigs\n"; -static PyObject *bpy_blend_paths(PyObject * self, PyObject *args, PyObject *kw) +static PyObject *bpy_blend_paths(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { struct BPathIterator bpi; PyObject *list = PyList_New(0), *st; /* stupidly big string to be safe */ @@ -124,7 +126,7 @@ static char bpy_user_resource_doc[] = " :type subdir: string\n" " :return: a path.\n" " :rtype: string\n"; -static PyObject *bpy_user_resource(PyObject * self, PyObject *args, PyObject *kw) +static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { char *type; char *subdir= NULL; diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c index 6c4e190673c..46a3c93292b 100644 --- a/source/blender/python/intern/bpy_app.c +++ b/source/blender/python/intern/bpy_app.c @@ -26,6 +26,7 @@ #include "BLI_path_util.h" +#include "BKE_utildefines.h" #include "BKE_blender.h" #include "BKE_global.h" #include "structseq.h" @@ -116,21 +117,15 @@ static PyObject *make_app_info(void) /* a few getsets because it makes sense for them to be in bpy.app even though * they are not static */ -static PyObject *bpy_app_debug_get(PyObject *self, void *closure) +static PyObject *bpy_app_debug_get(PyObject *UNUSED(self), void *UNUSED(closure)) { - (void)(self); - (void)(closure); - return PyBool_FromLong(G.f & G_DEBUG); } -static int bpy_app_debug_set(PyObject *self, PyObject *value, void *closure) +static int bpy_app_debug_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure)) { int param= PyObject_IsTrue(value); - (void)(self); - (void)(closure); - if(param < 0) { PyErr_SetString(PyExc_TypeError, "bpy.app.debug can only be True/False"); return -1; @@ -142,12 +137,9 @@ static int bpy_app_debug_set(PyObject *self, PyObject *value, void *closure) return 0; } -static PyObject *bpy_app_tempdir_get(PyObject *self, void *closure) +static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure)) { extern char btempdir[]; - (void)(self); - (void)(closure); - return PyC_UnicodeFromByte(btempdir); } diff --git a/source/blender/python/intern/bpy_array.c b/source/blender/python/intern/bpy_array.c index 6d971d8708e..d219757b777 100644 --- a/source/blender/python/intern/bpy_array.c +++ b/source/blender/python/intern/bpy_array.c @@ -237,7 +237,7 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int return data; } -static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix) +static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, char *param_data, ItemTypeCheckFunc check_item_type, const char *item_type_str, int item_size, ItemConvertFunc convert_item, RNA_SetArrayFunc rna_set_array, const char *error_prefix) { int totdim, dim_size[MAX_ARRAY_DIMENSION]; int totitem; @@ -358,18 +358,18 @@ static void bool_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void * RNA_property_boolean_set_index(ptr, prop, index, *(int*)value); } -int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, PyObject *py, const char *error_prefix) +int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix) { int ret; switch (RNA_property_type(prop)) { case PROP_FLOAT: - ret= py_to_array(py, ptr, prop, parms, param_data, py_float_check, "float", sizeof(float), py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix); + ret= py_to_array(py, ptr, prop, param_data, py_float_check, "float", sizeof(float), py_to_float, (RNA_SetArrayFunc)RNA_property_float_set_array, error_prefix); break; case PROP_INT: - ret= py_to_array(py, ptr, prop, parms, param_data, py_int_check, "int", sizeof(int), py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix); + ret= py_to_array(py, ptr, prop, param_data, py_int_check, "int", sizeof(int), py_to_int, (RNA_SetArrayFunc)RNA_property_int_set_array, error_prefix); break; case PROP_BOOLEAN: - ret= py_to_array(py, ptr, prop, parms, param_data, py_bool_check, "boolean", sizeof(int), py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix); + ret= py_to_array(py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int), py_to_bool, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix); break; default: PyErr_SetString(PyExc_TypeError, "not an array type"); diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index bc79ba94756..3ff0d86b433 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -43,6 +43,7 @@ #include "BLI_math_base.h" #include "BLI_string.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_text.h" #include "BKE_font.h" /* only for utf8towchar */ @@ -104,7 +105,8 @@ void bpy_context_set(bContext *C, PyGILState_STATE *gilstate) } } -void bpy_context_clear(bContext *C, PyGILState_STATE *gilstate) +/* context should be used but not now because it causes some bugs */ +void bpy_context_clear(bContext *UNUSED(C), PyGILState_STATE *gilstate) { py_call_level--; diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 2b475a57de6..3ffa78dab70 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -40,7 +40,7 @@ #include "MEM_guardedalloc.h" #include "BKE_report.h" -static PyObject *pyop_poll( PyObject * self, PyObject * args) +static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args) { wmOperatorType *ot; char *opname; @@ -80,7 +80,7 @@ static PyObject *pyop_poll( PyObject * self, PyObject * args) return ret; } -static PyObject *pyop_call( PyObject * self, PyObject * args) +static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) { wmOperatorType *ot; int error_val = 0; @@ -196,7 +196,7 @@ static PyObject *pyop_call( PyObject * self, PyObject * args) } -static PyObject *pyop_as_string( PyObject * self, PyObject * args) +static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args) { wmOperatorType *ot; PointerRNA ptr; @@ -248,7 +248,7 @@ static PyObject *pyop_as_string( PyObject * self, PyObject * args) return pybuf; } -static PyObject *pyop_dir(PyObject *self) +static PyObject *pyop_dir(PyObject *UNUSED(self)) { PyObject *list = PyList_New(0), *name; wmOperatorType *ot; @@ -262,7 +262,7 @@ static PyObject *pyop_dir(PyObject *self) return list; } -static PyObject *pyop_getrna(PyObject *self, PyObject *value) +static PyObject *pyop_getrna(PyObject *UNUSED(self), PyObject *value) { wmOperatorType *ot; PointerRNA ptr; diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c index 6d16896fb16..fa1aeacbc42 100644 --- a/source/blender/python/intern/bpy_operator_wrap.c +++ b/source/blender/python/intern/bpy_operator_wrap.c @@ -84,7 +84,7 @@ void macro_wrapper(wmOperatorType *ot, void *userdata) operator_properties_init(ot); } -PyObject *PYOP_wrap_macro_define(PyObject *self, PyObject *args) +PyObject *PYOP_wrap_macro_define(PyObject *UNUSED(self), PyObject *args) { wmOperatorType *ot; wmOperatorTypeMacro *otmacro; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index b49a48699fa..a3b0c4739c4 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -58,7 +58,7 @@ #include "../generic/IDProp.h" /* for IDprop lookups */ #include "../generic/py_capi_utils.h" -static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix); +static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix); static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length); static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self); static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self); @@ -135,7 +135,7 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype) return 1; } -static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int index) +static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int UNUSED(subtype), int index) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -146,7 +146,7 @@ static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int return 1; } -static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int subtype, int index) +static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int UNUSED(subtype), int index) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -176,7 +176,7 @@ Mathutils_Callback mathutils_rna_array_cb = { /* bpyrna matrix callbacks */ static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */ -static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype) +static int mathutils_rna_matrix_get(BaseMathObject *bmo, int UNUSED(subtype)) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -187,7 +187,7 @@ static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype) return 1; } -static int mathutils_rna_matrix_set(BaseMathObject *bmo, int subtype) +static int mathutils_rna_matrix_set(BaseMathObject *bmo, int UNUSED(subtype)) { BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user; @@ -864,7 +864,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const cha break; } } else { - if (pyrna_py_to_prop(ptr, prop, NULL, NULL, item, error_prefix)) { + if (pyrna_py_to_prop(ptr, prop, NULL, item, error_prefix)) { error_val= -1; break; } @@ -918,7 +918,7 @@ static PyObject *pyrna_func_to_py(BPy_DummyPointerRNA *pyrna, FunctionRNA *func) -static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix) +static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value, const char *error_prefix) { /* XXX hard limits should be checked here */ int type = RNA_property_type(prop); @@ -941,7 +941,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *p return -1; } /* done getting the length */ - ok= pyrna_py_to_array(ptr, prop, parms, data, value, error_prefix); + ok= pyrna_py_to_array(ptr, prop, data, value, error_prefix); if (!ok) { /* PyErr_Format(PyExc_AttributeError, "%.200s %s", error_prefix, error_str); */ @@ -1391,7 +1391,7 @@ static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, cons } /* static PyObject *pyrna_prop_array_subscript_str(BPy_PropertyRNA *self, char *keyname) */ -static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length) +static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop) { PointerRNA newptr; PyObject *list = PyList_New(stop - start); @@ -1513,7 +1513,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject return PyList_New(0); } else if (step == 1) { - return pyrna_prop_collection_subscript_slice(&self->ptr, self->prop, start, stop, len); + return pyrna_prop_collection_subscript_slice(&self->ptr, self->prop, start, stop); } else { PyErr_SetString(PyExc_TypeError, "bpy_prop_collection[slice]: slice steps not supported with rna"); @@ -2431,7 +2431,7 @@ static char pyrna_struct_type_recast_doc[] = " :return: a new instance of this object with the type initialized again.\n" " :rtype: subclass of :class:`bpy_struct`"; -static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self, PyObject *args) +static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self) { PointerRNA r_ptr; RNA_pointer_recast(&self->ptr, &r_ptr); @@ -2751,7 +2751,7 @@ static int pyrna_struct_setattro( BPy_StructRNA *self, PyObject *pyname, PyObjec PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported"); return -1; } - return pyrna_py_to_prop(&self->ptr, prop, NULL, NULL, value, "bpy_struct: item.attr = val:"); + return pyrna_py_to_prop(&self->ptr, prop, NULL, value, "bpy_struct: item.attr = val:"); } else { return PyObject_GenericSetAttr((PyObject *)self, pyname, value); @@ -2835,7 +2835,7 @@ static int pyrna_prop_collection_setattro( BPy_PropertyRNA *self, PyObject *pyna else if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) { if ((prop = RNA_struct_find_property(&r_ptr, name))) { /* pyrna_py_to_prop sets its own exceptions */ - return pyrna_py_to_prop(&r_ptr, prop, NULL, NULL, value, "BPy_PropertyRNA - Attribute (setattr):"); + return pyrna_py_to_prop(&r_ptr, prop, NULL, value, "BPy_PropertyRNA - Attribute (setattr):"); } } @@ -3409,7 +3409,7 @@ static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = { /* only needed for subtyping, so a new class gets a valid BPy_StructRNA * todo - also accept useful args */ -static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { +static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { BPy_StructRNA *base; @@ -3432,7 +3432,7 @@ static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject /* only needed for subtyping, so a new class gets a valid BPy_StructRNA * todo - also accept useful args */ -static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { +static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *UNUSED(kwds)) { BPy_PropertyRNA *base; @@ -3454,7 +3454,7 @@ static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *k } } -PyObject *pyrna_param_to_py(PointerRNA *ptr, ParameterList *parms, PropertyRNA *prop, void *data) +PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data) { PyObject *ret; int type = RNA_property_type(prop); @@ -3704,7 +3704,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw) continue; } - err= pyrna_py_to_prop(&funcptr, parm, &parms, iter.data, item, ""); + err= pyrna_py_to_prop(&funcptr, parm, iter.data, item, ""); if(err!=0) { /* the error generated isnt that useful, so generate it again with a useful prefix @@ -3717,7 +3717,7 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw) else snprintf(error_prefix, sizeof(error_prefix), "%s.%s(): error with argument %d, \"%s\" - ", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), i, parm_id); - pyrna_py_to_prop(&funcptr, parm, &parms, iter.data, item, error_prefix); + pyrna_py_to_prop(&funcptr, parm, iter.data, item, error_prefix); break; } @@ -3822,13 +3822,13 @@ static PyObject * pyrna_func_call(PyObject *self, PyObject *args, PyObject *kw) flag= RNA_property_flag(parm); if (flag & PROP_OUTPUT) - PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, &parms, parm, iter.data)); + PyTuple_SET_ITEM(ret, i++, pyrna_param_to_py(&funcptr, parm, iter.data)); } RNA_parameter_list_end(&iter); } else - ret= pyrna_param_to_py(&funcptr, &parms, pret_single, retdata_single); + ret= pyrna_param_to_py(&funcptr, pret_single, retdata_single); /* possible there is an error in conversion */ if(ret==NULL) @@ -5012,7 +5012,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun if(strcmp(identifier, rna_attr) == 0) { \ item= PyObject_GetAttrString(py_class, py_attr); \ if(item && item != Py_None) { \ - if(pyrna_py_to_prop(dummyptr, prop, NULL, NULL, item, "validating class error:") != 0) { \ + if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0) { \ Py_DECREF(item); \ return -1; \ } \ @@ -5036,7 +5036,7 @@ static int bpy_class_validate(PointerRNA *dummyptr, void *py_data, int *have_fun else { Py_DECREF(item); /* no need to keep a ref, the class owns it */ - if(pyrna_py_to_prop(dummyptr, prop, NULL, NULL, item, "validating class error:") != 0) + if(pyrna_py_to_prop(dummyptr, prop, NULL, item, "validating class error:") != 0) return -1; } } @@ -5156,7 +5156,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par continue; } - parmitem= pyrna_param_to_py(&funcptr, parms, parm, iter.data); + parmitem= pyrna_param_to_py(&funcptr, parm, iter.data); PyTuple_SET_ITEM(args, i, parmitem); i++; } @@ -5191,7 +5191,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par err= -1; } else if(ret_len==1) { - err= pyrna_py_to_prop(&funcptr, pret_single, parms, retdata_single, ret, "calling class function:"); + err= pyrna_py_to_prop(&funcptr, pret_single, retdata_single, ret, "calling class function:"); } else if (ret_len > 1) { @@ -5214,7 +5214,7 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par /* only useful for single argument returns, we'll need another list loop for multiple */ if (flag & PROP_OUTPUT) { - err= pyrna_py_to_prop(&funcptr, parm, parms, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:"); + err= pyrna_py_to_prop(&funcptr, parm, iter.data, PyTuple_GET_ITEM(ret, i++), "calling class function:"); if(err) break; } @@ -5328,7 +5328,7 @@ void pyrna_free_types(void) * - Should still be fixed - Campbell * */ -static PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class) +static PyObject *pyrna_basetype_register(PyObject *UNUSED(self), PyObject *py_class) { bContext *C= NULL; ReportList reports; @@ -5425,7 +5425,7 @@ static int pyrna_srna_contains_pointer_prop_srna(StructRNA *srna_props, StructRN return 0; } -static PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class) +static PyObject *pyrna_basetype_unregister(PyObject *UNUSED(self), PyObject *py_class) { bContext *C= NULL; StructUnregisterFunc unreg; diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index 7f750f94242..77b602b6f83 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -99,7 +99,7 @@ void pyrna_alloc_types(void); void pyrna_free_types(void); /* primitive type conversion */ -int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, char *param_data, PyObject *py, const char *error_prefix); +int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, PyObject *py, const char *error_prefix); int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, int arrayoffset, int index, PyObject *py, const char *error_prefix); PyObject *pyrna_array_index(PointerRNA *ptr, PropertyRNA *prop, int index); diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c index b2a7511f998..81d6e0cd4da 100644 --- a/source/blender/python/intern/bpy_rna_callback.c +++ b/source/blender/python/intern/bpy_rna_callback.c @@ -27,6 +27,7 @@ #include "bpy_util.h" #include "DNA_screen_types.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "ED_space_api.h" @@ -34,7 +35,7 @@ #define RNA_CAPSULE_ID "RNA_HANDLE" #define RNA_CAPSULE_ID_INVALID "RNA_HANDLE_REMOVED" -void cb_region_draw(const bContext *C, ARegion *ar, void *customdata) +void cb_region_draw(const bContext *C, ARegion *UNUSED(ar), void *customdata) { PyObject *cb_func, *cb_args, *result; PyGILState_STATE gilstate; |