Commit: 6e66ddf5ed29c2593dbd25d4fd48b36c2e68e411
Author: Brecht Van Lommel
Date:   Sun Oct 11 01:44:47 2015 +0200
Branches: master
https://developer.blender.org/rB6e66ddf5ed29c2593dbd25d4fd48b36c2e68e411

Fix warnings and remove casts by adding copy_vx_vx_uchar() functions.

===================================================================

M       source/blender/blenkernel/intern/DerivedMesh.c
M       source/blender/blenkernel/intern/cdderivedmesh.c
M       source/blender/blenkernel/intern/editderivedmesh.c
M       source/blender/blenkernel/intern/subsurf_ccg.c
M       source/blender/blenlib/BLI_math_vector.h
M       source/blender/blenlib/intern/math_color_blend_inline.c
M       source/blender/blenlib/intern/math_vector_inline.c
M       source/blender/blenloader/intern/versioning_260.c
M       source/blender/editors/space_view3d/drawmesh.c
M       source/blender/editors/space_view3d/drawobject.c
M       source/blender/imbuf/intern/stereoimbuf.c
M       source/blender/render/intern/source/bake.c

===================================================================

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c 
b/source/blender/blenkernel/intern/DerivedMesh.c
index e71cfca..4cf9885 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1561,8 +1561,8 @@ void DM_update_weight_mcol(
                        ml = mloop + mp->loopstart;
 
                        for (j = 0; j < mp->totloop; j++, ml++, l_index++) {
-                               copy_v4_v4_char((char *)&wtcol_l[l_index],
-                                               (char *)&wtcol_v[ml->v]);
+                               copy_v4_v4_uchar(&wtcol_l[l_index][0],
+                                                &wtcol_v[ml->v][0]);
                        }
                }
                MEM_freeN(wtcol_v);
