[Mesa-dev] [PATCH v2 kmscube] cube-tex: Do not declare counter inside 'for' loop
Fabio Estevam
festevam at gmail.com
Mon Mar 20 12:33:50 UTC 2017
Do not declare counter inside 'for' loop to fix the following build errors
on mips64el:
cube-tex.c: In function 'get_fd_rgba':
cube-tex.c:230:2: error: 'for' loop initial declarations are only allowed in C99 mode
for (uint32_t i = 0; i < texh; i++) {
^
cube-tex.c:230:2: note: use option -std=c99 or -std=gnu99 to compile your code
cube-tex.c: In function 'get_fd_y':
cube-tex.c:261:2: error: 'for' loop initial declarations are only allowed in C99 mode
for (uint32_t i = 0; i < texh; i++) {
^
cube-tex.c: In function 'get_fd_uv':
cube-tex.c:292:2: error: 'for' loop initial declarations are only allowed in C99 mode
for (uint32_t i = 0; i < texh/2; i++) {
^
Signed-off-by: Fabio Estevam <festevam at gmail.com>
---
Changes since v1:
- s/initialize/declare to match the build error
cube-tex.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/cube-tex.c b/cube-tex.c
index 0caeaea..0eff2ae 100644
--- a/cube-tex.c
+++ b/cube-tex.c
@@ -217,7 +217,7 @@ static int get_fd_rgba(uint32_t *pstride)
{
struct gbm_bo *bo;
void *map_data = NULL;
- uint32_t stride;
+ uint32_t stride, i;
extern const uint32_t raw_512x512_rgba[];
uint8_t *map, *src = (uint8_t *)raw_512x512_rgba;
int fd;
@@ -227,7 +227,7 @@ static int get_fd_rgba(uint32_t *pstride)
map = gbm_bo_map(bo, 0, 0, texw, texh, GBM_BO_TRANSFER_WRITE, &stride, &map_data);
- for (uint32_t i = 0; i < texh; i++) {
+ for (i = 0; i < texh; i++) {
memcpy(&map[stride * i], &src[texw * 4 * i], texw * 4);
}
@@ -247,7 +247,7 @@ static int get_fd_y(uint32_t *pstride)
{
struct gbm_bo *bo;
void *map_data = NULL;
- uint32_t stride;
+ uint32_t stride, i;
extern const uint32_t raw_512x512_nv12[];
uint8_t *map, *src = (uint8_t *)raw_512x512_nv12;
int fd;
@@ -258,7 +258,7 @@ static int get_fd_y(uint32_t *pstride)
map = gbm_bo_map(bo, 0, 0, texw/4, texh, GBM_BO_TRANSFER_WRITE, &stride, &map_data);
- for (uint32_t i = 0; i < texh; i++) {
+ for (i = 0; i < texh; i++) {
memcpy(&map[stride * i], &src[texw * i], texw);
}
@@ -278,7 +278,7 @@ static int get_fd_uv(uint32_t *pstride)
{
struct gbm_bo *bo;
void *map_data = NULL;
- uint32_t stride;
+ uint32_t stride, i;
extern const uint32_t raw_512x512_nv12[];
uint8_t *map, *src = &((uint8_t *)raw_512x512_nv12)[texw * texh];
int fd;
@@ -289,7 +289,7 @@ static int get_fd_uv(uint32_t *pstride)
map = gbm_bo_map(bo, 0, 0, texw/2/2, texh/2, GBM_BO_TRANSFER_WRITE, &stride, &map_data);
- for (uint32_t i = 0; i < texh/2; i++) {
+ for (i = 0; i < texh/2; i++) {
memcpy(&map[stride * i], &src[texw * i], texw);
}
--
2.7.4
More information about the mesa-dev
mailing list