remove unneeded casts from 'unsigned int' to 'int'
authorCampbell Barton <ideasman42@gmail.com>
Tue, 27 Dec 2011 03:54:23 +0000 (03:54 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 27 Dec 2011 03:54:23 +0000 (03:54 +0000)
source/blender/blenkernel/intern/mesh.c
source/blender/editors/mesh/meshtools.c
source/blender/modifiers/intern/MOD_mirror.c
source/blender/modifiers/intern/MOD_screw.c
source/blender/modifiers/intern/MOD_solidify.c
source/blender/render/intern/source/convertblender.c

index 43958457edbd656a6650422ae07a7ef929c487f8..4b4875213b1e7be05c43cf1b606aa53cd80ee919 100644 (file)
@@ -466,8 +466,8 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
                if(mface->v3==0) {
                        static int corner_indices[4] = {1, 2, 0, 3};
 
-                       SWAP(int, mface->v1, mface->v2);
-                       SWAP(int, mface->v2, mface->v3);
+                       SWAP(unsigned int, mface->v1, mface->v2);
+                       SWAP(unsigned int, mface->v2, mface->v3);
 
                        if(fdata)
                                CustomData_swap(fdata, mfindex, corner_indices);
@@ -477,8 +477,8 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
                if(mface->v3==0 || mface->v4==0) {
                        static int corner_indices[4] = {2, 3, 0, 1};
 
-                       SWAP(int, mface->v1, mface->v3);
-                       SWAP(int, mface->v2, mface->v4);
+                       SWAP(unsigned int, mface->v1, mface->v3);
+                       SWAP(unsigned int, mface->v2, mface->v4);
 
                        if(fdata)
                                CustomData_swap(fdata, mfindex, corner_indices);
@@ -520,12 +520,14 @@ void set_mesh(Object *ob, Mesh *me)
 /* ************** make edges in a Mesh, for outside of editmode */
 
 struct edgesort {
-       int v1, v2;
+       unsigned int v1, v2;
        short is_loose, is_draw;
 };
 
 /* edges have to be added with lowest index first for sorting */
-static void to_edgesort(struct edgesort *ed, int v1, int v2, short is_loose, short is_draw)
+static void to_edgesort(struct edgesort *ed,
+                        unsigned int v1, unsigned int v2,
+                        short is_loose, short is_draw)
 {
        if(v1<v2) {
                ed->v1= v1; ed->v2= v2;
@@ -627,7 +629,7 @@ static void make_edges_mdata(MVert *UNUSED(allvert), MFace *allface, int UNUSED(
                        /* order is swapped so extruding this edge as a surface wont flip face normals
                         * with cyclic curves */
                        if(ed->v1+1 != ed->v2) {
-                               SWAP(int, medge->v1, medge->v2);
+                               SWAP(unsigned int, medge->v1, medge->v2);
                        }
                        medge++;
                }
@@ -1029,17 +1031,17 @@ typedef struct EdgeLink {
 
 typedef struct VertLink {
        Link *next, *prev;
-       int index;
+       unsigned int index;
 } VertLink;
 
-static void prependPolyLineVert(ListBase *lb, int index)
+static void prependPolyLineVert(ListBase *lb, unsigned int index)
 {
        VertLink *vl= MEM_callocN(sizeof(VertLink), "VertLink");
        vl->index = index;
        BLI_addhead(lb, vl);
 }
 
-static void appendPolyLineVert(ListBase *lb, int index)
+static void appendPolyLineVert(ListBase *lb, unsigned int index)
 {
        VertLink *vl= MEM_callocN(sizeof(VertLink), "VertLink");
        vl->index = index;
@@ -1111,8 +1113,8 @@ void mesh_to_curve(Scene *scene, Object *ob)
                        int closed = FALSE;
                        int totpoly= 0;
                        MEdge *med_current= ((EdgeLink *)edges.last)->edge;
-                       int startVert= med_current->v1;
-                       int endVert= med_current->v2;
+                       unsigned int startVert= med_current->v1;
+                       unsigned int endVert= med_current->v2;
                        int ok= TRUE;
 
                        appendPolyLineVert(&polyline, startVert);       totpoly++;
index f3722e812469ccbc3bb64d89d931b3ff7c7cd025..b94b60fc279938ea940bb14201cbbd734882cfa4 100644 (file)
@@ -1080,8 +1080,8 @@ int *mesh_get_x_mirror_faces(Object *ob, EditMesh *em)
 
                /* make sure v4 is not 0 if a quad */
                if(mf->v4 && mirrormf.v4==0) {
-                       SWAP(int, mirrormf.v1, mirrormf.v3);
-                       SWAP(int, mirrormf.v2, mirrormf.v4);
+                       SWAP(unsigned int, mirrormf.v1, mirrormf.v3);
+                       SWAP(unsigned int, mirrormf.v2, mirrormf.v4);
                }
 
                hashmf= BLI_ghash_lookup(fhash, &mirrormf);
index c72a76f010104c354123a2695935211e6b2effd3..8a003256ff25144a2cfdb8430ece70d720bcca02 100644 (file)
@@ -266,7 +266,7 @@ static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
                        }
                        
                        /* Flip face normal */
-                       SWAP(int, mf2->v1, mf2->v3);
+                       SWAP(unsigned int, mf2->v1, mf2->v3);
                        DM_swap_face_data(result, numFaces, corner_indices);
                        
                        test_index_face(mf2, &result->faceData, numFaces, inMF.v4?4:3);
index 0867a4b2a7b8a898548505e63a2686ae3694f428..93abbb1780c24ffc513f88fe6a8d732762254c9c 100644 (file)
@@ -145,12 +145,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
        int mface_index=0;
        int step;
        int i, j;
-       int i1,i2;
+       unsigned int i1, i2;
        int step_tot= useRenderParams ? ltmd->render_steps : ltmd->steps;
        const int do_flip = ltmd->flag & MOD_SCREW_NORMAL_FLIP ? 1 : 0;
        int maxVerts=0, maxEdges=0, maxFaces=0;
-       int totvert= dm->getNumVerts(dm);
-       int totedge= dm->getNumEdges(dm);
+       const unsigned int totvert= dm->getNumVerts(dm);
+       const unsigned int totedge= dm->getNumEdges(dm);
 
        char axis_char= 'X', close;
        float angle= ltmd->angle;
@@ -571,7 +571,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
                                                                        if (lt_iter.v == lt_iter.e->v1) {
                                                                                if (ed_loop_flip == 0) {
                                                                                        /*printf("\t\t\tFlipping 0\n");*/
-                                                                                       SWAP(int, lt_iter.e->v1, lt_iter.e->v2);
+                                                                                       SWAP(unsigned int, lt_iter.e->v1, lt_iter.e->v2);
                                                                                }/* else {
                                                                                        printf("\t\t\tFlipping Not 0\n");
                                                                                }*/
@@ -579,7 +579,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
                                                                        else if (lt_iter.v == lt_iter.e->v2) {
                                                                                if (ed_loop_flip == 1) {
                                                                                        /*printf("\t\t\tFlipping 1\n");*/
-                                                                                       SWAP(int, lt_iter.e->v1, lt_iter.e->v2);
+                                                                                       SWAP(unsigned int, lt_iter.e->v1, lt_iter.e->v2);
                                                                                }/* else {
                                                                                        printf("\t\t\tFlipping Not 1\n");
                                                                                }*/
@@ -771,8 +771,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
                        }
                        
                        if( !mf_new->v3 || !mf_new->v4 ) {
-                               SWAP(int, mf_new->v1, mf_new->v3);
-                               SWAP(int, mf_new->v2, mf_new->v4);
+                               SWAP(unsigned int, mf_new->v1, mf_new->v3);
+                               SWAP(unsigned int, mf_new->v2, mf_new->v4);
                        }
                        mf_new->flag= ME_SMOOTH;
                        origindex[mface_index]= ORIGINDEX_NONE;
@@ -807,8 +807,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
                        }
 
                        if( !mf_new->v3 || !mf_new->v4 ) {
-                               SWAP(int, mf_new->v1, mf_new->v3);
-                               SWAP(int, mf_new->v2, mf_new->v4);
+                               SWAP(unsigned int, mf_new->v1, mf_new->v3);
+                               SWAP(unsigned int, mf_new->v2, mf_new->v4);
                        }
                        mf_new->flag= ME_SMOOTH;
                        origindex[mface_index]= ORIGINDEX_NONE;
index d11d10eb71b484c29fa3a81f4b8e1f9a1a366f38..2aa69526c102575fa82398c2a090a337f69f70ff 100644 (file)
@@ -350,7 +350,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 
        {
                static int corner_indices[4] = {2, 1, 0, 3};
-               int is_quad;
+               unsigned int is_quad;
 
                for(i=0, mf=mface+numFaces; i<numFaces; i++, mf++) {
                        mf->v1 += numVerts;
@@ -362,7 +362,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
                        /* Flip face normal */
                        {
                                is_quad = mf->v4;
-                               SWAP(int, mf->v1, mf->v3);
+                               SWAP(unsigned int, mf->v1, mf->v3);
                                DM_swap_face_data(result, i+numFaces, corner_indices);
                                test_index_face(mf, &result->faceData, numFaces, is_quad ? 4:3);
                        }
index 122b47016eb23a8aa1e60eb9aeb10b9f497e958e..434e596e73940c61d51f8d07d116990cf6c38fbf 100644 (file)
@@ -3056,17 +3056,19 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset)
 /* ------------------------------------------------------------------------- */
 
 struct edgesort {
-       int v1, v2;
+       unsigned int v1, v2;
        int f;
-       int i1, i2;
+       unsigned int i1, i2;
 };
 
 /* edges have to be added with lowest index first for sorting */
-static void to_edgesort(struct edgesort *ed, int i1, int i2, int v1, int v2, int f)
+static void to_edgesort(struct edgesort *ed,
+                        unsigned int i1, unsigned int i2,
+                        unsigned int v1, unsigned int v2, int f)
 {
-       if(v1>v2) {
-               SWAP(int, v1, v2);
-               SWAP(int, i1, i2);
+       if (v1 > v2) {
+               SWAP(unsigned int, v1, v2);
+               SWAP(unsigned int, i1, i2);
        }
 
        ed->v1= v1;