fix all bare malloc() realloc() etc calls to have a proper cast in front
authorJosh Coalson <jcoalson@users.sourceforce.net>
Thu, 30 Dec 2004 03:57:13 +0000 (03:57 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Thu, 30 Dec 2004 03:57:13 +0000 (03:57 +0000)
src/flac/main.c
src/libFLAC/metadata_object.c
src/libOggFLAC/ogg_helper.c
src/plugin_common/charset.c
src/plugin_common/tags.c
src/plugin_winamp2/infobox.c

index 1ddea28..86cf715 100644 (file)
@@ -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++]);
index 8907bdd..d1c0792 100644 (file)
@@ -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;
                }
index 5ee534d..169ee3a 100644 (file)
@@ -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;
        }
index d5c159e..ce3e8b8 100644 (file)
@@ -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;
 
index 1de2a8a..c69d1b0 100644 (file)
@@ -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;
index 8890089..dddcff5 100644 (file)
@@ -183,7 +183,7 @@ static wchar_t *AnsiToWide(const char *src)
 \r
        len = strlen(src) + 1;\r
        /* copy */\r
-       dest = malloc(len*sizeof(wchar_t));\r
+       dest = (wchar_t*)malloc(len*sizeof(wchar_t));\r
        if (dest) mbstowcs(dest, src, len);\r
        return dest;\r
 }\r