]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
use switch_snprintf instead of snprintf becuase in insures null termination of strings.
authorMichael Jerris <mike@jerris.com>
Wed, 12 Dec 2007 21:53:32 +0000 (21:53 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 12 Dec 2007 21:53:32 +0000 (21:53 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6707 d0543943-73ff-0310-b7d9-9358b9ac24b2

49 files changed:
src/mod/applications/mod_commands/mod_commands.c
src/mod/applications/mod_conference/mod_conference.c
src/mod/applications/mod_dptools/mod_dptools.c
src/mod/applications/mod_enum/mod_enum.c
src/mod/applications/mod_expr/mod_expr.c
src/mod/applications/mod_fifo/mod_fifo.c
src/mod/applications/mod_limit/mod_limit.c
src/mod/applications/mod_rss/mod_rss.c
src/mod/applications/mod_voicemail/mod_voicemail.c
src/mod/asr_tts/mod_cepstral/mod_cepstral.c
src/mod/codecs/mod_amr/mod_amr.c
src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/mod/endpoints/mod_iax/mod_iax.c
src/mod/endpoints/mod_portaudio/mod_portaudio.c
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c
src/mod/endpoints/mod_sofia/sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_reg.c
src/mod/endpoints/mod_woomera/mod_woomera.c
src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
src/mod/event_handlers/mod_event_socket/mod_event_socket.c
src/mod/event_handlers/mod_zeroconf/mod_zeroconf.c
src/mod/formats/mod_local_stream/mod_local_stream.c
src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c
src/mod/loggers/mod_logfile/mod_logfile.c
src/mod/say/mod_say_en/mod_say_en.c
src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
src/switch_caller.c
src/switch_channel.c
src/switch_config.c
src/switch_console.c
src/switch_core.c
src/switch_core_codec.c
src/switch_core_db.c
src/switch_core_session.c
src/switch_event.c
src/switch_ivr.c
src/switch_ivr_play_say.c
src/switch_loadable_module.c
src/switch_log.c
src/switch_rtp.c
src/switch_utils.c
src/switch_xml.cpp

index ed63b56b781f0f9a34fd936c6923870db8fdfa13..c69ba889413bd21eb14e80cb0945f4c839e255b2 100644 (file)
@@ -1610,7 +1610,7 @@ static int show_as_xml_callback(void *pArg, int argc, char **argv, char **column
                return -1;
        }
 
-       snprintf(id, sizeof(id), "%d", holder->rows);
+       switch_snprintf(id, sizeof(id), "%d", holder->rows);
 
        switch_xml_set_attr(switch_xml_set_flag(row, SWITCH_XML_DUP), strdup("row_id"), strdup(id));
 
@@ -1743,9 +1743,9 @@ SWITCH_STANDARD_API(show_function)
                holder.print_title = 0;
                if ((cmdname = strchr(command, ' ')) != 0) {
                        *cmdname++ = '\0';
-                       snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api' and name = '%s'", cmdname);
+                       switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api' and name = '%s'", cmdname);
                } else {
-                       snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api'");
+                       switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api'");
                }
        } else {
                stream->write_function(stream, "-USAGE: %s\n", SHOW_SYNTAX);
@@ -1791,7 +1791,7 @@ SWITCH_STANDARD_API(show_function)
                if (holder.xml) {
                        char count[50];
                        char *xmlstr;
-                       snprintf(count, sizeof(count), "%d", holder.count);
+                       switch_snprintf(count, sizeof(count), "%d", holder.count);
 
                        switch_xml_set_attr(switch_xml_set_flag(holder.xml, SWITCH_XML_DUP), strdup("row_count"), strdup(count));
                        xmlstr = switch_xml_toxml(holder.xml, SWITCH_FALSE);
@@ -1817,7 +1817,7 @@ SWITCH_STANDARD_API(show_function)
 SWITCH_STANDARD_API(version_function)
 {
        char version_string[1024];
-       snprintf(version_string, sizeof(version_string) - 1, "FreeSwitch Version %s\n", SWITCH_VERSION_FULL);
+       switch_snprintf(version_string, sizeof(version_string) - 1, "FreeSwitch Version %s\n", SWITCH_VERSION_FULL);
 
        stream->write_function(stream, version_string);
        return SWITCH_STATUS_SUCCESS;
@@ -1831,7 +1831,7 @@ SWITCH_STANDARD_API(help_function)
                sprintf(showcmd, "help");
                all = 1;
        } else {
-               snprintf(showcmd, sizeof(showcmd) - 1, "help %s", cmd);
+               switch_snprintf(showcmd, sizeof(showcmd) - 1, "help %s", cmd);
        }
 
        if (all) {
index 9b2784b4b6c6a9f2e0c340cde95f37f5ca5ab989..1b964a10f62cd470282b7332464840737b0c7665 100644 (file)
@@ -560,19 +560,19 @@ static switch_status_t conference_add_member(conference_obj_t * conference, conf
                        
                if (call_list) {
                        char saymsg[1024];
-                       snprintf(saymsg, sizeof(saymsg), "Auto Calling %d parties", call_list->itteration);
+                       switch_snprintf(saymsg, sizeof(saymsg), "Auto Calling %d parties", call_list->itteration);
                        conference_member_say(member, saymsg, 0);
                } else {
                        if (switch_strlen_zero(conference->special_announce)) {
                                /* anounce the total number of members in the conference */
                                if (conference->count >= conference->anounce_count && conference->anounce_count > 1) {
-                                       snprintf(msg, sizeof(msg), "There are %d callers", conference->count);
+                                       switch_snprintf(msg, sizeof(msg), "There are %d callers", conference->count);
                                        conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
                                } else if (conference->count == 1 && !conference->perpetual_sound) {
                                        if (conference->alone_sound) {
                                                conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0);
                                        } else {
-                                               snprintf(msg, sizeof(msg), "You are currently the only person in this conference.");
+                                               switch_snprintf(msg, sizeof(msg), "You are currently the only person in this conference.");
                                                conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
                                        }
                                }
@@ -1093,7 +1093,7 @@ static void conference_loop_fn_energy_up(conference_member_t * member, caller_co
                }
                switch_mutex_unlock(member->flag_mutex);
 
-               snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
+               switch_snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
                conference_member_say(member, msg, 0);
 
 
@@ -1117,7 +1117,7 @@ static void conference_loop_fn_energy_equ_conf(conference_member_t * member, cal
                }
                switch_mutex_unlock(member->flag_mutex);
 
-               snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
+               switch_snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
                conference_member_say(member, msg, 0);
 
        }
@@ -1143,7 +1143,7 @@ static void conference_loop_fn_energy_dn(conference_member_t * member, caller_co
                }
                switch_mutex_unlock(member->flag_mutex);
 
-               snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
+               switch_snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level);
                conference_member_say(member, msg, 0);
 
 
@@ -1171,7 +1171,7 @@ static void conference_loop_fn_volume_talk_up(conference_member_t * member, call
                switch_mutex_unlock(member->flag_mutex);
 
 
-               snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
+               switch_snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
                conference_member_say(member, msg, 0);
 
        }
@@ -1196,7 +1196,7 @@ static void conference_loop_fn_volume_talk_zero(conference_member_t * member, ca
                switch_mutex_unlock(member->flag_mutex);
 
 
-               snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
+               switch_snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
                conference_member_say(member, msg, 0);
 
 
@@ -1221,7 +1221,7 @@ static void conference_loop_fn_volume_talk_dn(conference_member_t * member, call
                }
                switch_mutex_unlock(member->flag_mutex);
 
-               snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
+               switch_snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level);
                conference_member_say(member, msg, 0);
 
 
@@ -1248,7 +1248,7 @@ static void conference_loop_fn_volume_listen_up(conference_member_t * member, ca
                switch_mutex_unlock(member->flag_mutex);
 
 
-               snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
+               switch_snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
                conference_member_say(member, msg, 0);
 
 
@@ -1273,7 +1273,7 @@ static void conference_loop_fn_volume_listen_zero(conference_member_t * member,
                }
                switch_mutex_unlock(member->flag_mutex);
 
-               snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
+               switch_snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
                conference_member_say(member, msg, 0);
 
 
@@ -1301,7 +1301,7 @@ static void conference_loop_fn_volume_listen_dn(conference_member_t * member, ca
                switch_mutex_unlock(member->flag_mutex);
 
 
-               snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
+               switch_snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level);
                conference_member_say(member, msg, 0);
 
 
@@ -2493,7 +2493,7 @@ static switch_status_t conf_api_sub_mute(conference_member_t * member, switch_st
                } else {
                        char msg[512];
 
-                       snprintf(msg, sizeof(msg), "Muted");
+                       switch_snprintf(msg, sizeof(msg), "Muted");
                        conference_member_say(member, msg, 0);
                }
                if (stream != NULL) {
@@ -2527,7 +2527,7 @@ static switch_status_t conf_api_sub_unmute(conference_member_t * member, switch_
                } else {
                        char msg[512];
 
-                       snprintf(msg, sizeof(msg), "Un-Muted");
+                       switch_snprintf(msg, sizeof(msg), "Un-Muted");
                        conference_member_say(member, msg, 0);
                }
                if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
@@ -3692,7 +3692,7 @@ static switch_status_t conference_outcall(conference_obj_t * conference,
                }
                /* add them to the conference */
                if (flags && !strcasecmp(flags, "none")) {
-                       snprintf(appdata, sizeof(appdata), "%s+flags{%s}", conference_name, flags);
+                       switch_snprintf(appdata, sizeof(appdata), "%s+flags{%s}", conference_name, flags);
                        switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, appdata);
                } else {
                        switch_caller_extension_add_application(peer_session, extension, (char *) global_app_name, conference_name);
index 94606166ccad064713594fdafaa1b0713b0a905d..01f72fa1daf25c579156da102c3a337db4d3cfeb 100644 (file)
@@ -1387,7 +1387,7 @@ SWITCH_STANDARD_APP(audio_bridge_function)
                        char cause_num[35] = "";
 
                        cause_str = switch_channel_cause2str(cause);
-                       snprintf(cause_num, sizeof(cause_num), "%u", cause);
+                       switch_snprintf(cause_num, sizeof(cause_num), "%u", cause);
 
                        if (switch_true(continue_on_fail) || switch_stristr(cause_str, continue_on_fail) || strstr(cause_num, continue_on_fail)) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Continue on fail [%s]:  Cause: %s\n", continue_on_fail, cause_str);
index 35dd51ef8eb7eb59cea393b0a05c7d5d969c88c8..492e3103cf69abd77a4da9022a28c204f8f517a1 100644 (file)
@@ -624,17 +624,17 @@ SWITCH_STANDARD_APP(enum_app_function)
                        for (rtp = globals.route_order; rtp; rtp = rtp->next) {
                                for (rp = results; rp; rp = rp->next) {
                                        if (!strcasecmp(rtp->service, rp->service)) {
-                                               snprintf(vbuf, sizeof(vbuf), "enum_route_%d", cnt++);
+                                               switch_snprintf(vbuf, sizeof(vbuf), "enum_route_%d", cnt++);
                                                switch_channel_set_variable(channel, vbuf, rp->route);
 
-                                               snprintf(rbp, rbl, "%s|", rp->route);
+                                               switch_snprintf(rbp, rbl, "%s|", rp->route);
                                                l = strlen(rp->route) + 1;
                                                rbp += l;
                                                rbl -= l;
                                        }
                                }
                        }
-                       snprintf(vbuf, sizeof(vbuf), "%d", cnt);
+                       switch_snprintf(vbuf, sizeof(vbuf), "%d", cnt);
                        switch_channel_set_variable(channel, "enum_route_count", vbuf);
                        *(rbuf + strlen(rbuf) - 1) = '\0';
                        switch_channel_set_variable(channel, "enum_auto_route", rbuf);
index b04dc85057f2fb96e53e0c0bbd78a85b4193d1a2..94314832fd6b8c1c72558134bd949e6ca3342ff7 100644 (file)
@@ -128,7 +128,7 @@ SWITCH_STANDARD_API(expr_function)
                err = exprEval(e, &last_expr);
        } while (err);
 
-    snprintf(val, sizeof(val), "%0.10f", last_expr);
+    switch_snprintf(val, sizeof(val), "%0.10f", last_expr);
     for (p = (val + strlen(val) - 1); p != val; p--) {
         if (*p != '0') {
             *(p+1) = '\0';
index 671aa0c127b45973d0841c4303a227ebf18b387c..d386721930d5e5ac1b8c8444c1a52a92725d292c 100644 (file)
@@ -471,9 +471,9 @@ static void list_node(fifo_node_t *node, switch_xml_t x_report, int *off, int ve
     switch_assert(x_fifo);
 
     switch_xml_set_attr_d(x_fifo, "name", node->name);
-    snprintf(tmp, sizeof(buffer), "%d", node->consumer_count);
+    switch_snprintf(tmp, sizeof(buffer), "%d", node->consumer_count);
     switch_xml_set_attr_d(x_fifo, "consumer_count", tmp);
-    snprintf(tmp, sizeof(buffer), "%d", node->caller_count);
+    switch_snprintf(tmp, sizeof(buffer), "%d", node->caller_count);
     switch_xml_set_attr_d(x_fifo, "caller_count", tmp);
     
     cc_off = xml_hash(x_fifo, node->caller_hash, "callers", "caller", cc_off, verbose);
index faddd53e0dc92b5ea02e9e7ffbed1cbe94f2ef08..2793a32a4e9f1fed3afe92a53f028aa64ddf100b 100644 (file)
@@ -325,7 +325,7 @@ static int sql2str_callback(void *pArg, int argc, char **argv, char **columnName
 static int group_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
        callback_t *cbt = (callback_t *) pArg;
-    snprintf(cbt->buf + strlen(cbt->buf), cbt->len - strlen(cbt->buf), "%s%c", argv[0], *argv[1]);
+    switch_snprintf(cbt->buf + strlen(cbt->buf), cbt->len - strlen(cbt->buf), "%s%c", argv[0], *argv[1]);
        cbt->matches++;
        return 0;
 }
index 28e302fdcd3235e82e8cf42f3f6dd81cf63bcd3a..170667435d3d3e898013e28a19bae3e0b41aa927 100644 (file)
@@ -73,7 +73,7 @@ static uint32_t match_count(char *str, uint32_t max)
        uint32_t len = (uint32_t) strlen(str);
 
        for (x = 0; x < max; x++) {
-               snprintf(tstr, sizeof(tstr), "%u", x);
+               switch_snprintf(tstr, sizeof(tstr), "%u", x);
                if (!strncasecmp(str, tstr, len)) {
                        matches++;
                }
@@ -316,28 +316,28 @@ SWITCH_STANDARD_APP(rss_function)
                title_txt = description_txt = rights_txt = "";
 
                if (jumpto > -1) {
-                       snprintf(cmd, sizeof(cmd), "%d", jumpto);
+                       switch_snprintf(cmd, sizeof(cmd), "%d", jumpto);
                        jumpto = -1;
                } else {
                        switch_core_speech_flush_tts(&sh);
 #ifdef MATCH_COUNT
-                       snprintf(buf + len, sizeof(buf) - len,
+                       switch_snprintf(buf + len, sizeof(buf) - len,
                                         ",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
                                         "Select one of the following news sources, or press 0 to exit. " ",<break time=\"600ms\"/>");
 #else
-                       snprintf(buf + len, sizeof(buf) - len,
+                       switch_snprintf(buf + len, sizeof(buf) - len,
                                         ",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
                                         "Select one of the following news sources, followed by the pound key or press 0 to exit. " ",<break time=\"600ms\"/>");
 #endif
                        len = (int32_t) strlen(buf);
 
                        for (idx = 0; idx < feed_index; idx++) {
-                               snprintf(buf + len, sizeof(buf) - len, "%d: %s. <break time=\"600ms\"/>", idx + 1, feed_names[idx]);
+                               switch_snprintf(buf + len, sizeof(buf) - len, "%d: %s. <break time=\"600ms\"/>", idx + 1, feed_names[idx]);
                                len = (int32_t) strlen(buf);
                        }
 
 
-                       snprintf(buf + len, sizeof(buf) - len, "<break time=\"2000ms\"/>");
+                       switch_snprintf(buf + len, sizeof(buf) - len, "<break time=\"2000ms\"/>");
                        len = (int32_t) strlen(buf);
 
                        args.input_callback = NULL;
@@ -497,7 +497,7 @@ SWITCH_STANDARD_APP(rss_function)
                        switch_strftime(date, &retsize, sizeof(date), "%I:%M %p", &tm);
 
 
-                       snprintf(buf, sizeof(buf),
+                       switch_snprintf(buf, sizeof(buf),
                                         ",<break time=\"500ms\"/>%s. %s. %s. local time: %s, Press 0 for options, 5 to change voice, or pound to return to the main menu. ",
                                         title_txt, description_txt, rights_txt, date);
                        args.input_callback = NULL;
@@ -555,14 +555,14 @@ SWITCH_STANDARD_APP(rss_function)
                                        }
                                        if (switch_test_flag(&dtb, SFLAG_INFO)) {
                                                switch_clear_flag(&dtb, SFLAG_INFO);
-                                               snprintf(buf + len, sizeof(buf) - len, "%s %s. I am speaking at %u words per minute. ", sh.engine, sh.voice, dtb.speed);
+                                               switch_snprintf(buf + len, sizeof(buf) - len, "%s %s. I am speaking at %u words per minute. ", sh.engine, sh.voice, dtb.speed);
                                                len = (uint32_t) strlen(buf);
                                        }
 
                                        if (switch_test_flag(&dtb, SFLAG_INSTRUCT)) {
                                                switch_clear_flag(&dtb, SFLAG_INSTRUCT);
                                                cont = 1;
-                                               snprintf(buf + len, sizeof(buf) - len,
+                                               switch_snprintf(buf + len, sizeof(buf) - len,
                                                                 "Press star to pause or resume speech. "
                                                                 "To go to the next item, press six. "
                                                                 "To go back, press 4. "
@@ -570,21 +570,21 @@ SWITCH_STANDARD_APP(rss_function)
                                                                 "To change voices, press five. To restore the original voice press 9. "
                                                                 "To hear these options again, press zero or press pound to return to the main menu. ");
                                        } else {
-                                               snprintf(buf + len, sizeof(buf) - len, "Story %d. ", dtb.index + 1);
+                                               switch_snprintf(buf + len, sizeof(buf) - len, "Story %d. ", dtb.index + 1);
                                                len = (uint32_t) strlen(buf);
 
                                                if (entries[dtb.index].subject_txt) {
-                                                       snprintf(buf + len, sizeof(buf) - len, "Subject: %s. ", entries[dtb.index].subject_txt);
+                                                       switch_snprintf(buf + len, sizeof(buf) - len, "Subject: %s. ", entries[dtb.index].subject_txt);
                                                        len = (uint32_t) strlen(buf);
                                                }
 
                                                if (entries[dtb.index].dept_txt) {
-                                                       snprintf(buf + len, sizeof(buf) - len, "From the %s department. ", entries[dtb.index].dept_txt);
+                                                       switch_snprintf(buf + len, sizeof(buf) - len, "From the %s department. ", entries[dtb.index].dept_txt);
                                                        len = (uint32_t) strlen(buf);
                                                }
 
                                                if (entries[dtb.index].title_txt) {
-                                                       snprintf(buf + len, sizeof(buf) - len, "%s", entries[dtb.index].title_txt);
+                                                       switch_snprintf(buf + len, sizeof(buf) - len, "%s", entries[dtb.index].title_txt);
                                                        len = (uint32_t) strlen(buf);
                                                }
                                        }
index 52ed1a680f45e37279af5ab628523a12594f45bf..ebed811d2976e7a9bd36a999ddc3495ce90af76f 100644 (file)
@@ -893,7 +893,7 @@ static switch_status_t create_file(switch_core_session_t *session, vm_profile_t
 
     while(switch_channel_ready(channel)) {
         
-        snprintf(key_buf, sizeof(key_buf), "%s:%s:%s", 
+        switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s", 
                  profile->listen_file_key,
                  profile->save_file_key,
                  profile->record_file_key);
@@ -1007,7 +1007,7 @@ static void message_count(vm_profile_t *profile, const char *myid, const char *d
     cbt.len = sizeof(msg_count);
                 
 
-    snprintf(sql, sizeof(sql), 
+    switch_snprintf(sql, sizeof(sql), 
              "select count(*) from voicemail_data where user='%s' and domain='%s' and in_folder='%s' and read_epoch=0", 
              myid,
              domain_name,
@@ -1015,7 +1015,7 @@ static void message_count(vm_profile_t *profile, const char *myid, const char *d
     vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
     *total_new_messages = atoi(msg_count);
 
-    snprintf(sql, sizeof(sql), 
+    switch_snprintf(sql, sizeof(sql), 
              "select count(*) from voicemail_data where user='%s' and domain='%s' and in_folder='%s' and read_epoch=0 and read_flags='%s'", 
              myid,
              domain_name,
@@ -1024,7 +1024,7 @@ static void message_count(vm_profile_t *profile, const char *myid, const char *d
     vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
     *total_new_urgent_messages = atoi(msg_count);
 
-    snprintf(sql, sizeof(sql), 
+    switch_snprintf(sql, sizeof(sql), 
              "select count(*) from voicemail_data where user='%s' and domain='%s' and in_folder='%s' and read_epoch!=0", 
              myid,
              domain_name,
@@ -1033,7 +1033,7 @@ static void message_count(vm_profile_t *profile, const char *myid, const char *d
     *total_saved_messages = atoi(msg_count);
 
 
-    snprintf(sql, sizeof(sql), 
+    switch_snprintf(sql, sizeof(sql), 
              "select count(*) from voicemail_data where user='%s' and domain='%s' and in_folder='%s' and read_epoch!=0 and read_flags='%s'", 
              myid,
              domain_name,
@@ -1063,7 +1063,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
         args.input_callback = cancel_on_dtmf;
 
 
-        snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s", 
+        switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s", 
                  profile->listen_file_key,
                  profile->save_file_key,
                  profile->delete_file_key,
@@ -1071,7 +1071,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
                  profile->callback_key);
 
 
-        snprintf(input, sizeof(input), "%s:%d", cbt->type == MSG_NEW ? "new" : "saved", cbt->want+1);
+        switch_snprintf(input, sizeof(input), "%s:%d", cbt->type == MSG_NEW ? "new" : "saved", cbt->want+1);
         memset(&cc, 0, sizeof(cc));
         cc.profile = profile;
         args.buf = &cc;
@@ -1141,13 +1141,13 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
                     switch_time_exp_lt(&tm, atoi(cbt->created_epoch) * 1000000);
                     switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
 
-                    snprintf(tmp,sizeof(tmp), "%d", total_new_messages);
+                    switch_snprintf(tmp,sizeof(tmp), "%d", total_new_messages);
                     switch_channel_set_variable(channel, "voicemail_total_new_messages", tmp);
-                    snprintf(tmp,sizeof(tmp), "%d", total_saved_messages);
+                    switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_messages);
                     switch_channel_set_variable(channel, "voicemail_total_saved_messages", tmp);
-                    snprintf(tmp,sizeof(tmp), "%d", total_new_urgent_messages);
+                    switch_snprintf(tmp,sizeof(tmp), "%d", total_new_urgent_messages);
                     switch_channel_set_variable(channel, "voicemail_urgent_new_messages", tmp);
-                    snprintf(tmp,sizeof(tmp), "%d", total_saved_urgent_messages);
+                    switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_urgent_messages);
                     switch_channel_set_variable(channel, "voicemail_urgent_saved_messages", tmp);
                     switch_channel_set_variable(channel, "voicemail_current_folder", cbt->in_folder);
                     switch_channel_set_variable(channel, "voicemail_account", cbt->user);
@@ -1157,7 +1157,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
                     switch_channel_set_variable(channel, "voicemail_file_path", cbt->file_path);
                     switch_channel_set_variable(channel, "voicemail_read_flags", cbt->read_flags);
                     switch_channel_set_variable(channel, "voicemail_time", date);
-                    snprintf(tmp,sizeof(tmp), "%d", priority);
+                    switch_snprintf(tmp,sizeof(tmp), "%d", priority);
                     switch_channel_set_variable(channel, "voicemail_priority", tmp);
                     message_len = atoi(cbt->message_len);
 
@@ -1166,7 +1166,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
                     duration.day += duration.yr * 365;
                     duration.hr += duration.day * 24;
                     
-                    snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", 
+                    switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", 
                              duration.hr,
                              duration.min,
                              duration.sec
@@ -1310,12 +1310,12 @@ static void voicemail_check_main(switch_core_session_t *session, const char *pro
 
 
                 if (total_new_urgent_messages > 0) {
-                    snprintf(msg_count, sizeof(msg_count), "%d:urgent-new", total_new_urgent_messages);
+                    switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-new", total_new_urgent_messages);
                     TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
                     informed++;
                 }
                 if (total_new_messages > 0 && total_new_messages != total_new_urgent_messages) {
-                    snprintf(msg_count, sizeof(msg_count), "%d:new", total_new_messages);
+                    switch_snprintf(msg_count, sizeof(msg_count), "%d:new", total_new_messages);
                     TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
                     informed++;
                 }
@@ -1328,13 +1328,13 @@ static void voicemail_check_main(switch_core_session_t *session, const char *pro
                 }
                 
                 if (total_saved_urgent_messages > 0) {
-                    snprintf(msg_count, sizeof(msg_count), "%d:urgent-saved", total_saved_urgent_messages);
+                    switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-saved", total_saved_urgent_messages);
                     TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
                     informed++;
                 }
 
                 if (total_saved_messages > 0 && total_saved_messages != total_saved_urgent_messages) {
-                    snprintf(msg_count, sizeof(msg_count), "%d:saved", total_saved_messages);
+                    switch_snprintf(msg_count, sizeof(msg_count), "%d:saved", total_saved_messages);
                     TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
                     informed++;
                 }
@@ -1347,7 +1347,7 @@ static void voicemail_check_main(switch_core_session_t *session, const char *pro
                 }
                 
                 if (!informed) {
-                    snprintf(msg_count, sizeof(msg_count), "0:new");
+                    switch_snprintf(msg_count, sizeof(msg_count), "0:new");
                     TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
                     informed++;
                 }
@@ -1368,7 +1368,7 @@ static void voicemail_check_main(switch_core_session_t *session, const char *pro
                 switch(play_msg_type) {
                 case MSG_NEW:
                     {
-                        snprintf(sql, sizeof(sql),
+                        switch_snprintf(sql, sizeof(sql),
                                  "select * from voicemail_data where user='%s' and domain='%s' and read_epoch=0 order by read_flags", myid, domain_name);
                         total_messages = total_new_messages;
                         heard_auto_new = heard_auto_saved = 1;
@@ -1377,7 +1377,7 @@ static void voicemail_check_main(switch_core_session_t *session, const char *pro
                 case MSG_SAVED:
                 default:
                     {
-                        snprintf(sql, sizeof(sql),
+                        switch_snprintf(sql, sizeof(sql),
                                  "select * from voicemail_data where user='%s' and domain='%s' and read_epoch !=0 order by read_flags", myid, domain_name);
                         total_messages = total_saved_messages;
                         heard_auto_new = heard_auto_saved = 1;                        
@@ -1394,12 +1394,12 @@ static void voicemail_check_main(switch_core_session_t *session, const char *pro
                         break;
                     }
                 }
-                snprintf(sql, sizeof(sql), "update voicemail_data set read_epoch=%ld where user='%s' and domain='%s' and flags='save'", 
+                switch_snprintf(sql, sizeof(sql), "update voicemail_data set read_epoch=%ld where user='%s' and domain='%s' and flags='save'", 
                          (long)time(NULL), myid, domain_name);
                 vm_execute_sql(profile, sql, profile->mutex);
-                snprintf(sql, sizeof(sql), "select file_path from voicemail_data where user='%s' and domain='%s' and flags='delete'", myid, domain_name);
+                switch_snprintf(sql, sizeof(sql), "select file_path from voicemail_data where user='%s' and domain='%s' and flags='delete'", myid, domain_name);
                 vm_execute_sql_callback(profile, profile->mutex, sql, unlink_callback, NULL);
-                snprintf(sql, sizeof(sql), "delete from voicemail_data where user='%s' and domain='%s' and flags='delete'", myid, domain_name);
+                switch_snprintf(sql, sizeof(sql), "delete from voicemail_data where user='%s' and domain='%s' and flags='delete'", myid, domain_name);
                 vm_execute_sql(profile, sql, profile->mutex);
                 vm_check_state = VM_CHECK_FOLDER_SUMMARY;
             }
@@ -1425,7 +1425,7 @@ static void voicemail_check_main(switch_core_session_t *session, const char *pro
                     switch_safe_free(sql);
                 }
 
-                snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s", 
+                switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s", 
                          profile->record_greeting_key, 
                          profile->choose_greeting_key, 
                          profile->record_name_key,
@@ -1506,7 +1506,7 @@ static void voicemail_check_main(switch_core_session_t *session, const char *pro
                 char key_buf[80] = "";
                 play_msg_type = MSG_NONE;
                 
-                snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s", 
+                switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s", 
                          profile->play_new_messages_key, 
                          profile->play_saved_messages_key,
                          profile->config_menu_key,
@@ -1789,7 +1789,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, cons
         }
     }
 
-    snprintf(sql, sizeof(sql), 
+    switch_snprintf(sql, sizeof(sql), 
              "select * from voicemail_prefs where user='%s' and domain='%s'", 
              id,
              domain_name);
@@ -1874,7 +1874,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, cons
     if ((status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) && switch_channel_ready(channel)) {
         char input[10] = "", key_buf[80] = "", term = 0;
 
-        snprintf(key_buf, sizeof(key_buf), "%s:%s", 
+        switch_snprintf(key_buf, sizeof(key_buf), "%s:%s", 
                  profile->urgent_key,
                  profile->terminator_key);
 
@@ -1946,13 +1946,13 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, cons
         switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
 
         switch_channel_set_variable(channel, "voicemail_current_folder", myfolder);
-        snprintf(tmp,sizeof(tmp), "%d", total_new_messages);
+        switch_snprintf(tmp,sizeof(tmp), "%d", total_new_messages);
         switch_channel_set_variable(channel, "voicemail_total_new_messages", tmp);
-        snprintf(tmp,sizeof(tmp), "%d", total_saved_messages);
+        switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_messages);
         switch_channel_set_variable(channel, "voicemail_total_saved_messages", tmp);
-        snprintf(tmp,sizeof(tmp), "%d", total_new_urgent_messages);
+        switch_snprintf(tmp,sizeof(tmp), "%d", total_new_urgent_messages);
         switch_channel_set_variable(channel, "voicemail_urgent_new_messages", tmp);
-        snprintf(tmp,sizeof(tmp), "%d", total_saved_urgent_messages);
+        switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_urgent_messages);
         switch_channel_set_variable(channel, "voicemail_urgent_saved_messages", tmp);
         switch_channel_set_variable(channel, "voicemail_account", id);
         switch_channel_set_variable(channel, "voicemail_domain", domain_name);
@@ -1961,7 +1961,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, cons
         switch_channel_set_variable(channel, "voicemail_file_path", file_path);
         switch_channel_set_variable(channel, "voicemail_read_flags", read_flags);
         switch_channel_set_variable(channel, "voicemail_time", date);
-        snprintf(tmp,sizeof(tmp), "%d", priority);
+        switch_snprintf(tmp,sizeof(tmp), "%d", priority);
         switch_channel_set_variable(channel, "voicemail_priority", tmp);
         switch_channel_set_variable(channel, "voicemail_email", email_vm);
 
@@ -1971,7 +1971,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, cons
         switch_core_measure_time(l_duration, &duration);
         duration.day += duration.yr * 365;
         duration.hr += duration.day * 24;
-        snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
+        switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
                  duration.hr,
                  duration.min,
                  duration.sec
@@ -2366,7 +2366,7 @@ static int web_callback(void *pArg, int argc, char **argv, char **columnNames)
     duration.day += duration.yr * 365;
     duration.hr += duration.day * 24;
 
-    snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", 
+    switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", 
              duration.hr,
              duration.min,
              duration.sec
@@ -2383,7 +2383,7 @@ static int web_callback(void *pArg, int argc, char **argv, char **columnNames)
         switch_strftime(read_date, &retsize, sizeof(read_date), fmt, &tm);
     }
 
-    snprintf(heard, sizeof(heard), *read_date == '\0' ? "never" : read_date);
+    switch_snprintf(heard, sizeof(heard), *read_date == '\0' ? "never" : read_date);
 
     get = switch_mprintf("http://%s:%s%s/get/%s", holder->host, holder->port, holder->uri, fname);
     del = switch_mprintf("http://%s:%s%s/del/%s", holder->host, holder->port, holder->uri, fname);
@@ -2397,7 +2397,7 @@ static int web_callback(void *pArg, int argc, char **argv, char **columnNames)
                                    //"<a href=%s>Delete This Message</a><br><hr noshade size=1>", 
                                    strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", create_date, heard, duration_str);
 
-    snprintf(title_b4, sizeof(title_b4), "%s <%s> %s", argv[5], argv[6], rss_date);
+    switch_snprintf(title_b4, sizeof(title_b4), "%s <%s> %s", argv[5], argv[6], rss_date);
     switch_url_encode(title_b4, title_aft, sizeof(title_aft)-1);
 
 
@@ -2455,7 +2455,7 @@ static int rss_callback(void *pArg, int argc, char **argv, char **columnNames)
     duration.day += duration.yr * 365;
     duration.hr += duration.day * 24;
 
-    snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", 
+    switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", 
              duration.hr,
              duration.min,
              duration.sec
@@ -2481,7 +2481,7 @@ static int rss_callback(void *pArg, int argc, char **argv, char **columnNames)
 
     x_tmp = switch_xml_add_child_d(holder->x_item, "description", 0);
 
-    snprintf(heard, sizeof(heard), *read_date == '\0' ? "never" : read_date);
+    switch_snprintf(heard, sizeof(heard), *read_date == '\0' ? "never" : read_date);
     
     if ((fname = strrchr(argv[8], '/'))) {
         fname++;
index 676a4bb69654d24bfe3a523f8545ec406aa003af..36a3ccb157948cf1438e85c8b474bbc176dd36b2 100644 (file)
@@ -134,7 +134,7 @@ static switch_status_t cepstral_speech_open(switch_speech_handle_t *sh, char *vo
 
        cepstral->params = swift_params_new(NULL);
        swift_params_set_string(cepstral->params, "audio/encoding", "pcm16");
-       snprintf(srate, sizeof(srate), "%d", rate);
+       switch_snprintf(srate, sizeof(srate), "%d", rate);
        swift_params_set_string(cepstral->params, "audio/sampling-rate", srate);
 
 
index 640a0625cca81a90aa274e168c824ed7807fcf7c..ac493b4cdd255da26b464f3ded7de74783b45127 100644 (file)
@@ -203,7 +203,7 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_
                        context->enc_mode = globals.default_bitrate;
                }
 
-               snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode);
+               switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode);
                codec->fmtp_out = switch_core_strdup(codec->memory_pool, fmtptmp);
 
                context->enc_mode = AMR_DEFAULT_BITRATE;
index fd37d4b577af007e73fc78088c8e74f9b9a8f730..a66cd91be970d4b130c53e9c2a3827bab7c58066 100644 (file)
@@ -113,9 +113,9 @@ SWITCH_STANDARD_DIALPLAN(directory_dialplan_hunt)
                return NULL;
        }
 
-       snprintf(filter, sizeof(filter), "exten=%s", caller_profile->destination_number);
+       switch_snprintf(filter, sizeof(filter), "exten=%s", caller_profile->destination_number);
        if (caller_profile->context) {
-               snprintf(filter + strlen(filter), sizeof(filter) - strlen(filter), "context=%s", caller_profile->context);
+               switch_snprintf(filter + strlen(filter), sizeof(filter) - strlen(filter), "context=%s", caller_profile->context);
        }
 
 
index 93caada71b66f031095fac607cd05bfa22571947..939ee16229066cc9fd44fd209baea940ee18c0c8 100644 (file)
@@ -1643,7 +1643,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                        *p++ = '\0';
                        u = profile_name;
                        profile_name = p;
-                       snprintf(ubuf, sizeof(ubuf), "%s@%s/talk", u, profile_name);
+                       switch_snprintf(ubuf, sizeof(ubuf), "%s@%s/talk", u, profile_name);
                        user = ubuf;
                }
 
@@ -1661,10 +1661,10 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                                        }
 
                                        if (strchr(id_num, '@')) {
-                                               snprintf(ubuf, sizeof(ubuf), "%s/talk", id_num);
+                                               switch_snprintf(ubuf, sizeof(ubuf), "%s/talk", id_num);
                                                user = ubuf;
                                        } else {
-                                               snprintf(ubuf, sizeof(ubuf), "%s@%s/talk", id_num, profile_name);
+                                               switch_snprintf(ubuf, sizeof(ubuf), "%s@%s/talk", id_num, profile_name);
                                                user = ubuf;
                                        }
                                }
@@ -1713,7 +1713,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                if (outbound_profile) {
                        char name[128];
 
-                       snprintf(name, sizeof(name), "DingaLing/%s", outbound_profile->destination_number);
+                       switch_snprintf(name, sizeof(name), "DingaLing/%s", outbound_profile->destination_number);
                        switch_channel_set_name(channel, name);
 
                        caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
@@ -2198,7 +2198,7 @@ static switch_status_t load_config(void)
                        profile->message = "";
                        profile->user_flags |= LDL_FLAG_COMPONENT;
                        switch_mutex_init(&profile->mutex, SWITCH_MUTEX_NESTED, module_pool);
-                       snprintf(dbname, sizeof(dbname), "dingaling_%s", profile->name);
+                       switch_snprintf(dbname, sizeof(dbname), "dingaling_%s", profile->name);
                        profile->dbname = switch_core_strdup(module_pool, dbname);
 
 
@@ -2670,7 +2670,7 @@ static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlses
                                                                                                                                                          context,
                                                                                                                                                          exten)) != 0) {
                                                char name[128];
-                                               snprintf(name, sizeof(name), "DingaLing/%s", tech_pvt->caller_profile->destination_number);
+                                               switch_snprintf(name, sizeof(name), "DingaLing/%s", tech_pvt->caller_profile->destination_number);
                                                switch_channel_set_name(channel, name);
                                                switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
                                        }
index 89b8a899b408169388665f341855ed67870fa36a..d4cfe5676a7d645359ab01f83df65d6b7049ba12 100644 (file)
@@ -810,7 +810,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                if (outbound_profile) {
                        char name[128];
 
-                       snprintf(name, sizeof(name), "IAX/%s-%04x", outbound_profile->destination_number, rand() & 0xffff);
+                       switch_snprintf(name, sizeof(name), "IAX/%s-%04x", outbound_profile->destination_number, rand() & 0xffff);
                        switch_channel_set_name(channel, name);
 
                        caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
@@ -1131,7 +1131,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime)
                                                                                                                                                                  iaxevent->ies.called_context,
                                                                                                                                                                  iaxevent->ies.called_number)) != 0) {
                                                        char name[128];
-                                                       snprintf(name, sizeof(name), "IAX/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
+                                                       switch_snprintf(name, sizeof(name), "IAX/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
                                                        switch_channel_set_name(channel, name);
                                                        switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
 
index b21d91df4248c30e5b36e512fe7924058f8e992f..6fd18e17e228ac7d92e4828977828cdddfffddc6 100644 (file)
@@ -249,7 +249,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
                                char buf[512];
                                switch_event_t *event;
 
-                               snprintf(buf, sizeof(buf), "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id);
+                               switch_snprintf(buf, sizeof(buf), "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id);
 
                                if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_RINGING) == SWITCH_STATUS_SUCCESS) {
                                        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_info", "%s", buf);
@@ -365,7 +365,7 @@ static void add_pvt(private_t * tech_pvt, int master)
        switch_mutex_lock(globals.pvt_lock);
 
        if (switch_strlen_zero(tech_pvt->call_id)) {
-               snprintf(tech_pvt->call_id, sizeof(tech_pvt->call_id), "%d", ++globals.call_id);
+               switch_snprintf(tech_pvt->call_id, sizeof(tech_pvt->call_id), "%d", ++globals.call_id);
                switch_core_hash_insert(globals.call_hash, tech_pvt->call_id, tech_pvt);
                switch_core_session_set_read_codec(tech_pvt->session, &globals.read_codec);
                switch_core_session_set_write_codec(tech_pvt->session, &globals.write_codec);
@@ -766,7 +766,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                if (outbound_profile) {
                        char name[128];
                        const char *id = !switch_strlen_zero(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na";
-                       snprintf(name, sizeof(name), "PortAudio/%s", id);
+                       switch_snprintf(name, sizeof(name), "PortAudio/%s", id);
 
                        switch_channel_set_name(channel, name);
 
@@ -1611,7 +1611,7 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t
                                                                                                                                  ip, NULL, NULL, NULL, modname, NULL,
                                                                                                                                  dest)) != 0) {
                        char name[128];
-                       snprintf(name, sizeof(name), "PortAudio/%s",
+                       switch_snprintf(name, sizeof(name), "PortAudio/%s",
                                         tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->destination_number : modname);
                        switch_channel_set_name(channel, name);
 
@@ -1689,19 +1689,19 @@ SWITCH_STANDARD_API(pa_cmd)
 
                if (action) {
                        if (strlen(action) == 1) {
-                               snprintf(cmd_buf, sizeof(cmd_buf), "dtmf %s", action);
+                               switch_snprintf(cmd_buf, sizeof(cmd_buf), "dtmf %s", action);
                                cmd = cmd_buf;
                        } else if (!strcmp(action, "mute")) {
-                               snprintf(cmd_buf, sizeof(cmd_buf), "flags off mouth");
+                               switch_snprintf(cmd_buf, sizeof(cmd_buf), "flags off mouth");
                                cmd = cmd_buf;
                        } else if (!strcmp(action, "unmute")) {
-                               snprintf(cmd_buf, sizeof(cmd_buf), "flags on mouth");
+                               switch_snprintf(cmd_buf, sizeof(cmd_buf), "flags on mouth");
                                cmd = cmd_buf;
                        } else if (!strcmp(action, "switch")) {
-                               snprintf(cmd_buf, sizeof(cmd_buf), "switch %s", wcmd);
+                               switch_snprintf(cmd_buf, sizeof(cmd_buf), "switch %s", wcmd);
                                cmd = cmd_buf;
                        } else if (!strcmp(action, "call")) {
-                               snprintf(cmd_buf, sizeof(cmd_buf), "call %s", wcmd);
+                               switch_snprintf(cmd_buf, sizeof(cmd_buf), "call %s", wcmd);
                                cmd = cmd_buf;
                        } else if (!strcmp(action, "hangup") || !strcmp(action, "list") || !strcmp(action, "answer")) {
                                cmd = action;
index 257b2cdcf6fbd8c2588931722fb2e04bc399308c..630ca77e29843b5fb1e3e16a77ffb61407189df4 100644 (file)
@@ -1524,7 +1524,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
                if ((dest_to = strchr(dest, '^'))) {
                        *dest_to++ = '\0';
                        tech_pvt->dest_to = switch_core_session_alloc(nsession, strlen(dest_to) + 5);
-                       snprintf(tech_pvt->dest_to, strlen(dest_to) + 5, "sip:%s", dest_to);
+                       switch_snprintf(tech_pvt->dest_to, strlen(dest_to) + 5, "sip:%s", dest_to);
                }
 
                if ((host = strchr(dest, '%'))) {
@@ -1557,7 +1557,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
                        }
                } else {
                        tech_pvt->dest = switch_core_session_alloc(nsession, strlen(dest) + 5);
-                       snprintf(tech_pvt->dest, strlen(dest) + 5, "sip:%s", dest);
+                       switch_snprintf(tech_pvt->dest, strlen(dest) + 5, "sip:%s", dest);
                }
        }
 
index 7ddbc9b4fccfaaabfb1b8577eb88fa9d49993159..ec25753006352299d9c9359c7eea49a6878536c4 100644 (file)
@@ -741,7 +741,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
                return status;
        }
 
-       snprintf(url, sizeof(url), "profile=%s", switch_str_nil(profile_name));
+       switch_snprintf(url, sizeof(url), "profile=%s", switch_str_nil(profile_name));
 
        if (!(xml = switch_xml_open_cfg(cf, &cfg, url))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
@@ -796,7 +796,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                profile->user_agent = SOFIA_USER_AGENT;
 
                                profile->name = switch_core_strdup(profile->pool, xprofilename);
-                               snprintf(url, sizeof(url), "sofia_reg_%s", xprofilename);
+                               switch_snprintf(url, sizeof(url), "sofia_reg_%s", xprofilename);
                                
                                profile->dbname = switch_core_strdup(profile->pool, url);
                                switch_core_hash_init(&profile->chat_hash, profile->pool);
@@ -1457,7 +1457,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
                                if (switch_test_flag(tech_pvt, TFLAG_NOHUP)) {
                                        switch_clear_flag_locked(tech_pvt, TFLAG_NOHUP);
                                } else {
-                                       snprintf(st, sizeof(st), "%d", status);
+                                       switch_snprintf(st, sizeof(st), "%d", status);
                                        switch_channel_set_variable(channel, "sip_term_status", st);
                                        switch_channel_hangup(channel, sofia_glue_sip_cause_to_freeswitch(status));
                                }
@@ -2034,7 +2034,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
 
        if (sip->sip_max_forwards) {
                char max_forwards[32];
-               snprintf(max_forwards, sizeof(max_forwards), "%lu", sip->sip_max_forwards->mf_count);
+               switch_snprintf(max_forwards, sizeof(max_forwards), "%lu", sip->sip_max_forwards->mf_count);
                switch_channel_set_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE, max_forwards);
        }
 
index 3266f8ca05f01b441d9d896bde336e32155f0162..142a7c6a6378b95cc288b702d5c0d16bfb39bf38 100644 (file)
@@ -81,7 +81,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
 
        tech_pvt->session_id++;
        
-       snprintf(buf, sizeof(buf),
+       switch_snprintf(buf, sizeof(buf),
                         "v=0\n"
                         "o=FreeSWITCH %010u %010u IN IP4 %s\n"
                         "s=FreeSWITCH\n" 
@@ -90,7 +90,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
                         "m=audio %d RTP/AVP", tech_pvt->owner_id, tech_pvt->session_id, ip, ip, sr, port);
        
        if (tech_pvt->rm_encoding) {
-               snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt);
+               switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt);
        } else if (tech_pvt->num_codecs) {
                int i;
                int already_did[128] = { 0 };
@@ -109,7 +109,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
                                already_did[imp->ianacode] = 1;
                        }
 
-                       snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode);
+                       switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode);
                        if (!ptime) {
                                ptime = imp->microseconds_per_frame / 1000;
                        }
@@ -117,20 +117,20 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
        }
 
        if (tech_pvt->te > 95) {
-               snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te);
+               switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te);
        }
        
        if (tech_pvt->cng_pt && use_cng) {
-               snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt);
+               switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt);
        }
 
-       snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n");
+       switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n");
 
        if (tech_pvt->rm_encoding) {
                rate = tech_pvt->rm_rate;
-               snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", tech_pvt->pt, tech_pvt->rm_encoding, rate);
+               switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", tech_pvt->pt, tech_pvt->rm_encoding, rate);
                if (tech_pvt->fmtp_out) {
-                       snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->pt, tech_pvt->fmtp_out);
+                       switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->pt, tech_pvt->fmtp_out);
                }
                if (tech_pvt->read_codec.implementation && !ptime) {
                        ptime = tech_pvt->read_codec.implementation->microseconds_per_frame / 1000;
@@ -159,38 +159,38 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
                        if (ptime && ptime != imp->microseconds_per_frame / 1000) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ptime %u != advertised ptime %u\n", imp->microseconds_per_frame / 1000, ptime);
                        }
-                       snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, rate);
+                       switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, rate);
                        if (imp->fmtp) {
-                               snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp);
+                               switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp);
                        }
                }
        }
 
        if (tech_pvt->te > 95) {
-               snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te);
+               switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te);
        }
        if (tech_pvt->cng_pt && use_cng) {
-               snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/8000\n", tech_pvt->cng_pt);
+               switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/8000\n", tech_pvt->cng_pt);
                if (!tech_pvt->rm_encoding) {
                        tech_pvt->cng_pt = 0;
                }
        } else {
-               snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=silenceSupp:off - - - -\n");
+               switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=silenceSupp:off - - - -\n");
        }
        if (ptime) {
-               snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=ptime:%d\n", ptime);
+               switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=ptime:%d\n", ptime);
        }
 
        if (switch_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding) {
                sofia_glue_tech_choose_video_port(tech_pvt);
                if ((v_port = tech_pvt->adv_sdp_video_port)) {
-                       snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=video %d RTP/AVP", v_port);
+                       switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=video %d RTP/AVP", v_port);
                        
                        sofia_glue_tech_set_video_codec(tech_pvt, 0);   
 
                        /*****************************/
                        if (tech_pvt->video_rm_encoding) {
-                               snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->video_pt);
+                               switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->video_pt);
                        } else if (tech_pvt->num_codecs) {
                                int i;
                                int already_did[128] = { 0 };
@@ -208,20 +208,20 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
                                                already_did[imp->ianacode] = 1;
                                        }
                                        
-                                       snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode);
+                                       switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode);
                                        if (!ptime) {
                                                ptime = imp->microseconds_per_frame / 1000;
                                        }
                                }
                        }
 
-                       snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n");
+                       switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n");
 
                        if (tech_pvt->rm_encoding) {
                                rate = tech_pvt->video_rm_rate;
-                               snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->video_pt, tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate);
+                               switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->video_pt, tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate);
                                if (tech_pvt->video_fmtp_out) {
-                                       snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->video_pt, tech_pvt->video_fmtp_out);
+                                       switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->video_pt, tech_pvt->video_fmtp_out);
                                }
                        } else if (tech_pvt->num_codecs) {
                                int i;
@@ -244,9 +244,9 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
                                                rate = imp->samples_per_second;
                                        }
 
