[Bf-blender-cvs] [2a6df7dfe5a] master: Cleanup: use named unsigned types in the Python API

Campbell Barton noreply at git.blender.org
Thu Feb 20 05:40:49 CET 2020


Commit: 2a6df7dfe5ae9c25780166771c56ff921cc90f63
Author: Campbell Barton
Date:   Thu Feb 20 15:38:58 2020 +1100
Branches: master
https://developer.blender.org/rB2a6df7dfe5ae9c25780166771c56ff921cc90f63

Cleanup: use named unsigned types in the Python API

===================================================================

M	source/blender/python/bmesh/bmesh_py_ops.c
M	source/blender/python/bmesh/bmesh_py_ops_call.c
M	source/blender/python/bmesh/bmesh_py_types.c
M	source/blender/python/bmesh/bmesh_py_types.h
M	source/blender/python/bmesh/bmesh_py_types_meshdata.c
M	source/blender/python/generic/bgl.c
M	source/blender/python/generic/blf_py_api.c
M	source/blender/python/generic/py_capi_utils.c
M	source/blender/python/gpu/gpu_py_select.c
M	source/blender/python/intern/bpy_app.c
M	source/blender/python/intern/bpy_app_translations.c
M	source/blender/python/intern/bpy_interface.c
M	source/blender/python/intern/bpy_intern_string.c
M	source/blender/python/intern/bpy_rna.c
M	source/blender/python/intern/bpy_rna.h
M	source/blender/python/intern/bpy_rna_array.c
M	source/blender/python/intern/bpy_rna_id_collection.c
M	source/blender/python/mathutils/mathutils.c
M	source/blender/python/mathutils/mathutils_Color.c
M	source/blender/python/mathutils/mathutils_Euler.c
M	source/blender/python/mathutils/mathutils_Matrix.c
M	source/blender/python/mathutils/mathutils_Matrix.h
M	source/blender/python/mathutils/mathutils_Quaternion.c
M	source/blender/python/mathutils/mathutils_Vector.c
M	source/blender/python/mathutils/mathutils_bvhtree.c
M	source/blender/python/mathutils/mathutils_geometry.c
M	source/blender/python/mathutils/mathutils_kdtree.c
M	source/blender/python/mathutils/mathutils_noise.c

===================================================================

