summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2012-04-04 21:29:25 +1000
committerErik de Castro Lopo <erikd@mega-nerd.com>2012-04-04 21:29:25 +1000
commit6c2040dc90b21f0cf652c066ee51690df30fa32e (patch)
tree9bb302a4d83377e8e7ad1482ef951211f3b2ce13 /src
parentafedee12513f9a7204da74e0b7bb6f2ad6189c35 (diff)
downloadflac-6c2040dc90b21f0cf652c066ee51690df30fa32e.tar.gz
Remove casting of return value from *alloc() functions.
Diffstat (limited to 'src')
-rw-r--r--src/flac/foreign_metadata.c2
-rw-r--r--src/flac/main.c4
-rw-r--r--src/libFLAC/bitreader.c4
-rw-r--r--src/libFLAC/bitwriter.c6
-rw-r--r--src/libFLAC/format.c4
-rw-r--r--src/libFLAC/md5.c6
-rw-r--r--src/libFLAC/memory.c10
-rw-r--r--src/libFLAC/metadata_iterators.c28
-rw-r--r--src/libFLAC/metadata_object.c34
-rw-r--r--src/libFLAC/ogg_helper.c4
-rw-r--r--src/libFLAC/stream_decoder.c44
-rw-r--r--src/libFLAC/stream_encoder.c10
-rw-r--r--src/metaflac/operations.c4
-rw-r--r--src/metaflac/options.c14
-rw-r--r--src/metaflac/utils.c2
-rw-r--r--src/plugin_common/charset.c2
-rw-r--r--src/plugin_common/tags.c6
-rw-r--r--src/share/getopt/getopt.c2
-rw-r--r--src/share/grabbag/picture.c6
-rw-r--r--src/share/utf8/charset.c14
-rw-r--r--src/share/utf8/iconvert.c18
-rw-r--r--src/test_libFLAC/metadata_manip.c2
-rw-r--r--src/test_libFLAC/metadata_object.c14
-rw-r--r--src/test_libs_common/metadata_utils.c18
-rw-r--r--src/test_seeking/main.c2
25 files changed, 130 insertions, 130 deletions
diff --git a/src/flac/foreign_metadata.c b/src/flac/foreign_metadata.c
index c9b4d71d..924217aa 100644
--- a/src/flac/foreign_metadata.c
+++ b/src/flac/foreign_metadata.c
@@ -682,7 +682,7 @@ static FLAC__bool write_to_iff_(foreign_metadata_t *fm, FILE *fin, FILE *fout, o
foreign_metadata_t *flac__foreign_metadata_new(foreign_block_type_t type)
{
/* calloc() to zero all the member variables */
- foreign_metadata_t *x = (foreign_metadata_t*)calloc(sizeof(foreign_metadata_t), 1);
+ foreign_metadata_t *x = calloc(sizeof(foreign_metadata_t), 1);
if(x) {
x->type = type;
x->is_rf64 = false;
diff --git a/src/flac/main.c b/src/flac/main.c
index d35c960d..80af14c0 100644
--- a/src/flac/main.c
+++ b/src/flac/main.c
@@ -638,7 +638,7 @@ int parse_options(int argc, char *argv[])
if(option_values.num_files > 0) {
unsigned i = 0;
- if(0 == (option_values.filenames = (char**)malloc(sizeof(char*) * option_values.num_files)))
+ if(0 == (option_values.filenames = malloc(sizeof(char*) * option_values.num_files)))
die("out of memory allocating space for file names list");
while(share__optind < argc)
option_values.filenames[i++] = local_strdup(argv[share__optind++]);
@@ -1896,7 +1896,7 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
if(encode_infile != stdin && grabbag__file_are_same(infilename, outfilename)) {
static const char *tmp_suffix = ".tmp,fl-ac+en'c";
/*@@@@ still a remote possibility that a file with this filename exists */
- if(0 == (internal_outfilename = (char *)safe_malloc_add_3op_(strlen(outfilename), /*+*/strlen(tmp_suffix), /*+*/1))) {
+ if(0 == (internal_outfilename = safe_malloc_add_3op_(strlen(outfilename), /*+*/strlen(tmp_suffix), /*+*/1))) {
flac__utils_printf(stderr, 1, "ERROR allocating memory for tempfile name\n");
conditional_fclose(encode_infile);
return 1;
diff --git a/src/libFLAC/bitreader.c b/src/libFLAC/bitreader.c
index 55807e3c..cd05a62b 100644
--- a/src/libFLAC/bitreader.c
+++ b/src/libFLAC/bitreader.c
@@ -259,7 +259,7 @@ FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br)
FLAC__BitReader *FLAC__bitreader_new(void)
{
- FLAC__BitReader *br = (FLAC__BitReader*)calloc(1, sizeof(FLAC__BitReader));
+ FLAC__BitReader *br = calloc(1, sizeof(FLAC__BitReader));
/* calloc() implies:
memset(br, 0, sizeof(FLAC__BitReader));
@@ -294,7 +294,7 @@ FLAC__bool FLAC__bitreader_init(FLAC__BitReader *br, FLAC__CPUInfo cpu, FLAC__Bi
br->words = br->bytes = 0;
br->consumed_words = br->consumed_bits = 0;
br->capacity = FLAC__BITREADER_DEFAULT_CAPACITY;
- br->buffer = (uint32_t*)malloc(sizeof(uint32_t) * br->capacity);
+ br->buffer = malloc(sizeof(uint32_t) * br->capacity);
if(br->buffer == 0)
return false;
br->read_callback = rcb;
diff --git a/src/libFLAC/bitwriter.c b/src/libFLAC/bitwriter.c
index 60fb560f..651440dc 100644
--- a/src/libFLAC/bitwriter.c
+++ b/src/libFLAC/bitwriter.c
@@ -118,7 +118,7 @@ static FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, unsigned bits_to_add)
FLAC__ASSERT(new_capacity > bw->capacity);
FLAC__ASSERT(new_capacity >= bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD));
- new_buffer = (bwword*)safe_realloc_mul_2op_(bw->buffer, sizeof(bwword), /*times*/new_capacity);
+ new_buffer = safe_realloc_mul_2op_(bw->buffer, sizeof(bwword), /*times*/new_capacity);
if(new_buffer == 0)
return false;
bw->buffer = new_buffer;
@@ -135,7 +135,7 @@ static FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, unsigned bits_to_add)
FLAC__BitWriter *FLAC__bitwriter_new(void)
{
- FLAC__BitWriter *bw = (FLAC__BitWriter*)calloc(1, sizeof(FLAC__BitWriter));
+ FLAC__BitWriter *bw = calloc(1, sizeof(FLAC__BitWriter));
/* note that calloc() sets all members to 0 for us */
return bw;
}
@@ -160,7 +160,7 @@ FLAC__bool FLAC__bitwriter_init(FLAC__BitWriter *bw)
bw->words = bw->bits = 0;
bw->capacity = FLAC__BITWRITER_DEFAULT_CAPACITY;
- bw->buffer = (bwword*)malloc(sizeof(bwword) * bw->capacity);
+ bw->buffer = malloc(sizeof(bwword) * bw->capacity);
if(bw->buffer == 0)
return false;
diff --git a/src/libFLAC/format.c b/src/libFLAC/format.c
index 6da76c2f..c7454f83 100644
--- a/src/libFLAC/format.c
+++ b/src/libFLAC/format.c
@@ -587,9 +587,9 @@ FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_s
FLAC__ASSERT(object->capacity_by_order > 0 || (0 == object->parameters && 0 == object->raw_bits));
if(object->capacity_by_order < max_partition_order) {
- if(0 == (object->parameters = (unsigned*)realloc(object->parameters, sizeof(unsigned)*(1 << max_partition_order))))
+ if(0 == (object->parameters = realloc(object->parameters, sizeof(unsigned)*(1 << max_partition_order))))
return false;
- if(0 == (object->raw_bits = (unsigned*)realloc(object->raw_bits, sizeof(unsigned)*(1 << max_partition_order))))
+ if(0 == (object->raw_bits = realloc(object->raw_bits, sizeof(unsigned)*(1 << max_partition_order))))
return false;
memset(object->raw_bits, 0, sizeof(unsigned)*(1 << max_partition_order));
object->capacity_by_order = max_partition_order;
diff --git a/src/libFLAC/md5.c b/src/libFLAC/md5.c
index 6de9b1c9..e251d50b 100644
--- a/src/libFLAC/md5.c
+++ b/src/libFLAC/md5.c
@@ -139,7 +139,7 @@ static void byteSwap(FLAC__uint32 *buf, unsigned words)
{
register FLAC__uint32 x;
do {
- x = *buf;
+ x = *buf;
x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff);
*buf++ = (x >> 16) | (x << 16);
} while (--words);
@@ -402,10 +402,10 @@ FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const
return false;
if(ctx->capacity < bytes_needed) {
- FLAC__byte *tmp = (FLAC__byte*)realloc(ctx->internal_buf, bytes_needed);
+ FLAC__byte *tmp = realloc(ctx->internal_buf, bytes_needed);
if(0 == tmp) {
free(ctx->internal_buf);
- if(0 == (ctx->internal_buf = (FLAC__byte*)safe_malloc_(bytes_needed)))
+ if(0 == (ctx->internal_buf = safe_malloc_(bytes_needed)))
return false;
}
else
diff --git a/src/libFLAC/memory.c b/src/libFLAC/memory.c
index 8870efe9..b9e5d34d 100644
--- a/src/libFLAC/memory.c
+++ b/src/libFLAC/memory.c
@@ -87,7 +87,7 @@ FLAC__bool FLAC__memory_alloc_aligned_int32_array(size_t elements, FLAC__int32 *
if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
return false;
- pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
+ pu = FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
if(0 == pu) {
return false;
}
@@ -116,7 +116,7 @@ FLAC__bool FLAC__memory_alloc_aligned_uint32_array(size_t elements, FLAC__uint32
if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
return false;
- pu = (FLAC__uint32*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
+ pu = FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
if(0 == pu) {
return false;
}
@@ -145,7 +145,7 @@ FLAC__bool FLAC__memory_alloc_aligned_uint64_array(size_t elements, FLAC__uint64
if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
return false;
- pu = (FLAC__uint64*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
+ pu = FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
if(0 == pu) {
return false;
}
@@ -174,7 +174,7 @@ FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(size_t elements, unsigned *
if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
return false;
- pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
+ pu = FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
if(0 == pu) {
return false;
}
@@ -205,7 +205,7 @@ FLAC__bool FLAC__memory_alloc_aligned_real_array(size_t elements, FLAC__real **u
if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */
return false;
- pu = (FLAC__real*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
+ pu = FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv);
if(0 == pu) {
return false;
}
diff --git a/src/libFLAC/metadata_iterators.c b/src/libFLAC/metadata_iterators.c
index 32e8ed30..cab476a7 100644
--- a/src/libFLAC/metadata_iterators.c
+++ b/src/libFLAC/metadata_iterators.c
@@ -374,7 +374,7 @@ FLAC_API const char * const FLAC__Metadata_SimpleIteratorStatusString[] = {
FLAC_API FLAC__Metadata_SimpleIterator *FLAC__metadata_simple_iterator_new(void)
{
- FLAC__Metadata_SimpleIterator *iterator = (FLAC__Metadata_SimpleIterator*)calloc(1, sizeof(FLAC__Metadata_SimpleIterator));
+ FLAC__Metadata_SimpleIterator *iterator = calloc(1, sizeof(FLAC__Metadata_SimpleIterator));
if(0 != iterator) {
iterator->file = 0;
@@ -940,7 +940,7 @@ FLAC_API const char * const FLAC__Metadata_ChainStatusString[] = {
static FLAC__Metadata_Node *node_new_(void)
{
- return (FLAC__Metadata_Node*)calloc(1, sizeof(FLAC__Metadata_Node));
+ return calloc(1, sizeof(FLAC__Metadata_Node));
}
static void node_delete_(FLAC__Metadata_Node *node)
@@ -1496,7 +1496,7 @@ static FLAC__bool chain_rewrite_file_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHa
FLAC_API FLAC__Metadata_Chain *FLAC__metadata_chain_new(void)
{
- FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)calloc(1, sizeof(FLAC__Metadata_Chain));
+ FLAC__Metadata_Chain *chain = calloc(1, sizeof(FLAC__Metadata_Chain));
if(0 != chain)
chain_init_(chain);
@@ -1831,7 +1831,7 @@ FLAC_API void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain)
FLAC_API FLAC__Metadata_Iterator *FLAC__metadata_iterator_new(void)
{
- FLAC__Metadata_Iterator *iterator = (FLAC__Metadata_Iterator*)calloc(1, sizeof(FLAC__Metadata_Iterator));
+ FLAC__Metadata_Iterator *iterator = calloc(1, sizeof(FLAC__Metadata_Iterator));
/* calloc() implies:
iterator->current = 0;
@@ -2167,7 +2167,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLA
block->data = 0;
}
else {
- if(0 == (block->data = (FLAC__byte*)malloc(block_length)))
+ if(0 == (block->data = malloc(block_length)))
return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
if(read_cb(block->data, 1, block_length, handle) != block_length)
@@ -2188,7 +2188,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC_
if(block->num_points == 0)
block->points = 0;
- else if(0 == (block->points = (FLAC__StreamMetadata_SeekPoint*)safe_malloc_mul_2op_(block->num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint))))
+ else if(0 == (block->points = safe_malloc_mul_2op_(block->num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint))))
return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
for(i = 0; i < block->num_points; i++) {
@@ -2221,7 +2221,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entr
entry->entry = 0;
}
else {
- if(0 == (entry->entry = (FLAC__byte*)safe_malloc_add_2op_(entry->length, /*+*/1)))
+ if(0 == (entry->entry = safe_malloc_add_2op_(entry->length, /*+*/1)))
return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
if(read_cb(entry->entry, 1, entry->length, handle) != entry->length)
@@ -2252,7 +2252,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(
if(block->num_comments == 0) {
block->comments = 0;
}
- else if(0 == (block->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)calloc(block->num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry))))
+ else if(0 == (block->comments = calloc(block->num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry))))
return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
for(i = 0; i < block->num_comments; i++) {
@@ -2307,7 +2307,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_track_cb_(
if(track->num_indices == 0) {
track->indices = 0;
}
- else if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)calloc(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index))))
+ else if(0 == (track->indices = calloc(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index))))
return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
for(i = 0; i < track->num_indices; i++) {
@@ -2367,7 +2367,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_cb_(FLAC__
if(block->num_tracks == 0) {
block->tracks = 0;
}
- else if(0 == (block->tracks = (FLAC__StreamMetadata_CueSheet_Track*)calloc(block->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track))))
+ else if(0 == (block->tracks = calloc(block->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track))))
return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
for(i = 0; i < block->num_tracks; i++) {
@@ -2396,7 +2396,7 @@ static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_picture_cstr
if(0 != *data)
free(*data);
- if(0 == (*data = (FLAC__byte*)safe_malloc_add_2op_(*length, /*+*/1)))
+ if(0 == (*data = safe_malloc_add_2op_(*length, /*+*/1)))
return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
if(*length > 0) {
@@ -2470,7 +2470,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__I
block->data = 0;
}
else {
- if(0 == (block->data = (FLAC__byte*)malloc(block_length)))
+ if(0 == (block->data = malloc(block_length)))
return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
if(read_cb(block->data, 1, block_length, handle) != block_length)
@@ -3215,7 +3215,7 @@ FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path_prefix
{
static const char *tempfile_suffix = ".metadata_edit";
if(0 == tempfile_path_prefix) {
- if(0 == (*tempfilename = (char*)safe_malloc_add_3op_(strlen(filename), /*+*/strlen(tempfile_suffix), /*+*/1))) {
+ if(0 == (*tempfilename = safe_malloc_add_3op_(strlen(filename), /*+*/strlen(tempfile_suffix), /*+*/1))) {
*status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -3229,7 +3229,7 @@ FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path_prefix
else
p++;
- if(0 == (*tempfilename = (char*)safe_malloc_add_4op_(strlen(tempfile_path_prefix), /*+*/strlen(p), /*+*/strlen(tempfile_suffix), /*+*/2))) {
+ if(0 == (*tempfilename = safe_malloc_add_4op_(strlen(tempfile_path_prefix), /*+*/strlen(p), /*+*/strlen(tempfile_suffix), /*+*/2))) {
*status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
return false;
}
diff --git a/src/libFLAC/metadata_object.c b/src/libFLAC/metadata_object.c
index d586b173..7f178f81 100644
--- a/src/libFLAC/metadata_object.c
+++ b/src/libFLAC/metadata_object.c
@@ -61,7 +61,7 @@ static FLAC__bool copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsigned
FLAC__ASSERT(0 != to);
if(bytes > 0 && 0 != from) {
FLAC__byte *x;
- if(0 == (x = (FLAC__byte*)safe_malloc_(bytes)))
+ if(0 == (x = safe_malloc_(bytes)))
return false;
memcpy(x, from, bytes);
*to = x;
@@ -95,7 +95,7 @@ static FLAC__bool free_copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsi
/* realloc() failure leaves entry unchanged */
static FLAC__bool ensure_null_terminated_(FLAC__byte **entry, unsigned length)
{
- FLAC__byte *x = (FLAC__byte*)safe_realloc_add_2op_(*entry, length, /*+*/1);
+ FLAC__byte *x = safe_realloc_add_2op_(*entry, length, /*+*/1);
if(0 != x) {
x[length] = '\0';
*entry = x;
@@ -133,7 +133,7 @@ static FLAC__bool copy_vcentry_(FLAC__StreamMetadata_VorbisComment_Entry *to, co
else {
FLAC__byte *x;
FLAC__ASSERT(from->length > 0);
- if(0 == (x = (FLAC__byte*)safe_malloc_add_2op_(from->length, /*+*/1)))
+ if(0 == (x = safe_malloc_add_2op_(from->length, /*+*/1)))
return false;
memcpy(x, from->entry, from->length);
x[from->length] = '\0';
@@ -151,7 +151,7 @@ static FLAC__bool copy_track_(FLAC__StreamMetadata_CueSheet_Track *to, const FLA
else {
FLAC__StreamMetadata_CueSheet_Index *x;
FLAC__ASSERT(from->num_indices > 0);
- if(0 == (x = (FLAC__StreamMetadata_CueSheet_Index*)safe_malloc_mul_2op_(from->num_indices, /*times*/sizeof(FLAC__StreamMetadata_CueSheet_Index))))
+ if(0 == (x = safe_malloc_mul_2op_(from->num_indices, /*times*/sizeof(FLAC__StreamMetadata_CueSheet_Index))))
return false;
memcpy(x, from->indices, from->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index));
to->indices = x;
@@ -173,7 +173,7 @@ static FLAC__StreamMetadata_SeekPoint *seekpoint_array_new_(unsigned num_points)
FLAC__ASSERT(num_points > 0);
- object_array = (FLAC__StreamMetadata_SeekPoint*)safe_malloc_mul_2op_(num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint));
+ object_array = safe_malloc_mul_2op_(num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint));
if(0 != object_array) {
unsigned i;
@@ -206,7 +206,7 @@ static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_new_(
{
FLAC__ASSERT(num_comments > 0);
- return (FLAC__StreamMetadata_VorbisComment_Entry*)safe_calloc_(num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry));
+ return safe_calloc_(num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry));
}
static void vorbiscomment_entry_array_delete_(FLAC__StreamMetadata_VorbisComment_Entry *object_array, unsigned num_comments)
@@ -345,14 +345,14 @@ static FLAC__StreamMetadata_CueSheet_Index *cuesheet_track_index_array_new_(unsi
{
FLAC__ASSERT(num_indices > 0);
- return (FLAC__StreamMetadata_CueSheet_Index*)safe_calloc_(num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index));
+ return safe_calloc_(num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index));
}
static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_new_(unsigned num_tracks)
{
FLAC__ASSERT(num_tracks > 0);
- return (FLAC__StreamMetadata_CueSheet_Track*)safe_calloc_(num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track));
+ return safe_calloc_(num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track));
}
static void cuesheet_track_array_delete_(FLAC__StreamMetadata_CueSheet_Track *object_array, unsigned num_tracks)
@@ -437,7 +437,7 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type
if(type > FLAC__MAX_METADATA_TYPE_CODE)
return 0;
- object = (FLAC__StreamMetadata*)calloc(1, sizeof(FLAC__StreamMetadata));
+ object = calloc(1, sizeof(FLAC__StreamMetadata));
if(0 != object) {
object->is_last = false;
object->type = type;
@@ -952,7 +952,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMe
free(object->data.seek_table.points);
object->data.seek_table.points = 0;
}
- else if(0 == (object->data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)realloc(object->data.seek_table.points, new_size)))
+ else if(0 == (object->data.seek_table.points = realloc(object->data.seek_table.points, new_size)))
return false;
/* if growing, set new elements to placeholders */
@@ -1191,7 +1191,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__St
free(object->data.vorbis_comment.comments);
object->data.vorbis_comment.comments = 0;
}
- else if(0 == (object->data.vorbis_comment.comments = (FLAC__StreamMetadata_VorbisComment_Entry*)realloc(object->data.vorbis_comment.comments, new_size)))
+ else if(0 == (object->data.vorbis_comment.comments = realloc(object->data.vorbis_comment.comments, new_size)))
return false;
/* if growing, zero all the length/pointers of new elements */
@@ -1328,7 +1328,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_from_name_value_pa
const size_t nn = strlen(field_name);
const size_t nv = strlen(field_value);
entry->length = nn + 1 /*=*/ + nv;
- if(0 == (entry->entry = (FLAC__byte*)safe_malloc_add_4op_(nn, /*+*/1, /*+*/nv, /*+*/1)))
+ if(0 == (entry->entry = safe_malloc_add_4op_(nn, /*+*/1, /*+*/nv, /*+*/1)))
return false;
memcpy(entry->entry, field_name, nn);
entry->entry[nn] = '=';
@@ -1355,9 +1355,9 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair
FLAC__ASSERT(0 != eq);
if(0 == eq)
return false; /* double protection */
- if(0 == (*field_name = (char*)safe_malloc_add_2op_(nn, /*+*/1)))
+ if(0 == (*field_name = safe_malloc_add_2op_(nn, /*+*/1)))
return false;
- if(0 == (*field_value = (char*)safe_malloc_add_2op_(nv, /*+*/1))) {
+ if(0 == (*field_value = safe_malloc_add_2op_(nv, /*+*/1))) {
free(*field_name);
return false;
}
@@ -1435,7 +1435,7 @@ FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entries_matching(FLAC__S
FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_new(void)
{
- return (FLAC__StreamMetadata_CueSheet_Track*)calloc(1, sizeof(FLAC__StreamMetadata_CueSheet_Track));
+ return calloc(1, sizeof(FLAC__StreamMetadata_CueSheet_Track));
}
FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_clone(const FLAC__StreamMetadata_CueSheet_Track *object)
@@ -1500,7 +1500,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__St
free(track->indices);
track->indices = 0;
}
- else if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)realloc(track->indices, new_size)))
+ else if(0 == (track->indices = realloc(track->indices, new_size)))
return false;
/* if growing, zero all the lengths/pointers of new elements */
@@ -1596,7 +1596,7 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMet
free(object->data.cue_sheet.tracks);
object->data.cue_sheet.tracks = 0;
}
- else if(0 == (object->data.cue_sheet.tracks = (FLAC__StreamMetadata_CueSheet_Track*)realloc(object->data.cue_sheet.tracks, new_size)))
+ else if(0 == (object->data.cue_sheet.tracks = realloc(object->data.cue_sheet.tracks, new_size)))
return false;
/* if growing, zero all the lengths/pointers of new elements */
diff --git a/src/libFLAC/ogg_helper.c b/src/libFLAC/ogg_helper.c
index 08173680..700d1834 100644
--- a/src/libFLAC/ogg_helper.c
+++ b/src/libFLAC/ogg_helper.c
@@ -113,7 +113,7 @@ FLAC__bool simple_ogg_page__get_at(FLAC__StreamEncoder *encoder, FLAC__uint64 po
}
/* allocate space for the page header */
- if(0 == (page->header = (unsigned char *)safe_malloc_(OGG_MAX_HEADER_LEN))) {
+ if(0 == (page->header = safe_malloc_(OGG_MAX_HEADER_LEN))) {
encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -155,7 +155,7 @@ FLAC__bool simple_ogg_page__get_at(FLAC__StreamEncoder *encoder, FLAC__uint64 po
}
/* allocate space for the page body */
- if(0 == (page->body = (unsigned char *)safe_malloc_(page->body_len))) {
+ if(0 == (page->body = safe_malloc_(page->body_len))) {
encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
return false;
}
diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c
index 67654b8e..6f960232 100644
--- a/src/libFLAC/stream_decoder.c
+++ b/src/libFLAC/stream_decoder.c
@@ -276,18 +276,18 @@ FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void)
FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */
- decoder = (FLAC__StreamDecoder*)calloc(1, sizeof(FLAC__StreamDecoder));
+ decoder = calloc(1, sizeof(FLAC__StreamDecoder));
if(decoder == 0) {
return 0;
}
- decoder->protected_ = (FLAC__StreamDecoderProtected*)calloc(1, sizeof(FLAC__StreamDecoderProtected));
+ decoder->protected_ = calloc(1, sizeof(FLAC__StreamDecoderProtected));
if(decoder->protected_ == 0) {
free(decoder);
return 0;
}
- decoder->private_ = (FLAC__StreamDecoderPrivate*)calloc(1, sizeof(FLAC__StreamDecoderPrivate));
+ decoder->private_ = calloc(1, sizeof(FLAC__StreamDecoderPrivate));
if(decoder->private_ == 0) {
free(decoder->protected_);
free(decoder);
@@ -303,7 +303,7 @@ FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void)
}
decoder->private_->metadata_filter_ids_capacity = 16;
- if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) * decoder->private_->metadata_filter_ids_capacity))) {
+ if(0 == (decoder->private_->metadata_filter_ids = malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) * decoder->private_->metadata_filter_ids_capacity))) {
FLAC__bitreader_delete(decoder->private_->input);
free(decoder->private_);
free(decoder->protected_);
@@ -780,7 +780,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__
FLAC__ASSERT(0 != decoder->private_->metadata_filter_ids);
if(decoder->private_->metadata_filter_ids_count == decoder->private_->metadata_filter_ids_capacity) {
- if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2))) {
+ if(0 == (decoder->private_->metadata_filter_ids = safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -839,7 +839,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__S
FLAC__ASSERT(0 != decoder->private_->metadata_filter_ids);
if(decoder->private_->metadata_filter_ids_count == decoder->private_->metadata_filter_ids_capacity) {
- if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2))) {
+ if(0 == (decoder->private_->metadata_filter_ids = safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -1283,7 +1283,7 @@ FILE *get_binary_stdin_(void)
*/
#if defined _MSC_VER || defined __MINGW32__
_setmode(_fileno(stdin), _O_BINARY);
-#elif defined __CYGWIN__
+#elif defined __CYGWIN__
/* almost certainly not needed for any modern Cygwin, but let's be safe... */
setmode(_fileno(stdin), _O_BINARY);
#elif defined __EMX__
@@ -1321,7 +1321,7 @@ FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, unsigned size, unsigne
* (at negative indices) for alignment purposes; we use 4
* to keep the data well-aligned.
*/
- tmp = (FLAC__int32*)safe_malloc_muladd2_(sizeof(FLAC__int32), /*times (*/size, /*+*/4/*)*/);
+ tmp = safe_malloc_muladd2_(sizeof(FLAC__int32), /*times (*/size, /*+*/4/*)*/);
if(tmp == 0) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
@@ -1492,7 +1492,7 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder)
case FLAC__METADATA_TYPE_APPLICATION:
/* remember, we read the ID already */
if(real_length > 0) {
- if(0 == (block.data.application.data = (FLAC__byte*)malloc(real_length))) {
+ if(0 == (block.data.application.data = malloc(real_length))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -1520,7 +1520,7 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder)
break;
default:
if(real_length > 0) {
- if(0 == (block.data.unknown.data = (FLAC__byte*)malloc(real_length))) {
+ if(0 == (block.data.unknown.data = malloc(real_length))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -1674,7 +1674,7 @@ FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_
decoder->private_->seek_table.data.seek_table.num_points = length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
/* use realloc since we may pass through here several times (e.g. after seeking) */
- if(0 == (decoder->private_->seek_table.data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)safe_realloc_mul_2op_(decoder->private_->seek_table.data.seek_table.points, decoder->private_->seek_table.data.seek_table.num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)))) {
+ if(0 == (decoder->private_->seek_table.data.seek_table.points = safe_realloc_mul_2op_(decoder->private_->seek_table.data.seek_table.points, decoder->private_->seek_table.data.seek_table.num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -1713,7 +1713,7 @@ FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__Stre
if(!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->vendor_string.length))
return false; /* read_callback_ sets the state for us */
if(obj->vendor_string.length > 0) {
- if(0 == (obj->vendor_string.entry = (FLAC__byte*)safe_malloc_add_2op_(obj->vendor_string.length, /*+*/1))) {
+ if(0 == (obj->vendor_string.entry = safe_malloc_add_2op_(obj->vendor_string.length, /*+*/1))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -1731,7 +1731,7 @@ FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__Stre
/* read comments */
if(obj->num_comments > 0) {
- if(0 == (obj->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)safe_malloc_mul_2op_(obj->num_comments, /*times*/sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) {
+ if(0 == (obj->comments = safe_malloc_mul_2op_(obj->num_comments, /*times*/sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -1740,7 +1740,7 @@ FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__Stre
if(!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->comments[i].length))
return false; /* read_callback_ sets the state for us */
if(obj->comments[i].length > 0) {
- if(0 == (obj->comments[i].entry = (FLAC__byte*)safe_malloc_add_2op_(obj->comments[i].length, /*+*/1))) {
+ if(0 == (obj->comments[i].entry = safe_malloc_add_2op_(obj->comments[i].length, /*+*/1))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -1786,7 +1786,7 @@ FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMet
obj->num_tracks = x;
if(obj->num_tracks > 0) {
- if(0 == (obj->tracks = (FLAC__StreamMetadata_CueSheet_Track*)safe_calloc_(obj->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) {
+ if(0 == (obj->tracks = safe_calloc_(obj->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -1819,7 +1819,7 @@ FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMet
track->num_indices = (FLAC__byte)x;
if(track->num_indices > 0) {
- if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)safe_calloc_(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) {
+ if(0 == (track->indices = safe_calloc_(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -1856,7 +1856,7 @@ FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMeta
/* read MIME type */
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN))
return false; /* read_callback_ sets the state for us */
- if(0 == (obj->mime_type = (char*)safe_malloc_add_2op_(x, /*+*/1))) {
+ if(0 == (obj->mime_type = safe_malloc_add_2op_(x, /*+*/1))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -1869,7 +1869,7 @@ FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMeta
/* read description */
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN))
return false; /* read_callback_ sets the state for us */
- if(0 == (obj->description = (FLAC__byte*)safe_malloc_add_2op_(x, /*+*/1))) {
+ if(0 == (obj->description = safe_malloc_add_2op_(x, /*+*/1))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -1898,7 +1898,7 @@ FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMeta
/* read data */
if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &(obj->data_length), FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN))
return false; /* read_callback_ sets the state for us */
- if(0 == (obj->data = (FLAC__byte*)safe_malloc_(obj->data_length))) {
+ if(0 == (obj->data = safe_malloc_(obj->data_length))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -3144,11 +3144,11 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s
}
/* our last move backwards wasn't big enough, try again */
approx_bytes_per_frame = approx_bytes_per_frame? approx_bytes_per_frame * 2 : 16;
- continue;
+ continue;
}
/* allow one seek over upper bound, so we can get a correct upper_bound_sample for streams with unknown total_samples */
first_seek = false;
-
+
/* make sure we are not seeking in corrupted stream */
if (this_frame_sample < lower_bound_sample) {
decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR;
@@ -3188,7 +3188,7 @@ FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint
FLAC__bool did_a_seek;
unsigned iteration = 0;
- /* In the first iterations, we will calculate the target byte position
+ /* In the first iterations, we will calculate the target byte position
* by the distance from the target sample to left_sample and
* right_sample (let's call it "proportional search"). After that, we
* will switch to binary search.
diff --git a/src/libFLAC/stream_encoder.c b/src/libFLAC/stream_encoder.c
index eb1b1e0b..dd36b70b 100644
--- a/src/libFLAC/stream_encoder.c
+++ b/src/libFLAC/stream_encoder.c
@@ -521,18 +521,18 @@ FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(void)
FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */
- encoder = (FLAC__StreamEncoder*)calloc(1, sizeof(FLAC__StreamEncoder));
+ encoder = calloc(1, sizeof(FLAC__StreamEncoder));
if(encoder == 0) {
return 0;
}
- encoder->protected_ = (FLAC__StreamEncoderProtected*)calloc(1, sizeof(FLAC__StreamEncoderProtected));
+ encoder->protected_ = calloc(1, sizeof(FLAC__StreamEncoderProtected));
if(encoder->protected_ == 0) {
free(encoder);
return 0;
}
- encoder->private_ = (FLAC__StreamEncoderPrivate*)calloc(1, sizeof(FLAC__StreamEncoderPrivate));
+ encoder->private_ = calloc(1, sizeof(FLAC__StreamEncoderPrivate));
if(encoder->private_ == 0) {
free(encoder->protected_);
free(encoder);
@@ -976,7 +976,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_(
*/
encoder->private_->verify.input_fifo.size = encoder->protected_->blocksize+OVERREAD_;
for(i = 0; i < encoder->protected_->channels; i++) {
- if(0 == (encoder->private_->verify.input_fifo.data[i] = (FLAC__int32*)safe_malloc_mul_2op_(sizeof(FLAC__int32), /*times*/encoder->private_->verify.input_fifo.size))) {
+ if(0 == (encoder->private_->verify.input_fifo.data[i] = safe_malloc_mul_2op_(sizeof(FLAC__int32), /*times*/encoder->private_->verify.input_fifo.size))) {
encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
}
@@ -1717,7 +1717,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encod
}
if(num_blocks) {
FLAC__StreamMetadata **m;
- if(0 == (m = (FLAC__StreamMetadata**)safe_malloc_mul_2op_(sizeof(m[0]), /*times*/num_blocks)))
+ if(0 == (m = safe_malloc_mul_2op_(sizeof(m[0]), /*times*/num_blocks)))
return false;
memcpy(m, metadata, sizeof(m[0]) * num_blocks);
encoder->protected_->metadata = m;
diff --git a/src/metaflac/operations.c b/src/metaflac/operations.c
index 4df8fd55..62d5701f 100644
--- a/src/metaflac/operations.c
+++ b/src/metaflac/operations.c
@@ -448,8 +448,8 @@ FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned nu
}
if(
- 0 == (title_gains = (float*)safe_malloc_mul_2op_(sizeof(float), /*times*/num_files)) ||
- 0 == (title_peaks = (float*)safe_malloc_mul_2op_(sizeof(float), /*times*/num_files))
+ 0 == (title_gains = safe_malloc_mul_2op_(sizeof(float), /*times*/num_files)) ||
+ 0 == (title_peaks = safe_malloc_mul_2op_(sizeof(float), /*times*/num_files))
)
die("out of memory allocating space for title gains/peaks");
diff --git a/src/metaflac/options.c b/src/metaflac/options.c
index f2b68314..eb3498d0 100644
--- a/src/metaflac/options.c
+++ b/src/metaflac/options.c
@@ -186,7 +186,7 @@ FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options)
if(options->num_files > 0) {
unsigned i = 0;
- if(0 == (options->filenames = (char**)safe_malloc_mul_2op_(sizeof(char*), /*times*/options->num_files)))
+ if(0 == (options->filenames = safe_malloc_mul_2op_(sizeof(char*), /*times*/options->num_files)))
die("out of memory allocating space for file names list");
while(share__optind < argc)
options->filenames[i++] = local_strdup(argv[share__optind++]);
@@ -713,7 +713,7 @@ void append_new_operation(CommandLineOptions *options, Operation operation)
{
if(options->ops.capacity == 0) {
options->ops.capacity = 50;
- if(0 == (options->ops.operations = (Operation*)malloc(sizeof(Operation) * options->ops.capacity)))
+ if(0 == (options->ops.operations = malloc(sizeof(Operation) * options->ops.capacity)))
die("out of memory allocating space for option list");
memset(options->ops.operations, 0, sizeof(Operation) * options->ops.capacity);
}
@@ -722,7 +722,7 @@ void append_new_operation(CommandLineOptions *options, Operation operation)
if(options->ops.capacity > UINT32_MAX / 2) /* overflow check */
die("out of memory allocating space for option list");
options->ops.capacity *= 2;
- if(0 == (options->ops.operations = (Operation*)safe_realloc_mul_2op_(options->ops.operations, sizeof(Operation), /*times*/options->ops.capacity)))
+ if(0 == (options->ops.operations = safe_realloc_mul_2op_(options->ops.operations, sizeof(Operation), /*times*/options->ops.capacity)))
die("out of memory allocating space for option list");
memset(options->ops.operations + original_capacity, 0, sizeof(Operation) * (options->ops.capacity - original_capacity));
}
@@ -734,7 +734,7 @@ void append_new_argument(CommandLineOptions *options, Argument argument)
{
if(options->args.capacity == 0) {
options->args.capacity = 50;
- if(0 == (options->args.arguments = (Argument*)malloc(sizeof(Argument) * options->args.capacity)))
+ if(0 == (options->args.arguments = malloc(sizeof(Argument) * options->args.capacity)))
die("out of memory allocating space for option list");
memset(options->args.arguments, 0, sizeof(Argument) * options->args.capacity);
}
@@ -743,7 +743,7 @@ void append_new_argument(CommandLineOptions *options, Argument argument)
if(options->args.capacity > UINT32_MAX / 2) /* overflow check */
die("out of memory allocating space for option list");
options->args.capacity *= 2;
- if(0 == (options->args.arguments = (Argument*)safe_realloc_mul_2op_(options->args.arguments, sizeof(Argument), /*times*/options->args.capacity)))
+ if(0 == (options->args.arguments = safe_realloc_mul_2op_(options->args.arguments, sizeof(Argument), /*times*/options->args.capacity)))
die("out of memory allocating space for option list");
memset(options->args.arguments + original_capacity, 0, sizeof(Argument) * (options->args.capacity - original_capacity));
}
@@ -974,7 +974,7 @@ FLAC__bool parse_block_number(const char *in, Argument_BlockNumber *out)
/* make space */
FLAC__ASSERT(out->num_entries > 0);
- if(0 == (out->entries = (unsigned*)safe_malloc_mul_2op_(sizeof(unsigned), /*times*/out->num_entries)))
+ if(0 == (out->entries = safe_malloc_mul_2op_(sizeof(unsigned), /*times*/out->num_entries)))
die("out of memory allocating space for option list");
/* load 'em up */
@@ -1013,7 +1013,7 @@ FLAC__bool parse_block_type(const char *in, Argument_BlockType *out)
/* make space */
FLAC__ASSERT(out->num_entries > 0);
- if(0 == (out->entries = (Argument_BlockTypeEntry*)safe_malloc_mul_2op_(sizeof(Argument_BlockTypeEntry), /*times*/out->num_entries)))
+ if(0 == (out->entries = safe_malloc_mul_2op_(sizeof(Argument_BlockTypeEntry), /*times*/out->num_entries)))
die("out of memory allocating space for option list");
/* load 'em up */
diff --git a/src/metaflac/utils.c b/src/metaflac/utils.c
index b3bf7080..6c45f711 100644
--- a/src/metaflac/utils.c
+++ b/src/metaflac/utils.c
@@ -69,7 +69,7 @@ void local_strcat(char **dest, const char *source)
if(nsource == 0)
return;
- *dest = (char*)safe_realloc_add_3op_(*dest, ndest, /*+*/nsource, /*+*/1);
+ *dest = safe_realloc_add_3op_(*dest, ndest, /*+*/nsource, /*+*/1);
if(0 == *dest)
die("out of memory growing string");
strcpy((*dest)+ndest, source);
diff --git a/src/plugin_common/charset.c b/src/plugin_common/charset.c
index 41b0a01f..e2cd043a 100644
--- a/src/plugin_common/charset.c
+++ b/src/plugin_common/charset.c
@@ -85,7 +85,7 @@ char* FLAC_plugin__charset_convert_string (const char *string, char *from, char
outsize = ((length + 3) & ~3) + 1;
if(outsize < length) /* overflow check */
return NULL;
- out = (char*)malloc(outsize);
+ out = malloc(outsize);
outleft = outsize - 1;
outptr = out;
diff --git a/src/plugin_common/tags.c b/src/plugin_common/tags.c
index 85ef4997..9b7658f8 100644
--- a/src/plugin_common/tags.c
+++ b/src/plugin_common/tags.c
@@ -128,7 +128,7 @@ static FLAC__uint16 *local__convert_utf8_to_ucs2(const char *src, unsigned lengt
}
/* allocate */
- out = (FLAC__uint16*)safe_malloc_mul_2op_(chars, /*times*/sizeof(FLAC__uint16));
+ out = safe_malloc_mul_2op_(chars, /*times*/sizeof(FLAC__uint16));
if (0 == out) {
FLAC__ASSERT(0);
return 0;
@@ -193,7 +193,7 @@ static char *local__convert_ucs2_to_utf8(const FLAC__uint16 *src, unsigned lengt
}
/* allocate */
- out = (char*)safe_malloc_mul_2op_(len, /*times*/sizeof(char));
+ out = safe_malloc_mul_2op_(len, /*times*/sizeof(char));
if (0 == out)
return 0;
@@ -316,7 +316,7 @@ FLAC__bool FLAC_plugin__tags_add_tag_utf8(FLAC__StreamMetadata *tags, const char
const size_t value_len = strlen(value);
const size_t separator_len = strlen(separator);
FLAC__byte *new_entry;
- if(0 == (new_entry = (FLAC__byte*)safe_realloc_add_4op_(entry->entry, entry->length, /*+*/value_len, /*+*/separator_len, /*+*/1)))
+ if(0 == (new_entry = safe_realloc_add_4op_(entry->entry, entry->length, /*+*/value_len, /*+*/separator_len, /*+*/1)))
return false;
memcpy(new_entry+entry->length, separator, separator_len);
entry->length += separator_len;
diff --git a/src/share/getopt/getopt.c b/src/share/getopt/getopt.c
index 279dff02..5663bc16 100644
--- a/src/share/getopt/getopt.c
+++ b/src/share/getopt/getopt.c
@@ -447,7 +447,7 @@ share___getopt_initialize (argc, argv, optstring)
if (nonoption_flags_max_len < argc)
nonoption_flags_max_len = argc;
__getopt_nonoption_flags =
- (char *) malloc (nonoption_flags_max_len);
+ malloc (nonoption_flags_max_len);
if (__getopt_nonoption_flags == NULL)
nonoption_flags_max_len = -1;
else
diff --git a/src/share/grabbag/picture.c b/src/share/grabbag/picture.c
index 3619f0c3..d17da006 100644
--- a/src/share/grabbag/picture.c
+++ b/src/share/grabbag/picture.c
@@ -30,7 +30,7 @@
/* slightly different that strndup(): this always copies 'size' bytes starting from s into a NUL-terminated string. */
static char *local__strndup_(const char *s, size_t size)
{
- char *x = (char*)safe_malloc_add_2op_(size, /*+*/1);
+ char *x = safe_malloc_add_2op_(size, /*+*/1);
if(x) {
memcpy(x, s, size);
x[size] = '\0';
@@ -360,7 +360,7 @@ FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, con
if(size < 0)
*error_message = error_messages[5];
else {
- FLAC__byte *buffer = (FLAC__byte*)safe_malloc_(size);
+ FLAC__byte *buffer = safe_malloc_(size);
if(0 == buffer)
*error_message = error_messages[0];
else {
@@ -395,7 +395,7 @@ FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, con
if(*error_message == 0) {
if(
- obj->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD &&
+ obj->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD &&
(
(strcmp(obj->data.picture.mime_type, "image/png") && strcmp(obj->data.picture.mime_type, "-->")) ||
obj->data.picture.width != 32 ||
diff --git a/src/share/utf8/charset.c b/src/share/utf8/charset.c
index dcef6fc9..4824db97 100644
--- a/src/share/utf8/charset.c
+++ b/src/share/utf8/charset.c
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -334,7 +334,7 @@ static struct inverse_map *make_inverse_map(const unsigned short *from)
char used[256];
int i, j, k;
- to = (struct inverse_map *)malloc(sizeof(struct inverse_map));
+ to = malloc(sizeof(struct inverse_map));
if (!to)
return 0;
for (i = 0; i < 256; i++)
@@ -447,9 +447,9 @@ struct charset *charset_find(const char *code)
for (i = 0; maps[i].name; i++)
if (!ascii_strcasecmp(code, maps[i].name)) {
if (!maps[i].charset) {
- maps[i].charset = (struct charset *)malloc(sizeof(struct charset));
+ maps[i].charset = malloc(sizeof(struct charset));
if (maps[i].charset) {
- struct map *map = (struct map *)malloc(sizeof(struct map));
+ struct map *map = malloc(sizeof(struct map));
if (!map) {
free(maps[i].charset);
maps[i].charset = 0;
@@ -493,7 +493,7 @@ int charset_convert(const char *fromcode, const char *tocode,
if (!charset1 || !charset2 )
return -1;
- tobuf = (char *)safe_malloc_mul2add_(fromlen, /*times*/charset2->max, /*+*/1);
+ tobuf = safe_malloc_mul2add_(fromlen, /*times*/charset2->max, /*+*/1);
if (!tobuf)
return -2;
diff --git a/src/share/utf8/iconvert.c b/src/share/utf8/iconvert.c
index f0311ee0..022f4c2e 100644
--- a/src/share/utf8/iconvert.c
+++ b/src/share/utf8/iconvert.c
@@ -1,16 +1,16 @@
/*
* Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -82,7 +82,7 @@ int iconvert(const char *fromcode, const char *tocode,
* This is deliberately not a config option as people often
* change their iconv library without rebuilding applications.
*/
- tocode1 = (char *)safe_malloc_add_2op_(strlen(tocode), /*+*/11);
+ tocode1 = safe_malloc_add_2op_(strlen(tocode), /*+*/11);
if (!tocode1)
goto fail;
@@ -101,7 +101,7 @@ int iconvert(const char *fromcode, const char *tocode,
}
utflen = 1; /*fromlen * 2 + 1; XXX */
- utfbuf = (char *)malloc(utflen);
+ utfbuf = malloc(utflen);
if (!utfbuf)
goto fail;
@@ -123,7 +123,7 @@ int iconvert(const char *fromcode, const char *tocode,
if(utflen*2 < utflen) /* overflow check */
goto fail;
utflen *= 2;
- newbuf = (char *)realloc(utfbuf, utflen);
+ newbuf = realloc(utfbuf, utflen);
if (!newbuf)
goto fail;
ob = (ob - utfbuf) + newbuf;
@@ -148,7 +148,7 @@ int iconvert(const char *fromcode, const char *tocode,
iconv_close(cd1);
return ret;
}
- newbuf = (char *)safe_realloc_add_2op_(utfbuf, (ob - utfbuf), /*+*/1);
+ newbuf = safe_realloc_add_2op_(utfbuf, (ob - utfbuf), /*+*/1);
if (!newbuf)
goto fail;
ob = (ob - utfbuf) + newbuf;
@@ -160,7 +160,7 @@ int iconvert(const char *fromcode, const char *tocode,
/* Truncate the buffer to be tidy */
utflen = ob - utfbuf;
- newbuf = (char *)realloc(utfbuf, utflen);
+ newbuf = realloc(utfbuf, utflen);
if (!newbuf)
goto fail;
utfbuf = newbuf;
@@ -199,7 +199,7 @@ int iconvert(const char *fromcode, const char *tocode,
outlen += ob - tbuf;
/* Convert from UTF-8 for real */
- outbuf = (char *)safe_malloc_add_2op_(outlen, /*+*/1);
+ outbuf = safe_malloc_add_2op_(outlen, /*+*/1);
if (!outbuf)
goto fail;
ib = utfbuf;
diff --git a/src/test_libFLAC/metadata_manip.c b/src/test_libFLAC/metadata_manip.c
index 19c4e147..62b9298d 100644
--- a/src/test_libFLAC/metadata_manip.c
+++ b/src/test_libFLAC/metadata_manip.c
@@ -186,7 +186,7 @@ static FLAC__bool open_tempfile_(const char *filename, FILE **tempfile, char **t
{
static const char *tempfile_suffix = ".metadata_edit";
- if(0 == (*tempfilename = (char*)malloc(strlen(filename) + strlen(tempfile_suffix) + 1)))
+ if(0 == (*tempfilename = malloc(strlen(filename) + strlen(tempfile_suffix) + 1)))
return false;
strcpy(*tempfilename, filename);
strcat(*tempfilename, tempfile_suffix);
diff --git a/src/test_libFLAC/metadata_object.c b/src/test_libFLAC/metadata_object.c
index c2552cb4..988eadaf 100644
--- a/src/test_libFLAC/metadata_object.c
+++ b/src/test_libFLAC/metadata_object.c
@@ -33,7 +33,7 @@ static FLAC__byte *make_dummydata_(FLAC__byte *dummydata, unsigned len)
{
FLAC__byte *ret;
- if(0 == (ret = (FLAC__byte*)malloc(len))) {
+ if(0 == (ret = malloc(len))) {
printf("FAILED, malloc error\n");
exit(1);
}
@@ -148,7 +148,7 @@ static FLAC__bool check_seektable_(const FLAC__StreamMetadata *block, unsigned n
static void entry_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, const char *field)
{
entry->length = strlen(field);
- entry->entry = (FLAC__byte*)malloc(entry->length+1);
+ entry->entry = malloc(entry->length+1);
FLAC__ASSERT(0 != entry->entry);
memcpy(entry->entry, field, entry->length);
entry->entry[entry->length] = '\0';
@@ -156,7 +156,7 @@ static void entry_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, const ch
static void entry_clone_(FLAC__StreamMetadata_VorbisComment_Entry *entry)
{
- FLAC__byte *x = (FLAC__byte*)malloc(entry->length+1);
+ FLAC__byte *x = malloc(entry->length+1);
FLAC__ASSERT(0 != x);
memcpy(x, entry->entry, entry->length);
x[entry->length] = '\0';
@@ -198,7 +198,7 @@ static void vc_resize_(FLAC__StreamMetadata *block, unsigned num)
}
}
else {
- vc->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)realloc(vc->comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*num);
+ vc->comments = realloc(vc->comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*num);
FLAC__ASSERT(0 != vc->comments);
if(num > vc->num_comments)
memset(vc->comments+vc->num_comments, 0, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(num-vc->num_comments));
@@ -297,7 +297,7 @@ static void track_clone_(FLAC__StreamMetadata_CueSheet_Track *track)
{
if(track->num_indices > 0) {
size_t bytes = sizeof(FLAC__StreamMetadata_CueSheet_Index) * track->num_indices;
- FLAC__StreamMetadata_CueSheet_Index *x = (FLAC__StreamMetadata_CueSheet_Index*)malloc(bytes);
+ FLAC__StreamMetadata_CueSheet_Index *x = malloc(bytes);
FLAC__ASSERT(0 != x);
memcpy(x, track->indices, bytes);
track->indices = x;
@@ -352,7 +352,7 @@ static void tr_resize_(FLAC__StreamMetadata *block, unsigned track_num, unsigned
}
}
else {
- tr->indices = (FLAC__StreamMetadata_CueSheet_Index*)realloc(tr->indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)*num);
+ tr->indices = realloc(tr->indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)*num);
FLAC__ASSERT(0 != tr->indices);
if(num > tr->num_indices)
memset(tr->indices+tr->num_indices, 0, sizeof(FLAC__StreamMetadata_CueSheet_Index)*(num-tr->num_indices));
@@ -429,7 +429,7 @@ static void cs_resize_(FLAC__StreamMetadata *block, unsigned num)
}
}
else {
- cs->tracks = (FLAC__StreamMetadata_CueSheet_Track*)realloc(cs->tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)*num);
+ cs->tracks = realloc(cs->tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)*num);
FLAC__ASSERT(0 != cs->tracks);
if(num > cs->num_tracks)
memset(cs->tracks+cs->num_tracks, 0, sizeof(FLAC__StreamMetadata_CueSheet_Track)*(num-cs->num_tracks));
diff --git a/src/test_libs_common/metadata_utils.c b/src/test_libs_common/metadata_utils.c
index a417dff0..629f0419 100644
--- a/src/test_libs_common/metadata_utils.c
+++ b/src/test_libs_common/metadata_utils.c
@@ -475,7 +475,7 @@ void mutils__init_metadata_blocks(
seektable->type = FLAC__METADATA_TYPE_SEEKTABLE;
seektable->data.seek_table.num_points = 2;
seektable->length = seektable->data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
- seektable->data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)malloc_or_die_(seektable->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint));
+ seektable->data.seek_table.points = malloc_or_die_(seektable->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint));
seektable->data.seek_table.points[0].sample_number = 0;
seektable->data.seek_table.points[0].stream_offset = 0;
seektable->data.seek_table.points[0].frame_samples = streaminfo->data.stream_info.min_blocksize;
@@ -487,7 +487,7 @@ void mutils__init_metadata_blocks(
application1->type = FLAC__METADATA_TYPE_APPLICATION;
application1->length = 8;
memcpy(application1->data.application.id, "\xfe\xdc\xba\x98", 4);
- application1->data.application.data = (FLAC__byte*)malloc_or_die_(4);
+ application1->data.application.data = malloc_or_die_(4);
memcpy(application1->data.application.data, "\xf0\xe1\xd2\xc3", 4);
application2->is_last = false;
@@ -502,12 +502,12 @@ void mutils__init_metadata_blocks(
vorbiscomment->type = FLAC__METADATA_TYPE_VORBIS_COMMENT;
vorbiscomment->length = (4 + vendor_string_length) + 4 + (4 + 5) + (4 + 0);
vorbiscomment->data.vorbis_comment.vendor_string.length = vendor_string_length;
- vorbiscomment->data.vorbis_comment.vendor_string.entry = (FLAC__byte*)malloc_or_die_(vendor_string_length+1);
+ vorbiscomment->data.vorbis_comment.vendor_string.entry = malloc_or_die_(vendor_string_length+1);
memcpy(vorbiscomment->data.vorbis_comment.vendor_string.entry, FLAC__VENDOR_STRING, vendor_string_length+1);
vorbiscomment->data.vorbis_comment.num_comments = 2;
- vorbiscomment->data.vorbis_comment.comments = (FLAC__StreamMetadata_VorbisComment_Entry*)malloc_or_die_(vorbiscomment->data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry));
+ vorbiscomment->data.vorbis_comment.comments = malloc_or_die_(vorbiscomment->data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry));
vorbiscomment->data.vorbis_comment.comments[0].length = 5;
- vorbiscomment->data.vorbis_comment.comments[0].entry = (FLAC__byte*)malloc_or_die_(5+1);
+ vorbiscomment->data.vorbis_comment.comments[0].entry = malloc_or_die_(5+1);
memcpy(vorbiscomment->data.vorbis_comment.comments[0].entry, "ab=cd", 5+1);
vorbiscomment->data.vorbis_comment.comments[1].length = 0;
vorbiscomment->data.vorbis_comment.comments[1].entry = 0;
@@ -547,14 +547,14 @@ void mutils__init_metadata_blocks(
cuesheet->data.cue_sheet.lead_in = 2 * 44100;
cuesheet->data.cue_sheet.is_cd = true;
cuesheet->data.cue_sheet.num_tracks = 3;
- cuesheet->data.cue_sheet.tracks = (FLAC__StreamMetadata_CueSheet_Track*)calloc_or_die_(cuesheet->data.cue_sheet.num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track));
+ cuesheet->data.cue_sheet.tracks = calloc_or_die_(cuesheet->data.cue_sheet.num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track));
cuesheet->data.cue_sheet.tracks[0].offset = 0;
cuesheet->data.cue_sheet.tracks[0].number = 1;
memcpy(cuesheet->data.cue_sheet.tracks[0].isrc, "ACBDE1234567", sizeof(cuesheet->data.cue_sheet.tracks[0].isrc));
cuesheet->data.cue_sheet.tracks[0].type = 0;
cuesheet->data.cue_sheet.tracks[0].pre_emphasis = 1;
cuesheet->data.cue_sheet.tracks[0].num_indices = 2;
- cuesheet->data.cue_sheet.tracks[0].indices = (FLAC__StreamMetadata_CueSheet_Index*)malloc_or_die_(cuesheet->data.cue_sheet.tracks[0].num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index));
+ cuesheet->data.cue_sheet.tracks[0].indices = malloc_or_die_(cuesheet->data.cue_sheet.tracks[0].num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index));
cuesheet->data.cue_sheet.tracks[0].indices[0].offset = 0;
cuesheet->data.cue_sheet.tracks[0].indices[0].number = 0;
cuesheet->data.cue_sheet.tracks[0].indices[1].offset = 123 * 588;
@@ -565,7 +565,7 @@ void mutils__init_metadata_blocks(
cuesheet->data.cue_sheet.tracks[1].type = 1;
cuesheet->data.cue_sheet.tracks[1].pre_emphasis = 0;
cuesheet->data.cue_sheet.tracks[1].num_indices = 1;
- cuesheet->data.cue_sheet.tracks[1].indices = (FLAC__StreamMetadata_CueSheet_Index*)malloc_or_die_(cuesheet->data.cue_sheet.tracks[1].num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index));
+ cuesheet->data.cue_sheet.tracks[1].indices = malloc_or_die_(cuesheet->data.cue_sheet.tracks[1].num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index));
cuesheet->data.cue_sheet.tracks[1].indices[0].offset = 0;
cuesheet->data.cue_sheet.tracks[1].indices[0].number = 1;
cuesheet->data.cue_sheet.tracks[2].offset = 12345 * 588;
@@ -602,7 +602,7 @@ void mutils__init_metadata_blocks(
unknown->is_last = true;
unknown->type = 126;
unknown->length = 8;
- unknown->data.unknown.data = (FLAC__byte*)malloc_or_die_(unknown->length);
+ unknown->data.unknown.data = malloc_or_die_(unknown->length);
memcpy(unknown->data.unknown.data, "\xfe\xdc\xba\x98\xf0\xe1\xd2\xc3", unknown->length);
}
diff --git a/src/test_seeking/main.c b/src/test_seeking/main.c
index 589e8596..46ea9c4b 100644
--- a/src/test_seeking/main.c
+++ b/src/test_seeking/main.c
@@ -153,7 +153,7 @@ static FLAC__bool read_pcm_(FLAC__int32 *pcm[], const char *rawfilename, const c
return false;
}
for(i = 0; i < channels; i++) {
- if(0 == (pcm[i] = (FLAC__int32*)malloc(sizeof(FLAC__int32)*samples))) {
+ if(0 == (pcm[i] = malloc(sizeof(FLAC__int32)*samples))) {
printf("ERROR: allocating space for PCM samples\n");
return false;
}