Commit 80171dc3 authored by Josh Coalson's avatar Josh Coalson
Browse files

fix all bare malloc() realloc() etc calls to have a proper cast in front

parent f8ecddeb
......@@ -631,7 +631,7 @@ int parse_options(int argc, char *argv[])
if(option_values.num_files > 0) {
unsigned i = 0;
if(0 == (option_values.filenames = malloc(sizeof(char *) * option_values.num_files)))
if(0 == (option_values.filenames = (char**)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++]);
......
......@@ -1131,7 +1131,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 = malloc(entry->length+1)))
if(0 == (entry->entry = (FLAC__byte*)malloc(entry->length+1)))
return false;
memcpy(entry->entry, field_name, nn);
entry->entry[nn] = '=';
......@@ -1158,9 +1158,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 = malloc(nn+1)))
if(0 == (*field_name = (char*)malloc(nn+1)))
return false;
if(0 == (*field_value = malloc(nv+1))) {
if(0 == (*field_value = (char*)malloc(nv+1))) {
free(*field_name);
return false;
}
......
......@@ -102,7 +102,7 @@ FLAC__bool simple_ogg_page__get_at(OggFLAC__SeekableStreamEncoder *encoder, FLAC
}
/* allocate space for the page header */
if(0 == (page->header = malloc(OGG_MAX_HEADER_LEN))) {
if(0 == (page->header = (unsigned char *)malloc(OGG_MAX_HEADER_LEN))) {
encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
return false;
}
......@@ -144,7 +144,7 @@ FLAC__bool simple_ogg_page__get_at(OggFLAC__SeekableStreamEncoder *encoder, FLAC
}
/* allocate space for the page body */
if(0 == (page->body = malloc(page->body_len))) {
if(0 == (page->body = (unsigned char *)malloc(page->body_len))) {
encoder->protected_->state = OggFLAC__SEEKABLE_STREAM_ENCODER_MEMORY_ALLOCATION_ERROR;
return false;
}
......
......@@ -83,7 +83,7 @@ char* FLAC_plugin__charset_convert_string (const char *string, char *from, char
/* Due to a GLIBC bug, round outbuf_size up to a multiple of 4 */
/* + 1 for nul in case len == 1 */
outsize = ((length + 3) & ~3) + 1;
out = malloc(outsize);
out = (char*)malloc(outsize);
outleft = outsize - 1;
outptr = out;
......
......@@ -265,7 +265,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 = realloc(entry->entry, entry->length + value_len + separator_len + 1)))
if(0 == (new_entry = (FLAC__byte*)realloc(entry->entry, entry->length + value_len + separator_len + 1)))
return false;
memcpy(new_entry+entry->length, separator, separator_len);
entry->length += separator_len;
......
......@@ -183,7 +183,7 @@ static wchar_t *AnsiToWide(const char *src)
len = strlen(src) + 1;
/* copy */
dest = malloc(len*sizeof(wchar_t));
dest = (wchar_t*)malloc(len*sizeof(wchar_t));
if (dest) mbstowcs(dest, src, len);
return dest;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment