summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathis Rosenhauer <rosenhauer@dkrz.de>2014-08-05 10:11:35 +0200
committerMathis Rosenhauer <rosenhauer@dkrz.de>2014-08-06 13:39:08 +0200
commit06815d5026e8cc58b054b2d9dfafc20d167341e7 (patch)
tree78c0169b57aca49d7c55e9110a241871a7284911
parentb75565ff22fc6ab47d9ac74399b4c0681068afda (diff)
downloadlibaec-06815d5026e8cc58b054b2d9dfafc20d167341e7.tar.gz
libaec-06815d5026e8cc58b054b2d9dfafc20d167341e7.tar.bz2
libaec-06815d5026e8cc58b054b2d9dfafc20d167341e7.zip
Fix -pedantic warnings.
-rw-r--r--src/aec.c5
-rw-r--r--src/decode.c18
-rw-r--r--src/encode.c12
3 files changed, 18 insertions, 17 deletions
diff --git a/src/aec.c b/src/aec.c
index 2ac5fb4..14d9569 100644
--- a/src/aec.c
+++ b/src/aec.c
@@ -58,7 +58,7 @@
#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) {
(*iarg)++;
@@ -78,7 +78,8 @@ int main(int argc, char *argv[])
unsigned char *in;
unsigned char *out;
size_t total_out;
- int chunk, status;
+ unsigned int chunk;
+ int status;
int input_avail, output_avail;
char *infn, *outfn;
FILE *infp, *outfp;
diff --git a/src/decode.c b/src/decode.c
index eea6542..f636c3a 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -82,7 +82,7 @@
state->last_out = *state->rsi_buffer; \
\
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 */ \
state->last_out = (state->last_out ^ m) - m; \
} \
@@ -251,7 +251,7 @@ static inline uint32_t direct_get(struct aec_stream *strm, int n)
fill_acc(strm);
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)
@@ -271,7 +271,7 @@ static inline uint32_t direct_get_fs(struct aec_stream *strm)
#endif
struct internal_state *state = strm->state;
- state->acc &= ((1ULL << state->bitp) - 1);
+ state->acc &= ((UINT64_C(1) << state->bitp) - 1);
while (state->acc == 0) {
fs += state->bitp;
@@ -289,7 +289,7 @@ static inline uint32_t direct_get_fs(struct aec_stream *strm)
state->bitp = lz;
#else
state->bitp--;
- while ((state->acc & (1ULL << state->bitp)) == 0) {
+ while ((state->acc & (UINT64_C(1) << state->bitp)) == 0) {
state->bitp--;
fs++;
}
@@ -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)
{
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)
@@ -325,7 +325,7 @@ static inline uint32_t fs_ask(struct aec_stream *strm)
{
if (bits_ask(strm, 1) == 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->avail_in == 0)
return 0;
@@ -703,11 +703,11 @@ int aec_decode_init(struct aec_stream *strm)
}
if (strm->flags & AEC_DATA_SIGNED) {
- state->xmin = -(1LL << (strm->bits_per_sample - 1));
- state->xmax = (1ULL << (strm->bits_per_sample - 1)) - 1;
+ state->xmin = -(INT64_C(1) << (strm->bits_per_sample - 1));
+ state->xmax = (UINT64_C(1) << (strm->bits_per_sample - 1)) - 1;
} else {
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
diff --git a/src/encode.c b/src/encode.c
index 0daadd8..8046326 100644
--- a/src/encode.c
+++ b/src/encode.c
@@ -136,7 +136,7 @@ static inline void emitblock_fs(struct aec_stream *strm, int k, int ref)
acc = 0;
used -= 64;
}
- acc |= 1ULL << (63 - used);
+ acc |= UINT64_C(1) << (63 - used);
}
copy64(state->cds, acc);
@@ -154,7 +154,7 @@ static inline void emitblock(struct aec_stream *strm, int k, int ref)
struct internal_state *state = strm->state;
uint32_t *in = state->block + ref;
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;
int p = state->bits;
@@ -283,7 +283,7 @@ static void preprocess_signed(struct aec_stream *strm)
struct internal_state *state = strm->state;
uint32_t *restrict d = state->data_pp;
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 xmin = state->xmin;
uint32_t rsi = strm->rsi * strm->block_size - 1;
@@ -853,12 +853,12 @@ int aec_encode_init(struct aec_stream *strm)
state->rsi_len = strm->rsi * strm->block_size * state->bytes_per_sample;
if (strm->flags & AEC_DATA_SIGNED) {
- state->xmin = -(1LL << (strm->bits_per_sample - 1));
- state->xmax = (1ULL << (strm->bits_per_sample - 1)) - 1;
+ state->xmin = -(INT64_C(1) << (strm->bits_per_sample - 1));
+ state->xmax = (UINT64_C(1) << (strm->bits_per_sample - 1)) - 1;
state->preprocess = preprocess_signed;
} else {
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;
}