-                                       snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, imp->samples_per_second);
+                                       switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, imp->samples_per_second);
                                        if (imp->fmtp) {
-                                               snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp);
+                                               switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp);
                                        }
                                }
                        }
@@ -358,7 +358,7 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t *
        switch_core_session_set_private(session, tech_pvt);
 
 
-       snprintf(name, sizeof(name), "sofia/%s/%s", profile->name, channame);
+       switch_snprintf(name, sizeof(name), "sofia/%s/%s", profile->name, channame);
        switch_channel_set_name(tech_pvt->channel, name);
 }
 
@@ -414,7 +414,7 @@ switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt)
        tech_pvt->adv_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, ip);
        tech_pvt->adv_sdp_audio_port = sdp_port;
 
-       snprintf(tmp, sizeof(tmp), "%d", sdp_port);
+       switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port);
        switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
        switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, tmp);
 
@@ -446,7 +446,7 @@ switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt)
 
        tech_pvt->adv_sdp_video_port = sdp_port;
 
-       snprintf(tmp, sizeof(tmp), "%d", sdp_port);
+       switch_snprintf(tmp, sizeof(tmp), "%d", sdp_port);
        switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
        switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_PORT_VARIABLE, tmp);
 
@@ -660,7 +660,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                if ((host = strchr(user, '@'))) {
                        *host++ = '\0';
                }
