From 5e659c0b0895e07351bd2b2425deea342141e515 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Thu, 9 Jul 2009 15:40:04 +0000 Subject: 2.5 Monthly cleaning round to make it compile warning free. Mostly it was const stuff (strings, Context), but also a couple useful fixes, like wrong use of temp pointers. Only Mathutils callback struct I left alone... design issue. --- source/blender/blenkernel/intern/cloth.c | 9 ++++-- source/blender/blenkernel/intern/packedFile.c | 2 -- source/blender/blenkernel/intern/particle.c | 8 ++--- source/blender/blenkernel/intern/particle_system.c | 6 ++-- source/blender/blenkernel/intern/pointcache.c | 12 +++---- source/blender/blenlib/intern/storage.c | 2 +- source/blender/blenlib/intern/util.c | 6 ++-- source/blender/editors/armature/BIF_retarget.h | 2 +- .../editors/armature/editarmature_retarget.c | 2 +- .../blender/editors/armature/editarmature_sketch.c | 18 +++++------ source/blender/editors/include/ED_armature.h | 14 ++++---- source/blender/editors/object/object_edit.c | 2 -- source/blender/editors/physics/ed_pointcache.c | 2 +- source/blender/editors/space_file/file_ops.c | 2 +- source/blender/editors/space_file/file_panels.c | 4 +-- source/blender/editors/space_file/filelist.c | 2 +- source/blender/editors/space_file/filelist.h | 2 +- .../editors/transform/transform_manipulator.c | 1 - .../editors/transform/transform_ndofinput.c | 10 +++--- source/blender/python/BPY_extern.h | 2 +- source/blender/python/generic/euler.c | 37 ++++++++++++++-------- source/blender/python/generic/quat.c | 24 +++++++++----- source/blender/python/generic/vector.c | 2 +- source/blender/python/intern/bpy_interface.c | 4 +-- source/blender/render/intern/source/zbuf.c | 30 ------------------ 25 files changed, 95 insertions(+), 110 deletions(-) diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 08caea565aa..089dafeb8c7 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -341,24 +341,27 @@ void bvhselftree_update_from_cloth(ClothModifierData *clmd, int moving) } int modifiers_indexInObject(Object *ob, ModifierData *md_seek); -static void cloth_write_state(int index, Cloth *cloth, float *data) +static void cloth_write_state(int index, void *cloth_v, float *data) { + Cloth *cloth= cloth_v; ClothVertex *vert = cloth->verts + index; memcpy(data, vert->x, 3 * sizeof(float)); memcpy(data + 3, vert->xconst, 3 * sizeof(float)); memcpy(data + 6, vert->v, 3 * sizeof(float)); } -static void cloth_read_state(int index, Cloth *cloth, float *data) +static void cloth_read_state(int index, void *cloth_v, float *data) { + Cloth *cloth= cloth_v; ClothVertex *vert = cloth->verts + index; memcpy(vert->x, data, 3 * sizeof(float)); memcpy(vert->xconst, data + 3, 3 * sizeof(float)); memcpy(vert->v, data + 6, 3 * sizeof(float)); } -static void cloth_cache_interpolate(int index, Cloth *cloth, float frs_sec, float cfra, float cfra1, float cfra2, float *data1, float *data2) +static void cloth_cache_interpolate(int index, void *cloth_v, float frs_sec, float cfra, float cfra1, float cfra2, float *data1, float *data2) { + Cloth *cloth= cloth_v; ClothVertex *vert = cloth->verts + index; ParticleKey keys[4]; float dfra; diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 4d88556d8bf..02b0f6a45a0 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -377,8 +377,6 @@ there was an error or when the user desides to cancel the operation. char *unpackFile(ReportList *reports, char *abs_name, char *local_name, PackedFile *pf, int how) { - char menu[6 *(FILE_MAXDIR + FILE_MAXFILE + 100)]; - char line[FILE_MAXDIR + FILE_MAXFILE + 100]; char *newname = NULL, *temp = NULL; // char newabs[FILE_MAXDIR + FILE_MAXFILE]; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 6ab8d72aa6d..4488f8cdffd 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -2008,10 +2008,10 @@ void psys_thread_create_path(ParticleThread *thread, struct ChildParticle *cpa, ParticleTexture ptex; float *cpa_fuv=0, *par_rot=0; float co[3], orco[3], ornor[3], t, cpa_1st[3], dvec[3]; - float branch_begin, branch_end, branch_prob, branchfac, rough_rand; + float branch_begin, branch_end, branch_prob, rough_rand; float length, max_length = 1.0f, cur_length = 0.0f; float eff_length, eff_vec[3]; - int k, cpa_num, guided = 0; + int k, cpa_num; short cpa_from; if(part->flag & PART_BRANCHING) { @@ -2417,7 +2417,7 @@ void psys_cache_paths(Scene *scene, Object *ob, ParticleSystem *psys, float cfra float nosel_col[3]; float length, vec[3]; float *vg_effector= NULL, effector=0.0f; - float *vg_length= NULL, pa_length=1.0f, max_length=1.0f, cur_length=0.0f; + float *vg_length= NULL, pa_length=1.0f; int keyed, baked; /* we don't have anything valid to create paths from so let's quit here */ @@ -3553,7 +3553,6 @@ void psys_get_particle_on_path(Scene *scene, Object *ob, ParticleSystem *psys, i float t, real_t, dfra, keytime, frs_sec = scene->r.frs_sec; float co[3], orco[3]; float hairmat[4][4]; - float pa_clump = 0.0, pa_kink = 0.0; int totparent = 0; int totpart = psys->totpart; int totchild = psys->totchild; @@ -3800,7 +3799,6 @@ void psys_get_particle_on_path(Scene *scene, Object *ob, ParticleSystem *psys, i Normalize(state->vel); } else{ - float length = VecLength(state->vel); tstate.time=t+0.001f; psys_get_particle_on_path(scene, ob,psys,p,&tstate,0); VECSUB(state->vel,tstate.co,state->co); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 92b919f6b0e..07e0e82a86d 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -2205,8 +2205,10 @@ void psys_get_pointcache_start_end(Scene *scene, ParticleSystem *psys, int *sfra *sfra = MAX2(1, (int)part->sta); *efra = MIN2((int)(part->end + part->lifetime + 1.0), scene->r.efra); } -static void particle_write_state(int index, ParticleSystem *psys, float *data) +static void particle_write_state(int index, void *psys_ptr, float *data) { + ParticleSystem *psys= psys_ptr; + memcpy(data, (float *)(&(psys->particles+index)->state), sizeof(ParticleKey)); } static void particle_read_state(int index, void *psys_ptr, float *data) @@ -2225,7 +2227,7 @@ static void particle_cache_interpolate(int index, void *psys_ptr, float frs_sec, ParticleSystem *psys= psys_ptr; ParticleData *pa = psys->particles + index; ParticleKey keys[4]; - float dfra, cfra1f = (float)cfra1, cfra2f(float); + float dfra; cfra = MIN2(cfra, pa->dietime); cfra1 = MIN2(cfra1, pa->dietime); diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 2fbd0278e0e..2fe46be7a89 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -643,8 +643,8 @@ int BKE_ptcache_write_cache(PTCacheWriter *writer) return 0; for(i=0; itotelem; i++) { - writer->set_elem(i, writer->calldata, &temp); - BKE_ptcache_file_write_floats(pf, &temp, incr); + writer->set_elem(i, writer->calldata, temp); + BKE_ptcache_file_write_floats(pf, temp, incr); } } } @@ -677,8 +677,8 @@ int BKE_ptcache_write_cache(PTCacheWriter *writer) pmdata = pm->data; for(i=0; itotelem; i++, pmdata+=incr) { - writer->set_elem(i, writer->calldata, &temp); - memcpy(pmdata, &temp, elemsize); + writer->set_elem(i, writer->calldata, temp); + memcpy(pmdata, temp, elemsize); } pm->frame = writer->cfra; @@ -689,8 +689,8 @@ int BKE_ptcache_write_cache(PTCacheWriter *writer) pmdata = pm->data; for(i=0; itotelem; i++, pmdata+=incr) { - writer->set_elem(i, writer->calldata, &temp); - memcpy(pmdata, &temp, elemsize); + writer->set_elem(i, writer->calldata, temp); + memcpy(pmdata, temp, elemsize); } pm->frame = writer->cfra; diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 3204d5f74e1..7af383e2356 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -218,7 +218,7 @@ void BLI_builddir(char *dirname, char *relname) { struct dirent *fname; struct dirlink *dlink; - int rellen, newnum = 0, ignore; + int rellen, newnum = 0; char buf[256]; DIR *dir; diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index b9d4daaf5b2..838648ebfd7 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -738,9 +738,9 @@ void BLI_splitdirstring(char *di, char *fi) void BLI_getlastdir(const char* dir, char *last, int maxlen) { - char *s = dir; - char *lslash = NULL; - char *prevslash = NULL; + const char *s = dir; + const char *lslash = NULL; + const char *prevslash = NULL; while (*s) { if ((*s == '\\') || (*s == '/')) { prevslash = lslash; diff --git a/source/blender/editors/armature/BIF_retarget.h b/source/blender/editors/armature/BIF_retarget.h index c39f410424a..d950f073cf0 100644 --- a/source/blender/editors/armature/BIF_retarget.h +++ b/source/blender/editors/armature/BIF_retarget.h @@ -152,7 +152,7 @@ typedef struct RigControl { } RigControl; void BIF_retargetArc(struct bContext *C, ReebArc *earc, RigGraph *template_rigg); -RigGraph *RIG_graphFromArmature(struct bContext *C, struct Object *ob, struct bArmature *arm); +RigGraph *RIG_graphFromArmature(const struct bContext *C, struct Object *ob, struct bArmature *arm); int RIG_nbJoints(RigGraph *rg); char *RIG_nameBone(RigGraph *rg, int arc_index, int bone_index); void RIG_freeRigGraph(BGraph *rg); diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index 68e8b45e7d2..6f5692dbf4c 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -1538,7 +1538,7 @@ void RIG_printGraph(RigGraph *rg) /*******************************************************************************************************/ -RigGraph *RIG_graphFromArmature(bContext *C, Object *ob, bArmature *arm) +RigGraph *RIG_graphFromArmature(const bContext *C, Object *ob, bArmature *arm) { Object *obedit = CTX_data_edit_object(C); Scene *scene = CTX_data_scene(C); diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 6e6e61dafc2..33351c99828 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -242,7 +242,7 @@ int TEMPLATES_CURRENT = 0; GHash *TEMPLATES_HASH = NULL; RigGraph *TEMPLATE_RIGG = NULL; -void BIF_makeListTemplates(bContext *C) +void BIF_makeListTemplates(const bContext *C) { Object *obedit = CTX_data_edit_object(C); Scene *scene = CTX_data_scene(C); @@ -275,7 +275,7 @@ void BIF_makeListTemplates(bContext *C) } } -char *BIF_listTemplates(bContext *C) +char *BIF_listTemplates(const bContext *C) { GHashIterator ghi; char menu_header[] = "Template%t|None%x0|"; @@ -307,7 +307,7 @@ char *BIF_listTemplates(bContext *C) return TEMPLATES_MENU; } -int BIF_currentTemplate(bContext *C) +int BIF_currentTemplate(const bContext *C) { ToolSettings *ts = CTX_data_tool_settings(C); @@ -334,7 +334,7 @@ int BIF_currentTemplate(bContext *C) return TEMPLATES_CURRENT; } -RigGraph* sk_makeTemplateGraph(bContext *C, Object *ob) +RigGraph* sk_makeTemplateGraph(const bContext *C, Object *ob) { Object *obedit = CTX_data_edit_object(C); if (ob == obedit) @@ -363,7 +363,7 @@ RigGraph* sk_makeTemplateGraph(bContext *C, Object *ob) return TEMPLATE_RIGG; } -int BIF_nbJointsTemplate(bContext *C) +int BIF_nbJointsTemplate(const bContext *C) { ToolSettings *ts = CTX_data_tool_settings(C); RigGraph *rg = sk_makeTemplateGraph(C, ts->skgen_template); @@ -378,7 +378,7 @@ int BIF_nbJointsTemplate(bContext *C) } } -char * BIF_nameBoneTemplate(bContext *C) +char * BIF_nameBoneTemplate(const bContext *C) { ToolSettings *ts = CTX_data_tool_settings(C); SK_Sketch *stk = GLOBAL_sketch; @@ -3033,7 +3033,7 @@ int BDR_drawSketchNames(ViewContext *vc) return 0; } -void BDR_drawSketch(bContext *C) +void BDR_drawSketch(const bContext *C) { if (ED_operator_sketch_mode(C)) { @@ -3351,7 +3351,7 @@ int ED_operator_sketch_full_mode(bContext *C) } } -int ED_operator_sketch_mode(bContext *C) +int ED_operator_sketch_mode(const bContext *C) { Object *obedit = CTX_data_edit_object(C); ToolSettings *ts = CTX_data_tool_settings(C); @@ -3458,7 +3458,7 @@ void SKETCH_OT_draw_stroke(wmOperatorType *ot) ot->modal = sketch_draw_stroke_modal; ot->cancel = sketch_draw_stroke_cancel; - ot->poll= ED_operator_sketch_mode; + ot->poll= (int (*)(bContext *))ED_operator_sketch_mode; RNA_def_boolean(ot->srna, "snap", 0, "Snap", ""); diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index f28dbe2a619..1df9182fc9b 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -128,22 +128,22 @@ void ED_pose_deselectall(struct Object *ob, int test, int doundo); int ED_operator_sketch_mode_active_stroke(struct bContext *C); int ED_operator_sketch_full_mode(struct bContext *C); -int ED_operator_sketch_mode(struct bContext *C); +int ED_operator_sketch_mode(const struct bContext *C); void BIF_freeSketch(struct bContext *C); void BIF_convertSketch(struct bContext *C); void BIF_deleteSketch(struct bContext *C); void BIF_selectAllSketch(struct bContext *C, int mode); /* -1: deselect, 0: select, 1: toggle */ -void BIF_makeListTemplates(struct bContext *C); -char *BIF_listTemplates(struct bContext *C); -int BIF_currentTemplate(struct bContext *C); +void BIF_makeListTemplates(const struct bContext *C); +char *BIF_listTemplates(const struct bContext *C); +int BIF_currentTemplate(const struct bContext *C); void BIF_freeTemplates(struct bContext *C); void BIF_setTemplate(struct bContext *C, int index); -int BIF_nbJointsTemplate(struct bContext *C); -char * BIF_nameBoneTemplate(struct bContext *C); +int BIF_nbJointsTemplate(const struct bContext *C); +char * BIF_nameBoneTemplate(const struct bContext *C); -void BDR_drawSketch(struct bContext *vc); +void BDR_drawSketch(const struct bContext *vc); int BDR_drawSketchNames(struct ViewContext *vc); #endif /* ED_ARMATURE_H */ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 6a5b743056a..11f6b443912 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -3581,9 +3581,7 @@ void special_editmenu(Scene *scene, View3D *v3d) // XXX static short numcuts= 2; Object *ob= OBACT; Object *obedit= NULL; // XXX - float fac; int nr,ret=0; - short randfac; if(ob==NULL) return; diff --git a/source/blender/editors/physics/ed_pointcache.c b/source/blender/editors/physics/ed_pointcache.c index ad60be3ba7d..4bf6612df67 100644 --- a/source/blender/editors/physics/ed_pointcache.c +++ b/source/blender/editors/physics/ed_pointcache.c @@ -177,7 +177,7 @@ static int ptcache_bake_cloth_exec(bContext *C, wmOperator *op) baker.quick_step = 1; baker.break_test = cache_break_test; baker.break_data = NULL; - baker.progressbar = WM_timecursor; + baker.progressbar = (void (*)(void *, int))WM_timecursor; baker.progresscontext = CTX_wm_window(C); BKE_ptcache_make_cache(&baker); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index bb56ec94d7b..9f703a9802b 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -358,9 +358,9 @@ void FILE_OT_add_bookmark(wmOperatorType *ot) static int bookmark_delete_invoke(bContext *C, wmOperator *op, wmEvent *event) { ScrArea *sa= CTX_wm_area(C); - SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C); struct FSMenu* fsmenu = fsmenu_get(); int nentries = fsmenu_get_nentries(fsmenu, FS_CATEGORY_BOOKMARKS); + if(RNA_struct_find_property(op->ptr, "index")) { int index = RNA_int_get(op->ptr, "index"); if ( (index >-1) && (index < nentries)) { diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 29c759d43c0..72a4133fe75 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -57,11 +57,9 @@ static void do_file_panel_events(bContext *C, void *arg, int event) static void file_panel_category(const bContext *C, Panel *pa, FSMenuCategory category, int icon, int allow_delete) { uiBlock *block; - uiStyle *style= U.uistyles.first; - int i; - int fontsize = file_font_pointsize(); struct FSMenu* fsmenu = fsmenu_get(); int nentries = fsmenu_get_nentries(fsmenu, category); + int i; uiLayoutSetAlignment(pa->layout, UI_LAYOUT_ALIGN_LEFT); block= uiLayoutFreeBlock(pa->layout); diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index ab5dac1a727..6e442c654ca 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -367,7 +367,7 @@ struct ListBase* folderlist_new() return p; } -void folderlist_popdir(struct ListBase* folderlist, const char *dir) +void folderlist_popdir(struct ListBase* folderlist, char *dir) { const char *prev_dir; struct FolderList *folder; diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h index 0f8db98b7ab..dd3c2c766c1 100644 --- a/source/blender/editors/space_file/filelist.h +++ b/source/blender/editors/space_file/filelist.h @@ -73,7 +73,7 @@ void filelist_setfiletypes(struct FileList* filelist, short has_quicktime); struct ListBase * folderlist_new(); void folderlist_free(struct ListBase* folderlist); -void folderlist_popdir(struct ListBase* folderlist, const char *dir); +void folderlist_popdir(struct ListBase* folderlist, char *dir); void folderlist_pushdir(struct ListBase* folderlist, const char *dir); int folderlist_clear_next(struct SpaceFile* sfile); diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index c4cca6eba07..7c71e89f948 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -1603,7 +1603,6 @@ int BIF_do_manipulator(bContext *C, struct wmEvent *event, wmOperator *op) ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; ARegion *ar= CTX_wm_region(C); - RegionView3D *rv3d= ar->regiondata; int constraint_axis[3] = {0, 0, 0}; int val; int shift = event->shift; diff --git a/source/blender/editors/transform/transform_ndofinput.c b/source/blender/editors/transform/transform_ndofinput.c index 9c2a1a7db6d..f8567023e5f 100644 --- a/source/blender/editors/transform/transform_ndofinput.c +++ b/source/blender/editors/transform/transform_ndofinput.c @@ -37,7 +37,9 @@ #include "transform.h" +#if 0 static int updateNDofMotion(NDofInput *n); // return 0 when motion is null +#endif static void resetNDofInput(NDofInput *n); void initNDofInput(NDofInput *n) @@ -121,6 +123,8 @@ void applyNDofInput(NDofInput *n, float *vec) } } +// TRANSFORM_FIX_ME +#if 0 static int updateNDofMotion(NDofInput *n) { @@ -128,14 +132,11 @@ static int updateNDofMotion(NDofInput *n) int i; int retval = 0; -// TRANSFORM_FIX_ME -#if 0 getndof(fval); if (G.vd->ndoffilter) filterNDOFvalues(fval); -#endif - + for(i = 0; i < 6; i++) { if (!retval && fval[i] != 0.0f) @@ -150,6 +151,7 @@ static int updateNDofMotion(NDofInput *n) return retval; } +#endif diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index d141a585378..c6972793372 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -100,7 +100,7 @@ extern "C" { /* 2.5 UI Scripts */ int BPY_run_python_script( struct bContext *C, const char *filename, struct Text *text, struct ReportList *reports ); // 2.5 working - int BPY_run_script_space_draw(struct bContext *C, struct SpaceScript * sc); // 2.5 working + int BPY_run_script_space_draw(const struct bContext *C, struct SpaceScript * sc); // 2.5 working void BPY_run_ui_scripts(struct bContext *C, int reload); // int BPY_run_script_space_listener(struct bContext *C, struct SpaceScript * sc, struct ARegion *ar, struct wmNotifier *wmn); // 2.5 working void BPY_update_modules( void ); // XXX - annoying, need this for pointers that get out of date diff --git a/source/blender/python/generic/euler.c b/source/blender/python/generic/euler.c index 1e0632f4040..69373b1aa36 100644 --- a/source/blender/python/generic/euler.c +++ b/source/blender/python/generic/euler.c @@ -134,18 +134,21 @@ static PyObject *Euler_ToQuat(EulerObject * self) //return a matrix representation of the euler static PyObject *Euler_ToMatrix(EulerObject * self) { - float eul[3]; float mat[9] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}; - int x; if(!BaseMath_ReadCallback(self)) return NULL; #ifdef USE_MATHUTILS_DEG - for(x = 0; x < 3; x++) { - eul[x] = self->eul[x] * ((float)Py_PI / 180); + { + float eul[3]; + int x; + + for(x = 0; x < 3; x++) { + eul[x] = self->eul[x] * ((float)Py_PI / 180); + } + EulToMat3(eul, (float (*)[3]) mat); } - EulToMat3(eul, (float (*)[3]) mat); #else EulToMat3(self->eul, (float (*)[3]) mat); #endif @@ -234,7 +237,6 @@ static PyObject *Euler_Rotate(EulerObject * self, PyObject *args) { float angle = 0.0f; char *axis; - int x; if(!PyArg_ParseTuple(args, "fs", &angle, &axis)){ PyErr_SetString(PyExc_TypeError, "euler.rotate():expected angle (float) and axis (x,y,z)"); @@ -249,18 +251,25 @@ static PyObject *Euler_Rotate(EulerObject * self, PyObject *args) return NULL; #ifdef USE_MATHUTILS_DEG - //covert to radians - angle *= ((float)Py_PI / 180); - for(x = 0; x < 3; x++) { - self->eul[x] *= ((float)Py_PI / 180); + { + int x; + + //covert to radians + angle *= ((float)Py_PI / 180); + for(x = 0; x < 3; x++) { + self->eul[x] *= ((float)Py_PI / 180); + } } #endif euler_rot(self->eul, angle, *axis); #ifdef USE_MATHUTILS_DEG - //convert back from radians - for(x = 0; x < 3; x++) { - self->eul[x] *= (180 / (float)Py_PI); + { + int x; + //convert back from radians + for(x = 0; x < 3; x++) { + self->eul[x] *= (180 / (float)Py_PI); + } } #endif @@ -602,7 +611,7 @@ PyObject *newEulerObject(float *eul, int type, PyTypeObject *base_type) EulerObject *self; int x; - if(base_type) self = base_type->tp_alloc(base_type, 0); + if(base_type) self = (EulerObject *)base_type->tp_alloc(base_type, 0); else self = PyObject_NEW(EulerObject, &euler_Type); /* init callbacks as NULL */ diff --git a/source/blender/python/generic/quat.c b/source/blender/python/generic/quat.c index 81d69834469..a353f73c854 100644 --- a/source/blender/python/generic/quat.c +++ b/source/blender/python/generic/quat.c @@ -167,7 +167,6 @@ static PyObject *Quaternion_ToEuler(QuaternionObject * self, PyObject *args) { float eul[3]; EulerObject *eul_compat = NULL; - int x; if(!PyArg_ParseTuple(args, "|O!:toEuler", &euler_Type, &eul_compat)) return NULL; @@ -176,7 +175,7 @@ static PyObject *Quaternion_ToEuler(QuaternionObject * self, PyObject *args) return NULL; if(eul_compat) { - float mat[3][3], eul_compatf[3]; + float mat[3][3]; if(!BaseMath_ReadCallback(eul_compat)) return NULL; @@ -184,10 +183,15 @@ static PyObject *Quaternion_ToEuler(QuaternionObject * self, PyObject *args) QuatToMat3(self->quat, mat); #ifdef USE_MATHUTILS_DEG - for(x = 0; x < 3; x++) { - eul_compatf[x] = eul_compat->eul[x] * ((float)Py_PI / 180); + { + float eul_compatf[3]; + int x; + + for(x = 0; x < 3; x++) { + eul_compatf[x] = eul_compat->eul[x] * ((float)Py_PI / 180); + } + Mat3ToCompatibleEul(mat, eul, eul_compatf); } - Mat3ToCompatibleEul(mat, eul, eul_compatf); #else Mat3ToCompatibleEul(mat, eul, eul_compat->eul); #endif @@ -197,8 +201,12 @@ static PyObject *Quaternion_ToEuler(QuaternionObject * self, PyObject *args) } #ifdef USE_MATHUTILS_DEG - for(x = 0; x < 3; x++) { - eul[x] *= (180 / (float)Py_PI); + { + int x; + + for(x = 0; x < 3; x++) { + eul[x] *= (180 / (float)Py_PI); + } } #endif return newEulerObject(eul, Py_NEW, NULL); @@ -833,7 +841,7 @@ PyObject *newQuaternionObject(float *quat, int type, PyTypeObject *base_type) { QuaternionObject *self; - if(base_type) self = base_type->tp_alloc(base_type, 0); + if(base_type) self = (QuaternionObject *)base_type->tp_alloc(base_type, 0); else self = PyObject_NEW(QuaternionObject, &quaternion_Type); /* init callbacks as NULL */ diff --git a/source/blender/python/generic/vector.c b/source/blender/python/generic/vector.c index b4c74787e05..cf2396b30d4 100644 --- a/source/blender/python/generic/vector.c +++ b/source/blender/python/generic/vector.c @@ -1973,7 +1973,7 @@ PyObject *newVectorObject(float *vec, int size, int type, PyTypeObject *base_typ int i; VectorObject *self; - if(base_type) self = base_type->tp_alloc(base_type, 0); + if(base_type) self = (VectorObject *)base_type->tp_alloc(base_type, 0); else self = PyObject_NEW(VectorObject, &vector_Type); if(size > 4 || size < 2) diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 76c27dbbc22..42eb9c4c57a 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -351,9 +351,9 @@ static int bpy_run_script_init(bContext *C, SpaceScript * sc) return 1; } -int BPY_run_script_space_draw(struct bContext *C, SpaceScript * sc) +int BPY_run_script_space_draw(const struct bContext *C, SpaceScript * sc) { - if (bpy_run_script_init(C, sc)) { + if (bpy_run_script_init( (bContext *)C, sc)) { PyGILState_STATE gilstate = PyGILState_Ensure(); PyObject *result = PyObject_CallObject( sc->script->py_draw, NULL ); diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 21c3977fc0b..0d8f1be8c85 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -2269,36 +2269,6 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart*, } } -typedef struct { - float *vert; - float hoco[4]; - int clip; -} VertBucket; - -/* warning, not threaded! */ -static int hashlist_projectvert(float *v1, float winmat[][4], float *hoco) -{ - static VertBucket bucket[256], *buck; - - /* init static bucket */ - if(v1==NULL) { - memset(bucket, 0, 256*sizeof(VertBucket)); - return 0; - } - - buck= &bucket[ (((intptr_t)v1)/16) & 255 ]; - if(buck->vert==v1) { - QUATCOPY(hoco, buck->hoco); - return buck->clip; - } - - projectvert(v1, winmat, hoco); - buck->clip = testclip(hoco); - buck->vert= v1; - QUATCOPY(buck->hoco, hoco); - return buck->clip; -} - void zbuffer_shadow(Render *re, float winmat[][4], LampRen *lar, int *rectz, int size, float jitx, float jity) { ZbufProjectCache cache[ZBUF_PROJECT_CACHE_SIZE]; -- cgit v1.2.3