quiet warnings and possible NULL checking crash fix for indentation functions.

This commit is contained in:
Campbell Barton 2012-01-20 23:03:41 +00:00
parent f08a8c5b15
commit a98a75346c
13 changed files with 29 additions and 23 deletions

View File

@ -37,7 +37,8 @@ CHECKER_BIN = "cppcheck"
CHECKER_ARGS = [
# not sure why this is needed, but it is.
"-I" + os.path.join(project_source_info.SOURCE_DIR, "extern", "glew", "include"),
"--suppress=*:%s/extern/glew/include/GL/glew.h:241" % project_source_info.SOURCE_DIR,
# "--max-configs=1", # speeds up execution
# "--check-config", # when includes are missing
# "--enable=all", # if you want sixty hundred pedantic suggestions
]

View File

@ -188,11 +188,12 @@ typedef struct ImgSeqFormatData {
Vec3f *barycentricWeights; /* b-weights for all pixel samples */
} ImgSeqFormatData;
#if 0 /* UNUSED */
typedef struct EffVelPoint {
float previous_pos[3];
float previous_vel[3];
} EffVelPoint;
#endif
/* adjacency data flags */
#define ADJ_ON_MESH_EDGE (1<<0)

View File

@ -1111,9 +1111,9 @@ int BKE_add_image_extension(char *string, const char imtype)
if(BLI_testextensie_array(string, imb_ext_image)
|| (G.have_quicktime && BLI_testextensie_array(string, imb_ext_image_qt))) {
return BLI_replace_extension(string, FILE_MAX, extension);
} else {
}
else {
return BLI_ensure_extension(string, FILE_MAX, extension);
return TRUE;
}
}

View File

@ -1292,11 +1292,11 @@ float (*mesh_getVertexCos(Mesh *me, int *numVerts_r))[3]
{
int i, numVerts = me->totvert;
float (*cos)[3] = MEM_mallocN(sizeof(*cos)*numVerts, "vertexcos1");
if (numVerts_r) *numVerts_r = numVerts;
for (i=0; i<numVerts; i++)
copy_v3_v3(cos[i], me->mvert[i].co);
return cos;
}

View File

@ -981,7 +981,7 @@ static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, i
{
char name[FILE_MAX];
int quality, rectx, recty;
int size= size= rendersize_to_number(proxy_render_size);
int size= rendersize_to_number(proxy_render_size);
ImBuf *scaleibuf;
get_proxy_fname(clip, proxy_render_size, undistorted, cfra, name);

View File

@ -2751,15 +2751,19 @@ void txt_indent(Text *text)
/* hardcoded: TXT_TABSIZE = 4 spaces: */
int spaceslen = TXT_TABSIZE;
if (ELEM3(NULL, text, text->curl, text->sell)) {
return;
}
if (!text) return;
if (!text->curl) return;
if (!text->sell) return;
/* insert spaces rather than tabs */
if (text->flags & TXT_TABSTOSPACES){
add = tab_to_spaces;
indentlen = spaceslen;
}
if (!text) return;
if (!text->curl) return;
if (!text->sell) return;
num = 0;
while (TRUE)
@ -2812,16 +2816,16 @@ void txt_unindent(Text *text)
/* hardcoded: TXT_TABSIZE = 4 spaces: */
int spaceslen = TXT_TABSIZE;
if (!text) return;
if (!text->curl) return;
if (!text->sell) return;
/* insert spaces rather than tabs */
if (text->flags & TXT_TABSTOSPACES){
remove = tab_to_spaces;
indent = spaceslen;
}
if (!text) return;
if (!text->curl) return;
if (!text->sell) return;
while(TRUE)
{
int i = 0;

View File

@ -811,7 +811,7 @@ void single_axis_angle_to_mat3(float mat[3][3], const char axis, const float ang
mat[2][2] = 1.0f;
break;
default:
assert("invalid axis");
assert(0);
}
}

View File

@ -450,7 +450,7 @@ static void renameTemplateBone(char *name, char *template_name, ListBase *editbo
{
int i, j;
for (i = 0, j = 0; template_name[i] != '\0' && i < (MAXBONENAME-1) && j < (MAXBONENAME-1); i++)
for (i = 0, j = 0; i < (MAXBONENAME-1) && j < (MAXBONENAME-1) && template_name[i] != '\0'; i++)
{
if (template_name[i] == '&')
{

View File

@ -1061,7 +1061,6 @@ ID *buttons_context_id_path(const bContext *C)
if(ptr->id.data) {
return ptr->id.data;
break;
}
}
}

View File

@ -96,8 +96,8 @@ static int script_reload_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
#else
(void)C; /* unused */
#endif
return OPERATOR_CANCELLED;
#endif
}
void SCRIPT_OT_reload(wmOperatorType *ot)

View File

@ -912,12 +912,13 @@ static void stitch_select_uv(UvElement *element, StitchState *stitch_state, int
}
}
static void stitch_calculate_edge_normal(EditMesh *em, UvEdge *edge, float *normal){
static void stitch_calculate_edge_normal(EditMesh *em, UvEdge *edge, float *normal)
{
UvElement *element = edge->element;
EditFace *efa = element->face;
MTFace *mt = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
int nverts = efa->v4?4 : 3;
int index = index = (element->tfindex + 2)%nverts;
int index = (element->tfindex + 2)%nverts;
float tangent[2], internal[2];
sub_v2_v2v2(tangent, mt->uv[(element->tfindex + 1)%nverts], mt->uv[element->tfindex]);

View File

@ -353,7 +353,7 @@ typedef struct SpeedControlVars {
*/
#define SEQ_HAS_PATH(_seq) (ELEM5((_seq)->type, SEQ_MOVIE, SEQ_IMAGE, SEQ_SOUND, SEQ_RAM_SOUND, SEQ_HD_SOUND))
#define SEQ_HAS_PATH(_seq) (ELEM4((_seq)->type, SEQ_MOVIE, SEQ_IMAGE, SEQ_RAM_SOUND, SEQ_HD_SOUND))
#endif

View File

@ -3071,7 +3071,7 @@ static void rna_def_node_socket_subtype(BlenderRNA *brna, int type, int subtype,
};
#undef SUBTYPE
#define SUBTYPE(socktype, stypename, id, idname) if (subtype==PROP_##id) propsubtype = PROP_##id;
#define SUBTYPE(socktype, stypename, id, idname) if (subtype == (PROP_##id)) propsubtype = PROP_##id;
NODE_DEFINE_SUBTYPES
#undef SUBTYPE