-               snprintf(hash_key, sizeof(hash_key), "%s%s%s", user, host, cid_num);
+               switch_snprintf(hash_key, sizeof(hash_key), "%s%s%s", user, host, cid_num);
 
                tech_pvt->chat_from = tech_pvt->from_str;
                tech_pvt->chat_to = tech_pvt->dest;
@@ -991,7 +991,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
                                          tech_pvt->agreed_pt,
                                          tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
 
-       snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
+       switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
        switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
        switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, tmp);
 
@@ -1358,7 +1358,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
                                        char tmp[80];
                                        int num;
 
-                                       snprintf(tmp, sizeof(tmp), "%s@%uk@%ui", near_match->iananame, near_match->samples_per_second, ptime);
+                                       switch_snprintf(tmp, sizeof(tmp), "%s@%uk@%ui", near_match->iananame, near_match->samples_per_second, ptime);
                                        
                                        prefs[0] = tmp;
                                        num = switch_loadable_module_get_codecs_sorted(search, 1, prefs, 1);
@@ -1385,7 +1385,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
                                        tech_pvt->rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp);
                                        tech_pvt->remote_sdp_audio_port = (switch_port_t) m->m_port;
                                        tech_pvt->agreed_pt = (switch_payload_t) map->rm_pt;
