In article <[EMAIL PROTECTED]>,
 <[email protected]> wrote:
> Author: russell
> Date: Fri May 19 20:28:14 2006
> New Revision: 28934
> 
> URL: http://svn.digium.com/view/asterisk?rev=28934&view=rev
> Log:
> fix up another place where the code made assumptions about how space for
> variables would be allocatted on the stack
> 
> Modified:
>     trunk/apps/app_sms.c
> 
> Modified: trunk/apps/app_sms.c
> URL: 
> http://svn.digium.com/view/asterisk/trunk/apps/app_sms.c?rev=28934&r1=28933&r2=28934&view=diff
> ==============================================================================
> --- trunk/apps/app_sms.c (original)
> +++ trunk/apps/app_sms.c Fri May 19 20:28:14 2006
> @@ -1176,14 +1176,13 @@
>  static int sms_generate (struct ast_channel *chan, void *data, int len, int 
> samples)
>  {
>       struct ast_frame f = { 0 };
> -     unsigned char waste[AST_FRIENDLY_OFFSET];
>  #define MAXSAMPLES (800)
>  #ifdef OUTALAW
> -     unsigned char buf[MAXSAMPLES];
> +     unsigned char *buf;
>  #else
> -     signed short buf[MAXSAMPLES];
> +     short *buf;
>  #endif

Another way to fix this would be to put them into a struct:

struct {
  unsigned char waste[AST_FRIENDLY_OFFSET];
  unsigned char buf[MAXSAMPLES];
} t;

Then waste becomes t.waste and buf becomes t.buf. The rest of the code
then stays unchanged, in particular not having to add or subtract
AST_FRIENDLY_OFFSET in various places.

Cheers
Tony
-- 
Tony Mountifield
Work: [EMAIL PROTECTED] - http://www.softins.co.uk
Play: [EMAIL PROTECTED] - http://tony.mountifield.org
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to