[xiph-cvs] cvs commit: vorbis/lib bitbuffer.c block.c codebook.c envelope.c floor0.c floor1.c iir.c info.c lpc.c lsp.c mapping0.c mdct.c psy.c res0.c sharedbook.c smallft.c synthesis.c tone.c vorbisenc.c vorbisfile.c window.c

Segher Boessenkool segher at xiph.org
Mon Oct 1 17:14:37 PDT 2001



segher      01/10/01 17:14:37

  Modified:    lib      bitbuffer.c block.c codebook.c envelope.c floor0.c
                        floor1.c iir.c info.c lpc.c lsp.c mapping0.c mdct.c
                        psy.c res0.c sharedbook.c smallft.c synthesis.c
                        tone.c vorbisenc.c vorbisfile.c window.c
  Log:
  sizeof() cleanup.  the occasional void * didn't make this easier.
  two bugs in vorbisfile found and fixed.

Revision  Changes    Path
1.6       +4 -4      vorbis/lib/bitbuffer.c

Index: bitbuffer.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/bitbuffer.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- bitbuffer.c	2001/02/26 03:50:41	1.5
+++ bitbuffer.c	2001/10/02 00:14:30	1.6
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: flexible, delayed bitpacking abstraction
- last mod: $Id: bitbuffer.c,v 1.5 2001/02/26 03:50:41 xiphmont Exp $
+ last mod: $Id: bitbuffer.c,v 1.6 2001/10/02 00:14:30 segher Exp $
 
  ********************************************************************/
 
@@ -27,16 +27,16 @@
 */
 
 void bitbuf_init(vorbis_bitbuffer *vbb,vorbis_block *vb){
-  memset(vbb,0,sizeof(vorbis_bitbuffer));
+  memset(vbb,0,sizeof(*vbb));
   vbb->vb=vb;
-  vbb->first=vbb->last=_vorbis_block_alloc(vb,sizeof(vorbis_bitbuffer_chain));
+  vbb->first=vbb->last=_vorbis_block_alloc(vb,sizeof(*vbb->first));
   vbb->first->next=0; /* overengineering */
 }
 
 void bitbuf_write(vorbis_bitbuffer *vbb,unsigned long word,int length){
   vorbis_block *vb=vbb->vb;
   if(vbb->ptr>=_VBB_ALLOCSIZE){
-    vbb->last->next=_vorbis_block_alloc(vb,sizeof(vorbis_bitbuffer_chain));
+    vbb->last->next=_vorbis_block_alloc(vb,sizeof(*vbb->last->next));
     vbb->last=vbb->last->next;
     vbb->last->next=0; /* overengineering */
     vbb->ptr=0;

1.50      +36 -36    vorbis/lib/block.c

Index: block.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/block.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- block.c	2001/08/13 01:36:56	1.49
+++ block.c	2001/10/02 00:14:30	1.50
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c,v 1.49 2001/08/13 01:36:56 xiphmont Exp $
+ last mod: $Id: block.c,v 1.50 2001/10/02 00:14:30 segher Exp $
 
  Handle windowing, overlap-add, etc of the PCM vectors.  This is made
  more amusing by Vorbis' current two allowed block sizes.
@@ -89,7 +89,7 @@
 #endif
 
 int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){
-  memset(vb,0,sizeof(vorbis_block));
+  memset(vb,0,sizeof(*vb));
   vb->vd=v;
   vb->localalloc=0;
   vb->localstore=NULL;
@@ -107,7 +107,7 @@
   if(bytes+vb->localtop>vb->localalloc){
     /* can't just _ogg_realloc... there are outstanding pointers */
     if(vb->localstore){
-      struct alloc_chain *link=_ogg_malloc(sizeof(struct alloc_chain));
+      struct alloc_chain *link=_ogg_malloc(sizeof(*link));
       vb->totaluse+=vb->localtop;
       link->next=vb->reap;
       link->ptr=vb->localstore;
@@ -132,7 +132,7 @@
   while(reap){
     struct alloc_chain *next=reap->next;
     _ogg_free(reap->ptr);
-    memset(reap,0,sizeof(struct alloc_chain));
+    memset(reap,0,sizeof(*reap));
     _ogg_free(reap);
     reap=next;
   }
@@ -156,7 +156,7 @@
   if(vb->localstore)_ogg_free(vb->localstore);
   if(vb->internal)_ogg_free(vb->internal);
 
-  memset(vb,0,sizeof(vorbis_block));
+  memset(vb,0,sizeof(*vb));
   return(0);
 }
 
@@ -169,14 +169,14 @@
   codec_setup_info *ci=vi->codec_setup;
   backend_lookup_state *b=NULL;
 
-  memset(v,0,sizeof(vorbis_dsp_state));
-  b=v->backend_state=_ogg_calloc(1,sizeof(backend_lookup_state));
+  memset(v,0,sizeof(*v));
+  b=v->backend_state=_ogg_calloc(1,sizeof(*b));
 
   v->vi=vi;
   b->modebits=ilog2(ci->modes);
 
-  b->transform[0]=_ogg_calloc(VI_TRANSFORMB,sizeof(vorbis_look_transform *));
-  b->transform[1]=_ogg_calloc(VI_TRANSFORMB,sizeof(vorbis_look_transform *));
+  b->transform[0]=_ogg_calloc(VI_TRANSFORMB,sizeof(*b->transform[0]));
+  b->transform[1]=_ogg_calloc(VI_TRANSFORMB,sizeof(*b->transform[1]));
 
   /* MDCT is tranform 0 */
 
@@ -185,14 +185,14 @@
   mdct_init(b->transform[0][0],ci->blocksizes[0]);
   mdct_init(b->transform[1][0],ci->blocksizes[1]);
 
-  b->window[0][0][0]=_ogg_calloc(VI_WINDOWB,sizeof(float *));
+  b->window[0][0][0]=_ogg_calloc(VI_WINDOWB,sizeof(*b->window[0][0][0]));
   b->window[0][0][1]=b->window[0][0][0];
   b->window[0][1][0]=b->window[0][0][0];
   b->window[0][1][1]=b->window[0][0][0];
-  b->window[1][0][0]=_ogg_calloc(VI_WINDOWB,sizeof(float *));
-  b->window[1][0][1]=_ogg_calloc(VI_WINDOWB,sizeof(float *));
-  b->window[1][1][0]=_ogg_calloc(VI_WINDOWB,sizeof(float *));
-  b->window[1][1][1]=_ogg_calloc(VI_WINDOWB,sizeof(float *));
+  b->window[1][0][0]=_ogg_calloc(VI_WINDOWB,sizeof(*b->window[1][0][0]));
+  b->window[1][0][1]=_ogg_calloc(VI_WINDOWB,sizeof(*b->window[1][0][1]));
+  b->window[1][1][0]=_ogg_calloc(VI_WINDOWB,sizeof(*b->window[1][1][0]));
+  b->window[1][1][1]=_ogg_calloc(VI_WINDOWB,sizeof(*b->window[1][1][1]));
 
   for(i=0;i<VI_WINDOWB;i++){
     b->window[0][0][0][i]=
@@ -209,13 +209,13 @@
 
   if(encp){ /* encode/decode differ here */
     /* finish the codebooks */
-    b->fullbooks=_ogg_calloc(ci->books,sizeof(codebook));
+    b->fullbooks=_ogg_calloc(ci->books,sizeof(*b->fullbooks));
     for(i=0;i<ci->books;i++)
       vorbis_book_init_encode(b->fullbooks+i,ci->book_param[i]);
     v->analysisp=1;
   }else{
     /* finish the codebooks */
-    b->fullbooks=_ogg_calloc(ci->books,sizeof(codebook));
+    b->fullbooks=_ogg_calloc(ci->books,sizeof(*b->fullbooks));
     for(i=0;i<ci->books;i++)
       vorbis_book_init_decode(b->fullbooks+i,ci->book_param[i]);
   }
@@ -226,12 +226,12 @@
   v->pcm_storage=8192; /* we'll assume later that we have
                           a minimum of twice the blocksize of
                           accumulated samples in analysis */
-  v->pcm=_ogg_malloc(vi->channels*sizeof(float *));
-  v->pcmret=_ogg_malloc(vi->channels*sizeof(float *));
+  v->pcm=_ogg_malloc(vi->channels*sizeof(*v->pcm));
+  v->pcmret=_ogg_malloc(vi->channels*sizeof(*v->pcmret));
   {
     int i;
     for(i=0;i<vi->channels;i++)
-      v->pcm[i]=_ogg_calloc(v->pcm_storage,sizeof(float));
+      v->pcm[i]=_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i]));
   }
 
   /* all 1 (large block) or 0 (small block) */
@@ -245,7 +245,7 @@
   v->pcm_current=v->centerW;
 
   /* initialize all the mapping/backend lookups */
-  b->mode=_ogg_calloc(ci->modes,sizeof(vorbis_look_mapping *));
+  b->mode=_ogg_calloc(ci->modes,sizeof(*b->mode));
   for(i=0;i<ci->modes;i++){
     int mapnum=ci->mode_param[i]->mapping;
     int maptype=ci->map_type[mapnum];
@@ -265,7 +265,7 @@
   b->psy_g_look=_vp_global_look(vi);
 
   /* Initialize the envelope state storage */
-  b->ve=_ogg_calloc(1,sizeof(envelope_lookup));
+  b->ve=_ogg_calloc(1,sizeof(*b->ve));
   _ve_envelope_init(b->ve,vi);
   return(0);
 }
@@ -340,7 +340,7 @@
       _ogg_free(b);
     }
     
-    memset(v,0,sizeof(vorbis_dsp_state));
+    memset(v,0,sizeof(*v));
   }
 }
 
@@ -361,7 +361,7 @@
     v->pcm_storage=v->pcm_current+vals*2;
    
     for(i=0;i<vi->channels;i++){
-      v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(float));
+      v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(*v->pcm[i]));
     }
   }
 
@@ -374,8 +374,8 @@
 static void _preextrapolate_helper(vorbis_dsp_state *v){
   int i;
   int order=32;
-  float *lpc=alloca(order*sizeof(float));
-  float *work=alloca(v->pcm_current*sizeof(float));
+  float *lpc=alloca(order*sizeof(*lpc));
+  float *work=alloca(v->pcm_current*sizeof(*work));
   long j;
   v->preextrapolate=1;
 
@@ -411,7 +411,7 @@
   if(vals<=0){
     int order=32;
     int i;
-    float *lpc=alloca(order*sizeof(float));
+    float *lpc=alloca(order*sizeof(*lpc));
 
     /* if it wasn't done earlier (very short sample) */
     if(!v->preextrapolate)
@@ -445,7 +445,7 @@
            guarding the overlap, but bulletproof in case that
            assumtion goes away). zeroes will do. */
         memset(v->pcm[i]+v->eofflag,0,
-	       (v->pcm_current-v->eofflag)*sizeof(float));
+	       (v->pcm_current-v->eofflag)*sizeof(*v->pcm[i]));
 
       }
     }
@@ -550,17 +550,17 @@
     g->ampmax=_vp_ampmax_decay(g->ampmax,v);
     vbi->ampmax=g->ampmax;
 
