[Mesa-dev] [PATCH v2 1/2] vl: Fix trivial sign compare warnings
Jan Vesely
jano.vesely at gmail.com
Fri Jun 10 03:01:46 UTC 2016
From: Jan Vesely <jan.vesely at rutgers.edu>
v2: add whitepace fixes
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
src/gallium/auxiliary/vl/vl_deint_filter.c | 3 ++-
src/gallium/auxiliary/vl/vl_idct.c | 6 ++----
src/gallium/auxiliary/vl/vl_matrix_filter.c | 2 +-
src/gallium/auxiliary/vl/vl_median_filter.c | 5 +++--
src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c | 4 ++--
src/gallium/auxiliary/vl/vl_vlc.h | 8 ++++----
src/gallium/auxiliary/vl/vl_zscan.c | 5 +----
7 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/src/gallium/auxiliary/vl/vl_deint_filter.c b/src/gallium/auxiliary/vl/vl_deint_filter.c
index cf26009..3ca3b49 100644
--- a/src/gallium/auxiliary/vl/vl_deint_filter.c
+++ b/src/gallium/auxiliary/vl/vl_deint_filter.c
@@ -447,7 +447,8 @@ vl_deint_filter_render(struct vl_deint_filter *filter,
struct pipe_sampler_view *sampler_views[4];
struct pipe_surface **dst_surfaces;
const unsigned *plane_order;
- int i, j;
+ int i;
+ unsigned j;
assert(filter && prevprev && prev && cur && next && field <= 1);
diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c
index deb9721..3e6f581 100644
--- a/src/gallium/auxiliary/vl/vl_idct.c
+++ b/src/gallium/auxiliary/vl/vl_idct.c
@@ -321,13 +321,11 @@ static void *
create_stage1_frag_shader(struct vl_idct *idct)
{
struct ureg_program *shader;
-
struct ureg_src l_addr[2], r_addr[2];
-
struct ureg_dst l[4][2], r[2];
struct ureg_dst *fragment;
-
- int i, j;
+ unsigned i;
+ int j;
shader = ureg_create(PIPE_SHADER_FRAGMENT);
if (!shader)
diff --git a/src/gallium/auxiliary/vl/vl_matrix_filter.c b/src/gallium/auxiliary/vl/vl_matrix_filter.c
index e6d9132..e331cb7 100644
--- a/src/gallium/auxiliary/vl/vl_matrix_filter.c
+++ b/src/gallium/auxiliary/vl/vl_matrix_filter.c
@@ -85,7 +85,7 @@ create_frag_shader(struct vl_matrix_filter *filter, unsigned num_offsets,
struct ureg_dst t_sum;
struct ureg_dst o_fragment;
bool first;
- int i;
+ unsigned i;
shader = ureg_create(PIPE_SHADER_FRAGMENT);
if (!shader) {
diff --git a/src/gallium/auxiliary/vl/vl_median_filter.c b/src/gallium/auxiliary/vl/vl_median_filter.c
index 3d022ef..f7477b7 100644
--- a/src/gallium/auxiliary/vl/vl_median_filter.c
+++ b/src/gallium/auxiliary/vl/vl_median_filter.c
@@ -84,7 +84,7 @@ create_frag_shader(struct vl_median_filter *filter,
struct ureg_dst *t_array = MALLOC(sizeof(struct ureg_dst) * num_offsets);
struct ureg_dst o_fragment;
const unsigned median = num_offsets >> 1;
- int i, j;
+ unsigned i, j;
assert(num_offsets & 1); /* we need an odd number of offsets */
if (!(num_offsets & 1)) { /* yeah, we REALLY need an odd number of offsets!!! */
@@ -158,7 +158,8 @@ static void
generate_offsets(enum vl_median_filter_shape shape, unsigned size,
struct vertex2f **offsets, unsigned *num_offsets)
{
- int i = 0, half_size;
+ unsigned i = 0;
+ int half_size;
struct vertex2f v;
assert(offsets && num_offsets);
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
index 6fc915a..cb73750 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_bitstream.c
@@ -583,12 +583,12 @@ init_dct_coeff_table(struct dct_coeff *dst, const struct dct_coeff_compressed *s
break;
}
- for(i=0; i<(1 << (17 - coeff.length)); ++i)
+ for(i=0; i < (1u << (17 - coeff.length)); ++i)
dst[src->bitcode << 1 | i] = coeff;
if (has_sign) {
coeff.level = -coeff.level;
- for(; i<(1 << (18 - coeff.length)); ++i)
+ for(; i < (1u << (18 - coeff.length)); ++i)
dst[src->bitcode << 1 | i] = coeff;
}
}
diff --git a/src/gallium/auxiliary/vl/vl_vlc.h b/src/gallium/auxiliary/vl/vl_vlc.h
index 7821b8b..5db6b37 100644
--- a/src/gallium/auxiliary/vl/vl_vlc.h
+++ b/src/gallium/auxiliary/vl/vl_vlc.h
@@ -79,7 +79,7 @@ vl_vlc_init_table(struct vl_vlc_entry *dst, unsigned dst_size, const struct vl_v
}
for(; src_size > 0; --src_size, ++src) {
- for(i=0; i<(1 << (bits - src->entry.length)); ++i)
+ for(i=0; i < (1u << (bits - src->entry.length)); ++i)
dst[src->bitcode >> (16 - bits) | i] = src->entry;
}
}
@@ -293,7 +293,7 @@ vl_vlc_search_byte(struct vl_vlc *vlc, unsigned num_bits, uint8_t value)
{
/* make sure we are on a byte boundary */
assert((vl_vlc_valid_bits(vlc) % 8) == 0);
- assert(num_bits == ~0 || (num_bits % 8) == 0);
+ assert(num_bits == ~0u || (num_bits % 8) == 0);
/* deplete the bit buffer */
while (vl_vlc_valid_bits(vlc) > 0) {
@@ -305,7 +305,7 @@ vl_vlc_search_byte(struct vl_vlc *vlc, unsigned num_bits, uint8_t value)
vl_vlc_eatbits(vlc, 8);
- if (num_bits != ~0) {
+ if (num_bits != ~0u) {
num_bits -= 8;
if (num_bits == 0)
return FALSE;
@@ -332,7 +332,7 @@ vl_vlc_search_byte(struct vl_vlc *vlc, unsigned num_bits, uint8_t value)
}
++vlc->data;
- if (num_bits != ~0) {
+ if (num_bits != ~0u) {
num_bits -= 8;
if (num_bits == 0) {
vl_vlc_align_data_ptr(vlc);
diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c
index 5ff4420..ef05af4 100644
--- a/src/gallium/auxiliary/vl/vl_zscan.c
+++ b/src/gallium/auxiliary/vl/vl_zscan.c
@@ -99,15 +99,12 @@ static void *
create_vert_shader(struct vl_zscan *zscan)
{
struct ureg_program *shader;
-
struct ureg_src scale;
struct ureg_src vrect, vpos, block_num;
-
struct ureg_dst tmp;
struct ureg_dst o_vpos;
struct ureg_dst *o_vtex;
-
- signed i;
+ unsigned i;
shader = ureg_create(PIPE_SHADER_VERTEX);
if (!shader)
--
2.7.4
More information about the mesa-dev
mailing list