From 40b96afb4aca357858bbcc1edf750943c7c2c1a6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 21 May 2008 20:00:00 +0000 Subject: [PATCH] tweak git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8506 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_channel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 501ba2cee3..d01591213e 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -130,9 +130,10 @@ SWITCH_DECLARE(const char *) switch_channel_cause2str(switch_call_cause_t cause) uint8_t x; const char *str = "UNKNOWN"; - for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) ; x++) { + for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) -1 ; x++) { if (CAUSE_CHART[x].cause == cause) { str = CAUSE_CHART[x].name; + break; } } @@ -147,9 +148,10 @@ SWITCH_DECLARE(switch_call_cause_t) switch_channel_str2cause(const char *str) if (*str > 47 && *str < 58) { cause = atoi(str); } else { - for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) && CAUSE_CHART[x].name; x++) { + for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) - 1 && CAUSE_CHART[x].name; x++) { if (!strcasecmp(CAUSE_CHART[x].name, str)) { cause = CAUSE_CHART[x].cause; + break; } } }