[Freeswitch-svn] [commit] r13366 - in freeswitch/trunk: src src/include w32/Library

FreeSWITCH SVN mikej at freeswitch.org
Fri May 15 14:07:18 PDT 2009


Author: mikej
Date: Fri May 15 16:07:18 2009
New Revision: 13366

Log:
cleanup msvc code analysis warnings

Modified:
   freeswitch/trunk/src/include/switch_xml.h
   freeswitch/trunk/src/switch_utils.c
   freeswitch/trunk/src/switch_xml.c
   freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj

Modified: freeswitch/trunk/src/include/switch_xml.h
==============================================================================
--- freeswitch/trunk/src/include/switch_xml.h	(original)
+++ freeswitch/trunk/src/include/switch_xml.h	Fri May 15 16:07:18 2009
@@ -240,7 +240,7 @@
 
 ///\brief returns a new empty switch_xml structure with the given root tag name
 ///\param name the name of the new root tag
-SWITCH_DECLARE(switch_xml_t) switch_xml_new(_In_z_ const char *name);
+SWITCH_DECLARE(switch_xml_t) switch_xml_new(_In_opt_z_ const char *name);
 
 ///\brief wrapper for switch_xml_new() that strdup()s name
 ///\param name the name of the root

Modified: freeswitch/trunk/src/switch_utils.c
==============================================================================
--- freeswitch/trunk/src/switch_utils.c	(original)
+++ freeswitch/trunk/src/switch_utils.c	Fri May 15 16:07:18 2009
@@ -83,6 +83,8 @@
 	switch_frame_t *new_frame;
 
 	new_frame = malloc(sizeof(*new_frame));
+
+	switch_assert(new_frame);
 	
 	*new_frame = *orig;
 	switch_set_flag(new_frame, SFF_DYNAMIC);

Modified: freeswitch/trunk/src/switch_xml.c
==============================================================================
--- freeswitch/trunk/src/switch_xml.c	(original)
+++ freeswitch/trunk/src/switch_xml.c	Fri May 15 16:07:18 2009
@@ -391,17 +391,17 @@
 
 	if (!xml || !xml->attr)
 		return NULL;
-	while (xml->attr[i] && strcmp(attr, xml->attr[i]))
+	while (xml->attr[i] && attr && strcmp(attr, xml->attr[i]))
 		i += 2;
 	if (xml->attr[i])
 		return xml->attr[i + 1];	/* found attribute */
 
 	while (root->xml.parent)
 		root = (switch_xml_root_t) root->xml.parent;	/* root tag */
-	for (i = 0; root->attr[i] && strcmp(xml->name, root->attr[i][0]); i++);
+	for (i = 0; root->attr[i] && xml->name && strcmp(xml->name, root->attr[i][0]); i++);
 	if (!root->attr[i])
 		return NULL;			/* no matching default attributes */
-	while (root->attr[i][j] && strcmp(attr, root->attr[i][j]))
+	while (root->attr[i][j] && attr && strcmp(attr, root->attr[i][j]))
 		j += 3;
 	return (root->attr[i][j]) ? root->attr[i][j + 1] : NULL;	/* found default */
 }
@@ -2140,6 +2140,7 @@
 	char *r, *s;
 	switch_mutex_lock(XML_GEN_LOCK);
 	s = (char *)malloc(SWITCH_XML_BUFSIZE);
+	switch_assert(s);
 	r = switch_xml_toxml_buf(xml, s, SWITCH_XML_BUFSIZE, 0, prn_header);
 	switch_mutex_unlock(XML_GEN_LOCK);
 	return r;
@@ -2251,6 +2252,9 @@
 	/*switch_xml_free(xml->ordered);*/
 
 	if (!xml->parent) {			/* free root tag allocations */
+#if (_MSC_VER >= 1400)			// VC8+
+		__analysis_assume(sizeof(root->ent) > 44); /* tail recursion confuses code analysis */
+#endif
 		for (i = 10; root->ent[i]; i += 2)	/* 0 - 9 are default entities (<>&"') */
 			if ((s = root->ent[i + 1]) < root->s || s > root->e)
 				free(s);

Modified: freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj
==============================================================================
--- freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj	(original)
+++ freeswitch/trunk/w32/Library/FreeSwitchCore.2008.vcproj	Fri May 15 16:07:18 2009
@@ -713,6 +713,22 @@
 			<File
 				RelativePath="..\..\src\switch_ivr_originate.c"
 				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalOptions="/analyze:stacksize17000"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						AdditionalOptions="/analyze:stacksize17000"
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="..\..\src\switch_ivr_play_say.c"



More information about the Freeswitch-svn mailing list