-                                       snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
+                                       switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
                                        switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip);
                                        switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp);
 
@@ -1467,7 +1467,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
                                                tech_pvt->video_rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp);
                                                tech_pvt->remote_sdp_video_port = (switch_port_t) m->m_port;
                                                tech_pvt->video_agreed_pt = (switch_payload_t) map->rm_pt;
-                                               snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_video_port);
+                                               switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_video_port);
                                                switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_VIDEO_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip);
                                                switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_VIDEO_PORT_VARIABLE, tmp);
                                        } else {
index 05c61d13a70a9d3b1ae228c1ed02db65298684c4..dd943552e5c4dfe7978e9c99f8c62f13226e0467 100644 (file)
@@ -958,7 +958,7 @@ void sofia_presence_set_hash_key(char *hash_key, int32_t len, sip_t const *sip)
 {
        url_t *to = sip->sip_to->a_url;
        url_t *from = sip->sip_from->a_url;
-       snprintf(hash_key, len, "%s%s%s", from->url_user, from->url_host, to->url_user);
+       switch_snprintf(hash_key, len, "%s%s%s", from->url_user, from->url_host, to->url_user);
 }
 
 void sofia_presence_handle_sip_i_message(int status,
index f77c2ad79b964bcf3e2e355d15a483ad2f67704c..9bd7c94fd2457f9bf3d11f95da5510b9aaf80e3e 100644 (file)
@@ -159,7 +159,7 @@ int sofia_reg_nat_callback(void *pArg, int argc, char **argv, char **columnNames
        char *contact = NULL;
        char to[128] = "";
 
-       snprintf(to, sizeof(to), "%s@%s", argv[1], argv[2]);
+       switch_snprintf(to, sizeof(to), "%s@%s", argv[1], argv[2]);
        contact = sofia_glue_get_url_from_contact(argv[3], 1);
 
        nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(contact), SIPTAG_CONTACT_STR(profile->url), TAG_END());
@@ -211,9 +211,9 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now)
 #endif
 
        if (now) {
-               snprintf(sql, sizeof(sql), "select '%s',* from sip_registrations where expires > 0 and expires <= %ld", profile->name, (long) now);
+               switch_snprintf(sql, sizeof(sql), "select '%s',* from sip_registrations where expires > 0 and expires <= %ld", profile->name, (long) now);
        } else {
-               snprintf(sql, sizeof(sql), "select '%s',* from sip_registrations where expires > 0", profile->name);
+               switch_snprintf(sql, sizeof(sql), "select '%s',* from sip_registrations where expires > 0", profile->name);
        }
 
        switch_mutex_lock(profile->ireg_mutex);
@@ -224,26 +224,26 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now)
                                                                        sofia_reg_del_callback,
                                                                        NULL);
        if (now) {
-               snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and expires <= %ld", (long) now);
+               switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and expires <= %ld", (long) now);
        } else {
-               snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0");
+               switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0");
        }
        sofia_glue_execute_sql(profile, SWITCH_TRUE, sql, NULL);
        if (now) {
-               snprintf(sql, sizeof(sql), "delete from sip_authentication where expires > 0 and expires <= %ld", (long) now);
+               switch_snprintf(sql, sizeof(sql), "delete from sip_authentication where expires > 0 and expires <= %ld", (long) now);
        } else {
-               snprintf(sql, sizeof(sql), "delete from sip_authentication where expires > 0");
+               switch_snprintf(sql, sizeof(sql), "delete from sip_authentication where expires > 0");
        }
        sofia_glue_execute_sql(profile, SWITCH_TRUE, sql, NULL);
        if (now) {
-               snprintf(sql, sizeof(sql), "delete from sip_subscriptions where expires > 0 and expires <= %ld", (long) now);
+               switch_snprintf(sql, sizeof(sql), "delete from sip_subscriptions where expires > 0 and expires <= %ld", (long) now);
        } else {
-               snprintf(sql, sizeof(sql), "delete from sip_subscriptions where expires > 0");
+               switch_snprintf(sql, sizeof(sql), "delete from sip_subscriptions where expires > 0");
        }
        sofia_glue_execute_sql(profile, SWITCH_TRUE, sql, NULL);
 
        if (now) {
-               snprintf(sql, sizeof(sql), "select * from sip_registrations where status like '%%NATHACK%%'");
+               switch_snprintf(sql, sizeof(sql), "select * from sip_registrations where status like '%%NATHACK%%'");
                sofia_glue_execute_sql_callback(profile,
                                                                                SWITCH_TRUE,
                                                                                NULL,
@@ -269,9 +269,9 @@ char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const c
        cbt.len = len;
 
        if (host) {
-               snprintf(val, len, "select contact from sip_registrations where sip_user='%s' and sip_host='%s'", user, host);
+               switch_snprintf(val, len, "select contact from sip_registrations where sip_user='%s' and sip_host='%s'", user, host);
        } else {
-               snprintf(val, len, "select contact from sip_registrations where sip_user='%s'", user);
+               switch_snprintf(val, len, "select contact from sip_registrations where sip_user='%s'", user);
        }
 
 
@@ -385,10 +385,10 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han
                }
 
                if (contact->m_url->url_params) {
-                       snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%s;%s>",
+                       switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%s;%s>",
                                         display, contact->m_url->url_user, contact->m_url->url_host, port, contact->m_url->url_params);
                } else {
-                       snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%s>", display, contact->m_url->url_user, contact->m_url->url_host, port);
+                       switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%s>", display, contact->m_url->url_user, contact->m_url->url_host, port);
                }
        }
 
