]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
cleanup msvc code analysis warnings
authorMichael Jerris <mike@jerris.com>
Fri, 15 May 2009 21:07:18 +0000 (21:07 +0000)
committerMichael Jerris <mike@jerris.com>
Fri, 15 May 2009 21:07:18 +0000 (21:07 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13366 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_xml.h
src/switch_utils.c
src/switch_xml.c
w32/Library/FreeSwitchCore.2008.vcproj

index 96639d4a88be5d64c8462fc4dcd13d62f100d6ea..1187b89d4f7622d3d2cba3fc29d8fc110b577337 100644 (file)
@@ -240,7 +240,7 @@ SWITCH_DECLARE(const char *) switch_xml_error(_In_ switch_xml_t xml);
 
 ///\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
index 5829140098aaec2799d8f875e14e10f3d2c68a59..59b0b66c17efcb8663e6fbde08fb50a60e225580 100644 (file)
@@ -83,6 +83,8 @@ SWITCH_DECLARE(switch_status_t) switch_frame_dup(switch_frame_t *orig, switch_fr
        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);
index eccaa630a608ca1694d80e2964808cd9f3cb607b..4103009e2ee51f012a58bab6a1763281855e3f98 100644 (file)
@@ -391,17 +391,17 @@ SWITCH_DECLARE(const char *) switch_xml_attr(switch_xml_t xml, const char *attr)
 
        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 @@ SWITCH_DECLARE(char *) switch_xml_toxml(switch_xml_t xml, switch_bool_t prn_head
        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 @@ tailrecurse:
        /*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);
index d93f12baeeff0440b97047d13a93893ca641640c..c50b511aebaf5ef2b0844df05850d64634ed93d0 100644 (file)
                        <File\r
                                RelativePath="..\..\src\switch_ivr_originate.c"\r
                                >\r
+                               <FileConfiguration\r
+                                       Name="Debug|Win32"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                               AdditionalOptions="/analyze:stacksize17000"\r
+                                       />\r
+                               </FileConfiguration>\r
+                               <FileConfiguration\r
+                                       Name="Release|Win32"\r
+                                       >\r
+                                       <Tool\r
+                                               Name="VCCLCompilerTool"\r
+                                               AdditionalOptions="/analyze:stacksize17000"\r
+                                       />\r
+                               </FileConfiguration>\r
                        </File>\r
                        <File\r
                                RelativePath="..\..\src\switch_ivr_play_say.c"\r