-    vb->pcm=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels);
-    vbi->pcmdelay=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels);
+    vb->pcm=_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
+    vbi->pcmdelay=_vorbis_block_alloc(vb,sizeof(*vbi->pcmdelay)*vi->channels);
     for(i=0;i<vi->channels;i++){
       vbi->pcmdelay[i]=
-	_vorbis_block_alloc(vb,(vb->pcmend+beginW)*sizeof(float));
-      memcpy(vbi->pcmdelay[i],v->pcm[i],(vb->pcmend+beginW)*sizeof(float));
+	_vorbis_block_alloc(vb,(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i]));
+      memcpy(vbi->pcmdelay[i],v->pcm[i],(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i]));
       vb->pcm[i]=vbi->pcmdelay[i]+beginW;
       
       /* before we added the delay 
-      vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(float));
-      memcpy(vb->pcm[i],v->pcm[i]+beginW,ci->blocksizes[v->W]*sizeof(float));
+      vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
+      memcpy(vb->pcm[i],v->pcm[i]+beginW,ci->blocksizes[v->W]*sizeof(*vb->pcm[i]));
       */
 
     }
@@ -590,7 +590,7 @@
       
       for(i=0;i<vi->channels;i++)
         memmove(v->pcm[i],v->pcm[i]+movementW,
-		v->pcm_current*sizeof(float));
+		v->pcm_current*sizeof(*v->pcm[i]));
       
       
       v->lW=v->W;
@@ -658,7 +658,7 @@
       int i;
       for(i=0;i<vi->channels;i++)
         memmove(v->pcm[i],v->pcm[i]+shiftPCM,
-		v->pcm_current*sizeof(float));
+		v->pcm_current*sizeof(*v->pcm[i]));
     }
   }
 
@@ -691,7 +691,7 @@
       v->pcm_storage=endW+ci->blocksizes[1];
    
       for(i=0;i<vi->channels;i++)
-	v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(float)); 
+	v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(*v->pcm[i])); 
     }
 
     /* overlap/add PCM */

1.30      +11 -11    vorbis/lib/codebook.c

Index: codebook.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/codebook.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- codebook.c	2001/08/13 11:33:39	1.29
+++ codebook.c	2001/10/02 00:14:30	1.30
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: basic codebook pack/unpack/code/decode operations
- last mod: $Id: codebook.c,v 1.29 2001/08/13 11:33:39 xiphmont Exp $
+ last mod: $Id: codebook.c,v 1.30 2001/10/02 00:14:30 segher Exp $
 
  ********************************************************************/
 
@@ -148,7 +148,7 @@
    readies the codebook auxiliary structures for decode *************/
 int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
   long i,j;
-  memset(s,0,sizeof(static_codebook));
+  memset(s,0,sizeof(*s));
   s->allocedp=1;
 
   /* make sure alignment is correct */
@@ -163,7 +163,7 @@
   switch(oggpack_read(opb,1)){
   case 0:
     /* unordered */
-    s->lengthlist=_ogg_malloc(sizeof(long)*s->entries);
+    s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
 
     /* allocated but unused entries? */
     if(oggpack_read(opb,1)){
@@ -191,7 +191,7 @@
     /* ordered */
     {
       long length=oggpack_read(opb,5)+1;
-      s->lengthlist=_ogg_malloc(sizeof(long)*s->entries);
+      s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
 
       for(i=0;i<s->entries;){
         long num=oggpack_read(opb,_ilog(s->entries-i));
@@ -233,7 +233,7 @@
       }
       
       /* quantized values */
-      s->quantlist=_ogg_malloc(sizeof(long)*quantvals);
+      s->quantlist=_ogg_malloc(sizeof(*s->quantlist)*quantvals);
       for(i=0;i<quantvals;i++)
         s->quantlist[i]=oggpack_read(opb,s->q_quant);
       
@@ -344,8 +344,8 @@
 /* returns 0 on OK or -1 on eof *************************************/
 long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){
   int step=n/book->dim;
-  long *entry = alloca(sizeof(long)*step);
-  float **t = alloca(sizeof(float *)*step);
+  long *entry = alloca(sizeof(*entry)*step);
+  float **t = alloca(sizeof(*t)*step);
   int i,j,o;
 
   for (i = 0; i < step; i++) {
@@ -523,10 +523,10 @@
   while(testlist[ptr]){
     codebook c;
     static_codebook s;
-    float *qv=alloca(sizeof(float)*TESTSIZE);
-    float *iv=alloca(sizeof(float)*TESTSIZE);
-    memcpy(qv,testvec[ptr],sizeof(float)*TESTSIZE);
-    memset(iv,0,sizeof(float)*TESTSIZE);
+    float *qv=alloca(sizeof(*qv)*TESTSIZE);
+    float *iv=alloca(sizeof(*iv)*TESTSIZE);
+    memcpy(qv,testvec[ptr],sizeof(*qv)*TESTSIZE);
+    memset(iv,0,sizeof(*iv)*TESTSIZE);
 
     fprintf(stderr,"\tpacking/coding %ld... ",ptr);
 

1.38      +10 -10    vorbis/lib/envelope.c

Index: envelope.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/envelope.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- envelope.c	2001/08/13 01:36:56	1.37
+++ envelope.c	2001/10/02 00:14:30	1.38
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: PCM data envelope analysis and manipulation
- last mod: $Id: envelope.c,v 1.37 2001/08/13 01:36:56 xiphmont Exp $
+ last mod: $Id: envelope.c,v 1.38 2001/10/02 00:14:30 segher Exp $
 
  Preecho calculation.
 
@@ -88,8 +88,8 @@
   int i;
   e->winlength=window;
   e->minenergy=fromdB(gi->preecho_minenergy);
-  e->iir=_ogg_calloc(ch*4,sizeof(IIR_state));
-  e->filtered=_ogg_calloc(ch*4,sizeof(float *));
+  e->iir=_ogg_calloc(ch*4,sizeof(*e->iir));
+  e->filtered=_ogg_calloc(ch*4,sizeof(*e->filtered));
   e->ch=ch;
   e->storage=128;
   for(i=0;i<ch*4;i+=4){
@@ -103,10 +103,10 @@
     IIR_init(e->iir+i+3,cheb_bandpass_stages,cheb_bandpass1k_gain,
              cheb_bandpass1k_A,cheb_bandpass_B);
 
-    e->filtered[i]=_ogg_calloc(e->storage,sizeof(float));
-    e->filtered[i+1]=_ogg_calloc(e->storage,sizeof(float));
-    e->filtered[i+2]=_ogg_calloc(e->storage,sizeof(float));
-    e->filtered[i+3]=_ogg_calloc(e->storage,sizeof(float));
+    e->filtered[i]=_ogg_calloc(e->storage,sizeof(*e->filtered[i]));
+    e->filtered[i+1]=_ogg_calloc(e->storage,sizeof(*e->filtered[i+1]));
+    e->filtered[i+2]=_ogg_calloc(e->storage,sizeof(*e->filtered[i+2]));
+    e->filtered[i+3]=_ogg_calloc(e->storage,sizeof(*e->filtered[i+3]));
   }
 
 }
@@ -119,7 +119,7 @@
   }
   _ogg_free(e->filtered);
   _ogg_free(e->iir);
-  memset(e,0,sizeof(envelope_lookup));
+  memset(e,0,sizeof(*e));
 }
 
 /* straight threshhold based until we find something that works better
@@ -159,7 +159,7 @@
   if(v->pcm_storage>ve->storage){
     ve->storage=v->pcm_storage;
     for(i=0;i<ve->ch*4;i++)
-      ve->filtered[i]=_ogg_realloc(ve->filtered[i],ve->storage*sizeof(float));
+      ve->filtered[i]=_ogg_realloc(ve->filtered[i],ve->storage*sizeof(*ve->filtered[i]));
   }
 
   /* catch up the highpass to match the pcm */
@@ -228,7 +228,7 @@
   int i;
   for(i=0;i<e->ch*4;i++)
     memmove(e->filtered[i],e->filtered[i]+shift,(e->current-shift)*
-	    sizeof(float));
+	    sizeof(*e->filtered[i]));
   e->current-=shift;
   e->lastmark-=shift;
 }

1.46      +21 -20    vorbis/lib/floor0.c

Index: floor0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor0.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- floor0.c	2001/08/13 01:36:56	1.45
+++ floor0.c	2001/10/02 00:14:30	1.46
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.45 2001/08/13 01:36:56 xiphmont Exp $
+ last mod: $Id: floor0.c,v 1.46 2001/10/02 00:14:30 segher Exp $
 
  ********************************************************************/
 
@@ -63,7 +63,7 @@
     lsp[i]=(orig[i+cursor]-base);
   best=_best(book,lsp,1);
 
-  memcpy(lsp,book->valuelist+best*dim,dim*sizeof(float));
+  memcpy(lsp,book->valuelist+best*dim,dim*sizeof(*lsp));
   for(i=0;i<dim;i++)
     lsp[i]+=base;
   return(best);
@@ -73,21 +73,22 @@
 
 static vorbis_info_floor *floor0_copy_info (vorbis_info_floor *i){
   vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
-  vorbis_info_floor0 *ret=_ogg_malloc(sizeof(vorbis_info_floor0));
-  memcpy(ret,info,sizeof(vorbis_info_floor0));
+  vorbis_info_floor0 *ret=_ogg_malloc(sizeof(*ret));
+  memcpy(ret,info,sizeof(*ret));
   return(ret);
 }
 
 static void floor0_free_info(vorbis_info_floor *i){
-  if(i){
-    memset(i,0,sizeof(vorbis_info_floor0));
-    _ogg_free(i);
+  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
+  if(info){
+    memset(info,0,sizeof(*info));
+    _ogg_free(info);
   }
 }
 
 static void floor0_free_look(vorbis_look_floor *i){
   vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
-  if(i){
+  if(look){
 
     /*fprintf(stderr,"floor 0 bit usage %f\n",
       (float)look->bits/look->frames);*/
@@ -95,7 +96,7 @@
     if(look->linearmap)_ogg_free(look->linearmap);
     if(look->lsp_look)_ogg_free(look->lsp_look);
     lpc_clear(&look->lpclook);
-    memset(look,0,sizeof(vorbis_look_floor0));
+    memset(look,0,sizeof(*look));
     _ogg_free(look);
   }
 }
@@ -117,7 +118,7 @@
   codec_setup_info     *ci=vi->codec_setup;
   int j;
 
-  vorbis_info_floor0 *info=_ogg_malloc(sizeof(vorbis_info_floor0));
+  vorbis_info_floor0 *info=_ogg_malloc(sizeof(*info));
   info->order=oggpack_read(opb,8);
   info->rate=oggpack_read(opb,16);
   info->barkmap=oggpack_read(opb,16);
@@ -156,7 +157,7 @@
   vorbis_info        *vi=vd->vi;
   codec_setup_info   *ci=vi->codec_setup;
   vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
-  vorbis_look_floor0 *look=_ogg_calloc(1,sizeof(vorbis_look_floor0));
+  vorbis_look_floor0 *look=_ogg_calloc(1,sizeof(*look));
   look->m=info->order;
   look->n=ci->blocksizes[mi->blockflag]/2;
   look->ln=info->barkmap;
@@ -176,7 +177,7 @@
      the encoder may do what it wishes in filling them.  They're
      necessary in some mapping combinations to keep the scale spacing
      accurate */
-  look->linearmap=_ogg_malloc((look->n+1)*sizeof(int));
+  look->linearmap=_ogg_malloc((look->n+1)*sizeof(*look->linearmap));
   for(j=0;j<look->n;j++){
     int val=floor( toBARK((info->rate/2.f)/look->n*j) 
                    *scale); /* bark numbers represent band edges */
@@ -185,7 +186,7 @@
   }
   look->linearmap[j]=-1;
 
-  look->lsp_look=_ogg_malloc(look->ln*sizeof(float));
+  look->lsp_look=_ogg_malloc(look->ln*sizeof(*look->lsp_look));
   for(j=0;j<look->ln;j++)
     look->lsp_look[j]=2*cos(M_PI/look->ln*j);
 
@@ -200,12 +201,12 @@
   /* map the input curve to a bark-scale curve for encoding */
   
   int mapped=l->ln;
-  float *work=alloca(sizeof(float)*mapped);
+  float *work=alloca(sizeof(*work)*mapped);
   int i,j,last=0;
   int bark=0;
   static int seq=0;
 
-  memset(work,0,sizeof(float)*mapped);
+  memset(work,0,sizeof(*work)*mapped);
   
   /* Only the decode side is behavior-specced; for now in the encoder,
      we select the maximum value of each band as representative (this
@@ -323,7 +324,7 @@
   look->frames++;
 
   if(val){
-    float *lspwork=alloca(look->m*sizeof(float));
+    float *lspwork=alloca(look->m*sizeof(*lspwork));
 
     /* the spec supports using one of a number of codebooks.  Right
        now, encode using this lib supports only one */
@@ -404,8 +405,8 @@
     fclose(of);
 #endif
 
-  memset(codedflr,0,sizeof(float)*look->n);
-  memset(mdct,0,sizeof(float)*look->n);
+  memset(codedflr,0,sizeof(*codedflr)*look->n);
+  memset(mdct,0,sizeof(*mdct)*look->n);
   return(val);
 }
 
@@ -424,7 +425,7 @@
       backend_lookup_state *be=vb->vd->backend_state;
       codebook *b=be->fullbooks+info->books[booknum];
       float last=0.f;
-      float *lsp=_vorbis_block_alloc(vb,sizeof(float)*(look->m+1));
+      float *lsp=_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+1));
             
       for(j=0;j<look->m;j+=b->dim)
         if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim)==-1)goto eop;
