]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Better check of input data?
authorGuido van Rossum <guido@python.org>
Tue, 11 Feb 1992 14:47:11 +0000 (14:47 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 11 Feb 1992 14:47:11 +0000 (14:47 +0000)
Demo/sgi/video/squash.c

index c045084f51e035b7f8b561d8c2b29cfad88e17d8..d5ea94692495541c590fb6dfe15e303fc12ddd0b 100755 (executable)
@@ -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],