use PySequence_Size() rather then PySequence_Length(), this is only kept in python...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 9 Jan 2011 14:53:18 +0000 (14:53 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 9 Jan 2011 14:53:18 +0000 (14:53 +0000)
12 files changed:
intern/audaspace/Python/AUD_PyAPI.cpp
source/blender/python/generic/IDProp.c
source/blender/python/generic/bgl.c
source/blender/python/generic/mathutils_vector.c
source/blender/python/intern/bpy_props.c
source/blender/python/intern/bpy_rna.c
source/blender/python/intern/bpy_rna_array.c
source/gameengine/VideoTexture/FilterBlueScreen.cpp
source/gameengine/VideoTexture/FilterColor.cpp
source/gameengine/VideoTexture/ImageRender.cpp
source/gameengine/VideoTexture/ImageViewport.cpp
source/gameengine/VideoTexture/VideoBase.cpp

index d3f42419494aa4034a1539929e0182dd5a7a1636..9620f26cc338d7d10320bc25684e99c9dada4b3b 100644 (file)
@@ -851,7 +851,7 @@ Factory_filter(Factory* self, PyObject* args)
                return NULL;
        }
 
-       if(!PySequence_Length(py_b) || (py_a != NULL && !PySequence_Length(py_a)))
+       if(!PySequence_Size(py_b) || (py_a != NULL && !PySequence_Size(py_a)))
        {
                PyErr_SetString(PyExc_ValueError, "The sequence has to contain at least one value!");
                return NULL;
@@ -862,7 +862,7 @@ Factory_filter(Factory* self, PyObject* args)
        float value;
        int result;
 
-       for(int i = 0; i < PySequence_Length(py_b); i++)
+       for(int i = 0; i < PySequence_Size(py_b); i++)
        {
                py_value = PySequence_GetItem(py_b, i);
                result = PyArg_Parse(py_value, "f:filter", &value);
@@ -876,7 +876,7 @@ Factory_filter(Factory* self, PyObject* args)
 
        if(py_a)
        {
-               for(int i = 0; i < PySequence_Length(py_a); i++)
+               for(int i = 0; i < PySequence_Size(py_a); i++)
                {
                        py_value = PySequence_GetItem(py_a, i);
                        result = PyArg_Parse(py_value, "f:filter", &value);
index 7bf7f06f98964adbb5bd248566a52e29fd7eb667..9e4aa88354d40b7a53cf27739d2d310415d0aa4c 100644 (file)
@@ -261,7 +261,7 @@ static int idp_sequence_type(PyObject *seq)
        PyObject *item;
        int type= IDP_INT;
 
-       int i, len = PySequence_Length(seq);
+       int i, len = PySequence_Size(seq);
        for (i=0; i < len; i++) {
                item = PySequence_GetItem(seq, i);
                if (PyFloat_Check(item)) {
@@ -331,7 +331,7 @@ const char *BPy_IDProperty_Map_ValidateAndCreate(const char *name, IDProperty *g
                we assume IDP_INT unless we hit a float
                number; then we assume it's */
 
-               val.array.len = PySequence_Length(ob);
+               val.array.len = PySequence_Size(ob);
 
                switch(val.array.type) {
                case IDP_DOUBLE:
index e72f2136ee52959fd4aa08985d8f2620aea0f383..3d525b08ecc11e8c4a09fe7852c9f18714a71eec 100644 (file)
@@ -207,7 +207,7 @@ static PyObject *Method_Buffer (PyObject *UNUSED(self), PyObject *args)
                ndimensions= 1;
                dimensions[0]= PyLong_AsLong(length_ob);
        } else if (PySequence_Check(length_ob)) {
-               ndimensions= PySequence_Length(length_ob);
+               ndimensions= PySequence_Size(length_ob);
                if (ndimensions > MAX_DIMENSIONS) {
                        PyErr_SetString(PyExc_AttributeError, "too many dimensions, max is 256");
                        return NULL;
@@ -360,8 +360,8 @@ static int Buffer_ass_slice(PyObject *self, int begin, int end, PyObject *seq)
                return -1;
        }
 
-       if (PySequence_Length(seq)!=(end-begin)) {
-               int seq_len = PySequence_Length(seq);
+       if (PySequence_Size(seq)!=(end-begin)) {
+               int seq_len = PySequence_Size(seq);
                char err_str[128];
                sprintf(err_str, "size mismatch in assignment. Expected size: %d (size provided: %d)", seq_len, (end-begin));
                PyErr_SetString(PyExc_TypeError, err_str);
index 2208046e6c0dbae28827db83596536f7fd641299..d25bd12fdfdc60d5c4f20efa7d565e87e3bb1a2c 100644 (file)
@@ -844,7 +844,7 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end,
        CLAMP(end, 0, self->size);
        begin = MIN2(begin,end);
 
-       size = PySequence_Length(seq);
+       size = PySequence_Size(seq);
        if(size != (end - begin)){
                PyErr_SetString(PyExc_TypeError, "vector[begin:end] = []: size mismatch in slice assignment");
                return -1;
index dd3a49ad8b194465419c35b2cb0a3c89ab89060c..bdd1f0575bddef1e8d79d8e0a5db10126a8aa6c8 100644 (file)
@@ -552,7 +552,7 @@ static EnumPropertyItem *enum_items_from_py(PyObject *value, PyObject *def, int
                return NULL;
        }
 
-       seq_len= PySequence_Length(value);
+       seq_len= PySequence_Size(value);
 
        if(is_enum_flag) {
                if(seq_len > RNA_ENUM_BITFLAG_SIZE) {
index 663c82e07adfcdbe7b50d36eeb40b40fb09afb13..c0c4227b4660b9e84204e53a7c3d98a1f6ca5834 100644 (file)
@@ -1250,7 +1250,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
                                return -1;
                        }
 
-                       seq_len = PySequence_Length(value);
+                       seq_len = PySequence_Size(value);
                        for(i=0; i<seq_len; i++) {
                                item= PySequence_GetItem(value, i);
 
@@ -3279,7 +3279,7 @@ static int foreach_parse_args(
                return -1;
        }
 
-       *tot= PySequence_Length(*seq); // TODO - buffer may not be a sequence! array.array() is tho.
+       *tot= PySequence_Size(*seq); // TODO - buffer may not be a sequence! array.array() is tho.
 
        if(*tot>0) {
                foreach_attr_type(self, *attr, raw_type, attr_tot, attr_signed);
index 8e815e34cbc0c1aedfedf6aff87e06fbd241805f..a0dbc2d5ff24a6a0b7c8a65f463dec8e817b6db1 100644 (file)
@@ -57,7 +57,7 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
        if (dim + 1 < totdim) {
                /* check that a sequence contains dimsize[dim] items */
 
-               for (i= 0; i < PySequence_Length(seq); i++) {
+               for (i= 0; i < PySequence_Size(seq); i++) {
                        PyObject *item;
                        int ok= 1;
                        item= PySequence_GetItem(seq, i);
@@ -72,7 +72,7 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
                           dimsize[2]=5
                   
                           dim=0 */
-                       else if (PySequence_Length(item) != dimsize[dim + 1]) {
+                       else if (PySequence_Size(item) != dimsize[dim + 1]) {
                                /* BLI_snprintf(error_str, error_str_size, "sequences of dimension %d should contain %d items", (int)dim + 1, (int)dimsize[dim + 1]); */
                                PyErr_Format(PyExc_ValueError, "%s sequences of dimension %d should contain %d items", error_prefix, (int)dim + 1, (int)dimsize[dim + 1]);
                                ok= 0;
@@ -89,7 +89,7 @@ static int validate_array_type(PyObject *seq, int dim, int totdim, int dimsize[]
        }
        else {
                /* check that items are of correct type */
-               for (i= 0; i < PySequence_Length(seq); i++) {
+               for (i= 0; i < PySequence_Size(seq); i++) {
                        PyObject *item= PySequence_GetItem(seq, i);
 
                        if (!check_item_type(item)) {
@@ -114,7 +114,7 @@ static int count_items(PyObject *seq)
 
        if (PySequence_Check(seq)) {
                int i;
-               for (i= 0; i < PySequence_Length(seq); i++) {
+               for (i= 0; i < PySequence_Size(seq); i++) {
                        PyObject *item= PySequence_GetItem(seq, i);
                        totitem += count_items(item);
                        Py_DECREF(item);
@@ -211,7 +211,7 @@ static char *copy_values(PyObject *seq, PointerRNA *ptr, PropertyRNA *prop, int
        unsigned int i;
        int totdim= RNA_property_array_dimension(ptr, prop, NULL);
 
-       for (i= 0; i < PySequence_Length(seq); i++) {
+       for (i= 0; i < PySequence_Size(seq); i++) {
                PyObject *item= PySequence_GetItem(seq, i);
 
                if (dim + 1 < totdim) {
index 2a624b2ccaac3edb2f391465943a4b9b66394c0b..73b104d4585282b541e55531c4c5937fb0712387 100644 (file)
@@ -80,7 +80,7 @@ static PyObject * getColor (PyFilter * self, void * closure)
 static int setColor (PyFilter * self, PyObject * value, void * closure)
 {
        // check validity of parameter
-       if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 3
+       if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 3
                || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
                || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1))
                || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 2)))
@@ -107,7 +107,7 @@ static PyObject * getLimits (PyFilter * self, void * closure)
 static int setLimits (PyFilter * self, PyObject * value, void * closure)
 {
        // check validity of parameter
-       if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
+       if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
                || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
                || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
        {
index e5d479747c469d0323b906102bfc6ecf74cf034f..7bbbc86e35f6140ca9f5cfabc09d1f69f4d1fb3e 100644 (file)
@@ -129,14 +129,14 @@ static int setMatrix (PyFilter * self, PyObject * value, void * closure)
        ColorMatrix mat;
        // check validity of parameter
        bool valid = value != NULL && PySequence_Check(value)
-               && PySequence_Length(value) == 4;
+               && PySequence_Size(value) == 4;
        // check rows
        for (int r = 0; valid && r < 4; ++r)
        {
                // get row object
                PyObject * row = PySequence_Fast_GET_ITEM(value, r);
                // check sequence
-               valid = PySequence_Check(row) && PySequence_Length(row) == 5;
+               valid = PySequence_Check(row) && PySequence_Size(row) == 5;
                // check items
                for (int c = 0; valid && c < 5; ++c)
                {
@@ -262,14 +262,14 @@ static int setLevels (PyFilter * self, PyObject * value, void * closure)
        ColorLevel lev;
        // check validity of parameter
        bool valid = value != NULL && PySequence_Check(value)
-               && PySequence_Length(value) == 4;
+               && PySequence_Size(value) == 4;
        // check rows
        for (int r = 0; valid && r < 4; ++r)
        {
                // get row object
                PyObject * row = PySequence_Fast_GET_ITEM(value, r);
                // check sequence
-               valid = PySequence_Check(row) && PySequence_Length(row) == 2;
+               valid = PySequence_Check(row) && PySequence_Size(row) == 2;
                // check items
                for (int c = 0; valid && c < 2; ++c)
                {
index 0aba4be1121b391f17a035e3675173746ce9837e..2325329d55b962a67b98967dada11566df869bf1 100644 (file)
@@ -336,7 +336,7 @@ PyObject * getBackground (PyImage * self, void * closure)
 static int setBackground (PyImage * self, PyObject * value, void * closure)
 {
        // check validity of parameter
-       if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 4
+       if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 4
                || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
                || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1))
                || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 2))
index 5a4e8af1b0c130d4508f29dcc50f45ac1dfb6cce..50f5244138a6b4e8a1bc192f01c04370826c7077 100644 (file)
@@ -225,7 +225,7 @@ static PyObject * ImageViewport_getPosition (PyImage * self, void * closure)
 static int ImageViewport_setPosition (PyImage * self, PyObject * value, void * closure)
 {
        // check validity of parameter
-       if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
+       if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
                || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
                || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
        {
@@ -253,7 +253,7 @@ PyObject * ImageViewport_getCaptureSize (PyImage * self, void * closure)
 int ImageViewport_setCaptureSize (PyImage * self, PyObject * value, void * closure)
 {
        // check validity of parameter
-       if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
+       if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
                || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 0))
                || !PyLong_Check(PySequence_Fast_GET_ITEM(value, 1)))
        {
index 322ede7004d6bab07b41ce327337a72bbc0b0cd3..bd620309926d39cb3daf4084dc1f851b07991fd2 100644 (file)
@@ -147,7 +147,7 @@ PyObject * Video_getRange (PyImage * self, void * closure)
 int Video_setRange (PyImage * self, PyObject * value, void * closure)
 {
        // check validity of parameter
-       if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
+       if (value == NULL || !PySequence_Check(value) || PySequence_Size(value) != 2
                || !PyFloat_Check(PySequence_Fast_GET_ITEM(value, 0))
                || !PyFloat_Check(PySequence_Fast_GET_ITEM(value, 1)))
        {