Remove useless use of "long", remove useless prototypes

This commit is contained in:
Jean-Marc Valin 2010-08-02 09:01:28 -04:00
parent 4409224845
commit 531f2ae7e3
8 changed files with 15 additions and 22 deletions

View file

@ -56,34 +56,27 @@ struct ec_byte_buffer{
unsigned char *buf;
unsigned char *ptr;
unsigned char *end_ptr;
long storage;
ec_uint32 storage;
};
/*Encoding functions.*/
void ec_byte_writeinit_buffer(ec_byte_buffer *_b, unsigned char *_buf, long _size);
void ec_byte_shrink(ec_byte_buffer *_b, long _size);
void ec_byte_writeinit(ec_byte_buffer *_b);
void ec_byte_writetrunc(ec_byte_buffer *_b,long _bytes);
void ec_byte_writeinit_buffer(ec_byte_buffer *_b, unsigned char *_buf, ec_uint32 _size);
void ec_byte_shrink(ec_byte_buffer *_b, ec_uint32 _size);
int ec_byte_write1(ec_byte_buffer *_b,unsigned _value);
int ec_byte_write_at_end(ec_byte_buffer *_b,unsigned _value);
void ec_byte_write4(ec_byte_buffer *_b,ec_uint32 _value);
void ec_byte_writecopy(ec_byte_buffer *_b,void *_source,long _bytes);
void ec_byte_writeclear(ec_byte_buffer *_b);
/*Decoding functions.*/
void ec_byte_readinit(ec_byte_buffer *_b,unsigned char *_buf,long _bytes);
int ec_byte_look1(ec_byte_buffer *_b);
void ec_byte_readinit(ec_byte_buffer *_b,unsigned char *_buf,ec_uint32 _bytes);
unsigned char ec_byte_look_at_end(ec_byte_buffer *_b);
int ec_byte_look4(ec_byte_buffer *_b,ec_uint32 *_val);
void ec_byte_adv1(ec_byte_buffer *_b);
void ec_byte_adv4(ec_byte_buffer *_b);
int ec_byte_read1(ec_byte_buffer *_b);
int ec_byte_read4(ec_byte_buffer *_b,ec_uint32 *_val);
/*Shared functions.*/
static inline void ec_byte_reset(ec_byte_buffer *_b){
_b->ptr=_b->buf;
}
static inline long ec_byte_bytes(ec_byte_buffer *_b){
static inline ec_uint32 ec_byte_bytes(ec_byte_buffer *_b){
return _b->ptr-_b->buf;
}

View file

@ -38,7 +38,7 @@
#include "os_support.h"
#include "arch.h"
void ec_byte_readinit(ec_byte_buffer *_b,unsigned char *_buf,long _bytes){
void ec_byte_readinit(ec_byte_buffer *_b,unsigned char *_buf,ec_uint32 _bytes){
_b->buf=_b->ptr=_buf;
_b->storage=_bytes;
_b->end_ptr=_b->buf+_bytes-1;

View file

@ -123,7 +123,7 @@ int ec_dec_bit_prob(ec_dec *_this,unsigned _prob);
Return: The number of bits scaled by 2**_b.
This will always be slightly larger than the exact value (e.g., all
rounding error is in the positive direction).*/
long ec_dec_tell(ec_dec *_this,int _b);
ec_uint32 ec_dec_tell(ec_dec *_this,int _b);
/*Returns a nonzero value if any error has been detected during decoding*/
int ec_dec_get_error(ec_dec *_this);

View file

@ -38,13 +38,13 @@
#include "arch.h"
void ec_byte_writeinit_buffer(ec_byte_buffer *_b, unsigned char *_buf, long _size){
void ec_byte_writeinit_buffer(ec_byte_buffer *_b, unsigned char *_buf, ec_uint32 _size){
_b->ptr=_b->buf=_buf;
_b->end_ptr=_b->buf+_size-1;
_b->storage=_size;
}
void ec_byte_shrink(ec_byte_buffer *_b, long _size){
void ec_byte_shrink(ec_byte_buffer *_b, ec_uint32 _size){
_b->end_ptr=_b->buf+_size-1;
_b->storage=_size;
}

View file

@ -104,7 +104,7 @@ void ec_enc_bit_prob(ec_enc *_this,int val,unsigned _prob);
Return: The number of bits scaled by 2**_b.
This will always be slightly larger than the exact value (e.g., all
rounding error is in the positive direction).*/
long ec_enc_tell(ec_enc *_this,int _b);
ec_uint32 ec_enc_tell(ec_enc *_this,int _b);
/*Indicates that there are no more symbols to encode.
All reamining output bytes are flushed to the output buffer.

View file

@ -203,10 +203,10 @@ int ec_dec_bit_prob(ec_dec *_this,unsigned _prob){
return val;
}
long ec_dec_tell(ec_dec *_this,int _b){
ec_uint32 ec_dec_tell(ec_dec *_this,int _b){
ec_uint32 r;
int l;
long nbits;
ec_uint32 nbits;
nbits=(ec_byte_bytes(_this->buf)-(EC_CODE_BITS+EC_SYM_BITS-1)/EC_SYM_BITS)*
EC_SYM_BITS;
/*To handle the non-integral number of bits still left in the decoder state,

View file

@ -168,10 +168,10 @@ void ec_encode_raw(ec_enc *_this,unsigned _fl,unsigned _fh,unsigned bits){
_this->end_bits_left -= bits;
}
long ec_enc_tell(ec_enc *_this,int _b){
ec_uint32 ec_enc_tell(ec_enc *_this,int _b){
ec_uint32 r;
int l;
long nbits;
ec_uint32 nbits;
nbits=(ec_byte_bytes(_this->buf)+(_this->rem>=0)+_this->ext)*EC_SYM_BITS;
/*To handle the non-integral number of bits still left in the encoder state,
we compute the number of bits of low that must be encoded to ensure that

View file

@ -132,7 +132,7 @@ int main(int _argc,char **_argv){
ec_enc_done(&enc);
if ((tell_bits+7)/8 < ec_byte_bytes(&buf))
{
fprintf (stderr, "tell() lied, there's %li bytes instead of %d (Random seed: %u)\n",
fprintf (stderr, "tell() lied, there's %i bytes instead of %d (Random seed: %u)\n",
ec_byte_bytes(&buf), (tell_bits+7)/8,seed);
ret=-1;
}