From: Eric Engestrom Date: Sun, 1 Sep 2019 16:42:23 +0000 (+0100) Subject: gbm: use size_t for array indexes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ebe176eeff75b76527fc99d0a0f88b48ab04d0d7;p=mesa.git gbm: use size_t for array indexes Signed-off-by: Eric Engestrom Reviewed-by: Eric Anholt --- diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index ce24c3183e0..8fe6a0265fb 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -281,12 +281,11 @@ dri_bind_extensions(struct gbm_dri_device *dri, struct dri_extension_match *matches, size_t num_matches, const __DRIextension **extensions) { - int i, j; bool ret = true; void *field; - for (i = 0; extensions[i]; i++) { - for (j = 0; j < num_matches; j++) { + for (size_t i = 0; extensions[i]; i++) { + for (size_t j = 0; j < num_matches; j++) { if (strcmp(extensions[i]->name, matches[j].name) == 0 && extensions[i]->version >= matches[j].version) { field = ((char *) dri + matches[j].offset); @@ -295,7 +294,7 @@ dri_bind_extensions(struct gbm_dri_device *dri, } } - for (j = 0; j < num_matches; j++) { + for (size_t j = 0; j < num_matches; j++) { field = ((char *) dri + matches[j].offset); if ((*(const __DRIextension **) field == NULL) && !matches[j].optional) { ret = false; @@ -571,10 +570,8 @@ static const struct gbm_dri_visual gbm_dri_visuals_table[] = { static int gbm_format_to_dri_format(uint32_t gbm_format) { - int i; - gbm_format = gbm_format_canonicalize(gbm_format); - for (i = 0; i < ARRAY_SIZE(gbm_dri_visuals_table); i++) { + for (size_t i = 0; i < ARRAY_SIZE(gbm_dri_visuals_table); i++) { if (gbm_dri_visuals_table[i].gbm_format == gbm_format) return gbm_dri_visuals_table[i].dri_image_format; } @@ -585,9 +582,7 @@ gbm_format_to_dri_format(uint32_t gbm_format) static uint32_t gbm_dri_to_gbm_format(int dri_format) { - int i; - - for (i = 0; i < ARRAY_SIZE(gbm_dri_visuals_table); i++) { + for (size_t i = 0; i < ARRAY_SIZE(gbm_dri_visuals_table); i++) { if (gbm_dri_visuals_table[i].dri_image_format == dri_format) return gbm_dri_visuals_table[i].gbm_format; }