@@ -455,7 +456,7 @@
                         lsp,look->m,amp,info->ampdB);
     return(1);
   }
-  memset(out,0,sizeof(float)*look->n);
+  memset(out,0,sizeof(*out)*look->n);
   return(0);
 }
 

1.16      +18 -17    vorbis/lib/floor1.c

Index: floor1.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor1.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- floor1.c	2001/09/01 06:14:50	1.15
+++ floor1.c	2001/10/02 00:14:31	1.16
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: floor backend 1 implementation
- last mod: $Id: floor1.c,v 1.15 2001/09/01 06:14:50 xiphmont Exp $
+ last mod: $Id: floor1.c,v 1.16 2001/10/02 00:14:31 segher Exp $
 
  ********************************************************************/
 
@@ -68,28 +68,29 @@
  
 static vorbis_info_floor *floor1_copy_info (vorbis_info_floor *i){
   vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;
-  vorbis_info_floor1 *ret=_ogg_malloc(sizeof(vorbis_info_floor1));
-  memcpy(ret,info,sizeof(vorbis_info_floor1));
+  vorbis_info_floor1 *ret=_ogg_malloc(sizeof(*ret));
+  memcpy(ret,info,sizeof(*ret));
   return(ret);
 }
 
 static void floor1_free_info(vorbis_info_floor *i){
-  if(i){
-    memset(i,0,sizeof(vorbis_info_floor1));
-    _ogg_free(i);
+  vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;
+  if(info){
+    memset(info,0,sizeof(*info));
+    _ogg_free(info);
   }
 }
 
 static void floor1_free_look(vorbis_look_floor *i){
   vorbis_look_floor1 *look=(vorbis_look_floor1 *)i;
-  if(i){
+  if(look){
     /*fprintf(stderr,"floor 1 bit usage %f:%f (%f total)\n",
             (float)look->phrasebits/look->frames,
             (float)look->postbits/look->frames,
             (float)(look->postbits+look->phrasebits)/look->frames);*/
 
-    memset(look,0,sizeof(vorbis_look_floor1));
-    free(i);
+    memset(look,0,sizeof(*look));
+    free(look);
   }
 }
 
@@ -152,7 +153,7 @@
   codec_setup_info     *ci=vi->codec_setup;
   int j,k,count=0,maxclass=-1,rangebits;
 
-  vorbis_info_floor1 *info=_ogg_calloc(1,sizeof(vorbis_info_floor1));
+  vorbis_info_floor1 *info=_ogg_calloc(1,sizeof(*info));
   /* read partitions */
   info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */
   for(j=0;j<info->partitions;j++){
@@ -207,7 +208,7 @@
 
   int *sortpointer[VIF_POSIT+2];
   vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;
-  vorbis_look_floor1 *look=_ogg_calloc(1,sizeof(vorbis_look_floor1));
+  vorbis_look_floor1 *look=_ogg_calloc(1,sizeof(*look));
   int i,j,n=0;
 
   look->vi=info;
@@ -226,7 +227,7 @@
 
   /* also store a sorted position index */
   for(i=0;i<n;i++)sortpointer[i]=info->postlist+i;
-  qsort(sortpointer,n,sizeof(int *),icomp);
+  qsort(sortpointer,n,sizeof(*sortpointer),icomp);
 
   /* points from sort order back to range number */
   for(i=0;i<n;i++)look->forward_index[i]=sortpointer[i]-info->postlist;
@@ -426,7 +427,7 @@
 
   long xa=0,ya=0,x2a=0,y2a=0,xya=0,na=0, xb=0,yb=0,x2b=0,y2b=0,xyb=0,nb=0;
 
-  memset(a,0,sizeof(lsfit_acc));
+  memset(a,0,sizeof(*a));
   a->x0=x0;
   a->x1=x1;
   a->edgey0=quantized;
@@ -1013,8 +1014,8 @@
 
   }else{
     if(writeflag)oggpack_write(&vb->opb,0,1);
-    memset(codedflr,0,n*sizeof(float));
-    memset(mdct,0,n*sizeof(float));
+    memset(codedflr,0,n*sizeof(*codedflr));
+    memset(mdct,0,n*sizeof(*mdct));
   }
   seq++;
   return(nonzero);
@@ -1031,7 +1032,7 @@
 
   /* unpack wrapped/predicted values from stream */
   if(oggpack_read(&vb->opb,1)==1){
-    int *fit_value=_vorbis_block_alloc(vb,(look->posts)*sizeof(int));
+    int *fit_value=_vorbis_block_alloc(vb,(look->posts)*sizeof(*fit_value));
 
     fit_value[0]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
     fit_value[1]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
@@ -1140,7 +1141,7 @@
     for(j=hx;j<n;j++)out[j]*=out[j-1]; /* be certain */    
     return(1);
   }
-  memset(out,0,sizeof(float)*n);
+  memset(out,0,sizeof(*out)*n);
   return(0);
 }
 

1.11      +10 -10    vorbis/lib/iir.c

Index: iir.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/iir.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- iir.c	2001/02/26 03:50:41	1.10
+++ iir.c	2001/10/02 00:14:31	1.11
@@ -11,7 +11,7 @@
  ********************************************************************
 
   function: Direct Form II IIR filters, plus some specializations
-  last mod: $Id: iir.c,v 1.10 2001/02/26 03:50:41 xiphmont Exp $
+  last mod: $Id: iir.c,v 1.11 2001/10/02 00:14:31 segher Exp $
 
  ********************************************************************/
 
@@ -25,15 +25,15 @@
 #include "iir.h"
 
 void IIR_init(IIR_state *s,int stages,float gain, float *A, float *B){
-  memset(s,0,sizeof(IIR_state));
+  memset(s,0,sizeof(*s));
   s->stages=stages;
   s->gain=1.f/gain;
-  s->coeff_A=_ogg_malloc(stages*sizeof(float));
-  s->coeff_B=_ogg_malloc((stages+1)*sizeof(float));
-  s->z_A=_ogg_calloc(stages*2,sizeof(float));
+  s->coeff_A=_ogg_malloc(stages*sizeof(*s->coeff_A));
+  s->coeff_B=_ogg_malloc((stages+1)*sizeof(*s->coeff_B));
+  s->z_A=_ogg_calloc(stages*2,sizeof(*s->z_A));
 
-  memcpy(s->coeff_A,A,stages*sizeof(float));
-  memcpy(s->coeff_B,B,(stages+1)*sizeof(float));
+  memcpy(s->coeff_A,A,stages*sizeof(*s->coeff_A));
+  memcpy(s->coeff_B,B,(stages+1)*sizeof(*s->coeff_B));
 }
 
 void IIR_clear(IIR_state *s){
@@ -41,12 +41,12 @@
     _ogg_free(s->coeff_A);
     _ogg_free(s->coeff_B);
     _ogg_free(s->z_A);
-    memset(s,0,sizeof(IIR_state));
+    memset(s,0,sizeof(*s));
   }
 }
 
 void IIR_reset(IIR_state *s){
-  memset(s->z_A,0,sizeof(float)*s->stages*2);
+  memset(s->z_A,0,sizeof(*s->z_A)*s->stages*2);
 }
 
 float IIR_filter(IIR_state *s,float in){
@@ -265,7 +265,7 @@
 
   /* run the pregenerated Chebyshev filter, then our own distillation
      through the generic and specialized code */
-  float *work=_ogg_malloc(128*sizeof(float));
+  float *work=_ogg_malloc(128*sizeof(*work));
   IIR_state iir;
   int i;
 

1.46      +19 -19    vorbis/lib/info.c

Index: info.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/info.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- info.c	2001/09/30 14:02:31	1.45
+++ info.c	2001/10/02 00:14:31	1.46
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: maintain the info structure, info <-> header packets
- last mod: $Id: info.c,v 1.45 2001/09/30 14:02:31 msmith Exp $
+ last mod: $Id: info.c,v 1.46 2001/10/02 00:14:31 segher Exp $
 
  ********************************************************************/
 
@@ -54,14 +54,14 @@
 }
 
 void vorbis_comment_init(vorbis_comment *vc){
-  memset(vc,0,sizeof(vorbis_comment));
+  memset(vc,0,sizeof(*vc));
 }
 
 void vorbis_comment_add(vorbis_comment *vc,char *comment){
   vc->user_comments=_ogg_realloc(vc->user_comments,
-			    (vc->comments+2)*sizeof(char *));
+			    (vc->comments+2)*sizeof(*vc->user_comments));
   vc->comment_lengths=_ogg_realloc(vc->comment_lengths,
-      			    (vc->comments+2)*sizeof(int));
+      			    (vc->comments+2)*sizeof(*vc->comment_lengths));
   vc->user_comments[vc->comments]=strdup(comment);
   vc->comment_lengths[vc->comments]=strlen(comment);
   vc->comments++;
@@ -133,12 +133,12 @@
         if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
     if(vc->vendor)_ogg_free(vc->vendor);
   }
-  memset(vc,0,sizeof(vorbis_comment));
+  memset(vc,0,sizeof(*vc));
 }
 
 /* used by synthesis, which has a full, alloced vi */
 void vorbis_info_init(vorbis_info *vi){
-  memset(vi,0,sizeof(vorbis_info));
+  memset(vi,0,sizeof(*vi));
   vi->codec_setup=_ogg_calloc(1,sizeof(codec_setup_info));
 }
 