diff --git a/source/blender/python/bmesh/bmesh_py_ops.c b/source/blender/python/bmesh/bmesh_py_ops.c
index a3bfe791c88..4708736ca27 100644
--- a/source/blender/python/bmesh/bmesh_py_ops.c
+++ b/source/blender/python/bmesh/bmesh_py_ops.c
@@ -259,8 +259,8 @@ static PyObject *bpy_bmesh_ops_fakemod_getattro(PyObject *UNUSED(self), PyObject
 
 static PyObject *bpy_bmesh_ops_fakemod_dir(PyObject *UNUSED(self))
 {
-  const unsigned int tot = bmo_opdefines_total;
-  unsigned int i;
+  const uint tot = bmo_opdefines_total;
+  uint i;
   PyObject *ret;
 
   ret = PyList_New(bmo_opdefines_total);
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c
index f9196f7f100..f44fa2aeac3 100644
--- a/source/blender/python/bmesh/bmesh_py_ops_call.c
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.c
@@ -337,7 +337,7 @@ static int bpy_slot_from_py(BMesh *bm,
           BMIter iter;
           BMHeader *ele;
           int tot;
-          unsigned int i;
+          uint i;
 
           if (bpy_slot_from_py_elemseq_check(
                   (BPy_BMGeneric *)value,
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index ebfce204456..12ae18a5bf5 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -2680,12 +2680,12 @@ static PyObject *bpy_bmelemseq_sort(BPy_BMElemSeq *self, PyObject *args, PyObjec
 
   double *keys;
   int *elem_idx;
-  unsigned int *elem_map_idx;
+  uint *elem_map_idx;
   int (*elem_idx_compare_by_keys)(const void *, const void *, void *);
 
-  unsigned int *vert_idx = NULL;
-  unsigned int *edge_idx = NULL;
-  unsigned int *face_idx = NULL;
+  uint *vert_idx = NULL;
+  uint *edge_idx = NULL;
+  uint *face_idx = NULL;
   int i;
 
   BMesh *bm = self->bm;
@@ -4065,7 +4065,7 @@ int bpy_bm_generic_valid_check(BPy_BMGeneric *self)
 int bpy_bm_generic_valid_check_source(BMesh *bm_source,
                                       const char *error_prefix,
                                       void **args,
-                                      unsigned int args_tot)
+                                      uint args_tot)
 {
   int ret = 0;
 
diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h
index c61fdeab4b0..74bfbcec3c7 100644
--- a/source/blender/python/bmesh/bmesh_py_types.h
+++ b/source/blender/python/bmesh/bmesh_py_types.h
@@ -177,7 +177,7 @@ int bpy_bm_generic_valid_check(BPy_BMGeneric *self);
 int bpy_bm_generic_valid_check_source(BMesh *bm_source,
                                       const char *error_prefix,
                                       void **args,
-                                      unsigned int args_n) ATTR_NONNULL(1, 2);
+                                      uint args_n) ATTR_NONNULL(1, 2);
 
 #define BPY_BM_CHECK_OBJ(obj) \
   if (UNLIKELY(bpy_bm_generic_valid_check((BPy_BMGeneric *)obj) == -1)) { \
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index 08d934251af..7cecc844f9a 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -284,15 +284,15 @@ PyObject *BPy_BMVertSkin_CreatePyObject(struct MVertSkin *mvertskin)
 
 static void mloopcol_to_float(const MLoopCol *mloopcol, float r_col[3])
 {
-  rgba_uchar_to_float(r_col, (const unsigned char *)&mloopcol->r);
+  rgba_uchar_to_float(r_col, (const uchar *)&mloopcol->r);
 }
 
 static void mloopcol_from_float(MLoopCol *mloopcol, const float col[3])
 {
-  rgba_float_to_uchar((unsigned char *)&mloopcol->r, col);
+  rgba_float_to_uchar((uchar *)&mloopcol->r, col);
 }
 
-static unsigned char mathutils_bmloopcol_cb_index = -1;
+static uchar mathutils_bmloopcol_cb_index = -1;
 
 static int mathutils_bmloopcol_check(BaseMathObject *UNUSED(bmo))
 {
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 3f8ec826cc3..5471fc25f37 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -167,19 +167,19 @@ typedef struct BufferOrOffset {
  * so we use signed everything (even stuff that should be unsigned.
  */
 
-/* typedef unsigned int GLenum; */
+/* typedef uint GLenum; */
 #define GLenum_str "i"
 #define GLenum_var(num) bgl_var##num
 #define GLenum_ref(num) &bgl_var##num
 #define GLenum_def(num) /* unsigned */ int GLenum_var(num)
 
-/* typedef unsigned int GLboolean; */
+/* typedef uint GLboolean; */
 #define GLboolean_str "b"
 #define GLboolean_var(num) bgl_var##num
 #define GLboolean_ref(num) &bgl_var##num
 #define GLboolean_def(num) /* unsigned */ char GLboolean_var(num)
 
-/* typedef unsigned int GLbitfield; */
+/* typedef uint GLbitfield; */
 #define GLbitfield_str "i"
 #define GLbitfield_var(num) bgl_var##num
 #define GLbitfield_ref(num) &bgl_var##num
@@ -223,27 +223,27 @@ typedef struct BufferOrOffset {
 #define GLintptr_ref(num) &bgl_var##num
 #define GLintptr_def(num) size_t GLintptr_var(num)
 
-/* typedef unsigned char GLubyte; */
+/* typedef uchar GLubyte; */
 #define GLubyte_str "B"
 #define GLubyte_var(num) bgl_var##num
 #define GLubyte_ref(num) &bgl_var##num
 #define GLubyte_def(num) /* unsigned */ char GLubyte_var(num)
 
 #if 0
-/* typedef unsigned short GLushort; */
+/* typedef ushort GLushort; */
 #  define GLushort_str "H"
 #  define GLushort_var(num) bgl_var##num
 #  define GLushort_ref(num) &bgl_var##num
 #  define GLushort_def(num) /* unsigned */ short GLushort_var(num)
 #endif
 
-/* typedef unsigned int GLuint; */
+/* typedef uint GLuint; */
 #define GLuint_str "I"
 #define GLuint_var(num) bgl_var##num
 #define GLuint_ref(num) &bgl_var##num
 #define GLuint_def(num) /* unsigned */ int GLuint_var(num)
 
-/* typedef unsigned int GLuint64; */
+/* typedef uint GLuint64; */
 #if 0
 #  define GLuint64_str "Q"
 #  define GLuint64_var(num) bgl_var##num
@@ -251,7 +251,7 @@ typedef struct BufferOrOffset {
 #  define GLuint64_def(num) /* unsigned */ int GLuint64_var(num)
 #endif
 
-/* typedef unsigned int GLsync; */
+/* typedef uint GLsync; */
 #if 0
 #  define GLsync_str "I"
 #  define GLsync_var(num) bgl_var##num
@@ -384,7 +384,7 @@ typedef struct BufferOrOffset {
 #define ret_set_GLint ret_int =
 #define ret_ret_GLint return PyLong_FromLong(ret_int)
 
-#define ret_def_GLuint unsigned int ret_uint
+#define ret_def_GLuint uint ret_uint
 #define ret_set_GLuint ret_uint =
 #define ret_ret_GLuint return PyLong_FromLong((long)ret_uint)
 
@@ -395,20 +395,20 @@ typedef struct BufferOrOffset {
 #endif
 
 #if 0
-#  define ret_def_GLsync unsigned int ret_sync
+#  define ret_def_GLsync uint ret_sync
 #  define ret_set_GLsync ret_sync =
 #  define ret_ret_GLsync return PyLong_FromLong((long)ret_sync)
 #endif
 
-#define ret_def_GLenum unsigned int ret_uint
+#define ret_def_GLenum uint ret_uint
 #define ret_set_GLenum ret_uint =
 #define ret_ret_GLenum return PyLong_FromLong((long)ret_uint)
 
-#define ret_def_GLboolean unsigned char ret_bool
+#define ret_def_GLboolean uchar ret_bool
 #define ret_set_GLboolean ret_bool =
 #define ret_ret_GLboolean return PyLong_FromLong((long)ret_bool)
 
-#define ret_def_GLstring const unsigned char *ret_str
+#define ret_def_GLstring const uchar *ret_str
 #define ret_set_GLstring ret_str =
 
 #define ret_ret_GLstring \
@@ -2612,7 +2612,7 @@ PyObject *BPyInit_bgl(void)
 
 static PyObject *Method_ShaderSource(PyObject *UNUSED(self), PyObject *args)
 {
-  unsigned int shader;
+  uint shader;
   const char *source;
 
   if (!PyArg_ParseTuple(args, "Is", &shader, &source)) {
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index 62f5a568ee1..269ff3b5d69 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -186,7 +186,7 @@ static PyObject *py_blf_draw(PyObject *UNUSED(self), PyObject *args)
     return NULL;
   }
 
-  BLF_draw(fontid, text, (unsigned int)text_length);
+  BLF_draw(fontid, text, (uint)text_length);
 
   Py_RETURN_NONE;
 }
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
index 8ea627589f2..35fff8699d1 100644
--- a/source/blender/python/generic/py_capi_utils.c
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -198,8 +198,8 @@ PyObject *PyC_Tuple_PackArray_Bool(const bool *array, uint len)
  */
 void PyC_Tuple_Fill(PyObject *tuple, PyObject *value)
 {
-  unsigned int tot = PyTuple_GET_SIZE(tuple);
-  unsigned int i;
+  uint tot = PyTuple_GET_SIZE(tuple);
+  uint i;
 
   for (i = 0; i < tot; i++) {
     PyTuple_SET_ITEM(tuple, i, value);
@@ -209,8 +209,8 @@ void PyC_Tuple_Fill(PyObject *tuple, PyObject *value)
 
 void PyC_List_Fill(PyObject *list, PyObject *value)
 {
-  unsigned int tot = PyList_GET_SIZE(list);
-  unsigned int i;
+  uint tot = PyList_GET_SIZE(list);
+  uint i;
 
   for (i = 0; i < tot; i++) {
     PyList_SET_ITEM(list, i, value);
diff --git a/source/blender/python/gpu/gpu_py_select.c b/source/blender/python/gpu/gpu_py_select.c
index 21832b58015..b0b0e16f139 100644
--- a/source/blender/python/gpu/gpu_py_select.c
+++ b/source/blender/python/gpu/gpu_py_select.c
@@ -45,7 +45,7 @@ PyDoc_STRVAR(bpygpu_select_load_id_doc,
              "\n"
              "   Set the selection ID.\n"
              "\n"
-             "   :param id: Number (32-bit unsigned int).\n"
+             "   :param id: Number (32-bit uint).\n"
              "   :type select: int\n");
 static PyObject *bpygpu_select_load_id(PyObject *UNUSED(self), PyObject *value)
 {
diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index b6784f2cdc2..9b7842460b5 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -66,7 +66,7 @@
 #ifdef BUILD_DATE
 extern char build_date[];
 extern char build_time[];
-extern unsigned long build_commit_timestamp;
+extern ulong build_commit_timestamp;
 extern char build_commit_date[];
 extern char build_commit_time[];
 extern char build_hash[];
diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c
in

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list