formating and fix switch statement

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9448 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-09-04 17:18:22 +00:00
parent d6e6e52239
commit bfafa0bd36

View File

@ -52,31 +52,31 @@ static void span_message(int level, const char *msg)
return; return;
} }
*/ */
switch_assert(msg!=NULL); switch_assert(msg);
switch (level) switch (level) {
{ /* TODO: i need to ask Coppice what SPAN_LOG_NONE and SPA_LOG_FLOW are exactly for
/* TODO: i need to ask Coppice what SPAN_LOG_NONE and SPA_LOG_FLOW are exactly for case SPAN_LOG_NONE:
SPAN_LOG_NONE:
return; return;
SPAN_LOG_FLOW: case SPAN_LOG_FLOW:
SPAN_LOG_FLOW_2: case SPAN_LOG_FLOW_2:
SPAN_LOG_FLOW_3: case SPAN_LOG_FLOW_3:
if (!debug) if (!debug)
return; return;
fs_log_level = SWITCH_LOG_DEBUG; fs_log_level = SWITCH_LOG_DEBUG;
break; break;
*/ */
SPAN_LOG_ERROR: case SPAN_LOG_ERROR:
SPAN_LOG_PROTOCOL_ERROR: case SPAN_LOG_PROTOCOL_ERROR:
fs_log_level = SWITCH_LOG_ERROR; fs_log_level = SWITCH_LOG_ERROR;
break; break;
SPAN_LOG_WARNING: case SPAN_LOG_WARNING:
SPAN_LOG_PROTOCOL_WARNING: case SPAN_LOG_PROTOCOL_WARNING:
fs_log_level = SWITCH_LOG_WARNING; fs_log_level = SWITCH_LOG_WARNING;
break; break;
default: /* SPAN_LOG_DEBUG, SPAN_LOG_DEBUG_2, SPAN_LOG_DEBUG_3 */ default: /* SPAN_LOG_DEBUG, SPAN_LOG_DEBUG_2, SPAN_LOG_DEBUG_3 */
fs_log_level = SWITCH_LOG_DEBUG; fs_log_level = SWITCH_LOG_DEBUG;
break;
} }
switch_log_printf(SWITCH_CHANNEL_LOG, fs_log_level, "%s", msg ); switch_log_printf(SWITCH_CHANNEL_LOG, fs_log_level, "%s", msg );
} }
@ -111,11 +111,11 @@ static int phase_b_handler(t30_state_t *s, void *user_data, int result)
static int phase_d_handler(t30_state_t *s, void *user_data, int result) static int phase_d_handler(t30_state_t *s, void *user_data, int result)
{ {
t30_stats_t t; t30_stats_t t;
int session; int session = (intptr_t) user_data;
switch_assert(user_data != NULL); switch_assert(user_data);
session = (intptr_t) user_data;
if (!result) return T30_ERR_OK;
if (result) {
t30_get_transfer_statistics(s, &t); t30_get_transfer_statistics(s, &t);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "==============================================================================\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "==============================================================================\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Phase D handler on channel %d - (0x%X) %s\n", session, session, result, t30_frametype(result)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Phase D handler on channel %d - (0x%X) %s\n", session, session, result, t30_frametype(result));
@ -133,7 +133,7 @@ static int phase_d_handler(t30_state_t *s, void *user_data, int result)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "remote ident: %s\n", t30_get_rx_ident(s)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "remote ident: %s\n", t30_get_rx_ident(s));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "bits per row - min %d, max %d\n", s->t4.min_row_bits, s->t4.max_row_bits); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "bits per row - min %d, max %d\n", s->t4.min_row_bits, s->t4.max_row_bits);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "==============================================================================\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "==============================================================================\n");
}
return T30_ERR_OK; return T30_ERR_OK;
} }
@ -149,7 +149,7 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
switch_channel_t *chan = (switch_channel_t *) user_data; switch_channel_t *chan = (switch_channel_t *) user_data;
char buf[128]; char buf[128];
switch_assert(user_data != NULL); switch_assert(chan);
if (result == T30_ERR_OK) { if (result == T30_ERR_OK) {
t30_get_transfer_statistics(s, &t); t30_get_transfer_statistics(s, &t);
@ -190,8 +190,7 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
switch_channel_set_variable(chan, "FAX_REMOTESTATIONID", far_ident); switch_channel_set_variable(chan, "FAX_REMOTESTATIONID", far_ident);
switch_snprintf(buf, sizeof(buf), "%d", result); switch_snprintf(buf, sizeof(buf), "%d", result);
switch_channel_set_variable(chan, "FAX_RESULT", buf); switch_channel_set_variable(chan, "FAX_RESULT", buf);
switch_snprintf(buf, sizeof(buf), "%s", t30_completion_code_to_str(result)); switch_channel_set_variable(chan, "FAX_ERROR", t30_completion_code_to_str(result));
switch_channel_set_variable(chan, "FAX_ERROR", buf);
/* /*
* TODO * TODO
@ -205,9 +204,8 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
static int document_handler(t30_state_t *s, void *user_data, int event) static int document_handler(t30_state_t *s, void *user_data, int event)
{ {
int i; int i = (intptr_t) user_data;
i = (intptr_t) user_data; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%d: Document handler on channel %d - event %d\n", i, i, event);
printf("%d: Document handler on channel %d - event %d\n", i, i, event);
return FALSE; return FALSE;
} }