]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8953 [core] white space clean up.
authorKen Rice <krice@freeswitch.org>
Thu, 17 Mar 2016 13:55:00 +0000 (08:55 -0500)
committerKen Rice <krice@freeswitch.org>
Thu, 17 Mar 2016 13:55:00 +0000 (08:55 -0500)
25 files changed:
src/switch_apr.c
src/switch_channel.c
src/switch_core.c
src/switch_core_cert.c
src/switch_core_io.c
src/switch_core_media.c
src/switch_core_media_bug.c
src/switch_core_session.c
src/switch_core_sqldb.c
src/switch_core_state_machine.c
src/switch_core_video.c
src/switch_hashtable.c
src/switch_ivr.c
src/switch_ivr_async.c
src/switch_ivr_bridge.c
src/switch_json.c
src/switch_pcm.c
src/switch_pgsql.c
src/switch_profile.c
src/switch_rtp.c
src/switch_sdp.c
src/switch_stun.c
src/switch_utf8.c
src/switch_utils.c
src/switch_vpx.c

index fe305d7cd1ad966414f98a5aec7a0e2cd1ef480c..db226cb6a88f4306c8e56ad0d249eee7e2c64501 100644 (file)
@@ -631,9 +631,9 @@ struct apr_threadattr_t {
 /* this needs to be revisited when apr for windows supports thread priority settings */
 /* search for WIN32 in this file */
 struct apr_threadattr_t {
-    apr_pool_t *pool;
-    apr_int32_t detach;
-    apr_size_t stacksize;
+       apr_pool_t *pool;
+       apr_int32_t detach;
+       apr_size_t stacksize;
        int priority;
 };
 #endif
@@ -802,13 +802,13 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, s
        new_sa->pool = pool;
        memset(new_sa, 0, sizeof(*new_sa));
 
-    new_sa->family = family;
-    new_sa->sa.sin.sin_family = family;
+       new_sa->family = family;
+       new_sa->sa.sin.sin_family = family;
 
-    new_sa->salen = sizeof(struct sockaddr_in);
-    new_sa->addr_str_len = 16;
-    new_sa->ipaddr_ptr = &(new_sa->sa.sin.sin_addr);
-    new_sa->ipaddr_len = sizeof(struct in_addr);
+       new_sa->salen = sizeof(struct sockaddr_in);
+       new_sa->addr_str_len = 16;
+       new_sa->ipaddr_ptr = &(new_sa->sa.sin.sin_addr);
+       new_sa->ipaddr_len = sizeof(struct in_addr);
 
        *sa = new_sa;
        return SWITCH_STATUS_SUCCESS;
@@ -1310,7 +1310,7 @@ SWITCH_DECLARE(int) switch_atomic_dec(volatile switch_atomic_t *mem)
 
 SWITCH_DECLARE(char *) switch_strerror(switch_status_t statcode, char *buf, switch_size_t bufsize)
 {
-       return apr_strerror(statcode, buf, bufsize);
+       return apr_strerror(statcode, buf, bufsize);
 }
 
 /* For Emacs:
index b23236fa47ff675515f17d2c80a9f1e0359b7a6a..02f391a7a32b4b55819adad0dd31766bc43d7b16 100644 (file)
@@ -239,16 +239,16 @@ struct switch_callstate_table {
        switch_channel_callstate_t callstate;
 };
 static struct switch_callstate_table CALLSTATE_CHART[] = {
-    {"DOWN", CCS_DOWN},
-    {"DIALING", CCS_DIALING},
-    {"RINGING", CCS_RINGING},
-    {"EARLY", CCS_EARLY},
-    {"ACTIVE", CCS_ACTIVE},
-    {"HELD", CCS_HELD},
-    {"RING_WAIT", CCS_RING_WAIT},
-    {"HANGUP", CCS_HANGUP},
+       {"DOWN", CCS_DOWN},
+       {"DIALING", CCS_DIALING},
+       {"RINGING", CCS_RINGING},
+       {"EARLY", CCS_EARLY},
+       {"ACTIVE", CCS_ACTIVE},
+       {"HELD", CCS_HELD},
+       {"RING_WAIT", CCS_RING_WAIT},
+       {"HANGUP", CCS_HANGUP},
        {"UNHELD", CCS_UNHELD},
-    {NULL, 0}
+       {NULL, 0}
 };
 
 struct switch_device_state_table {
@@ -256,14 +256,14 @@ struct switch_device_state_table {
        switch_device_state_t device_state;
 };
 static struct switch_device_state_table DEVICE_STATE_CHART[] = {
-    {"DOWN", SDS_DOWN},
-    {"RINGING", SDS_RINGING},
-    {"ACTIVE", SDS_ACTIVE},
-    {"ACTIVE_MULTI", SDS_ACTIVE_MULTI},
-    {"HELD", SDS_HELD},
-    {"UNHELD", SDS_UNHELD},
-    {"HANGUP", SDS_HANGUP},
-    {NULL, 0}
+       {"DOWN", SDS_DOWN},
+       {"RINGING", SDS_RINGING},
+       {"ACTIVE", SDS_ACTIVE},
+       {"ACTIVE_MULTI", SDS_ACTIVE_MULTI},
+       {"HELD", SDS_HELD},
+       {"UNHELD", SDS_UNHELD},
+       {"HANGUP", SDS_HANGUP},
+       {NULL, 0}
 };
 
 
index 259807a2876fc07ad63ca6f84cb9f03deafc3474..67d35608c4019f949925633d5d0b60f723626038 100644 (file)
@@ -348,7 +348,7 @@ SWITCH_DECLARE(const char *) switch_core_get_hostname(void)
 
 SWITCH_DECLARE(const char *) switch_core_get_switchname(void)
 {
-    if (!zstr(runtime.switchname)) return runtime.switchname;
+       if (!zstr(runtime.switchname)) return runtime.switchname;
        return runtime.hostname;
 }
 
@@ -2312,7 +2312,7 @@ static void switch_load_core_config(const char *file)
 #endif
                                } else if (!strcasecmp(var, "switchname") && !zstr(val)) {
                                        runtime.switchname = switch_core_strdup(runtime.memory_pool, val);
-                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Set switchname to %s\n", runtime.switchname);
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Set switchname to %s\n", runtime.switchname);
                                } else if (!strcasecmp(var, "rtp-retain-crypto-keys")) {
                                        if (switch_true(val)) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
index 34d4c666cd1875775d7ecd9286c69c4d51f2345c..42c34b315046a70a87b2bbb391cffdf289993b6c 100644 (file)
@@ -110,8 +110,7 @@ static const EVP_MD *get_evp_by_name(const char *name)
  * Solaris 10 with the Sun Studio compilers doesn't have strsep in the
  * C library either.
  */
-char
-    *strsep(char **stringp, const char *delim)
+char *strsep(char **stringp, const char *delim)
 {
        char *res;
 
index f0a775e56bf8a69dc38fe1b191cfbf23dca214b9..924b358af67c5e89483d6bcd5fd3585251981e8a 100644 (file)
@@ -116,7 +116,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has no read codec.\n", switch_channel_get_name(session->channel));
                switch_channel_hangup(session->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
                *frame = &runtime.dummy_cng_frame;
-        return SWITCH_STATUS_FALSE;
+               return SWITCH_STATUS_FALSE;
        }
 
        switch_mutex_lock(session->read_codec->mutex);
@@ -928,8 +928,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
   even_more_done:
 
        if (!*frame ||
-                (!switch_test_flag(*frame, SFF_PROXY_PACKET) &&
-                    (!(*frame)->codec || !(*frame)->codec->implementation || !switch_core_codec_ready((*frame)->codec)))) {
+                       (!switch_test_flag(*frame, SFF_PROXY_PACKET) &&
+                        (!(*frame)->codec || !(*frame)->codec->implementation || !switch_core_codec_ready((*frame)->codec)))) {
                *frame = &runtime.dummy_cng_frame;
        }
 
index 947a7528c43229f245973c9c39e2805e7a38f61e..7441f018b9ecce2d6a4a85f09ac706bc2ba27fba 100644 (file)
@@ -186,8 +186,8 @@ struct switch_media_handle_s {
        switch_mutex_t *read_mutex[2];
        switch_mutex_t *write_mutex[2];
        char *codec_order[SWITCH_MAX_CODECS];
-    int codec_order_last;
-    const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
+       int codec_order_last;
+       const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
 
        int payload_space;
        char *origin;
@@ -3829,16 +3829,16 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        char tmp[32] = "";
 
 
-                    if (!switch_channel_test_flag(other_channel, CF_ANSWERED)) {
-                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
-                                          SWITCH_LOG_WARNING, "%s Error Passing T.38 to unanswered channel %s\n",
-                                          switch_channel_get_name(session->channel), switch_channel_get_name(other_channel));
-                        switch_core_session_rwunlock(other_session);
+                                       if (!switch_channel_test_flag(other_channel, CF_ANSWERED)) {
+                                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
+                                                                               SWITCH_LOG_WARNING, "%s Error Passing T.38 to unanswered channel %s\n",
+                                                                               switch_channel_get_name(session->channel), switch_channel_get_name(other_channel));
+                                               switch_core_session_rwunlock(other_session);
 
-                        pass = 0;
-                        match = 0;
-                        goto done;
-                    }
+                                               pass = 0;
+                                               match = 0;
+                                               goto done;
+                                       }
 
 
                                        if (switch_true(switch_channel_get_variable(session->channel, "t38_broken_boolean")) && 
index fc80c13da8708af783dfcb5516ffc70c945c2be3..e50eb3df5765c5f4872c3eb27936b5f6e214de20 100644 (file)
@@ -1073,7 +1073,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_sess
        stream->write_function(stream, "<media-bugs>\n");
 
        if (session->bugs) {
-        switch_thread_rwlock_rdlock(session->bug_rwlock);
+               switch_thread_rwlock_rdlock(session->bug_rwlock);
                for (bp = session->bugs; bp; bp = bp->next) {
                        int thread_locked = (bp->thread_id && bp->thread_id == switch_thread_self());
                        stream->write_function(stream, 
index 9b6e28e9dd405151fceda01adbe73ff312d0be54..a4a64d96e5ed908988d520286f6d1c2c93ca55b1 100644 (file)
@@ -315,7 +315,7 @@ SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_i
        void *val;
        switch_core_session_t *session;
        switch_memory_pool_t *pool;
-    struct str_node *head = NULL, *np;
+       struct str_node *head = NULL, *np;
        
        switch_core_new_memory_pool(&pool);
        
@@ -327,8 +327,8 @@ SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_i
                        if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
                                if (session->endpoint_interface == endpoint_interface) {
                                        np = switch_core_alloc(pool, sizeof(*np));
-                    np->str = switch_core_strdup(pool, session->uuid_str);
-                    np->next = head;
+                                       np->str = switch_core_strdup(pool, session->uuid_str);
+                                       np->next = head;
                                        head = np;
                                }
                                switch_core_session_rwunlock(session);
index 40ba64332f36fc3580ab2ef4afb72023e51c9186..ff1ee6ff9f8cd2db0ac9372bfb70697b52ac084f 100644 (file)
@@ -3524,12 +3524,12 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
                                //runtime.odbc_dsn = NULL;
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error [%s]\n", err);
                                //switch_cache_db_release_db_handle(&sql_manager.dbh);
-                                if (switch_stristr("read-only", err)) { 
-                                        switch_safe_free(err);
-                                } else {
-                                        switch_safe_free(err);
-                                        goto top;
-                                }
+                               if (switch_stristr("read-only", err)) { 
+                                       switch_safe_free(err);
+                               } else {
+                                       switch_safe_free(err);
+                                       goto top;
+                               }
                        }
                }
                break;
index e37517ca612ae0ba1dd21d85e06b891080aba7b8..9bbf6e67146265bd1b65d7f22a9f17750f312f87 100644 (file)
@@ -60,76 +60,76 @@ static void switch_core_standard_on_hangup(switch_core_session_t *session)
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard HANGUP, cause: %s\n",
                                          switch_channel_get_name(session->channel), switch_channel_cause2str(switch_channel_get_cause(session->channel)));
 
-    if (switch_true(switch_channel_get_variable(session->channel, "log_audio_stats_on_hangup"))) {
-        switch_rtp_stats_t *audio_stats = NULL;
-
-        switch_core_media_set_stats(session);
-        audio_stats = switch_core_media_get_stats(session, SWITCH_MEDIA_TYPE_AUDIO, switch_core_session_get_pool(session));
-        if (audio_stats) {
-            switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
-                              SWITCH_LOG_DEBUG,
-                              "%s Call statistics:\n"
-                              "in_raw_bytes: %d\n"
-                              "in_media_bytes: %d\n"
-                              "in_packet_count: %d\n"
-                              "in_media_packet_count: %d\n"
-                              "in_skip_packet_count: %d\n"
-                              "in_jitter_packet_count: %d\n"
-                              "in_dtmf_packet_count: %d\n"
-                              "in_cng_packet_count: %d\n"
-                              "in_flush_packet_count: %d\n"
-                              "in_largest_jb_size: %d\n\n"
-                              "in_jitter_min_variance: %lf\n"
-                              "in_jitter_max_variance: %lf\n"
-                              "in_jitter_loss_rate: %lf\n"
-                              "in_jitter_burst_rate: %lf\n"
-                              "in_mean_interval: %lf\n\n"
-                              "in_flaw_total: %d\n"
-                              "in_quality_percentage: %lf\n"
-                              "in_mos: %lf\n\n"
-                              "out_raw_bytes: %d\n"
-                              "out_media_bytes: %d\n"
-                              "out_packet_count: %d\n"
-                              "out_media_packet_count: %d\n"
-                              "out_skip_packet_count: %d\n"
-                              "out_dtmf_packet_count: %d\n"
-                              "out_cng_packet_count: %d\n\n"
-                              "rtcp_packet_count: %d\n"
-                              "rtcp_octet_count: %d\n",
-                              switch_channel_get_name(session->channel),
-                              (int)audio_stats->inbound.raw_bytes,
-                              (int)audio_stats->inbound.media_bytes,
-                              (int)audio_stats->inbound.packet_count,
-                              (int)audio_stats->inbound.media_packet_count,
-                              (int)audio_stats->inbound.skip_packet_count,
-                              (int)audio_stats->inbound.jb_packet_count,
-                              (int)audio_stats->inbound.dtmf_packet_count,
-                              (int)audio_stats->inbound.cng_packet_count,
-                              (int)audio_stats->inbound.flush_packet_count,
-                              (int)audio_stats->inbound.largest_jb_size,
-                              audio_stats->inbound.min_variance,
-                              audio_stats->inbound.max_variance,
-                              audio_stats->inbound.lossrate,
-                              audio_stats->inbound.burstrate,
-                              audio_stats->inbound.mean_interval,
-                              (int)audio_stats->inbound.flaws,
-                              audio_stats->inbound.R,
-                              audio_stats->inbound.mos,
-                              (int)audio_stats->outbound.raw_bytes,
-                              (int)audio_stats->outbound.media_bytes,
-                              (int)audio_stats->outbound.packet_count,
-                              (int)audio_stats->outbound.media_packet_count,
-                              (int)audio_stats->outbound.skip_packet_count,
-                              (int)audio_stats->outbound.dtmf_packet_count,
-                              (int)audio_stats->outbound.cng_packet_count,
-                              (int)audio_stats->rtcp.packet_count,
-                              (int)audio_stats->rtcp.octet_count
-            );
-        } else {
-            switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Missing call statistics!\n",
-                              switch_channel_get_name(session->channel));
-        }
-    }
+       if (switch_true(switch_channel_get_variable(session->channel, "log_audio_stats_on_hangup"))) {
+               switch_rtp_stats_t *audio_stats = NULL;
+
+               switch_core_media_set_stats(session);
+               audio_stats = switch_core_media_get_stats(session, SWITCH_MEDIA_TYPE_AUDIO, switch_core_session_get_pool(session));
+               if (audio_stats) {
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
+                                       SWITCH_LOG_DEBUG,
+                                       "%s Call statistics:\n"
+                                       "in_raw_bytes: %d\n"
+                                       "in_media_bytes: %d\n"
+                                       "in_packet_count: %d\n"
+                                       "in_media_packet_count: %d\n"
+                                       "in_skip_packet_count: %d\n"
+                                       "in_jitter_packet_count: %d\n"
+                                       "in_dtmf_packet_count: %d\n"
+                                       "in_cng_packet_count: %d\n"
+                                       "in_flush_packet_count: %d\n"
+                                       "in_largest_jb_size: %d\n\n"
+                                       "in_jitter_min_variance: %lf\n"
+                                       "in_jitter_max_variance: %lf\n"
+                                       "in_jitter_loss_rate: %lf\n"
+                                       "in_jitter_burst_rate: %lf\n"
+                                       "in_mean_interval: %lf\n\n"
+                                       "in_flaw_total: %d\n"
+                                       "in_quality_percentage: %lf\n"
+                                       "in_mos: %lf\n\n"
+                                       "out_raw_bytes: %d\n"
+                                       "out_media_bytes: %d\n"
+                                       "out_packet_count: %d\n"
+                                       "out_media_packet_count: %d\n"
+                                       "out_skip_packet_count: %d\n"
+                                       "out_dtmf_packet_count: %d\n"
+                                       "out_cng_packet_count: %d\n\n"
+                                       "rtcp_packet_count: %d\n"
+                                       "rtcp_octet_count: %d\n",
+                               switch_channel_get_name(session->channel),
+                               (int)audio_stats->inbound.raw_bytes,
+                               (int)audio_stats->inbound.media_bytes,
+                               (int)audio_stats->inbound.packet_count,
+                               (int)audio_stats->inbound.media_packet_count,
+                               (int)audio_stats->inbound.skip_packet_count,
+                               (int)audio_stats->inbound.jb_packet_count,
+                               (int)audio_stats->inbound.dtmf_packet_count,
+                               (int)audio_stats->inbound.cng_packet_count,
+                               (int)audio_stats->inbound.flush_packet_count,
+                               (int)audio_stats->inbound.largest_jb_size,
+                               audio_stats->inbound.min_variance,
+                               audio_stats->inbound.max_variance,
+                               audio_stats->inbound.lossrate,
+                               audio_stats->inbound.burstrate,
+                               audio_stats->inbound.mean_interval,
+                               (int)audio_stats->inbound.flaws,
+                               audio_stats->inbound.R,
+                               audio_stats->inbound.mos,
+                               (int)audio_stats->outbound.raw_bytes,
+                               (int)audio_stats->outbound.media_bytes,
+                               (int)audio_stats->outbound.packet_count,
+                               (int)audio_stats->outbound.media_packet_count,
+                               (int)audio_stats->outbound.skip_packet_count,
+                               (int)audio_stats->outbound.dtmf_packet_count,
+                               (int)audio_stats->outbound.cng_packet_count,
+                               (int)audio_stats->rtcp.packet_count,
+                               (int)audio_stats->rtcp.octet_count
+                                       );
+               } else {
+                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Missing call statistics!\n",
+                                       switch_channel_get_name(session->channel));
+               }
+       }
 
        rec = switch_channel_test_flag(session->channel, CF_RECOVERING);
        switch_channel_clear_flag(session->channel, CF_RECOVERING);
