summaryrefslogtreecommitdiff
path: root/progs/demos
diff options
context:
space:
mode:
Diffstat (limited to 'progs/demos')
-rw-r--r--progs/demos/engine.c18
-rw-r--r--progs/demos/fbotexture.c1
-rw-r--r--progs/demos/fire.c10
-rw-r--r--progs/demos/isosurf.c1
-rw-r--r--progs/demos/morph3d.c1
5 files changed, 24 insertions, 7 deletions
diff --git a/progs/demos/engine.c b/progs/demos/engine.c
index c54e3b8fb8..7e485111da 100644
--- a/progs/demos/engine.c
+++ b/progs/demos/engine.c
@@ -120,7 +120,11 @@ static Engine Engines[NUM_ENGINES] =
0.3, /* CrankJournalRadius */
0.4, /* CrankJournalLength */
1.5, /* ConnectingRodLength */
- 0.1 /* ConnectingRodThickness */
+ 0.1, /* ConnectingRodThickness */
+ 0, /* CrankList */
+ 0, /* ConnRodList */
+ 0, /* PistonList */
+ 0 /* BlockList */
},
{
"Inline-4",
@@ -136,7 +140,11 @@ static Engine Engines[NUM_ENGINES] =
0.3, /* CrankJournalRadius */
0.4, /* CrankJournalLength */
1.5, /* ConnectingRodLength */
- 0.1 /* ConnectingRodThickness */
+ 0.1, /* ConnectingRodThickness */
+ 0, /* CrankList */
+ 0, /* ConnRodList */
+ 0, /* PistonList */
+ 0 /* BlockList */
},
{
"Boxer-6",
@@ -152,7 +160,11 @@ static Engine Engines[NUM_ENGINES] =
0.3, /* CrankJournalRadius */
0.4, /* CrankJournalLength */
1.5, /* ConnectingRodLength */
- 0.1 /* ConnectingRodThickness */
+ 0.1, /* ConnectingRodThickness */
+ 0, /* CrankList */
+ 0, /* ConnRodList */
+ 0, /* PistonList */
+ 0 /* BlockList */
}
};
diff --git a/progs/demos/fbotexture.c b/progs/demos/fbotexture.c
index 56482663dc..46bf1c5f6a 100644
--- a/progs/demos/fbotexture.c
+++ b/progs/demos/fbotexture.c
@@ -14,7 +14,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <math.h>
#include "extfuncs.h"
/* For debug */
diff --git a/progs/demos/fire.c b/progs/demos/fire.c
index 3db45418fa..bb912fb447 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>
@@ -725,8 +726,13 @@ main(int ac, char **av)
maxage = 1.0 / dt;
- if (ac == 2)
+ if (ac == 2) {
np = atoi(av[1]);
+ if (np <= 0 || np > 1000000) {
+ fprintf(stderr, "Invalid input.\n");
+ exit(-1);
+ }
+ }
if (ac == 4) {
WIDTH = atoi(av[2]);
@@ -758,7 +764,9 @@ 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);
+ assert(p);
for (i = 0; i < np; i++)
setnewpart(&p[i]);
diff --git a/progs/demos/isosurf.c b/progs/demos/isosurf.c
index dbe4d8d172..a5b21ffb5c 100644
--- a/progs/demos/isosurf.c
+++ b/progs/demos/isosurf.c
@@ -27,7 +27,6 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
-#include <string.h>
#include <math.h>
#ifdef _WIN32
#include <windows.h>
diff --git a/progs/demos/morph3d.c b/progs/demos/morph3d.c
index 0f8ac426f3..07458eb156 100644
--- a/progs/demos/morph3d.c
+++ b/progs/demos/morph3d.c
@@ -137,7 +137,6 @@ So the angle is:
#endif
#include <GL/glut.h>
#include <math.h>
-#include <string.h>
#define Scale 0.3