| OLD | NEW |
| 1 /* Copyright (c) 2007-2011 Xiph.Org Foundation, Mozilla Corporation, | 1 /* Copyright (c) 2007-2011 Xiph.Org Foundation, Mozilla Corporation, |
| 2 Gregory Maxwell | 2 Gregory Maxwell |
| 3 Written by Jean-Marc Valin, Gregory Maxwell, and Timothy B. Terriberry */ | 3 Written by Jean-Marc Valin, Gregory Maxwell, and Timothy B. Terriberry */ |
| 4 /* | 4 /* |
| 5 Redistribution and use in source and binary forms, with or without | 5 Redistribution and use in source and binary forms, with or without |
| 6 modification, are permitted provided that the following conditions | 6 modification, are permitted provided that the following conditions |
| 7 are met: | 7 are met: |
| 8 | 8 |
| 9 - Redistributions of source code must retain the above copyright | 9 - Redistributions of source code must retain the above copyright |
| 10 notice, this list of conditions and the following disclaimer. | 10 notice, this list of conditions and the following disclaimer. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 int ftb; | 59 int ftb; |
| 60 int sz; | 60 int sz; |
| 61 int i; | 61 int i; |
| 62 int ret; | 62 int ret; |
| 63 unsigned int sym; | 63 unsigned int sym; |
| 64 unsigned int seed; | 64 unsigned int seed; |
| 65 unsigned char *ptr; | 65 unsigned char *ptr; |
| 66 const char *env_seed; | 66 const char *env_seed; |
| 67 ret=0; | 67 ret=0; |
| 68 entropy=0; | 68 entropy=0; |
| 69 if (_argc > 2) { | 69 if (_argc > 2) { |
| 70 » fprintf(stderr, "Usage: %s [<seed>]\n", _argv[0]); | 70 fprintf(stderr, "Usage: %s [<seed>]\n", _argv[0]); |
| 71 » return 1; | 71 return 1; |
| 72 } | 72 } |
| 73 env_seed = getenv("SEED"); | 73 env_seed = getenv("SEED"); |
| 74 if (_argc > 1) | 74 if (_argc > 1) |
| 75 seed = atoi(_argv[1]); | 75 seed = atoi(_argv[1]); |
| 76 else if (env_seed) | 76 else if (env_seed) |
| 77 seed = atoi(env_seed); | 77 seed = atoi(env_seed); |
| 78 else | 78 else |
| 79 seed = time(NULL); | 79 seed = time(NULL); |
| 80 /*Testing encoding of raw bit values.*/ | 80 /*Testing encoding of raw bit values.*/ |
| 81 ptr = (unsigned char *)malloc(DATA_SIZE); | 81 ptr = (unsigned char *)malloc(DATA_SIZE); |
| 82 ec_enc_init(&enc,ptr, DATA_SIZE); | 82 ec_enc_init(&enc,ptr, DATA_SIZE); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 ec_enc_bits(&enc,0,1); | 373 ec_enc_bits(&enc,0,1); |
| 374 } | 374 } |
| 375 ec_enc_done(&enc); | 375 ec_enc_done(&enc); |
| 376 if(!enc.error){ | 376 if(!enc.error){ |
| 377 fprintf(stderr,"17 raw bits encoded in two bytes"); | 377 fprintf(stderr,"17 raw bits encoded in two bytes"); |
| 378 ret=-1; | 378 ret=-1; |
| 379 } | 379 } |
| 380 free(ptr); | 380 free(ptr); |
| 381 return ret; | 381 return ret; |
| 382 } | 382 } |
| OLD | NEW |