discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] `s < d_bufsize' failed.


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] `s < d_bufsize' failed.
Date: Mon, 1 May 2006 15:05:09 -0700
User-agent: Mutt/1.5.9i

On Mon, May 01, 2006 at 06:02:29PM -0400, Chuck Swiger wrote:
> On Mon, 2006-05-01 at 10:38 -0700, Eric Blossom wrote:
> > On Mon, May 01, 2006 at 12:08:57PM -0400, Chuck Swiger wrote:
> > > Any general clues what would be causing: 
> > > 
> > > python: ./gr_buffer.h:96: unsigned int gr_buffer::index_add(unsigned
> > > int, unsigned int): Assertion `s < d_bufsize' failed.
> > 
> > You're probably returning a value from work/general_work that's 
> > greater than nouput_items.  Add an assert to you code.
> > 
> 
> Look like the old code has a flaw:
> 
>   for (int k = 0; k < noutput_items; k++){
>     ...
>     out_sample[k] = interp_sample;
>     ...
>   }
> 
>   return k;

Agreed


> but modern compilers deallocate the index when the loop
> is completed (one web page says), so the fix is to use:
> 
> 
>   for (int k = 0; k < noutput_items; k++){
>     ...
>     out_sample[k] = interp_sample;
>     ...
>   }
> 
>   return noutput_items;

As long as there's no early exit from the loop ;)

Otherwise:

  int k = 0;
  for (k = 0; k < noutput_items; k++){
    ...
    out_sample[k] = interp_sample;
    ...
  }

  return k;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]