@@ -423,10 +423,10 @@ uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_han
                        if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact"))) {
                                if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-connectile-dysfunction")) {
                                        if (contact->m_url->url_params) {
-                                               snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s>",
+                                               switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s>",
                                                                 display, contact->m_url->url_user, network_ip, network_port, contact->m_url->url_params);
                                        } else {
-                                               snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d>", display, contact->m_url->url_user, network_ip, network_port);
+                                               switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d>", display, contact->m_url->url_user, network_ip, network_port);
                                        }
                                        cd = 1;
                                        exptime = 20;
@@ -709,7 +709,7 @@ void sofia_reg_handle_sip_r_challenge(int status,
                goto cancel;
        }
 
-       snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->register_username, gateway->register_password);
+       switch_snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->register_username, gateway->register_password);
 
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Authenticating '%s' with '%s'.\n", profile->username, authentication);
 
index 0562e3d88514abb4c27b716fb7fac6423baa5419..8547397e1786189fe7b9f5d2febe50323beaed76 100644 (file)
@@ -506,7 +506,7 @@ static switch_call_cause_t woomera_outgoing_channel(switch_core_session_t *sessi
                        char name[128];
                        switch_caller_profile_t *caller_profile;
 
-                       snprintf(name, sizeof(name), "Woomera/%s-%04x", outbound_profile->destination_number, rand() & 0xffff);
+                       switch_snprintf(name, sizeof(name), "Woomera/%s-%04x", outbound_profile->destination_number, rand() & 0xffff);
                        switch_channel_set_name(channel, name);
 
                        caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
@@ -1089,7 +1089,7 @@ static void *woomera_channel_thread_run(switch_thread_t * thread, void *obj)
                                                                                                                                                  NULL,
                                                                                                                                                  exten)) != 0) {
                                        char name[128];
-                                       snprintf(name, sizeof(name), "Woomera/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
+                                       switch_snprintf(name, sizeof(name), "Woomera/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
                                        switch_channel_set_name(channel, name);
                                        switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
 
index 45a538a0ff02207285091402e11fe724a3702ccb..789aab00a517b120efa17a4c2fbe0e040d86af9f 100644 (file)
@@ -217,24 +217,24 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
 
                tt_created = (time_t) (caller_profile->times->created / 1000000);
                mtt_created = (time_t) (caller_profile->times->created / 1000);
-               snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_created);
+               switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_created);
                switch_channel_set_variable(channel, "start_epoch", tmp);
-               snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
+               switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
                switch_channel_set_variable(channel, "start_uepoch", tmp);
                
                tt_answered = (time_t) (caller_profile->times->answered / 1000000);
                mtt_answered = (time_t) (caller_profile->times->answered / 1000);
-               snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_answered);
+               switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_answered);
                switch_channel_set_variable(channel, "answer_epoch", tmp);
-               snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
+               switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
                switch_channel_set_variable(channel, "answer_uepoch", tmp);             
 
 
                tt_hungup = (time_t) (caller_profile->times->hungup / 1000000);
                mtt_hungup = (time_t) (caller_profile->times->hungup / 1000);
-               snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_hungup);
+               switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_hungup);
                switch_channel_set_variable(channel, "end_epoch", tmp);
-               snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);
+               switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);
                switch_channel_set_variable(channel, "end_uepoch", tmp);
 
                uduration = caller_profile->times->hungup - caller_profile->times->created;
@@ -253,22 +253,22 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
        switch_channel_set_variable(channel, "last_arg", last_arg);
        switch_channel_set_variable(channel, "caller_id", cid_buf);
 
-       snprintf(tmp, sizeof(tmp), "%d", duration);
+       switch_snprintf(tmp, sizeof(tmp), "%d", duration);
        switch_channel_set_variable(channel, "duration", tmp);
 
-       snprintf(tmp, sizeof(tmp), "%d", billsec);
+       switch_snprintf(tmp, sizeof(tmp), "%d", billsec);
        switch_channel_set_variable(channel, "billsec", tmp);
        
-       snprintf(tmp, sizeof(tmp), "%d", mduration);
+       switch_snprintf(tmp, sizeof(tmp), "%d", mduration);
        switch_channel_set_variable(channel, "mduration", tmp);
 
-       snprintf(tmp, sizeof(tmp), "%d", billmsec);
+       switch_snprintf(tmp, sizeof(tmp), "%d", billmsec);
        switch_channel_set_variable(channel, "billmsec", tmp);
 
-       snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, uduration);
+       switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, uduration);
        switch_channel_set_variable(channel, "uduration", tmp);
 
-       snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, billusec);
+       switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, billusec);
        switch_channel_set_variable(channel, "billusec", tmp);
 
        if (globals.debug) {
@@ -395,7 +395,7 @@ static switch_status_t load_config(switch_memory_pool_t *pool)
                                        size_t len = strlen(param->txt) + 2;
                                        if (end_of(param->txt) != '\n') {
                                                tpl = switch_core_alloc(pool, len);
-                                               snprintf(tpl, len, "%s\n", param->txt);
+                                               switch_snprintf(tpl, len, "%s\n", param->txt);
                                        } else {
                                                tpl = switch_core_strdup(pool, param->txt);
                                        }
index 1a69c22e963189d95cbf69019aca3622f0f16ba2..be7c1b496ae94646dfa118aa3d0af038073c397c 100644 (file)
@@ -290,7 +290,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime)
                                                                term++;
                                                        }
                                                }
-                                               snprintf(tmpname, sizeof(tmpname), "Orig-%s", var);
+                                               switch_snprintf(tmpname, sizeof(tmpname), "Orig-%s", var);
                                                switch_event_add_header(local_event, SWITCH_STACK_BOTTOM, tmpname, "%s", val);
                                                var = term + 1;
                                        } else {
index 5b40dc721311fcc3216ea311d245f9ee77aea1e6..1d1e8491b026fd0edb562296c22896ca005b41d9 100644 (file)
@@ -450,7 +450,7 @@ static switch_status_t read_packet(listener_t * listener, switch_event_t **event
 
 
                                        if (data) {
-                                               snprintf(buf, sizeof(buf), "Content-Type: log/data\nContent-Length: %" SWITCH_SSIZE_T_FMT "\n\n", strlen(data));
+                                               switch_snprintf(buf, sizeof(buf), "Content-Type: log/data\nContent-Length: %" SWITCH_SSIZE_T_FMT "\n\n", strlen(data));
                                                len = strlen(buf);
                                                switch_socket_send(listener->sock, buf, &len);
                                                len = strlen(data);
@@ -487,7 +487,7 @@ static switch_status_t read_packet(listener_t * listener, switch_event_t **event
 
                                        len = strlen(listener->ebuf);
 
-                                       snprintf(hbuf, sizeof(hbuf), "Content-Length: %" SWITCH_SSIZE_T_FMT "\n" "Content-Type: text/event-%s\n" "\n", len, etype);
+                                       switch_snprintf(hbuf, sizeof(hbuf), "Content-Length: %" SWITCH_SSIZE_T_FMT "\n" "Content-Type: text/event-%s\n" "\n", len, etype);
 
                                        len = strlen(hbuf);
                                        switch_socket_send(listener->sock, hbuf, &len);
@@ -558,7 +558,7 @@ static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t * thread, void *obj)
                switch_size_t rlen, blen;
                char buf[1024] = "";
                rlen = strlen(reply);
-               snprintf(buf, sizeof(buf), "Content-Type: api/response\nContent-Length: %" SWITCH_SSIZE_T_FMT "\n\n", rlen);
+               switch_snprintf(buf, sizeof(buf), "Content-Type: api/response\nContent-Length: %" SWITCH_SSIZE_T_FMT "\n\n", rlen);
                blen = strlen(buf);
                switch_socket_send(acs->listener->sock, buf, &blen);
                switch_socket_send(acs->listener->sock, reply, &rlen);
@@ -590,7 +590,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
 
        if (!strncasecmp(cmd, "exit", 4)) {
                switch_clear_flag_locked(listener, LFLAG_RUNNING);
-               snprintf(reply, reply_len, "+OK bye");
+               switch_snprintf(reply, reply_len, "+OK bye");
                goto done;
        }
 
@@ -603,9 +603,9 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
 
                        if (!strcmp(prefs.password, pass)) {
                                switch_set_flag_locked(listener, LFLAG_AUTHED);
-                               snprintf(reply, reply_len, "+OK accepted");
+                               switch_snprintf(reply, reply_len, "+OK accepted");
                        } else {
-                               snprintf(reply, reply_len, "-ERR invalid");
+                               switch_snprintf(reply, reply_len, "-ERR invalid");
                                switch_clear_flag_locked(listener, LFLAG_RUNNING);
                        }
 
@@ -621,18 +621,18 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
                assert(channel != NULL);
 
                if (!strncasecmp(cmd, "connect", 7)) {
-                       snprintf(reply, reply_len, "+OK");
+                       switch_snprintf(reply, reply_len, "+OK");
                        goto done;
                } else if (!strncasecmp(cmd, "sendmsg", 7)) {
                        if (switch_test_flag(listener, LFLAG_ASYNC)) {
                                if ((status = switch_core_session_queue_private_event(listener->session, &event)) == SWITCH_STATUS_SUCCESS) {
-                                       snprintf(reply, reply_len, "+OK");
+                                       switch_snprintf(reply, reply_len, "+OK");
                                } else {
-                                       snprintf(reply, reply_len, "-ERR memory error");
+                                       switch_snprintf(reply, reply_len, "-ERR memory error");
                                }
                        } else {
                                switch_ivr_parse_event(listener->session, event);
-                               snprintf(reply, reply_len, "+OK");
+                               switch_snprintf(reply, reply_len, "+OK");
                        }
                        goto done;
                } else if (!strncasecmp(cmd, "getvar", 6)) {
@@ -648,7 +648,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
                                }
 
                        }
-                       snprintf(reply, reply_len, "%s", val);
+                       switch_snprintf(reply, reply_len, "%s", val);
                        goto done;
                } else if (!strncasecmp(cmd, "myevents", 8)) {
                        listener->event_list[SWITCH_EVENT_CHANNEL_CREATE] = 1;
@@ -674,7 +674,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
                        if (strstr(cmd, "xml") || strstr(cmd, "XML")) {
                                listener->format = EVENT_FORMAT_XML;
                        }
-                       snprintf(reply, reply_len, "+OK Events Enabled");
+                       switch_snprintf(reply, reply_len, "+OK Events Enabled");
                        goto done;
                }
 
@@ -705,7 +705,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
                }
 
                switch_event_fire(&event);
-               snprintf(reply, reply_len, "+OK");
+               switch_snprintf(reply, reply_len, "+OK");
                goto done;
        } else if (!strncasecmp(cmd, "sendmsg", 7)) {
                switch_core_session_t *session;
@@ -737,13 +737,13 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
 
                if (session) {
                        if ((status = switch_core_session_queue_private_event(session, &event)) == SWITCH_STATUS_SUCCESS) {
-                               snprintf(reply, reply_len, "+OK");
+                               switch_snprintf(reply, reply_len, "+OK");
                        } else {
-                               snprintf(reply, reply_len, "-ERR memory error");
+                               switch_snprintf(reply, reply_len, "-ERR memory error");
                        }
                        switch_core_session_rwunlock(session);
                } else {
-                       snprintf(reply, reply_len, "-ERR invalid session id [%s]", uuid);
+                       switch_snprintf(reply, reply_len, "-ERR invalid session id [%s]", uuid);
                }
 
                goto done;
@@ -764,7 +764,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
                acs.bg = 0;
 
                api_exec(NULL, (void *) &acs);
-               //snprintf(reply, reply_len, "+OK");
+               //switch_snprintf(reply, reply_len, "+OK");
 
                return SWITCH_STATUS_SUCCESS;
        } else if (!strncasecmp(cmd, "bgapi ", 6)) {
@@ -805,7 +805,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
                        switch_uuid_get(&uuid);
                        switch_uuid_format(acs->uuid_str, &uuid);
                }
-               snprintf(reply, reply_len, "+OK Job-UUID: %s", acs->uuid_str);
+               switch_snprintf(reply, reply_len, "+OK Job-UUID: %s", acs->uuid_str);
                
                return SWITCH_STATUS_SUCCESS;
        } else if (!strncasecmp(cmd, "log", 3)) {
@@ -832,9 +832,9 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
                if (ltype && ltype != SWITCH_LOG_INVALID) {
                        listener->level = ltype;
                        switch_set_flag(listener, LFLAG_LOG);
-                       snprintf(reply, reply_len, "+OK log level %s [%d]", level_s, listener->level);
+                       switch_snprintf(reply, reply_len, "+OK log level %s [%d]", level_s, listener->level);
                } else {
-                       snprintf(reply, reply_len, "-ERR invalid log level");
+                       switch_snprintf(reply, reply_len, "-ERR invalid log level");
                }
        } else if (!strncasecmp(cmd, "nolog", 5)) {
                void *pop;
@@ -842,9 +842,9 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
 
                if (switch_test_flag(listener, LFLAG_LOG)) {
                        switch_clear_flag_locked(listener, LFLAG_LOG);
-                       snprintf(reply, reply_len, "+OK no longer logging");
+                       switch_snprintf(reply, reply_len, "+OK no longer logging");
                } else {
-                       snprintf(reply, reply_len, "-ERR not loging");
+                       switch_snprintf(reply, reply_len, "-ERR not loging");
                }
        } else if (!strncasecmp(cmd, "event", 5)) {
                char *next, *cur;
@@ -894,7 +894,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
                }
 
                if (!key_count) {
-                       snprintf(reply, reply_len, "-ERR no keywords supplied");
+                       switch_snprintf(reply, reply_len, "-ERR no keywords supplied");
                        goto done;
                }
 