index 288940bea1b1e0d04150d01534612d45edac09a7..b317a80c8631c9602f03b84b3bffda12291dfb01 100644 (file)
@@ -129,10 +129,10 @@ struct fit_el {
 
 
 static struct fit_el IMG_FIT_TABLE[] = {
-               {SWITCH_FIT_SIZE, "fit-size"},
-               {SWITCH_FIT_SCALE, "fit-scale"},
-               {SWITCH_FIT_SIZE_AND_SCALE, "fit-size-and-scale"},
-               {SWITCH_FIT_NONE, NULL}
+       {SWITCH_FIT_SIZE, "fit-size"},
+       {SWITCH_FIT_SCALE, "fit-scale"},
+       {SWITCH_FIT_SIZE_AND_SCALE, "fit-size-and-scale"},
+       {SWITCH_FIT_NONE, NULL}
 };
 
 
@@ -813,9 +813,9 @@ SWITCH_DECLARE(switch_status_t) switch_img_txt_handle_create(switch_img_txt_hand
        new_handle->pool = pool;
        new_handle->free_pool = free_pool;
 
-    if (zstr(font_family)) {
+       if (zstr(font_family)) {
                font_family = switch_core_sprintf(new_handle->pool, "%s%s%s",SWITCH_GLOBAL_dirs.fonts_dir, SWITCH_PATH_SEPARATOR, "FreeMono.ttf");
-    }
+       }
 
        if (!switch_is_file_path(font_family)) {
                new_handle->font_family = switch_core_sprintf(new_handle->pool, "%s%s%s",SWITCH_GLOBAL_dirs.fonts_dir, SWITCH_PATH_SEPARATOR, font_family);
@@ -910,7 +910,7 @@ static void draw_bitmap(switch_img_txt_handle_t *handle, switch_image_t *img, FT
                case FT_PIXEL_MODE_LCD_V:
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "unsupported pixel mode %d\n", bitmap->pixel_mode);
                        return;
-    }
+       }
 
        for ( i = x, p = 0; i < x_max; i++, p++ ) {
                for ( j = y, q = 0; j < y_max; j++, q++ ) {
@@ -1081,11 +1081,11 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_
        char *txt = "Value Optimized Out!";
        int argc = 0;
        char *argv[6] = { 0 };
-    switch_rgb_color_t bgcolor = { 0 };
-    int pre_width = 0, width = 0, font_size = 0, height = 0;
+       switch_rgb_color_t bgcolor = { 0 };
+       int pre_width = 0, width = 0, font_size = 0, height = 0;
        int len = 0;
        char *duptxt = strdup(text);
-    switch_img_txt_handle_t *txthandle = NULL;
+       switch_img_txt_handle_t *txthandle = NULL;
        switch_image_t *txtimg = NULL;
        int x = 0, y = 0;
 
@@ -1124,15 +1124,15 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_
        while (*txt == ' ') txt++;
        while (end_of(txt) == ' ') end_of(txt) = '\0';
        
-    len = strlen(txt);
+       len = strlen(txt);
 
-    if (len < 5) len = 5;
+       if (len < 5) len = 5;
 
 
        switch_img_txt_handle_create(&txthandle, font_face, fg, bg, font_size, 0, NULL);
        switch_color_set_rgb(&bgcolor, bg);
 
-    pre_width = switch_img_txt_handle_render(txthandle,
+       pre_width = switch_img_txt_handle_render(txthandle,
                                                                                         NULL,
                                                                                         font_size / 2, font_size / 2,
                                                                                         txt, NULL, fg, bg, 0, 0);
@@ -1162,10 +1162,10 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_
                x = (txtimg->d_w / 2) - (pre_width / 2);
        }
 
-    switch_img_txt_handle_render(txthandle,
-                                 txtimg,
-                                 x, y,
-                                 txt, NULL, fg, bg, 0, 0);
+       switch_img_txt_handle_render(txthandle,
+                                                               txtimg,
+                                                               x, y,
+                                                               txt, NULL, fg, bg, 0, 0);
        switch_img_txt_handle_destroy(&txthandle);
 
        switch_safe_free(duptxt);
@@ -1974,9 +1974,9 @@ static inline uint32_t switch_img_fmt2fourcc(switch_img_fmt_t fmt)
                case SWITCH_IMG_FMT_I44416:    fourcc = FOURCC_ANY ; break;
                case SWITCH_IMG_FMT_I44016:    fourcc = FOURCC_ANY ; break;
                default: fourcc = FOURCC_ANY;
-    }
+       }
 
-    return fourcc;
+       return fourcc;
 }
 #endif
 
@@ -2032,14 +2032,14 @@ SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t *dest, void *
 
 /*
        int ConvertToI420(const uint8* src_frame, size_t src_size,
-                  uint8* dst_y, int dst_stride_y,
-                  uint8* dst_u, int dst_stride_u,
-                  uint8* dst_v, int dst_stride_v,
-                  int crop_x, int crop_y,
-                  int src_width, int src_height,
-                  int crop_width, int crop_height,
-                  enum RotationMode rotation,
-                  uint32 format);
+                       uint8* dst_y, int dst_stride_y,
+                       uint8* dst_u, int dst_stride_u,
+                       uint8* dst_v, int dst_stride_v,
+                       int crop_x, int crop_y,
+                       int src_width, int src_height,
+                       int crop_width, int crop_height,
+                       enum RotationMode rotation,
+                       uint32 format);
 
        src_size is only used when FOURCC_MJPG which we don't support so always 0
 */
