use replace 0 with NULL for pointers, set some functions static
authorCampbell Barton <ideasman42@gmail.com>
Fri, 16 Sep 2011 08:20:21 +0000 (08:20 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 16 Sep 2011 08:20:21 +0000 (08:20 +0000)
also fixed own errors in recent static check commit.

24 files changed:
build_files/cmake/cmake_static_check_cppcheck.py
build_files/cmake/cmake_static_check_sparse.py
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/node.c
source/blender/blenlib/intern/string_utf8.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/animation/keyframes_edit.c
source/blender/editors/curve/curve_ops.c
source/blender/editors/sound/sound_intern.h
source/blender/editors/sound/sound_ops.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_outliner/outliner_edit.c
source/blender/editors/space_outliner/outliner_tools.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/gpu/intern/gpu_buffers.c
source/blender/imbuf/intern/indexer.c
source/blender/imbuf/intern/jp2.c
source/blender/modifiers/intern/MOD_weightvg_util.c
source/blender/nodes/composite/node_composite_tree.c
source/blender/nodes/composite/nodes/node_composite_diffMatte.c
source/blender/python/intern/bpy_app_handlers.c
source/blender/python/intern/gpu.c
source/blender/render/intern/source/envmap.c
source/blender/render/intern/source/pipeline.c

index 9b03bbf3982eb261ca6ef15a0ff9a0d90dea5350..4249537eca8fcbe73aca427139f7efbd13131549 100644 (file)
 
 # <pep8 compliant>
 
+import project_source_info
+import subprocess
+import sys
+import os
+
 CHECKER_IGNORE_PREFIX = [
     "extern",
     "intern/moto",
@@ -31,15 +36,11 @@ CHECKER_IGNORE_PREFIX = [
 CHECKER_BIN = "cppcheck"
 
 CHECKER_ARGS = [
-    "-I/dsk/data/src/blender/blender/extern/glew/include",
+    "-I" + os.join(project_source_info.SORCE_DIR, "blender/extern/glew/include"),
     #  "--check-config", # when includes are missing
     #  "--enable=all",  # if you want sixty hundred pedantic suggestions
     ]
 
-import project_source_info
-import subprocess
-import sys
-
 def main():
     source_info = project_source_info.build_info(ignore_prefix_list=CHECKER_IGNORE_PREFIX)
 
index 8b300548c4203f26b8d7fd82a38ba5fbcc56add6..740569708b5b8da7c53609993f29d8a4fadfb3cb 100644 (file)
@@ -23,7 +23,7 @@
 
 # <pep8 compliant>
 
-CHECKER_IGNORE_SUFFIX = [
+CHECKER_IGNORE_PREFIX = [
     "extern",
     "intern/moto",
     ]
index f75773d754adcc60b66ecb1b05ef26a94b00e72a..73ddcbecf94d7ef401061762f9dca41c15a301b5 100644 (file)
@@ -117,7 +117,7 @@ static void make_localact_apply_cb(ID *id, AnimData *adt, void *mlac_ptr)
        tMakeLocalActionContext *mlac = (tMakeLocalActionContext *)mlac_ptr;
        
        if (adt->action == mlac->act) {
-               if (id->lib==0) {
+               if (id->lib == NULL) {
                        adt->action = mlac->actn;
                        
                        id_us_plus(&mlac->actn->id);
index d40b030c4704a3e19616eb3bb5c893f77f0c1dfc..89fd3ff9c1384d228cde6b1dd624be3e0b5586d1 100644 (file)
@@ -1051,9 +1051,9 @@ void ntreeMakeLocal(bNodeTree *ntree)
        
        if(ntree->id.lib==NULL) return;
        if(ntree->id.us==1) {
-               ntree->id.lib= 0;
+               ntree->id.lib= NULL;
                ntree->id.flag= LIB_LOCAL;
-               new_id(0, (ID *)ntree, 0);
+               new_id(NULL, (ID *)ntree, NULL);
                return;
        }
        
@@ -1069,7 +1069,7 @@ void ntreeMakeLocal(bNodeTree *ntree)
        if(cd.local && cd.lib==0) {
                ntree->id.lib= NULL;
                ntree->id.flag= LIB_LOCAL;
-               new_id(0, (ID *)ntree, 0);
+               new_id(NULL, (ID *)ntree, NULL);
        }
        else if(cd.local && cd.lib) {
                /* this is the mixed case, we copy the tree and assign it to local users */
@@ -1438,7 +1438,7 @@ static void ntree_update_link_pointers(bNodeTree *ntree)
        }
 }
 
-void ntree_validate_links(bNodeTree *ntree)
+static void ntree_validate_links(bNodeTree *ntree)
 {
        bNodeTreeType *ntreetype = ntreeGetType(ntree->type);
        bNodeLink *link;
index 818666e7529b7d1adfd0e5159b9ee6d332be877a..961a41690f74ee6a2cd74a2226e729dc29fbcb2a 100644 (file)
@@ -32,6 +32,8 @@
 
 #include <string.h>
 
+#include "BLI_string.h"
+
 /* from libswish3, originally called u8_isvalid(),
  * modified to return the index of the bad character (byte index not utf).
  * http://svn.swish-e.org/libswish3/trunk/src/libswish3/utf8.c r3044 - campbell */
index bb710a3279420bef13fb01152246db120960f81b..bd5935c893c7b461e619c3ce873c69039a371537 100644 (file)
@@ -893,7 +893,7 @@ static size_t skip_fcurve_selected_data (bDopeSheet *ads, FCurve *fcu, ID *owner
  */
 static short skip_fcurve_with_name (bDopeSheet *ads, FCurve *fcu, ID *owner_id)
 {
-       bAnimListElem ale_dummy = {0};
+       bAnimListElem ale_dummy = {NULL};
        bAnimChannelType *acf;
        
        /* create a dummy wrapper for the F-Curve */
index 2305848e7b3e946e029bc2506f71d12817491763..fa619e4cf44216464361291df93efc19e20cf1c8 100644 (file)
@@ -204,8 +204,8 @@ static short ob_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Object *o
        int filter;
        int ret=0;
        
-       bAnimListElem dummychan = {0};
-       Base dummybase = {0};
+       bAnimListElem dummychan = {NULL};
+       Base dummybase = {NULL};
        
        if (ob == NULL)
                return 0;
@@ -249,7 +249,7 @@ static short scene_keyframes_loop(KeyframeEditData *ked, bDopeSheet *ads, Scene
        int filter;
        int ret=0;
        
-       bAnimListElem dummychan = {0};
+       bAnimListElem dummychan = {NULL};
        
        if (sce == NULL)
                return 0;
index adf4f0fac2ed1bbad547a8b45aa8d3c1d24c7b73..6b85523ac825521ab86199fa580610fd0cb37489 100644 (file)
@@ -46,6 +46,7 @@
 #include "WM_api.h"
 #include "WM_types.h"
 
+#include "ED_curve.h"
 #include "ED_object.h"
 #include "ED_screen.h"
 #include "ED_transform.h"
index b17ef99132f73b4ea787421e589a5119f9dc7d6d..cde0b3c44798186b06334223b4e8ad5dfbb5c627 100644 (file)
@@ -36,7 +36,5 @@
 
 struct wmOperatorType;
 
-void SOUND_OT_open(wmOperatorType *ot);
-
 #endif /* ED_SOUND_INTERN_H */
 
index 19cae6aa67dba936ccd27fc3fd55297ca60271db..60d665de94ceee5f9e13c8371cb4838aff293853 100644 (file)
@@ -175,7 +175,7 @@ static int open_invoke(bContext *C, wmOperator *op, wmEvent *event)
        return WM_operator_filesel(C, op, event);
 }
 
-void SOUND_OT_open(wmOperatorType *ot)
+static void SOUND_OT_open(wmOperatorType *ot)
 {
        /* identifiers */
        ot->name= "Open Sound";
@@ -196,7 +196,7 @@ void SOUND_OT_open(wmOperatorType *ot)
        RNA_def_boolean(ot->srna, "mono", FALSE, "Mono", "Mixdown the sound to mono.");
 }
 
-void SOUND_OT_open_mono(wmOperatorType *ot)
+static void SOUND_OT_open_mono(wmOperatorType *ot)
 {
        /* identifiers */
        ot->name= "Open Sound Mono";
@@ -659,7 +659,7 @@ static int update_animation_flags_exec(bContext *C, wmOperator *UNUSED(op))
        return OPERATOR_FINISHED;
 }
 
-void SOUND_OT_update_animation_flags(wmOperatorType *ot)
+static void SOUND_OT_update_animation_flags(wmOperatorType *ot)
 {
        /*
          This operator is needed to set a correct state of the sound animation
@@ -703,7 +703,7 @@ static int bake_animation_exec(bContext *C, wmOperator *UNUSED(op))
        return OPERATOR_FINISHED;
 }
 
-void SOUND_OT_bake_animation(wmOperatorType *ot)
+static void SOUND_OT_bake_animation(wmOperatorType *ot)
 {
        /* identifiers */
        ot->name= "Update animation cache";
index 9ea1e8ee8779854f71528faf767031411a0dc365..cd521f7e8c712dc0e5e3ccba9f2523f589b98baa 100644 (file)
@@ -97,7 +97,7 @@ static void node_sync_cb(bContext *UNUSED(C), void *snode_v, void *node_v)
        }
 }
 
-void node_socket_button_default(const bContext *C, uiBlock *block,
+static void node_socket_button_default(const bContext *C, uiBlock *block,
                                                                bNodeTree *ntree, bNode *node, bNodeSocket *sock,
                                                                const char *name, int x, int y, int width)
 {
@@ -135,7 +135,7 @@ static uiBlock *socket_component_menu(bContext *C, ARegion *ar, void *args_v)
        
        return block;
 }
-void node_socket_button_components(const bContext *C, uiBlock *block,
+static void node_socket_button_components(const bContext *C, uiBlock *block,
                                                                   bNodeTree *ntree, bNode *node, bNodeSocket *sock,
                                                                   const char *name, int x, int y, int width)
 {
@@ -157,7 +157,7 @@ void node_socket_button_components(const bContext *C, uiBlock *block,
        uiDefBlockButN(block, socket_component_menu, args, name, x, y+1, width, NODE_DY-2, "");
 }
 
-void node_socket_button_color(const bContext *C, uiBlock *block,
+static void node_socket_button_color(const bContext *C, uiBlock *block,
                                                          bNodeTree *ntree, bNode *node, bNodeSocket *sock,
                                                          const char *name, int x, int y, int width)
 {
@@ -179,7 +179,7 @@ void node_socket_button_color(const bContext *C, uiBlock *block,
 
 /* ****************** BASE DRAW FUNCTIONS FOR NEW OPERATOR NODES ***************** */
 
-void node_draw_socket_new(bNodeSocket *sock, float size)
+static void node_draw_socket_new(bNodeSocket *sock, float size)
 {
        float x=sock->locx, y=sock->locy;
        
index ada4bc6f8476f2cfa243502724855781b556c298..6172273f7e174c2dde26cd50fdd54daef3cfe207 100644 (file)
@@ -218,7 +218,7 @@ void OUTLINER_OT_item_openclose(wmOperatorType *ot)
 
 /* Rename --------------------------------------------------- */
 
-void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports)
+static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, ReportList *reports)
 {
        /* can't rename rna datablocks entries */
        if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))
index b2fdd34aab207a67e3acaaa13d3cbbe77f4fd5e5..efbfbd51fb5e0d102db7d6725344f85233ea8d75 100644 (file)
@@ -342,7 +342,7 @@ static void singleuser_action_cb(bContext *C, Scene *UNUSED(scene), TreeElement
        
        if (id) {
                IdAdtTemplate *iat = (IdAdtTemplate *)tsep->id;
-               PointerRNA ptr = {{0}};
+               PointerRNA ptr = {{NULL}};
                PropertyRNA *prop;
                
                RNA_pointer_create(&iat->id, &RNA_AnimData, iat->adt, &ptr);
index e7673651546052e8a2ffd52f5135ce77f9904acb..c3165adaf4931e87b68a581953e2a33bde9e2322 100644 (file)
@@ -188,7 +188,7 @@ static void proxy_endjob(void *UNUSED(customdata))
 
 }
 
-void seq_proxy_build_job(const bContext *C, Sequence * seq)
+static void seq_proxy_build_job(const bContext *C, Sequence * seq)
 {
        wmJob * steve;
        ProxyJob *pj;
index 4d4561e66db514290f423da34353af88df14ede2..ce3a378ea0098b13faf7ddc43c3772114bd0c855 100644 (file)
@@ -240,7 +240,7 @@ GPUBuffer *GPU_buffer_alloc(int size)
                   size */
                glGenBuffersARB(1, &buf->id);
                glBindBufferARB(GL_ARRAY_BUFFER_ARB, buf->id);
-               glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, 0, GL_STATIC_DRAW_ARB);
+               glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, GL_STATIC_DRAW_ARB);
                glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
        }
        else {
@@ -493,7 +493,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
 
        /* nothing to do for legacy mode */
        if(dm->drawObject->legacy)
-               return 0;
+               return NULL;
 
        cur_index_per_mat = MEM_mallocN(sizeof(int)*object->totmaterial,
                                        "GPU_buffer_setup.cur_index_per_mat");
@@ -513,7 +513,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object,
                        /* bind the buffer and discard previous data,
                           avoids stalling gpu */
                        glBindBufferARB(target, buffer->id);
-                       glBufferDataARB(target, buffer->size, 0, GL_STATIC_DRAW_ARB);
+                       glBufferDataARB(target, buffer->size, NULL, GL_STATIC_DRAW_ARB);
 
                        /* attempt to map the buffer */
                        if(!(varray = glMapBufferARB(target, GL_WRITE_ONLY_ARB))) {
index 3528318ba819868a7746522647ea64aea03dc3a2..2e45c0eb07abb6d9d1ebaa483f915dee8d494f00 100644 (file)
@@ -159,24 +159,24 @@ struct anim_index * IMB_indexer_open(const char * name)
        int i;
 
        if (!fp) {
-               return 0;
+               return NULL;
        }
 
        if (fread(header, 12, 1, fp) != 1) {
                fclose(fp);
-               return 0;
+               return NULL;
        }
 
        header[12] = 0;
 
        if (memcmp(header, magic, 8) != 0) {
                fclose(fp);
-               return 0;
+               return NULL;
        }
 
        if (atoi(header+9) != INDEX_FILE_VERSION) {
                fclose(fp);
-               return 0;
+               return NULL;
        }
 
        idx = MEM_callocN( sizeof(struct anim_index), "anim_index");
@@ -916,7 +916,7 @@ static AviMovie * alloc_proxy_output_avi(
 
        if (AVI_open_compress (filename, avi, 1, format) != AVI_ERROR_NONE) {
                MEM_freeN(avi);
-               return 0;
+               return NULL;
        }
                        
        AVI_set_compress_option (avi, AVI_OPTION_TYPE_MAIN, 0, AVI_OPTION_WIDTH, &x);
@@ -1000,7 +1000,7 @@ static void index_rebuild_fallback(struct anim * anim,
                                                 s_ibuf->rect, x * y * 4);
 
                                /* note that libavi free's the buffer... */
-                               s_ibuf->rect = 0;
+                               s_ibuf->rect = NULL;
 
                                IMB_freeImBuf(s_ibuf);
                        }
@@ -1056,14 +1056,14 @@ void IMB_free_indices(struct anim * anim)
        for (i = 0; i < IMB_PROXY_MAX_SLOT; i++) {
                if (anim->proxy_anim[i]) {
                        IMB_close_anim(anim->proxy_anim[i]);
-                       anim->proxy_anim[i] = 0;
+                       anim->proxy_anim[i] = NULL;
                }
        }
 
        for (i = 0; i < IMB_TC_MAX_SLOT; i++) {
                if (anim->curr_idx[i]) {
                        IMB_indexer_close(anim->curr_idx[i]);
-                       anim->curr_idx[i] = 0;
+                       anim->curr_idx[i] = NULL;
                }
        }
 
@@ -1116,7 +1116,7 @@ struct anim_index * IMB_anim_open_index(
        }
 
        if (anim->indices_tried & tc) {
-               return 0;
+               return NULL;
        }
 
        get_tc_filename(anim, tc, fname);
index a4eae492a58e07950eac57346272697471e23862..af7f098585e74fc790af681fadab403d3634b8a1 100644 (file)
@@ -97,7 +97,7 @@ static void info_callback(const char *msg, void *client_data) {
 
 struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
 {
-       struct ImBuf *ibuf = 0;
+       struct ImBuf *ibuf = NULL;
        int use_float = 0; /* for precision higher then 8 use float */
        
        long signed_offsets[4]= {0, 0, 0, 0};
@@ -117,7 +117,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
        opj_dinfo_t* dinfo = NULL;      /* handle to a decompressor */
        opj_cio_t *cio = NULL;
 
-       if (check_jp2(mem) == 0) return(0);
+       if (check_jp2(mem) == 0) return(NULL);
 
        /* configure the event callbacks (not required) */
        memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
index 7cdd7b289a4278d95836df8da469779eaad5cfbf..128e888ca90301b059cbdd72058144d149812748 100644 (file)
@@ -228,7 +228,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne
 }
 
 /* Adds the given vertex to the specified vertex group, with given weight. */
-void defvert_add_to_group(MDeformVert *dv, int defgrp_idx, const float weight) {
+static void defvert_add_to_group(MDeformVert *dv, int defgrp_idx, const float weight) {
        /* TODO, move into deform.c as a generic function. This assumes the vertex
         * groups have already been checked, so this has to remain low level. */
        MDeformWeight *newdw;
@@ -247,7 +247,7 @@ void defvert_add_to_group(MDeformVert *dv, int defgrp_idx, const float weight) {
 /* Removes the given vertex from the vertex group, specified either by its defgrp_idx,
  * or directly by its MDeformWeight pointer, if dw is not NULL.
  * WARNING: This function frees the given MDeformWeight, do not use it afterward! */
-void defvert_remove_from_group(MDeformVert *dv, int defgrp_idx, MDeformWeight *dw) {
+static void defvert_remove_from_group(MDeformVert *dv, int defgrp_idx, MDeformWeight *dw) {
        /* TODO, move this into deform.c as a generic function. */
        MDeformWeight *newdw;
        int i;
index 01e46ed3df93b4900f3beacc8bce6be1edb5f9f6..5c58070be9da4750156763bdf03d4f0c5d9f14e5 100644 (file)
@@ -337,7 +337,7 @@ static void *exec_composite_node(void *nodeexec_v)
                node->typeinfo->newexecfunc(thd->rd, 0, node, nodeexec->data, nsin, nsout);
        
        node->exec |= NODE_READY;
-       return 0;
+       return NULL;
 }
 
 /* return total of executable nodes, for timecursor */
index 23bcf57e2bc60ff6a5214811c0ccc8d0087e66e3..9f4af0e0d33c044e9354cf841c2ae856918c2152 100644 (file)
@@ -88,9 +88,9 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float *
 
 static void node_composit_exec_diff_matte(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
 {
-       CompBuf *outbuf=0;
-       CompBuf *imbuf1=0;
-       CompBuf *imbuf2=0;
+       CompBuf *outbuf= NULL;
+       CompBuf *imbuf1= NULL;
+       CompBuf *imbuf2= NULL;
        NodeChroma *c;
 
        /*is anything connected?*/
index e7e4616019935625f195cb24227554091e43686c..b909a0d5f5579614dce193da2387babc7de975e5 100644 (file)
@@ -63,7 +63,7 @@ static PyStructSequence_Desc app_cb_info_desc= {
 #endif
 */
 
-static PyObject *py_cb_array[BLI_CB_EVT_TOT]= {0};
+static PyObject *py_cb_array[BLI_CB_EVT_TOT]= {NULL};
 
 static PyObject *make_app_cb_info(void)
 {
@@ -102,7 +102,7 @@ PyObject *BPY_app_handlers_struct(void)
 
        /* assign the C callbacks */
        if(ret) {
-               static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{0}};
+               static bCallbackFuncStore funcstore_array[BLI_CB_EVT_TOT]= {{NULL}};
                bCallbackFuncStore *funcstore;
                int pos= 0;
 
index 334bb1f725ac884e6dd4b404ceea6945672325be..8fa6a7b0629665aac3b3bdd163c7bec0ef5144a5 100644 (file)
@@ -55,6 +55,8 @@
 
 #include "bpy_rna.h"
 
+#include "gpu.h"
+
 #define PY_MODULE_ADD_CONSTANT(module, name) PyModule_AddIntConstant(module, #name, name)
 
 PyDoc_STRVAR(M_gpu_doc,
index 66a73b477903c5114ea7bbff45111266875b8829..e2b3b23b9c949c866e6e1c0b4b9987523d6a31cd 100644 (file)
@@ -240,8 +240,8 @@ static void envmap_transmatrix(float mat[][4], int part)
        copy_m4_m4(tmat, mat);
        eul_to_mat4( rotmat,eul);
        mul_serie_m4(mat, tmat, rotmat,
-                                        0,   0,    0,
-                                        0,   0,    0);
+                                        NULL, NULL, NULL,
+                                        NULL, NULL, NULL);
 }
 
 /* ------------------------------------------------------------------------- */
index 49e5e7b989d4f76f28cf7de89bf3e28662c89ed9..05bcc32a90ae471f3f6fda880b323e304fb379e4 100644 (file)
@@ -1452,10 +1452,12 @@ void RE_test_break_cb(Render *re, void *handle, int (*f)(void *handle))
 
 /* object is considered fully prepared on correct time etc */
 /* includes lights */
+#if 0
 void RE_AddObject(Render *UNUSED(re), Object *UNUSED(ob))
 {
        
 }
+#endif
 
 /* *************************************** */