@@ -176,7 +176,7 @@
     _ogg_free(ci);
   }
 
-  memset(vi,0,sizeof(vorbis_info));
+  memset(vi,0,sizeof(*vi));
 }
 
 /* Header packing/unpacking ********************************************/
@@ -219,8 +219,8 @@
   _v_readstring(opb,vc->vendor,vendorlen);
   vc->comments=oggpack_read(opb,32);
   if(vc->comments<0)goto err_out;
-  vc->user_comments=_ogg_calloc(vc->comments+1,sizeof(char *));
-  vc->comment_lengths=_ogg_calloc(vc->comments+1, sizeof(int));
+  vc->user_comments=_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments));
+  vc->comment_lengths=_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));
             
   for(i=0;i<vc->comments;i++){
     int len=oggpack_read(opb,32);
@@ -246,15 +246,15 @@
 
   /* codebooks */
   ci->books=oggpack_read(opb,8)+1;
-  /*ci->book_param=_ogg_calloc(ci->books,sizeof(static_codebook *));*/
+  /*ci->book_param=_ogg_calloc(ci->books,sizeof(*ci->book_param));*/
   for(i=0;i<ci->books;i++){
-    ci->book_param[i]=_ogg_calloc(1,sizeof(static_codebook));
+    ci->book_param[i]=_ogg_calloc(1,sizeof(*ci->book_param[i]));
     if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out;
   }
 
   /* time backend settings */
   ci->times=oggpack_read(opb,6)+1;
-  /*ci->time_type=_ogg_malloc(ci->times*sizeof(int));*/
+  /*ci->time_type=_ogg_malloc(ci->times*sizeof(*ci->time_type));*/
   /*ci->time_param=_ogg_calloc(ci->times,sizeof(void *));*/
   for(i=0;i<ci->times;i++){
     ci->time_type[i]=oggpack_read(opb,16);
@@ -265,7 +265,7 @@
 
   /* floor backend settings */
   ci->floors=oggpack_read(opb,6)+1;
-  /*ci->floor_type=_ogg_malloc(ci->floors*sizeof(int));*/
+  /*ci->floor_type=_ogg_malloc(ci->floors*sizeof(*ci->floor_type));*/
   /*ci->floor_param=_ogg_calloc(ci->floors,sizeof(void *));*/
   for(i=0;i<ci->floors;i++){
     ci->floor_type[i]=oggpack_read(opb,16);
@@ -276,7 +276,7 @@
 
   /* residue backend settings */
   ci->residues=oggpack_read(opb,6)+1;
-  /*ci->residue_type=_ogg_malloc(ci->residues*sizeof(int));*/
+  /*ci->residue_type=_ogg_malloc(ci->residues*sizeof(*ci->residue_type));*/
   /*ci->residue_param=_ogg_calloc(ci->residues,sizeof(void *));*/
   for(i=0;i<ci->residues;i++){
     ci->residue_type[i]=oggpack_read(opb,16);
@@ -287,7 +287,7 @@
 
   /* map backend settings */
   ci->maps=oggpack_read(opb,6)+1;
-  /*ci->map_type=_ogg_malloc(ci->maps*sizeof(int));*/
+  /*ci->map_type=_ogg_malloc(ci->maps*sizeof(*ci->map_type));*/
   /*ci->map_param=_ogg_calloc(ci->maps,sizeof(void *));*/
   for(i=0;i<ci->maps;i++){
     ci->map_type[i]=oggpack_read(opb,16);
@@ -300,7 +300,7 @@
   ci->modes=oggpack_read(opb,6)+1;
   /*vi->mode_param=_ogg_calloc(vi->modes,sizeof(void *));*/
   for(i=0;i<ci->modes;i++){
-    ci->mode_param[i]=_ogg_calloc(1,sizeof(vorbis_info_mode));
+    ci->mode_param[i]=_ogg_calloc(1,sizeof(*ci->mode_param[i]));
     ci->mode_param[i]->blockflag=oggpack_read(opb,1);
     ci->mode_param[i]->windowtype=oggpack_read(opb,16);
     ci->mode_param[i]->transformtype=oggpack_read(opb,16);
@@ -573,9 +573,9 @@
   return(0);
  err_out:
   oggpack_writeclear(&opb);
-  memset(op,0,sizeof(ogg_packet));
-  memset(op_comm,0,sizeof(ogg_packet));
-  memset(op_code,0,sizeof(ogg_packet));
+  memset(op,0,sizeof(*op));
+  memset(op_comm,0,sizeof(*op_comm));
+  memset(op_code,0,sizeof(*op_code));
 
   if(b->header)_ogg_free(b->header);
   if(b->header1)_ogg_free(b->header1);

1.32      +6 -6      vorbis/lib/lpc.c

Index: lpc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/lpc.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- lpc.c	2001/02/26 03:50:42	1.31
+++ lpc.c	2001/10/02 00:14:31	1.32
@@ -11,7 +11,7 @@
  ********************************************************************
 
   function: LPC low level routines
-  last mod: $Id: lpc.c,v 1.31 2001/02/26 03:50:42 xiphmont Exp $
+  last mod: $Id: lpc.c,v 1.32 2001/10/02 00:14:31 segher Exp $
 
  ********************************************************************/
 
@@ -59,7 +59,7 @@
    Output: m lpc coefficients, excitation energy */
 
 float vorbis_lpc_from_data(float *data,float *lpc,int n,int m){
-  float *aut=alloca(sizeof(float)*(m+1));
+  float *aut=alloca(sizeof(*aut)*(m+1));
   float error;
   int i,j;
 
@@ -80,7 +80,7 @@
     float r=-aut[i+1];
 
     if(error==0){
-      memset(lpc,0,m*sizeof(float));
+      memset(lpc,0,m*sizeof(*lpc));
       return 0;
     }
 
@@ -117,7 +117,7 @@
 float vorbis_lpc_from_curve(float *curve,float *lpc,lpc_lookup *l){
   int n=l->ln;
   int m=l->m;
-  float *work=alloca(sizeof(float)*(n+n));
+  float *work=alloca(sizeof(*work)*(n+n));
   float fscale=.5f/n;
   int i,j;
   
@@ -149,7 +149,7 @@
 }
 
 void lpc_init(lpc_lookup *l,long mapped, int m){
-  memset(l,0,sizeof(lpc_lookup));
+  memset(l,0,sizeof(*l));
 
   l->ln=mapped;
   l->m=m;
@@ -174,7 +174,7 @@
 
   long i,j,o,p;
   float y;
-  float *work=alloca(sizeof(float)*(m+n));
+  float *work=alloca(sizeof(*work)*(m+n));
 
   if(!prime)
     for(i=0;i<m;i++)

1.19      +10 -10    vorbis/lib/lsp.c

Index: lsp.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/lsp.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- lsp.c	2001/06/15 21:15:39	1.18
+++ lsp.c	2001/10/02 00:14:31	1.19
@@ -11,7 +11,7 @@
  ********************************************************************
 
   function: LSP (also called LSF) conversion routines
-  last mod: $Id: lsp.c,v 1.18 2001/06/15 21:15:39 xiphmont Exp $
+  last mod: $Id: lsp.c,v 1.19 2001/10/02 00:14:31 segher Exp $
 
   The LSP generation code is taken (with minimal modification and a
   few bugfixes) from "On the Computation of the LSP Frequencies" by
@@ -144,7 +144,7 @@
   int i;
   int ampoffseti=rint(ampoffset*4096.f);
   int ampi=rint(amp*16.f);
-  long *ilsp=alloca(m*sizeof(long));
+  long *ilsp=alloca(m*sizeof(*ilsp));
   for(i=0;i<m;i++)ilsp[i]=vorbis_coslook_i(lsp[i]/M_PI*65536.f+.5f);
 
   i=0;
@@ -311,7 +311,7 @@
 static int Laguerre_With_Deflation(float *a,int ord,float *r){
   int i,m;
   double lastdelta=0.f;
-  double *defl=alloca(sizeof(double)*(ord+1));
+  double *defl=alloca(sizeof(*defl)*(ord+1));
   for(i=0;i<=ord;i++)defl[i]=a[i];
 
   for(m=ord;m>0;m--){
@@ -367,7 +367,7 @@
 static int Newton_Raphson(float *a,int ord,float *r){
   int i, k, count=0;
   double error=1.f;
-  double *root=alloca(ord*sizeof(double));
+  double *root=alloca(ord*sizeof(*root));
 
   for(i=0; i<ord;i++) root[i] = r[i];
   
@@ -406,10 +406,10 @@
 int vorbis_lpc_to_lsp(float *lpc,float *lsp,int m){
   int order2=(m+1)>>1;
   int g1_order,g2_order;
-  float *g1=alloca(sizeof(float)*(order2+1));
-  float *g2=alloca(sizeof(float)*(order2+1));
-  float *g1r=alloca(sizeof(float)*(order2+1));
-  float *g2r=alloca(sizeof(float)*(order2+1));
+  float *g1=alloca(sizeof(*g1)*(order2+1));
+  float *g2=alloca(sizeof(*g2)*(order2+1));
+  float *g1r=alloca(sizeof(*g1r)*(order2+1));
+  float *g2r=alloca(sizeof(*g2r)*(order2+1));
   int i;
 
   /* even and odd are slightly different base cases */
@@ -445,8 +445,8 @@
   Newton_Raphson(g1,g1_order,g1r); /* if it fails, it leaves g1r alone */
   Newton_Raphson(g2,g2_order,g2r); /* if it fails, it leaves g2r alone */
 
-  qsort(g1r,g1_order,sizeof(float),comp);
-  qsort(g2r,g2_order,sizeof(float),comp);
+  qsort(g1r,g1_order,sizeof(*g1r),comp);
+  qsort(g2r,g2_order,sizeof(*g2r),comp);
 
   for(i=0;i<g1_order;i++)
     lsp[i*2] = acos(g1r[i]);

1.37      +40 -39    vorbis/lib/mapping0.c

Index: mapping0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mapping0.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- mapping0.c	2001/09/11 05:06:57	1.36
+++ mapping0.c	2001/10/02 00:14:31	1.37
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: channel mapping 0 implementation
- last mod: $Id: mapping0.c,v 1.36 2001/09/11 05:06:57 xiphmont Exp $
+ last mod: $Id: mapping0.c,v 1.37 2001/10/02 00:14:31 segher Exp $
 
  ********************************************************************/
 
@@ -61,15 +61,16 @@
 
 static vorbis_info_mapping *mapping0_copy_info(vorbis_info_mapping *vm){
   vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm;
-  vorbis_info_mapping0 *ret=_ogg_malloc(sizeof(vorbis_info_mapping0));
-  memcpy(ret,info,sizeof(vorbis_info_mapping0));
+  vorbis_info_mapping0 *ret=_ogg_malloc(sizeof(*ret));
+  memcpy(ret,info,sizeof(*ret));
   return(ret);
 }
 
 static void mapping0_free_info(vorbis_info_mapping *i){
-  if(i){
-    memset(i,0,sizeof(vorbis_info_mapping0));
-    _ogg_free(i);
+  vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)i;
+  if(info){
+    memset(info,0,sizeof(*info));
+    _ogg_free(info);
   }
 }
 
@@ -98,7 +99,7 @@
     _ogg_free(l->time_look);
     _ogg_free(l->floor_look);
     _ogg_free(l->residue_look);
-    memset(l,0,sizeof(vorbis_look_mapping0));
+    memset(l,0,sizeof(*l));
     _ogg_free(l);
   }
 }
@@ -108,18 +109,18 @@
   int i;
   vorbis_info          *vi=vd->vi;
   codec_setup_info     *ci=vi->codec_setup;
-  vorbis_look_mapping0 *look=_ogg_calloc(1,sizeof(vorbis_look_mapping0));
+  vorbis_look_mapping0 *look=_ogg_calloc(1,sizeof(*look));
   vorbis_info_mapping0 *info=look->map=(vorbis_info_mapping0 *)m;
   look->mode=vm;
   
-  look->time_look=_ogg_calloc(info->submaps,sizeof(vorbis_look_time *));
-  look->floor_look=_ogg_calloc(info->submaps,sizeof(vorbis_look_floor *));
+  look->time_look=_ogg_calloc(info->submaps,sizeof(*look->time_look));
+  look->floor_look=_ogg_calloc(info->submaps,sizeof(*look->floor_look));
 
-  look->residue_look=_ogg_calloc(info->submaps,sizeof(vorbis_look_residue *));
+  look->residue_look=_ogg_calloc(info->submaps,sizeof(*look->residue_look));
 
-  look->time_func=_ogg_calloc(info->submaps,sizeof(vorbis_func_time *));
-  look->floor_func=_ogg_calloc(info->submaps,sizeof(vorbis_func_floor *));
-  look->residue_func=_ogg_calloc(info->submaps,sizeof(vorbis_func_residue *));
+  look->time_func=_ogg_calloc(info->submaps,sizeof(*look->time_func));
+  look->floor_func=_ogg_calloc(info->submaps,sizeof(*look->floor_func));
+  look->residue_func=_ogg_calloc(info->submaps,sizeof(*look->residue_func));
   
   for(i=0;i<info->submaps;i++){
     int timenum=info->timesubmap[i];
@@ -141,20 +142,20 @@
     if(info->psy[0] != info->psy[1]){
 
       int psynum=info->psy[0];
-      look->psy_look[0]=_ogg_calloc(1,sizeof(vorbis_look_psy));      
+      look->psy_look[0]=_ogg_calloc(1,sizeof(*look->psy_look[0]));      
       _vp_psy_init(look->psy_look[0],ci->psy_param[psynum],
                    ci->psy_g_param,
                    ci->blocksizes[vm->blockflag]/2,vi->rate);
 
       psynum=info->psy[1];
-      look->psy_look[1]=_ogg_calloc(1,sizeof(vorbis_look_psy));      
+      look->psy_look[1]=_ogg_calloc(1,sizeof(*look->psy_look[1]));      
       _vp_psy_init(look->psy_look[1],ci->psy_param[psynum],
                    ci->psy_g_param,
                    ci->blocksizes[vm->blockflag]/2,vi->rate);
     }else{
 
       int psynum=info->psy[0];
-      look->psy_look[0]=_ogg_calloc(1,sizeof(vorbis_look_psy));      
+      look->psy_look[0]=_ogg_calloc(1,sizeof(*look->psy_look[0]));      
       look->psy_look[1]=look->psy_look[0];
       _vp_psy_init(look->psy_look[0],ci->psy_param[psynum],
                    ci->psy_g_param,
@@ -223,9 +224,9 @@
 /* also responsible for range checking */
 static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
   int i;
-  vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(vorbis_info_mapping0));
+  vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(*info));
   codec_setup_info     *ci=vi->codec_setup;
-  memset(info,0,sizeof(vorbis_info_mapping0));
+  memset(info,0,sizeof(*info));
 
   if(oggpack_read(opb,1))
     info->submaps=oggpack_read(opb,4)+1;
@@ -294,12 +295,12 @@
   int                    n=vb->pcmend;
   int i,j;
   float *window=b->window[vb->W][vb->lW][vb->nW][mode->windowtype];
-  int   *nonzero=alloca(sizeof(int)*vi->channels);
+  int   *nonzero=alloca(sizeof(*nonzero)*vi->channels);
 
-  float *work=_vorbis_block_alloc(vb,n*sizeof(float));
+  float *work=_vorbis_block_alloc(vb,n*sizeof(*work));
 
   float global_ampmax=vbi->ampmax;
-  float *local_ampmax=alloca(sizeof(float)*vi->channels);
+  float *local_ampmax=alloca(sizeof(*local_ampmax)*vi->channels);
   int blocktype;
 
   /* we differentiate between short and long block types to help the
@@ -450,14 +451,14 @@
    
   {
     float  **pcm=vb->pcm;
-    float  **quantized=alloca(sizeof(float*)*vi->channels);
-    float  **sofar=alloca(sizeof(float*)*vi->channels);
+    float  **quantized=alloca(sizeof(*quantized)*vi->channels);
+    float  **sofar=alloca(sizeof(*sofar)*vi->channels);
 
-    long  ***classifications=alloca(sizeof(long**)*info->submaps);
-    float ***pcmbundle=alloca(sizeof(float **)*info->submaps);
-    float ***sobundle=alloca(sizeof(float **)*info->submaps);
-    int    **zerobundle=alloca(sizeof(int *)*info->submaps);
-    int     *chbundle=alloca(sizeof(int)*info->submaps);
+    long  ***classifications=alloca(sizeof(*classifications)*info->submaps);
+    float ***pcmbundle=alloca(sizeof(*pcmbundle)*info->submaps);
+    float ***sobundle=alloca(sizeof(*sobundle)*info->submaps);
+    int    **zerobundle=alloca(sizeof(*zerobundle)*info->submaps);
+    int     *chbundle=alloca(sizeof(*chbundle)*info->submaps);
     int      chcounter=0;
 
     /* play a little loose with this abstraction */
@@ -466,13 +467,13 @@
 
     for(i=0;i<vi->channels;i++){
       quantized[i]=pcm[i]+n/2;
-      sofar[i]=_vorbis_block_alloc(vb,n/2*sizeof(float));
-      memset(sofar[i],0,sizeof(float)*n/2);
+      sofar[i]=_vorbis_block_alloc(vb,n/2*sizeof(*sofar[i]));
+      memset(sofar[i],0,sizeof(*sofar[i])*n/2);
     }
 
-    pcmbundle[0]=alloca(sizeof(float *)*vi->channels);
-    sobundle[0]=alloca(sizeof(float *)*vi->channels);
-    zerobundle[0]=alloca(sizeof(int)*vi->channels);
+    pcmbundle[0]=alloca(sizeof(*pcmbundle[0])*vi->channels);
+    sobundle[0]=alloca(sizeof(*sobundle[0])*vi->channels);
+    zerobundle[0]=alloca(sizeof(*zerobundle[0])*vi->channels);
 
     /* initial down-quantized coupling */
     
@@ -586,11 +587,11 @@
   long                  n=vb->pcmend=ci->blocksizes[vb->W];
 
   float *window=b->window[vb->W][vb->lW][vb->nW][mode->windowtype];
-  float **pcmbundle=alloca(sizeof(float *)*vi->channels);
-  int    *zerobundle=alloca(sizeof(int)*vi->channels);
+  float **pcmbundle=alloca(sizeof(*pcmbundle)*vi->channels);
+  int    *zerobundle=alloca(sizeof(*zerobundle)*vi->channels);
 
-  int   *nonzero  =alloca(sizeof(int)*vi->channels);
-  void **floormemo=alloca(sizeof(void *)*vi->channels);
+  int   *nonzero  =alloca(sizeof(*nonzero)*vi->channels);
+  void **floormemo=alloca(sizeof(*floormemo)*vi->channels);
   
   /* time domain information decode (note that applying the
      information would have to happen later; we'll probably add a
@@ -606,7 +607,7 @@
       nonzero[i]=1;
     else
       nonzero[i]=0;      
-    memset(vb->pcm[i],0,sizeof(float)*n/2);
+    memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2);
   }
 
   /* channel coupling can 'dirty' the nonzero listing */

1.26      +5 -5      vorbis/lib/mdct.c

Index: mdct.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mdct.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- mdct.c	2001/02/26 03:50:42	1.25
+++ mdct.c	2001/10/02 00:14:31	1.26
@@ -12,7 +12,7 @@
 
  function: normalized modified discrete cosine transform
            power of two length transform only [64 <= n ]
- last mod: $Id: mdct.c,v 1.25 2001/02/26 03:50:42 xiphmont Exp $
+ last mod: $Id: mdct.c,v 1.26 2001/10/02 00:14:31 segher Exp $
 
  Original algorithm adapted long ago from _The use of multirate filter
  banks for coding of high quality digital audio_, by T. Sporer,
@@ -49,8 +49,8 @@
    some window function algebra. */
 
 void mdct_init(mdct_lookup *lookup,int n){
-  int   *bitrev=_ogg_malloc(sizeof(int)*(n/4));
-  DATA_TYPE *T=_ogg_malloc(sizeof(DATA_TYPE)*(n+n/4));
+  int   *bitrev=_ogg_malloc(sizeof(*bitrev)*(n/4));
+  DATA_TYPE *T=_ogg_malloc(sizeof(*T)*(n+n/4));
   
   int i;
   int n2=n>>1;
@@ -344,7 +344,7 @@
   if(l){
     if(l->trig)_ogg_free(l->trig);
     if(l->bitrev)_ogg_free(l->bitrev);
-    memset(l,0,sizeof(mdct_lookup));
+    memset(l,0,sizeof(*l));
   }
 }
 
@@ -499,7 +499,7 @@
   int n2=n>>1;
   int n4=n>>2;
   int n8=n>>3;
-  DATA_TYPE *w=alloca(n*sizeof(DATA_TYPE)); /* forward needs working space */
+  DATA_TYPE *w=alloca(n*sizeof(*w)); /* forward needs working space */
   DATA_TYPE *w2=w+n2;
 
   /* rotate */

1.56      +70 -70    vorbis/lib/psy.c

Index: psy.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- psy.c	2001/09/11 05:06:57	1.55
+++ psy.c	2001/10/02 00:14:32	1.56
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.55 2001/09/11 05:06:57 xiphmont Exp $
+ last mod: $Id: psy.c,v 1.56 2001/10/02 00:14:32 segher Exp $
 
  ********************************************************************/
 
@@ -38,16 +38,16 @@
   int i,j;
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_psy_global *gi=ci->psy_g_param;
-  vorbis_look_psy_global *look=_ogg_calloc(1,sizeof(vorbis_look_psy_global));
+  vorbis_look_psy_global *look=_ogg_calloc(1,sizeof(*look));
 
   int shiftoc=rint(log(gi->eighth_octave_lines*8)/log(2))-1;
   look->decaylines=toOC(96000.f)*(1<<(shiftoc+1))+.5f; /* max sample
                                                           rate of
                                                           192000kHz
                                                           for now */
-  look->decay=_ogg_calloc(vi->channels,sizeof(float *));
+  look->decay=_ogg_calloc(vi->channels,sizeof(*look->decay));
   for(i=0;i<vi->channels;i++){
-    look->decay[i]=_ogg_calloc(look->decaylines,sizeof(float));
+    look->decay[i]=_ogg_calloc(look->decaylines,sizeof(*look->decay[i]));
     for(j=0;j<look->decaylines;j++)
       look->decay[i][j]=-9999.;
   }
@@ -65,20 +65,20 @@
       _ogg_free(look->decay[i]);
     _ogg_free(look->decay);
   }
-  memset(look,0,sizeof(vorbis_look_psy_global));
+  memset(look,0,sizeof(*look));
   _ogg_free(look);
 }
 
 void _vi_psy_free(vorbis_info_psy *i){
   if(i){
-    memset(i,0,sizeof(vorbis_info_psy));
+    memset(i,0,sizeof(*i));
     _ogg_free(i);
   }
 }
 
 vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i){
-  vorbis_info_psy *ret=_ogg_malloc(sizeof(vorbis_info_psy));
-  memcpy(ret,i,sizeof(vorbis_info_psy));
+  vorbis_info_psy *ret=_ogg_malloc(sizeof(*ret));
+  memcpy(ret,i,sizeof(*ret));
   return(ret);
 }
 
@@ -133,8 +133,8 @@
   float tempc[P_LEVELS][EHMER_MAX];
   float *ATH=ATH_Bark_dB_lspconservative; /* just for limiting here */
 
-  memcpy(c[0]+2,c[4]+2,sizeof(float)*EHMER_MAX);
-  memcpy(c[2]+2,c[4]+2,sizeof(float)*EHMER_MAX);
+  memcpy(c[0]+2,c[4]+2,sizeof(*c[0])*EHMER_MAX);
+  memcpy(c[2]+2,c[4]+2,sizeof(*c[2])*EHMER_MAX);
 
   /* we add back in the ATH to avoid low level curves falling off to
      -infinity and unnecessarily cutting off high level curves in the
@@ -177,7 +177,7 @@
   /* make temp curves with the ATH overlayed */
   for(i=0;i<P_LEVELS;i++){
     attenuate_curve(c[i]+2,curveatt_dB[i]);
-    memcpy(tempc[i],ath,EHMER_MAX*sizeof(float));
+    memcpy(tempc[i],ath,EHMER_MAX*sizeof(*tempc[i]));
     attenuate_curve(tempc[i],-i*10.f);
     max_curve(tempc[i],c[i]+2);
   }
@@ -216,7 +216,7 @@
                   vorbis_info_psy_global *gi,int n,long rate){
   long i,j,k,lo=-99,hi=0;
   long maxoc;
-  memset(p,0,sizeof(vorbis_look_psy));
+  memset(p,0,sizeof(*p));
 
 
   p->eighth_octave_lines=gi->eighth_octave_lines;
@@ -227,9 +227,9 @@
   p->total_octave_lines=maxoc-p->firstoc+1;
 
   if(vi->ath)
-    p->ath=_ogg_malloc(n*sizeof(float));
-  p->octave=_ogg_malloc(n*sizeof(long));
-  p->bark=_ogg_malloc(n*sizeof(unsigned long));
+    p->ath=_ogg_malloc(n*sizeof(*p->ath));
+  p->octave=_ogg_malloc(n*sizeof(*p->octave));
+  p->bark=_ogg_malloc(n*sizeof(*p->bark));
   p->vi=vi;
   p->n=n;
   p->rate=rate;
@@ -253,62 +253,62 @@
   for(i=0;i<n;i++)
     p->octave[i]=toOC((i*.5f+.25f)*rate/n)*(1<<(p->shiftoc+1))+.5f;
 
-  p->tonecurves=_ogg_malloc(P_BANDS*sizeof(float **));
-  p->noisethresh=_ogg_malloc(n*sizeof(float));
-  p->noiseoffset=_ogg_malloc(n*sizeof(float));
+  p->tonecurves=_ogg_malloc(P_BANDS*sizeof(*p->tonecurves));
+  p->noisethresh=_ogg_malloc(n*sizeof(*p->noisethresh));
+  p->noiseoffset=_ogg_malloc(n*sizeof(*p->noiseoffset));
   for(i=0;i<P_BANDS;i++)
-    p->tonecurves[i]=_ogg_malloc(P_LEVELS*sizeof(float *));
+    p->tonecurves[i]=_ogg_malloc(P_LEVELS*sizeof(*p->tonecurves[i]));
   
   for(i=0;i<P_BANDS;i++)
     for(j=0;j<P_LEVELS;j++)
-      p->tonecurves[i][j]=_ogg_malloc((EHMER_MAX+2)*sizeof(float));
+      p->tonecurves[i][j]=_ogg_malloc((EHMER_MAX+2)*sizeof(*p->tonecurves[i][j]));
   
 
   /* OK, yeah, this was a silly way to do it */
-  memcpy(p->tonecurves[0][4]+2,tone_125_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[0][6]+2,tone_125_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[0][8]+2,tone_125_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[0][10]+2,tone_125_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[2][4]+2,tone_125_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[2][6]+2,tone_125_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[2][8]+2,tone_125_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[2][10]+2,tone_125_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[4][4]+2,tone_250_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[4][6]+2,tone_250_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[4][8]+2,tone_250_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[4][10]+2,tone_250_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[6][4]+2,tone_500_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[6][6]+2,tone_500_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[6][8]+2,tone_500_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[6][10]+2,tone_500_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[8][4]+2,tone_1000_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[8][6]+2,tone_1000_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[8][8]+2,tone_1000_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[8][10]+2,tone_1000_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[10][4]+2,tone_2000_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[10][6]+2,tone_2000_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[10][8]+2,tone_2000_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[10][10]+2,tone_2000_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[12][4]+2,tone_4000_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[12][6]+2,tone_4000_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[12][8]+2,tone_4000_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[12][10]+2,tone_4000_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[14][4]+2,tone_8000_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[14][6]+2,tone_8000_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[14][8]+2,tone_8000_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[14][10]+2,tone_8000_100dB_SL,sizeof(float)*EHMER_MAX);
-
-  memcpy(p->tonecurves[16][4]+2,tone_8000_40dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[16][6]+2,tone_8000_60dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[16][8]+2,tone_8000_80dB_SL,sizeof(float)*EHMER_MAX);
-  memcpy(p->tonecurves[16][10]+2,tone_8000_100dB_SL,sizeof(float)*EHMER_MAX);
+  memcpy(p->tonecurves[0][4]+2,tone_125_40dB_SL,sizeof(*p->tonecurves[0][4])*EHMER_MAX);
+  memcpy(p->tonecurves[0][6]+2,tone_125_60dB_SL,sizeof(*p->tonecurves[0][6])*EHMER_MAX);
+  memcpy(p->tonecurves[0][8]+2,tone_125_80dB_SL,sizeof(*p->tonecurves[0][8])*EHMER_MAX);
+  memcpy(p->tonecurves[0][10]+2,tone_125_100dB_SL,sizeof(*p->tonecurves[0][10])*EHMER_MAX);
+
+  memcpy(p->tonecurves[2][4]+2,tone_125_40dB_SL,sizeof(*p->tonecurves[2][4])*EHMER_MAX);
+  memcpy(p->tonecurves[2][6]+2,tone_125_60dB_SL,sizeof(*p->tonecurves[2][6])*EHMER_MAX);
+  memcpy(p->tonecurves[2][8]+2,tone_125_80dB_SL,sizeof(*p->tonecurves[2][8])*EHMER_MAX);
+  memcpy(p->tonecurves[2][10]+2,tone_125_100dB_SL,sizeof(*p->tonecurves[2][10])*EHMER_MAX);
+
+  memcpy(p->tonecurves[4][4]+2,tone_250_40dB_SL,sizeof(*p->tonecurves[4][4])*EHMER_MAX);
+  memcpy(p->tonecurves[4][6]+2,tone_250_60dB_SL,sizeof(*p->tonecurves[4][6])*EHMER_MAX);
+  memcpy(p->tonecurves[4][8]+2,tone_250_80dB_SL,sizeof(*p->tonecurves[4][8])*EHMER_MAX);
+  memcpy(p->tonecurves[4][10]+2,tone_250_100dB_SL,sizeof(*p->tonecurves[4][10])*EHMER_MAX);
+
+  memcpy(p->tonecurves[6][4]+2,tone_500_40dB_SL,sizeof(*p->tonecurves[6][4])*EHMER_MAX);
+  memcpy(p->tonecurves[6][6]+2,tone_500_60dB_SL,sizeof(*p->tonecurves[6][6])*EHMER_MAX);
+  memcpy(p->tonecurves[6][8]+2,tone_500_80dB_SL,sizeof(*p->tonecurves[6][8])*EHMER_MAX);
+  memcpy(p->tonecurves[6][10]+2,tone_500_100dB_SL,sizeof(*p->tonecurves[6][10])*EHMER_MAX);
+
+  memcpy(p->tonecurves[8][4]+2,tone_1000_40dB_SL,sizeof(*p->tonecurves[8][4])*EHMER_MAX);
+  memcpy(p->tonecurves[8][6]+2,tone_1000_60dB_SL,sizeof(*p->tonecurves[8][6])*EHMER_MAX);
+  memcpy(p->tonecurves[8][8]+2,tone_1000_80dB_SL,sizeof(*p->tonecurves[8][8])*EHMER_MAX);
+  memcpy(p->tonecurves[8][10]+2,tone_1000_100dB_SL,sizeof(*p->tonecurves[8][10])*EHMER_MAX);
+
+  memcpy(p->tonecurves[10][4]+2,tone_2000_40dB_SL,sizeof(*p->tonecurves[10][4])*EHMER_MAX);
+  memcpy(p->tonecurves[10][6]+2,tone_2000_60dB_SL,sizeof(*p->tonecurves[10][6])*EHMER_MAX);
+  memcpy(p->tonecurves[10][8]+2,tone_2000_80dB_SL,sizeof(*p->tonecurves[10][8])*EHMER_MAX);
+  memcpy(p->tonecurves[10][10]+2,tone_2000_100dB_SL,sizeof(*p->tonecurves[10][10])*EHMER_MAX);
+
+  memcpy(p->tonecurves[12][4]+2,tone_4000_40dB_SL,sizeof(*p->tonecurves[12][4])*EHMER_MAX);
+  memcpy(p->tonecurves[12][6]+2,tone_4000_60dB_SL,sizeof(*p->tonecurves[12][6])*EHMER_MAX);
+  memcpy(p->tonecurves[12][8]+2,tone_4000_80dB_SL,sizeof(*p->tonecurves[12][8])*EHMER_MAX);
+  memcpy(p->tonecurves[12][10]+2,tone_4000_100dB_SL,sizeof(*p->tonecurves[12][10])*EHMER_MAX);
+
+  memcpy(p->tonecurves[14][4]+2,tone_8000_40dB_SL,sizeof(*p->tonecurves[14][4])*EHMER_MAX);
+  memcpy(p->tonecurves[14][6]+2,tone_8000_60dB_SL,sizeof(*p->tonecurves[14][6])*EHMER_MAX);
+  memcpy(p->tonecurves[14][8]+2,tone_8000_80dB_SL,sizeof(*p->tonecurves[14][8])*EHMER_MAX);
+  memcpy(p->tonecurves[14][10]+2,tone_8000_100dB_SL,sizeof(*p->tonecurves[14][10])*EHMER_MAX);
+
+  memcpy(p->tonecurves[16][4]+2,tone_8000_40dB_SL,sizeof(*p->tonecurves[16][4])*EHMER_MAX);
+  memcpy(p->tonecurves[16][6]+2,tone_8000_60dB_SL,sizeof(*p->tonecurves[16][6])*EHMER_MAX);
+  memcpy(p->tonecurves[16][8]+2,tone_8000_80dB_SL,sizeof(*p->tonecurves[16][8])*EHMER_MAX);
+  memcpy(p->tonecurves[16][10]+2,tone_8000_100dB_SL,sizeof(*p->tonecurves[16][10])*EHMER_MAX);
 
   /* value limit the tonal masking curves; the peakatt not only
      optionally specifies maximum dynamic depth, but also [always]
@@ -321,7 +321,7 @@
   /* interpolate curves between */
   for(i=1;i<P_BANDS;i+=2)
     for(j=4;j<P_LEVELS;j+=2){
-      memcpy(p->tonecurves[i][j]+2,p->tonecurves[i-1][j]+2,EHMER_MAX*sizeof(float));
+      memcpy(p->tonecurves[i][j]+2,p->tonecurves[i-1][j]+2,EHMER_MAX*sizeof(*p->tonecurves[i][j]));
       /*interp_curve(p->tonecurves[i][j],
                    p->tonecurves[i-1][j],
                    p->tonecurves[i+1][j],.5);*/
@@ -432,7 +432,7 @@
     }
     _ogg_free(p->noiseoffset);
     _ogg_free(p->noisethresh);
-    memset(p,0,sizeof(vorbis_look_psy));
+    memset(p,0,sizeof(*p));
   }
 }
 
@@ -500,8 +500,8 @@
 }
 
 static void seed_chase(float *seeds, int linesper, long n){
-  long  *posstack=alloca(n*sizeof(long));
-  float *ampstack=alloca(n*sizeof(float));
+  long  *posstack=alloca(n*sizeof(*posstack));
+  float *ampstack=alloca(n*sizeof(*ampstack));
   long   stack=0;
   long   pos=0;
   long   i;
@@ -724,12 +724,12 @@
   int i,n=p->n;
   static int seq=0;
 
-  float *seed=alloca(sizeof(float)*p->total_octave_lines);
+  float *seed=alloca(sizeof(*seed)*p->total_octave_lines);
   for(i=0;i<p->total_octave_lines;i++)seed[i]=NEGINF;
 
   /* noise masking */
   if(p->vi->noisemaskp){
-    float *work=alloca(n*sizeof(float));
+    float *work=alloca(n*sizeof(*work));
 
     bark_noise_hybridmp(n,p->bark,logmdct,logmask,
                         140.,-1);

1.37      +26 -25    vorbis/lib/res0.c

Index: res0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/res0.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- res0.c	2001/09/01 06:14:50	1.36
+++ res0.c	2001/10/02 00:14:32	1.37
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: residue backend 0, 1 and 2 implementation
- last mod: $Id: res0.c,v 1.36 2001/09/01 06:14:50 xiphmont Exp $
+ last mod: $Id: res0.c,v 1.37 2001/10/02 00:14:32 segher Exp $
 
  ********************************************************************/
 
@@ -53,15 +53,16 @@
 
 vorbis_info_residue *res0_copy_info(vorbis_info_residue *vr){
   vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
-  vorbis_info_residue0 *ret=_ogg_malloc(sizeof(vorbis_info_residue0));
-  memcpy(ret,info,sizeof(vorbis_info_residue0));
+  vorbis_info_residue0 *ret=_ogg_malloc(sizeof(*ret));
+  memcpy(ret,info,sizeof(*ret));
   return(ret);
 }
 
 void res0_free_info(vorbis_info_residue *i){
-  if(i){
-    memset(i,0,sizeof(vorbis_info_residue0));
-    _ogg_free(i);
+  vorbis_info_residue0 *info=(vorbis_info_residue0 *)i;
+  if(info){
+    memset(info,0,sizeof(*info));
+    _ogg_free(info);
   }
 }
 
@@ -104,8 +105,8 @@
     for(j=0;j<look->partvals;j++)
       _ogg_free(look->decodemap[j]);
     _ogg_free(look->decodemap);
-    memset(i,0,sizeof(vorbis_look_residue0));
-    _ogg_free(i);
+    memset(look,0,sizeof(*look));
+    _ogg_free(look);
   }
 }
 
@@ -160,7 +161,7 @@
 /* vorbis_info is for range checking */
 vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
   int j,acc=0;
-  vorbis_info_residue0 *info=_ogg_calloc(1,sizeof(vorbis_info_residue0));
+  vorbis_info_residue0 *info=_ogg_calloc(1,sizeof(*info));
   codec_setup_info     *ci=vi->codec_setup;
 
   info->begin=oggpack_read(opb,24);
@@ -193,7 +194,7 @@
 vorbis_look_residue *res0_look (vorbis_dsp_state *vd,vorbis_info_mode *vm,
                           vorbis_info_residue *vr){
   vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
-  vorbis_look_residue0 *look=_ogg_calloc(1,sizeof(vorbis_look_residue0));
+  vorbis_look_residue0 *look=_ogg_calloc(1,sizeof(*look));
   backend_lookup_state *be=vd->backend_state;
 
   int j,k,acc=0;
@@ -207,13 +208,13 @@
   look->phrasebook=be->fullbooks+info->groupbook;
   dim=look->phrasebook->dim;
 
-  look->partbooks=_ogg_calloc(look->parts,sizeof(codebook **));
+  look->partbooks=_ogg_calloc(look->parts,sizeof(*look->partbooks));
 
   for(j=0;j<look->parts;j++){
     int stages=ilog(info->secondstages[j]);
     if(stages){
       if(stages>maxstage)maxstage=stages;
-      look->partbooks[j]=_ogg_calloc(stages,sizeof(codebook *));
+      look->partbooks[j]=_ogg_calloc(stages,sizeof(*look->partbooks[j]));
       for(k=0;k<stages;k++)
         if(info->secondstages[j]&(1<<k))
           look->partbooks[j][k]=be->fullbooks+info->booklist[acc++];
@@ -222,11 +223,11 @@
 
   look->partvals=rint(pow(look->parts,dim));
   look->stages=maxstage;
-  look->decodemap=_ogg_malloc(look->partvals*sizeof(int *));
+  look->decodemap=_ogg_malloc(look->partvals*sizeof(*look->decodemap));
   for(j=0;j<look->partvals;j++){
     long val=j;
     long mult=look->partvals/look->parts;
-    look->decodemap[j]=_ogg_malloc(dim*sizeof(int));
+    look->decodemap[j]=_ogg_malloc(dim*sizeof(*look->decodemap[j]));
     for(k=0;k<dim;k++){
       long deco=val/mult;
       val-=deco*mult;
@@ -380,15 +381,15 @@
   int n=info->end-info->begin;
 
   int partvals=n/samples_per_partition;
-  long **partword=_vorbis_block_alloc(vb,ch*sizeof(long *));
+  long **partword=_vorbis_block_alloc(vb,ch*sizeof(*partword));
 
   /* we find the partition type for each partition of each
      channel.  We'll go back and do the interleaved encoding in a
      bit.  For now, clarity */
  
   for(i=0;i<ch;i++){
-    partword[i]=_vorbis_block_alloc(vb,n/samples_per_partition*sizeof(long));
-    memset(partword[i],0,n/samples_per_partition*sizeof(long));
+    partword[i]=_vorbis_block_alloc(vb,n/samples_per_partition*sizeof(*partword[i]));
+    memset(partword[i],0,n/samples_per_partition*sizeof(*partword[i]));
   }
 
   for(i=0;i<partvals;i++){
@@ -435,11 +436,11 @@
   int n=info->end-info->begin;
 
   int partvals=n/samples_per_partition;
-  long **partword=_vorbis_block_alloc(vb,sizeof(long *));
-  float *work=alloca(sizeof(float)*samples_per_partition);
+  long **partword=_vorbis_block_alloc(vb,sizeof(*partword));
+  float *work=alloca(sizeof(*work)*samples_per_partition);
   
-  partword[0]=_vorbis_block_alloc(vb,n*ch/samples_per_partition*sizeof(long));
-  memset(partword[0],0,n*ch/samples_per_partition*sizeof(long));
+  partword[0]=_vorbis_block_alloc(vb,n*ch/samples_per_partition*sizeof(*partword[0]));
+  memset(partword[0],0,n*ch/samples_per_partition*sizeof(*partword[0]));
 
   for(i=0,j=0,k=0,l=info->begin;i<partvals;i++){
     for(k=0;k<samples_per_partition;k++){
@@ -591,10 +592,10 @@
   
   int partvals=n/samples_per_partition;
   int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
-  int ***partword=alloca(ch*sizeof(int **));
+  int ***partword=alloca(ch*sizeof(*partword));
 
   for(j=0;j<ch;j++)
-    partword[j]=_vorbis_block_alloc(vb,partwords*sizeof(int *));
+    partword[j]=_vorbis_block_alloc(vb,partwords*sizeof(*partword[j]));
 
   for(s=0;s<look->stages;s++){
 
@@ -757,7 +758,7 @@
   /* don't duplicate the code; use a working vector hack for now and
      reshape ourselves into a single channel res1 */
   /* ugly; reallocs for each coupling pass :-( */
-  float *work=_vorbis_block_alloc(vb,ch*n*sizeof(float));
+  float *work=_vorbis_block_alloc(vb,ch*n*sizeof(*work));
   for(i=0;i<ch;i++){
     float *pcm=in[i];
     if(nonzero[i])used++;
@@ -794,7 +795,7 @@
 
   int partvals=n/samples_per_partition;
   int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
-  int **partword=_vorbis_block_alloc(vb,partwords*sizeof(int *));
+  int **partword=_vorbis_block_alloc(vb,partwords*sizeof(*partword));
 
   for(i=0;i<ch;i++)if(nonzero[i])break;
   if(i==ch)return(0); /* no nonzero vectors */

1.18      +15 -15    vorbis/lib/sharedbook.c

Index: sharedbook.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/sharedbook.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- sharedbook.c	2001/08/13 01:36:57	1.17
+++ sharedbook.c	2001/10/02 00:14:32	1.18
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: basic shared codebook operations
- last mod: $Id: sharedbook.c,v 1.17 2001/08/13 01:36:57 xiphmont Exp $
+ last mod: $Id: sharedbook.c,v 1.18 2001/10/02 00:14:32 segher Exp $
 
  ********************************************************************/
 
@@ -72,7 +72,7 @@
 long *_make_words(long *l,long n){
   long i,j;
   long marker[33];
-  long *r=_ogg_malloc(n*sizeof(long));
+  long *r=_ogg_malloc(n*sizeof(*r));
   memset(marker,0,sizeof(marker));
 
   for(i=0;i<n;i++){
@@ -141,9 +141,9 @@
 decode_aux *_make_decode_tree(codebook *c){
   const static_codebook *s=c->c;
   long top=0,i,j,n;
-  decode_aux *t=_ogg_malloc(sizeof(decode_aux));
-  long *ptr0=t->ptr0=_ogg_calloc(c->entries*2,sizeof(long));
-  long *ptr1=t->ptr1=_ogg_calloc(c->entries*2,sizeof(long));
+  decode_aux *t=_ogg_malloc(sizeof(*t));
+  long *ptr0=t->ptr0=_ogg_calloc(c->entries*2,sizeof(*ptr0));
+  long *ptr1=t->ptr1=_ogg_calloc(c->entries*2,sizeof(*ptr1));
   long *codelist=_make_words(s->lengthlist,s->entries);
 
   if(codelist==NULL)return(NULL);
@@ -175,8 +175,8 @@
   t->tabn = _ilog(c->entries)-4; /* this is magic */
   if(t->tabn<5)t->tabn=5;
   n = 1<<t->tabn;
-  t->tab = _ogg_malloc(n*sizeof(long));
-  t->tabl = _ogg_malloc(n*sizeof(int));
+  t->tab = _ogg_malloc(n*sizeof(*t->tab));
+  t->tabl = _ogg_malloc(n*sizeof(*t->tabl));
   for (i = 0; i < n; i++) {
     long p = 0;
     for (j = 0; j < t->tabn && (p > 0 || j == 0); j++) {
@@ -235,7 +235,7 @@
     int quantvals;
     float mindel=_float32_unpack(b->q_min);
     float delta=_float32_unpack(b->q_delta);
-    float *r=_ogg_calloc(b->entries*b->dim,sizeof(float));
+    float *r=_ogg_calloc(b->entries*b->dim,sizeof(*r));
 
     /* maptype 1 and 2 both use a quantized value vector, but
        different sizes */
@@ -289,17 +289,17 @@
       _ogg_free(b->nearest_tree->ptr1);
       _ogg_free(b->nearest_tree->p);
       _ogg_free(b->nearest_tree->q);
-      memset(b->nearest_tree,0,sizeof(encode_aux_nearestmatch));
+      memset(b->nearest_tree,0,sizeof(*b->nearest_tree));
       _ogg_free(b->nearest_tree);
     }
     if(b->thresh_tree){
       _ogg_free(b->thresh_tree->quantthresh);
       _ogg_free(b->thresh_tree->quantmap);
-      memset(b->thresh_tree,0,sizeof(encode_aux_threshmatch));
+      memset(b->thresh_tree,0,sizeof(*b->thresh_tree));
       _ogg_free(b->thresh_tree);
     }
 
-    memset(b,0,sizeof(static_codebook));
+    memset(b,0,sizeof(*b));
   }
 }
 
@@ -319,17 +319,17 @@
 
     _ogg_free(b->decode_tree->ptr0);
     _ogg_free(b->decode_tree->ptr1);
-    memset(b->decode_tree,0,sizeof(decode_aux));
+    memset(b->decode_tree,0,sizeof(*b->decode_tree));
     _ogg_free(b->decode_tree);
   }
   if(b->valuelist)_ogg_free(b->valuelist);
   if(b->codelist)_ogg_free(b->codelist);
-  memset(b,0,sizeof(codebook));
+  memset(b,0,sizeof(*b));
 }
 
 int vorbis_book_init_encode(codebook *c,const static_codebook *s){
   long j,k;
-  memset(c,0,sizeof(codebook));
+  memset(c,0,sizeof(*c));
   c->c=s;
   c->entries=s->entries;
   c->dim=s->dim;
@@ -356,7 +356,7 @@
 }
 
 int vorbis_book_init_decode(codebook *c,const static_codebook *s){
-  memset(c,0,sizeof(codebook));
+  memset(c,0,sizeof(*c));
   c->c=s;
   c->entries=s->entries;
   c->dim=s->dim;

1.15      +4 -4      vorbis/lib/smallft.c

Index: smallft.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/smallft.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- smallft.c	2001/02/26 03:50:43	1.14
+++ smallft.c	2001/10/02 00:14:32	1.15
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: *unnormalized* fft transform
- last mod: $Id: smallft.c,v 1.14 2001/02/26 03:50:43 xiphmont Exp $
+ last mod: $Id: smallft.c,v 1.15 2001/10/02 00:14:32 segher Exp $
 
 ********************************************************************/
 
@@ -1240,8 +1240,8 @@
 
 void drft_init(drft_lookup *l,int n){
   l->n=n;
-  l->trigcache=_ogg_calloc(3*n,sizeof(float));
-  l->splitcache=_ogg_calloc(32,sizeof(int));
+  l->trigcache=_ogg_calloc(3*n,sizeof(*l->trigcache));
+  l->splitcache=_ogg_calloc(32,sizeof(*l->splitcache));
   fdrffti(n, l->trigcache, l->splitcache);
 }
 
@@ -1249,6 +1249,6 @@
   if(l){
     if(l->trigcache)_ogg_free(l->trigcache);
     if(l->splitcache)_ogg_free(l->splitcache);
-    memset(l,0,sizeof(drft_lookup));
+    memset(l,0,sizeof(*l));
   }
 }

1.24      +3 -3      vorbis/lib/synthesis.c

Index: synthesis.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/synthesis.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- synthesis.c	2001/08/13 01:36:57	1.23
+++ synthesis.c	2001/10/02 00:14:32	1.24
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: single-block PCM synthesis
- last mod: $Id: synthesis.c,v 1.23 2001/08/13 01:36:57 xiphmont Exp $
+ last mod: $Id: synthesis.c,v 1.24 2001/10/02 00:14:32 segher Exp $
 
  ********************************************************************/
 
@@ -63,9 +63,9 @@
 
   /* alloc pcm passback storage */
   vb->pcmend=ci->blocksizes[vb->W];
-  vb->pcm=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels);
+  vb->pcm=_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
   for(i=0;i<vi->channels;i++)
-    vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(float));
+    vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
 
   /* unpack_header enforces range checking */
   type=ci->map_type[ci->mode_param[mode]->mapping];

1.6       +2 -2      vorbis/lib/tone.c

Index: tone.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/tone.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- tone.c	2000/12/21 21:04:41	1.5
+++ tone.c	2001/10/02 00:14:32	1.6
@@ -15,8 +15,8 @@
   
   if(argc<2)usage();
 
-  f=alloca(sizeof(float)*(argc-1));
-  amp=alloca(sizeof(float)*(argc-1));
+  f=alloca(sizeof(*f)*(argc-1));
+  amp=alloca(sizeof(*amp)*(argc-1));
 
   i=0;
   while(argv[i+1]){

1.17      +3 -3      vorbis/lib/vorbisenc.c

Index: vorbisenc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisenc.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- vorbisenc.c	2001/09/13 21:38:45	1.16
+++ vorbisenc.c	2001/10/02 00:14:32	1.17
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: simple programmatic interface for encoder mode setup
- last mod: $Id: vorbisenc.c,v 1.16 2001/09/13 21:38:45 cwolf Exp $
+ last mod: $Id: vorbisenc.c,v 1.17 2001/10/02 00:14:32 segher Exp $
 
  ********************************************************************/
 
@@ -58,7 +58,7 @@
   ; /* some error handling for memory exhaustion */
 #endif
 
-  memcpy(ci,cs,sizeof(codec_setup_info)); /* to get the flat numbers */
+  memcpy(ci,cs,sizeof(*ci)); /* to get the flat numbers */
 
   /* codebooks */
   for(i=0;i<ci->books;i++){
@@ -91,7 +91,7 @@
   
   /* mode settings */
   for(i=0;i<ci->modes;i++){
-    ci->mode_param[i]=_ogg_calloc(1,sizeof(vorbis_info_mode));
+    ci->mode_param[i]=_ogg_calloc(1,sizeof(*ci->mode_param[i]));
     ci->mode_param[i]->blockflag=cs->mode_param[i]->blockflag;
     ci->mode_param[i]->windowtype=cs->mode_param[i]->windowtype;
     ci->mode_param[i]->transformtype=cs->mode_param[i]->transformtype;

1.50      +11 -11    vorbis/lib/vorbisfile.c

Index: vorbisfile.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisfile.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- vorbisfile.c	2001/09/13 02:17:51	1.49
+++ vorbisfile.c	2001/10/02 00:14:32	1.50
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.c,v 1.49 2001/09/13 02:17:51 xiphmont Exp $
+ last mod: $Id: vorbisfile.c,v 1.50 2001/10/02 00:14:32 segher Exp $
 
  ********************************************************************/
 
@@ -207,7 +207,7 @@
   
   if(searched>=end || ret<0){
     vf->links=m+1;
-    vf->offsets=_ogg_malloc((m+2)*sizeof(ogg_int64_t));
+    vf->offsets=_ogg_malloc((m+2)*sizeof(*vf->offsets));
     vf->offsets[m+1]=searched;
   }else{
     ret=_bisect_forward_serialno(vf,next,vf->offset,
@@ -289,11 +289,11 @@
   ogg_page og;
   int i,ret;
   
-  vf->vi=_ogg_realloc(vf->vi,vf->links*sizeof(vorbis_info));
-  vf->vc=_ogg_realloc(vf->vc,vf->links*sizeof(vorbis_info));
-  vf->dataoffsets=_ogg_malloc(vf->links*sizeof(ogg_int64_t));
-  vf->pcmlengths=_ogg_malloc(vf->links*sizeof(ogg_int64_t));
-  vf->serialnos=_ogg_malloc(vf->links*sizeof(long));
+  vf->vi=_ogg_realloc(vf->vi,vf->links*sizeof(*vf->vi));
+  vf->vc=_ogg_realloc(vf->vc,vf->links*sizeof(*vf->vc));
+  vf->dataoffsets=_ogg_malloc(vf->links*sizeof(*vf->dataoffsets));
+  vf->pcmlengths=_ogg_malloc(vf->links*sizeof(*vf->pcmlengths));
+  vf->serialnos=_ogg_malloc(vf->links*sizeof(*vf->serialnos));
   
   for(i=0;i<vf->links;i++){
     if(i==0){
@@ -562,7 +562,7 @@
   long offset=(f?callbacks.seek_func(f,0,SEEK_CUR):-1);
   int ret;
 
-  memset(vf,0,sizeof(OggVorbis_File));
+  memset(vf,0,sizeof(*vf));
   vf->datasource=f;
   vf->callbacks = callbacks;
 
@@ -585,8 +585,8 @@
   /* No seeking yet; Set up a 'single' (current) logical bitstream
      entry for partial open */
   vf->links=1;
-  vf->vi=_ogg_calloc(vf->links,sizeof(vorbis_info));
-  vf->vc=_ogg_calloc(vf->links,sizeof(vorbis_info));
+  vf->vi=_ogg_calloc(vf->links,sizeof(*vf->vi));
+  vf->vc=_ogg_calloc(vf->links,sizeof(*vf->vc));
   
   /* Try to fetch the headers, maintaining all the storage */
   if((ret=_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,NULL))<0){
@@ -634,7 +634,7 @@
     if(vf->offsets)_ogg_free(vf->offsets);
     ogg_sync_clear(&vf->oy);
     if(vf->datasource)(vf->callbacks.close_func)(vf->datasource);
-    memset(vf,0,sizeof(OggVorbis_File));
+    memset(vf,0,sizeof(*vf));
   }
 #ifdef DEBUG_LEAKS
   _VDBG_dump();

1.14      +2 -2      vorbis/lib/window.c

Index: window.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/window.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- window.c	2001/02/26 03:50:43	1.13
+++ window.c	2001/10/02 00:14:33	1.14
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: window functions
- last mod: $Id: window.c,v 1.13 2001/02/26 03:50:43 xiphmont Exp $
+ last mod: $Id: window.c,v 1.14 2001/10/02 00:14:33 segher Exp $
 
  ********************************************************************/
 
@@ -21,7 +21,7 @@
 #include "misc.h"
 
 float *_vorbis_window(int type, int window,int left,int right){
-  float *ret=_ogg_calloc(window,sizeof(float));
+  float *ret=_ogg_calloc(window,sizeof(*ret));
 
   switch(type){
   case 0:

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list