@@ -2085,10 +2085,10 @@ SWITCH_DECLARE(switch_status_t) switch_img_scale(switch_image_t *src, switch_ima
                                                kFilterBox);
        } else if (src->fmt == SWITCH_IMG_FMT_ARGB) {
                ret = ARGBScale(src->planes[SWITCH_PLANE_PACKED], src->d_w * 4,
-              src->d_w, src->d_h,
-              dest->planes[SWITCH_PLANE_PACKED], width * 4,
-              width, height,
-              kFilterBox);
+                               src->d_w, src->d_h,
+                               dest->planes[SWITCH_PLANE_PACKED], width * 4,
+                               width, height,
+                               kFilterBox);
        }
 
        if (ret != 0) {
index 458b5abcabfa8239b64e1de0c55a64b4b4b1cd04..d0b47778e7940dbea91fb5897839d6a98f4caa0c 100644 (file)
@@ -57,33 +57,33 @@ switch_create_hashtable(switch_hashtable_t **hp, unsigned int minsize,
                                                unsigned int (*hashf) (void*),
                                                int (*eqf) (void*,void*))
 {
-    switch_hashtable_t *h;
-    unsigned int pindex, size = primes[0];
-
-    /* Check requested hashtable isn't too large */
-    if (minsize > (1u << 30)) {*hp = NULL; return SWITCH_STATUS_FALSE;}
-    /* Enforce size as prime */
-    for (pindex=0; pindex < prime_table_length; pindex++) {
-        if (primes[pindex] > minsize) { 
+       switch_hashtable_t *h;
+       unsigned int pindex, size = primes[0];
+
+       /* Check requested hashtable isn't too large */
+       if (minsize > (1u << 30)) {*hp = NULL; return SWITCH_STATUS_FALSE;}
+       /* Enforce size as prime */
+       for (pindex=0; pindex < prime_table_length; pindex++) {
+               if (primes[pindex] > minsize) { 
                        size = primes[pindex]; 
                        break; 
                }
-    }
-    h = (switch_hashtable_t *) malloc(sizeof(switch_hashtable_t));
+       }
+       h = (switch_hashtable_t *) malloc(sizeof(switch_hashtable_t));
 
-    if (NULL == h) abort(); /*oom*/
+       if (NULL == h) abort(); /*oom*/
 
-    h->table = (struct entry **)malloc(sizeof(struct entry*) * size);
+       h->table = (struct entry **)malloc(sizeof(struct entry*) * size);
 
-    if (NULL == h->table) abort(); /*oom*/
+       if (NULL == h->table) abort(); /*oom*/
 
-    memset(h->table, 0, size * sizeof(struct entry *));
-    h->tablelength  = size;
-    h->primeindex   = pindex;
-    h->entrycount   = 0;
-    h->hashfn       = hashf;
-    h->eqfn         = eqf;
-    h->loadlimit    = (unsigned int) ceil(size * max_load_factor);
+       memset(h->table, 0, size * sizeof(struct entry *));
+       h->tablelength  = size;
+       h->primeindex   = pindex;
+       h->entrycount   = 0;
+       h->hashfn       = hashf;
+       h->eqfn         = eqf;
+       h->loadlimit    = (unsigned int) ceil(size * max_load_factor);
 
        *hp = h;
        return SWITCH_STATUS_SUCCESS;
@@ -93,17 +93,17 @@ switch_create_hashtable(switch_hashtable_t **hp, unsigned int minsize,
 static int
 hashtable_expand(switch_hashtable_t *h)
 {
-    /* Double the size of the table to accomodate more entries */
-    struct entry **newtable;
-    struct entry *e;
-    struct entry **pE;
-    unsigned int newsize, i, index;
-    /* Check we're not hitting max capacity */
-    if (h->primeindex == (prime_table_length - 1)) return 0;
-    newsize = primes[++(h->primeindex)];
-
-    newtable = (struct entry **)malloc(sizeof(struct entry*) * newsize);
-    if (NULL != newtable)
+       /* Double the size of the table to accomodate more entries */
+       struct entry **newtable;
+       struct entry *e;
+       struct entry **pE;
+       unsigned int newsize, i, index;
+       /* Check we're not hitting max capacity */
+       if (h->primeindex == (prime_table_length - 1)) return 0;
+       newsize = primes[++(h->primeindex)];
+
+       newtable = (struct entry **)malloc(sizeof(struct entry*) * newsize);
+       if (NULL != newtable)
                {
                        memset(newtable, 0, newsize * sizeof(struct entry *));
                        /* This algorithm is not 'stable'. ie. it reverses the list
@@ -119,8 +119,8 @@ hashtable_expand(switch_hashtable_t *h)
                        switch_safe_free(h->table);
                        h->table = newtable;
                }
-    /* Plan B: realloc instead */
-    else 
+       /* Plan B: realloc instead */
+       else 
                {
                        newtable = (struct entry **)
                                realloc(h->table, newsize * sizeof(struct entry *));
@@ -141,30 +141,30 @@ hashtable_expand(switch_hashtable_t *h)
                                }
                        }
                }
-    h->tablelength = newsize;
-    h->loadlimit   = (unsigned int) ceil(newsize * max_load_factor);
-    return -1;
+       h->tablelength = newsize;
+       h->loadlimit   = (unsigned int) ceil(newsize * max_load_factor);
+       return -1;
 }
 
 /*****************************************************************************/
 SWITCH_DECLARE(unsigned int)
 switch_hashtable_count(switch_hashtable_t *h)
 {
-    return h->entrycount;
+       return h->entrycount;
 }
 
 static void * _switch_hashtable_remove(switch_hashtable_t *h, void *k, unsigned int hashvalue, unsigned int index) {
-    /* TODO: consider compacting the table when the load factor drops enough,
-     *       or provide a 'compact' method. */
+       /* TODO: consider compacting the table when the load factor drops enough,
+        *       or provide a 'compact' method. */
 
-    struct entry *e;
-    struct entry **pE;
-    void *v;
+       struct entry *e;
+       struct entry **pE;
+       void *v;
 
 
-    pE = &(h->table[index]);
-    e = *pE;
-    while (NULL != e) {
+       pE = &(h->table[index]);
+       e = *pE;
+       while (NULL != e) {
                /* Check hash value to short circuit heavier comparison */
                if ((hashvalue == e->h) && (h->eqfn(k, e->k))) {
                        *pE = e->next;
@@ -186,22 +186,22 @@ static void * _switch_hashtable_remove(switch_hashtable_t *h, void *k, unsigned
                pE = &(e->next);
                e = e->next;
        }
-    return NULL;
+       return NULL;
 }
 
 /*****************************************************************************/
 SWITCH_DECLARE(int)
 switch_hashtable_insert_destructor(switch_hashtable_t *h, void *k, void *v, hashtable_flag_t flags, hashtable_destructor_t destructor)
 {
-    struct entry *e;
+       struct entry *e;
        unsigned int hashvalue = hash(h, k);
-    unsigned index = indexFor(h->tablelength, hashvalue);
+       unsigned index = indexFor(h->tablelength, hashvalue);
 
        if (flags & HASHTABLE_DUP_CHECK) {
                _switch_hashtable_remove(h, k, hashvalue, index);
        }
 
-    if (++(h->entrycount) > h->loadlimit)
+       if (++(h->entrycount) > h->loadlimit)
                {
                        /* Ignore the return value. If expand fails, we should
                         * still try cramming just this value into the existing table
@@ -210,33 +210,33 @@ switch_hashtable_insert_destructor(switch_hashtable_t *h, void *k, void *v, hash
                        hashtable_expand(h);
                        index = indexFor(h->tablelength, hashvalue);
                }
-    e = (struct entry *)malloc(sizeof(struct entry));
-    if (NULL == e) { --(h->entrycount); return 0; } /*oom*/
-    e->h = hashvalue;
-    e->k = k;
-    e->v = v;
+       e = (struct entry *)malloc(sizeof(struct entry));
+       if (NULL == e) { --(h->entrycount); return 0; } /*oom*/
+       e->h = hashvalue;
+       e->k = k;
+       e->v = v;
        e->flags = flags;
        e->destructor = destructor;
-    e->next = h->table[index];
-    h->table[index] = e;
-    return -1;
+       e->next = h->table[index];
+       h->table[index] = e;
+       return -1;
 }
 
 /*****************************************************************************/
 SWITCH_DECLARE(void *) /* returns value associated with key */
 switch_hashtable_search(switch_hashtable_t *h, void *k)
 {
-    struct entry *e;
-    unsigned int hashvalue, index;
-    hashvalue = hash(h,k);
-    index = indexFor(h->tablelength,hashvalue);
-    e = h->table[index];
-    while (NULL != e) {
+       struct entry *e;
+       unsigned int hashvalue, index;
+       hashvalue = hash(h,k);
+       index = indexFor(h->tablelength,hashvalue);
+       e = h->table[index];
+       while (NULL != e) {
                /* Check hash value to short circuit heavier comparison */
                if ((hashvalue == e->h) && (h->eqfn(k, e->k))) return e->v;
                e = e->next;
        }
-    return NULL;
+       return NULL;
 }
 
 /*****************************************************************************/
@@ -252,9 +252,9 @@ switch_hashtable_remove(switch_hashtable_t *h, void *k)
 SWITCH_DECLARE(void)
 switch_hashtable_destroy(switch_hashtable_t **h)
 {
-    unsigned int i;
-    struct entry *e, *f;
-    struct entry **table = (*h)->table;
+       unsigned int i;
+       struct entry *e, *f;
+       struct entry **table = (*h)->table;
 
        for (i = 0; i < (*h)->tablelength; i++) {
                e = table[i];
@@ -274,8 +274,8 @@ switch_hashtable_destroy(switch_hashtable_t **h)
                        switch_safe_free(f); 
                }
        }
-    
-    switch_safe_free((*h)->table);
+
+       switch_safe_free((*h)->table);
        free(*h);
        *h = NULL;
 }
index 96fc5a79717b94e341115e0cd940e440c1e7ab4a..712e9e15a0bf44584fca65cc281ac17cf8484a3f 100644 (file)
@@ -1848,8 +1848,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_3p_nomedia(const char *uuid, switch_m
                                }
 
                                if (switch_core_session_in_thread(session)) {
-                    switch_yield(100000);
-                } else {
+                                       switch_yield(100000);
+                               } else {
                                        switch_channel_wait_for_state(other_channel, channel, CS_HIBERNATE);
                                }
 
@@ -1948,8 +1948,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
                                }
 
                                if (switch_core_session_in_thread(session)) {
-                    switch_yield(100000);
-                } else {
+                                       switch_yield(100000);
+                               } else {
                                        switch_channel_wait_for_state(other_channel, channel, CS_HIBERNATE);
                                }
 
@@ -3820,9 +3820,9 @@ SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_force_exists(const char *uuid)
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *session, const char *cmd, switch_file_handle_t *fhp)
 {
-    if (zstr(cmd)) {
+       if (zstr(cmd)) {
                return SWITCH_STATUS_SUCCESS;   
-    }
+       }
 
        if (fhp) {
                if (!switch_test_flag(fhp, SWITCH_FILE_OPEN)) {
@@ -3926,11 +3926,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses
                }
        }
 
-    if (!strcmp(cmd, "true") || !strcmp(cmd, "undefined")) {
+       if (!strcmp(cmd, "true") || !strcmp(cmd, "undefined")) {
                return SWITCH_STATUS_SUCCESS;
-    }
+       }
 
-    return SWITCH_STATUS_FALSE;
+       return SWITCH_STATUS_FALSE;
        
 }
 
index 00837038aaea7c90f6b4f798a9fdec01d4ceccba..1220991b0f4da8f5c8f5a2c3eb9c2a57a29c278b 100644 (file)
@@ -5096,16 +5096,16 @@ static switch_bool_t video_write_overlay_callback(switch_media_bug_t *bug, void
        switch_core_session_t *session = switch_core_media_bug_get_session(bug);
        switch_channel_t *channel = switch_core_session_get_channel(session);
        
-    switch (type) {
-    case SWITCH_ABC_TYPE_INIT:
-        {                      
-        }
-        break;
-    case SWITCH_ABC_TYPE_CLOSE:
-        {
+       switch (type) {
+       case SWITCH_ABC_TYPE_INIT:
+               {                       
+               }
+               break;
+       case SWITCH_ABC_TYPE_CLOSE:
+               {
                        switch_img_free(&oht->img);
-        }
-        break;
+               }
+               break;
        case SWITCH_ABC_TYPE_WRITE_VIDEO_PING:
                if (switch_channel_test_flag(channel, CF_VIDEO_DECODED_READ)) {
                        switch_frame_t *frame = switch_core_media_bug_get_video_ping_frame(bug);
@@ -5121,12 +5121,12 @@ static switch_bool_t video_write_overlay_callback(switch_media_bug_t *bug, void
                                switch_img_free(&oimg);
                        }
                }
-        break;
-    default:
-        break;
-    }
+               break;
+       default:
+               break;
+       }
 
-    return SWITCH_TRUE;
+       return SWITCH_TRUE;
 }
 
 
@@ -5150,7 +5150,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_video_write_overlay_session(switch_co
        switch_channel_t *channel = switch_core_session_get_channel(session);
        switch_status_t status;
        switch_media_bug_flag_t bflags = SMBF_WRITE_VIDEO_PING;
-    switch_media_bug_t *bug;
+       switch_media_bug_t *bug;
        overly_helper_t *oht;
        switch_image_t *img;
 
index 8ad48130663c2a975780ab4743f0f8cb15a99fc5..63d6e567ca677d94718393d94fd34f73fae6baf2 100644 (file)
@@ -1026,7 +1026,7 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio
                if (switch_ivr_wait_for_answer(session, other_session) != SWITCH_STATUS_SUCCESS) {
                        if (switch_true(switch_channel_get_variable(channel, "uuid_bridge_continue_on_cancel"))) {
                                switch_channel_set_state(channel, CS_EXECUTE);
-                        } else if (switch_true(switch_channel_get_variable(channel, "uuid_bridge_park_on_cancel"))) {
+                       } else if (switch_true(switch_channel_get_variable(channel, "uuid_bridge_park_on_cancel"))) {
                                switch_ivr_park_session(session);
                        } else if (!switch_channel_test_flag(channel, CF_TRANSFER)) {
                                switch_channel_hangup(channel, SWITCH_CAUSE_ORIGINATOR_CANCEL);
@@ -1700,7 +1700,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
                switch_call_cause_t cause = switch_channel_get_cause(peer_channel);
                const char *hup = switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE);
                int explicit = 0;
-        int answered = 0;
+               int answered = 0;
                int early = 0;
 
                if (cause == SWITCH_CAUSE_NONE) {
index 2f52967a0b6662aa851fdca89af60d1f5e45106a..370433fe20f3e15cab16119ab2c85b5d9796b5dc 100644 (file)
@@ -59,23 +59,23 @@ static void (*cJSON_free)(void *ptr) = glue_free;
 
 static char* cJSON_strdup(const char* str)
 {
-      size_t len;
-      char* copy;
-      const char *s = str ? str : "";
-
-      len = strlen(s) + 1;
-      if (!(copy = (char*)cJSON_malloc(len))) return 0;
-      memcpy(copy,s,len);
-      return copy;
+       size_t len;
+       char* copy;
+       const char *s = str ? str : "";
+
+       len = strlen(s) + 1;
+       if (!(copy = (char*)cJSON_malloc(len))) return 0;
+       memcpy(copy,s,len);
+       return copy;
 }
 
 SWITCH_DECLARE(void)cJSON_InitHooks(cJSON_Hooks* hooks)
 {
-    if (!hooks) { /* Reset hooks */
-        cJSON_malloc = malloc;
-        cJSON_free = free;
-        return;
-    }
+       if (!hooks) { /* Reset hooks */
+               cJSON_malloc = malloc;
+               cJSON_free = free;
+               return;
+       }
 
        cJSON_malloc = (hooks->malloc_fn)?hooks->malloc_fn:malloc;
        cJSON_free       = (hooks->free_fn)?hooks->free_fn:free;
index cc034b6be7135d4229877a420a52fe54252a7e06..a7d5aa48f897a71e7f135f59cd32ccc1bb70b30f 100644 (file)
@@ -470,23 +470,23 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
                                                                                         switch_raw_decode,     /* function to decode encoded data into raw data */
                                                                                         switch_raw_destroy);   /* deinitalize a codec handle using this implementation */
 
-    switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
-                       100,  /* the IANA code number */
-                       "L16", /* the IANA code name */
-                       NULL,  /* default fmtp to send (can be overridden by the init function) */
-                       12000, /* samples transferred per second */
-                       12000, /* actual samples transferred per second */
-                       192000 * 2,  /* bits transferred per second */
-                       ms_per_frame,  /* number of microseconds per frame */
-                       samples_per_frame, /* number of samples per frame */
-                       bytes_per_frame * 2, /* number of bytes per frame decompressed */
-                       bytes_per_frame * 2, /* number of bytes per frame compressed */
-                       2, /* number of channels represented */
-                       1, /* number of frames per network packet */
-                       switch_raw_init, /* function to initialize a codec handle using this implementation */
-                       switch_raw_encode, /* function to encode raw data into encoded data */
-                       switch_raw_decode, /* function to decode encoded data into raw data */
-                       switch_raw_destroy); /* deinitalize a codec handle using this implementation */
+               switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
+                               100,  /* the IANA code number */
+                               "L16", /* the IANA code name */
+                               NULL,  /* default fmtp to send (can be overridden by the init function) */
+                               12000, /* samples transferred per second */
+                               12000, /* actual samples transferred per second */
+                               192000 * 2,  /* bits transferred per second */
+                               ms_per_frame,  /* number of microseconds per frame */
+                               samples_per_frame, /* number of samples per frame */
+                               bytes_per_frame * 2, /* number of bytes per frame decompressed */
+                               bytes_per_frame * 2, /* number of bytes per frame compressed */
+                               2, /* number of channels represented */
+                               1, /* number of frames per network packet */
+                               switch_raw_init, /* function to initialize a codec handle using this implementation */
+                               switch_raw_encode, /* function to encode raw data into encoded data */
+                               switch_raw_decode, /* function to decode encoded data into raw data */
+                               switch_raw_destroy); /* deinitalize a codec handle using this implementation */
 
                samples_per_frame += 240;
                bytes_per_frame += 480;
@@ -517,23 +517,23 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
                                                                                         switch_raw_decode,     /* function to decode encoded data into raw data */
                                                                                         switch_raw_destroy);   /* deinitalize a codec handle using this implementation */
 
-    switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
-                       100,  /* the IANA code number */
-                       "L16", /* the IANA code name */
-                       NULL,  /* default fmtp to send (can be overridden by the init function) */
-                       24000, /* samples transferred per second */
-                       24000, /* actual samples transferred per second */
-                       384000 * 2,  /* bits transferred per second */
-                       ms_per_frame,  /* number of microseconds per frame */
-                       samples_per_frame, /* number of samples per frame */
-                       bytes_per_frame * 2, /* number of bytes per frame decompressed */
-                       bytes_per_frame * 2, /* number of bytes per frame compressed */
-                       2, /* number of channels represented */
-                       1, /* number of frames per network packet */
-                       switch_raw_init, /* function to initialize a codec handle using this implementation */
-                       switch_raw_encode, /* function to encode raw data into encoded data */
-                       switch_raw_decode, /* function to decode encoded data into raw data */
-                       switch_raw_destroy); /* deinitalize a codec handle using this implementation */
+               switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
+                               100,  /* the IANA code number */
+                               "L16", /* the IANA code name */
+                               NULL,  /* default fmtp to send (can be overridden by the init function) */
+                               24000, /* samples transferred per second */
+                               24000, /* actual samples transferred per second */
+                               384000 * 2,  /* bits transferred per second */
+                               ms_per_frame,  /* number of microseconds per frame */
+                               samples_per_frame, /* number of samples per frame */
+                               bytes_per_frame * 2, /* number of bytes per frame decompressed */
+                               bytes_per_frame * 2, /* number of bytes per frame compressed */
+                               2, /* number of channels represented */
+                               1, /* number of frames per network packet */
+                               switch_raw_init, /* function to initialize a codec handle using this implementation */
+                               switch_raw_encode, /* function to encode raw data into encoded data */
+                               switch_raw_decode, /* function to decode encoded data into raw data */
+                               switch_raw_destroy); /* deinitalize a codec handle using this implementation */
 
                samples_per_frame += 480;
                bytes_per_frame += 960;
@@ -614,23 +614,23 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
                                                                                         switch_raw_decode,     /* function to decode encoded data into raw data */
                                                                                         switch_raw_destroy);   /* deinitalize a codec handle using this implementation */
 
-    switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
-                       100,  /* the IANA code number */
-                       "L16", /* the IANA code name */
-                       NULL,  /* default fmtp to send (can be overridden by the init function) */
-                       8000,  /* samples transferred per second */
-                       8000,  /* actual samples transferred per second */
-                       128000 * 2,  /* bits transferred per second */
-                       ms_per_frame,  /* number of microseconds per frame */
-                       samples_per_frame, /* number of samples per frame */
-                       bytes_per_frame * 2, /* number of bytes per frame decompressed */
-                       bytes_per_frame * 2, /* number of bytes per frame compressed */
-                       2, /* number of channels represented */
-                       1, /* number of frames per network packet */
-                       switch_raw_init, /* function to initialize a codec handle using this implementation */
-                       switch_raw_encode, /* function to encode raw data into encoded data */
-                       switch_raw_decode, /* function to decode encoded data into raw data */
-                       switch_raw_destroy); /* deinitalize a codec handle using this implementation */
+               switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
+                               100,  /* the IANA code number */
+                               "L16", /* the IANA code name */
+                               NULL,  /* default fmtp to send (can be overridden by the init function) */
+                               8000,  /* samples transferred per second */
+                               8000,  /* actual samples transferred per second */
+                               128000 * 2,  /* bits transferred per second */
+                               ms_per_frame,  /* number of microseconds per frame */
+                               samples_per_frame, /* number of samples per frame */
+                               bytes_per_frame * 2, /* number of bytes per frame decompressed */
+                               bytes_per_frame * 2, /* number of bytes per frame compressed */
+                               2, /* number of channels represented */
+                               1, /* number of frames per network packet */
+                               switch_raw_init, /* function to initialize a codec handle using this implementation */
+                               switch_raw_encode, /* function to encode raw data into encoded data */
+                               switch_raw_decode, /* function to decode encoded data into raw data */
+                               switch_raw_destroy); /* deinitalize a codec handle using this implementation */
 
                samples_per_frame += 16;
                bytes_per_frame += 32;
