[Bf-blender-cvs] [c5cb42f] master: Code Cleanup: use bool for bmesh operator boolean mapping functions

Campbell Barton noreply at git.blender.org
Fri Jan 3 11:36:17 CET 2014


Commit: c5cb42f40285fca072e8378bdadf11c674b90340
Author: Campbell Barton
Date:   Fri Jan 3 21:35:29 2014 +1100
https://developer.blender.org/rBc5cb42f40285fca072e8378bdadf11c674b90340

Code Cleanup: use bool for bmesh operator boolean mapping functions

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

M	source/blender/bmesh/intern/bmesh_operator_api_inline.h
M	source/blender/bmesh/intern/bmesh_operators.c
M	source/blender/python/bmesh/bmesh_py_ops_call.c

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

diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.h b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
index 77310d9..2b78b77 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api_inline.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
@@ -78,11 +78,10 @@ BLI_INLINE void BMO_slot_map_int_insert(BMOperator *op, BMOpSlot *slot,
 }
 
 BLI_INLINE void BMO_slot_map_bool_insert(BMOperator *op, BMOpSlot *slot,
-                                        void *element, const int val)
+                                        void *element, const bool val)
 {
-	union { void *ptr; int val; } t = {NULL};
+	union { void *ptr; bool val; } t = {NULL};
 	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_BOOL);
-	BLI_assert(val == false || val == true);
 	BMO_slot_map_insert(op, slot, element, ((t.val = val), t.ptr));
 }
 
@@ -170,7 +169,7 @@ BLI_INLINE bool BMO_slot_map_bool_get(BMOpSlot *slot, const void *element)
 
 	data = BMO_slot_map_data_get(slot, element);
 	if (data) {
-		return **(int **)data;
+		return **(bool **)data;
 	}
 	else {
 		return false;
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index b443970..3dca80c 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -1466,7 +1466,7 @@ int BMO_iter_map_value_int(BMOIter *iter)
 bool BMO_iter_map_value_bool(BMOIter *iter)
 {
 	BLI_assert(iter->slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_BOOL);
-	return **((int **)iter->val);
+	return **((bool **)iter->val);
 }
 
 /* error system */
diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.c b/source/blender/python/bmesh/bmesh_py_ops_call.c
index ec9f286..5b3eabe 100644
--- a/source/blender/python/bmesh/bmesh_py_ops_call.c
+++ b/source/blender/python/bmesh/bmesh_py_ops_call.c
@@ -639,7 +639,7 @@ static PyObject *bpy_slot_to_py(BMesh *bm, BMOpSlot *slot)
 							void     *ele_val = BLI_ghashIterator_getValue(&hash_iter);
 
 							PyObject *py_key =  BPy_BMElem_CreatePyObject(bm,  ele_key);
-							PyObject *py_val =  PyBool_FromLong(*(int *)&ele_val);
+							PyObject *py_val =  PyBool_FromLong(*(bool *)&ele_val);
 
 							PyDict_SetItem(item, py_key, py_val);
 							Py_DECREF(py_key);




More information about the Bf-blender-cvs mailing list