From: Timothy Arceri Date: Tue, 24 Apr 2018 04:06:00 +0000 (+1000) Subject: mesa: some C99 tidy ups for framebuffer.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2554b8cb006d5466736333ab7b75aa34501278bb;p=mesa.git mesa: some C99 tidy ups for framebuffer.c Reviewed-by: Marek Olšák Reviewed-by: Ian Romanick --- diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 249e775f8cb..211e97c33bd 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -210,14 +210,12 @@ _mesa_destroy_framebuffer(struct gl_framebuffer *fb) void _mesa_free_framebuffer_data(struct gl_framebuffer *fb) { - GLuint i; - assert(fb); assert(fb->RefCount == 0); simple_mtx_destroy(&fb->Mutex); - for (i = 0; i < BUFFER_COUNT; i++) { + for (unsigned i = 0; i < BUFFER_COUNT; i++) { struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; if (att->Renderbuffer) { _mesa_reference_renderbuffer(&att->Renderbuffer, NULL); @@ -280,8 +278,6 @@ void _mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb, GLuint width, GLuint height) { - GLuint i; - /* XXX I think we could check if the size is not changing * and return early. */ @@ -289,7 +285,7 @@ _mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb, /* Can only resize win-sys framebuffer objects */ assert(_mesa_is_winsys_fbo(fb)); - for (i = 0; i < BUFFER_COUNT; i++) { + for (unsigned i = 0; i < BUFFER_COUNT; i++) { struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; if (att->Type == GL_RENDERBUFFER_EXT && att->Renderbuffer) { struct gl_renderbuffer *rb = att->Renderbuffer; @@ -427,13 +423,11 @@ void _mesa_update_framebuffer_visual(struct gl_context *ctx, struct gl_framebuffer *fb) { - GLuint i; - memset(&fb->Visual, 0, sizeof(fb->Visual)); fb->Visual.rgbMode = GL_TRUE; /* assume this */ /* find first RGB renderbuffer */ - for (i = 0; i < BUFFER_COUNT; i++) { + for (unsigned i = 0; i < BUFFER_COUNT; i++) { if (fb->Attachment[i].Renderbuffer) { const struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer; const GLenum baseFormat = _mesa_get_format_base_format(rb->Format); @@ -461,7 +455,7 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx, } fb->Visual.floatMode = GL_FALSE; - for (i = 0; i < BUFFER_COUNT; i++) { + for (unsigned i = 0; i < BUFFER_COUNT; i++) { if (fb->Attachment[i].Renderbuffer) { const struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer; const mesa_format fmt = rb->Format; @@ -936,14 +930,12 @@ _mesa_get_read_renderbuffer_for_format(const struct gl_context *ctx, void _mesa_print_framebuffer(const struct gl_framebuffer *fb) { - GLuint i; - fprintf(stderr, "Mesa Framebuffer %u at %p\n", fb->Name, (void *) fb); fprintf(stderr, " Size: %u x %u Status: %s\n", fb->Width, fb->Height, _mesa_enum_to_string(fb->_Status)); fprintf(stderr, " Attachments:\n"); - for (i = 0; i < BUFFER_COUNT; i++) { + for (unsigned i = 0; i < BUFFER_COUNT; i++) { const struct gl_renderbuffer_attachment *att = &fb->Attachment[i]; if (att->Type == GL_TEXTURE) { const struct gl_texture_image *texImage = att->Renderbuffer->TexImage;