From c5cb42f40285fca072e8378bdadf11c674b90340 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 3 Jan 2014 21:35:29 +1100 Subject: Code Cleanup: use bool for bmesh operator boolean mapping functions --- source/blender/bmesh/intern/bmesh_operator_api_inline.h | 7 +++---- source/blender/bmesh/intern/bmesh_operators.c | 2 +- source/blender/python/bmesh/bmesh_py_ops_call.c | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.h b/source/blender/bmesh/intern/bmesh_operator_api_inline.h index 77310d958e6..2b78b775723 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 b4439703c4a..3dca80ca38a 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 ec9f2865582..5b3eabe5ca4 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); -- cgit v1.2.3