Fixed all gcc 4 warnings in blenkernel. Found 2 potentially harmful

unintialized variables in the verse code, verse_session.c:451 and
verse_object_node.c:339, those are properly initialized now.
This commit is contained in:
2006-10-26 23:34:44 +00:00
parent 47f579f514
commit 5376df2689
18 changed files with 116 additions and 33 deletions

View File

@@ -154,5 +154,50 @@ struct DispListMesh *NewBooleanMeshDLM(struct Object *ob, struct Object *ob_sele
struct DerivedMesh *NewBooleanDerivedMesh(struct Object *ob,
struct Object *ob_select, int int_op_type);
/* verse_*.c */
struct VerseVert;
struct VerseFace;
struct VerseSession;
struct VNode;
struct VTag;
struct VTagGroup;
struct VBitmapLayer;
struct VLink;
struct VLayer;
struct Mesh;
void post_vertex_create(struct VerseVert *vvert);
void post_vertex_set_xyz(struct VerseVert *vvert);
void post_vertex_delete(struct VerseVert *vvert);
void post_vertex_free_constraint(struct VerseVert *vvert);
void post_polygon_create(struct VerseFace *vface);
void post_polygon_set_corner(struct VerseFace *vface);
void post_polygon_delete(struct VerseFace *vface);
void post_polygon_free_constraint(struct VerseFace *vface);
void post_polygon_set_uint8(struct VerseFace *vface);
void post_node_create(struct VNode *vnode);
void post_node_destroy(struct VNode *vnode);
void post_node_name_set(struct VNode *vnode);
void post_tag_change(struct VTag *vtag);
void post_taggroup_create(struct VTagGroup *vtaggroup);
char *verse_client_name(void);
void post_transform(struct VNode *vnode);
void post_object_free_constraint(struct VNode *vnode);
void post_link_set(struct VLink *vlink);
void post_link_destroy(struct VLink *vlink);
void post_connect_accept(struct VerseSession *session);
void post_connect_terminated(struct VerseSession *session);
void post_connect_update(struct VerseSession *session);
void add_screenhandler(struct bScreen *sc, short eventcode, short val);
void post_bitmap_dimension_set(struct VNode *vnode);
void post_bitmap_layer_create(struct VBitmapLayer *vblayer);
void post_bitmap_layer_destroy(struct VBitmapLayer *vblayer);
void post_bitmap_tile_set(struct VBitmapLayer *vblayer, unsigned int xs, unsigned int ys);
void create_meshdata_from_geom_node(struct Mesh *me, struct VNode *vnode);
void post_geometry_free_constraint(struct VNode *vnode);
void post_layer_create(struct VLayer *vlayer);
void post_layer_destroy(struct VLayer *vlayer);
void post_server_add(void);
#endif

View File

@@ -222,8 +222,7 @@ void bglEnd(void) {}
/* booleanops.c */
struct DispListMesh *NewBooleanMeshDLM(struct Object *ob, struct Object *ob_select, int int_op_type) { return 0; }
struct DerivedMesh *NewBooleanDerivedMesh(struct Object *ob,
struct Object *ob_select, int int_op_type) {}
struct DerivedMesh *NewBooleanDerivedMesh(struct Object *ob, struct Object *ob_select, int int_op_type) { return 0; }
// bobj read/write debug messages
void elbeemDebugOut(char *msg) {}
@@ -232,7 +231,6 @@ void fluidsimSettingsCopy(struct FluidsimSettings* sb) {}
/*new render funcs */
int externtex(struct MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *tb, float *ta) { return 0; }
int multitex(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres) {return 0;}
struct Render *RE_GetRender(const char *name) {return (struct Render *)NULL;}
struct RenderResult *RE_GetResult(Render *re) {return (struct RenderResult *)NULL;}
float *RE_RenderLayerGetPass(RenderLayer *rl, int passtype) {return NULL;}
@@ -253,7 +251,7 @@ int multitex_ext(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, Te
return 1969;
}
/* verse*/
/* verse */
void post_vertex_create(struct VerseVert *vvert) {}
void post_vertex_set_xyz(struct VerseVert *vvert) {}
@@ -268,7 +266,7 @@ void post_node_create(struct VNode *vnode) {}
void post_node_destroy(struct VNode *vnode) {}
void post_node_name_set(struct VNode *vnode) {}
void post_tag_change(struct VTag *vtag) {}
void post_taggroup_create(struct VTag *vtag) {}
void post_taggroup_create(struct VTagGroup *vtaggroup) {}
char *verse_client_name(void) { return NULL; }
void post_transform(struct VNode *vnode) {}
void post_object_free_constraint(struct VNode *vnode) {}
@@ -281,7 +279,7 @@ void add_screenhandler(struct bScreen *sc, short eventcode, short val) {}
void post_bitmap_dimension_set(struct VNode *vnode) {}
void post_bitmap_layer_create(struct VBitmapLayer *vblayer) {}
void post_bitmap_layer_destroy(struct VBitmapLayer *vblayer) {}
void post_bitmap_tile_set(struct VBitmapLayer *vblayer) {}
void post_bitmap_tile_set(struct VBitmapLayer *vblayer, unsigned int xs, unsigned int ys) {}
void create_meshdata_from_geom_node(struct Mesh *me, struct VNode *vnode) {}
void post_geometry_free_constraint(struct VNode *vnode) {}
void post_layer_create(struct VLayer *vlayer) {}

View File

@@ -1079,6 +1079,35 @@ static void emDM_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(vo
glEnd();
}
}
static void emDM_drawUVEdges(DerivedMesh *dm)
{
EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
EditFace *efa;
glBegin(GL_LINES);
for(efa= emdm->em->faces.first; efa; efa= efa->next) {
if(!(efa->tf.flag&TF_HIDE)) {
glVertex2fv(efa->tf.uv[0]);
glVertex2fv(efa->tf.uv[1]);
glVertex2fv(efa->tf.uv[1]);
glVertex2fv(efa->tf.uv[2]);
if (!efa->v4) {
glVertex2fv(efa->tf.uv[2]);
glVertex2fv(efa->tf.uv[0]);
} else {
glVertex2fv(efa->tf.uv[2]);
glVertex2fv(efa->tf.uv[3]);
glVertex2fv(efa->tf.uv[3]);
glVertex2fv(efa->tf.uv[0]);
}
}
}
glEnd();
}
static void emDM__calcFaceCent(EditFace *efa, float cent[3], float (*vertexCos)[3])
{
if (vertexCos) {
@@ -1449,6 +1478,7 @@ static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, Object *ob,
emdm->dm.drawMappedEdges = emDM_drawMappedEdges;
emdm->dm.drawMappedEdgesInterp = emDM_drawMappedEdgesInterp;
emdm->dm.drawMappedFaces = emDM_drawMappedFaces;
emdm->dm.drawUVEdges = emDM_drawUVEdges;
emdm->dm.release = emDM_release;
@@ -1798,7 +1828,7 @@ static void ssDM_drawFacesTex_common(DerivedMesh *dm, int (*drawParams)(TFace *t
for (a=0; a<dlm->totface; a++, index++) {
MFace *mf= &mface[a];
TFace *tf = tface?&tface[a]:NULL;
int flag;
int flag = 0;
unsigned char *cp= NULL;
if (drawParams) {

View File

@@ -753,6 +753,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
if(use_dverts || armature_def_nr >= 0) {
if(dm) dvert = dm->getVertData(dm, i, LAYERTYPE_MDEFORMVERT);
else if(i < target_totvert) dvert = dverts + i;
else dvert = NULL;
} else
dvert = NULL;

View File

@@ -986,7 +986,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
med = CustomData_get_layer(&edgeData, LAYERTYPE_MEDGE);
for(i = 0; !BLI_edgehashIterator_isDone(ehi);
BLI_edgehashIterator_step(ehi), ++i, ++med) {
BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2);
BLI_edgehashIterator_getKey(ehi, (int*)&med->v1, (int*)&med->v2);
med->flag = ME_EDGEDRAW|ME_EDGERENDER;
}

View File

@@ -605,9 +605,9 @@ static void mesh_create_shadedColors(Render *re, Object *ob, int onlyForMesh, un
for (j=0; j<nverts; j++) {
MVert *mv= &dlm->mvert[vidx[j]];
unsigned char *col1= &col1base[j*4];
unsigned char *col2= col2base?&col2base[j*4]:NULL;
unsigned char *mcol= mcolbase?&mcolbase[j*4]:NULL;
char *col1= (char*)&col1base[j*4];
char *col2= (char*)(col2base?&col2base[j*4]:NULL);
char *mcol= (char*)(mcolbase?&mcolbase[j*4]:NULL);
float *vn = (mf->flag & ME_SMOOTH)?&vnors[3*vidx[j]]:n1;
VECCOPY(vec, mv->co);
@@ -1610,7 +1610,7 @@ void displistmesh_add_edges(DispListMesh *dlm)
for (i=0; !BLI_edgehashIterator_isDone(ehi); BLI_edgehashIterator_step(ehi)) {
MEdge *med = &dlm->medge[i++];
BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2);
BLI_edgehashIterator_getKey(ehi, (int*)&med->v1, (int*)&med->v2);
med->flag = ME_EDGEDRAW|ME_EDGERENDER;
}

View File

@@ -696,7 +696,7 @@ static int pdDoDeflection(RNG *rng, float opco[3], float npco[3], float opno[3],
MFace *mface, *deflection_face = NULL;
float *v1, *v2, *v3, *v4, *vcache=NULL;
float nv1[3], nv2[3], nv3[3], nv4[3], edge1[3], edge2[3];
float dv1[3], dv2[3], dv3[3];
float dv1[3] = {0}, dv2[3] = {0}, dv3[3] = {0};
float vect_to_int[3], refl_vel[3];
float d_intersect_co[3], d_intersect_vect[3], d_nvect[3], d_i_co_above[3];
float forcec[3];
@@ -709,7 +709,7 @@ static int pdDoDeflection(RNG *rng, float opco[3], float npco[3], float opno[3],
float perm_val, rdamp_val;
int a, deflected=0, deflected_now=0;
float t,t2, min_t;
float mat[3][3], obloc[3];
float mat[3][3], obloc[3] = {0};
int cur_frame;
float time_before, time_after;
float force_mag_norm;

View File

@@ -134,7 +134,7 @@ static int is_stl(char *str);
static int is_stl_ascii(char *str)
{
FILE *fpSTL;
unsigned char buffer[1000];
char buffer[1000];
int numread, i;
fpSTL = fopen(str, "rb");

View File

@@ -394,7 +394,7 @@ Material *give_current_material(Object *ob, int act)
Material ***matarar, *ma;
if(ob==NULL) return 0;
if(ob->totcol==NULL) return 0;
if(ob->totcol==0) return 0;
if(act>ob->totcol) act= ob->totcol;
else if(act<=0) act= 1;

View File

@@ -3249,7 +3249,7 @@ static void hookModifier_deformVerts(
Mesh *me = ob->data;
int index = 0;
int use_dverts;
int maxVerts;
int maxVerts = 0;
/* find the group (weak loop-in-loop) */
for(curdef = ob->defbase.first; curdef; curdef = curdef->next, index++)

View File

@@ -543,8 +543,8 @@ static void add_2nd_order_roller(Object *ob,float stiffness,int *counter, int ad
/*assume we have a softbody*/
SoftBody *sb= ob->soft; /* is supposed to be there */
BodyPoint *bp,*bpo;
BodySpring *bs,*bs2,*bs3;
int a,b,c,notthis,v0;
BodySpring *bs,*bs2,*bs3= NULL;
int a,b,c,notthis= 0,v0;
if (!sb->bspring){return;} /* we are 2nd order here so 1rst should have been build :) */
/* first run counting second run adding */
*counter = 0;

View File

@@ -68,7 +68,6 @@ static void change_layer_dimension(
{
struct VNode *vnode = vblayer->vnode;
unsigned int t_width = ((VBitmapData*)(vnode->data))->t_width;
unsigned int t_height = ((VBitmapData*)(vnode->data))->t_height;
unsigned int width = ((VBitmapData*)(vnode->data))->width;
unsigned int height = ((VBitmapData*)(vnode->data))->height;
unsigned int x, y, i, j;
@@ -138,6 +137,9 @@ static void *alloc_verse_bitmap_layer_data(VBitmapLayer *vblayer)
case VN_B_LAYER_REAL64:
data = (void*)MEM_mallocN(sizeof(double)*size, "VBLayer data float32");
break;
default:
data = NULL;
break;
}
return data;

View File

@@ -701,6 +701,7 @@ static void cb_node_create(
vnode->data = (void*)create_bitmap_data();
}
default:
vnode = NULL;
break;
}

View File

@@ -129,8 +129,8 @@ void send_verse_object_position(VNode *vnode)
*/
void send_verse_object_rotation(VNode *vnode)
{
float quat[4];
/* float bvec[3], vvec[3];*/
/* float quat[4];
float bvec[3], vvec[3];*/
VNQuat32 rot;
rot.x = ((VObjectData*)vnode->data)->rot[0];
@@ -360,6 +360,11 @@ static void cb_o_transform_pos_real32(
vec[1] = pos[1];
vec[2] = pos[2];
}
else {
vec[0] = 0.0f;
vec[1] = 0.0f;
vec[2] = 0.0f;
}
if(speed) {
vec[0] += speed[0]*dt;

View File

@@ -47,7 +47,7 @@
struct ListBase session_list={NULL, NULL};
struct ListBase server_list={NULL, NULL};
static cb_ping_registered = 0;
static int cb_ping_registered = 0;
/* list of static function prototypes */
static void cb_connect_terminate(const char *address, const char *bye);
@@ -117,12 +117,11 @@ static void cb_ping(void *user, const char *address, const char *message)
VMSServer **servers = verse_ms_list_parse(message);
if(servers != NULL)
{
int i, j;
int i;
for(i = 0; servers[i] != NULL; i++)
{
add_verse_server(servers[i]);
}
free(servers);
}
}
@@ -449,7 +448,7 @@ void b_verse_ms_get(void)
*/
void b_verse_connect(char *address)
{
VerseSession *session;
VerseSession *session = NULL;
/* if no session was created before, then set up all callbacks */
if((session_list.first==NULL) && (session_list.last==NULL))

View File

@@ -191,7 +191,7 @@ void append_avi(int frame, int *pixels, int rectx, int recty)
/* note that libavi free's the buffer... stupid interface - zr */
rectot= MEM_mallocN(rectx*recty*sizeof(int), "rectot");
rt1= rectot;
rt2= pixels + (recty-1)*rectx;
rt2= (unsigned int*)pixels + (recty-1)*rectx;
/* flip y and convert to abgr */
for (y=0; y < recty; y++, rt1+= rectx, rt2-= rectx) {
memcpy (rt1, rt2, rectx*sizeof(int));

View File

@@ -256,9 +256,9 @@ int frameserver_loop()
fd_set readfds;
struct timeval tv;
struct sockaddr_in addr;
int len;
int len, rval;
unsigned int socklen;
char buf[4096];
int rval;
if (connsock != -1) {
closesocket(connsock);
@@ -280,9 +280,9 @@ int frameserver_loop()
return -1;
}
len = sizeof(addr);
socklen = sizeof(addr);
if ((connsock = accept(sock, (struct sockaddr *)&addr, &len)) < 0) {
if ((connsock = accept(sock, (struct sockaddr *)&addr, &socklen)) < 0) {
return -1;
}
@@ -350,7 +350,7 @@ static void serve_ppm(int *pixels, int rectx, int recty)
target += 3;
src += 4;
}
safe_write(row, 3 * rectx);
safe_write((char*)row, 3 * rectx);
}
free(row);
closesocket(connsock);

View File

@@ -35,8 +35,10 @@
struct Object;
struct EditMesh;
struct EditVert;
struct EditFace;
struct Mesh;
struct MVert;
struct Mface;