]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix build warnings
authorMichael Jerris <mike@jerris.com>
Wed, 29 Jul 2009 23:11:03 +0000 (23:11 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 29 Jul 2009 23:11:03 +0000 (23:11 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14426 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c

index 7a4b200501f71f2fa42a0d1a62290207efd77bda..04643f67fb62da29ef3344f91c2596e03b48a532 100644 (file)
@@ -596,7 +596,7 @@ static void ipchanged_event_handler(switch_event_t *event)
                        for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
                                switch_hash_this(hi, NULL, NULL, &val);
                                profile = (mdl_profile_t *) val;
-                               if (!strcmp(profile->extip, old_ip4)) {
+                               if (old_ip4 && !strcmp(profile->extip, old_ip4)) {
                                        tmp = profile->extip;
                                        profile->extip = strdup(new_ip4);
                                        switch_safe_free(tmp);
@@ -1989,15 +1989,15 @@ static void set_profile_val(mdl_profile_t *profile, char *var, char *val)
                profile->name = switch_core_strdup(module_pool, val);
        } else if (!strcasecmp(var, "message") && !switch_strlen_zero(val)) {
                profile->message = switch_core_strdup(module_pool, val);
-       } else if (!strcasecmp(var, "local-network-acl")) {
+       } else if (!strcasecmp(var, "local-network-acl") && !switch_strlen_zero(val)) {
                profile->local_network = switch_core_strdup(module_pool, val);
        } else if (!strcasecmp(var, "rtp-ip")) {
                profile->ip = switch_core_strdup(module_pool, strcasecmp(switch_str_nil(val), "auto") ? switch_str_nil(val) : globals.guess_ip);
        } else if (!strcasecmp(var, "ext-rtp-ip")) {
                char *ip = globals.guess_ip;
-               if (!strcasecmp(val, "auto-nat")) {
+               if (val && !strcasecmp(val, "auto-nat")) {
                        ip = globals.auto_nat ? switch_core_get_variable("nat_public_addr") : globals.guess_ip;
-               } else if (!strcasecmp(val, "auto")) {
+               } else if (val && !strcasecmp(val, "auto")) {
                        globals.auto_nat = 0;
                        ip = globals.guess_ip;
                } else {
index cc7b3f2e403dfb002576c913e16c497354c47641..0fdedf64cbf5eeb52d901f9ed8d09e09034cc6e4 100644 (file)
@@ -68,7 +68,7 @@ static struct {
 
 struct peer_status {
        switch_bool_t active;
-       int lastseen;
+       time_t lastseen;
 };
 
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_address, globals.address);
@@ -179,11 +179,12 @@ static void event_handler(switch_event_t *event)
        if (event->subclass_name && (!strcmp(event->subclass_name, MULTICAST_EVENT) ||
                                !strcmp(event->subclass_name, MULTICAST_PEERUP) ||
                                !strcmp(event->subclass_name, MULTICAST_PEERDOWN))) {
-               char * event_name;
-               if ((event_name = switch_event_get_header(event, "orig-event-name")) && !strcasecmp(event_name, "HEARTBEAT")) {
-                       char *sender = switch_event_get_header(event, "orig-multicast-sender");
+               char * event_name, *sender;
+               if ((event_name = switch_event_get_header(event, "orig-event-name")) &&
+                       !strcasecmp(event_name, "HEARTBEAT") && 
+                       (sender = switch_event_get_header(event, "orig-multicast-sender"))) {
                        struct peer_status *p;
-                       int now = switch_epoch_time_now(NULL);
+                       time_t now = switch_epoch_time_now(NULL);
                        
                        if (!(p = switch_core_hash_find(globals.peer_hash, sender))) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Host %s not already in hash\n", sender);
@@ -200,7 +201,7 @@ static void event_handler(switch_event_t *event)
                                        char lastseen[21];
                                        switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Peer", sender);
                                        if (p->lastseen) {
-                                               switch_snprintf(lastseen, sizeof(lastseen), "%d", p->lastseen);
+                                               switch_snprintf(lastseen, sizeof(lastseen), "%d", (int)p->lastseen);
                                        } else {
                                                switch_snprintf(lastseen, sizeof(lastseen), "%s", "Never");
                                        }
@@ -243,7 +244,7 @@ static void event_handler(switch_event_t *event)
                switch_ssize_t keylen;
                const void *key;
                void *value;
-               int now = switch_epoch_time_now(NULL);
+               time_t now = switch_epoch_time_now(NULL);
                struct peer_status *last;
                char *host;
                
@@ -258,7 +259,7 @@ static void event_handler(switch_event_t *event)
                                if (switch_event_create_subclass(&local_event, SWITCH_EVENT_CUSTOM, MULTICAST_PEERDOWN) == SWITCH_STATUS_SUCCESS) {
                                        char lastseen[21];
                                        switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Peer", host);
-                                       switch_snprintf(lastseen, sizeof(lastseen), "%d", last->lastseen);
+                                       switch_snprintf(lastseen, sizeof(lastseen), "%d", (int)last->lastseen);
                                        switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Lastseen", lastseen);
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Peer %s has gone down; last seen: %s\n", host, lastseen);
 
@@ -347,7 +348,7 @@ SWITCH_STANDARD_API(multicast_peers)
        switch_ssize_t keylen;
        const void *key;
        void *value;
-       int now = switch_epoch_time_now(NULL);
+       time_t now = switch_epoch_time_now(NULL);
        struct peer_status *last;
        char *host;
        int i = 0;