summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-01-08 08:21:12 -0700
committerBrian Paul <brianp@vmware.com>2010-01-08 08:21:12 -0700
commitfd70841121475d7aad98812d6bf9c9c67567b89a (patch)
tree13f7eef837abc0151dc663a2b6fed04d7f2cc578 /progs
parenta1de400e8de06a80ab140bb0fa950e990607572d (diff)
parent674c76310fe93dd3d7a15af0f72bb9f04351d09f (diff)
Merge branch 'mesa_7_7_branch'
Conflicts: src/mesa/drivers/dri/i965/brw_wm_emit.c
Diffstat (limited to 'progs')
-rw-r--r--progs/demos/fire.c2
-rwxr-xr-xprogs/fp/Makefile1
-rw-r--r--progs/fp/SConscript1
-rw-r--r--progs/fp/tri-inv.c111
-rw-r--r--progs/glsl/shtest.c4
-rw-r--r--progs/xdemos/glsync.c2
-rw-r--r--progs/xdemos/glxheads.c32
-rw-r--r--progs/xdemos/manywin.c32
-rw-r--r--progs/xdemos/sharedtex_mt.c4
9 files changed, 69 insertions, 120 deletions
diff --git a/progs/demos/fire.c b/progs/demos/fire.c
index 3db45418fa..9c351e80e5 100644
--- a/progs/demos/fire.c
+++ b/progs/demos/fire.c
@@ -6,6 +6,7 @@
* Humanware s.r.l.
*/
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@@ -758,6 +759,7 @@ main(int ac, char **av)
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.1);
+ assert(np > 0);
p = (part *) malloc(sizeof(part) * np);
for (i = 0; i < np; i++)
diff --git a/progs/fp/Makefile b/progs/fp/Makefile
index d77cd32b4d..681928cf26 100755
--- a/progs/fp/Makefile
+++ b/progs/fp/Makefile
@@ -17,7 +17,6 @@ SOURCES = \
tri-depth2.c \
tri-depthwrite.c \
tri-depthwrite2.c \
- tri-inv.c \
tri-param.c \
fp-tri.c
diff --git a/progs/fp/SConscript b/progs/fp/SConscript
index 113e11ab54..e209161f32 100644
--- a/progs/fp/SConscript
+++ b/progs/fp/SConscript
@@ -6,7 +6,6 @@ progs = [
'tri-depth2',
'tri-depthwrite',
'tri-depthwrite2',
- 'tri-inv',
'tri-param',
'tri-tex',
'point-position',
diff --git a/progs/fp/tri-inv.c b/progs/fp/tri-inv.c
deleted file mode 100644
index 7e490fa61c..0000000000
--- a/progs/fp/tri-inv.c
+++ /dev/null
@@ -1,111 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <GL/glew.h>
-#include <GL/glut.h>
-
-
-
-static void Init( void )
-{
- static const char *modulate2D =
- "!!ARBfp1.0\n"
- "TEMP R0;\n"
- "INV result.color, fragment.color; \n"
- "END"
- ;
- GLuint modulateProg;
-
- if (!GLEW_ARB_fragment_program) {
- printf("Error: GL_ARB_fragment_program not supported!\n");
- exit(1);
- }
- printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
-
- /* Setup the fragment program */
- glGenProgramsARB(1, &modulateProg);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg);
- glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
- strlen(modulate2D), (const GLubyte *)modulate2D);
-
- printf("glGetError = 0x%x\n", (int) glGetError());
- printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n",
- (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
-
- glClearColor(.3, .3, .3, 0);
-}
-
-static void Reshape(int width, int height)
-{
-
- glViewport(0, 0, (GLint)width, (GLint)height);
-
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
- glMatrixMode(GL_MODELVIEW);
-}
-
-static void Key(unsigned char key, int x, int y)
-{
-
- switch (key) {
- case 27:
- exit(1);
- default:
- break;
- }
-
- glutPostRedisplay();
-}
-
-static void Draw(void)
-{
- glClear(GL_COLOR_BUFFER_BIT);
-
- glBegin(GL_TRIANGLES);
- glColor3f(0,0,1);
- glVertex3f( 0.9, -0.9, -30.0);
- glColor3f(1,0,0);
- glVertex3f( 0.9, 0.9, -30.0);
- glColor3f(0,1,0);
- glVertex3f(-0.9, 0.0, -30.0);
- glEnd();
-
- glFlush();
-
-
-}
-
-
-int main(int argc, char **argv)
-{
- GLenum type;
-
- glutInit(&argc, argv);
-
-
-
- glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
-
- type = GLUT_RGB;
- type |= GLUT_SINGLE;
- glutInitDisplayMode(type);
-
- if (glutCreateWindow("First Tri") == GL_FALSE) {
- exit(1);
- }
-
- glewInit();
-
- Init();
-
- glutReshapeFunc(Reshape);
- glutKeyboardFunc(Key);
- glutDisplayFunc(Draw);
- glutMainLoop();
- return 0;
-}
diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c
index e9800c307f..7b1917be1c 100644
--- a/progs/glsl/shtest.c
+++ b/progs/glsl/shtest.c
@@ -549,6 +549,10 @@ ReadConfigFile(const char *filename, struct config_file *conf)
type = TypeFromName(typeName);
+ if (strlen(name) + 1 > sizeof(conf->uniforms[conf->num_uniforms].name)) {
+ fprintf(stderr, "string overflow\n");
+ exit(1);
+ }
strcpy(conf->uniforms[conf->num_uniforms].name, name);
conf->uniforms[conf->num_uniforms].value[0] = v1;
conf->uniforms[conf->num_uniforms].value[1] = v2;
diff --git a/progs/xdemos/glsync.c b/progs/xdemos/glsync.c
index da87306cf2..9d4b0f1ce2 100644
--- a/progs/xdemos/glsync.c
+++ b/progs/xdemos/glsync.c
@@ -89,7 +89,7 @@ static char optstr[] = "w:h:s:v";
enum sync_type {
none = 0,
sgi_video_sync,
- buffer_swap,
+ buffer_swap
};
static void usage(char *name)
diff --git a/progs/xdemos/glxheads.c b/progs/xdemos/glxheads.c
index b1a63d3d50..edae0a3ef7 100644
--- a/progs/xdemos/glxheads.c
+++ b/progs/xdemos/glxheads.c
@@ -145,14 +145,40 @@ AddHead(const char *displayName)
/* save the info for this head */
{
struct head *h = &Heads[NumHeads];
+ const char * tmp;
+
+ if (strlen(displayName) + 1 > sizeof(h->DisplayName)) {
+ Error(displayName, "displayName string length overflow");
+ return NULL;
+ }
strcpy(h->DisplayName, displayName);
+
h->Dpy = dpy;
h->Win = win;
h->Context = ctx;
h->Angle = 0.0;
- strcpy(h->Version, (char *) glGetString(GL_VERSION));
- strcpy(h->Vendor, (char *) glGetString(GL_VENDOR));
- strcpy(h->Renderer, (char *) glGetString(GL_RENDERER));
+
+ tmp = (char *) glGetString(GL_VERSION);
+ if (strlen(tmp) + 1 > sizeof(h->Version)) {
+ Error(displayName, "GL_VERSION string length overflow");
+ return NULL;
+ }
+ strcpy(h->Version, tmp);
+
+ tmp = (char *) glGetString(GL_VENDOR);
+ if (strlen(tmp) + 1 > sizeof(h->Vendor)) {
+ Error(displayName, "GL_VENDOR string length overflow");
+ return NULL;
+ }
+ strcpy(h->Vendor, tmp);
+
+ tmp = (char *) glGetString(GL_RENDERER);
+ if (strlen(tmp) + 1 > sizeof(h->Renderer)) {
+ Error(displayName, "GL_RENDERER string length overflow");
+ return NULL;
+ }
+ strcpy(h->Renderer, tmp);
+
NumHeads++;
return &Heads[NumHeads-1];
}
diff --git a/progs/xdemos/manywin.c b/progs/xdemos/manywin.c
index ee357f32a4..3b0810b2e5 100644
--- a/progs/xdemos/manywin.c
+++ b/progs/xdemos/manywin.c
@@ -177,14 +177,40 @@ AddHead(const char *displayName, const char *name)
/* save the info for this head */
{
struct head *h = &Heads[NumHeads];
+ const char * tmp;
+
+ if (strlen(name) + 1 > sizeof(h->DisplayName)) {
+ Error(displayName, "name string overflow");
+ return NULL;
+ }
strcpy(h->DisplayName, name);
+
h->Dpy = dpy;
h->Win = win;
h->Context = ctx;
h->Angle = 0.0;
- strcpy(h->Version, (char *) glGetString(GL_VERSION));
- strcpy(h->Vendor, (char *) glGetString(GL_VENDOR));
- strcpy(h->Renderer, (char *) glGetString(GL_RENDERER));
+
+ tmp = (char *) glGetString(GL_VERSION);
+ if (strlen(tmp) + 1 > sizeof(h->Version)) {
+ Error(displayName, "GL_VERSION string overflow");
+ return NULL;
+ }
+ strcpy(h->Version, tmp);
+
+ tmp = (char *) glGetString(GL_VENDOR);
+ if (strlen(tmp) + 1 > sizeof(h->Vendor)) {
+ Error(displayName, "GL_VENDOR string overflow");
+ return NULL;
+ }
+ strcpy(h->Vendor, tmp);
+
+ tmp = (char *) glGetString(GL_RENDERER);
+ if (strlen(tmp) + 1 > sizeof(h->Renderer)) {
+ Error(displayName, "GL_RENDERER string overflow");
+ return NULL;
+ }
+ strcpy(h->Renderer, tmp);
+
NumHeads++;
return &Heads[NumHeads-1];
}
diff --git a/progs/xdemos/sharedtex_mt.c b/progs/xdemos/sharedtex_mt.c
index f924448cc4..a90903adec 100644
--- a/progs/xdemos/sharedtex_mt.c
+++ b/progs/xdemos/sharedtex_mt.c
@@ -174,6 +174,10 @@ AddWindow(Display *dpy, const char *displayName, int xpos, int ypos,
{
static int id = 0;
struct window *h = &Windows[NumWindows];
+ if (strlen(displayName) + 1 > sizeof(h->DisplayName)) {
+ Error(displayName, "string overflow");
+ return NULL;
+ }
strcpy(h->DisplayName, displayName);
h->Dpy = dpy;
h->Win = win;