Assert that we get a valid format in pixel_format_to_gl{,es}

The assert could use a 'default:' label but that would stop GCC from
giving a warning when a new enum value is added.

https://bugzilla.gnome.org/show_bug.cgi?id=671016

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts 2012-02-29 13:42:44 +00:00
parent b6dc23370d
commit 2b9aca20a8
2 changed files with 10 additions and 2 deletions

View File

@ -400,7 +400,7 @@ _cogl_texture_driver_pixel_format_to_gl (CoglPixelFormat format,
{ {
CoglPixelFormat required_format; CoglPixelFormat required_format;
GLenum glintformat; GLenum glintformat;
GLenum glformat; GLenum glformat = 0;
GLenum gltype; GLenum gltype;
required_format = format; required_format = format;
@ -522,6 +522,10 @@ _cogl_texture_driver_pixel_format_to_gl (CoglPixelFormat format,
break; break;
} }
/* All of the pixel formats are handled above so if this hits then
we've been given an invalid pixel format */
g_assert (glformat != 0);
if (out_glintformat != NULL) if (out_glintformat != NULL)
*out_glintformat = glintformat; *out_glintformat = glintformat;
if (out_glformat != NULL) if (out_glformat != NULL)

View File

@ -412,7 +412,7 @@ _cogl_texture_driver_pixel_format_to_gl (CoglPixelFormat format,
{ {
CoglPixelFormat required_format; CoglPixelFormat required_format;
GLenum glintformat; GLenum glintformat;
GLenum glformat; GLenum glformat = 0;
GLenum gltype; GLenum gltype;
required_format = format; required_format = format;
@ -491,6 +491,10 @@ _cogl_texture_driver_pixel_format_to_gl (CoglPixelFormat format,
break; break;
} }
/* All of the pixel formats are handled above so if this hits then
we've been given an invalid pixel format */
g_assert (glformat != 0);
if (out_glintformat != NULL) if (out_glintformat != NULL)
*out_glintformat = glintformat; *out_glintformat = glintformat;
if (out_glformat != NULL) if (out_glformat != NULL)