@@ -661,23 +661,23 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
                                                                                         switch_raw_decode,     /* function to decode encoded data into raw data */
                                                                                         switch_raw_destroy);   /* deinitalize a codec handle using this implementation */
 
-    switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
-                       100,  /* the IANA code number */
-                       "L16", /* the IANA code name */
-                       NULL,  /* default fmtp to send (can be overridden by the init function) */
-                       16000, /* samples transferred per second */
-                       16000, /* actual samples transferred per second */
-                       256000 * 2,  /* bits transferred per second */
-                       ms_per_frame,  /* number of microseconds per frame */
-                       samples_per_frame, /* number of samples per frame */
-                       bytes_per_frame * 2, /* number of bytes per frame decompressed */
-                       bytes_per_frame * 2, /* number of bytes per frame compressed */
-                       2, /* number of channels represented */
-                       1, /* number of frames per network packet */
-                       switch_raw_init, /* function to initialize a codec handle using this implementation */
-                       switch_raw_encode, /* function to encode raw data into encoded data */
-                       switch_raw_decode, /* function to decode encoded data into raw data */
-                       switch_raw_destroy); /* deinitalize a codec handle using this implementation */
+               switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
+                               100,  /* the IANA code number */
+                               "L16", /* the IANA code name */
+                               NULL,  /* default fmtp to send (can be overridden by the init function) */
+                               16000, /* samples transferred per second */
+                               16000, /* actual samples transferred per second */
+                               256000 * 2,  /* bits transferred per second */
+                               ms_per_frame,  /* number of microseconds per frame */
+                               samples_per_frame, /* number of samples per frame */
+                               bytes_per_frame * 2, /* number of bytes per frame decompressed */
+                               bytes_per_frame * 2, /* number of bytes per frame compressed */
+                               2, /* number of channels represented */
+                               1, /* number of frames per network packet */
+                               switch_raw_init, /* function to initialize a codec handle using this implementation */
+                               switch_raw_encode, /* function to encode raw data into encoded data */
+                               switch_raw_decode, /* function to decode encoded data into raw data */
+                               switch_raw_destroy); /* deinitalize a codec handle using this implementation */
 
                samples_per_frame += 32;
                bytes_per_frame += 64;
@@ -709,23 +709,23 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
                                                                                         switch_raw_decode,     /* function to decode encoded data into raw data */
                                                                                         switch_raw_destroy);   /* deinitalize a codec handle using this implementation */
 
-    switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
-                       100,  /* the IANA code number */
-                       "L16", /* the IANA code name */
-                       NULL,  /* default fmtp to send (can be overridden by the init function) */
-                       32000, /* samples transferred per second */
-                       32000, /* actual samples transferred per second */
-                       512000 * 2,  /* bits transferred per second */
-                       ms_per_frame,  /* number of microseconds per frame */
-                       samples_per_frame, /* number of samples per frame */
-                       bytes_per_frame * 2, /* number of bytes per frame decompressed */
-                       bytes_per_frame * 2, /* number of bytes per frame compressed */
-                       2, /* number of channels represented */
-                       1, /* number of frames per network packet */
-                       switch_raw_init, /* function to initialize a codec handle using this implementation */
-                       switch_raw_encode, /* function to encode raw data into encoded data */
-                       switch_raw_decode, /* function to decode encoded data into raw data */
-                       switch_raw_destroy); /* deinitalize a codec handle using this implementation */
+               switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
+                               100,  /* the IANA code number */
+                               "L16", /* the IANA code name */
+                               NULL,  /* default fmtp to send (can be overridden by the init function) */
+                               32000, /* samples transferred per second */
+                               32000, /* actual samples transferred per second */
+                               512000 * 2,  /* bits transferred per second */
+                               ms_per_frame,  /* number of microseconds per frame */
+                               samples_per_frame, /* number of samples per frame */
+                               bytes_per_frame * 2, /* number of bytes per frame decompressed */
+                               bytes_per_frame * 2, /* number of bytes per frame compressed */
+                               2, /* number of channels represented */
+                               1, /* number of frames per network packet */
+                               switch_raw_init, /* function to initialize a codec handle using this implementation */
+                               switch_raw_encode, /* function to encode raw data into encoded data */
+                               switch_raw_decode, /* function to decode encoded data into raw data */
+                               switch_raw_destroy); /* deinitalize a codec handle using this implementation */
 
                samples_per_frame += 64;
                bytes_per_frame += 128;
