summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/buffers.c
diff options
context:
space:
mode:
authorRob Herring <[email protected]>2017-05-30 15:30:38 -0500
committerRob Herring <[email protected]>2017-06-07 20:44:26 -0500
commitf4b5510872b94a434a5223e35a67db322aad5e8b (patch)
treeb3002db5c1f8a80711bdca45df3ec6aabf39931a /src/mesa/main/buffers.c
parent18348a383dae41567fd333db6f848fbc8ff7d99b (diff)
mesa/main: fix gl_buffer_index enum comparison
For clang, enums are unsigned by default and gives the following warning: external/mesa3d/src/mesa/main/buffers.c:764:21: warning: comparison of constant -1 with expression of type 'gl_buffer_index' is always false [-Wtautological-constant-out-of-range-compare] if (srcBuffer == -1) { ~~~~~~~~~ ^ ~~ Replace -1 with an enum value to fix this. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]> Signed-off-by: Rob Herring <[email protected]>
Diffstat (limited to 'src/mesa/main/buffers.c')
-rw-r--r--src/mesa/main/buffers.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 7d17ae92de2..d85974afe60 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -231,7 +231,7 @@ read_buffer_enum_to_index(const struct gl_context *ctx, GLenum buffer)
if (buffer >= GL_COLOR_ATTACHMENT8 && buffer <= GL_COLOR_ATTACHMENT31)
return BUFFER_COUNT;
/* error */
- return -1;
+ return BUFFER_NONE;
}
}
@@ -752,16 +752,16 @@ read_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
if (buffer == GL_NONE) {
/* This is legal--it means that no buffer should be bound for reading. */
- srcBuffer = -1;
+ srcBuffer = BUFFER_NONE;
}
else {
/* general case / window-system framebuffer */
if (_mesa_is_gles3(ctx) && !is_legal_es3_readbuffer_enum(buffer))
- srcBuffer = -1;
+ srcBuffer = BUFFER_NONE;
else
srcBuffer = read_buffer_enum_to_index(ctx, buffer);
- if (srcBuffer == -1) {
+ if (srcBuffer == BUFFER_NONE) {
_mesa_error(ctx, GL_INVALID_ENUM,
"%s(invalid buffer %s)", caller,
_mesa_enum_to_string(buffer));