quiet warnings and possible NULL checking crash fix for indentation functions.
authorCampbell Barton <ideasman42@gmail.com>
Fri, 20 Jan 2012 23:03:41 +0000 (23:03 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 20 Jan 2012 23:03:41 +0000 (23:03 +0000)
13 files changed:
build_files/cmake/cmake_static_check_cppcheck.py
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/movieclip.c
source/blender/blenkernel/intern/text.c
source/blender/blenlib/intern/math_rotation.c
source/blender/editors/armature/editarmature_retarget.c
source/blender/editors/space_buttons/buttons_context.c
source/blender/editors/space_script/script_edit.c
source/blender/editors/uvedit/uvedit_smart_stitch.c
source/blender/makesdna/DNA_sequence_types.h
source/blender/makesrna/intern/rna_nodetree.c

index 8720cb83054c8be369c64abdfd6321c83e03873d..6c13f3a079a12826d46a01a86468be393b71ef45 100644 (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
     ]
index 8dc568cd004827b0b70ae6b4b8b1dc01c731664b..6a2207d455ca1d164f48e2d3df87e20c1d918a70 100644 (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)
index ce337608cc5ee9452ae9b406c0c745570342af8c..0a80e8a3d56a01514e8e01cc73b3b446008ec2e6 100644 (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;
                }
                
        }
index f6bd321466c36ac986aad6923f90846e47200e3f..cba92e7a14c846e0fcff4ac6f4e5c446d9c49db5 100644 (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;
 }
 
index 3b1dc2973ad7fadd7cb54666121e0c9fed5214d9..bb8e420451fc55062fc9f289a2acd753de18f0a5 100644 (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);
index b8f37a90a4d5839d20605d9ec8b8367587a8f8dd..8e5cc8c48e3aaf958a5c1a8b9d09025bc97376e2 100644 (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;
index 5596b6f9f222b05c8a37985965f6b650a692385c..b0e6fe518106b8975f151850c174db961b68f333 100644 (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);
        }
 }
 
index 9ec27b69835f1a15736eb7905909ba128bdc4985..a8978a0bbde84897011991bc684da9a9e9a9ed10 100644 (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] == '&')
                {
index 4c028612320299e0e9e7b6e29f67ab0d5133a717..579814314923d553fe8dddc9d07e478f27669eb2 100644 (file)
@@ -1061,7 +1061,6 @@ ID *buttons_context_id_path(const bContext *C)
 
                        if(ptr->id.data) {
                                return ptr->id.data;
-                               break;
                        }
                }
        }
index b0c2de390a239332179d45fce8b732ba394542cf..7702e952e246a296d2038375291b4b69118a95e7 100644 (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)
index c4716f2e3ca2cf6efd2bdc23f221326b98c5c9e4..3731d348522d6eff3b7705484847b650e9a43318 100644 (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]);
index fa501de8d6d88a8ba88dc43b48ebdd7ce882641c..748769bd5d847268645b2f36f712be833ef7e69d 100644 (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
 
index a04ddec2098defb64b35dc1bb5cbba5355974767..989202f785c35551166ecb709c4ac2cb7239b959 100644 (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