@@ -3453,7 +3453,7 @@ void DM_draw_attrib_vertex(DMVertexAttribs *attribs, int 
a, int index, int vert,
 
                if (attribs->mcol[b].array) {
                        const MLoopCol *cp = &attribs->mcol[b].array[loop];
-                       copy_v4_v4_char((char *)col, &cp->r);
+                       copy_v4_v4_uchar(col, &cp->r);
                }
                else {
                        col[0] = 0; col[1] = 0; col[2] = 0; col[3] = 0;
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c 
b/source/blender/blenkernel/intern/cdderivedmesh.c
index 7c3287e..989e5e3 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -967,7 +967,7 @@ static void cdDM_drawMappedFacesGLSL(
                int *mat_orig_to_new;
                int tot_active_mat;
                GPUBuffer *buffer = NULL;
-               char *varray;
+               unsigned char *varray;
                size_t max_element_size = 0;
                int tot_loops = 0;
 
@@ -1072,7 +1072,7 @@ static void cdDM_drawMappedFacesGLSL(
                                                if 
(matconv[i].attribs.mcol[b].array) {
                                                        const MLoopCol 
*mloopcol = matconv[i].attribs.mcol[b].array;
                                                        for (j = 0; j < 
mpoly->totloop; j++)
-                                                               
copy_v4_v4_char((char *)&varray[offset + j * max_element_size], 
&mloopcol[mpoly->loopstart + j].r);
+                                                               
copy_v4_v4_uchar(&varray[offset + j * max_element_size], 
&mloopcol[mpoly->loopstart + j].r);
                                                        offset += 
sizeof(unsigned char) * 4;
                                                }
                                        }
@@ -1482,7 +1482,7 @@ static void cdDM_buffer_copy_mcol(
 
        for (i = 0; i < totpoly; i++, mpoly++) {
                for (j = 0; j < mpoly->totloop; j++) {
-                       copy_v3_v3_char((char *)&varray[start], 
&mloopcol[mpoly->loopstart + j].r);
+                       copy_v3_v3_uchar(&varray[start], 
&mloopcol[mpoly->loopstart + j].r);
                        start += 3;
                }
        }
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c 
b/source/blender/blenkernel/intern/editderivedmesh.c
index 840935c..88ae279 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -1248,7 +1248,7 @@ static void emdm_pass_attrib_vertex_glsl(const 
DMVertexAttribs *attribs, const B
                GLubyte col[4];
                if (attribs->mcol[i].em_offset != -1) {
                        const MLoopCol *cp = BM_ELEM_CD_GET_VOID_P(loop, 
attribs->mcol[i].em_offset);
-                       copy_v4_v4_char((char *)col, &cp->r);
+                       copy_v4_v4_uchar(col, &cp->r);
                }
                else {
                        col[0] = 0; col[1] = 0; col[2] = 0; col[3] = 0;
@@ -2170,8 +2170,8 @@ static void statvis_calc_overhang(
                        rgb_float_to_uchar(r_face_colors[index], fcol);
                }
                else {
-                       unsigned char *fallback = is_max ? col_fallback_max : 
col_fallback;
-                       copy_v4_v4_char((char *)r_face_colors[index], (const 
char *)fallback);
+                       const unsigned char *fallback = is_max ? 
col_fallback_max : col_fallback;
+                       copy_v4_v4_uchar(r_face_colors[index], fallback);
                }
        }
 }
@@ -2210,7 +2210,7 @@ static void statvis_calc_thickness(
        struct BMLoop *(*looptris)[3] = em->looptris;
 
        /* fallback */
-       const char col_fallback[4] = {64, 64, 64, 255};
+       const unsigned char col_fallback[4] = {64, 64, 64, 255};
 
        struct BMBVHTree *bmtree;
 
@@ -2305,7 +2305,7 @@ static void statvis_calc_thickness(
                        rgb_float_to_uchar(r_face_colors[i], fcol);
                }
                else {
-                       copy_v4_v4_char((char *)r_face_colors[i], (const char 
*)col_fallback);
+                       copy_v4_v4_uchar(r_face_colors[i], col_fallback);
                }
        }
 }
@@ -2357,7 +2357,7 @@ static void statvis_calc_intersect(
 
                                index = BM_elem_index_get(f_hit);
 
-                               copy_v3_v3_char((char *)r_face_colors[index], 
(const char *)col);
+                               copy_v3_v3_uchar(r_face_colors[index], col);
                        }
                }
                MEM_freeN(overlap);
@@ -2382,7 +2382,7 @@ static void statvis_calc_distort(
        const float minmax_irange = 1.0f / (max - min);
 
        /* fallback */
-       const char col_fallback[4] = {64, 64, 64, 255};
+       const unsigned char col_fallback[4] = {64, 64, 64, 255};
 
        /* now convert into global space */
        BM_ITER_MESH_INDEX (f, &iter, bm, BM_FACES_OF_MESH, index) {
@@ -2431,7 +2431,7 @@ static void statvis_calc_distort(
                        rgb_float_to_uchar(r_face_colors[index], fcol);
                }
                else {
-                       copy_v4_v4_char((char *)r_face_colors[index], (const 
char *)col_fallback);
+                       copy_v4_v4_uchar(r_face_colors[index], col_fallback);
                }
        }
 }
@@ -2453,7 +2453,7 @@ static void statvis_calc_sharp(
        int i;
 
        /* fallback */
-       const char col_fallback[4] = {64, 64, 64, 255};
+       const unsigned char col_fallback[4] = {64, 64, 64, 255};
 
        (void)vertexCos;  /* TODO */
 
@@ -2481,7 +2481,7 @@ static void statvis_calc_sharp(
                        rgb_float_to_uchar(r_vert_colors[i], fcol);
                }
                else {
-                       copy_v4_v4_char((char *)r_vert_colors[i], (const char 
*)col_fallback);
+                       copy_v4_v4_uchar(r_vert_colors[i], col_fallback);
                }
        }
 }
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c 
b/source/blender/blenkernel/intern/subsurf_ccg.c
index 509ca9c..f351ce0 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -2167,7 +2167,7 @@ static void ccgDM_buffer_copy_color(
        CCGDerivedMesh *ccgdm = (CCGDerivedMesh *) dm;
        CCGSubSurf *ss = ccgdm->ss;
        CCGKey key;
-       const char *mloopcol = user_data;
+       const unsigned char *mloopcol = user_data;
        int gridSize = ccgSubSurf_getGridSize(ss);
        int gridFaces = gridSize - 1;
        int i, totface = ccgSubSurf_getNumFaces(ss);
@@ -2184,10 +2184,10 @@ static void ccgDM_buffer_copy_color(
                for (S = 0; S < numVerts; S++) {
                        for (y = 0; y < gridFaces; y++) {
                                for (x = 0; x < gridFaces; x++) {
-                                       copy_v3_v3_char((char *)&varray[start + 
0], &mloopcol[iface * 16 + 0]);
-                                       copy_v3_v3_char((char *)&varray[start + 
3], &mloopcol[iface * 16 + 12]);
-                                       copy_v3_v3_char((char *)&varray[start + 
6], &mloopcol[iface * 16 + 8]);
-                                       copy_v3_v3_char((char *)&varray[start + 
9], &mloopcol[iface * 16 + 4]);
+                                       copy_v3_v3_uchar(&varray[start + 0], 
&mloopcol[iface * 16 + 0]);
+                                       copy_v3_v3_uchar(&varray[start + 3], 
&mloopcol[iface * 16 + 12]);
+                                       copy_v3_v3_uchar(&varray[start + 6], 
&mloopcol[iface * 16 + 8]);
+                                       copy_v3_v3_uchar(&varray[start + 9], 
&mloopcol[iface * 16 + 4]);
 
                                        start += 12;
                                        iface++;
diff --git a/source/blender/blenlib/BLI_math_vector.h 
b/source/blender/blenlib/BLI_math_vector.h
index fc0dd76..01c00dd 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -61,11 +61,14 @@ MINLINE void swap_v2_v2(float a[2], float b[2]);
 MINLINE void swap_v3_v3(float a[3], float b[3]);
 MINLINE void swap_v4_v4(float a[4], float b[4]);
 
+/* unsigned char */
+MINLINE void copy_v2_v2_uchar(unsigned char r[2], const unsigned char a[2]);
+MINLINE void copy_v3_v3_uchar(unsigned char r[3], const unsigned char a[3]);
+MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4]);
 /* char */
 MINLINE void copy_v2_v2_char(char r[2], const char a[2]);
 MINLINE void copy_v3_v3_char(char r[3], const char a[3]);
 MINLINE void copy_v4_v4_char(char r[4], const char a[4]);
-
 /* short */
 MINLINE void copy_v2_v2_short(short r[2], const short a[2]);
 MINLINE void copy_v3_v3_short(short r[3], const short a[3]);
diff --git a/source/blender/blenlib/intern/math_color_blend_inline.c 
b/source/blender/blenlib/intern/math_color_blend_inline.c
index 88be86a..048ab71 100644
--- a/source/blender/blenlib/intern/math_color_blend_inline.c
+++ b/source/blender/blenlib/intern/math_color_blend_inline.c
@@ -72,7 +72,7 @@ MINLINE void blend_color_mix_byte(unsigned char dst[4], const 
unsigned char src1
        }
        else {
                /* no op */
-               copy_v4_v4_char((char *)dst, (char *)src1);
+               copy_v4_v4_uchar(dst, src1);
        }
 }
 
@@ -94,7 +94,7 @@ MINLINE void blend_color_add_byte(unsigned char dst[4], const 
unsigned char src1
        }
        else {
                /* no op */
-               copy_v4_v4_char((char *)dst, (char *)src1);
+               copy_v4_v4_uchar(dst, src1);
        }
 }
 
@@ -116,7 +116,7 @@ MINLINE void blend_color_sub_byte(unsigned char dst[4], 
const unsigned char src1
        }
        else {
                /* no op */
-               copy_v4_v4_char((char *)dst, (char *)src1);
+               copy_v4_v4_uchar(dst, src1);
        }
 }
 
@@ -139,7 +139,7 @@ MINLINE void blend_color_mul_byte(unsigned char dst[4], 
const unsigned char src1
        }
        else {
                /* no op */
-               copy_v4_v4_char((char *)dst, (char *)src1);
+               copy_v4_v4_uchar(dst, src1);
        }
 }
 
