fix several code analysis problems and mask several that are required

This commit is contained in:
Jeff Lenk 2010-09-20 09:25:14 -05:00
parent 0748711434
commit 184f395553
9 changed files with 29 additions and 5 deletions

View File

@ -36,7 +36,10 @@
#define closesocket(x) close(x) #define closesocket(x) close(x)
#include <fcntl.h> #include <fcntl.h>
#else #else
#pragma warning (disable:6386)
/* These warnings need to be ignored warning in sdk header */
#include <Ws2tcpip.h> #include <Ws2tcpip.h>
#pragma warning (default:6386)
#endif #endif

View File

@ -110,7 +110,7 @@ ESL_DECLARE(int) esl_config_next_pair(esl_config_t *cfg, char **var, char **val)
*var = *val = NULL; *var = *val = NULL;
if (!cfg->path) { if (!cfg || !cfg->file) {
return 0; return 0;
} }

View 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 */ char *encode_buf = NULL; /* used for url encoding of variables to make sure unsafe things stay out of the serialized copy */
int clen = 0; int clen = 0;
if (!event || !event->headers)
return ESL_FAIL;
*str = NULL; *str = NULL;
dlen = blocksize * 2; dlen = blocksize * 2;

View File

@ -413,6 +413,9 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm
*e++ = '\0'; *e++ = '\0';
} }
do { do {
if (!p) {
break;
}
if ((next = strchr(p, ',')) != 0) { if ((next = strchr(p, ',')) != 0) {
*next++ = '\0'; *next++ = '\0';
} }

View File

@ -91,7 +91,10 @@
#include <Ws2tcpip.h> #include <Ws2tcpip.h>
#pragma warning(pop) #pragma warning(pop)
#else #else
/* work around for warnings in vs 2010 */
#pragma warning (disable:6386)
#include <Ws2tcpip.h> #include <Ws2tcpip.h>
#pragma warning (default:6386)
#endif #endif
#else #else
#include <strings.h> #include <strings.h>

View 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) #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) static inline int switch_string_has_escaped_data(const char *in)
{ {
const char *i = strchr(in, '\\'); const char *i = strchr(in, '\\');
@ -153,6 +156,9 @@ static inline int switch_string_has_escaped_data(const char *in)
return 0; 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_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); 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) static inline char *switch_lc_strdup(const char *it)
{ {
char *dup; char *dup;
@ -487,6 +496,9 @@ static inline char *switch_uc_strdup(const char *it)
return NULL; return NULL;
} }
#ifdef _MSC_VER
#pragma warning(default:6011)
#endif
/*! /*!

View File

@ -549,8 +549,8 @@ static switch_status_t do_config(void)
if (id == -1) { 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); 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; 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 */ /* add elements to tone */
for (element = switch_xml_child(tone, "element"); element; element = switch_xml_next(element)) { for (element = switch_xml_child(tone, "element"); element; element = switch_xml_next(element)) {
const char *freq1_attr = switch_xml_attr(element, "freq1"); const char *freq1_attr = switch_xml_attr(element, "freq1");

View File

@ -2724,7 +2724,7 @@ static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec
name++; name++;
name = switch_core_sprintf(ah->memory_pool, "%s ASR-%d", name, speech_channel_number); name = switch_core_sprintf(ah->memory_pool, "%s ASR-%d", name, speech_channel_number);
} else { } 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 */ /* Allocate the channel */

View 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]))); 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))) { if (!cur || !strncmp(argv[i], cur, strlen(cur))) {
r_argv[0] = argv[i]; r_argv[0] = argv[i];
comp_callback(h, 1, r_argv, r_cols); comp_callback(h, 1, r_argv, r_cols);