@@ -902,7 +902,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
                        switch_set_flag_locked(listener, LFLAG_EVENTS);
                }
 
-               snprintf(reply, reply_len, "+OK event listener enabled %s", listener->format == EVENT_FORMAT_XML ? "xml" : "plain");
+               switch_snprintf(reply, reply_len, "+OK event listener enabled %s", listener->format == EVENT_FORMAT_XML ? "xml" : "plain");
 
        } else if (!strncasecmp(cmd, "nixevent", 8)) {
                char *next, *cur;
@@ -948,7 +948,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
                }
 
                if (!key_count) {
-                       snprintf(reply, reply_len, "-ERR no keywords supplied");
+                       switch_snprintf(reply, reply_len, "-ERR no keywords supplied");
                        goto done;
                }
 
@@ -956,7 +956,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
                        switch_set_flag_locked(listener, LFLAG_EVENTS);
                }
 
-               snprintf(reply, reply_len, "+OK events nixed");
+               switch_snprintf(reply, reply_len, "+OK events nixed");
 
        } else if (!strncasecmp(cmd, "noevents", 8)) {
                void *pop;
@@ -971,9 +971,9 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
                        /* wipe the hash */
                        switch_core_hash_destroy(&listener->event_hash);
                        switch_core_hash_init(&listener->event_hash, listener->pool);
-                       snprintf(reply, reply_len, "+OK no longer listening for events");
+                       switch_snprintf(reply, reply_len, "+OK no longer listening for events");
                } else {
-                       snprintf(reply, reply_len, "-ERR not listening for events");
+                       switch_snprintf(reply, reply_len, "-ERR not listening for events");
                }
        }
 
@@ -983,7 +983,7 @@ static switch_status_t parse_command(listener_t * listener, switch_event_t *even
        }
 
        if (switch_strlen_zero(reply)) {
-               snprintf(reply, reply_len, "-ERR command not found");
+               switch_snprintf(reply, reply_len, "-ERR command not found");
        }
 
        return status;
@@ -1060,7 +1060,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t * thread, void *obj
 
                switch_safe_free(event_str);
        } else {
-               snprintf(buf, sizeof(buf), "Content-Type: auth/request\n\n");
+               switch_snprintf(buf, sizeof(buf), "Content-Type: auth/request\n\n");
 
                len = strlen(buf);
                switch_socket_send(listener->sock, buf, &len);
@@ -1079,7 +1079,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t * thread, void *obj
                                goto done;
                        }
                        if (*reply != '\0') {
-                               snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
+                               switch_snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
                                len = strlen(buf);
                                switch_socket_send(listener->sock, buf, &len);
                        }
@@ -1108,7 +1108,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t * thread, void *obj
                }
 
                if (*reply != '\0') {
-                       snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
+                       switch_snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply);
                        len = strlen(buf);
                        switch_socket_send(listener->sock, buf, &len);
                }
index c6b0729a5d50ab6feaefb24d8b2a2adf63daf9db..a5026d18fd6eed7546e429b0eb02b8d463374dde 100644 (file)
@@ -145,7 +145,7 @@ static void event_handler(switch_event_t *event)
                                        return;
                                }
 
-                               snprintf(data, len, "%s=%s", hp->name, hp->value);
+                               switch_snprintf(data, len, "%s=%s", hp->name, hp->value);
                                if (sw_text_record_add_string(text_record, data) != SW_OKAY) {
                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to add service text: %s\n", data);
                                        free(data);
index a9bf2e7c67a0d307de7e02ffe8778707396b3b5b..6a7f577ce97a515ca6e282451347d650308b4870 100644 (file)
@@ -119,7 +119,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
                                        break;
                                }
 
-                               snprintf(path_buf, sizeof(path_buf), "%s%s%s", source->location, SWITCH_PATH_SEPARATOR, fname);
+                               switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", source->location, SWITCH_PATH_SEPARATOR, fname);
 
                                if (switch_stristr(".loc", path_buf)) {
                                        if ((fd = open(path_buf, O_RDONLY)) < 0) {
index b9780b2ab4f93779ef5fb1f9994fe453634a4330..c95b04cad36e3f0c0d8e14d4c203d7cde049239d 100644 (file)
@@ -880,13 +880,13 @@ static switch_status_t sm_load_module(const char *dir, const char *fname)
                        len += strlen(file);
                        len += 4;
                        path = (char *) switch_core_alloc(module_manager.pool, len);
-                       snprintf(path, len, "%s%s%s", dir, SWITCH_PATH_SEPARATOR, file);
+                       switch_snprintf(path, len, "%s%s%s", dir, SWITCH_PATH_SEPARATOR, file);
                } else {
                        len = strlen(dir);
                        len += strlen(file);
                        len += 8;
                        path = (char *) switch_core_alloc(module_manager.pool, len);
-                       snprintf(path, len, "%s%s%s%s", dir, SWITCH_PATH_SEPARATOR, file, ext);
+                       switch_snprintf(path, len, "%s%s%s%s", dir, SWITCH_PATH_SEPARATOR, file, ext);
                }
        }
 
@@ -1592,7 +1592,7 @@ static JSBool session_streamfile(JSContext * cx, JSObject * obj, uintN argc, jsv
        JS_ResumeRequest(cx, cb_state.saveDepth);
        *rval = cb_state.ret;
 
-       snprintf(posbuf, sizeof(posbuf), "%u", fh.offset_pos);
+       switch_snprintf(posbuf, sizeof(posbuf), "%u", fh.offset_pos);
        switch_channel_set_variable(channel, "last_file_position", posbuf);
 
        return JS_TRUE;
@@ -2175,7 +2175,7 @@ static size_t hash_callback(void *ptr, size_t size, size_t nmemb, void *data)
                                for (p = val + strlen(val) - 1; *p == ' '; p--)
                                        *p = '\0';
 
-                               snprintf(code, sizeof(code), "~%s[\"%s\"] = \"%s\"", config_data->name, line, val);
+                               switch_snprintf(code, sizeof(code), "~%s[\"%s\"] = \"%s\"", config_data->name, line, val);
                                eval_some_js(code, config_data->cx, config_data->obj, &rval);
 
                        }
@@ -2374,7 +2374,7 @@ static JSBool js_fetchurl(JSContext * cx, JSObject * obj, uintN argc, jsval * ar
                        *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, config_data.buffer));
                } else {
                        char errmsg[256];
-                       snprintf(errmsg, 256, "~throw new Error(\"Curl returned error %u.\");", (unsigned)code);
+                       switch_snprintf(errmsg, 256, "~throw new Error(\"Curl returned error %u.\");", (unsigned)code);
                        eval_some_js(errmsg, cx, obj, rval);
                }
 
