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.
This commit is contained in:
Ton Roosendaal
2009-07-09 15:40:04 +00:00
parent 77c61f545f
commit 5e659c0b08
25 changed files with 95 additions and 110 deletions

View File

@@ -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;

View File

@@ -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];

View File

@@ -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);

View File

@@ -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);

View File

@@ -643,8 +643,8 @@ int BKE_ptcache_write_cache(PTCacheWriter *writer)
return 0;
for(i=0; i<writer->totelem; 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; i<writer->totelem; 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; i<writer->totelem; 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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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", "");

View File

@@ -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 */

View File

@@ -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;

View File

@@ -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);

View File

@@ -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)) {

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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

View File

@@ -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

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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)

View File

@@ -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 );

View File

@@ -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];