]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix several problems discovered with code analysis
authorJeff Lenk <jeff@jefflenk.com>
Mon, 30 May 2011 05:07:32 +0000 (00:07 -0500)
committerJeff Lenk <jeff@jefflenk.com>
Mon, 30 May 2011 05:07:32 +0000 (00:07 -0500)
src/include/switch_utils.h
src/switch_core_session.c
src/switch_utils.c

index 88c13379b30bd48d265ad11f95c37bf12ac091b9..f798e92386d9c61d6ee8ac6362c8cf5a9bf26dd2 100644 (file)
@@ -793,9 +793,9 @@ SWITCH_DECLARE(int) switch_split_user_domain(char *in, char **user, char **domai
 
 /* malloc or DIE macros */
 #ifdef NDEBUG
-#define switch_malloc(ptr, len) (void)( (!!(ptr = malloc(len))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), ptr )
-#define switch_zmalloc(ptr, len) (void)( (!!(ptr = calloc(1, (len)))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), ptr)
-#define switch_strdup(ptr, s) (void)( (!!(ptr = strdup(s))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%s", __FILE__, __LINE__),abort(), 0), ptr)
+#define switch_malloc(ptr, len) (void)( (!!(ptr = malloc(len))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%d", __FILE__, __LINE__),abort(), 0), ptr )
+#define switch_zmalloc(ptr, len) (void)( (!!(ptr = calloc(1, (len)))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%d", __FILE__, __LINE__),abort(), 0), ptr)
+#define switch_strdup(ptr, s) (void)( (!!(ptr = strdup(s))) || (fprintf(stderr,"ABORT! Malloc failure at: %s:%d", __FILE__, __LINE__),abort(), 0), ptr)
 #else
 #if (_MSC_VER >= 1500)                 // VC9+
 #define switch_malloc(ptr, len) (void)(assert(((ptr) = malloc((len)))),ptr);__analysis_assume( ptr )
index ade22d2f3278b44f4c2ec4271f5d82411d28e356..ea07a7805e1df950821b183e56802e2f537d407d 100644 (file)
@@ -616,6 +616,10 @@ static const char *message_names[] = {
        "APPLICATION_EXEC_COMPLETE",
        "PHONE_EVENT",
        "T38_DESCRIPTION"
+       "UDPTL_MODE",
+       "CLEAR_PROGRESS",
+       "JITTER_BUFFER",
+       "RECOVERY_REFRESH",
        "INVALID"
 };
 
@@ -644,8 +648,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(swit
                message->_line = line;
        }
 
-       if (message->message_id > SWITCH_MESSAGE_INVALID) {
-               message->message_id = SWITCH_MESSAGE_INVALID;
+       if (message->message_id > SWITCH_MESSAGE_INVALID-1) {
+               message->message_id = SWITCH_MESSAGE_INVALID-1;
        }
 
        switch_log_printf(SWITCH_CHANNEL_ID_LOG, message->_file, message->_func, message->_line,
index 99d1d982751f0dcdb89b90b399262a18fdb0301f..906a02eba687520b416f4ae99f3428bd56ac0037 100644 (file)
@@ -2669,7 +2669,7 @@ SWITCH_DECLARE(switch_bool_t) switch_dow_cmp(const char *exp, int val)
                        /* Save the previous token and move to the next one */
                        range_start = prev;
                } else if (cur == DOW_ERR) {
-                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse error for [%s] at position %td (%.6s)\n", exp, p - exp, p);
+                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse error for [%s] at position %ld (%.6s)\n", exp, (long) (p - exp), p);
                        break;
                } else {
                        /* Valid day found */