]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix several code analysis problems and mask several that are required
authorJeff Lenk <jeff@jefflenk.com>
Mon, 20 Sep 2010 14:25:14 +0000 (09:25 -0500)
committerJeff Lenk <jeff@jefflenk.com>
Mon, 20 Sep 2010 14:25:14 +0000 (09:25 -0500)
libs/esl/src/esl.c
libs/esl/src/esl_config.c
libs/esl/src/esl_event.c
libs/libteletone/src/libteletone_generate.c
src/include/switch.h
src/include/switch_utils.h
src/mod/applications/mod_spandsp/mod_spandsp_dsp.c
src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c
src/switch_console.c

index 160fe2d759f149e3b37601a7bc912bb9fa061822..75a52d6bd2e73bc618787e2bc7f3f5f0b0bd43ac 100644 (file)
 #define closesocket(x) close(x)
 #include <fcntl.h>
 #else
+#pragma warning (disable:6386)
+/* These warnings need to be ignored warning in sdk header */
 #include <Ws2tcpip.h>
+#pragma warning (default:6386)
 #endif
 
 
index 4616356f7f7e87e14e9b803ca8d16c977927bdbf..2e2400779986ab561a997003c489b97eb60e88ad 100644 (file)
@@ -110,7 +110,7 @@ ESL_DECLARE(int) esl_config_next_pair(esl_config_t *cfg, char **var, char **val)
 
        *var = *val = NULL;
 
-       if (!cfg->path) {
+       if (!cfg || !cfg->file) {
                return 0;
        }
 
index 2e1d8a302ac06986bcf9fb8a8f314d06164beda6..db7c581ee92bf9acf933af41ec0a4522adfc9f86 100644 (file)
@@ -513,6 +513,9 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es
        char *encode_buf = NULL;        /* used for url encoding of variables to make sure unsafe things stay out of the serialized copy */
        int clen = 0;
 
+       if (!event || !event->headers)
+               return ESL_FAIL;
+
        *str = NULL;
 
        dlen = blocksize * 2;
index 8098e3605c8d8785aaf2745a581b872ef56bf870..3977ca521decaf5c9807a1e10853e4dbedddac50 100644 (file)
@@ -413,6 +413,9 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
                                                                *e++ = '\0';
                                                        }
                                                        do {
+                                                               if (!p) {
+                                                                       break;
+                                                               }
                                                                if ((next = strchr(p, ',')) != 0) {
                                                                        *next++ = '\0';
                                                                }
index 7143c61d9192670c298d606f06903a05ee5c4e39..81684c59b0efabfdcb0682183d0eb5cc46b97498 100644 (file)
 #include <Ws2tcpip.h>
 #pragma warning(pop)
 #else
+/* work around for warnings in vs 2010 */
+#pragma warning (disable:6386)
 #include <Ws2tcpip.h>
+#pragma warning (default:6386)
 #endif
 #else
 #include <strings.h>
index 4dc7ed7f1b0599e4c3017325cbac00a6b9c27aad..45703ab49c0fdec068af6b1ddc89a6712ba49946 100644 (file)
@@ -139,6 +139,9 @@ static inline char *switch_strchr_strict(const char *in, char find, const char *
 #define switch_is_valid_rate(_tmp) (_tmp == 8000 || _tmp == 12000 || _tmp == 16000 || _tmp == 24000 || _tmp == 32000 || _tmp == 11025 || _tmp == 22050 || _tmp == 44100 || _tmp == 48000)
 
 
+#ifdef _MSC_VER
+#pragma warning(disable:6011)
+#endif
 static inline int switch_string_has_escaped_data(const char *in)
 {
        const char *i = strchr(in, '\\');
@@ -153,6 +156,9 @@ static inline int switch_string_has_escaped_data(const char *in)
 
        return 0;
 }
+#ifdef _MSC_VER
+#pragma warning(default:6011)
+#endif
 
 SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size_t ilen, unsigned char *out, switch_size_t olen);
 SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen);
@@ -455,6 +461,9 @@ static inline char *switch_safe_strdup(const char *it)
 }
 
 
+#ifdef _MSC_VER
+#pragma warning(disable:6011)
+#endif
 static inline char *switch_lc_strdup(const char *it)
 {
        char *dup;
@@ -487,6 +496,9 @@ static inline char *switch_uc_strdup(const char *it)
 
        return NULL;
 }
+#ifdef _MSC_VER
+#pragma warning(default:6011)
+#endif
 
 
 /*!
index 096d967ff01943c3559cc2ab7719d9b72ed7a3f3..aa7d05cf9e194ca7030ceb1f69d71115fb1ce2c2 100644 (file)
@@ -549,8 +549,8 @@ static switch_status_t do_config(void)
                                if (id == -1) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unable to add tone_descriptor: %s, tone: %s.  (too many tones)\n", name, tone_name);
                                        return SWITCH_STATUS_FALSE;
-                               
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Adding tone_descriptor: %s, tone: %s(%d)\n", name, tone_name, id);}
+                               }
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Adding tone_descriptor: %s, tone: %s(%d)\n", name, tone_name, id);
                                /* add elements to tone */
                                for (element = switch_xml_child(tone, "element"); element; element = switch_xml_next(element)) {
                                        const char *freq1_attr = switch_xml_attr(element, "freq1");
index 139fe217a326c98f626763ac3db5b676f9bb2933..4b36e1435ed3c52a07f4cdf1ab349048641d3205 100644 (file)
@@ -2724,7 +2724,7 @@ static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec
                name++;
                name = switch_core_sprintf(ah->memory_pool, "%s ASR-%d", name, speech_channel_number);
        } else {
-               name = switch_core_sprintf(ah->memory_pool, "ASR-%d", name, speech_channel_number);
+               name = switch_core_sprintf(ah->memory_pool, "ASR-%d", speech_channel_number);
        }
 
        /* Allocate the channel */
index 06a7e0de7a2469af811a053613ea5311db6407f6..9f138231986fe1cf3500e40324c8e97216dd81d2 100644 (file)
@@ -493,7 +493,7 @@ static int comp_callback(void *pArg, int argc, char **argv, char **columnNames)
                        
                        argc = switch_separate_string(list, ':', argv, (sizeof(argv) / sizeof(argv[0])));
 
-                       for (i = 0; i < argc; i++) {
+                       for (i = 0; (int)i < argc; i++) {
                                if (!cur || !strncmp(argv[i], cur, strlen(cur))) {
                                        r_argv[0] = argv[i];
                                        comp_callback(h, 1, r_argv, r_cols);