constify some arguments to switch_console_printf and switch_cut_path and remove improper casts for the consumers of those functions.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4241 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
681b8e94eb
commit
ceafc84ca0
|
@ -62,7 +62,7 @@ SWITCH_DECLARE(void) switch_console_loop(void);
|
|||
/*!
|
||||
\brief A method akin to printf that allows you to redirect output to a specific console "channel"
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, char *file, const char *func, int line, char *fmt, ...) PRINTF_FUNCTION(5,6);
|
||||
SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, const char *file, const char *func, int line, const char *fmt, ...) PRINTF_FUNCTION(5,6);
|
||||
|
||||
/*!
|
||||
\brief A method akin to printf for dealing with api streams
|
||||
|
|
|
@ -274,7 +274,7 @@ SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms);
|
|||
\brief Create a pointer to the file name in a given file path eliminating the directory name
|
||||
\return the pointer to the next character after the final / or \\ characters
|
||||
*/
|
||||
SWITCH_DECLARE(char *) switch_cut_path(char *in);
|
||||
SWITCH_DECLARE(const char *) switch_cut_path(const char *in);
|
||||
|
||||
#define switch_clean_re(re) if (re) {\
|
||||
pcre_free(re);\
|
||||
|
|
|
@ -612,7 +612,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_c
|
|||
if (state > CS_RING) {
|
||||
switch_channel_presence(channel, "unknown", (char*)state_names[state]);
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, (char *) file, func, line, SWITCH_LOG_DEBUG, "%s State Change %s -> %s\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s State Change %s -> %s\n",
|
||||
channel->name,
|
||||
state_names[last_state],
|
||||
state_names[state]);
|
||||
|
@ -645,7 +645,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_c
|
|||
}
|
||||
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, (char *) file, func, line, SWITCH_LOG_WARNING, "%s Invalid State Change %s -> %s\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_WARNING, "%s Invalid State Change %s -> %s\n",
|
||||
channel->name,
|
||||
state_names[last_state],
|
||||
state_names[state]);
|
||||
|
@ -958,7 +958,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
|
|||
switch_channel_state_t last_state = channel->state;
|
||||
channel->state = CS_HANGUP;
|
||||
channel->hangup_cause = hangup_cause;
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, (char *) file, func, line, SWITCH_LOG_NOTICE, "Hangup %s [%s] [%s]\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Hangup %s [%s] [%s]\n",
|
||||
channel->name,
|
||||
state_names[last_state], switch_channel_cause2str(channel->hangup_cause));
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_HANGUP) == SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -985,7 +985,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready(switch_ch
|
|||
int line)
|
||||
{
|
||||
if (!switch_channel_test_flag(channel, CF_RING_READY)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, (char *) file, func, line, SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
|
||||
switch_channel_set_flag(channel, CF_RING_READY);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -1008,7 +1008,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_
|
|||
char *uuid;
|
||||
switch_core_session_t *other_session;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, (char *) file, func, line, SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name);
|
||||
switch_channel_set_flag(channel, CF_EARLY_MEDIA);
|
||||
switch_channel_set_variable(channel, "endpoint_disposition", "EARLY MEDIA");
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_PROGRESS) == SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -1091,7 +1091,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready(switch_channel
|
|||
status = switch_core_session_message_send(uuid, &msg);
|
||||
|
||||
if (status == SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, (char *) file, func, line, SWITCH_LOG_NOTICE, "Ring Ready %s!\n", channel->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Ring Ready %s!\n", channel->name);
|
||||
}
|
||||
|
||||
return status;
|
||||
|
@ -1138,7 +1138,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
|
|||
}
|
||||
|
||||
switch_channel_set_variable(channel, "endpoint_disposition", "ANSWER");
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, (char *) file, func, line, SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", channel->name);
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", channel->name);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -132,14 +132,14 @@ static int switch_console_process(char *cmd)
|
|||
return 1;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, char *file, const char *func, int line,
|
||||
char *fmt, ...)
|
||||
SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, const char *file, const char *func, int line,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
char *data = NULL;
|
||||
int ret = 0;
|
||||
va_list ap;
|
||||
FILE *handle;
|
||||
char *filep = switch_cut_path(file);
|
||||
const char *filep = switch_cut_path(file);
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
||||
|
|
|
@ -589,13 +589,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(switch_core_sessio
|
|||
if (switch_test_flag(session, SSF_DESTROYED)) {
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
#ifdef SWITCH_DEBUG_RWLOCKS
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, (char *) file, func, line, SWITCH_LOG_DEBUG, "%s Read lock FAIL\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s Read lock FAIL\n",
|
||||
switch_channel_get_name(session->channel));
|
||||
#endif
|
||||
} else {
|
||||
status = (switch_status_t) switch_thread_rwlock_tryrdlock(session->rwlock);
|
||||
#ifdef SWITCH_DEBUG_RWLOCKS
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, (char *) file, func, line, SWITCH_LOG_DEBUG, "%s Read lock AQUIRED\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s Read lock AQUIRED\n",
|
||||
switch_channel_get_name(session->channel));
|
||||
#endif
|
||||
}
|
||||
|
@ -611,7 +611,7 @@ SWITCH_DECLARE(void) switch_core_session_perform_write_lock(switch_core_session_
|
|||
int line)
|
||||
{
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, (char *) file, func, line, SWITCH_LOG_DEBUG, "%s Write lock AQUIRED\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s Write lock AQUIRED\n",
|
||||
switch_channel_get_name(session->channel));
|
||||
#else
|
||||
SWITCH_DECLARE(void) switch_core_session_write_lock(switch_core_session_t *session)
|
||||
|
@ -626,7 +626,7 @@ SWITCH_DECLARE(void) switch_core_session_perform_rwunlock(switch_core_session_t
|
|||
const char *func,
|
||||
int line)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, (char *) file, func, line, SWITCH_LOG_DEBUG, "%s Read/Write lock CLEARED\n",
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_DEBUG, "%s Read/Write lock CLEARED\n",
|
||||
switch_channel_get_name(session->channel));
|
||||
#else
|
||||
SWITCH_DECLARE(void) switch_core_session_rwunlock(switch_core_session_t *session)
|
||||
|
@ -2495,7 +2495,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_kill_channel(switch_
|
|||
switch_io_event_hook_kill_channel_t *ptr;
|
||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, (char *) file, func, line, SWITCH_LOG_INFO, "Kill %s [%d]\n", switch_channel_get_name(session->channel), sig);
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, SWITCH_LOG_INFO, "Kill %s [%d]\n", switch_channel_get_name(session->channel), sig);
|
||||
|
||||
if (session->endpoint_interface->io_routines->kill_channel) {
|
||||
if ((status = session->endpoint_interface->io_routines->kill_channel(session, sig)) == SWITCH_STATUS_SUCCESS) {
|
||||
|
|
|
@ -169,7 +169,7 @@ SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char
|
|||
int ret = 0;
|
||||
va_list ap;
|
||||
FILE *handle;
|
||||
const char *filep = (file ? (const char *)switch_cut_path((char *)file): "");
|
||||
const char *filep = (file ? switch_cut_path(file): "");
|
||||
const char *funcp = (func ? func : "");
|
||||
char *content = NULL;
|
||||
switch_time_t now = switch_time_now();
|
||||
|
|
|
@ -496,11 +496,11 @@ SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char
|
|||
return argc;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(char *) switch_cut_path(char *in)
|
||||
SWITCH_DECLARE(const char *) switch_cut_path(const char *in)
|
||||
{
|
||||
char *p, *ret = in;
|
||||
char delims[] = "/\\";
|
||||
char *i;
|
||||
const char *p, *ret = in;
|
||||
const char delims[] = "/\\";
|
||||
const char *i;
|
||||
|
||||
if (in) {
|
||||
for (i = delims; *i; i++) {
|
||||
|
|
Loading…
Reference in New Issue