int main(int argc, char* argv[]) { int rv = bs_init(argc, argv); if (rv == SC_OK) { bs_start(); bs_stop(); } bs_destroy(); return rv; }
void vdvi_state_destroy(uint16_t idx, u_char **s) { vdvi_state_t *v; v = (vdvi_state_t*)*s; xfree(v->as); bs_destroy(&v->bs); xfree(v); *s = (u_char*)NULL; UNUSED(idx); }
/* * SimBridge * --------- * Simulates the coordination of cars and trucks on a a single lane bridge using * threads, mutex, and condition variables. * * author: Jonathan Nagy <*****@*****.**> * studentid: (220103482) * date: 15 July 2016 * * arguments: * none * * returns: writes the coordinated bridge activity and the traffic behaviour to * stdout */ int main(int argc, char **argv) { struct bs_t *bs = bs_create(THREADCOUNT); pthread_t *pts = pts_create(THREADCOUNT, bs); pts_join(THREADCOUNT, pts); pts_destroy(pts); bs_destroy(bs); return(0); }
int main(int argc, char *argv[]) { int fd,bits=3; struct bitsaver bs; const char* output_fn = "out.bin"; int opt,offset=0; while ((opt = getopt (argc, argv, "b:h")) != -1) { switch (opt) { case 'b': bits = atoi(optarg); offset += 2; break; case 'h': fprintf(stderr,"bitsaver\n" " -h print help\n" " -b <bits> the upper bound for the number of bits to try permuting on the file (default 3).\n" ); exit(0); break; } } if (argc + offset< 3) { errx(1, "usage: %s [ -b <bits> | -h ] <zlib-file> <hash>\n", argv[0]); } bs_init(&bs, argv[1+offset], argv[2+offset]); bitsaver_t r = bs_check_bits_compressed(&bs,bits); if (r == BS_SUCCESS) { printf("Found original file. Saving to %s\n",output_fn); bs_save(&bs, output_fn); } else { printf("Could not find original file after checking all combinations ( ~ %zd choose %d + %zd choose %d ).\n", bs.inflated_size, bits, bs.data_size,bits); } bs_destroy(&bs); return 0; }
int vdvi_peek_frame_size(uint16_t idx, u_char *data, int data_len) { bitstream_t *bs; u_char dvi_buf[80]; int len; UNUSED(idx); bs_create(&bs); bs_attach(bs, data, data_len); len = vdvi_decode(bs, dvi_buf, 160); bs_destroy(&bs); assert(len <= data_len); return len; }