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 = realloc(object->parameters, sizeof(unsigned)*(1 << max_partition_order))))
+ if(0 == (object->parameters = (unsigned*)realloc(object->parameters, sizeof(unsigned)*(1 << max_partition_order))))
return false;
- if(0 == (object->raw_bits = realloc(object->raw_bits, sizeof(unsigned)*(1 << max_partition_order))))
+ if(0 == (object->raw_bits = (unsigned*)realloc(object->raw_bits, sizeof(unsigned)*(1 << max_partition_order))))
return false;
object->capacity_by_order = max_partition_order;
}
const unsigned bytes_needed = channels * samples * bytes_per_sample;
if(ctx->capacity < bytes_needed) {
- FLAC__byte *tmp = realloc(ctx->internal_buf, bytes_needed);
+ FLAC__byte *tmp = (FLAC__byte*)realloc(ctx->internal_buf, bytes_needed);
if(0 == tmp) {
free(ctx->internal_buf);
- if(0 == (ctx->internal_buf = malloc(bytes_needed)))
+ if(0 == (ctx->internal_buf = (FLAC__byte*)malloc(bytes_needed)))
return false;
}
ctx->internal_buf = tmp;
FLAC__ASSERT(0 != aligned_pointer);
FLAC__ASSERT(unaligned_pointer != aligned_pointer);
- pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(FLAC__int32) * elements, (void*)&pa);
+ pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(FLAC__int32) * elements, (void**)&pa);
if(0 == pu) {
return false;
}
FLAC__ASSERT(0 != aligned_pointer);
FLAC__ASSERT(unaligned_pointer != aligned_pointer);
- pu = (FLAC__uint32*)FLAC__memory_alloc_aligned(sizeof(FLAC__uint32) * elements, (void*)&pa);
+ pu = (FLAC__uint32*)FLAC__memory_alloc_aligned(sizeof(FLAC__uint32) * elements, (void**)&pa);
if(0 == pu) {
return false;
}
FLAC__ASSERT(0 != aligned_pointer);
FLAC__ASSERT(unaligned_pointer != aligned_pointer);
- pu = (FLAC__uint64*)FLAC__memory_alloc_aligned(sizeof(FLAC__uint64) * elements, (void*)&pa);
+ pu = (FLAC__uint64*)FLAC__memory_alloc_aligned(sizeof(FLAC__uint64) * elements, (void**)&pa);
if(0 == pu) {
return false;
}
FLAC__ASSERT(0 != aligned_pointer);
FLAC__ASSERT(unaligned_pointer != aligned_pointer);
- pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(unsigned) * elements, (void*)&pa);
+ pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(unsigned) * elements, (void**)&pa);
if(0 == pu) {
return false;
}
FLAC__ASSERT(0 != aligned_pointer);
FLAC__ASSERT(unaligned_pointer != aligned_pointer);
- pu = (FLAC__real*)FLAC__memory_alloc_aligned(sizeof(FLAC__real) * elements, (void*)&pa);
+ pu = (FLAC__real*)FLAC__memory_alloc_aligned(sizeof(FLAC__real) * elements, (void**)&pa);
if(0 == pu) {
return false;
}
FLAC_API FLAC__Metadata_SimpleIterator *FLAC__metadata_simple_iterator_new()
{
- FLAC__Metadata_SimpleIterator *iterator = calloc(1, sizeof(FLAC__Metadata_SimpleIterator));
+ FLAC__Metadata_SimpleIterator *iterator = (FLAC__Metadata_SimpleIterator*)calloc(1, sizeof(FLAC__Metadata_SimpleIterator));
if(0 != iterator) {
iterator->file = 0;
FLAC_API FLAC__Metadata_Chain *FLAC__metadata_chain_new()
{
- FLAC__Metadata_Chain *chain = calloc(1, sizeof(FLAC__Metadata_Chain));
+ FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)calloc(1, sizeof(FLAC__Metadata_Chain));
if(0 != chain) {
chain->filename = 0;
FLAC_API FLAC__Metadata_Iterator *FLAC__metadata_iterator_new()
{
- FLAC__Metadata_Iterator *iterator = calloc(1, sizeof(FLAC__Metadata_Iterator));
+ FLAC__Metadata_Iterator *iterator = (FLAC__Metadata_Iterator*)calloc(1, sizeof(FLAC__Metadata_Iterator));
/* calloc() implies:
iterator->current = 0;
block->data = 0;
}
else {
- if(0 == (block->data = malloc(block_length)))
+ if(0 == (block->data = (FLAC__byte*)malloc(block_length)))
return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
if(fread(block->data, 1, block_length, file) != block_length)
if(block->num_points == 0)
block->points = 0;
- else if(0 == (block->points = malloc(block->num_points * sizeof(FLAC__StreamMetadata_SeekPoint))))
+ else if(0 == (block->points = (FLAC__StreamMetadata_SeekPoint*)malloc(block->num_points * sizeof(FLAC__StreamMetadata_SeekPoint))))
return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
for(i = 0; i < block->num_points; i++) {
entry->entry = 0;
}
else {
- if(0 == (entry->entry = malloc(entry->length)))
+ if(0 == (entry->entry = (FLAC__byte*)malloc(entry->length)))
return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
if(fread(entry->entry, 1, entry->length, file) != entry->length)
if(block->num_comments == 0) {
block->comments = 0;
}
- else if(0 == (block->comments = calloc(sizeof(FLAC__StreamMetadata_VorbisComment_Entry), block->num_comments)))
+ else if(0 == (block->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)calloc(sizeof(FLAC__StreamMetadata_VorbisComment_Entry), block->num_comments)))
return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
for(i = 0; i < block->num_comments; i++) {
{
static const char *tempfile_suffix = ".metadata_edit";
if(0 == tempfile_path_prefix) {
- if(0 == (*tempfilename = malloc(strlen(filename) + strlen(tempfile_suffix) + 1))) {
+ if(0 == (*tempfilename = (char*)malloc(strlen(filename) + strlen(tempfile_suffix) + 1))) {
*status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
return false;
}
else
p++;
- if(0 == (*tempfilename = malloc(strlen(tempfile_path_prefix) + 1 + strlen(p) + strlen(tempfile_suffix) + 1))) {
+ if(0 == (*tempfilename = (char*)malloc(strlen(tempfile_path_prefix) + 1 + strlen(p) + strlen(tempfile_suffix) + 1))) {
*status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR;
return false;
}
{
if(bytes > 0 && 0 != from) {
FLAC__byte *x;
- if(0 == (x = malloc(bytes)))
+ if(0 == (x = (FLAC__byte*)malloc(bytes)))
return false;
memcpy(x, from, bytes);
*to = x;
else {
FLAC__byte *x;
FLAC__ASSERT(from->length > 0);
- if(0 == (x = malloc(from->length)))
+ if(0 == (x = (FLAC__byte*)malloc(from->length)))
return false;
memcpy(x, from->entry, from->length);
to->entry = x;
FLAC__ASSERT(num_points > 0);
- object_array = malloc(num_points * sizeof(FLAC__StreamMetadata_SeekPoint));
+ object_array = (FLAC__StreamMetadata_SeekPoint*)malloc(num_points * sizeof(FLAC__StreamMetadata_SeekPoint));
if(0 != object_array) {
unsigned i;
{
FLAC__ASSERT(num_comments > 0);
- return calloc(num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry));
+ return (FLAC__StreamMetadata_VorbisComment_Entry*)calloc(num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry));
}
static void vorbiscomment_entry_array_delete_(FLAC__StreamMetadata_VorbisComment_Entry *object_array, unsigned num_comments)
FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type)
{
- FLAC__StreamMetadata *object = calloc(1, sizeof(FLAC__StreamMetadata));
+ FLAC__StreamMetadata *object = (FLAC__StreamMetadata*)calloc(1, sizeof(FLAC__StreamMetadata));
if(0 != object) {
object->is_last = false;
object->type = type;
free(object->data.seek_table.points);
object->data.seek_table.points = 0;
}
- else if(0 == (object->data.seek_table.points = realloc(object->data.seek_table.points, new_size)))
+ else if(0 == (object->data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)realloc(object->data.seek_table.points, new_size)))
return false;
/* if growing, set new elements to placeholders */
free(object->data.vorbis_comment.comments);
object->data.vorbis_comment.comments = 0;
}
- else if(0 == (object->data.vorbis_comment.comments = realloc(object->data.vorbis_comment.comments, new_size)))
+ else if(0 == (object->data.vorbis_comment.comments = (FLAC__StreamMetadata_VorbisComment_Entry*)realloc(object->data.vorbis_comment.comments, new_size)))
return false;
/* if growing, zero all the length/pointers of new elements */
FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC__StreamMetadata_VorbisComment_Entry *entry, const char *field_name, unsigned field_name_length)
{
- const FLAC__byte *eq = memchr(entry->entry, '=', entry->length);
+ const FLAC__byte *eq = (FLAC__byte*)memchr(entry->entry, '=', entry->length);
#if defined _MSC_VER || defined __MINGW32__
#define FLAC__STRNCASECMP strnicmp
#else
#define FLAC__STRNCASECMP strncasecmp
#endif
- return (0 != eq && (unsigned)(eq-entry->entry) == field_name_length && 0 == FLAC__STRNCASECMP(field_name, entry->entry, field_name_length));
+ return (0 != eq && (unsigned)(eq-entry->entry) == field_name_length && 0 == FLAC__STRNCASECMP(field_name, (const char *)entry->entry, field_name_length));
#undef FLAC__STRNCASECMP
}
return decoder->protected_->state;
}
-FLAC_API FLAC__SeekableStreamDecoderState FLAC__seekable_stream_decoder_get_stream_decoder_state(const FLAC__SeekableStreamDecoder *decoder)
+FLAC_API FLAC__StreamDecoderState FLAC__seekable_stream_decoder_get_stream_decoder_state(const FLAC__SeekableStreamDecoder *decoder)
{
FLAC__ASSERT(0 != decoder);
FLAC__ASSERT(0 != decoder->private_);
}
decoder->private_->metadata_filter_ids_capacity = 16;
- if(0 == (decoder->private_->metadata_filter_ids = malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) * decoder->private_->metadata_filter_ids_capacity))) {
+ if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) * decoder->private_->metadata_filter_ids_capacity))) {
FLAC__bitbuffer_delete(decoder->private_->input);
free(decoder->private_);
free(decoder->protected_);
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 = realloc(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity * 2)))
+ if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)realloc(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity * 2)))
return decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
decoder->private_->metadata_filter_ids_capacity *= 2;
}
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 = realloc(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity * 2)))
+ if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)realloc(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity * 2)))
return decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
decoder->private_->metadata_filter_ids_capacity *= 2;
}
return false; /* the read_callback_ sets the state for us */
if(type == FLAC__METADATA_TYPE_STREAMINFO) {
unsigned used_bits = 0;
- decoder->private_->stream_info.type = type;
+ decoder->private_->stream_info.type = (FLAC__MetadataType)type;
decoder->private_->stream_info.is_last = last_block;
decoder->private_->stream_info.length = length;
decoder->private_->metadata_callback(decoder, &decoder->private_->stream_info, decoder->private_->client_data);
}
else if(type == FLAC__METADATA_TYPE_SEEKTABLE) {
- decoder->private_->seek_table.type = type;
+ decoder->private_->seek_table.type = (FLAC__MetadataType)type;
decoder->private_->seek_table.is_last = last_block;
decoder->private_->seek_table.length = length;
FLAC__StreamMetadata block;
block.is_last = last_block;
- block.type = type;
+ block.type = (FLAC__MetadataType)type;
block.length = length;
if(type == FLAC__METADATA_TYPE_APPLICATION) {
case FLAC__METADATA_TYPE_APPLICATION:
/* remember, we read the ID already */
if(real_length > 0) {
- if(0 == (block.data.application.data = malloc(real_length))) {
+ if(0 == (block.data.application.data = (FLAC__byte*)malloc(real_length))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
if(!FLAC__bitbuffer_read_raw_uint32_little_endian(decoder->private_->input, &block.data.vorbis_comment.vendor_string.length, read_callback_, decoder))
return false; /* the read_callback_ sets the state for us */
if(block.data.vorbis_comment.vendor_string.length > 0) {
- if(0 == (block.data.vorbis_comment.vendor_string.entry = malloc(block.data.vorbis_comment.vendor_string.length))) {
+ if(0 == (block.data.vorbis_comment.vendor_string.entry = (FLAC__byte*)malloc(block.data.vorbis_comment.vendor_string.length))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
/* read comments */
if(block.data.vorbis_comment.num_comments > 0) {
- if(0 == (block.data.vorbis_comment.comments = malloc(block.data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) {
+ if(0 == (block.data.vorbis_comment.comments = (FLAC__StreamMetadata_VorbisComment_Entry*)malloc(block.data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
if(!FLAC__bitbuffer_read_raw_uint32_little_endian(decoder->private_->input, &block.data.vorbis_comment.comments[i].length, read_callback_, decoder))
return false; /* the read_callback_ sets the state for us */
if(block.data.vorbis_comment.comments[i].length > 0) {
- if(0 == (block.data.vorbis_comment.comments[i].entry = malloc(block.data.vorbis_comment.comments[i].length))) {
+ if(0 == (block.data.vorbis_comment.comments[i].entry = (FLAC__byte*)malloc(block.data.vorbis_comment.comments[i].length))) {
decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR;
return false;
}
/* read entropy coding method info */
if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_TYPE_LEN, read_callback_, decoder))
return false; /* the read_callback_ sets the state for us */
- subframe->entropy_coding_method.type = u32;
+ subframe->entropy_coding_method.type = (FLAC__EntropyCodingMethodType)u32;
switch(subframe->entropy_coding_method.type) {
case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN, read_callback_, decoder))
/* read entropy coding method info */
if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_TYPE_LEN, read_callback_, decoder))
return false; /* the read_callback_ sets the state for us */
- subframe->entropy_coding_method.type = u32;
+ subframe->entropy_coding_method.type = (FLAC__EntropyCodingMethodType)u32;
switch(subframe->entropy_coding_method.type) {
case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE:
if(!FLAC__bitbuffer_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN, read_callback_, decoder))