fixes for errors/warnings found with cppcheck
This commit is contained in:
@@ -182,11 +182,11 @@ AviError AVI_print_error (AviError in_error) {
|
||||
|
||||
return in_error;
|
||||
}
|
||||
|
||||
/*
|
||||
void AVI_set_debug (int mode) {
|
||||
AVI_DEBUG= mode;
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
int AVI_is_avi (char *name) {
|
||||
FILE *fp;
|
||||
|
||||
@@ -352,7 +352,8 @@ int cdf_write_open(CDataFile *cdf, char *filename)
|
||||
|
||||
/* fill header */
|
||||
header= &cdf->header;
|
||||
strcpy(header->ID, "BCDF");
|
||||
/* strcpy(, "BCDF"); // terminator out of range */
|
||||
header->ID[0]= 'B'; header->ID[1]= 'C'; header->ID[2]= 'D'; header->ID[3]= 'F';
|
||||
header->endian= cdf_endian();
|
||||
header->version= CDF_VERSION;
|
||||
header->subversion= CDF_SUBVERSION;
|
||||
|
||||
@@ -52,13 +52,3 @@
|
||||
* since we have to force clearing all Python related data before freeing
|
||||
* Blender's library. Still testing, will decide later (Willian). */
|
||||
|
||||
//XXX
|
||||
#if 0
|
||||
void free_script (Script *script)
|
||||
{
|
||||
if (!script) return;
|
||||
#ifndef DISABLE_PYTHON
|
||||
BPY_clear_script(script);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -159,7 +159,7 @@ int BLI_gzip(char *from, char *to) {
|
||||
|
||||
file = open(from,O_BINARY|O_RDONLY);
|
||||
|
||||
if ( -1 == file ) return -2;
|
||||
if (file < 0) return -2;
|
||||
|
||||
while ( 1 )
|
||||
{
|
||||
|
||||
@@ -440,7 +440,7 @@ int BLI_filepathsize(const char *path)
|
||||
{
|
||||
int size, file = open(path, O_BINARY|O_RDONLY);
|
||||
|
||||
if (file <= 0)
|
||||
if (file < 0)
|
||||
return -1;
|
||||
|
||||
size = BLI_filesize(file);
|
||||
|
||||
@@ -230,12 +230,8 @@ void CutEdgeloop(Object *obedit, wmOperator *op, EditMesh *em, int numcuts)
|
||||
nearest = findnearestedge(&vc, &dist); // returns actual distance in dist
|
||||
// scrarea_do_windraw(curarea); // after findnearestedge, backbuf!
|
||||
|
||||
sprintf(msg,"Number of Cuts: %d",numcuts);
|
||||
if(smooth){
|
||||
sprintf(msg,"%s (S)mooth: on",msg);
|
||||
} else {
|
||||
sprintf(msg,"%s (S)mooth: off",msg);
|
||||
}
|
||||
sprintf(msg,"Number of Cuts: %d (S)mooth: ",numcuts);
|
||||
strcat(msg, smooth ? "on":"off");
|
||||
|
||||
// headerprint(msg);
|
||||
/* Need to figure preview */
|
||||
|
||||
@@ -3803,15 +3803,15 @@ int PE_minmax(Scene *scene, float *min, float *max)
|
||||
{
|
||||
Object *ob= OBACT;
|
||||
PTCacheEdit *edit= PE_get_current(scene, ob);
|
||||
ParticleSystem *psys = edit->psys;
|
||||
ParticleSystem *psys;
|
||||
ParticleSystemModifierData *psmd = NULL;
|
||||
POINT_P; KEY_K;
|
||||
float co[3], mat[4][4];
|
||||
int ok= 0;
|
||||
|
||||
if(!edit) return ok;
|
||||
|
||||
if(psys)
|
||||
|
||||
if((psys = edit->psys))
|
||||
psmd= psys_get_modifier(ob, psys);
|
||||
else
|
||||
unit_m4(mat);
|
||||
|
||||
@@ -298,7 +298,6 @@ static int buttons_context_path_particle(ButsContextPath *path)
|
||||
static int buttons_context_path_brush(const bContext *C, ButsContextPath *path)
|
||||
{
|
||||
Scene *scene;
|
||||
ToolSettings *ts;
|
||||
Brush *br= NULL;
|
||||
PointerRNA *ptr= &path->ptr[path->len-1];
|
||||
|
||||
@@ -309,7 +308,6 @@ static int buttons_context_path_brush(const bContext *C, ButsContextPath *path)
|
||||
/* if we have a scene, use the toolsettings brushes */
|
||||
else if(buttons_context_path_scene(path)) {
|
||||
scene= path->ptr[path->len-1].data;
|
||||
ts= scene->toolsettings;
|
||||
|
||||
if(scene)
|
||||
br= paint_brush(paint_get_active(scene));
|
||||
|
||||
@@ -402,12 +402,12 @@ void drawaxes(float size, int flag, char drawtype)
|
||||
break;
|
||||
|
||||
case OB_EMPTY_SPHERE:
|
||||
draw_empty_sphere(size);
|
||||
break;
|
||||
draw_empty_sphere(size);
|
||||
break;
|
||||
|
||||
case OB_EMPTY_CONE:
|
||||
draw_empty_cone(size);
|
||||
break;
|
||||
draw_empty_cone(size);
|
||||
break;
|
||||
|
||||
case OB_ARROWS:
|
||||
default:
|
||||
@@ -1361,7 +1361,7 @@ static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, float *v0
|
||||
view3d_project_short_noclip(data->vc.ar, v1co, s[1]);
|
||||
|
||||
if (data->clipVerts==2) {
|
||||
if (!(s[0][0]>=0 && s[0][1]>= 0 && s[0][0]<data->vc.ar->winx && s[0][1]<data->vc.ar->winy))
|
||||
if (!(s[0][0]>=0 && s[0][1]>= 0 && s[0][0]<data->vc.ar->winx && s[0][1]<data->vc.ar->winy))
|
||||
if (!(s[1][0]>=0 && s[1][1]>= 0 && s[1][0]<data->vc.ar->winx && s[1][1]<data->vc.ar->winy))
|
||||
return;
|
||||
}
|
||||
@@ -2399,7 +2399,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(v3d->zbuf) {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -2971,7 +2971,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
|
||||
finalDM = cageDM = editmesh_get_derived_base(ob, em);
|
||||
else
|
||||
cageDM = editmesh_get_derived_cage_and_final(scene, ob, em, &finalDM,
|
||||
v3d->customdata_mask);
|
||||
v3d->customdata_mask);
|
||||
|
||||
if(dt>OB_WIRE) {
|
||||
// no transp in editmode, the fancy draw over goes bad then
|
||||
@@ -4003,11 +4003,13 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
|
||||
sprintf(val, " %i", a);
|
||||
|
||||
if(part->draw&PART_DRAW_NUM && part->draw&PART_DRAW_HEALTH)
|
||||
sprintf(val, "%s:", val);
|
||||
|
||||
if(part->draw&PART_DRAW_HEALTH && a < totpart && part->phystype==PART_PHYS_BOIDS)
|
||||
sprintf(val, "%s %.2f", val, pa_health);
|
||||
strcat(val, ":");
|
||||
|
||||
if(part->draw&PART_DRAW_HEALTH && a < totpart && part->phystype==PART_PHYS_BOIDS) {
|
||||
char tval[8];
|
||||
sprintf(tval, " %.2f", pa_health);
|
||||
strcat(val, tval);
|
||||
}
|
||||
/* in path drawing state.co is the end point */
|
||||
view3d_cached_text_draw_add(state.co[0], state.co[1], state.co[2], val, 0);
|
||||
}
|
||||
@@ -4826,7 +4828,7 @@ static void draw_empty_sphere (float size)
|
||||
static void draw_empty_cone (float size)
|
||||
{
|
||||
float cent=0;
|
||||
float radius;
|
||||
float radius;
|
||||
GLUquadricObj *qobj = gluNewQuadric();
|
||||
gluQuadricDrawStyle(qobj, GLU_SILHOUETTE);
|
||||
|
||||
@@ -4946,11 +4948,11 @@ static void drawspiral(float *cent, float rad, float tmat[][4], int start)
|
||||
*/
|
||||
static void drawcircle_size(float size)
|
||||
{
|
||||
float x, y;
|
||||
float x, y;
|
||||
short degrees;
|
||||
|
||||
glBegin(GL_LINE_LOOP);
|
||||
|
||||
|
||||
/* coordinates are: cos(degrees*11.25)=x, sin(degrees*11.25)=y, 0.0f=z */
|
||||
for (degrees=0; degrees<32; degrees++) {
|
||||
x= *(cosval + degrees);
|
||||
@@ -5824,7 +5826,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
|
||||
float selboxw;
|
||||
|
||||
cpack(0xffffff);
|
||||
set_inverted_drawing(1);
|
||||
set_inverted_drawing(1);
|
||||
for (i=0; i<(selend-selstart+1); i++) {
|
||||
SelBox *sb = &(cu->selboxes[i]);
|
||||
|
||||
@@ -5839,12 +5841,12 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
|
||||
}
|
||||
glBegin(GL_QUADS);
|
||||
glVertex3f(sb->x, sb->y, 0.001);
|
||||
glVertex3f(sb->x+selboxw, sb->y, 0.001);
|
||||
glVertex3f(sb->x+selboxw, sb->y, 0.001);
|
||||
glVertex3f(sb->x+selboxw, sb->y+sb->h, 0.001);
|
||||
glVertex3f(sb->x, sb->y+sb->h, 0.001);
|
||||
glEnd();
|
||||
}
|
||||
set_inverted_drawing(0);
|
||||
set_inverted_drawing(0);
|
||||
}
|
||||
}
|
||||
else if(dt==OB_BOUNDBOX)
|
||||
|
||||
@@ -829,7 +829,7 @@ static void draw_selected_name(Scene *scene, Object *ob, View3D *v3d)
|
||||
if(kb){
|
||||
sprintf(shapes, ": %s ", kb->name);
|
||||
if(ob->shapeflag == OB_SHAPE_LOCK){
|
||||
sprintf(shapes, "%s (Pinned)",shapes);
|
||||
strcat(shapes, " (Pinned)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ struct ImBuf *IMB_loadiffname(const char *naam, int flags) {
|
||||
|
||||
file = open(naam, O_BINARY|O_RDONLY);
|
||||
|
||||
if (file == -1) return (0);
|
||||
if (file < 0) return (0);
|
||||
|
||||
ibuf= IMB_loadifffile(file, flags);
|
||||
|
||||
@@ -304,7 +304,7 @@ struct ImBuf *IMB_testiffname(char *naam,int flags) {
|
||||
flags |= IB_test;
|
||||
file = open(naam,O_BINARY|O_RDONLY);
|
||||
|
||||
if (file<=0) return (0);
|
||||
if (file < 0) return (0);
|
||||
|
||||
ibuf=IMB_loadifffile(file,flags);
|
||||
if (ibuf) {
|
||||
|
||||
@@ -296,7 +296,10 @@ short imb_savetarga(struct ImBuf * ibuf, char *name, int flags)
|
||||
|
||||
if (ibuf->cmap){
|
||||
for (i = 0 ; i<ibuf->maxcol ; i++){
|
||||
if (fwrite(((uchar *)(ibuf->cmap + i)) + 1,1,3,fildes) != 3) return (0);
|
||||
if (fwrite(((uchar *)(ibuf->cmap + i)) + 1,1,3,fildes) != 3) {
|
||||
fclose(fildes);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +129,6 @@ extern "C" {
|
||||
// void BPY_spacescript_do_pywin_draw( struct SpaceScript *sc );
|
||||
// void BPY_spacescript_do_pywin_event( struct SpaceScript *sc,
|
||||
// unsigned short event, short val, char ascii );
|
||||
// void BPY_clear_script( struct Script *script );
|
||||
// void BPY_free_finished_script( struct Script *script );
|
||||
// void BPY_scripts_clear_pyobjects( void );
|
||||
//
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
//void BPY_run_python_script() {}
|
||||
//void BPY_start_python() {}
|
||||
void BPY_call_importloader() {}
|
||||
void BPY_clear_script() {}
|
||||
//void BPY_free_compiled_text() {}
|
||||
void BPY_pyconstraint_eval() {}
|
||||
void BPY_pyconstraint_target() {}
|
||||
|
||||
@@ -5200,7 +5200,7 @@ static int load_fluidsimspeedvectors(Render *re, ObjectInstanceRen *obi, float *
|
||||
float mat[4][4], winmat[4][4];
|
||||
float imat[4][4];
|
||||
FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(fsob, eModifierType_Fluidsim);
|
||||
FluidsimSettings *fss = fluidmd->fss;
|
||||
FluidsimSettings *fss;
|
||||
float *velarray = NULL;
|
||||
|
||||
/* only one step needed */
|
||||
|
||||
Reference in New Issue
Block a user