Mesa (master): mesa: Fix _mesa_lookup_parameter_constant's return value.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Mon Aug 30 13:12:29 UTC 2010


Module: Mesa
Branch: master
Commit: 128237927d6fa4ffb23e52c59150f57520004c00
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=128237927d6fa4ffb23e52c59150f57520004c00

Author: José Fonseca <jfonseca at vmware.com>
Date:   Mon Aug 30 13:48:21 2010 +0100

mesa: Fix _mesa_lookup_parameter_constant's return value.

Fixes gcc warning

  In function ‘_mesa_add_unnamed_constant’:
  warning: ‘pos’ may be used uninitialized in this function

but also what appears to be a bug.

---

 src/mesa/program/prog_parameter.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c
index 40dc92c..6bf8a08 100644
--- a/src/mesa/program/prog_parameter.c
+++ b/src/mesa/program/prog_parameter.c
@@ -482,8 +482,10 @@ _mesa_lookup_parameter_constant(const struct gl_program_parameter_list *list,
    assert(vSize >= 1);
    assert(vSize <= 4);
 
-   if (!list)
-      return -1;
+   if (!list) {
+      *posOut = -1;
+      return GL_FALSE;
+   }
 
    for (i = 0; i < list->NumParameters; i++) {
       if (list->Parameters[i].Type == PROGRAM_CONSTANT) {




More information about the mesa-commit mailing list