@@ -785,157 +785,157 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
 
        for (x = 0; x < 3; x++) {
                switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,    /* enumeration defining the type of the codec */
-                                                                                        100,   /* the IANA code number */
-                                                                                        "L16", /* the IANA code name */
-                                                                                        NULL,  /* default fmtp to send (can be overridden by the init function) */
-                                                                                        44100, /* samples transferred per second */
-                                                                                        44100, /* actual samples transferred per second */
-                                                                                        705600,        /* bits transferred per second */
-                                                                                        ms_per_frame,  /* number of microseconds per frame */
-                                                                                        samples_per_frame,     /* number of samples per frame */
-                                                                                        bytes_per_frame,       /* number of bytes per frame decompressed */
-                                                                                        bytes_per_frame,       /* number of bytes per frame compressed */
-                                                                                        1,     /* number of channels represented */
-                                                                                        1,     /* number of frames per network packet */
-                                                                                        switch_raw_init,       /* function to initialize a codec handle using this implementation */
-                                                                                        switch_raw_encode,     /* function to encode raw data into encoded data */
-                                                                                        switch_raw_decode,     /* function to decode encoded data into raw data */
-                                                                                        switch_raw_destroy);   /* deinitalize a codec handle using this implementation */
+                               100,    /* the IANA code number */
+                               "L16",  /* the IANA code name */
+                               NULL,   /* default fmtp to send (can be overridden by the init function) */
+                               44100,  /* samples transferred per second */
+                               44100,  /* actual samples transferred per second */
+                               705600, /* bits transferred per second */
+                               ms_per_frame,   /* number of microseconds per frame */
+                               samples_per_frame,      /* number of samples per frame */
+                               bytes_per_frame,        /* number of bytes per frame decompressed */
+                               bytes_per_frame,        /* number of bytes per frame compressed */
+                               1,      /* number of channels represented */
+                               1,      /* number of frames per network packet */
+                               switch_raw_init,        /* function to initialize a codec handle using this implementation */
+                               switch_raw_encode,      /* function to encode raw data into encoded data */
+                               switch_raw_decode,      /* function to decode encoded data into raw data */
+                               switch_raw_destroy);    /* deinitalize a codec handle using this implementation */
 
                switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,    /* enumeration defining the type of the codec */
-                                                                                        100,   /* the IANA code number */
-                                                                                        "L16", /* the IANA code name */
-                                                                                        NULL,  /* default fmtp to send (can be overridden by the init function) */
-                                                                                        44100, /* samples transferred per second */
-                                                                                        44100, /* actual samples transferred per second */
-                                                                                        705600,        /* bits transferred per second */
-                                                                                        ms_per_frame,  /* number of microseconds per frame */
-                                                                                        samples_per_frame,     /* number of samples per frame */
-                                                                                        bytes_per_frame * 2,   /* number of bytes per frame decompressed */
-                                                                                        bytes_per_frame * 2,   /* number of bytes per frame compressed */
-                                                                                        2,     /* number of channels represented */
-                                                                                        1,     /* number of frames per network packet */
-                                                                                        switch_raw_init,       /* function to initialize a codec handle using this implementation */
-                                                                                        switch_raw_encode,     /* function to encode raw data into encoded data */
-                                                                                        switch_raw_decode,     /* function to decode encoded data into raw data */
-                                                                                        switch_raw_destroy);   /* deinitalize a codec handle using this implementation */
+                               100,    /* the IANA code number */
+                               "L16",  /* the IANA code name */
+                               NULL,   /* default fmtp to send (can be overridden by the init function) */
+                               44100,  /* samples transferred per second */
+                               44100,  /* actual samples transferred per second */
+                               705600, /* bits transferred per second */
+                               ms_per_frame,   /* number of microseconds per frame */
+                               samples_per_frame,      /* number of samples per frame */
+                               bytes_per_frame * 2,    /* number of bytes per frame decompressed */
+                               bytes_per_frame * 2,    /* number of bytes per frame compressed */
+                               2,      /* number of channels represented */
+                               1,      /* number of frames per network packet */
+                               switch_raw_init,        /* function to initialize a codec handle using this implementation */
+                               switch_raw_encode,      /* function to encode raw data into encoded data */
+                               switch_raw_decode,      /* function to decode encoded data into raw data */
+                               switch_raw_destroy);    /* deinitalize a codec handle using this implementation */
 
                samples_per_frame += 441;
                bytes_per_frame += 882;
                ms_per_frame += 10000;
-               
+
        }       
 
 
 
        switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,    /* enumeration defining the type of the codec */
-                                                                                100,   /* the IANA code number */
-                                                                                "L16", /* the IANA code name */
-                                                                                NULL,  /* default fmtp to send (can be overridden by the init function) */
-                                                                                22050, /* samples transferred per second */
-                                                                                22050, /* actual samples transferred per second */
-                                                                                352800,        /* bits transferred per second */
-                                                                                20000, /* number of microseconds per frame */
-                                                                                441,   /* number of samples per frame */
-                                                                                882,   /* number of bytes per frame decompressed */
-                                                                                882,   /* number of bytes per frame compressed */
-                                                                                1,     /* number of channels represented */
-                                                                                1,     /* number of frames per network packet */
-                                                                                switch_raw_init,       /* function to initialize a codec handle using this implementation */
-                                                                                switch_raw_encode,     /* function to encode raw data into encoded data */
-                                                                                switch_raw_decode,     /* function to decode encoded data into raw data */
-                                                                                switch_raw_destroy);   /* deinitalize a codec handle using this implementation */
-
-  switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
-                     100,  /* the IANA code number */
-                     "L16", /* the IANA code name */
-                     NULL,  /* default fmtp to send (can be overridden by the init function) */
-                     22050, /* samples transferred per second */
-                     22050, /* actual samples transferred per second */
-                     352800 * 2,  /* bits transferred per second */
-                     20000, /* number of microseconds per frame */
-                     441, /* number of samples per frame */
-                     882 * 2, /* number of bytes per frame decompressed */
-                     882 * 2, /* number of bytes per frame compressed */
-                     2, /* number of channels represented */
-                     1, /* number of frames per network packet */
-                     switch_raw_init, /* function to initialize a codec handle using this implementation */
-                     switch_raw_encode, /* function to encode raw data into encoded data */
-                     switch_raw_decode, /* function to decode encoded data into raw data */
-                     switch_raw_destroy); /* deinitalize a codec handle using this implementation */
+                       100,    /* the IANA code number */
+                       "L16",  /* the IANA code name */
+                       NULL,   /* default fmtp to send (can be overridden by the init function) */
+                       22050,  /* samples transferred per second */
+                       22050,  /* actual samples transferred per second */
+                       352800, /* bits transferred per second */
+                       20000,  /* number of microseconds per frame */
+                       441,    /* number of samples per frame */
+                       882,    /* number of bytes per frame decompressed */
+                       882,    /* number of bytes per frame compressed */
+                       1,      /* number of channels represented */
+                       1,      /* number of frames per network packet */
+                       switch_raw_init,        /* function to initialize a codec handle using this implementation */
+                       switch_raw_encode,      /* function to encode raw data into encoded data */
+                       switch_raw_decode,      /* function to decode encoded data into raw data */
+                       switch_raw_destroy);    /* deinitalize a codec handle using this implementation */
+
+       switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
+                       100,  /* the IANA code number */
+                       "L16", /* the IANA code name */
+                       NULL,  /* default fmtp to send (can be overridden by the init function) */
+                       22050, /* samples transferred per second */
+                       22050, /* actual samples transferred per second */
+                       352800 * 2,  /* bits transferred per second */
+                       20000, /* number of microseconds per frame */
+                       441, /* number of samples per frame */
+                       882 * 2, /* number of bytes per frame decompressed */
+                       882 * 2, /* number of bytes per frame compressed */
+                       2, /* number of channels represented */
+                       1, /* number of frames per network packet */
+                       switch_raw_init, /* function to initialize a codec handle using this implementation */
+                       switch_raw_encode, /* function to encode raw data into encoded data */
+                       switch_raw_decode, /* function to decode encoded data into raw data */
+                       switch_raw_destroy); /* deinitalize a codec handle using this implementation */
 
        switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,    /* enumeration defining the type of the codec */
-                                                                                100,   /* the IANA code number */
-                                                                                "L16", /* the IANA code name */
-                                                                                NULL,  /* default fmtp to send (can be overridden by the init function) */
-                                                                                11025, /* samples transferred per second */
-                                                                                11025, /* actual samples transferred per second */
-                                                                                176400,        /* bits transferred per second */
-                                                                                40000, /* number of microseconds per frame */
-                                                                                441,   /* number of samples per frame */
-                                                                                882,   /* number of bytes per frame decompressed */
-                                                                                882,   /* number of bytes per frame compressed */
-                                                                                1,     /* number of channels represented */
-                                                                                1,     /* number of frames per network packet */
-                                                                                switch_raw_init,       /* function to initialize a codec handle using this implementation */
-                                                                                switch_raw_encode,     /* function to encode raw data into encoded data */
-                                                                                switch_raw_decode,     /* function to decode encoded data into raw data */
-                                                                                switch_raw_destroy);   /* deinitalize a codec handle using this implementation */
-
-  switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
-                     100,  /* the IANA code number */
-                     "L16", /* the IANA code name */
-                     NULL,  /* default fmtp to send (can be overridden by the init function) */
-                     11025, /* samples transferred per second */
-                     11025, /* actual samples transferred per second */
-                     176400 * 2,  /* bits transferred per second */
-                     40000, /* number of microseconds per frame */
-                     441, /* number of samples per frame */
-                     882 * 2, /* number of bytes per frame decompressed */
-                     882 * 2, /* number of bytes per frame compressed */
-                     2, /* number of channels represented */
-                     1, /* number of frames per network packet */
-                     switch_raw_init, /* function to initialize a codec handle using this implementation */
-                     switch_raw_encode, /* function to encode raw data into encoded data */
-                     switch_raw_decode, /* function to decode encoded data into raw data */
-                     switch_raw_destroy); /* deinitalize a codec handle using this implementation */
+                       100,    /* the IANA code number */
+                       "L16",  /* the IANA code name */
+                       NULL,   /* default fmtp to send (can be overridden by the init function) */
+                       11025,  /* samples transferred per second */
+                       11025,  /* actual samples transferred per second */
+                       176400, /* bits transferred per second */
+                       40000,  /* number of microseconds per frame */
+                       441,    /* number of samples per frame */
+                       882,    /* number of bytes per frame decompressed */
+                       882,    /* number of bytes per frame compressed */
+                       1,      /* number of channels represented */
+                       1,      /* number of frames per network packet */
+                       switch_raw_init,        /* function to initialize a codec handle using this implementation */
+                       switch_raw_encode,      /* function to encode raw data into encoded data */
+                       switch_raw_decode,      /* function to decode encoded data into raw data */
+                       switch_raw_destroy);    /* deinitalize a codec handle using this implementation */
+
+       switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
+                       100,  /* the IANA code number */
+                       "L16", /* the IANA code name */
+                       NULL,  /* default fmtp to send (can be overridden by the init function) */
+                       11025, /* samples transferred per second */
+                       11025, /* actual samples transferred per second */
+                       176400 * 2,  /* bits transferred per second */
+                       40000, /* number of microseconds per frame */
+                       441, /* number of samples per frame */
+                       882 * 2, /* number of bytes per frame decompressed */
+                       882 * 2, /* number of bytes per frame compressed */
+                       2, /* number of channels represented */
+                       1, /* number of frames per network packet */
+                       switch_raw_init, /* function to initialize a codec handle using this implementation */
+                       switch_raw_encode, /* function to encode raw data into encoded data */
+                       switch_raw_decode, /* function to decode encoded data into raw data */
+                       switch_raw_destroy); /* deinitalize a codec handle using this implementation */
 
 
        switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,    /* enumeration defining the type of the codec */
-                                                                                100,   /* the IANA code number */
-                                                                                "L16", /* the IANA code name */
-                                                                                NULL,  /* default fmtp to send (can be overridden by the init function) */
-                                                                                11025, /* samples transferred per second */
-                                                                                11025, /* actual samples transferred per second */
-                                                                                176400,        /* bits transferred per second */
-                                                                                32000, /* number of microseconds per frame */
-                                                                                256,   /* number of samples per frame */
-                                                                                512,   /* number of bytes per frame decompressed */
-                                                                                512,   /* number of bytes per frame compressed */
-                                                                                1,     /* number of channels represented */
-                                                                                1,     /* number of frames per network packet */
-                                                                                switch_raw_init,       /* function to initialize a codec handle using this implementation */
-                                                                                switch_raw_encode,     /* function to encode raw data into encoded data */
-                                                                                switch_raw_decode,     /* function to decode encoded data into raw data */
-                                                                                switch_raw_destroy);   /* deinitalize a codec handle using this implementation */
-
-  switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
-                     100,  /* the IANA code number */
-                     "L16", /* the IANA code name */
-                     NULL,  /* default fmtp to send (can be overridden by the init function) */
-                     11025, /* samples transferred per second */
-                     11025, /* actual samples transferred per second */
-                     176400 * 2,  /* bits transferred per second */
-                     32000, /* number of microseconds per frame */
-                     256, /* number of samples per frame */
-                     512 * 2, /* number of bytes per frame decompressed */
-                     512 * 2, /* number of bytes per frame compressed */
-                     2, /* number of channels represented */
-                     1, /* number of frames per network packet */
-                     switch_raw_init, /* function to initialize a codec handle using this implementation */
-                     switch_raw_encode, /* function to encode raw data into encoded data */
-                     switch_raw_decode, /* function to decode encoded data into raw data */
-                     switch_raw_destroy); /* deinitalize a codec handle using this implementation */
+                       100,    /* the IANA code number */
+                       "L16",  /* the IANA code name */
+                       NULL,   /* default fmtp to send (can be overridden by the init function) */
+                       11025,  /* samples transferred per second */
+                       11025,  /* actual samples transferred per second */
+                       176400, /* bits transferred per second */
+                       32000,  /* number of microseconds per frame */
+                       256,    /* number of samples per frame */
+                       512,    /* number of bytes per frame decompressed */
+                       512,    /* number of bytes per frame compressed */
+                       1,      /* number of channels represented */
+                       1,      /* number of frames per network packet */
+                       switch_raw_init,        /* function to initialize a codec handle using this implementation */
+                       switch_raw_encode,      /* function to encode raw data into encoded data */
+                       switch_raw_decode,      /* function to decode encoded data into raw data */
+                       switch_raw_destroy);    /* deinitalize a codec handle using this implementation */
+
+       switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,  /* enumeration defining the type of the codec */
+                       100,  /* the IANA code number */
+                       "L16", /* the IANA code name */
+                       NULL,  /* default fmtp to send (can be overridden by the init function) */
+                       11025, /* samples transferred per second */
+                       11025, /* actual samples transferred per second */
+                       176400 * 2,  /* bits transferred per second */
+                       32000, /* number of microseconds per frame */
+                       256, /* number of samples per frame */
+                       512 * 2, /* number of bytes per frame decompressed */
+                       512 * 2, /* number of bytes per frame compressed */
+                       2, /* number of channels represented */
+                       1, /* number of frames per network packet */
+                       switch_raw_init, /* function to initialize a codec handle using this implementation */
+                       switch_raw_encode, /* function to encode raw data into encoded data */
+                       switch_raw_decode, /* function to decode encoded data into raw data */
+                       switch_raw_destroy); /* deinitalize a codec handle using this implementation */
 
        /* indicate that the module should continue to be loaded */
 
