diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-25 06:41:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-25 06:41:30 +0400 |
commit | e1a54214bbed9b32e1aee0e849ae654c495afa80 (patch) | |
tree | a95eaa2b98e7baa7e91fa34db46571e531b1cfb3 /source/blender | |
parent | 153eea5f23e2f0060d89a701ddd9b48085fc6070 (diff) |
code cleanup:
- remove unused defines.
- quiet some shadow warnings.
- bevel, ifdef out some asserts that are too common.
- style
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_brush.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/dynamicpaint.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bevel.c | 9 | ||||
-rw-r--r-- | source/blender/collada/collada_utils.cpp | 4 | ||||
-rw-r--r-- | source/blender/compositor/operations/COM_CompositorOperation.cpp | 4 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_2d.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_stroke.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 7 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_smart_stitch.c | 9 | ||||
-rw-r--r-- | source/blender/imbuf/intern/anim_movie.c | 6 | ||||
-rw-r--r-- | source/blender/imbuf/intern/colormanagement.c | 8 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_app_ffmpeg.c | 2 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_library.c | 10 |
14 files changed, 47 insertions, 34 deletions
diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index e123a0a94c0..23e96732386 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -78,8 +78,8 @@ float BKE_brush_sample_tex_3D(const Scene *scene, struct Brush *br, const float float rgba[4], const int thread, struct ImagePool *pool); float BKE_brush_sample_tex_2D(const struct Scene *scene, struct Brush *brush, const float xy[2], float rgba[4]); -float BKE_brush_sample_masktex (const Scene *scene, struct Brush *br,const float point[3], - const int thread, struct ImagePool *pool); +float BKE_brush_sample_masktex(const Scene *scene, struct Brush *br, const float point[3], + const int thread, struct ImagePool *pool); void BKE_brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size, struct ImBuf **imbuf, int use_color_correction); diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 7700538af28..18edb6e3500 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -585,10 +585,11 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br, return intensity; } -float BKE_brush_sample_masktex (const Scene *scene, Brush *br, - const float point[3], - const int thread, - struct ImagePool *pool) { +float BKE_brush_sample_masktex(const Scene *scene, Brush *br, + const float point[3], + const int thread, + struct ImagePool *pool) +{ UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; MTex *mtex = &br->mask_mtex; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 4e05595b93a..5dfaba2ea93 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -520,7 +520,7 @@ static int subframe_updateObject(Scene *scene, Object *ob, int flags, int parent /* if object has parents, update them too */ if (parent_recursion) { - int recursion = parent_recursion-1; + int recursion = parent_recursion - 1; int is_canvas = 0; if (ob->parent) is_canvas += subframe_updateObject(scene, ob->parent, 0, recursion, frame); if (ob->track) is_canvas += subframe_updateObject(scene, ob->track, 0, recursion, frame); diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index f685b741176..525bf3a2da7 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -43,11 +43,12 @@ #include "bmesh.h" #include "./intern/bmesh_private.h" - - #define BEVEL_EPSILON_D 1e-6 #define BEVEL_EPSILON 1e-6f +/* happens far too often, uncomment for development */ +// #define BEVEL_ASSERT_PROJECT + /* for testing */ // #pragma GCC diagnostic error "-Wpadded" @@ -369,7 +370,9 @@ static void offset_meet(EdgeHalf *e1, EdgeHalf *e2, BMVert *v, BMFace *f, /* intersect the lines; by construction they should be on the same plane and not parallel */ if (!isect_line_line_v3(off1a, off1b, off2a, off2b, meetco, isect2)) { +#ifdef BEVEL_ASSERT_PROJECT BLI_assert(!"offset_meet failure"); +#endif copy_v3_v3(meetco, off1a); /* just to do something */ } } @@ -485,7 +488,9 @@ static void project_to_edge(BMEdge *e, const float co_a[3], const float co_b[3], float otherco[3]; if (!isect_line_line_v3(e->v1->co, e->v2->co, co_a, co_b, projco, otherco)) { +#ifdef BEVEL_ASSERT_PROJECT BLI_assert(!"project meet failure"); +#endif copy_v3_v3(projco, e->v1->co); } } diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 84b81f4d332..9aa1f7b9714 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -327,8 +327,8 @@ std::string bc_replace_string(std::string data, const std::string& pattern, */ void bc_match_scale(std::vector<Object *> *objects_done, Scene &sce, - UnitConverter &bc_unit) { - + UnitConverter &bc_unit) +{ Object *ob = NULL; PointerRNA scene_ptr, unit_settings; diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp index 56527da47bc..f46aae9e455 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cpp +++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp @@ -175,8 +175,8 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber) Full frame */ - int full_width = rd->xsch * rd->size / 100; - int full_height =rd->ysch * rd->size / 100; + int full_width = rd->xsch * rd->size / 100; + int full_height = rd->ysch * rd->size / 100; dx = rd->border.xmin * full_width - (full_width - this->getWidth()) / 2.0f; dy = rd->border.ymin * full_height - (full_height - this->getHeight()) / 2.0f; diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 90a2c8037c4..9bc232c6a61 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -793,7 +793,7 @@ void *paint_2d_new_stroke(bContext *C, wmOperator *op) return s; } -void paint_2d_redraw (const bContext *C, void *ps, int final) +void paint_2d_redraw(const bContext *C, void *ps, int final) { ImagePaintState *s = ps; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 859d8d76f15..d7e2d010f03 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -179,7 +179,7 @@ static void paint_brush_update(bContext *C, Brush *brush, PaintMode mode, SCULPT_TOOL_THUMB, SCULPT_TOOL_ROTATE))) { if (((brush->mtex.brush_map_mode == MTEX_MAP_MODE_VIEW) || - (brush->mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM)) && + (brush->mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM)) && !(brush->flag & BRUSH_RAKE)) { if (brush->flag & BRUSH_RANDOM_ROTATION) @@ -191,7 +191,8 @@ static void paint_brush_update(bContext *C, Brush *brush, PaintMode mode, if ((brush->mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM)) { ups->tex_mouse[0] = BLI_frand() * stroke->vc.ar->sizex; ups->tex_mouse[1] = BLI_frand() * stroke->vc.ar->sizey;; - } else { + } + else { copy_v2_v2(ups->tex_mouse, mouse); } } diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index ba931b05214..e3270d9ce8e 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1460,23 +1460,22 @@ static int file_delete_poll(bContext *C) { int poll = ED_operator_file_active(C); SpaceFile *sfile = CTX_wm_space_file(C); - struct direntry *file; - if (sfile && sfile->params) { + if (sfile && sfile->params) { char dir[FILE_MAX], group[FILE_MAX]; int numfiles = filelist_numfiles(sfile->files); int i; int num_selected = 0; if (filelist_islibrary(sfile->files, dir, group)) poll = 0; - for (i = 0; i < numfiles; i++) { + for (i = 0; i < numfiles; i++) { if (filelist_is_selected(sfile->files, i, CHECK_FILES)) { num_selected++; } } if (num_selected <= 0) { poll = 0; - } + } } else poll = 0; diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 4c56a016176..8f8c5b8e03c 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -754,7 +754,8 @@ static void stitch_set_face_preview_buffer_position(BMFace *efa, StitchPreviewer /* setup face preview for all coincident uvs and their faces */ static void stitch_setup_face_preview_for_uv_group(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data, - PreviewPosition *preview_position) { + PreviewPosition *preview_position) +{ StitchPreviewer *preview = state->stitch_preview; /* static island does not change so returning immediately */ @@ -774,7 +775,8 @@ static void stitch_setup_face_preview_for_uv_group(UvElement *element, StitchSta /* checks if uvs are indeed stitchable and registers so that they can be shown in preview */ static void stitch_validate_uv_stichability(UvElement *element, StitchState *state, IslandStitchData *island_stitch_data, - PreviewPosition *preview_position) { + PreviewPosition *preview_position) +{ UvElement *element_iter; StitchPreviewer *preview = state->stitch_preview; int vert_index; @@ -809,7 +811,8 @@ static void stitch_validate_uv_stichability(UvElement *element, StitchState *sta static void stitch_validate_edge_stichability(UvEdge *edge, StitchState *state, IslandStitchData *island_stitch_data, - PreviewPosition *preview_position) { + PreviewPosition *preview_position) +{ UvEdge *edge_iter = edge->first; StitchPreviewer *preview = state->stitch_preview; diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 4ef1f962a0f..7f25d9b1d25 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -946,7 +946,8 @@ static int ffmpeg_seek_by_byte(AVFormatContext *pFormatCtx) } static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, - IMB_Timecode_Type tc) { + IMB_Timecode_Type tc) +{ int64_t pts_to_search = 0; double frame_rate; double pts_time_base; @@ -1303,7 +1304,8 @@ struct ImBuf *IMB_anim_previewframe(struct anim *anim) struct ImBuf *IMB_anim_absolute(struct anim *anim, int position, IMB_Timecode_Type tc, - IMB_Proxy_Size preview_size) { + IMB_Proxy_Size preview_size) +{ struct ImBuf *ibuf = NULL; char head[256], tail[256]; unsigned short digits; diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index aa3dd05dbd1..65a3db839a9 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -2401,15 +2401,15 @@ void IMB_colormanagement_colorspace_items_add(EnumPropertyItem **items, int *tot static void partial_buffer_update_rect(ImBuf *ibuf, unsigned char *display_buffer, const float *linear_buffer, const unsigned char *byte_buffer, int display_stride, int linear_stride, int linear_offset_x, int linear_offset_y, ColormanageProcessor *cm_processor, - int xmin, int ymin, int xmax, int ymax) + const int xmin, const int ymin, const int xmax, const int ymax) { int x, y; int channels = ibuf->channels; float dither = ibuf->dither; ColorSpace *rect_colorspace = ibuf->rect_colorspace; float *display_buffer_float = NULL; - int width = xmax - xmin; - int height = ymax - ymin; + const int width = xmax - xmin; + const int height = ymax - ymin; int is_data = ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA; if (dither != 0.0f) { @@ -2467,7 +2467,7 @@ static void partial_buffer_update_rect(ImBuf *ibuf, unsigned char *display_buffe width, height, width, display_stride); } else { - int i, width = xmax - xmin; + int i; for (i = ymin; i < ymax; i++) { int byte_offset = (linear_stride * i + xmin) * 4; diff --git a/source/blender/python/intern/bpy_app_ffmpeg.c b/source/blender/python/intern/bpy_app_ffmpeg.c index 3bf3dec3872..61e12c1cea0 100644 --- a/source/blender/python/intern/bpy_app_ffmpeg.c +++ b/source/blender/python/intern/bpy_app_ffmpeg.c @@ -81,8 +81,10 @@ static PyObject *make_ffmpeg_info(void) #define SetIntItem(flag) \ PyStructSequence_SET_ITEM(ffmpeg_info, pos++, PyLong_FromLong(flag)) #endif +#ifndef WITH_FFMPEG #define SetStrItem(str) \ PyStructSequence_SET_ITEM(ffmpeg_info, pos++, PyUnicode_FromString(str)) +#endif #define SetObjItem(obj) \ PyStructSequence_SET_ITEM(ffmpeg_info, pos++, obj) diff --git a/source/blender/python/intern/bpy_library.c b/source/blender/python/intern/bpy_library.c index 3f66fb7b337..623d45dfd90 100644 --- a/source/blender/python/intern/bpy_library.c +++ b/source/blender/python/intern/bpy_library.c @@ -330,10 +330,10 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args)) mainl = BLO_library_append_begin(bmain, &(self->blo_handle), self->relpath); { - int i = 0, code; - while ((code = BKE_idcode_iter_step(&i))) { - if (BKE_idcode_is_linkable(code)) { - const char *name_plural = BKE_idcode_to_name_plural(code); + int idcode_step = 0, idcode; + while ((idcode = BKE_idcode_iter_step(&idcode_step))) { + if (BKE_idcode_is_linkable(idcode)) { + const char *name_plural = BKE_idcode_to_name_plural(idcode); PyObject *ls = PyDict_GetItemString(self->dict, name_plural); // printf("lib: %s\n", name_plural); if (ls && PyList_Check(ls)) { @@ -350,7 +350,7 @@ static PyObject *bpy_lib_exit(BPy_Library *self, PyObject *UNUSED(args)) // printf(" %s\n", item_str); if (item_str) { - ID *id = BLO_library_append_named_part(mainl, &(self->blo_handle), item_str, code); + ID *id = BLO_library_append_named_part(mainl, &(self->blo_handle), item_str, idcode); if (id) { #ifdef USE_RNA_DATABLOCKS PointerRNA id_ptr; |