remove casts from malloc
authorMathis Rosenhauer <rosenhauer@dkrz.de>
Mon, 26 Nov 2012 16:34:15 +0000 (17:34 +0100)
committerThomas Jahns <jahns@dkrz.de>
Tue, 19 Feb 2013 10:33:01 +0000 (11:33 +0100)
src/decode.c
src/encode.c

index 061da95..2b871d2 100644 (file)
@@ -69,7 +69,7 @@
     static void flush_##KIND(struct aec_stream *strm)                   \
     {                                                                   \
         int i;                                                          \
-        int64_t x, d, th, D, lower, m, sample;                          \
+        int64_t x, d, th, D, lower, m;                                  \
         int64_t data;                                                   \
         struct internal_state *state = strm->state;                     \
                                                                         \
@@ -605,11 +605,11 @@ int aec_decode_init(struct aec_stream *strm)
     if (strm->bits_per_sample > 32 || strm->bits_per_sample == 0)
         return AEC_CONF_ERROR;
 
-    state = (struct internal_state *) malloc(sizeof(struct internal_state));
+    state = malloc(sizeof(struct internal_state));
     if (state == NULL)
         return AEC_MEM_ERROR;
 
-    state->se_table = (int *) malloc(182 * sizeof(int));
+    state->se_table = malloc(182 * sizeof(int));
     if (state->se_table == NULL)
         return AEC_MEM_ERROR;
 
@@ -674,12 +674,12 @@ int aec_decode_init(struct aec_stream *strm)
     }
     state->id_table[modi - 1] = m_uncomp;
 
-    state->block = (int64_t *)malloc(strm->block_size * sizeof(int64_t));
+    state->block = malloc(strm->block_size * sizeof(int64_t));
     if (state->block == NULL)
         return AEC_MEM_ERROR;
 
     state->buf_size = strm->rsi * strm->block_size;
-    state->buf = (uint32_t *)malloc(state->buf_size * sizeof(uint32_t));
+    state->buf = malloc(state->buf_size * sizeof(uint32_t));
     if (state->buf == NULL)
         return AEC_MEM_ERROR;
 
index 73d065e..cc5eef4 100644 (file)
@@ -744,7 +744,7 @@ int aec_encode_init(struct aec_stream *strm)
     if (strm->rsi > 4096)
         return AEC_CONF_ERROR;
 
-    state = (struct internal_state *)malloc(sizeof(struct internal_state));
+    state = malloc(sizeof(struct internal_state));
     if (state == NULL)
         return AEC_MEM_ERROR;
 
@@ -809,16 +809,16 @@ int aec_encode_init(struct aec_stream *strm)
 
     state->kmax = (1U << state->id_len) - 3;
 
-    state->data_pp = (uint32_t *)malloc(strm->rsi
-                                         * strm->block_size
-                                         * sizeof(uint32_t));
+    state->data_pp = malloc(strm->rsi
+                            * strm->block_size
+                            * sizeof(uint32_t));
     if (state->data_pp == NULL)
         return AEC_MEM_ERROR;
 
     if (strm->flags & AEC_DATA_PREPROCESS) {
-        state->data_raw = (uint32_t *)malloc(strm->rsi
-                                             * strm->block_size
-                                             * sizeof(uint32_t));
+        state->data_raw = malloc(strm->rsi
+                                 * strm->block_size
+                                 * sizeof(uint32_t));
         if (state->data_raw == NULL)
             return AEC_MEM_ERROR;
     } else {
@@ -829,7 +829,7 @@ int aec_encode_init(struct aec_stream *strm)
 
     /* Largest possible CDS according to specs */
     state->cds_len = (5 + 64 * 32) / 8 + 3;
-    state->cds_buf = (uint8_t *)malloc(state->cds_len);
+    state->cds_buf = malloc(state->cds_len);
     if (state->cds_buf == NULL)
         return AEC_MEM_ERROR;