index d51312e8660c7bb6da0e729b173713565e048524..9fd6e38657b56c357c1c62779887275ceeaae1a7 100644 (file)
@@ -124,8 +124,8 @@ static int db_is_up(switch_pgsql_handle_t *handle)
                goto done;
        }
   
-    /* Try a non-blocking read on the connection to gobble up any EOF from a closed connection and mark the connection BAD if it is closed. */
-    PQconsumeInput(handle->con);
+       /* Try a non-blocking read on the connection to gobble up any EOF from a closed connection and mark the connection BAD if it is closed. */
+       PQconsumeInput(handle->con);
 
        if (PQstatus(handle->con) == CONNECTION_BAD) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "PQstatus returned bad connection; reconnecting...\n");
index 6bece5863053d0203e84bf23b1e24603e3391c1e..0a9553f75bc3d33bc23e2491e3ddb0fb6a720069 100644 (file)
@@ -52,8 +52,8 @@ struct profile_timer
        /* last calculated percentage of idle time */
        double last_percentage_of_idle_time;
        double *percentage_of_idle_time_ring;
-        unsigned int last_idle_time_index;
-        unsigned int cpu_idle_smoothing_depth;
+       unsigned int last_idle_time_index;
+       unsigned int cpu_idle_smoothing_depth;
 
 #ifdef __linux__
        /* the cpu feature gets disabled on errors */
@@ -83,14 +83,14 @@ struct profile_timer
 
 #ifdef __linux__
 static int read_cpu_stats(switch_profile_timer_t *p, 
-                     unsigned long long *user, 
-                      unsigned long long *nice, 
-                      unsigned long long *system, 
-                      unsigned long long *idle, 
-                      unsigned long long *iowait, 
-                      unsigned long long *irq, 
-                      unsigned long long *softirq, 
-                      unsigned long long *steal)
+               unsigned long long *user, 
+               unsigned long long *nice, 
+               unsigned long long *system, 
+               unsigned long long *idle, 
+               unsigned long long *iowait, 
+               unsigned long long *irq, 
+               unsigned long long *softirq, 
+               unsigned long long *steal)
 {
 // the output of proc should not change that often from one kernel to other
 // see fs/proc/proc_misc.c or fs/proc/stat.c in the Linux kernel for more details
@@ -307,15 +307,15 @@ SWITCH_DECLARE(switch_profile_timer_t *)switch_new_profile_timer(void)
   switch_profile_timer_t *p = calloc(1, sizeof(switch_profile_timer_t));
 
   if ( runtime.cpu_idle_smoothing_depth && runtime.cpu_idle_smoothing_depth > 0 ) {
-    p->cpu_idle_smoothing_depth = runtime.cpu_idle_smoothing_depth;
+         p->cpu_idle_smoothing_depth = runtime.cpu_idle_smoothing_depth;
   } else {
-    p->cpu_idle_smoothing_depth = 30;
+         p->cpu_idle_smoothing_depth = 30;
   }
 
   p->percentage_of_idle_time_ring = calloc(1, sizeof(double) * p->cpu_idle_smoothing_depth);
 
   for ( x = 0; x < p->cpu_idle_smoothing_depth; x++ ) {
-    p->percentage_of_idle_time_ring[x] = 100.0;
+         p->percentage_of_idle_time_ring[x] = 100.0;
   }
 
   return p;
index 28b53ff23b99f389991a5eeb8e88983f92720e04..683820015bda3d433dd06850a3fcccb2f09be815 100644 (file)
@@ -1727,10 +1727,10 @@ static void rtcp_generate_sender_info(switch_rtp_t *rtp_session, struct switch_r
 
        switch_time_exp_gmt(&now_hr,now);
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10,"Sending an RTCP packet[%04d-%02d-%02d %02d:%02d:%02d.%d] lsr[%u] msw[%u] lsw[%u] stats_ssrc[%u]\n",
-                1900 + now_hr.tm_year,  now_hr.tm_mday, now_hr.tm_mon, now_hr.tm_hour, now_hr.tm_min, now_hr.tm_sec, now_hr.tm_usec,
-                (ntohl(sr->ntp_lsw)&0xffff0000)>>16 | (ntohl(sr->ntp_msw)&0x0000ffff)<<16,
-                ntohl(sr->ntp_msw),ntohl(sr->ntp_lsw), rtp_session->stats.rtcp.ssrc
-       );
+                       1900 + now_hr.tm_year,  now_hr.tm_mday, now_hr.tm_mon, now_hr.tm_hour, now_hr.tm_min, now_hr.tm_sec, now_hr.tm_usec,
+                       (ntohl(sr->ntp_lsw)&0xffff0000)>>16 | (ntohl(sr->ntp_msw)&0x0000ffff)<<16,
+                       ntohl(sr->ntp_msw),ntohl(sr->ntp_lsw), rtp_session->stats.rtcp.ssrc
+                       );
 }
 
 //#define DEBUG_RTCP
@@ -1769,11 +1769,11 @@ static void rtcp_generate_report_block(switch_rtp_t *rtp_session, struct switch_
 
 #ifdef DEBUG_RTCP
                        if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO])
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "rtcp_generate_sr: stats_ssrc[%u]\nreceived[%d]\nexpected[%d]\ncum[%d]\nlost[%d|%d/256]pkt\nlast_seq[%d]\ncyc[%d]\nlast_rpt_seq[%d]\ncyc[%d]\nssrc[%d]\n",
-               rtp_session->remote_ssrc, stats->period_pkt_count, expected_pkt,
-               stats->cum_lost, pkt_lost, rtcp_report_block->fraction, stats->high_ext_seq_recv&0x0000ffff,
-               stats->cycle, stats->last_rpt_ext_seq&0x0000ffff, stats->last_rpt_cycle, rtp_session->stats.rtcp.peer_ssrc
-       );
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "rtcp_generate_sr: stats_ssrc[%u]\nreceived[%d]\nexpected[%d]\ncum[%d]\nlost[%d|%d/256]pkt\nlast_seq[%d]\ncyc[%d]\nlast_rpt_seq[%d]\ncyc[%d]\nssrc[%d]\n",
+                                               rtp_session->remote_ssrc, stats->period_pkt_count, expected_pkt,
+                                               stats->cum_lost, pkt_lost, rtcp_report_block->fraction, stats->high_ext_seq_recv&0x0000ffff,
+                                               stats->cycle, stats->last_rpt_ext_seq&0x0000ffff, stats->last_rpt_cycle, rtp_session->stats.rtcp.peer_ssrc
+                                               );
 #endif
        rtcp_report_block->highest_sequence_number_received = htonl(stats->high_ext_seq_recv);
 
@@ -1851,7 +1851,7 @@ static int rtcp_stats(switch_rtp_t *rtp_session)
                if (pkt_seq < max_seq) {
                        stats->cycle++;
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rtcp_stats:[cycle change] pkt_seq[%d] cycle[%d] max_seq[%d] stats_ssrc[%u] local_ts[%u]\n",
-                  pkt_seq, stats->cycle, max_seq, stats->ssrc, rtp_session->timer.samplecount);
+                                       pkt_seq, stats->cycle, max_seq, stats->ssrc, rtp_session->timer.samplecount);
                }
                pkt_extended_seq = stats->cycle << 16 | pkt_seq; /* getting the extended packet extended sequence ID */
                if (pkt_extended_seq > stats->high_ext_seq_recv) {
@@ -1878,7 +1878,7 @@ static int rtcp_stats(switch_rtp_t *rtp_session)
        stats->pkt_count++;
 #ifdef DEBUG_RTCP
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "rtcp_stats: period_pkt_count[%d]last_seq[%d]cycle[%d]stats_ssrc[%u]local_ts[%u]\n",
-                 stats->period_pkt_count, pkt_seq, stats->cycle, stats->ssrc, rtp_session->timer.samplecount);
+                       stats->period_pkt_count, pkt_seq, stats->cycle, stats->ssrc, rtp_session->timer.samplecount);
 #endif
        /* Interarrival jitter calculation */
        pkt_tsdiff = abs((int)rtp_session->timer.samplecount - (int)ntohl(hdr->ts));  /* relative transit times for this packet */
@@ -1893,7 +1893,7 @@ static int rtcp_stats(switch_rtp_t *rtp_session)
 
 #ifdef DEBUG_RTCP
        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "rtcp_stats: pkt_ts[%d]local_ts[%d]diff[%d]pkt_spacing[%d]inter_jitter[%f]seq[%d]stats_ssrc[%d]",
-               ntohl(hdr->ts), rtp_session->timer.samplecount, pkt_tsdiff, packet_spacing_diff, stats->inter_jitter, ntohs(hdr->seq), stats->ssrc);
+                       ntohl(hdr->ts), rtp_session->timer.samplecount, pkt_tsdiff, packet_spacing_diff, stats->inter_jitter, ntohs(hdr->seq), stats->ssrc);
 #endif
        return 1;
 }
@@ -3917,10 +3917,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
        
        /* Burst and Packet Loss */
        rtp_session->stats.inbound.lossrate = 0;
-    rtp_session->stats.inbound.burstrate = 0;
-    memset(rtp_session->stats.inbound.loss, 0, sizeof(rtp_session->stats.inbound.loss));
-    rtp_session->stats.inbound.last_loss = 0;
-    rtp_session->stats.inbound.last_processed_seq = -1;
+       rtp_session->stats.inbound.burstrate = 0;
+       memset(rtp_session->stats.inbound.loss, 0, sizeof(rtp_session->stats.inbound.loss));
+       rtp_session->stats.inbound.last_loss = 0;
+       rtp_session->stats.inbound.last_processed_seq = -1;
 
        rtp_session->ready = 1;
        *new_rtp_session = rtp_session;
@@ -4983,7 +4983,7 @@ static switch_size_t do_flush(switch_rtp_t *rtp_session, int force, switch_size_
                if (rtp_session->vb) {
                        //switch_jb_reset(rtp_session->vb);
                        bytes_out = bytes_in;
-            goto end;
+                       goto end;
                }
                
                if (rtp_session->flags[SWITCH_RTP_FLAG_DEBUG_RTP_READ]) {
@@ -6308,7 +6308,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_BREAK);
                                bytes = 0;
                                reset_jitter_seq(rtp_session);
-                return_cng_frame();
+                               return_cng_frame();
                        }
 
                }
index b1255195bd59f85d1d3fdb30a7716bf564052f6b..529f117e1422f65b0435db20f008b80c1c257ce5 100644 (file)
@@ -4,13 +4,13 @@
 
 sdp_connection_t *sdp_media_connections(sdp_media_t const *m)
 {
-  if (m) {
-    if (m->m_connections)
-      return m->m_connections;
-    if (m->m_session)
-      return m->m_session->sdp_connection;
-  }
-  return NULL;
+       if (m) {
+               if (m->m_connections)
+                       return m->m_connections;
+               if (m->m_session)
+                       return m->m_session->sdp_connection;
+       }
+       return NULL;
 }
 
 #include <su_alloc.c>
index cc3f983b17882f137ee01bb37f42664a57266a11..b27bca66e397641be68da44143343adbcb6e77b6 100644 (file)
@@ -414,7 +414,7 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_get_xor_mapped_address(swit
                }
        }
 
-    ip->port ^= ntohl(header->cookie) >> 16;
+       ip->port ^= ntohl(header->cookie) >> 16;
        *port = ip->port;
 
        return 1;
