Commit 06815d50 authored by Mathis Rosenhauer's avatar Mathis Rosenhauer
Browse files

Fix -pedantic warnings.

parent b75565ff
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
#define CHUNK 10485760 #define CHUNK 10485760
int get_param(int *param, int *iarg, char *argv[]) int get_param(unsigned int *param, int *iarg, char *argv[])
{ {
if (strlen(argv[*iarg]) == 2) { if (strlen(argv[*iarg]) == 2) {
(*iarg)++; (*iarg)++;
...@@ -78,7 +78,8 @@ int main(int argc, char *argv[]) ...@@ -78,7 +78,8 @@ int main(int argc, char *argv[])
unsigned char *in; unsigned char *in;
unsigned char *out; unsigned char *out;
size_t total_out; size_t total_out;
int chunk, status; unsigned int chunk;
int status;
int input_avail, output_avail; int input_avail, output_avail;
char *infn, *outfn; char *infn, *outfn;
FILE *infp, *outfp; FILE *infp, *outfp;
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
state->last_out = *state->rsi_buffer; \ state->last_out = *state->rsi_buffer; \
\ \
if (strm->flags & AEC_DATA_SIGNED) { \ if (strm->flags & AEC_DATA_SIGNED) { \
m = 1ULL << (strm->bits_per_sample - 1); \ m = UINT64_C(1) << (strm->bits_per_sample - 1); \
/* Reference samples have to be sign extended */ \ /* Reference samples have to be sign extended */ \
state->last_out = (state->last_out ^ m) - m; \ state->last_out = (state->last_out ^ m) - m; \
} \ } \
...@@ -251,7 +251,7 @@ static inline uint32_t direct_get(struct aec_stream *strm, int n) ...@@ -251,7 +251,7 @@ static inline uint32_t direct_get(struct aec_stream *strm, int n)
fill_acc(strm); fill_acc(strm);
state->bitp -= n; state->bitp -= n;
return (state->acc >> state->bitp) & ((1ULL << n) - 1); return (state->acc >> state->bitp) & ((UINT64_C(1) << n) - 1);
} }
static inline uint32_t direct_get_fs(struct aec_stream *strm) static inline uint32_t direct_get_fs(struct aec_stream *strm)
...@@ -271,7 +271,7 @@ static inline uint32_t direct_get_fs(struct aec_stream *strm) ...@@ -271,7 +271,7 @@ static inline uint32_t direct_get_fs(struct aec_stream *strm)
#endif #endif
struct internal_state *state = strm->state; struct internal_state *state = strm->state;
state->acc &= ((1ULL << state->bitp) - 1); state->acc &= ((UINT64_C(1) << state->bitp) - 1);
while (state->acc == 0) { while (state->acc == 0) {
fs += state->bitp; fs += state->bitp;
...@@ -289,7 +289,7 @@ static inline uint32_t direct_get_fs(struct aec_stream *strm) ...@@ -289,7 +289,7 @@ static inline uint32_t direct_get_fs(struct aec_stream *strm)
state->bitp = lz; state->bitp = lz;
#else #else
state->bitp--; state->bitp--;
while ((state->acc & (1ULL << state->bitp)) == 0) { while ((state->acc & (UINT64_C(1) << state->bitp)) == 0) {
state->bitp--; state->bitp--;
fs++; fs++;
} }
...@@ -313,7 +313,7 @@ static inline uint32_t bits_ask(struct aec_stream *strm, int n) ...@@ -313,7 +313,7 @@ static inline uint32_t bits_ask(struct aec_stream *strm, int n)
static inline uint32_t bits_get(struct aec_stream *strm, int n) static inline uint32_t bits_get(struct aec_stream *strm, int n)
{ {
return (strm->state->acc >> (strm->state->bitp - n)) return (strm->state->acc >> (strm->state->bitp - n))
& ((1ULL << n) - 1); & ((UINT64_C(1) << n) - 1);
} }
static inline void bits_drop(struct aec_stream *strm, int n) static inline void bits_drop(struct aec_stream *strm, int n)
...@@ -325,7 +325,7 @@ static inline uint32_t fs_ask(struct aec_stream *strm) ...@@ -325,7 +325,7 @@ static inline uint32_t fs_ask(struct aec_stream *strm)
{ {
if (bits_ask(strm, 1) == 0) if (bits_ask(strm, 1) == 0)
return 0; return 0;
while ((strm->state->acc & (1ULL << (strm->state->bitp - 1))) == 0) { while ((strm->state->acc & (UINT64_C(1) << (strm->state->bitp - 1))) == 0) {
if (strm->state->bitp == 1) { if (strm->state->bitp == 1) {
if (strm->avail_in == 0) if (strm->avail_in == 0)
return 0; return 0;
...@@ -703,11 +703,11 @@ int aec_decode_init(struct aec_stream *strm) ...@@ -703,11 +703,11 @@ int aec_decode_init(struct aec_stream *strm)
} }
if (strm->flags & AEC_DATA_SIGNED) { if (strm->flags & AEC_DATA_SIGNED) {
state->xmin = -(1LL << (strm->bits_per_sample - 1)); state->xmin = -(INT64_C(1) << (strm->bits_per_sample - 1));
state->xmax = (1ULL << (strm->bits_per_sample - 1)) - 1; state->xmax = (UINT64_C(1) << (strm->bits_per_sample - 1)) - 1;
} else { } else {
state->xmin = 0; state->xmin = 0;
state->xmax = (1ULL << strm->bits_per_sample) - 1; state->xmax = (UINT64_C(1) << strm->bits_per_sample) - 1;
} }
state->in_blklen = (strm->block_size * strm->bits_per_sample state->in_blklen = (strm->block_size * strm->bits_per_sample
......
...@@ -136,7 +136,7 @@ static inline void emitblock_fs(struct aec_stream *strm, int k, int ref) ...@@ -136,7 +136,7 @@ static inline void emitblock_fs(struct aec_stream *strm, int k, int ref)
acc = 0; acc = 0;
used -= 64; used -= 64;
} }
acc |= 1ULL << (63 - used); acc |= UINT64_C(1) << (63 - used);
} }
copy64(state->cds, acc); copy64(state->cds, acc);
...@@ -154,7 +154,7 @@ static inline void emitblock(struct aec_stream *strm, int k, int ref) ...@@ -154,7 +154,7 @@ static inline void emitblock(struct aec_stream *strm, int k, int ref)
struct internal_state *state = strm->state; struct internal_state *state = strm->state;
uint32_t *in = state->block + ref; uint32_t *in = state->block + ref;
uint32_t *in_end = state->block + strm->block_size; uint32_t *in_end = state->block + strm->block_size;
uint64_t mask = (1ULL << k) - 1; uint64_t mask = (UINT64_C(1) << k) - 1;
uint8_t *o = state->cds; uint8_t *o = state->cds;
int p = state->bits; int p = state->bits;
...@@ -283,7 +283,7 @@ static void preprocess_signed(struct aec_stream *strm) ...@@ -283,7 +283,7 @@ static void preprocess_signed(struct aec_stream *strm)
struct internal_state *state = strm->state; struct internal_state *state = strm->state;
uint32_t *restrict d = state->data_pp; uint32_t *restrict d = state->data_pp;
int32_t *restrict x = (int32_t *)state->data_raw; int32_t *restrict x = (int32_t *)state->data_raw;
uint32_t m = 1ULL << (strm->bits_per_sample - 1); uint32_t m = UINT64_C(1) << (strm->bits_per_sample - 1);
int64_t xmax = state->xmax; int64_t xmax = state->xmax;
int64_t xmin = state->xmin; int64_t xmin = state->xmin;
uint32_t rsi = strm->rsi * strm->block_size - 1; uint32_t rsi = strm->rsi * strm->block_size - 1;
...@@ -853,12 +853,12 @@ int aec_encode_init(struct aec_stream *strm) ...@@ -853,12 +853,12 @@ int aec_encode_init(struct aec_stream *strm)
state->rsi_len = strm->rsi * strm->block_size * state->bytes_per_sample; state->rsi_len = strm->rsi * strm->block_size * state->bytes_per_sample;
if (strm->flags & AEC_DATA_SIGNED) { if (strm->flags & AEC_DATA_SIGNED) {
state->xmin = -(1LL << (strm->bits_per_sample - 1)); state->xmin = -(INT64_C(1) << (strm->bits_per_sample - 1));
state->xmax = (1ULL << (strm->bits_per_sample - 1)) - 1; state->xmax = (UINT64_C(1) << (strm->bits_per_sample - 1)) - 1;
state->preprocess = preprocess_signed; state->preprocess = preprocess_signed;
} else { } else {
state->xmin = 0; state->xmin = 0;
state->xmax = (1ULL << strm->bits_per_sample) - 1; state->xmax = (UINT64_C(1) << strm->bits_per_sample) - 1;
state->preprocess = preprocess_unsigned; state->preprocess = preprocess_unsigned;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment