summaryrefslogtreecommitdiffstats
path: root/Demo
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-02-11 14:47:11 (GMT)
committerGuido van Rossum <guido@python.org>1992-02-11 14:47:11 (GMT)
commitd61bbb33f7b19974f0a45c17ad7696eb4c310218 (patch)
treee33e6600d0e1d2415a0d61b95e75bc922186b07e /Demo
parent58b38ccc9d8ac7937dff4cc86f4908f9217c53f7 (diff)
downloadcpython-d61bbb33f7b19974f0a45c17ad7696eb4c310218.zip
cpython-d61bbb33f7b19974f0a45c17ad7696eb4c310218.tar.gz
cpython-d61bbb33f7b19974f0a45c17ad7696eb4c310218.tar.bz2
Better check of input data?
Diffstat (limited to 'Demo')
-rwxr-xr-xDemo/sgi/video/squash.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/Demo/sgi/video/squash.c b/Demo/sgi/video/squash.c
index c045084..d5ea946 100755
--- a/Demo/sgi/video/squash.c
+++ b/Demo/sgi/video/squash.c
@@ -78,9 +78,19 @@ main(argc, argv)
exit(1);
}
while( !feof(stdin) ) {
- gets(lbuf);
- if ( feof(stdin) ) break;
- puts(lbuf);
+ { int t, s;
+ gets(lbuf);
+ if ( feof(stdin) ) break;
+ if ( sscanf(lbuf, "%d,%d", &t,&s) == 2) {
+ if ( s != h*w*4 ) {
+ fprintf(stderr, "Size changed from %d to %d: %s\n",4*h*w,s, lbuf);
+ exit(1);
+ }
+ printf("%d, %d\n", t, nh*nw*4);
+ } else {
+ puts(lbuf);
+ }
+ }
fprintf(stderr, "Reading %d\n", h*w*sizeof(long));
if ( (i=fread(bm, 1, h*w*sizeof(long), stdin)) != h*w*sizeof(long)) {
fprintf(stderr, "%s: short read, %d wanted %d\n", argv[0],