@@ -585,9 +585,9 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_use_candidate(switch_st
 SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_controlling(switch_stun_packet_t *packet)
 {
        switch_stun_packet_attribute_t *attribute;
-    char buf[8];
+       char buf[8];
 
-    switch_stun_random_string(buf, 8, NULL);
+       switch_stun_random_string(buf, 8, NULL);
 
        attribute = (switch_stun_packet_attribute_t *) ((uint8_t *) & packet->first_attribute + ntohs(packet->header.length));
        attribute->type = htons(SWITCH_STUN_ATTR_CONTROLLING);
@@ -600,9 +600,9 @@ SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_controlling(switch_stun
 SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_add_controlled(switch_stun_packet_t *packet)
 {
        switch_stun_packet_attribute_t *attribute;
-    char buf[8];
+       char buf[8];
 
-    switch_stun_random_string(buf, 8, NULL);
+       switch_stun_random_string(buf, 8, NULL);
 
        attribute = (switch_stun_packet_attribute_t *) ((uint8_t *) & packet->first_attribute + ntohs(packet->header.length));
        attribute->type = htons(SWITCH_STUN_ATTR_CONTROLLED);
index 86c7f5e4a9c6d8d8cfd577c8e3468497fe1b6fc9..450552fa66b57248cc3b7f7529740cc6dfff24fe 100644 (file)
@@ -64,7 +64,7 @@ static const char trailingBytesForUTF8[256] = {
 /* returns length of next utf-8 sequence */
 SWITCH_DECLARE(int) switch_u8_seqlen(char *s)
 {
-    return trailingBytesForUTF8[(unsigned int)(unsigned char)s[0]] + 1;
+       return trailingBytesForUTF8[(unsigned int)(unsigned char)s[0]] + 1;
 }
 
 /* conversions without error checking
@@ -76,38 +76,38 @@ SWITCH_DECLARE(int) switch_u8_seqlen(char *s)
    dest will always be L'\0'-terminated, even if there isn't enough room
    for all the characters.
    if sz = srcsz+1 (i.e. 4*srcsz+4 bytes), there will always be enough space.
-*/
+   */
 SWITCH_DECLARE(int) switch_u8_toucs(uint32_t *dest, int sz, char *src, int srcsz)
 {
-    uint32_t ch;
-    char *src_end = src + srcsz;
-    int nb;
-    int i=0;
-
-    while (i < sz-1) {
-        nb = trailingBytesForUTF8[(unsigned char)*src];
-        if (srcsz == -1) {
-            if (*src == 0)
-                goto done_toucs;
-        }
-        else {
-            if (src + nb >= src_end)
-                goto done_toucs;
-        }
-        ch = 0;
-        switch (nb) {
-            /* these fall through deliberately */
-        case 3: ch += (unsigned char)*src++; ch <<= 6;
-        case 2: ch += (unsigned char)*src++; ch <<= 6;
-        case 1: ch += (unsigned char)*src++; ch <<= 6;
-        case 0: ch += (unsigned char)*src++;
-        }
-        ch -= offsetsFromUTF8[nb];
-        dest[i++] = ch;
-    }
- done_toucs:
-    dest[i] = 0;
-    return i;
+       uint32_t ch;
+       char *src_end = src + srcsz;
+       int nb;
+       int i=0;
+
+       while (i < sz-1) {
+               nb = trailingBytesForUTF8[(unsigned char)*src];
+               if (srcsz == -1) {
+                       if (*src == 0)
+                               goto done_toucs;
+               }
+               else {
+                       if (src + nb >= src_end)
+                               goto done_toucs;
+               }
+               ch = 0;
+               switch (nb) {
+                       /* these fall through deliberately */
+                       case 3: ch += (unsigned char)*src++; ch <<= 6;
+                       case 2: ch += (unsigned char)*src++; ch <<= 6;
+                       case 1: ch += (unsigned char)*src++; ch <<= 6;
+                       case 0: ch += (unsigned char)*src++;
+               }
+               ch -= offsetsFromUTF8[nb];
+               dest[i++] = ch;
+       }
+done_toucs:
+       dest[i] = 0;
+       return i;
 }
 
 /* srcsz = number of source characters, or -1 if 0-terminated
@@ -121,346 +121,346 @@ SWITCH_DECLARE(int) switch_u8_toucs(uint32_t *dest, int sz, char *src, int srcsz
    only NUL-terminates if all the characters fit, and there's space for
    the NUL as well.
    the destination string will never be bigger than the source string.
-*/
+   */
 SWITCH_DECLARE(int) switch_u8_toutf8(char *dest, int sz, uint32_t *src, int srcsz)
 {
-    uint32_t ch;
-    int i = 0;
-    char *dest_end = dest + sz;
-
-    while (srcsz<0 ? src[i]!=0 : i < srcsz) {
-        ch = src[i];
-        if (ch < 0x80) {
-            if (dest >= dest_end)
-                return i;
-            *dest++ = (char)ch;
-        }
-        else if (ch < 0x800) {
-            if (dest >= dest_end-1)
-                return i;
-            *dest++ = (ch>>6) | 0xC0;
-            *dest++ = (ch & 0x3F) | 0x80;
-        }
-        else if (ch < 0x10000) {
-            if (dest >= dest_end-2)
-                return i;
-            *dest++ = (ch>>12) | 0xE0;
-            *dest++ = ((ch>>6) & 0x3F) | 0x80;
-            *dest++ = (ch & 0x3F) | 0x80;
-        }
-        else if (ch < 0x110000) {
-            if (dest >= dest_end-3)
-                return i;
-            *dest++ = (ch>>18) | 0xF0;
-            *dest++ = ((ch>>12) & 0x3F) | 0x80;
-            *dest++ = ((ch>>6) & 0x3F) | 0x80;
-            *dest++ = (ch & 0x3F) | 0x80;
-        }
-        i++;
-    }
-    if (dest < dest_end)
-        *dest = '\0';
-    return i;
+       uint32_t ch;
+       int i = 0;
+       char *dest_end = dest + sz;
+
+       while (srcsz<0 ? src[i]!=0 : i < srcsz) {
+               ch = src[i];
+               if (ch < 0x80) {
+                       if (dest >= dest_end)
+                               return i;
+                       *dest++ = (char)ch;
+               }
+               else if (ch < 0x800) {
+                       if (dest >= dest_end-1)
+                               return i;
+                       *dest++ = (ch>>6) | 0xC0;
+                       *dest++ = (ch & 0x3F) | 0x80;
+               }
+               else if (ch < 0x10000) {
+                       if (dest >= dest_end-2)
+                               return i;
+                       *dest++ = (ch>>12) | 0xE0;
+                       *dest++ = ((ch>>6) & 0x3F) | 0x80;
+                       *dest++ = (ch & 0x3F) | 0x80;
+               }
+               else if (ch < 0x110000) {
+                       if (dest >= dest_end-3)
+                               return i;
+                       *dest++ = (ch>>18) | 0xF0;
+                       *dest++ = ((ch>>12) & 0x3F) | 0x80;
+                       *dest++ = ((ch>>6) & 0x3F) | 0x80;
+                       *dest++ = (ch & 0x3F) | 0x80;
+               }
+               i++;
+       }
+       if (dest < dest_end)
+               *dest = '\0';
+       return i;
 }
 
 SWITCH_DECLARE(int) switch_u8_wc_toutf8(char *dest, uint32_t ch)
 {
-    if (ch < 0x80) {
-        dest[0] = (char)ch;
-        return 1;
-    }
-    if (ch < 0x800) {
-        dest[0] = (ch>>6) | 0xC0;
-        dest[1] = (ch & 0x3F) | 0x80;
-        return 2;
-    }
-    if (ch < 0x10000) {
-        dest[0] = (ch>>12) | 0xE0;
-        dest[1] = ((ch>>6) & 0x3F) | 0x80;
-        dest[2] = (ch & 0x3F) | 0x80;
-        return 3;
-    }
-    if (ch < 0x110000) {
-        dest[0] = (ch>>18) | 0xF0;
-        dest[1] = ((ch>>12) & 0x3F) | 0x80;
-        dest[2] = ((ch>>6) & 0x3F) | 0x80;
-        dest[3] = (ch & 0x3F) | 0x80;
-        return 4;
-    }
-    return 0;
+       if (ch < 0x80) {
+               dest[0] = (char)ch;
+               return 1;
+       }
+       if (ch < 0x800) {
+               dest[0] = (ch>>6) | 0xC0;
+               dest[1] = (ch & 0x3F) | 0x80;
+               return 2;
+       }
+       if (ch < 0x10000) {
+               dest[0] = (ch>>12) | 0xE0;
+               dest[1] = ((ch>>6) & 0x3F) | 0x80;
+               dest[2] = (ch & 0x3F) | 0x80;
+               return 3;
+       }
+       if (ch < 0x110000) {
+               dest[0] = (ch>>18) | 0xF0;
+               dest[1] = ((ch>>12) & 0x3F) | 0x80;
+               dest[2] = ((ch>>6) & 0x3F) | 0x80;
+               dest[3] = (ch & 0x3F) | 0x80;
+               return 4;
+       }
+       return 0;
 }
 
 /* charnum => byte offset */
 SWITCH_DECLARE(int) switch_u8_offset(char *str, int charnum)
 {
-    int offs=0;
-
-    while (charnum > 0 && str[offs]) {
-        (void)(isutf(str[++offs]) || isutf(str[++offs]) ||
-               isutf(str[++offs]) || ++offs);
-        charnum--;
-    }
-    return offs;
+       int offs=0;
+
+       while (charnum > 0 && str[offs]) {
+               (void)(isutf(str[++offs]) || isutf(str[++offs]) ||
+                               isutf(str[++offs]) || ++offs);
+               charnum--;
+       }
+       return offs;
 }
 
 /* byte offset => charnum */
 SWITCH_DECLARE(int) switch_u8_charnum(char *s, int offset)
 {
-    int charnum = 0, offs=0;
-
-    while (offs < offset && s[offs]) {
-        (void)(isutf(s[++offs]) || isutf(s[++offs]) ||
-               isutf(s[++offs]) || ++offs);
-        charnum++;
-    }
-    return charnum;
+       int charnum = 0, offs=0;
+
+       while (offs < offset && s[offs]) {
+               (void)(isutf(s[++offs]) || isutf(s[++offs]) ||
+                               isutf(s[++offs]) || ++offs);
+               charnum++;
+       }
+       return charnum;
 }
 
 /* number of characters */
 SWITCH_DECLARE(int) switch_u8_strlen(char *s)
 {
-    int count = 0;
-    int i = 0;
+       int count = 0;
+       int i = 0;
 
-    while (switch_u8_nextchar(s, &i) != 0)
-        count++;
+       while (switch_u8_nextchar(s, &i) != 0)
+               count++;
 
-    return count;
+       return count;
 }
 
 /* reads the next utf-8 sequence out of a string, updating an index */
 SWITCH_DECLARE(uint32_t) switch_u8_nextchar(char *s, int *i)
 {
-    uint32_t ch = 0;
-    int sz = 0;
+       uint32_t ch = 0;
+       int sz = 0;
 
-    do {
-        ch <<= 6;
-        ch += (unsigned char)s[(*i)++];
-        sz++;
-    } while (s[*i] && !isutf(s[*i]));
-    ch -= offsetsFromUTF8[sz-1];
+       do {
+               ch <<= 6;
+               ch += (unsigned char)s[(*i)++];
+               sz++;
+       } while (s[*i] && !isutf(s[*i]));
+       ch -= offsetsFromUTF8[sz-1];
 
-    return ch;
+       return ch;
 }
 
 SWITCH_DECLARE(void) switch_u8_inc(char *s, int *i)
 {
-    (void)(isutf(s[++(*i)]) || isutf(s[++(*i)]) ||
-           isutf(s[++(*i)]) || ++(*i));
+       (void)(isutf(s[++(*i)]) || isutf(s[++(*i)]) ||
+                       isutf(s[++(*i)]) || ++(*i));
 }
 
 SWITCH_DECLARE(void) switch_u8_dec(char *s, int *i)
 {
-    (void)(isutf(s[--(*i)]) || isutf(s[--(*i)]) ||
-           isutf(s[--(*i)]) || --(*i));
+       (void)(isutf(s[--(*i)]) || isutf(s[--(*i)]) ||
+                       isutf(s[--(*i)]) || --(*i));
 }
 
 SWITCH_DECLARE(int) octal_digit(char c)
 {
-    return (c >= '0' && c <= '7');
+       return (c >= '0' && c <= '7');
 }
 
 SWITCH_DECLARE(int) hex_digit(char c)
 {
-    return ((c >= '0' && c <= '9') ||
-            (c >= 'A' && c <= 'F') ||
-            (c >= 'a' && c <= 'f'));
+       return ((c >= '0' && c <= '9') ||
+                       (c >= 'A' && c <= 'F') ||
+                       (c >= 'a' && c <= 'f'));
 }
 
 /* assumes that src points to the character after a backslash
    returns number of input characters processed */
 SWITCH_DECLARE(int) switch_u8_read_escape_sequence(char *str, uint32_t *dest)
 {
-    uint32_t ch;
-    char digs[9]="\0\0\0\0\0\0\0\0";
-    int dno=0, i=1;
-
-    ch = (uint32_t)str[0];    /* take literal character */
-    if (str[0] == 'n')
-        ch = L'\n';
-    else if (str[0] == 't')
-        ch = L'\t';
-    else if (str[0] == 'r')
-        ch = L'\r';
-    else if (str[0] == 'b')
-        ch = L'\b';
-    else if (str[0] == 'f')
-        ch = L'\f';
-    else if (str[0] == 'v')
-        ch = L'\v';
-    else if (str[0] == 'a')
-        ch = L'\a';
-    else if (octal_digit(str[0])) {
-        i = 0;
-        do {
-            digs[dno++] = str[i++];
-        } while (octal_digit(str[i]) && dno < 3);
-        ch = strtol(digs, NULL, 8);
-    }
-    else if (str[0] == 'x') {
-        while (hex_digit(str[i]) && dno < 2) {
-            digs[dno++] = str[i++];
-        }
-        if (dno > 0)
-            ch = strtol(digs, NULL, 16);
-    }
-    else if (str[0] == 'u') {
-        while (hex_digit(str[i]) && dno < 4) {
-            digs[dno++] = str[i++];
-        }
-        if (dno > 0)
-            ch = strtol(digs, NULL, 16);
-    }
-    else if (str[0] == 'U') {
-        while (hex_digit(str[i]) && dno < 8) {
-            digs[dno++] = str[i++];
-        }
-        if (dno > 0)
-            ch = strtol(digs, NULL, 16);
-    }
-    *dest = ch;
-
-    return i;
+       uint32_t ch;
+       char digs[9]="\0\0\0\0\0\0\0\0";
+       int dno=0, i=1;
+
+       ch = (uint32_t)str[0];    /* take literal character */
+       if (str[0] == 'n')
+               ch = L'\n';
+       else if (str[0] == 't')
+               ch = L'\t';
+       else if (str[0] == 'r')
+               ch = L'\r';
+       else if (str[0] == 'b')
+               ch = L'\b';
+       else if (str[0] == 'f')
+               ch = L'\f';
+       else if (str[0] == 'v')
+               ch = L'\v';
+       else if (str[0] == 'a')
+               ch = L'\a';
+       else if (octal_digit(str[0])) {
+               i = 0;
+               do {
+                       digs[dno++] = str[i++];
+               } while (octal_digit(str[i]) && dno < 3);
+               ch = strtol(digs, NULL, 8);
+       }
+       else if (str[0] == 'x') {
+               while (hex_digit(str[i]) && dno < 2) {
+                       digs[dno++] = str[i++];
+               }
+               if (dno > 0)
+                       ch = strtol(digs, NULL, 16);
+       }
+       else if (str[0] == 'u') {
+               while (hex_digit(str[i]) && dno < 4) {
+                       digs[dno++] = str[i++];
+               }
+               if (dno > 0)
+                       ch = strtol(digs, NULL, 16);
+       }
+       else if (str[0] == 'U') {
+               while (hex_digit(str[i]) && dno < 8) {
+                       digs[dno++] = str[i++];
+               }
+               if (dno > 0)
+                       ch = strtol(digs, NULL, 16);
+       }
+       *dest = ch;
+
+       return i;
 }
 
 /* convert a string with literal \uxxxx or \Uxxxxxxxx characters to UTF-8
-   example: u8_unescape(mybuf, 256, "hello\\u220e")
-   note the double backslash is needed if called on a C string literal */
+example: u8_unescape(mybuf, 256, "hello\\u220e")
+note the double backslash is needed if called on a C string literal */
 SWITCH_DECLARE(int) switch_u8_unescape(char *buf, int sz, char *src)
 {
-    int c=0, amt;
-    uint32_t ch;
-    char temp[4];
-
-    while (*src && c < sz) {
-        if (*src == '\\') {
-            src++;
-            amt = switch_u8_read_escape_sequence(src, &ch);
-        }
-        else {
-            ch = (uint32_t)*src;
-            amt = 1;
-        }
-        src += amt;
-        amt = switch_u8_wc_toutf8(temp, ch);
-        if (amt > sz-c)
-            break;
-        memcpy(&buf[c], temp, amt);
-        c += amt;
-    }
-    if (c < sz)
-        buf[c] = '\0';
-    return c;
+       int c=0, amt;
+       uint32_t ch;
+       char temp[4];
+
+       while (*src && c < sz) {
+               if (*src == '\\') {
+                       src++;
+                       amt = switch_u8_read_escape_sequence(src, &ch);
+               }
+               else {
+                       ch = (uint32_t)*src;
+                       amt = 1;
+               }
+               src += amt;
+               amt = switch_u8_wc_toutf8(temp, ch);
+               if (amt > sz-c)
+                       break;
+               memcpy(&buf[c], temp, amt);
+               c += amt;
+       }
+       if (c < sz)
+               buf[c] = '\0';
+       return c;
 }
 
 SWITCH_DECLARE(int) switch_u8_escape_wchar(char *buf, int sz, uint32_t ch)
 {
-    if (ch == L'\n')
-        return snprintf(buf, sz, "\\n");
-    else if (ch == L'\t')
-        return snprintf(buf, sz, "\\t");
-    else if (ch == L'\r')
-        return snprintf(buf, sz, "\\r");
-    else if (ch == L'\b')
-        return snprintf(buf, sz, "\\b");
-    else if (ch == L'\f')
-        return snprintf(buf, sz, "\\f");
-    else if (ch == L'\v')
-        return snprintf(buf, sz, "\\v");
-    else if (ch == L'\a')
-        return snprintf(buf, sz, "\\a");
-    else if (ch == L'\\')
-        return snprintf(buf, sz, "\\\\");
-    else if (ch < 32 || ch == 0x7f)
-        return snprintf(buf, sz, "\\x%hhX", (unsigned char)ch);
-    else if (ch > 0xFFFF)
-        return snprintf(buf, sz, "\\U%.8X", (uint32_t)ch);
-    else if (ch >= 0x80 && ch <= 0xFFFF)
-        return snprintf(buf, sz, "\\u%.4hX", (unsigned short)ch);
-
-    return snprintf(buf, sz, "%c", (char)ch);
+       if (ch == L'\n')
+               return snprintf(buf, sz, "\\n");
+       else if (ch == L'\t')
+               return snprintf(buf, sz, "\\t");
+       else if (ch == L'\r')
+               return snprintf(buf, sz, "\\r");
+       else if (ch == L'\b')
+               return snprintf(buf, sz, "\\b");
+       else if (ch == L'\f')
+               return snprintf(buf, sz, "\\f");
+       else if (ch == L'\v')
+               return snprintf(buf, sz, "\\v");
+       else if (ch == L'\a')
+               return snprintf(buf, sz, "\\a");
+       else if (ch == L'\\')
+               return snprintf(buf, sz, "\\\\");
+       else if (ch < 32 || ch == 0x7f)
+               return snprintf(buf, sz, "\\x%hhX", (unsigned char)ch);
+       else if (ch > 0xFFFF)
+               return snprintf(buf, sz, "\\U%.8X", (uint32_t)ch);
+       else if (ch >= 0x80 && ch <= 0xFFFF)
+               return snprintf(buf, sz, "\\u%.4hX", (unsigned short)ch);
+
+       return snprintf(buf, sz, "%c", (char)ch);
 }
 
 SWITCH_DECLARE(int) switch_u8_escape(char *buf, int sz, char *src, int escape_quotes)
 {
-    int c=0, i=0, amt;
-
-    while (src[i] && c < sz) {
-        if (escape_quotes && src[i] == '"') {
-            amt = snprintf(buf, sz - c, "\\\"");
-            i++;
-        }
-        else {
-            amt = switch_u8_escape_wchar(buf, sz - c, switch_u8_nextchar(src, &i));
-        }
-        c += amt;
-        buf += amt;
-    }
-    if (c < sz)
-        *buf = '\0';
-    return c;
+       int c=0, i=0, amt;
+
+       while (src[i] && c < sz) {
+               if (escape_quotes && src[i] == '"') {
+                       amt = snprintf(buf, sz - c, "\\\"");
+                       i++;
+               }
+               else {
+                       amt = switch_u8_escape_wchar(buf, sz - c, switch_u8_nextchar(src, &i));
+               }
+               c += amt;
+               buf += amt;
+       }
+       if (c < sz)
+               *buf = '\0';
+       return c;
 }
 
 SWITCH_DECLARE(char *) switch_u8_strchr(char *s, uint32_t ch, int *charn)
 {
-    int i = 0, lasti=0;
-    uint32_t c;
-
-    *charn = 0;
-    while (s[i]) {
-        c = switch_u8_nextchar(s, &i);
-        if (c == ch) {
-            return &s[lasti];
-        }
-        lasti = i;
-        (*charn)++;
-    }
-    return NULL;
+       int i = 0, lasti=0;
+       uint32_t c;
+
+       *charn = 0;
+       while (s[i]) {
+               c = switch_u8_nextchar(s, &i);
+               if (c == ch) {
+                       return &s[lasti];
+               }
+               lasti = i;
+               (*charn)++;
+       }
+       return NULL;
 }
 
 SWITCH_DECLARE(char *) switch_u8_memchr(char *s, uint32_t ch, size_t sz, int *charn)
 {
-    int i = 0, lasti=0;
-    uint32_t c;
-    int csz;
-
-    *charn = 0;
-    while (i < sz) {
-        c = csz = 0;
-        do {
-            c <<= 6;
-            c += (unsigned char)s[i++];
-            csz++;
-        } while (i < sz && !isutf(s[i]));
-        c -= offsetsFromUTF8[csz-1];
-
-        if (c == ch) {
-            return &s[lasti];
-        }
-        lasti = i;
-        (*charn)++;
-    }
-    return NULL;
+       int i = 0, lasti=0;
+       uint32_t c;
+       int csz;
+
+       *charn = 0;
+       while (i < sz) {
+               c = csz = 0;
+               do {
+                       c <<= 6;
+                       c += (unsigned char)s[i++];
+                       csz++;
+               } while (i < sz && !isutf(s[i]));
+               c -= offsetsFromUTF8[csz-1];
+
+               if (c == ch) {
+                       return &s[lasti];
+               }
+               lasti = i;
+               (*charn)++;
+       }
+       return NULL;
 }
 
 SWITCH_DECLARE(int) switch_u8_is_locale_utf8(char *locale)
 {
-    /* this code based on libutf8 */
-    const char* cp = locale;
-
-    for (; *cp != '\0' && *cp != '@' && *cp != '+' && *cp != ','; cp++) {
-        if (*cp == '.') {
-            const char* encoding = ++cp;
-            for (; *cp != '\0' && *cp != '@' && *cp != '+' && *cp != ','; cp++)
-                ;
-            if ((cp-encoding == 5 && !strncmp(encoding, "UTF-8", 5))
-                || (cp-encoding == 4 && !strncmp(encoding, "utf8", 4)))
-                return 1; /* it's UTF-8 */
-            break;
-        }
-    }
-    return 0;
+       /* this code based on libutf8 */
+       const char* cp = locale;
+
+       for (; *cp != '\0' && *cp != '@' && *cp != '+' && *cp != ','; cp++) {
+               if (*cp == '.') {
+                       const char* encoding = ++cp;
+                       for (; *cp != '\0' && *cp != '@' && *cp != '+' && *cp != ','; cp++)
+                               ;
+                       if ((cp-encoding == 5 && !strncmp(encoding, "UTF-8", 5))
+                                       || (cp-encoding == 4 && !strncmp(encoding, "utf8", 4)))
+                               return 1; /* it's UTF-8 */
+                       break;
+               }
+       }
+       return 0;
 }
 
 
index 707b782feb729779b606d8be8fda8a50004a49cc..8567cfb95f873e86b8ef29d9be63527dcd0f62d3 100644 (file)
@@ -1838,7 +1838,7 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *ma
 #endif
 SWITCH_DECLARE(switch_status_t) switch_find_interface_ip(char *buf, int len, int *mask, const char *ifname, int family)
 {
-        switch_status_t status = SWITCH_STATUS_FALSE;
+       switch_status_t status = SWITCH_STATUS_FALSE;
 
 #ifdef HAVE_GETIFADDRS
 
index dcb3e8f185674f0896d4be0ef8d966381ee0698f..0c2b390ad9f7413626b32662eae24c74c7ddfc30 100644 (file)
@@ -1041,15 +1041,15 @@ static switch_status_t switch_vpx_decode(switch_codec_t *codec, switch_frame_t *
                is_keyframe = IS_VP8_KEY_FRAME((uint8_t *)frame->data);
        }
        
-    if (context->got_key_frame <= 0) {
-        context->no_key_frame++;
-        //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no keyframe, %d\n", context->no_key_frame);
-        if (context->no_key_frame > 50) {
-            if ((is_keyframe = is_start)) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no keyframe, treating start as key.\n");
-            }
-        }
-    }
+       if (context->got_key_frame <= 0) {
+               context->no_key_frame++;
+               //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no keyframe, %d\n", context->no_key_frame);
+               if (context->no_key_frame > 50) {
+                       if ((is_keyframe = is_start)) {
+                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "no keyframe, treating start as key.\n");
+                       }
+               }
+       }
 
        // if (is_keyframe) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "got key %d\n", is_keyframe);