mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-08 19:08:14 +00:00
fix up another place where the code made assumptions about how space for
variables would be allocatted on the stack git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@28934 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1176,14 +1176,13 @@ static void sms_messagetx(sms_t * h)
|
|||||||
static int sms_generate (struct ast_channel *chan, void *data, int len, int samples)
|
static int sms_generate (struct ast_channel *chan, void *data, int len, int samples)
|
||||||
{
|
{
|
||||||
struct ast_frame f = { 0 };
|
struct ast_frame f = { 0 };
|
||||||
unsigned char waste[AST_FRIENDLY_OFFSET];
|
|
||||||
#define MAXSAMPLES (800)
|
#define MAXSAMPLES (800)
|
||||||
#ifdef OUTALAW
|
#ifdef OUTALAW
|
||||||
unsigned char buf[MAXSAMPLES];
|
unsigned char *buf;
|
||||||
#else
|
#else
|
||||||
signed short buf[MAXSAMPLES];
|
short *buf;
|
||||||
#endif
|
#endif
|
||||||
#define SAMPLE2LEN (sizeof (buf[0]))
|
#define SAMPLE2LEN sizeof(*buf)
|
||||||
sms_t *h = data;
|
sms_t *h = data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -1192,9 +1191,9 @@ static int sms_generate (struct ast_channel *chan, void *data, int len, int samp
|
|||||||
MAXSAMPLES, samples);
|
MAXSAMPLES, samples);
|
||||||
samples = MAXSAMPLES;
|
samples = MAXSAMPLES;
|
||||||
}
|
}
|
||||||
len = samples * SAMPLE2LEN;
|
len = samples * SAMPLE2LEN + AST_FRIENDLY_OFFSET;
|
||||||
|
buf = alloca(len);
|
||||||
|
|
||||||
waste[0] = 0; /* make compiler happy */
|
|
||||||
f.frametype = AST_FRAME_VOICE;
|
f.frametype = AST_FRAME_VOICE;
|
||||||
#ifdef OUTALAW
|
#ifdef OUTALAW
|
||||||
f.subclass = AST_FORMAT_ALAW;
|
f.subclass = AST_FORMAT_ALAW;
|
||||||
@@ -1204,7 +1203,7 @@ static int sms_generate (struct ast_channel *chan, void *data, int len, int samp
|
|||||||
f.datalen = len;
|
f.datalen = len;
|
||||||
f.offset = AST_FRIENDLY_OFFSET;
|
f.offset = AST_FRIENDLY_OFFSET;
|
||||||
f.mallocd = 0;
|
f.mallocd = 0;
|
||||||
f.data = buf;
|
f.data = buf + AST_FRIENDLY_OFFSET;
|
||||||
f.samples = samples;
|
f.samples = samples;
|
||||||
f.src = "app_sms";
|
f.src = "app_sms";
|
||||||
/* create a buffer containing the digital sms pattern */
|
/* create a buffer containing the digital sms pattern */
|
||||||
|
|||||||
Reference in New Issue
Block a user