ref: 531f2ae7e3db9e05b5c34e47d25190260253fb3e
parent: 44092248453e1239d067b041c2915d2a2815b99d
author: Jean-Marc Valin <[email protected]>
date: Mon Aug 2 05:01:28 EDT 2010
Remove useless use of "long", remove useless prototypes
--- a/libcelt/entcode.h
+++ b/libcelt/entcode.h
@@ -56,34 +56,27 @@
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;
}
--- a/libcelt/entdec.c
+++ b/libcelt/entdec.c
@@ -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;
--- a/libcelt/entdec.h
+++ b/libcelt/entdec.h
@@ -123,7 +123,7 @@
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);
--- a/libcelt/entenc.c
+++ b/libcelt/entenc.c
@@ -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;
}
--- a/libcelt/entenc.h
+++ b/libcelt/entenc.h
@@ -104,7 +104,7 @@
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.
--- a/libcelt/rangedec.c
+++ b/libcelt/rangedec.c
@@ -203,10 +203,10 @@
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,
--- a/libcelt/rangeenc.c
+++ b/libcelt/rangeenc.c
@@ -168,10 +168,10 @@
_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
--- a/tests/ectest.c
+++ b/tests/ectest.c
@@ -132,7 +132,7 @@
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;
}