Browse code

stupid code (casting of void*) found by checktree.sh

Originally committed as revision 11117 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2007/12/01 09:19:44
Showing 7 changed files
... ...
@@ -1399,7 +1399,7 @@ static int av_encode(AVFormatContext **output_files,
1399 1399
     int key;
1400 1400
     int want_sdp = 1;
1401 1401
 
1402
-    file_table= (AVInputFile*) av_mallocz(nb_input_files * sizeof(AVInputFile));
1402
+    file_table= av_mallocz(nb_input_files * sizeof(AVInputFile));
1403 1403
     if (!file_table)
1404 1404
         goto fail;
1405 1405
 
... ...
@@ -3813,7 +3813,7 @@ static int parse_ffconfig(const char *filename)
3813 3813
             if (feed) {
3814 3814
                 int i;
3815 3815
 
3816
-                feed->child_argv = (char **) av_mallocz(64 * sizeof(char *));
3816
+                feed->child_argv = av_mallocz(64 * sizeof(char *));
3817 3817
 
3818 3818
                 for (i = 0; i < 62; i++) {
3819 3819
                     get_arg(arg, sizeof(arg), &p);
... ...
@@ -4190,7 +4190,7 @@ static int parse_ffconfig(const char *filename)
4190 4190
             }
4191 4191
 
4192 4192
             if (!errors) {
4193
-                IPAddressACL *nacl = (IPAddressACL *) av_mallocz(sizeof(*nacl));
4193
+                IPAddressACL *nacl = av_mallocz(sizeof(*nacl));
4194 4194
                 IPAddressACL **naclp = 0;
4195 4195
 
4196 4196
                 acl.next = 0;
... ...
@@ -210,7 +210,7 @@ void clear_blocks_dcbz128_ppc(DCTELEM *blocks)
210 210
    knows about dcbzl ... */
211 211
 long check_dcbzl_effect(void)
212 212
 {
213
-  register char *fakedata = (char*)av_malloc(1024);
213
+  register char *fakedata = av_malloc(1024);
214 214
   register char *fakedata_middle;
215 215
   register long zero = 0;
216 216
   register long i = 0;
... ...
@@ -138,7 +138,7 @@ int ff_rate_control_init(MpegEncContext *s)
138 138
         i+= s->max_b_frames;
139 139
         if(i<=0 || i>=INT_MAX / sizeof(RateControlEntry))
140 140
             return -1;
141
-        rcc->entry = (RateControlEntry*)av_mallocz(i*sizeof(RateControlEntry));
141
+        rcc->entry = av_mallocz(i*sizeof(RateControlEntry));
142 142
         rcc->num_entries= i;
143 143
 
144 144
         /* init all to skipped p frames (with b frames we might have a not encoded frame at the end FIXME) */
... ...
@@ -185,15 +185,15 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
185 185
 
186 186
     /* XXX: move those malloc to resample init code */
187 187
     for(i=0; i<s->filter_channels; i++){
188
-        bufin[i]= (short*) av_malloc( (nb_samples + s->temp_len) * sizeof(short) );
188
+        bufin[i]= av_malloc( (nb_samples + s->temp_len) * sizeof(short) );
189 189
         memcpy(bufin[i], s->temp[i], s->temp_len * sizeof(short));
190 190
         buftmp2[i] = bufin[i] + s->temp_len;
191 191
     }
192 192
 
193 193
     /* make some zoom to avoid round pb */
194 194
     lenout= (int)(4*nb_samples * s->ratio) + 16;
195
-    bufout[0]= (short*) av_malloc( lenout * sizeof(short) );
196
-    bufout[1]= (short*) av_malloc( lenout * sizeof(short) );
195
+    bufout[0]= av_malloc( lenout * sizeof(short) );
196
+    bufout[1]= av_malloc( lenout * sizeof(short) );
197 197
 
198 198
     if (s->input_channels == 2 &&
199 199
         s->output_channels == 1) {
... ...
@@ -237,9 +237,9 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) {
237 237
 
238 238
     AV_DEBUG(" Codebooks: %d \n", vc->codebook_count);
239 239
 
240
-    vc->codebooks=(vorbis_codebook *)av_mallocz(vc->codebook_count * sizeof(vorbis_codebook));
241
-    tmp_vlc_bits=(uint8_t *)av_mallocz(V_MAX_VLCS * sizeof(uint8_t));
242
-    tmp_vlc_codes=(uint32_t *)av_mallocz(V_MAX_VLCS * sizeof(uint32_t));
240
+    vc->codebooks=av_mallocz(vc->codebook_count * sizeof(vorbis_codebook));
241
+    tmp_vlc_bits =av_mallocz(V_MAX_VLCS * sizeof(uint8_t));
242
+    tmp_vlc_codes=av_mallocz(V_MAX_VLCS * sizeof(uint32_t));
243 243
 
244 244
     for(cb=0;cb<vc->codebook_count;++cb) {
245 245
         vorbis_codebook *codebook_setup=&vc->codebooks[cb];
... ...
@@ -351,7 +351,7 @@ static int vorbis_parse_setup_hdr_codebooks(vorbis_context *vc) {
351 351
             }
352 352
 
353 353
 // Weed out unused vlcs and build codevector vector
354
-            codebook_setup->codevectors=used_entries ? (float *)av_mallocz(used_entries*codebook_setup->dimensions * sizeof(float)) : NULL;
354
+            codebook_setup->codevectors=used_entries ? av_mallocz(used_entries*codebook_setup->dimensions * sizeof(float)) : NULL;
355 355
             for(j=0, i=0;i<entries;++i) {
356 356
                 uint_fast8_t dim=codebook_setup->dimensions;
357 357
 
... ...
@@ -459,7 +459,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) {
459 459
 
460 460
     vc->floor_count=get_bits(gb, 6)+1;
461 461
 
462
-    vc->floors=(vorbis_floor *)av_mallocz(vc->floor_count * sizeof(vorbis_floor));
462
+    vc->floors=av_mallocz(vc->floor_count * sizeof(vorbis_floor));
463 463
 
464 464
     for (i=0;i<vc->floor_count;++i) {
465 465
         vorbis_floor *floor_setup=&vc->floors[i];
... ...
@@ -517,7 +517,7 @@ static int vorbis_parse_setup_hdr_floors(vorbis_context *vc) {
517 517
                 floor_setup->data.t1.x_list_dim+=floor_setup->data.t1.class_dimensions[floor_setup->data.t1.partition_class[j]];
518 518
             }
519 519
 
520
-            floor_setup->data.t1.list=(floor1_entry_t *)av_mallocz(floor_setup->data.t1.x_list_dim * sizeof(floor1_entry_t));
520
+            floor_setup->data.t1.list=av_mallocz(floor_setup->data.t1.x_list_dim * sizeof(floor1_entry_t));
521 521
 
522 522
 
523 523
             rangebits=get_bits(gb, 4);
... ...
@@ -623,7 +623,7 @@ static int vorbis_parse_setup_hdr_residues(vorbis_context *vc){
623 623
     uint_fast8_t i, j, k;
624 624
 
625 625
     vc->residue_count=get_bits(gb, 6)+1;
626
-    vc->residues=(vorbis_residue *)av_mallocz(vc->residue_count * sizeof(vorbis_residue));
626
+    vc->residues=av_mallocz(vc->residue_count * sizeof(vorbis_residue));
627 627
 
628 628
     AV_DEBUG(" There are %d residues. \n", vc->residue_count);
629 629
 
... ...
@@ -684,7 +684,7 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc) {
684 684
     uint_fast8_t i, j;
685 685
 
686 686
     vc->mapping_count=get_bits(gb, 6)+1;
687
-    vc->mappings=(vorbis_mapping *)av_mallocz(vc->mapping_count * sizeof(vorbis_mapping));
687
+    vc->mappings=av_mallocz(vc->mapping_count * sizeof(vorbis_mapping));
688 688
 
689 689
     AV_DEBUG(" There are %d mappings. \n", vc->mapping_count);
690 690
 
... ...
@@ -703,8 +703,8 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc) {
703 703
 
704 704
         if (get_bits1(gb)) {
705 705
             mapping_setup->coupling_steps=get_bits(gb, 8)+1;
706
-            mapping_setup->magnitude=(uint_fast8_t *)av_mallocz(mapping_setup->coupling_steps * sizeof(uint_fast8_t));
707
-            mapping_setup->angle=(uint_fast8_t *)av_mallocz(mapping_setup->coupling_steps * sizeof(uint_fast8_t));
706
+            mapping_setup->magnitude=av_mallocz(mapping_setup->coupling_steps * sizeof(uint_fast8_t));
707
+            mapping_setup->angle    =av_mallocz(mapping_setup->coupling_steps * sizeof(uint_fast8_t));
708 708
             for(j=0;j<mapping_setup->coupling_steps;++j) {
709 709
                 mapping_setup->magnitude[j]=get_bits(gb, ilog(vc->audio_channels-1));
710 710
                 mapping_setup->angle[j]=get_bits(gb, ilog(vc->audio_channels-1));
... ...
@@ -722,7 +722,7 @@ static int vorbis_parse_setup_hdr_mappings(vorbis_context *vc) {
722 722
         }
723 723
 
724 724
         if (mapping_setup->submaps>1) {
725
-            mapping_setup->mux=(uint_fast8_t *)av_mallocz(vc->audio_channels * sizeof(uint_fast8_t));
725
+            mapping_setup->mux=av_mallocz(vc->audio_channels * sizeof(uint_fast8_t));
726 726
             for(j=0;j<vc->audio_channels;++j) {
727 727
                 mapping_setup->mux[j]=get_bits(gb, 4);
728 728
             }
... ...
@@ -784,7 +784,7 @@ static int vorbis_parse_setup_hdr_modes(vorbis_context *vc) {
784 784
     uint_fast8_t i;
785 785
 
786 786
     vc->mode_count=get_bits(gb, 6)+1;
787
-    vc->modes=(vorbis_mode *)av_mallocz(vc->mode_count * sizeof(vorbis_mode));
787
+    vc->modes=av_mallocz(vc->mode_count * sizeof(vorbis_mode));
788 788
 
789 789
     AV_DEBUG(" There are %d modes.\n", vc->mode_count);
790 790
 
... ...
@@ -897,12 +897,12 @@ static int vorbis_parse_id_hdr(vorbis_context *vc){
897 897
         return 2;
898 898
     }
899 899
 
900
-    vc->channel_residues=(float *)av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float));
901
-    vc->channel_floors=(float *)av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float));
902
-    vc->saved=(float *)av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float));
903
-    vc->ret=(float *)av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float));
904
-    vc->buf=(float *)av_malloc(vc->blocksize[1] * sizeof(float));
905
-    vc->buf_tmp=(float *)av_malloc(vc->blocksize[1] * sizeof(float));
900
+    vc->channel_residues= av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float));
901
+    vc->channel_floors  = av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float));
902
+    vc->saved           = av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float));
903
+    vc->ret             = av_malloc((vc->blocksize[1]/2)*vc->audio_channels * sizeof(float));
904
+    vc->buf             = av_malloc( vc->blocksize[1]                       * sizeof(float));
905
+    vc->buf_tmp         = av_malloc( vc->blocksize[1]                       * sizeof(float));
906 906
     vc->saved_start=0;
907 907
 
908 908
     ff_mdct_init(&vc->mdct[0], bl0, 1);
... ...
@@ -493,7 +493,7 @@ static int asf_write_header(AVFormatContext *s)
493 493
     asf->nb_packets = 0;
494 494
 
495 495
     asf->last_indexed_pts = 0;
496
-    asf->index_ptr = (ASFIndex*)av_malloc( sizeof(ASFIndex) * ASF_INDEX_BLOCK );
496
+    asf->index_ptr = av_malloc( sizeof(ASFIndex) * ASF_INDEX_BLOCK );
497 497
     asf->nb_index_memory_alloc = ASF_INDEX_BLOCK;
498 498
     asf->nb_index_count = 0;
499 499
     asf->maximum_packet = 0;