diff options
author | Brian Paul <[email protected]> | 2009-12-31 09:02:27 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-12-31 09:02:27 -0700 |
commit | 25024d948298a9f3f3210a0b91486f79a3917b0f (patch) | |
tree | 5647623b9781193b7ed55c8d9233404938aeb853 /progs | |
parent | d14beea534dcb2b3ae2ae1f7ee0ba5dcdef3dba3 (diff) | |
parent | 195e7657e2f15f7ad8b22042b86bcf33c5bba76b (diff) |
Merge branch 'mesa_7_7_branch'
Conflicts:
configs/darwin
src/gallium/auxiliary/util/u_clear.h
src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
src/mesa/drivers/dri/i965/brw_draw_upload.c
Diffstat (limited to 'progs')
-rw-r--r-- | progs/demos/geartrain.c | 21 | ||||
-rw-r--r-- | progs/demos/isosurf.c | 8 | ||||
-rw-r--r-- | progs/demos/terrain.c | 5 | ||||
-rw-r--r-- | progs/glsl/shtest.c | 5 | ||||
-rw-r--r-- | progs/glsl/vert-tex.c | 9 | ||||
-rw-r--r-- | progs/util/readtex.c | 20 |
6 files changed, 41 insertions, 27 deletions
diff --git a/progs/demos/geartrain.c b/progs/demos/geartrain.c index d2a195f39a2..00b6e78b724 100644 --- a/progs/demos/geartrain.c +++ b/progs/demos/geartrain.c @@ -25,6 +25,7 @@ */ +#include <assert.h> #include <math.h> #include <stdlib.h> #include <GL/glut.h> @@ -129,8 +130,10 @@ Clear_Buffers () static void LoadTriplet (TDA A) { + int result; Clear_Buffers (); - fscanf (mainfile, "%s %s %s %s", Buf1, Buf2, Buf3, Buf4); + result = fscanf (mainfile, "%s %s %s %s", Buf1, Buf2, Buf3, Buf4); + assert(result != EOF); A[0] = atof (Buf2); A[1] = atof (Buf3); A[2] = atof (Buf4); @@ -140,8 +143,10 @@ LoadTriplet (TDA A) static void LoadReal (float *a) { + int result; Clear_Buffers (); - fscanf (mainfile, "%s %s", Buf1, Buf2); + result = fscanf (mainfile, "%s %s", Buf1, Buf2); + assert(result != EOF); *a = atof (Buf2); } @@ -149,8 +154,10 @@ LoadReal (float *a) static void LoadInteger (int *a) { + int result; Clear_Buffers (); - fscanf (mainfile, "%s %s", Buf1, Buf2); + result = fscanf (mainfile, "%s %s", Buf1, Buf2); + assert(result != EOF); *a = atoi (Buf2); } @@ -158,8 +165,10 @@ LoadInteger (int *a) static void LoadText (char *a) { + int result; Clear_Buffers (); - fscanf (mainfile, "%s %s", Buf1, Buf2); + result = fscanf (mainfile, "%s %s", Buf1, Buf2); + assert(result != EOF); strcpy (a, Buf2); } @@ -177,8 +186,10 @@ getdata (char filename[]) do { + int result; Clear_Buffers (); - fscanf (mainfile, "%s", Buf1); + result = fscanf (mainfile, "%s", Buf1); + (void) result; if (ferror (mainfile)) { printf ("\nError opening file !\n"); diff --git a/progs/demos/isosurf.c b/progs/demos/isosurf.c index 56781f68189..dbe4d8d172a 100644 --- a/progs/demos/isosurf.c +++ b/progs/demos/isosurf.c @@ -132,9 +132,11 @@ static void read_surface( char *filename ) numverts = 0; while (!feof(f) && numverts<maxverts) { - fscanf( f, "%f %f %f %f %f %f", - &data[numverts][0], &data[numverts][1], &data[numverts][2], - &data[numverts][3], &data[numverts][4], &data[numverts][5] ); + int result; + result = fscanf( f, "%f %f %f %f %f %f", + &data[numverts][0], &data[numverts][1], &data[numverts][2], + &data[numverts][3], &data[numverts][4], &data[numverts][5] ); + (void) result; numverts++; } numverts--; diff --git a/progs/demos/terrain.c b/progs/demos/terrain.c index 627c3bfb57a..a72c8d3caea 100644 --- a/progs/demos/terrain.c +++ b/progs/demos/terrain.c @@ -8,6 +8,7 @@ * based on a Mikael SkiZoWalker's (MoDEL) / France ([email protected]) demo */ +#include <assert.h> #include <stdio.h> #include <math.h> #include <stdlib.h> @@ -559,12 +560,14 @@ loadpic(void) FILE *FilePic; int i, tmp; GLenum gluerr; + size_t result; if ((FilePic = fopen("terrain.dat", "r")) == NULL) { fprintf(stderr, "Error loading terrain.dat\n"); exit(-1); } - fread(bufferter, 256 * 256, 1, FilePic); + result = fread(bufferter, 256 * 256, 1, FilePic); + assert(result == 1); fclose(FilePic); for (i = 0; i < (256 * 256); i++) { diff --git a/progs/glsl/shtest.c b/progs/glsl/shtest.c index 88315d74614..e9800c307f3 100644 --- a/progs/glsl/shtest.c +++ b/progs/glsl/shtest.c @@ -492,9 +492,8 @@ ReadConfigFile(const char *filename, struct config_file *conf) conf->num_uniforms = 0; /* ugly but functional parser */ - while (!feof(f)) { - fgets(line, sizeof(line), f); - if (!feof(f) && line[0]) { + while (fgets(line, sizeof(line), f) != NULL) { + if (line[0]) { if (strncmp(line, "vs ", 3) == 0) { VertShaderFile = strdup(line + 3); VertShaderFile[strlen(VertShaderFile) - 1] = 0; diff --git a/progs/glsl/vert-tex.c b/progs/glsl/vert-tex.c index 4c8bfa587aa..2b93c788889 100644 --- a/progs/glsl/vert-tex.c +++ b/progs/glsl/vert-tex.c @@ -40,15 +40,6 @@ static GLboolean Anim = GL_TRUE; static GLboolean WireFrame = GL_TRUE; static GLfloat xRot = -70.0f, yRot = 0.0f, zRot = 0.0f; - -/* value[0] = tex unit */ -static struct uniform_info Uniforms[] = { - { "tex1", 1, GL_SAMPLER_2D, { 0, 0, 0, 0 }, -1 }, - END_OF_UNIFORMS -}; - - - static void Idle(void) { diff --git a/progs/util/readtex.c b/progs/util/readtex.c index d1c50a494aa..f6f511481ca 100644 --- a/progs/util/readtex.c +++ b/progs/util/readtex.c @@ -9,6 +9,7 @@ #include <GL/gl.h> #include <GL/glu.h> +#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -89,6 +90,7 @@ static rawImageRec *RawImageOpen(const char *fileName) rawImageRec *raw; GLenum swapFlag; int x; + size_t result; endianTest.testWord = 1; if (endianTest.testByte[0] == 1) { @@ -114,7 +116,8 @@ static rawImageRec *RawImageOpen(const char *fileName) } } - fread(raw, 1, 12, raw->file); + result = fread(raw, 1, 12, raw->file); + assert(result == 12); if (swapFlag) { ConvertShort(&raw->imagic, 1); @@ -162,8 +165,10 @@ static rawImageRec *RawImageOpen(const char *fileName) } raw->rleEnd = 512 + (2 * x); fseek(raw->file, 512, SEEK_SET); - fread(raw->rowStart, 1, x, raw->file); - fread(raw->rowSize, 1, x, raw->file); + result = fread(raw->rowStart, 1, x, raw->file); + assert(result == x); + result = fread(raw->rowSize, 1, x, raw->file); + assert(result == x); if (swapFlag) { ConvertLong(raw->rowStart, (long) (x/sizeof(GLuint))); ConvertLong((GLuint *)raw->rowSize, (long) (x/sizeof(GLint))); @@ -193,11 +198,13 @@ static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z) { unsigned char *iPtr, *oPtr, pixel; int count, done = 0; + size_t result; if ((raw->type & 0xFF00) == 0x0100) { fseek(raw->file, (long) raw->rowStart[y+z*raw->sizeY], SEEK_SET); - fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY], - raw->file); + result = fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY], + raw->file); + assert(result == (unsigned int)raw->rowSize[y+z*raw->sizeY]); iPtr = raw->tmp; oPtr = buf; @@ -222,7 +229,8 @@ static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z) } else { fseek(raw->file, 512+(y*raw->sizeX)+(z*raw->sizeX*raw->sizeY), SEEK_SET); - fread(buf, 1, raw->sizeX, raw->file); + result = fread(buf, 1, raw->sizeX, raw->file); + assert(result == raw->sizeX); } } |