@@ -162,7 +162,7 @@ MINLINE void blend_color_lighten_byte(unsigned char dst[4], 
const unsigned char
        }
        else {
                /* no op */
-               copy_v4_v4_char((char *)dst, (char *)src1);
+               copy_v4_v4_uchar(dst, src1);
        }
 }
 
@@ -185,7 +185,7 @@ MINLINE void blend_color_darken_byte(unsigned char dst[4], 
const unsigned char s
        }
        else {
                /* no op */
-               copy_v4_v4_char((char *)dst, (char *)src1);
+               copy_v4_v4_uchar(dst, src1);
        }
 }
 
@@ -202,7 +202,7 @@ MINLINE void blend_color_erase_alpha_byte(unsigned char 
dst[4], const unsigned c
        }
        else {
                /* no op */
-               copy_v4_v4_char((char *)dst, (char *)src1);
+               copy_v4_v4_uchar(dst, src1);
        }
 }
 
@@ -219,7 +219,7 @@ MINLINE void blend_color_add_alpha_byte(unsigned char 
dst[4], const unsigned cha
        }
        else {
                /* no op */
-               copy_v4_v4_char((char *)dst, (char *)src1);
+               copy_v4_v4_uchar(dst, src1);
        }
 }
 
@@ -244,7 +244,7 @@ MINLINE void blend_color_overlay_byte(unsigned char dst[4], 
unsigned const char
        }
        else {
                /* no op */
-               copy_v4_v4_char((char *)dst, (char *)src1);
+               copy_v4_v4_uchar(dst, src1);
        }
 }
 
@@ -270,7 +270,7 @@ MINLINE void blend_color_hardlight_byte(unsigned char 
dst[4], unsigned const cha
        }
        else {
                /* no op */
-               copy_v4_v4_char((char *)dst, (char *)src1);
+               copy_v4_v4_uchar(dst, src1);
        }
 }
 
@@ -289,7 +289,7 @@ MINLINE void blend_color_burn_byte(unsigned char dst[4], 
unsigned const char src
        }
        else {
                /* no op */
-               copy_v4_v4_char((char *)dst, (char *)src1);
+               copy_v4_v4_uchar(dst, src1);
        }
 }
 
@@ -30

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to