Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathis Rosenhauer
libaec
Commits
3322d07e
Commit
3322d07e
authored
Nov 26, 2012
by
Mathis Rosenhauer
Committed by
Thomas Jahns
Feb 19, 2013
Browse files
remove casts from malloc
parent
e7330ab0
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/decode.c
View file @
3322d07e
...
...
@@ -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
;
...
...
src/encode.c
View file @
3322d07e
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment