code analysis and fixes for teletone.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7614 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
1cabc4a704
commit
20ab270879
|
@ -50,6 +50,7 @@
|
||||||
WarningLevel="4"
|
WarningLevel="4"
|
||||||
WarnAsError="true"
|
WarnAsError="true"
|
||||||
DebugInformationFormat="4"
|
DebugInformationFormat="4"
|
||||||
|
EnablePREfast="true"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
@ -123,6 +124,7 @@
|
||||||
WarningLevel="4"
|
WarningLevel="4"
|
||||||
WarnAsError="true"
|
WarnAsError="true"
|
||||||
DebugInformationFormat="3"
|
DebugInformationFormat="3"
|
||||||
|
EnablePREfast="true"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
|
|
@ -104,6 +104,12 @@ typedef struct {
|
||||||
typedef __int16 int16_t;
|
typedef __int16 int16_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (_MSC_VER >= 1400) // VC8+
|
||||||
|
#define teletone_assert(expr) assert(expr);__analysis_assume( expr )
|
||||||
|
#else
|
||||||
|
#define teletone_assert(expr) assert(expr)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <libteletone_generate.h>
|
#include <libteletone_generate.h>
|
||||||
#include <libteletone_detect.h>
|
#include <libteletone_detect.h>
|
||||||
|
|
||||||
|
|
|
@ -432,6 +432,8 @@ int teletone_dtmf_get (teletone_dtmf_detect_state_t *dtmf_detect_state,
|
||||||
char *buf,
|
char *buf,
|
||||||
int max)
|
int max)
|
||||||
{
|
{
|
||||||
|
teletone_assert(dtmf_detect_state->current_digits <= TELETONE_MAX_DTMF_DIGITS);
|
||||||
|
|
||||||
if (max > dtmf_detect_state->current_digits) {
|
if (max > dtmf_detect_state->current_digits) {
|
||||||
max = dtmf_detect_state->current_digits;
|
max = dtmf_detect_state->current_digits;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,10 +191,13 @@ static int ensure_buffer(teletone_generation_session_t *ts, int need)
|
||||||
need *= ts->channels;
|
need *= ts->channels;
|
||||||
|
|
||||||
if (need > ts->datalen) {
|
if (need > ts->datalen) {
|
||||||
|
teletone_audio_t *tmp;
|
||||||
ts->datalen = need + ts->dynamic;
|
ts->datalen = need + ts->dynamic;
|
||||||
if (!(ts->buffer = realloc(ts->buffer, ts->datalen))) {
|
tmp = realloc(ts->buffer, ts->datalen);
|
||||||
|
if (!tmp) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
ts->buffer = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue