[Freeswitch-svn] [commit] r7614 - in freeswitch/trunk/libs/libteletone: . src

Freeswitch SVN mikej at freeswitch.org
Thu Feb 14 13:13:50 EST 2008


Author: mikej
Date: Thu Feb 14 13:13:50 2008
New Revision: 7614

Modified:
   freeswitch/trunk/libs/libteletone/libteletone.2008.vcproj
   freeswitch/trunk/libs/libteletone/src/libteletone.h
   freeswitch/trunk/libs/libteletone/src/libteletone_detect.c
   freeswitch/trunk/libs/libteletone/src/libteletone_generate.c

Log:
code analysis and fixes for teletone.

Modified: freeswitch/trunk/libs/libteletone/libteletone.2008.vcproj
==============================================================================
--- freeswitch/trunk/libs/libteletone/libteletone.2008.vcproj	(original)
+++ freeswitch/trunk/libs/libteletone/libteletone.2008.vcproj	Thu Feb 14 13:13:50 2008
@@ -50,6 +50,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				DebugInformationFormat="4"
+				EnablePREfast="true"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -123,6 +124,7 @@
 				WarningLevel="4"
 				WarnAsError="true"
 				DebugInformationFormat="3"
+				EnablePREfast="true"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"

Modified: freeswitch/trunk/libs/libteletone/src/libteletone.h
==============================================================================
--- freeswitch/trunk/libs/libteletone/src/libteletone.h	(original)
+++ freeswitch/trunk/libs/libteletone/src/libteletone.h	Thu Feb 14 13:13:50 2008
@@ -104,6 +104,12 @@
 typedef __int16 int16_t;
 #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_detect.h>
 

Modified: freeswitch/trunk/libs/libteletone/src/libteletone_detect.c
==============================================================================
--- freeswitch/trunk/libs/libteletone/src/libteletone_detect.c	(original)
+++ freeswitch/trunk/libs/libteletone/src/libteletone_detect.c	Thu Feb 14 13:13:50 2008
@@ -432,6 +432,8 @@
 					   char *buf,
 					   int max)
 {
+	teletone_assert(dtmf_detect_state->current_digits <= TELETONE_MAX_DTMF_DIGITS);
+
 	if (max > dtmf_detect_state->current_digits) {
 		max = dtmf_detect_state->current_digits;
 	}

Modified: freeswitch/trunk/libs/libteletone/src/libteletone_generate.c
==============================================================================
--- freeswitch/trunk/libs/libteletone/src/libteletone_generate.c	(original)
+++ freeswitch/trunk/libs/libteletone/src/libteletone_generate.c	Thu Feb 14 13:13:50 2008
@@ -191,10 +191,13 @@
 	need *= ts->channels;
 
 	if (need > ts->datalen) {
+		teletone_audio_t *tmp;
 		ts->datalen = need + ts->dynamic;
-		if (!(ts->buffer = realloc(ts->buffer, ts->datalen))) {
+		tmp = realloc(ts->buffer, ts->datalen);
+		if (!tmp) {
 			return -1;
 		}
+		ts->buffer = tmp;
 	}
 
 	return 0;



More information about the Freeswitch-svn mailing list