1. Carl D
  2. bit-parser

Commits

Carl D  committed d2663dc

save

  • Participants
  • Parent commits 3c0dc3e
  • Branches egg

Comments (0)

Files changed (1)

File bitstream-c.c

View file
  • Ignore whitespace
   }
 }
 
+unsigned int stream_read(void *user) {
+  unsigned ch;
+  fread(&ch, 1, 1, (FILE*)user);
+  return ch;
+}
+
 #if MAIN
 int 
 main(int argc, char *argv[])
   unsigned long long v[16];
   FILE           *fp = fopen(argv[1], "rb");
   bit_stream_init(&st1, fp);
+  st1.read = stream_read;
 m0:
   v[0] = bit_stream_read(&st1, 3);
   v[1] = bit_stream_read(&st1, 3);
   printf("id:       %lld\n", v[4]);
 p0:
   v[5] = bit_stream_read(&st1, 1);
-  if (feof(st1.fp))
-    goto f0;
   if (v[5] == 1)
     goto tv0;
   else