diff --git a/source/blender/blenkernel/intern/layer.cc b/source/blender/blenkernel/intern/layer.cc index c1c6d7dc74d..498b0628a2c 100644 --- a/source/blender/blenkernel/intern/layer.cc +++ b/source/blender/blenkernel/intern/layer.cc @@ -78,7 +78,7 @@ static LayerCollection *layer_collection_add(ListBase *lb_parent, Collection *co { LayerCollection *lc = MEM_callocN("Collection Base"); lc->collection = collection; - lc->local_collections_bits = ~(0); + lc->local_collections_bits = ~0; BLI_addtail(lb_parent, lc); return lc; @@ -101,7 +101,7 @@ static Base *object_base_new(Object *ob) { Base *base = MEM_callocN("Object Base"); base->object = ob; - base->local_view_bits = ~(0); + base->local_view_bits = ~0; if (ob->base_flag & BASE_SELECTED) { base->flag |= BASE_SELECTED; } @@ -1378,7 +1378,7 @@ void BKE_layer_collection_sync(const Scene *scene, ViewLayer *view_layer) parent_exclude, parent_restrict, parent_layer_restrict, - ~(0)); + ~0); layer_collection_resync_unused_layers_free(view_layer, master_layer_resync); BLI_mempool_destroy(layer_resync_mempool); diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index c7ded3a57e2..31104a93b6c 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -1421,23 +1421,23 @@ typedef struct bNodeSocketValueString_404 { } bNodeSocketValueString_404; typedef struct bNodeSocketValueObject_404 { - struct Object *value; + Object *value; } bNodeSocketValueObject_404; typedef struct bNodeSocketValueImage_404 { - struct Image *value; + Image *value; } bNodeSocketValueImage_404; typedef struct bNodeSocketValueCollection_404 { - struct Collection *value; + Collection *value; } bNodeSocketValueCollection_404; typedef struct bNodeSocketValueTexture_404 { - struct Tex *value; + Tex *value; } bNodeSocketValueTexture_404; typedef struct bNodeSocketValueMaterial_404 { - struct Material *value; + Material *value; } bNodeSocketValueMaterial_404; typedef struct bNodeSocketValueMenu_404 { @@ -1609,7 +1609,7 @@ static void direct_link_node_socket_default_value(BlendDataReader *reader, bNode [](bNodeSocketValueString &dest, versioning_internal::bNodeSocketValueString_404 &src) { dest.subtype = src.subtype; - BLI_strncpy(dest.value, src.value, sizeof(dest.value)); + STRNCPY(dest.value, src.value); }); break; case SOCK_OBJECT: diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc index 67867b91c81..a8b8945f504 100644 --- a/source/blender/blenkernel/intern/paint.cc +++ b/source/blender/blenkernel/intern/paint.cc @@ -303,7 +303,7 @@ void BKE_paint_set_overlay_override(eOverlayFlags flags) } } else { - overlay_flags &= ~(PAINT_OVERRIDE_MASK); + overlay_flags &= ~PAINT_OVERRIDE_MASK; } } diff --git a/source/blender/blenkernel/intern/particle_system.cc b/source/blender/blenkernel/intern/particle_system.cc index 3d4cdfedcdb..69cce07f3ac 100644 --- a/source/blender/blenkernel/intern/particle_system.cc +++ b/source/blender/blenkernel/intern/particle_system.cc @@ -2820,7 +2820,7 @@ static int collision_detect(ParticleData *pa, BVHTreeRayHit *hit, ListBase *colliders) { - const int raycast_flag = BVH_RAYCAST_DEFAULT & ~(BVH_RAYCAST_WATERTIGHT); + const int raycast_flag = BVH_RAYCAST_DEFAULT & ~BVH_RAYCAST_WATERTIGHT; float ray_dir[3]; if (BLI_listbase_is_empty(colliders)) { diff --git a/source/blender/blenloader/intern/versioning_280.cc b/source/blender/blenloader/intern/versioning_280.cc index a5a884b3c23..40dc4591ddf 100644 --- a/source/blender/blenloader/intern/versioning_280.cc +++ b/source/blender/blenloader/intern/versioning_280.cc @@ -737,7 +737,7 @@ static void do_versions_material_convert_legacy_blend_mode(bNodeTree *ntree, cha static void do_versions_local_collection_bits_set(LayerCollection *layer_collection) { - layer_collection->local_collections_bits = ~(0); + layer_collection->local_collections_bits = ~0; LISTBASE_FOREACH (LayerCollection *, child, &layer_collection->layer_collections) { do_versions_local_collection_bits_set(child); } @@ -3023,7 +3023,7 @@ static bool strip_update_flags_cb(Strip *strip, void * /*user_data*/) strip->flag &= ~((1 << 6) | (1 << 18) | (1 << 19) | (1 << 21)); if (strip->type == STRIP_TYPE_SPEED) { SpeedControlVars *s = (SpeedControlVars *)strip->effectdata; - s->flags &= ~(SEQ_SPEED_UNUSED_1); + s->flags &= ~SEQ_SPEED_UNUSED_1; } return true; } @@ -4592,7 +4592,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain) SpaceOutliner *space_outliner = (SpaceOutliner *)sl; space_outliner->filter &= ~(SO_FILTER_CLEARED_1 | SO_FILTER_UNUSED_5 | SO_FILTER_OB_STATE_SELECTABLE); - space_outliner->storeflag &= ~(SO_TREESTORE_UNUSED_1); + space_outliner->storeflag &= ~SO_TREESTORE_UNUSED_1; break; } case SPACE_FILE: { @@ -5314,7 +5314,7 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain) } LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) { - arm->flag &= ~(ARM_BCOLL_SOLO_ACTIVE); + arm->flag &= ~ARM_BCOLL_SOLO_ACTIVE; } } diff --git a/source/blender/blenloader/intern/versioning_290.cc b/source/blender/blenloader/intern/versioning_290.cc index a2e6914396b..35ecdca99b4 100644 --- a/source/blender/blenloader/intern/versioning_290.cc +++ b/source/blender/blenloader/intern/versioning_290.cc @@ -1391,7 +1391,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain) switch (sl->spacetype) { case SPACE_IMAGE: { SpaceImage *sima = (SpaceImage *)sl; - sima->flag &= ~(SI_FLAG_UNUSED_20); + sima->flag &= ~SI_FLAG_UNUSED_20; break; } } diff --git a/source/blender/blenloader/intern/versioning_userdef.cc b/source/blender/blenloader/intern/versioning_userdef.cc index ae50d11c74c..0f3fbb83c2a 100644 --- a/source/blender/blenloader/intern/versioning_userdef.cc +++ b/source/blender/blenloader/intern/versioning_userdef.cc @@ -878,7 +878,7 @@ void blo_do_versions_userdef(UserDef *userdef) userdef->flag &= ~(USER_FLAG_NUMINPUT_ADVANCED | (1 << 2) | USER_FLAG_UNUSED_3 | USER_FLAG_UNUSED_6 | USER_FLAG_UNUSED_7 | USER_INTERNET_ALLOW | USER_DEVELOPER_UI); - userdef->uiflag &= ~(USER_HEADER_BOTTOM); + userdef->uiflag &= ~USER_HEADER_BOTTOM; userdef->transopts &= ~(USER_TR_UNUSED_3 | USER_TR_UNUSED_4 | USER_TR_UNUSED_6 | USER_TR_UNUSED_7); @@ -966,7 +966,7 @@ void blo_do_versions_userdef(UserDef *userdef) copy_v3_fl3(userdef->light_ambient, 0.025000, 0.025000, 0.025000); - userdef->flag &= ~(USER_FLAG_UNUSED_4); + userdef->flag &= ~USER_FLAG_UNUSED_4; userdef->uiflag &= ~(USER_HEADER_FROM_PREF | USER_REGISTER_ALL_USERS); } @@ -979,8 +979,8 @@ void blo_do_versions_userdef(UserDef *userdef) if (!USER_VERSION_ATLEAST(280, 44)) { userdef->uiflag &= ~(USER_NO_MULTITOUCH_GESTURES | USER_UIFLAG_UNUSED_1); - userdef->uiflag2 &= ~(USER_UIFLAG2_UNUSED_0); - userdef->gp_settings &= ~(GP_PAINT_UNUSED_0); + userdef->uiflag2 &= ~USER_UIFLAG2_UNUSED_0; + userdef->gp_settings &= ~GP_PAINT_UNUSED_0; } if (!USER_VERSION_ATLEAST(280, 50)) { diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.cc b/source/blender/editors/sculpt_paint/sculpt_cloth.cc index 41eddf60adb..0e02839bd3d 100644 --- a/source/blender/editors/sculpt_paint/sculpt_cloth.cc +++ b/source/blender/editors/sculpt_paint/sculpt_cloth.cc @@ -1152,7 +1152,7 @@ static void cloth_brush_solve_collision(const Object &object, SimulationData &cloth_sim, const int i) { - const int raycast_flag = BVH_RAYCAST_DEFAULT & ~(BVH_RAYCAST_WATERTIGHT); + const int raycast_flag = BVH_RAYCAST_DEFAULT & ~BVH_RAYCAST_WATERTIGHT; const float4x4 &object_to_world = object.object_to_world(); const float4x4 &world_to_object = object.world_to_object(); diff --git a/source/blender/editors/space_image/space_image.cc b/source/blender/editors/space_image/space_image.cc index dcc5c486675..e27481456b7 100644 --- a/source/blender/editors/space_image/space_image.cc +++ b/source/blender/editors/space_image/space_image.cc @@ -641,14 +641,14 @@ static void image_main_region_draw(const bContext *C, ARegion *region) const bool show_compositor_viewer = show_viewer && image->type == IMA_TYPE_COMPOSITE; /* Text info and render region are only relevant for the compositor. */ - const bool show_text_info = (sima->overlay.flag & SI_OVERLAY_SHOW_OVERLAYS && + const bool show_text_info = show_compositor_viewer && + (sima->overlay.flag & SI_OVERLAY_SHOW_OVERLAYS && sima->overlay.flag & SI_OVERLAY_DRAW_TEXT_INFO && - (sima->mode == SI_MODE_MASK || sima->mode == SI_MODE_VIEW)) && - show_compositor_viewer; - const bool show_render_region = (sima->overlay.flag & SI_OVERLAY_SHOW_OVERLAYS && + ELEM(sima->mode, SI_MODE_MASK, SI_MODE_VIEW)); + const bool show_render_region = show_compositor_viewer && + (sima->overlay.flag & SI_OVERLAY_SHOW_OVERLAYS && sima->overlay.flag & SI_OVERLAY_DRAW_RENDER_REGION && - (sima->mode == SI_MODE_MASK || sima->mode == SI_MODE_VIEW)) && - show_compositor_viewer; + ELEM(sima->mode, SI_MODE_MASK, SI_MODE_VIEW)); /* XXX not supported yet, disabling for now */ scene->r.scemode &= ~R_COMP_CROP; diff --git a/source/blender/editors/space_sequencer/sequencer_select.cc b/source/blender/editors/space_sequencer/sequencer_select.cc index a2a6c93a394..32e351b82ec 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.cc +++ b/source/blender/editors/space_sequencer/sequencer_select.cc @@ -255,7 +255,7 @@ static void select_linked_time_strip(const Scene *scene, if (left_match && right_match) { /* Direct match, copy all selection settings. */ - strip_dest->flag &= ~(STRIP_ALLSEL); + strip_dest->flag &= ~STRIP_ALLSEL; strip_dest->flag |= strip_source->flag & (STRIP_ALLSEL); recurs_sel_strip(strip_dest); } @@ -874,7 +874,7 @@ static void sequencer_select_connected_strips(const StripSelection &selection) blender::VectorSet connections = seq::connected_strips_get(source); for (Strip *connection : connections) { /* Copy selection settings exactly for connected strips. */ - connection->flag &= ~(STRIP_ALLSEL); + connection->flag &= ~STRIP_ALLSEL; connection->flag |= source->flag & (STRIP_ALLSEL); } } @@ -893,8 +893,8 @@ static void sequencer_copy_handles_to_selected_strips(const StripSelection &sele /* For left or right handle selection only, simply copy selection state. */ /* NOTE that this must be `ALLSEL` since `prev_selection` was deselected earlier. */ for (Strip *strip : prev_selection) { - strip->flag &= ~(STRIP_ALLSEL); - strip->flag |= source->flag & (STRIP_ALLSEL); + strip->flag &= ~STRIP_ALLSEL; + strip->flag |= source->flag & STRIP_ALLSEL; } } diff --git a/source/blender/editors/space_view3d/view3d_view.cc b/source/blender/editors/space_view3d/view3d_view.cc index 1804dc9c3d2..f32133f1185 100644 --- a/source/blender/editors/space_view3d/view3d_view.cc +++ b/source/blender/editors/space_view3d/view3d_view.cc @@ -1289,7 +1289,7 @@ bool ED_view3d_local_collections_set(const Main *bmain, View3D *v3d) void ED_view3d_local_collections_reset(const bContext *C, const bool reset_all) { Main *bmain = CTX_data_main(C); - uint local_view_bit = ~(0); + uint local_view_bit = ~0; bool do_reset = false; /* Reset only the ones that are not in use. */ @@ -1314,10 +1314,10 @@ void ED_view3d_local_collections_reset(const bContext *C, const bool reset_all) if (do_reset) { view3d_local_collections_reset(bmain, local_view_bit); } - else if (reset_all && (do_reset || (local_view_bit != ~(0)))) { - view3d_local_collections_reset(bmain, ~(0)); + else if (reset_all && (do_reset || (local_view_bit != ~0))) { + view3d_local_collections_reset(bmain, ~0); View3D v3d = {}; - v3d.local_collections_uid = ~(0); + v3d.local_collections_uid = ~0; BKE_layer_collection_local_sync(CTX_data_scene(C), CTX_data_view_layer(C), &v3d); DEG_id_tag_update(&CTX_data_scene(C)->id, ID_RECALC_BASE_FLAGS); } diff --git a/source/blender/io/fbx/importer/fbx_import_armature.cc b/source/blender/io/fbx/importer/fbx_import_armature.cc index c2e5e49a52d..2146aabbd29 100644 --- a/source/blender/io/fbx/importer/fbx_import_armature.cc +++ b/source/blender/io/fbx/importer/fbx_import_armature.cc @@ -281,7 +281,7 @@ static void find_fake_bones(const ufbx_node *root_node, { for (const ufbx_node *bone_node : bones) { const ufbx_node *node = bone_node->parent; - while (node != nullptr && node != root_node) { + while (!ELEM(node, nullptr, root_node)) { if (node->bone == nullptr) { r_fake_bones.add(node); }