@@ -2974,7 +2974,7 @@ static JSBool js_exit(JSContext * cx, JSObject * obj, uintN argc, jsval * argv,
        char *supplied_error, code_buf[256] = "";
        
        if (argc > 0 && (supplied_error = JS_GetStringBytes(JS_ValueToString(cx, argv[0])))) {
-               snprintf(code_buf, sizeof(code_buf), "~throw new Error(\"%s\");", supplied_error);
+               switch_snprintf(code_buf, sizeof(code_buf), "~throw new Error(\"%s\");", supplied_error);
                eval_some_js(code_buf, cx, obj, rval);
        }
 
@@ -3271,7 +3271,7 @@ static void js_parse_and_execute(switch_core_session_t *session, const char *inp
 
                /* Emaculent conception of session object into the script if one is available */
                if (!(session && new_js_session(cx, javascript_global_object, session, &jss, "session", flags))) {
-                       snprintf(buf, sizeof(buf), "~var session = false;");
+                       switch_snprintf(buf, sizeof(buf), "~var session = false;");
                        eval_some_js(buf, cx, javascript_global_object, &rval);
                }
                if (ro) {
@@ -3291,17 +3291,17 @@ static void js_parse_and_execute(switch_core_session_t *session, const char *inp
        }
 
        if (!argc) {
-               snprintf(buf, sizeof(buf), "~var argv = new Array();");
+               switch_snprintf(buf, sizeof(buf), "~var argv = new Array();");
                eval_some_js(buf, cx, javascript_global_object, &rval);
        } else {
                /* create a js doppleganger of this argc/argv */
-               snprintf(buf, sizeof(buf), "~var argv = new Array(%d);", argc);
+               switch_snprintf(buf, sizeof(buf), "~var argv = new Array(%d);", argc);
                eval_some_js(buf, cx, javascript_global_object, &rval);
-               snprintf(buf, sizeof(buf), "~var argc = %d", argc);
+               switch_snprintf(buf, sizeof(buf), "~var argc = %d", argc);
                eval_some_js(buf, cx, javascript_global_object, &rval);
 
                for (y = 0; y < argc; y++) {
-                       snprintf(buf, sizeof(buf), "~argv[%d] = \"%s\";", x++, argv[y]);
+                       switch_snprintf(buf, sizeof(buf), "~argv[%d] = \"%s\";", x++, argv[y]);
                        eval_some_js(buf, cx, javascript_global_object, &rval);
                }
        }
index aba56b428a9ba9319ede2f30a2c8d5a9f5cfba30..8f5d66e2dbd03316cbfee10d1ce0f6dd175cc377 100644 (file)
@@ -113,18 +113,18 @@ static int db_callback(void *pArg, int argc, char **argv, char **columnNames)
        jsval rval;
        int x = 0;
 
-       snprintf(code, sizeof(code), "~var _Db_RoW_ = {}");
+       switch_snprintf(code, sizeof(code), "~var _Db_RoW_ = {}");
        eval_some_js(code, dbo->cx, dbo->obj, &rval);
 
        for (x = 0; x < argc; x++) {
-               snprintf(code, sizeof(code), "~_Db_RoW_[\"%s\"] = \"%s\"", columnNames[x], argv[x]);
+               switch_snprintf(code, sizeof(code), "~_Db_RoW_[\"%s\"] = \"%s\"", columnNames[x], argv[x]);
                eval_some_js(code, dbo->cx, dbo->obj, &rval);
        }
 
-       snprintf(code, sizeof(code), "~%s(_Db_RoW_)", dbo->code_buffer);
+       switch_snprintf(code, sizeof(code), "~%s(_Db_RoW_)", dbo->code_buffer);
        eval_some_js(code, dbo->cx, dbo->obj, &rval);
 
-       snprintf(code, sizeof(code), "~delete _Db_RoW_");
+       switch_snprintf(code, sizeof(code), "~delete _Db_RoW_");
        eval_some_js(code, dbo->cx, dbo->obj, &rval);
 
        return 0;
@@ -208,13 +208,13 @@ static JSBool db_fetch(JSContext * cx, JSObject * obj, uintN argc, jsval * argv,
                return JS_FALSE;
        }
 
-       snprintf(code, sizeof(code), "~var _dB_RoW_DaTa_ = {}");
+       switch_snprintf(code, sizeof(code), "~var _dB_RoW_DaTa_ = {}");
        eval_some_js(code, dbo->cx, dbo->obj, rval);
        if (*rval == JS_FALSE) {
                return JS_TRUE;
        }
        for (x = 0; x < colcount; x++) {
-               snprintf(code, sizeof(code), "~_dB_RoW_DaTa_[\"%s\"] = \"%s\"",
+               switch_snprintf(code, sizeof(code), "~_dB_RoW_DaTa_[\"%s\"] = \"%s\"",
                                 (char *) switch_core_db_column_name(dbo->stmt, x), (char *) switch_core_db_column_text(dbo->stmt, x));
 
                eval_some_js(code, dbo->cx, dbo->obj, rval);
index 9398a7165fa3db0b053fb13c2d625c673a012bb4..e7d563072a1259e5fedee8a253cbfe7c8d6398a5 100644 (file)
@@ -359,7 +359,7 @@ static JSBool odbc_get_data(JSContext * cx, JSObject * obj, uintN argc, jsval *a
                SQLLEN m = 0;
                char code[66560];
 
-               snprintf(code, sizeof(code), "~var _oDbC_dB_RoW_DaTa_ = {}");
+               switch_snprintf(code, sizeof(code), "~var _oDbC_dB_RoW_DaTa_ = {}");
                eval_some_js(code, cx, obj, rval);
                if (*rval == JS_FALSE) {
                        return JS_TRUE;
@@ -383,7 +383,7 @@ static JSBool odbc_get_data(JSContext * cx, JSObject * obj, uintN argc, jsval *a
                                        data = esc;
                                }
 
-                               snprintf((char *) odbc_obj->code, odbc_obj->codelen, "~_oDbC_dB_RoW_DaTa_[\"%s\"] = \"%s\"", name, data);
+                               switch_snprintf((char *) odbc_obj->code, odbc_obj->codelen, "~_oDbC_dB_RoW_DaTa_[\"%s\"] = \"%s\"", name, data);
                                switch_safe_free(esc);
 
                                eval_some_js((char *) odbc_obj->code, cx, obj, rval);
index 50d4cff072c37dc13e90d302c4b40e29ea0c2d41..4e44e4815ca8cb6b4983adc5ccd183d000f9bdb9 100644 (file)
@@ -283,7 +283,7 @@ static switch_status_t load_profile(switch_xml_t xml)
 
        if (switch_strlen_zero(new_profile->logfile)) {
                char logfile[512];
-               snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch.log");
+               switch_snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch.log");
                new_profile->logfile = strdup(logfile);
        }
     
index e74b1b1026167f6f55b1631b17b15d1c92b21391..8e789041decafbf64d9b24746ea480dfcc0356db 100644 (file)
@@ -54,7 +54,7 @@ SWITCH_MODULE_DEFINITION(mod_say_en, mod_say_en_load, NULL, NULL);
 #define say_num(num, t) {                                                      \
                char tmp[80];\
                switch_status_t status;\
-               snprintf(tmp, sizeof(tmp), "%u", (unsigned)num);                                \
+               switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num);                         \
        if ((status = en_say_general_count(session, tmp, SST_ITEMS, t, args)) != SWITCH_STATUS_SUCCESS) {\
                return status;\
        }}\
@@ -62,7 +62,7 @@ SWITCH_MODULE_DEFINITION(mod_say_en, mod_say_en_load, NULL, NULL);
 #define say_file(...) {\
                char tmp[80];\
                switch_status_t status;\
-               snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
+               switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\
                if ((status = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \
                        return status;\
                }\
index 5db6b3ef95467c031ed5805b15c7e1cd4721a18a..a66646952333db5c7964ea6eee291f73bf224f82 100644 (file)
@@ -138,7 +138,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
        switch_uuid_get(&uuid);
        switch_uuid_format(uuid_str, &uuid);
 
-       snprintf(filename, sizeof(filename), "%s%s.tmp.xml", SWITCH_GLOBAL_dirs.temp_dir, uuid_str);
+       switch_snprintf(filename, sizeof(filename), "%s%s.tmp.xml", SWITCH_GLOBAL_dirs.temp_dir, uuid_str);
        curl_handle = curl_easy_init();
        headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
 
index 2e8f46857fd1e587c1358c354f648ebf851739b4..88fe124959ff6ac323012a41bfdaf5e797508757 100644 (file)
@@ -190,7 +190,7 @@ static abyss_bool http_directory_auth(TSession *r, char *domain_name)
                                        goto fail;
                                }
                                
-                               snprintf(z, sizeof(z), "%s:%s", globals.user, globals.pass);
+                               switch_snprintf(z, sizeof(z), "%s:%s", globals.user, globals.pass);
                                Base64Encode(z, t);
                                
                                if (!strcmp(p, t)) {
@@ -241,9 +241,9 @@ static abyss_bool http_directory_auth(TSession *r, char *domain_name)
                                } else {
                                        if (mypass1) {
                                                if (at) {
-                                                       snprintf(z, sizeof(z), "%s@%s:%s", user, domain_name, mypass1);
+                                                       switch_snprintf(z, sizeof(z), "%s@%s:%s", user, domain_name, mypass1);
                                                } else {
-                                                       snprintf(z, sizeof(z), "%s:%s", user, mypass1);
+                                                       switch_snprintf(z, sizeof(z), "%s:%s", user, mypass1);
                                                }
                                                Base64Encode(z, t);
                                
@@ -255,9 +255,9 @@ static abyss_bool http_directory_auth(TSession *r, char *domain_name)
 
                                        if (mypass2) {
                                                if (at) {
-                                                       snprintf(z, sizeof(z), "%s@%s:%s", user, domain_name, mypass2);
+                                                       switch_snprintf(z, sizeof(z), "%s@%s:%s", user, domain_name, mypass2);
                                                } else {
-                                                       snprintf(z, sizeof(z), "%s:%s", user, mypass2);
+                                                       switch_snprintf(z, sizeof(z), "%s:%s", user, mypass2);
                                                }
                                                Base64Encode(z, t);
                                
@@ -270,9 +270,9 @@ static abyss_bool http_directory_auth(TSession *r, char *domain_name)
                                        if (box) {
                                                if (mypass1) {
                                                        if (at) {
-                                                               snprintf(z, sizeof(z), "%s@%s:%s", box, domain_name, mypass1);
+                                                               switch_snprintf(z, sizeof(z), "%s@%s:%s", box, domain_name, mypass1);
                                                        } else {
-                                                               snprintf(z, sizeof(z), "%s:%s", box, mypass1);
+                                                               switch_snprintf(z, sizeof(z), "%s:%s", box, mypass1);
                                                        }
                                                        Base64Encode(z, t);
                                        
@@ -284,9 +284,9 @@ static abyss_bool http_directory_auth(TSession *r, char *domain_name)
                                        
                                                if (mypass2) {
                                                        if (at) {
-                                                               snprintf(z, sizeof(z), "%s@%s:%s", box, domain_name, mypass2);
+                                                               switch_snprintf(z, sizeof(z), "%s@%s:%s", box, domain_name, mypass2);
                                                        } else {
-                                                               snprintf(z, sizeof(z), "%s:%s", box, mypass2);
+                                                               switch_snprintf(z, sizeof(z), "%s:%s", box, mypass2);
                                                        }
 
                                                        Base64Encode(z, t);
@@ -321,7 +321,7 @@ static abyss_bool http_directory_auth(TSession *r, char *domain_name)
                switch_xml_free(x_domain_root);
        }
 
-    snprintf(z, sizeof(z), "Basic realm=\"%s\"", domain_name ? domain_name : globals.realm);
+    switch_snprintf(z, sizeof(z), "Basic realm=\"%s\"", domain_name ? domain_name : globals.realm);
     ResponseAddField(r, "WWW-Authenticate", z);
     ResponseStatus(r, 401);
     return FALSE;
@@ -362,7 +362,7 @@ abyss_bool auth_hook(TSession * r)
                                new_uri = "/";
                        }
 
-                       snprintf(tmp, sizeof(tmp), "%s%s", 
+                       switch_snprintf(tmp, sizeof(tmp), "%s%s", 
                                         SWITCH_GLOBAL_dirs.htdocs_dir, 
                                         new_uri
                                         );
@@ -370,7 +370,7 @@ abyss_bool auth_hook(TSession * r)
 
                        if (switch_directory_exists(tmp, NULL) == SWITCH_STATUS_SUCCESS) {
                                for (x = 0; x < 2; x++) {
-                                       snprintf(tmp, sizeof(tmp), "%s%s%s%s", 
+                                       switch_snprintf(tmp, sizeof(tmp), "%s%s%s%s", 
                                                         SWITCH_GLOBAL_dirs.htdocs_dir, 
                                                         new_uri,
                                                         end_of(new_uri) == *SWITCH_PATH_SEPARATOR ? "" : SWITCH_PATH_SEPARATOR,
@@ -378,7 +378,7 @@ abyss_bool auth_hook(TSession * r)
                                                         );
                                
                                        if (switch_file_exists(tmp, NULL) == SWITCH_STATUS_SUCCESS) {
-                                               snprintf(tmp, sizeof(tmp), "%s%s%s", 
+                                               switch_snprintf(tmp, sizeof(tmp), "%s%s%s", 
                                                                 new_uri,
                                                                 end_of(new_uri) == '/' ? "" : "/",
                                                                 list[x]
@@ -624,7 +624,7 @@ abyss_bool handler_hook(TSession * r)
        }
 
        
-       snprintf(buf, sizeof(buf), "Connection: close\r\n");
+       switch_snprintf(buf, sizeof(buf), "Connection: close\r\n");
        ConnWrite(r->conn, buf, (uint32_t) strlen(buf));
        
        if (html) {
@@ -712,16 +712,16 @@ static xmlrpc_value *freeswitch_man(xmlrpc_env * const envP, xmlrpc_value * cons
                if (switch_core_management_exec(relative_oid, action, buf, sizeof(buf)) == SWITCH_STATUS_SUCCESS) {
                        if (action == SMA_SET) {
                                if (*buf != '\0') {
-                                       snprintf(buf, sizeof(buf), "OK\n");
+                                       switch_snprintf(buf, sizeof(buf), "OK\n");
                                }
                        }
                } else {
                        if (*buf != '\0') {
-                               snprintf(buf, sizeof(buf), "ERROR\n");
+                               switch_snprintf(buf, sizeof(buf), "ERROR\n");
                        }
                }
        } else {
-               snprintf(buf, sizeof(buf), "Invalid Action %s\n", s_action);
+               switch_snprintf(buf, sizeof(buf), "Invalid Action %s\n", s_action);
        }
 
        /* Return our result. */
@@ -765,7 +765,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_xml_rpc_runtime)
                }
        }
 
-       snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch_http.log");
+       switch_snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch_http.log");
        ServerCreate(&globals.abyssServer, "XmlRpcServer", globals.port, SWITCH_GLOBAL_dirs.htdocs_dir, logfile);
 
        xmlrpc_server_abyss_set_handler(&env, &globals.abyssServer, "/RPC2", registryP);
index b9cf6768025cff20f516880314872058222aac4b..cbe44d9f4ddf8995ebf4699e2aaec70abcccc61d 100644 (file)
@@ -200,75 +200,75 @@ SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_
 
 
        if (!switch_strlen_zero(caller_profile->username)) {
-               snprintf(header_name, sizeof(header_name), "%s-Username", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-Username", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->username);
        }
        if (!switch_strlen_zero(caller_profile->dialplan)) {
-               snprintf(header_name, sizeof(header_name), "%s-Dialplan", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-Dialplan", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->dialplan);
        }
        if (!switch_strlen_zero(caller_profile->caller_id_name)) {
-               snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Name", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Name", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->caller_id_name);
        }
        if (!switch_strlen_zero(caller_profile->caller_id_number)) {
-               snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Number", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Number", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->caller_id_number);
        }
        if (!switch_strlen_zero(caller_profile->network_addr)) {
-               snprintf(header_name, sizeof(header_name), "%s-Network-Addr", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-Network-Addr", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->network_addr);
        }
        if (!switch_strlen_zero(caller_profile->ani)) {
-               snprintf(header_name, sizeof(header_name), "%s-ANI", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-ANI", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->ani);
        }
        if (!switch_strlen_zero(caller_profile->aniii)) {
-               snprintf(header_name, sizeof(header_name), "%s-ANI-II", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-ANI-II", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->aniii);
        }
        if (!switch_strlen_zero(caller_profile->destination_number)) {
-               snprintf(header_name, sizeof(header_name), "%s-Destination-Number", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-Destination-Number", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->destination_number);
        }
        if (!switch_strlen_zero(caller_profile->uuid)) {
-               snprintf(header_name, sizeof(header_name), "%s-Unique-ID", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-Unique-ID", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->uuid);
        }
        if (!switch_strlen_zero(caller_profile->source)) {
-               snprintf(header_name, sizeof(header_name), "%s-Source", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-Source", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->source);
        }
        if (!switch_strlen_zero(caller_profile->context)) {
-               snprintf(header_name, sizeof(header_name), "%s-Context", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-Context", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->context);
        }
        if (!switch_strlen_zero(caller_profile->rdnis)) {
-               snprintf(header_name, sizeof(header_name), "%s-RDNIS", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-RDNIS", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->rdnis);
        }
        if (!switch_strlen_zero(caller_profile->chan_name)) {
-               snprintf(header_name, sizeof(header_name), "%s-Channel-Name", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Name", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%s", caller_profile->chan_name);
        }
        if (caller_profile->times) {
-               snprintf(header_name, sizeof(header_name), "%s-Channel-Created-Time", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Created-Time", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
-               snprintf(header_name, sizeof(header_name), "%s-Channel-Answered-Time", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Answered-Time", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
-               snprintf(header_name, sizeof(header_name), "%s-Channel-Hangup-Time", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Hangup-Time", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);
-               snprintf(header_name, sizeof(header_name), "%s-Channel-Transfer-Time", prefix);
+               switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Transfer-Time", prefix);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->transferred);
        }
 
-       snprintf(header_name, sizeof(header_name), "%s-Screen-Bit", prefix);
+       switch_snprintf(header_name, sizeof(header_name), "%s-Screen-Bit", prefix);
        switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_SCREEN) ? "yes" : "no");
 
-       snprintf(header_name, sizeof(header_name), "%s-Privacy-Hide-Name", prefix);
+       switch_snprintf(header_name, sizeof(header_name), "%s-Privacy-Hide-Name", prefix);
        switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME) ? "yes" : "no");
 
-       snprintf(header_name, sizeof(header_name), "%s-Privacy-Hide-Number", prefix);
+       switch_snprintf(header_name, sizeof(header_name), "%s-Privacy-Hide-Number", prefix);
        switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "yes" : "no");
 
        
index f4c4ceb7e8d1ae105f79401639e6b1385399684b..1a2f715e6bc28a3b1df0901b0e9605fae31f691b 100644 (file)
@@ -595,7 +595,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state(
                                switch_channel_event_set_data(channel, event);
                        } else {
                                char state_num[25];
-                               snprintf(state_num, sizeof(state_num), "%d", channel->state);
+                               switch_snprintf(state_num, sizeof(state_num), "%d", channel->state);
                                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State", "%s", (char *) switch_channel_state_name(channel->state));
                                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%s", (char *) state_num);
                                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", channel->name);
@@ -830,7 +830,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw
        }
 
        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State", "%s", switch_channel_state_name(channel->state));
-       snprintf(state_num, sizeof(state_num), "%d", channel->state);
+       switch_snprintf(state_num, sizeof(state_num), "%d", channel->state);
        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%s", state_num);
        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", switch_channel_get_name(channel));
        switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", switch_core_session_get_uuid(channel->session));
@@ -870,7 +870,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw
                x++;
                
                switch_assert(vvar && vval);
-               snprintf(buf, sizeof(buf), "variable_%s", vvar);
+               switch_snprintf(buf, sizeof(buf), "variable_%s", vvar);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, buf, "%s", vval);
 
        }
index 48608d5aee38a50447f1048dd3b23f7afb82c8c9..d6fbe00d383af1916d10d080e9c12122d8b15c78 100644 (file)
@@ -41,7 +41,7 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t * cfg, char *file_pa
        if (switch_is_file_path(file_path)) {
                path = file_path;
        } else {
-               snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, file_path);
+               switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, file_path);
                path = path_buf;
        }
 
@@ -57,7 +57,7 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config_t * cfg, char *file_pa
                        int last = -1;
                        char *var, *val;
 
-                       snprintf(path_buf, sizeof(path_buf), "%s%sfreeswitch.conf", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR);
+                       switch_snprintf(path_buf, sizeof(path_buf), "%s%sfreeswitch.conf", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR);
                        path = path_buf;
 
                        if ((f = fopen(path, "r")) == 0) {
index 3c0da947e775c0d8e03a1b1058429e8951844247..b19956b5f8c27173a8b0a6ac17d9ef165ae161fd 100644 (file)
@@ -94,7 +94,7 @@ SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_stream_write(switch_stream
                        ret = -1;
                } else {
                        ret = 0;
-                       snprintf(end, remaining, "%s", data);
+                       switch_snprintf(end, remaining, "%s", data);
                        handle->data_len = strlen(buf);
                        handle->end = (uint8_t *) (handle->data) + handle->data_len;
                }
@@ -204,7 +204,7 @@ static char prompt_str[512] = "";
 char * prompt(EditLine *e) {
        if (*prompt_str == '\0') {
                gethostname(hostname, sizeof(hostname));
-               snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", hostname);
+               switch_snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", hostname);
        }       
 
        return prompt_str;
index bbe0f85a3b150cd6d599674de9e8161f3750e908..6a36e7d7a1ab3b07d81360c8c333f89a2faa961b 100644 (file)
@@ -534,7 +534,7 @@ SWITCH_DECLARE(void) switch_core_runtime_loop(int bg)
        if (bg) {
                bg = 0;
 #ifdef WIN32
-               snprintf(path, sizeof(path), "Global\\Freeswitch.%d", getpid());
+               switch_snprintf(path, sizeof(path), "Global\\Freeswitch.%d", getpid());
                shutdown_event = CreateEvent(NULL, FALSE, FALSE, path);
                if (shutdown_event) {
                        WaitForSingleObject(shutdown_event, INFINITE);
index caccdfa05ed2df6ff4fd56757d3cca728779ca9c..99df819e245f0edbb8894d97280e06ea113d27bf 100644 (file)
@@ -54,7 +54,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s
        }
 
        switch_channel_set_variable(channel, "read_codec", codec->implementation->iananame);
-       snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
+       switch_snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
        switch_channel_set_variable(channel, "read_rate", tmp);
 
        session->read_codec = codec;
@@ -92,7 +92,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(switch_core_
        }
 
        switch_channel_set_variable(channel, "write_codec", codec->implementation->iananame);
-       snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
+       switch_snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
        switch_channel_set_variable(channel, "write_rate", tmp);
 
        session->write_codec = codec;
index 2474952091055027496a8291009ef0d0fa87e9e8..0a74d1871ccc445aca6c211a7e96b4d5d7530dea 100644 (file)
@@ -42,7 +42,7 @@ static void db_pick_path(char *dbname, char *buf, switch_size_t size)
        if (switch_is_file_path(dbname)) {
                strncpy(buf, dbname, size);
        } else {
-               snprintf(buf, size, "%s%s%s.db", SWITCH_GLOBAL_dirs.db_dir, SWITCH_PATH_SEPARATOR, dbname);
+               switch_snprintf(buf, size, "%s%s%s.db", SWITCH_GLOBAL_dirs.db_dir, SWITCH_PATH_SEPARATOR, dbname);
        }
 }
 
index 00e6e966a9b861166a3533887966dfddbbe33d60..f472a157b38a7d5de135c7727151d45a4d1194db 100644 (file)
@@ -806,7 +806,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request(const switch
        switch_queue_create(&session->event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
        switch_queue_create(&session->private_event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
 
-       snprintf(session->name, sizeof(session->name), "%"SWITCH_SIZE_T_FMT, session->id);
+       switch_snprintf(session->name, sizeof(session->name), "%"SWITCH_SIZE_T_FMT, session->id);
        switch_mutex_lock(runtime.throttle_mutex);
        session->id = session_manager.session_id++;
        switch_core_hash_insert(session_manager.session_table, session->uuid_str, session);
index 5918dd1de3e793d071d7005518b98267cb8b6c7c..d186cd653d4dba407dbc0714ad4b3412575e76c7 100644 (file)
@@ -761,7 +761,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_serialize(switch_event_t *event, ch
                if (encode) {
                        switch_url_encode(hp->value, encode_buf, encode_len - 1);
                } else {
-                       snprintf(encode_buf, encode_len, "[%s]", hp->value);
+                       switch_snprintf(encode_buf, encode_len, "[%s]", hp->value);
                }
 
                llen = strlen(hp->name) + strlen(encode_buf) + 8;
@@ -779,7 +779,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_serialize(switch_event_t *event, ch
                        }
                }
 
-               snprintf(buf + len, dlen - len, "%s: %s\n", hp->name, switch_strlen_zero(encode_buf) ? "_undef_" : encode_buf);
+               switch_snprintf(buf + len, dlen - len, "%s: %s\n", hp->name, switch_strlen_zero(encode_buf) ? "_undef_" : encode_buf);
                len = strlen(buf);
 
        }
@@ -809,12 +809,12 @@ SWITCH_DECLARE(switch_status_t) switch_event_serialize(switch_event_t *event, ch
                }
 
                if (blen) {
-                       snprintf(buf + len, dlen - len, "Content-Length: %d\n\n%s", blen, event->body);
+                       switch_snprintf(buf + len, dlen - len, "Content-Length: %d\n\n%s", blen, event->body);
                } else {
-                       snprintf(buf + len, dlen - len, "\n");
+                       switch_snprintf(buf + len, dlen - len, "\n");
                }
        } else {
-               snprintf(buf + len, dlen - len, "\n");
+               switch_snprintf(buf + len, dlen - len, "\n");
        }
 
        *str = buf;
@@ -877,7 +877,7 @@ SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const ch
        if (body) {
                int blen = (int) strlen(body);
                char blena[25];
-               snprintf(blena, sizeof(blena), "%d", blen);
+               switch_snprintf(blena, sizeof(blena), "%d", blen);
                if (blen) {
                        switch_xml_t xbody = NULL;
 
index d5d54d416e27b786ea5b8a70a911f98a6ae1c928..d9fea5ed3180f13bb1d6f1d2afc255116bf8bef6 100644 (file)
@@ -1456,25 +1456,25 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_
                        if (!(time_tag = switch_xml_add_child_d(x_times, "created_time", t_off++))) {
                                goto error;
                        }
-                       snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
+                       switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
                        switch_xml_set_txt_d(time_tag, tmp);
 
                        if (!(time_tag = switch_xml_add_child_d(x_times, "answered_time", t_off++))) {
                                goto error;
                        }
-                       snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
+                       switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
                        switch_xml_set_txt_d(time_tag, tmp);
 
                        if (!(time_tag = switch_xml_add_child_d(x_times, "hangup_time", t_off++))) {
                                goto error;
                        }
-                       snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);
+                       switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);
                        switch_xml_set_txt_d(time_tag, tmp);
 
                        if (!(time_tag = switch_xml_add_child_d(x_times, "transfer_time", t_off++))) {
                                goto error;
                        }
-                       snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->transferred);
+                       switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->transferred);
                        switch_xml_set_txt_d(time_tag, tmp);
                }
 
index 72a72acd79af69ef4f54623e76aab34bb9ba5c90..4c2ceb321758f301292b562b7aedc3fde6afe352 100644 (file)
@@ -127,7 +127,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
        }
 
        switch_url_encode(data, enc_hint, sizeof(enc_hint));
-       snprintf(hint_data, sizeof(hint_data), "macro_name=%s&lang=%s&data=%s&destination_number=%s", macro_name, chan_lang, enc_hint, switch_channel_get_variable(channel,"destination_number"));
+       switch_snprintf(hint_data, sizeof(hint_data), "macro_name=%s&lang=%s&data=%s&destination_number=%s", macro_name, chan_lang, enc_hint, switch_channel_get_variable(channel,"destination_number"));
 
        if (switch_xml_locate("phrases", NULL, NULL, NULL, &xml, &cfg, hint_data) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of phrases failed.\n");
index 907353fbaeea688a5a55095f435af3fb06080780..6fba607f238528452b2c88c1611de51aa47c046e 100644 (file)
@@ -784,7 +784,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_load_module(char *dir, ch
                len += strlen(file);
                len += 8;
                path = (char *) switch_core_alloc(loadable_modules.pool, len);
-               snprintf(path, len, "%s%s%s%s", dir, SWITCH_PATH_SEPARATOR, file, ext);
+               switch_snprintf(path, len, "%s%s%s%s", dir, SWITCH_PATH_SEPARATOR, file, ext);
        }
 
        switch_mutex_lock(loadable_modules.mutex);
index 89d98d7d0d2bd34f7cd45c4d6744e5027c1aa50a..47239a15de481a86cd4413d83aca07804d0a74cd 100644 (file)
@@ -222,7 +222,7 @@ SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char
                len = (uint32_t) (strlen(extra_fmt) + strlen(date) + strlen(filep) + 32 + strlen(funcp) + strlen(fmt));
                new_fmt = malloc(len + 1);
                switch_assert(new_fmt);
-               snprintf(new_fmt, len, extra_fmt, date, switch_log_level2str(level), filep, line, funcp, 128, fmt);
+               switch_snprintf(new_fmt, len, extra_fmt, date, switch_log_level2str(level), filep, line, funcp, 128, fmt);
                fmt = new_fmt;
        }
 
index 6f3623a6cf88defb9329c1ff60a1826188ef0204..2623ffb55a59d7ad79ee1e386c94e25b5c7bfe71 100644 (file)
@@ -652,8 +652,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
        char ice_user[80];
        char user_ice[80];
 
-       snprintf(ice_user, sizeof(ice_user), "%s%s", login, rlogin);
-       snprintf(user_ice, sizeof(user_ice), "%s%s", rlogin, login);
+       switch_snprintf(ice_user, sizeof(ice_user), "%s%s", login, rlogin);
+       switch_snprintf(user_ice, sizeof(user_ice), "%s%s", rlogin, login);
        rtp_session->ice_user = switch_core_strdup(rtp_session->pool, ice_user);
        rtp_session->user_ice = switch_core_strdup(rtp_session->pool, user_ice);
 
index e0f6c72189d06a536043c1201b96cf6891d23b19..ddee0fe1834a7676dacc198def0eec47bec95ec3 100644 (file)
@@ -229,7 +229,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, const char *fr
        unsigned char in[B64BUFFLEN];
        unsigned char out[B64BUFFLEN + 512];
 
-    snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int)time(NULL), rand() & 0xffff);
+    switch_snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int)time(NULL), rand() & 0xffff);
     
     if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644))) {
         if (file) {
@@ -237,7 +237,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, const char *fr
                 return SWITCH_FALSE;
             }
 
-            snprintf(buf, B64BUFFLEN, "MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"%s\"\n", bound);
+            switch_snprintf(buf, B64BUFFLEN, "MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"%s\"\n", bound);
             if (!write_buf(fd, buf)) {
                 return SWITCH_FALSE;
             }
@@ -251,9 +251,9 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, const char *fr
 
         if (file) {
                        if (body && switch_stristr("content-type", body)) {
-                               snprintf(buf, B64BUFFLEN, "--%s\n", bound);
+                               switch_snprintf(buf, B64BUFFLEN, "--%s\n", bound);
                        } else {
-                               snprintf(buf, B64BUFFLEN, "--%s\nContent-Type: text/plain\n\n", bound);
+                               switch_snprintf(buf, B64BUFFLEN, "--%s\nContent-Type: text/plain\n\n", bound);
                        }
             if (!write_buf(fd, buf))
                 return SWITCH_FALSE;
@@ -277,7 +277,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, const char *fr
                                }
                        }
 
-                       snprintf(buf, B64BUFFLEN,
+                       switch_snprintf(buf, B64BUFFLEN,
                                         "\n\n--%s\nContent-Type: %s; name=\"%s\"\n"
                                         "Content-ID: <ATTACHED@freeswitch.org>\n"
                                         "Content-Transfer-Encoding: base64\n"
@@ -322,7 +322,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, const char *fr
 
 
         if (file) {
-            snprintf(buf, B64BUFFLEN, "\n\n--%s--\n.\n", bound);
+            switch_snprintf(buf, B64BUFFLEN, "\n\n--%s--\n.\n", bound);
             if (!write_buf(fd, buf))
                 return SWITCH_FALSE;
         }
@@ -334,7 +334,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, const char *fr
     if (ifd) {
         close(ifd);
     }
-    snprintf(buf, B64BUFFLEN, "/bin/cat %s | %s %s %s", filename, runtime.mailer_app, runtime.mailer_app_args, to);
+    switch_snprintf(buf, B64BUFFLEN, "/bin/cat %s | %s %s %s", filename, runtime.mailer_app, runtime.mailer_app_args, to);
     if(system(buf)) {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to execute command: %s\n", buf);
     }
@@ -826,7 +826,7 @@ switch_inet_ntop4(const unsigned char *src, char *dst, size_t size)
        static const char fmt[] = "%u.%u.%u.%u";
        char tmp[sizeof "255.255.255.255"];
 
-       if (snprintf(tmp, sizeof tmp, fmt,
+       if (switch_snprintf(tmp, sizeof tmp, fmt,
                     src[0], src[1], src[2], src[3]) >= (int)size) {
                return NULL;
        }
index 3c35c879780159459036f43a6f8c91b14a4b80ac..4c0b3d2c9be109daaade5f1f6d65dcc1a1501697 100644 (file)
@@ -294,7 +294,7 @@ static switch_xml_t switch_xml_err(switch_xml_root_t root, char *s, const char *
        for (t = root->s; t && t < s; t++)
                if (*t == '\n')
                        line++;
-       snprintf(fmt, SWITCH_XML_ERRL, "[error near line %d]: %s", line, err);
+       switch_snprintf(fmt, SWITCH_XML_ERRL, "[error near line %d]: %s", line, err);
 
        va_start(ap, err);
        vsnprintf(root->err, SWITCH_XML_ERRL, fmt, ap);
@@ -1288,7 +1288,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(const char *domain_name
        *domain = NULL;
 
        if (!params) {
-               snprintf(my_params, sizeof(my_params), "domain=%s", domain_name);
+               switch_snprintf(my_params, sizeof(my_params), "domain=%s", domain_name);
                params = my_params;
        }
 
@@ -1312,10 +1312,10 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(const char *key,
        *domain = NULL;
        
        if (!switch_strlen_zero(xtra_params)) {
-               snprintf(params, sizeof(params), "key=%s&user=%s&domain=%s&ip=%s&%s", key,
+               switch_snprintf(params, sizeof(params), "key=%s&user=%s&domain=%s&ip=%s&%s", key,
                                 switch_str_nil(user_name), switch_str_nil(domain_name), switch_str_nil(ip), xtra_params);
        } else {
-               snprintf(params, sizeof(params), "key=%s&user=%s&domain=%s&ip=%s", key,
+               switch_snprintf(params, sizeof(params), "key=%s&user=%s&domain=%s&ip=%s", key,
                                 switch_str_nil(user_name), switch_str_nil(domain_name), switch_str_nil(ip));
                xtra_params = "";
        }
@@ -1374,7 +1374,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e
                switch_thread_rwlock_wrlock(RWLOCK);
        }
 
-       snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "freeswitch.xml");
+       switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "freeswitch.xml");
        if ((new_main = switch_xml_parse_file(path_buf))) {
                *err = switch_xml_error(new_main);
                switch_copy_string(not_so_threadsafe_error_buffer, *err, sizeof(not_so_threadsafe_error_buffer));