Fix crash in seeking_example.
authorTimothy B. Terriberry <tterribe@xiph.org>
Fri, 21 Sep 2012 02:12:46 +0000 (19:12 -0700)
committerTimothy B. Terriberry <tterribe@xiph.org>
Fri, 21 Sep 2012 02:12:46 +0000 (19:12 -0700)
When a match fails, the index of the position in the link needs to
 be 64 bits.

examples/seeking_example.c

index 1a9ad52..97b92d8 100644 (file)
@@ -164,15 +164,15 @@ static void verify_seek(OggOpusFile *_of,opus_int64 _byte_offset,
   if(_bigassbuffer!=NULL){
     for(i=0;i<nsamples*nchannels;i++){
       if(!MATCH(buffer[i],_bigassbuffer[pcm_offset*nchannels+i])){
+        ogg_int64_t j;
         fprintf(stderr,"\nData after seek doesn't match declared PCM "
          "position: mismatch %G\n",
          (double)buffer[i]-_bigassbuffer[pcm_offset*nchannels+i]);
-        for(i=0;i<duration-nsamples;i++){
-          int j;
-          for(j=0;j<nsamples*nchannels;j++){
-            if(!MATCH(buffer[j],_bigassbuffer[i*nchannels+j]))break;
+        for(j=0;j<duration-nsamples;j++){
+          for(i=0;i<nsamples*nchannels;i++){
+            if(!MATCH(buffer[i],_bigassbuffer[j*nchannels+i]))break;
           }
-          if(j==nsamples*nchannels){
+          if(i==nsamples*nchannels){
             fprintf(stderr,"\nData after seek appears to match position %li.\n",
              (long)i);
           }