From af93ebcb503293e382f74c2d33554504269d4815 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 16 Jan 2014 19:15:53 +1100 Subject: [PATCH] Code Cleanup: style and redundant casts --- .../blender/blenkernel/intern/suggestions.c | 2 +- source/blender/blenlib/intern/scanfill.c | 2 +- source/blender/blenlib/intern/storage.c | 2 +- source/blender/blenlib/intern/string.c | 6 ++--- source/blender/blenlib/intern/winstuff_dir.c | 6 ++++- .../bmesh/operators/bmo_smooth_laplacian.c | 2 +- source/blender/bmesh/tools/bmesh_bevel.c | 2 +- source/blender/compositor/intern/COM_Node.cpp | 2 +- .../editors/animation/keyframes_edit.c | 2 +- source/blender/editors/animation/keyframing.c | 4 ++-- .../editors/armature/armature_naming.c | 3 ++- source/blender/editors/armature/pose_lib.c | 2 +- source/blender/editors/interface/view2d.c | 12 +++++----- source/blender/editors/object/object_edit.c | 2 +- source/blender/editors/screen/screen_ops.c | 2 +- .../blender/editors/space_file/file_panels.c | 4 ++-- source/blender/editors/space_file/filelist.c | 24 +++++++++---------- .../blender/editors/space_graph/graph_draw.c | 2 +- .../editors/space_outliner/outliner_draw.c | 2 +- .../editors/space_outliner/outliner_edit.c | 4 ++-- .../editors/space_outliner/outliner_intern.h | 2 +- .../editors/space_outliner/outliner_tools.c | 2 +- .../editors/space_sequencer/sequencer_edit.c | 2 +- .../blender/editors/space_view3d/drawobject.c | 2 +- .../editors/space_view3d/view3d_draw.c | 6 +++-- .../editors/space_view3d/view3d_edit.c | 6 ++--- .../editors/transform/transform_constraints.c | 2 +- .../editors/transform/transform_generics.c | 2 +- source/blender/editors/uvedit/uvedit_ops.c | 2 +- source/blender/makesrna/intern/rna_object.c | 2 +- .../blender/makesrna/intern/rna_sequencer.c | 2 +- source/blender/modifiers/intern/MOD_mask.c | 6 ++--- .../nodes/composite/node_composite_tree.c | 2 +- .../blender/windowmanager/intern/wm_cursors.c | 2 +- .../windowmanager/intern/wm_dragdrop.c | 2 +- .../windowmanager/intern/wm_event_system.c | 6 ++--- .../windowmanager/intern/wm_operators.c | 18 +++++++++----- 37 files changed, 83 insertions(+), 70 deletions(-) diff --git a/source/blender/blenkernel/intern/suggestions.c b/source/blender/blenkernel/intern/suggestions.c index 6f9736df683..d46fa591885 100644 --- a/source/blender/blenkernel/intern/suggestions.c +++ b/source/blender/blenkernel/intern/suggestions.c @@ -52,7 +52,7 @@ static int txttl_cmp(const char *first, const char *second, int len) { int cmp, i; for (cmp = 0, i = 0; i < len; i++) { - if ( (cmp = toupper(first[i]) - toupper(second[i])) ) { + if ((cmp = toupper(first[i]) - toupper(second[i]))) { break; } } diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index c4cefadb815..d1eb72563a1 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -699,7 +699,7 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, PolyFill *pf, const int fl ed3 = sc1->edge_first; while (ed3) { - if ( (ed3->v1 == v1 && ed3->v2 == v3) || (ed3->v1 == v3 && ed3->v2 == v1) ) { + if ((ed3->v1 == v1 && ed3->v2 == v3) || (ed3->v1 == v3 && ed3->v2 == v1)) { if (twoconnected || ed3->f == SF_EDGE_BOUNDARY) { BLI_remlink((ListBase *)&(sc1->edge_first), ed3); BLI_addtail(&sf_ctx->filledgebase, ed3); diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 6f03529d37c..de40cab425d 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -486,7 +486,7 @@ int BLI_exists(const char *name) unsigned int old_error_mode; len = wcslen(tmp_16); - if (len > 3 && (tmp_16[len - 1] == L'\\' || tmp_16[len - 1] == L'/') ) + if (len > 3 && (tmp_16[len - 1] == L'\\' || tmp_16[len - 1] == L'/')) tmp_16[len - 1] = '\0'; /* change error mode so user does not get a "no disk in drive" popup diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 0ce40f717d4..6b738fab45e 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -513,17 +513,17 @@ int BLI_natstrcmp(const char *s1, const char *s2) c1 = tolower(s1[d1]); c2 = tolower(s2[d2]); - if (isdigit(c1) && isdigit(c2) ) { + if (isdigit(c1) && isdigit(c2)) { int numcompare = left_number_strcmp(s1 + d1, s2 + d2, &tiebreaker); if (numcompare != 0) return numcompare; d1++; - while (isdigit(s1[d1]) ) + while (isdigit(s1[d1])) d1++; d2++; - while (isdigit(s2[d2]) ) + while (isdigit(s2[d2])) d2++; c1 = tolower(s1[d1]); diff --git a/source/blender/blenlib/intern/winstuff_dir.c b/source/blender/blenlib/intern/winstuff_dir.c index 4082681ee11..90250de1683 100644 --- a/source/blender/blenlib/intern/winstuff_dir.c +++ b/source/blender/blenlib/intern/winstuff_dir.c @@ -21,12 +21,16 @@ * Windows-posix compatibility layer for opendir/readdir/closedir */ -/** \file blender/blenlib/intern/winstuff.c +/** \file blender/blenlib/intern/winstuff_dir.c * \ingroup bli + * + * Posix compatibility functions for windows dealing with DIR + * (opendir, readdir, closedir) */ #if defined(WIN32) && !defined(FREE_WINDOWS) +/* standalone for inclusion in binaries other then blender */ # ifdef USE_STANDALONE # define MEM_mallocN(size, str) ((void)str, malloc(size)) # define MEM_callocN(size, str) ((void)str, calloc(size, 1)) diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c index 16e70e8c155..c36c7467b89 100644 --- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c +++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c @@ -362,7 +362,7 @@ static void fill_laplacian_matrix(LaplacianSystem *sys) } } BM_ITER_MESH (e, &eiter, sys->bm, BM_EDGES_OF_MESH) { - if (!BM_elem_flag_test(e, BM_ELEM_SELECT) && BM_edge_is_boundary(e) ) { + if (!BM_elem_flag_test(e, BM_ELEM_SELECT) && BM_edge_is_boundary(e)) { v1 = e->v1->co; v2 = e->v2->co; idv1 = BM_elem_index_get(e->v1); diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 836588c1c02..d07d833eab9 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -2522,7 +2522,7 @@ static bool tri_corner_test(BevelParams *bp, BevVert *bv) totang += ang; } angdiff = fabsf(totang - 3.0f * (float)M_PI_2); - if ((bp->pro_super_r == PRO_SQUARE_R && angdiff > (float)M_PI/16.0f) || + if ((bp->pro_super_r == PRO_SQUARE_R && angdiff > (float)M_PI / 16.0f) || (angdiff > (float)M_PI_4)) { return false; diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp index f59580acb50..b62e2d08d9a 100644 --- a/source/blender/compositor/intern/COM_Node.cpp +++ b/source/blender/compositor/intern/COM_Node.cpp @@ -39,7 +39,7 @@ //#include #include "COM_defines.h" -Node::Node(bNode *editorNode, bool create_sockets): NodeBase() +Node::Node(bNode *editorNode, bool create_sockets) : NodeBase() { setbNode(editorNode); diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 65669062667..6010a64bd06 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -121,7 +121,7 @@ short ANIM_fcurve_keyframes_loop(KeyframeEditData *ked, FCurve *fcu, KeyframeEdi } /* Only operate on this BezTriple if it fullfills the criteria of the validation func */ - if ( (ok = key_ok(ked, bezt)) ) { + if ((ok = key_ok(ked, bezt))) { if (ked) ked->curflags = ok; /* Exit with return-code '1' if function returns positive diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 1b77c1530bf..2fd30ed5ecc 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1984,7 +1984,7 @@ static short object_frame_has_keyframe(Object *ob, float frame, short filter) } /* try shapekey keyframes (if available, and allowed by filter) */ - if (!(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOSKEY) ) { + if (!(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOSKEY)) { Key *key = BKE_key_from_object(ob); /* shapekeys can have keyframes ('Relative Shape Keys') @@ -2000,7 +2000,7 @@ static short object_frame_has_keyframe(Object *ob, float frame, short filter) } /* try materials */ - if (!(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOMAT) ) { + if (!(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOMAT)) { /* if only active, then we can skip a lot of looping */ if (filter & ANIMFILTER_KEYS_ACTIVE) { Material *ma = give_current_material(ob, (ob->actcol + 1)); diff --git a/source/blender/editors/armature/armature_naming.c b/source/blender/editors/armature/armature_naming.c index a4b40f64859..c214dc35fbf 100644 --- a/source/blender/editors/armature/armature_naming.c +++ b/source/blender/editors/armature/armature_naming.c @@ -113,8 +113,9 @@ static void constraint_bone_name_fix(Object *ob, ListBase *conlist, const char * for (ct = targets.first; ct; ct = ct->next) { if (ct->tar == ob) { - if (!strcmp(ct->subtarget, oldname) ) + if (STREQ(ct->subtarget, oldname)) { BLI_strncpy(ct->subtarget, newname, MAXBONENAME); + } } } diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 3a9dd3c9748..7a825b3805c 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -920,7 +920,7 @@ static void poselib_keytag_pose(bContext *C, Scene *scene, tPoseLib_PreviewData pchan = BKE_pose_channel_find_name(pose, agrp->name); if (pchan) { - if ( (pld->selcount == 0) || ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED)) ) { + if ((pld->selcount == 0) || ((pchan->bone) && (pchan->bone->flag & BONE_SELECTED))) { if (autokey) { /* add datasource override for the PoseChannel, to be used later */ ANIM_relative_keyingset_add_source(&dsources, &pld->ob->id, &RNA_PoseBone, pchan); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 06f13c35e0b..544d9a0f575 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -823,17 +823,17 @@ void UI_view2d_curRect_reset(View2D *v2d) /* handle width - posx and negx flags are mutually exclusive, so watch out */ if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) { /* width is in negative-x half */ - v2d->cur.xmin = (float)-width; + v2d->cur.xmin = -width; v2d->cur.xmax = 0.0f; } else if ((v2d->align & V2D_ALIGN_NO_NEG_X) && !(v2d->align & V2D_ALIGN_NO_POS_X)) { /* width is in positive-x half */ v2d->cur.xmin = 0.0f; - v2d->cur.xmax = (float)width; + v2d->cur.xmax = width; } else { /* width is centered around (x == 0) */ - const float dx = (float)width / 2.0f; + const float dx = width / 2.0f; v2d->cur.xmin = -dx; v2d->cur.xmax = dx; @@ -842,17 +842,17 @@ void UI_view2d_curRect_reset(View2D *v2d) /* handle height - posx and negx flags are mutually exclusive, so watch out */ if ((v2d->align & V2D_ALIGN_NO_POS_Y) && !(v2d->align & V2D_ALIGN_NO_NEG_Y)) { /* height is in negative-y half */ - v2d->cur.ymin = (float)-height; + v2d->cur.ymin = -height; v2d->cur.ymax = 0.0f; } else if ((v2d->align & V2D_ALIGN_NO_NEG_Y) && !(v2d->align & V2D_ALIGN_NO_POS_Y)) { /* height is in positive-y half */ v2d->cur.ymin = 0.0f; - v2d->cur.ymax = (float)height; + v2d->cur.ymax = height; } else { /* height is centered around (y == 0) */ - const float dy = (float)height / 2.0f; + const float dy = height / 2.0f; v2d->cur.ymin = -dy; v2d->cur.ymax = dy; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index b80d4dedc65..5488545f2b1 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -455,7 +455,7 @@ void ED_object_editmode_enter(bContext *C, int flag) ob = base->object; /* this checks actual object->data, for cases when other scenes have it in editmode context */ - if ( BKE_object_is_in_editmode(ob) ) + if (BKE_object_is_in_editmode(ob)) return; if (BKE_object_obdata_is_libdata(ob)) { diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index af9eebe9f6d..eba8028dffb 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -165,7 +165,7 @@ int ED_operator_objectmode(bContext *C) if (scene == NULL || scene->id.lib) return 0; - if (CTX_data_edit_object(C) ) + if (CTX_data_edit_object(C)) return 0; /* add a check for ob->mode too? */ diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 1809c6cb835..77cea89f2f7 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -139,7 +139,7 @@ static void file_panel_system_bookmarks(const bContext *C, Panel *pa) { SpaceFile *sfile = CTX_wm_space_file(C); - if (sfile && !(U.uiflag & USER_HIDE_SYSTEM_BOOKMARKS) ) { + if (sfile && !(U.uiflag & USER_HIDE_SYSTEM_BOOKMARKS)) { file_panel_category(C, pa, FS_CATEGORY_SYSTEM_BOOKMARKS, &sfile->systemnr, ICON_BOOKMARKS, 0); } @@ -165,7 +165,7 @@ static void file_panel_recent(const bContext *C, Panel *pa) uiLayout *row; if (sfile) { - if (!(U.uiflag & USER_HIDE_RECENT) ) { + if (!(U.uiflag & USER_HIDE_RECENT)) { row = uiLayoutRow(pa->layout, FALSE); uiItemO(row, IFACE_("Reset"), ICON_X, "file.reset_recent"); uiItemL(row, NULL, ICON_NONE); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 872960432d9..748a0bd884c 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -304,18 +304,18 @@ static int is_hidden_file(const char *filename, short hide_dot) if (filename[0] == '.' && filename[1] != '.' && filename[1] != 0) { is_hidden = 1; /* ignore .file */ } - else if (((filename[0] == '.') && (filename[1] == 0) )) { + else if (((filename[0] == '.') && (filename[1] == 0))) { is_hidden = 1; /* ignore . */ } else { int len = strlen(filename); - if ( (len > 0) && (filename[len - 1] == '~') ) { + if ((len > 0) && (filename[len - 1] == '~')) { is_hidden = 1; /* ignore file~ */ } } } else { - if (((filename[0] == '.') && (filename[1] == 0) )) { + if (((filename[0] == '.') && (filename[1] == 0))) { is_hidden = 1; /* ignore . */ } } @@ -370,7 +370,7 @@ void filelist_filter(FileList *filelist) /* How many files are left after filter ? */ for (i = 0; i < filelist->numfiles; ++i) { struct direntry *file = &filelist->filelist[i]; - if (filelist->filterf(file, filelist->dir, filelist->filter, filelist->hide_dot) ) { + if (filelist->filterf(file, filelist->dir, filelist->filter, filelist->hide_dot)) { num_filtered++; } } @@ -384,7 +384,7 @@ void filelist_filter(FileList *filelist) for (i = 0, j = 0; i < filelist->numfiles; ++i) { struct direntry *file = &filelist->filelist[i]; - if (filelist->filterf(file, filelist->dir, filelist->filter, filelist->hide_dot) ) { + if (filelist->filterf(file, filelist->dir, filelist->filter, filelist->hide_dot)) { filelist->fidx[j++] = i; } } @@ -629,7 +629,7 @@ ImBuf *filelist_getimage(struct FileList *filelist, int index) BLI_assert(G.background == FALSE); - if ( (index < 0) || (index >= filelist->numfiltered) ) { + if ((index < 0) || (index >= filelist->numfiltered)) { return NULL; } fidx = filelist->fidx[index]; @@ -646,7 +646,7 @@ ImBuf *filelist_geticon(struct FileList *filelist, int index) BLI_assert(G.background == FALSE); - if ( (index < 0) || (index >= filelist->numfiltered) ) { + if ((index < 0) || (index >= filelist->numfiltered)) { return NULL; } fidx = filelist->fidx[index]; @@ -669,7 +669,7 @@ ImBuf *filelist_geticon(struct FileList *filelist, int index) if (file->flags & BLENDERFILE) { ibuf = gSpecialFileImages[SPECIAL_IMG_BLENDFILE]; } - else if ( (file->flags & MOVIEFILE) || (file->flags & MOVIEFILE_ICON) ) { + else if ((file->flags & MOVIEFILE) || (file->flags & MOVIEFILE_ICON)) { ibuf = gSpecialFileImages[SPECIAL_IMG_MOVIEFILE]; } else if (file->flags & SOUNDFILE) { @@ -698,7 +698,7 @@ struct direntry *filelist_file(struct FileList *filelist, int index) { int fidx = 0; - if ( (index < 0) || (index >= filelist->numfiltered) ) { + if ((index < 0) || (index >= filelist->numfiltered)) { return NULL; } fidx = filelist->fidx[index]; @@ -994,7 +994,7 @@ void filelist_select_file(struct FileList *filelist, int index, FileSelType sele void filelist_select(struct FileList *filelist, FileSelection *sel, FileSelType select, unsigned int flag, FileCheckType check) { /* select all valid files between first and last indicated */ - if ( (sel->first >= 0) && (sel->first < filelist->numfiltered) && (sel->last >= 0) && (sel->last < filelist->numfiltered) ) { + if ((sel->first >= 0) && (sel->first < filelist->numfiltered) && (sel->last >= 0) && (sel->last < filelist->numfiltered)) { int current_file; for (current_file = sel->first; current_file <= sel->last; current_file++) { filelist_select_file(filelist, current_file, select, flag, check); @@ -1332,7 +1332,7 @@ static void thumbnails_startjob(void *tjv, short *stop, short *do_update, float tj->stop = stop; tj->do_update = do_update; - while ( (*stop == 0) && (limg) ) { + while ((*stop == 0) && (limg)) { if (limg->flags & IMAGEFILE) { limg->img = IMB_thumb_manage(limg->path, THB_NORMAL, THB_SOURCE_IMAGE); } @@ -1393,7 +1393,7 @@ void thumbnails_start(FileList *filelist, const bContext *C) tj->filelist = filelist; for (idx = 0; idx < filelist->numfiles; idx++) { if (!filelist->filelist[idx].image) { - if ( (filelist->filelist[idx].flags & (IMAGEFILE | MOVIEFILE | BLENDERFILE | BLENDERFILE_BACKUP)) ) { + if ((filelist->filelist[idx].flags & (IMAGEFILE | MOVIEFILE | BLENDERFILE | BLENDERFILE_BACKUP))) { FileImage *limg = MEM_callocN(sizeof(FileImage), "loadimage"); BLI_strncpy(limg->path, filelist->filelist[idx].path, FILE_MAX); limg->index = idx; diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index e7c98437b9f..8b98f7ce5e6 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -237,7 +237,7 @@ static void draw_fcurve_vertices_handles(FCurve *fcu, SpaceIpo *sipo, View2D *v2 * Also, need to take into account whether the keyframe was selected * if a Graph Editor option to only show handles of selected keys is on. */ - if (!sel_handle_only || BEZSELECTED(bezt) ) { + if (!sel_handle_only || BEZSELECTED(bezt)) { if ((!prevbezt && (bezt->ipo == BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo == BEZT_IPO_BEZ))) { if ((bezt->f1 & SELECT) == sel) /* && v2d->cur.xmin < bezt->vec[0][0] < v2d->cur.xmax)*/ draw_fcurve_handle_control(bezt->vec[0][0], bezt->vec[0][1], xscale, yscale, hsize); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 10f4e011026..2f877e56f94 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1292,7 +1292,7 @@ static void outliner_draw_tree_element(bContext *C, uiBlock *block, Scene *scene } } else { - if (tree_element_type_active(NULL, scene, soops, te, tselem, 0, false) ) active = 2; + if (tree_element_type_active(NULL, scene, soops, te, tselem, 0, false)) active = 2; glColor4ub(220, 220, 255, alpha); } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 3f0ad45de56..8afd5607121 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -307,7 +307,7 @@ void OUTLINER_OT_item_rename(wmOperatorType *ot) /* Apply Settings ------------------------------- */ -static int outliner_count_levels(SpaceOops *soops, ListBase *lb, int curlevel) +static int outliner_count_levels(SpaceOops *soops, ListBase *lb, const int curlevel) { TreeElement *te; int level = curlevel, lev; @@ -320,7 +320,7 @@ static int outliner_count_levels(SpaceOops *soops, ListBase *lb, int curlevel) return level; } -int outliner_has_one_flag(SpaceOops *soops, ListBase *lb, short flag, short curlevel) +int outliner_has_one_flag(SpaceOops *soops, ListBase *lb, short flag, const int curlevel) { TreeElement *te; TreeStoreElem *tselem; diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 5aaf8b5430b..015d8d64627 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -177,7 +177,7 @@ void outliner_do_object_operation(struct bContext *C, struct Scene *scene, struc int common_restrict_check(struct bContext *C, struct Object *ob); -int outliner_has_one_flag(struct SpaceOops *soops, ListBase *lb, short flag, short curlevel); +bool outliner_has_one_flag(struct SpaceOops *soops, ListBase *lb, short flag, const int curlevel); void outliner_set_flag(struct SpaceOops *soops, ListBase *lb, short flag, short set); void object_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem); diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index a0af9340fe2..cdc7178e767 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -1278,7 +1278,7 @@ static int do_outliner_operation_event(bContext *C, Scene *scene, ARegion *ar, S /* select object that's clicked on and popup context menu */ if (!(tselem->flag & TSE_SELECTED)) { - if (outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1) ) + if (outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1)) outliner_set_flag(soops, &soops->tree, TSE_SELECTED, 0); tselem->flag |= TSE_SELECTED; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 2952bdb042c..3253d344ff6 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -293,7 +293,7 @@ Sequence *find_neighboring_sequence(Scene *scene, Sequence *test, int lr, int se for (seq = ed->seqbasep->first; seq; seq = seq->next) { if ((seq != test) && (test->machine == seq->machine) && - ((sel == -1) || (sel && (seq->flag & SELECT)) || (sel == 0 && (seq->flag & SELECT) == 0) )) + ((sel == -1) || (sel && (seq->flag & SELECT)) || (sel == 0 && (seq->flag & SELECT) == 0))) { switch (lr) { case SEQ_SIDE_LEFT: diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 7d51e0eac75..71a0c86da6a 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1271,7 +1271,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, /* draw clip start, useful for wide cones where its not obvious where the start is */ glTranslatef(0.0, 0.0, -x); /* reverse translation above */ - if (la->type == LA_SPOT && (la->mode & LA_SHAD_BUF) ) { + if (la->type == LA_SPOT && (la->mode & LA_SHAD_BUF)) { float lvec_clip[3]; float vvec_clip[3]; float clipsta_fac = la->clipsta / -x; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index d43cfa93311..23252804b36 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1295,7 +1295,8 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) return; } - if (!(v3d->flag & V3D_INVALID_BACKBUF) ) return; + if (!(v3d->flag & V3D_INVALID_BACKBUF)) + return; #if 0 if (test) { @@ -3326,8 +3327,9 @@ static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const /* draw selected and editmode */ for (base = scene->base.first; base; base = base->next) { if (v3d->lay & base->lay) { - if (base->object == scene->obedit || (base->flag & SELECT) ) + if (base->object == scene->obedit || (base->flag & SELECT)) { draw_object(scene, ar, v3d, base, 0); + } } } diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 842f1f230af..f95883f28ec 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -295,19 +295,19 @@ static void view3d_boxview_sync(ScrArea *sa, ARegion *ar) if (rv3dtest->viewlock) { rv3dtest->dist = rv3d->dist; - if (ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM) ) { + if (ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) { if (ELEM(rv3dtest->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK)) rv3dtest->ofs[0] = rv3d->ofs[0]; else if (ELEM(rv3dtest->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT)) rv3dtest->ofs[1] = rv3d->ofs[1]; } - else if (ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK) ) { + else if (ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK)) { if (ELEM(rv3dtest->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) rv3dtest->ofs[0] = rv3d->ofs[0]; else if (ELEM(rv3dtest->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT)) rv3dtest->ofs[2] = rv3d->ofs[2]; } - else if (ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT) ) { + else if (ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT)) { if (ELEM(rv3dtest->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) rv3dtest->ofs[1] = rv3d->ofs[1]; if (ELEM(rv3dtest->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK)) diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 894145c9e9d..24f51635e07 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -925,7 +925,7 @@ void postSelectConstraint(TransInfo *t) static void setNearestAxis2d(TransInfo *t) { /* no correction needed... just use whichever one is lower */ - if (abs(t->mval[0] - t->con.imval[0]) < abs(t->mval[1] - t->con.imval[1]) ) { + if (abs(t->mval[0] - t->con.imval[0]) < abs(t->mval[1] - t->con.imval[1])) { t->con.mode |= CON_AXIS1; BLI_strncpy(t->con.text, IFACE_(" along Y axis"), sizeof(t->con.text)); } diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 0ff94fb4f1c..85a2da10596 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -497,7 +497,7 @@ static void recalcData_nla(TransInfo *t) pExceeded = ((strip->prev) && (strip->prev->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h1[0] < strip->prev->end)); nExceeded = ((strip->next) && (strip->next->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h2[0] > strip->next->start)); - if ((pExceeded && nExceeded) || (iter == 4) ) { + if ((pExceeded && nExceeded) || (iter == 4)) { /* both endpoints exceeded (or iteration ping-pong'd meaning that we need a compromise) * - simply crop strip to fit within the bounds of the strips bounding it * - if there were no neighbors, clear the transforms (make it default to the strip's current values) diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 529a815b893..b5bcd8158e1 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -2856,7 +2856,7 @@ static int uv_border_select_exec(bContext *C, wmOperator *op) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - if (!pinned || (ts->uv_flag & UV_SYNC_SELECTION) ) { + if (!pinned || (ts->uv_flag & UV_SYNC_SELECTION)) { /* UV_SYNC_SELECTION - can't do pinned selection */ if (BLI_rctf_isect_pt_v(&rectf, luv->uv)) { diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 4c3bdd0398e..d82fe46ea54 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -2469,7 +2469,7 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_NEVER_NULL); RNA_def_property_pointer_sdna(prop, NULL, "iuser"); RNA_def_property_ui_text(prop, "Image User", - "Parameters defining which layer, pass and frame of the image is displayed"); + "Parameters defining which layer, pass and frame of the image is displayed"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); /* render */ diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index a73a7f41d7e..d8fc8799237 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -291,7 +291,7 @@ static void rna_Sequence_channel_set(PointerRNA *ptr, int value) seq->machine = value; - if (BKE_sequence_test_overlap(seqbase, seq) ) { + if (BKE_sequence_test_overlap(seqbase, seq)) { BKE_sequence_base_shuffle(seqbase, seq, scene); /* XXX - BROKEN!, uses context seqbasep */ } BKE_sequencer_sort(scene); diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index 1d5dc29c119..50788f4e4a6 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -140,7 +140,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, * - must have verts and therefore verts assigned to vgroups to do anything useful */ if (!(ELEM(mmd->mode, MOD_MASK_MODE_ARM, MOD_MASK_MODE_VGROUP)) || - (maxVerts == 0) || (ob->defbase.first == NULL) ) + (maxVerts == 0) || (ob->defbase.first == NULL)) { return dm; } @@ -297,7 +297,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* vertices */ for (hashIter = BLI_ghashIterator_new(vertHash); BLI_ghashIterator_done(hashIter) == false; - BLI_ghashIterator_step(hashIter) ) + BLI_ghashIterator_step(hashIter)) { MVert source; MVert *dest; @@ -336,7 +336,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, /* faces */ for (hashIter = BLI_ghashIterator_new(polyHash); BLI_ghashIterator_done(hashIter) == false; - BLI_ghashIterator_step(hashIter) ) + BLI_ghashIterator_step(hashIter)) { int oldIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(hashIter)); int newIndex = GET_INT_FROM_POINTER(BLI_ghashIterator_getValue(hashIter)); diff --git a/source/blender/nodes/composite/node_composite_tree.c b/source/blender/nodes/composite/node_composite_tree.c index 39a9f74dea4..31aefe4f027 100644 --- a/source/blender/nodes/composite/node_composite_tree.c +++ b/source/blender/nodes/composite/node_composite_tree.c @@ -377,7 +377,7 @@ int ntreeCompositTagAnimated(bNodeTree *ntree) } /* here was tag render layer, but this is called after a render, so re-composites fail */ else if (node->type == NODE_GROUP) { - if (ntreeCompositTagAnimated((bNodeTree *)node->id) ) { + if (ntreeCompositTagAnimated((bNodeTree *)node->id)) { nodeUpdate(ntree, node); } } diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index e6fc2cf6bb2..09a83834610 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -146,7 +146,7 @@ void WM_cursor_set(wmWindow *win, int curs) if (curs == SYSCURSOR) { /* System default Cursor */ GHOST_SetCursorShape(win->ghostwin, convert_cursor(CURSOR_STD)); } - else if ( (U.curssize == 0) || (BlenderCursor[curs]->big_bm == NULL) ) { + else if ((U.curssize == 0) || (BlenderCursor[curs]->big_bm == NULL)) { window_set_custom_cursor_ex(win, BlenderCursor[curs], 0); } else { diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index dad8e7bdde0..12e23c3d0c7 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -227,7 +227,7 @@ static void wm_drop_operator_options(bContext *C, wmDrag *drag, wmEvent *event) drag->opname[0] = 0; /* check buttons (XXX todo rna and value) */ - if (UI_but_active_drop_name(C) ) { + if (UI_but_active_drop_name(C)) { BLI_strncpy(drag->opname, IFACE_("Paste name"), sizeof(drag->opname)); } else { diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index e4dfae284fe..f8488b63c85 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -3040,7 +3040,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U /* double click test */ if (wm_event_is_double_click(&event, evt)) { - if (G.debug & (G_DEBUG_HANDLERS | G_DEBUG_EVENTS) ) + if (G.debug & (G_DEBUG_HANDLERS | G_DEBUG_EVENTS)) printf("%s Send double click\n", __func__); event.val = KM_DBL_CLICK; } @@ -3147,7 +3147,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U /* double click test */ /* if previous event was same type, and previous was release, and now it presses... */ if (wm_event_is_double_click(&event, evt)) { - if (G.debug & (G_DEBUG_HANDLERS | G_DEBUG_EVENTS) ) + if (G.debug & (G_DEBUG_HANDLERS | G_DEBUG_EVENTS)) printf("%s Send double click\n", __func__); evt->val = event.val = KM_DBL_CLICK; } @@ -3216,7 +3216,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U attach_ndof_data(&event, customdata); wm_event_add(win, &event); - if (G.debug & (G_DEBUG_HANDLERS | G_DEBUG_EVENTS) ) + if (G.debug & (G_DEBUG_HANDLERS | G_DEBUG_EVENTS)) printf("%s sending NDOF_MOTION, prev = %d %d\n", __func__, event.x, event.y); break; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 99437479df1..fc36290b0db 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2897,8 +2897,9 @@ static int border_apply(bContext *C, wmOperator *op, int gesture_mode) return 0; /* XXX weak; border should be configured for this without reading event types */ - if (RNA_struct_find_property(op->ptr, "gesture_mode") ) + if (RNA_struct_find_property(op->ptr, "gesture_mode")) { RNA_int_set(op->ptr, "gesture_mode", gesture_mode); + } retval = op->type->exec(C, op); OPERATOR_RETVAL_CHECK(retval); @@ -2915,8 +2916,9 @@ static void wm_gesture_end(bContext *C, wmOperator *op) ED_area_tag_redraw(CTX_wm_area(C)); - if (RNA_struct_find_property(op->ptr, "cursor") ) + if (RNA_struct_find_property(op->ptr, "cursor")) { WM_cursor_modal_restore(CTX_wm_window(C)); + } } int WM_border_select_invoke(bContext *C, wmOperator *op, const wmEvent *event) @@ -3194,8 +3196,9 @@ void wm_tweakevent_test(bContext *C, wmEvent *event, int action) if (win->tweak == NULL) { if (CTX_wm_region(C)) { if (event->val == KM_PRESS) { - if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE) ) + if (ELEM3(event->type, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) { win->tweak = WM_gesture_new(C, event, WM_GESTURE_TWEAK); + } } } } @@ -3220,8 +3223,9 @@ int WM_gesture_lasso_invoke(bContext *C, wmOperator *op, const wmEvent *event) wm_gesture_tag_redraw(C); - if (RNA_struct_find_property(op->ptr, "cursor") ) + if (RNA_struct_find_property(op->ptr, "cursor")) { WM_cursor_modal_set(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor")); + } return OPERATOR_RUNNING_MODAL; } @@ -3235,8 +3239,9 @@ int WM_gesture_lines_invoke(bContext *C, wmOperator *op, const wmEvent *event) wm_gesture_tag_redraw(C); - if (RNA_struct_find_property(op->ptr, "cursor") ) + if (RNA_struct_find_property(op->ptr, "cursor")) { WM_cursor_modal_set(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor")); + } return OPERATOR_RUNNING_MODAL; } @@ -3448,8 +3453,9 @@ int WM_gesture_straightline_invoke(bContext *C, wmOperator *op, const wmEvent *e wm_gesture_tag_redraw(C); - if (RNA_struct_find_property(op->ptr, "cursor") ) + if (RNA_struct_find_property(op->ptr, "cursor")) { WM_cursor_modal_set(CTX_wm_window(C), RNA_int_get(op->ptr, "cursor")); + } return OPERATOR_RUNNING_MODAL; }