From cbe760aa8ad43d3908b7c9408d7f3946747981b1 Mon Sep 17 00:00:00 2001 From: Roman Arutyunyan Date: Thu, 13 Jun 2013 17:11:44 +0400 Subject: [PATCH] fixed formatting types --- ngx_rtmp_auto_push_module.c | 2 +- ngx_rtmp_control_module.c | 2 +- ngx_rtmp_log_module.c | 16 ++++---- ngx_rtmp_netcall_module.c | 16 +++----- ngx_rtmp_notify_module.c | 2 +- ngx_rtmp_stat_module.c | 73 ++++++++++++++++++------------------- 6 files changed, 52 insertions(+), 59 deletions(-) diff --git a/ngx_rtmp_auto_push_module.c b/ngx_rtmp_auto_push_module.c index 4acdc0b..7c0c2b3 100644 --- a/ngx_rtmp_auto_push_module.c +++ b/ngx_rtmp_auto_push_module.c @@ -308,7 +308,7 @@ ngx_rtmp_auto_push_reconnect(ngx_event_t *ev) ngx_rtmp_relay_target_t at; u_char path[sizeof("unix:") + NGX_MAX_PATH]; u_char flash_ver[sizeof("APSH ,") + - NGX_OFF_T_LEN * 2]; + NGX_INT_T_LEN * 2]; u_char play_path[NGX_RTMP_MAX_NAME]; ngx_str_t name; u_char *p; diff --git a/ngx_rtmp_control_module.c b/ngx_rtmp_control_module.c index 759be3a..83ca22e 100644 --- a/ngx_rtmp_control_module.c +++ b/ngx_rtmp_control_module.c @@ -392,7 +392,7 @@ ngx_rtmp_control_drop(ngx_http_request_t *r, ngx_str_t *method) /* output ndropped */ - len = NGX_OFF_T_LEN; + len = NGX_INT_T_LEN; p = ngx_palloc(r->connection->pool, len); if (p == NULL) { diff --git a/ngx_rtmp_log_module.c b/ngx_rtmp_log_module.c index 0faf793..fa9cc3e 100644 --- a/ngx_rtmp_log_module.c +++ b/ngx_rtmp_log_module.c @@ -158,16 +158,16 @@ ngx_rtmp_log_var_default_getdata(ngx_rtmp_session_t *s, u_char *buf, static size_t -ngx_rtmp_log_var_number_getlen(ngx_rtmp_session_t *s, ngx_rtmp_log_op_t *op) +ngx_rtmp_log_var_connection_getlen(ngx_rtmp_session_t *s, ngx_rtmp_log_op_t *op) { - return NGX_OFF_T_LEN; + return NGX_INT_T_LEN; } static u_char * ngx_rtmp_log_var_connection_getdata(ngx_rtmp_session_t *s, u_char *buf, ngx_rtmp_log_op_t *op) { - return ngx_sprintf(buf, "%O", (off_t) s->connection->number); + return ngx_sprintf(buf, "%ui", (ngx_uint_t) s->connection->number); } @@ -192,7 +192,7 @@ static size_t ngx_rtmp_log_var_session_string_getlen(ngx_rtmp_session_t *s, ngx_rtmp_log_op_t *op) { - return ((ngx_str_t *) ((uint8_t *) s + op->offset))->len; + return ((ngx_str_t *) ((u_char *) s + op->offset))->len; } @@ -202,7 +202,7 @@ ngx_rtmp_log_var_session_string_getdata(ngx_rtmp_session_t *s, u_char *buf, { ngx_str_t *str; - str = (ngx_str_t *) ((uint8_t *) s + op->offset); + str = (ngx_str_t *) ((u_char *) s + op->offset); return ngx_cpymem(buf, str->data, str->len); } @@ -303,7 +303,7 @@ ngx_rtmp_log_var_time_local_getdata(ngx_rtmp_session_t *s, u_char *buf, ngx_rtmp_log_op_t *op) { return ngx_cpymem(buf, ngx_cached_http_log_time.data, - ngx_cached_http_log_time.len); + ngx_cached_http_log_time.len); } @@ -328,7 +328,7 @@ static size_t ngx_rtmp_log_var_session_readable_time_getlen(ngx_rtmp_session_t *s, ngx_rtmp_log_op_t *op) { - return NGX_OFF_T_LEN + sizeof("d 23h 59m 59s") - 1; + return NGX_INT_T_LEN + sizeof("d 23h 59m 59s") - 1; } @@ -366,7 +366,7 @@ ngx_rtmp_log_var_session_readable_time_getdata(ngx_rtmp_session_t *s, static ngx_rtmp_log_var_t ngx_rtmp_log_vars[] = { { ngx_string("connection"), - ngx_rtmp_log_var_number_getlen, + ngx_rtmp_log_var_connection_getlen, ngx_rtmp_log_var_connection_getdata, 0 }, diff --git a/ngx_rtmp_netcall_module.c b/ngx_rtmp_netcall_module.c index 230b3b1..a3880dc 100644 --- a/ngx_rtmp_netcall_module.c +++ b/ngx_rtmp_netcall_module.c @@ -547,7 +547,7 @@ ngx_rtmp_netcall_http_format_request(ngx_int_t method, ngx_str_t *host, } b = ngx_create_temp_buf(pool, sizeof(rq_tmpl) + host->len + - content_type->len + NGX_OFF_T_LEN); + content_type->len + NGX_SIZE_T_LEN); if (b == NULL) { return NULL; } @@ -685,12 +685,9 @@ ngx_rtmp_netcall_memcache_set(ngx_rtmp_session_t *s, ngx_pool_t *pool, return NULL; } - b = ngx_create_temp_buf(pool, - sizeof("set ") - 1 + key->len + - (sizeof(" ") - 1 + NGX_OFF_T_LEN) * 3 + - (sizeof("\r\n") - 1) * 2 - + value->len - ); + b = ngx_create_temp_buf(pool, sizeof("set ") - 1 + key->len + + (1 + NGX_INT_T_LEN) * 3 + + (sizeof("\r\n") - 1) * 2 + value->len); if (b == NULL) { return NULL; @@ -699,9 +696,8 @@ ngx_rtmp_netcall_memcache_set(ngx_rtmp_session_t *s, ngx_pool_t *pool, cl->next = NULL; cl->buf = b; - b->last = ngx_sprintf(b->pos, - "set %V %ui %ui %ui\r\n%V\r\n", - key, flags, sec, (ngx_uint_t)value->len, value); + b->last = ngx_sprintf(b->pos, "set %V %ui %ui %ui\r\n%V\r\n", + key, flags, sec, (ngx_uint_t) value->len, value); return cl; } diff --git a/ngx_rtmp_notify_module.c b/ngx_rtmp_notify_module.c index 85e9185..ee3f37a 100644 --- a/ngx_rtmp_notify_module.c +++ b/ngx_rtmp_notify_module.c @@ -583,7 +583,7 @@ ngx_rtmp_notify_play_create(ngx_rtmp_session_t *s, void *arg, sizeof("&call=play") + sizeof("&name=") + name_len * 3 + sizeof("&start=&duration=&reset=") + - NGX_OFF_T_LEN * 3 + 1 + args_len); + NGX_INT32_LEN * 3 + 1 + args_len); if (b == NULL) { return NULL; } diff --git a/ngx_rtmp_stat_module.c b/ngx_rtmp_stat_module.c index db1a846..1e37c91 100644 --- a/ngx_rtmp_stat_module.c +++ b/ngx_rtmp_stat_module.c @@ -276,7 +276,7 @@ ngx_rtmp_stat_bw(ngx_http_request_t *r, ngx_chain_t ***lll, #ifdef NGX_RTMP_POOL_DEBUG static void ngx_rtmp_stat_get_pool_size(ngx_pool_t *pool, ngx_uint_t *nlarge, - size_t *size) + ngx_uint_t *size) { ngx_pool_large_t *l; ngx_pool_t *p, *n; @@ -300,19 +300,16 @@ static void ngx_rtmp_stat_dump_pool(ngx_http_request_t *r, ngx_chain_t ***lll, ngx_pool_t *pool) { - ngx_uint_t nlarge; - size_t size; - u_char buf[NGX_OFF_T_LEN + 1]; + ngx_uint_t nlarge, size; + u_char buf[NGX_INT_T_LEN]; size = 0; nlarge = 0; ngx_rtmp_stat_get_pool_size(pool, &nlarge, &size); NGX_RTMP_STAT_L(""); - NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), - "%ui", nlarge) - buf); + NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%ui", nlarge) - buf); NGX_RTMP_STAT_L(""); - NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), - "%uz", size) - buf); + NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%ui", size) - buf); NGX_RTMP_STAT_L("\r\n"); } #endif @@ -323,14 +320,14 @@ static void ngx_rtmp_stat_client(ngx_http_request_t *r, ngx_chain_t ***lll, ngx_rtmp_session_t *s) { - u_char buf[NGX_OFF_T_LEN + 1]; + u_char buf[NGX_INT_T_LEN]; #ifdef NGX_RTMP_POOL_DEBUG ngx_rtmp_stat_dump_pool(r, lll, s->connection->pool); #endif NGX_RTMP_STAT_L(""); NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%ui", - (ngx_uint_t) s->connection->number) - buf); + (ngx_uint_t) s->connection->number) - buf); NGX_RTMP_STAT_L(""); NGX_RTMP_STAT_L("
"); @@ -338,8 +335,8 @@ ngx_rtmp_stat_client(ngx_http_request_t *r, ngx_chain_t ***lll, NGX_RTMP_STAT_L("
"); NGX_RTMP_STAT_L(""); if (s->flashver.len) { @@ -371,8 +368,9 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll, ngx_rtmp_live_ctx_t *ctx; ngx_rtmp_session_t *s; ngx_int_t n; - size_t nclients, total_nclients; - u_char buf[NGX_OFF_T_LEN + 1]; + ngx_uint_t nclients, total_nclients; + u_char buf[NGX_INT_T_LEN]; + u_char bbuf[NGX_INT32_LEN * 2 + 1]; ngx_rtmp_stat_loc_conf_t *slcf; u_char *cname; @@ -394,8 +392,9 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll, NGX_RTMP_STAT_L("\r\n"); NGX_RTMP_STAT_L(""); ngx_rtmp_stat_bw(r, lll, &stream->bw_in, &stream->bw_out); @@ -410,17 +409,16 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll, ngx_rtmp_stat_client(r, lll, s); NGX_RTMP_STAT_L(""); - NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), - "%uD/%uD", ctx->cs[1].dropped, - ctx->cs[0].dropped) - buf); + NGX_RTMP_STAT(bbuf, ngx_snprintf(bbuf, sizeof(bbuf), + "%uD/%uD", ctx->cs[1].dropped, + ctx->cs[0].dropped) - bbuf); NGX_RTMP_STAT_L(""); NGX_RTMP_STAT_L(""); if (!lacf->interleave) { - NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), - "%L", (int64_t) ctx->cs[1].timestamp - - (int64_t) ctx->cs[0].timestamp) - - buf); + NGX_RTMP_STAT(bbuf, ngx_snprintf(bbuf, sizeof(bbuf), + "%D", ctx->cs[1].timestamp - + ctx->cs[0].timestamp) - bbuf); } NGX_RTMP_STAT_L(""); @@ -443,13 +441,13 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll, if (codec) { NGX_RTMP_STAT_L(""); NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), - "%ui", codec->width) - buf); + "%ui", codec->width) - buf); NGX_RTMP_STAT_L(""); NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), - "%ui", codec->height) - buf); + "%ui", codec->height) - buf); NGX_RTMP_STAT_L(""); NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), - "%ui", codec->frame_rate) - buf); + "%ui", codec->frame_rate) - buf); NGX_RTMP_STAT_L(""); cname = ngx_rtmp_get_video_codec_name(codec->video_codec_id); if (*cname) { @@ -478,7 +476,7 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll, NGX_RTMP_STAT_L(""); NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), - "%uz", nclients) - buf); + "%ui", nclients) - buf); NGX_RTMP_STAT_L("\r\n"); if (stream->publishing) { @@ -495,7 +493,7 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll, NGX_RTMP_STAT_L(""); NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), - "%uz", total_nclients) - buf); + "%ui", total_nclients) - buf); NGX_RTMP_STAT_L("\r\n"); NGX_RTMP_STAT_L("\r\n"); @@ -508,9 +506,8 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll, { ngx_rtmp_play_ctx_t *ctx, *sctx; ngx_rtmp_session_t *s; - ngx_uint_t n; - size_t nclients, total_nclients; - u_char buf[NGX_OFF_T_LEN + 1]; + ngx_uint_t n, nclients, total_nclients; + u_char buf[NGX_INT_T_LEN]; ngx_rtmp_stat_loc_conf_t *slcf; if (pacf->entries.nelts == 0) { @@ -537,7 +534,7 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll, break; } - ++nclients; + nclients++; s = ctx->session; if (slcf->stat & NGX_RTMP_STAT_CLIENTS) { @@ -552,8 +549,8 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll, NGX_RTMP_STAT_L(""); NGX_RTMP_STAT_L(""); - NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), - "%uz", nclients) - buf); + NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), + "%ui", nclients) - buf); NGX_RTMP_STAT_L("\r\n"); NGX_RTMP_STAT_L("\r\n"); @@ -562,7 +559,7 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll, NGX_RTMP_STAT_L(""); NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), - "%uz", total_nclients) - buf); + "%ui", total_nclients) - buf); NGX_RTMP_STAT_L("\r\n"); NGX_RTMP_STAT_L("\r\n"); @@ -627,8 +624,8 @@ ngx_rtmp_stat_handler(ngx_http_request_t *r) ngx_chain_t *cl, *l, **ll, ***lll; size_t n; off_t len; - static u_char tbuf[NGX_TIME_T_LEN + 1]; - static u_char nbuf[NGX_OFF_T_LEN + 1]; + static u_char tbuf[NGX_TIME_T_LEN]; + static u_char nbuf[NGX_INT_T_LEN]; slcf = ngx_http_get_module_loc_conf(r, ngx_rtmp_stat_module); if (slcf->stat == 0) { @@ -669,7 +666,7 @@ ngx_rtmp_stat_handler(ngx_http_request_t *r) NGX_RTMP_STAT_L(""); NGX_RTMP_STAT(tbuf, ngx_snprintf(tbuf, sizeof(tbuf), - "%T", ngx_cached_time->sec - start_time) - tbuf); + "%T", ngx_cached_time->sec - start_time) - tbuf); NGX_RTMP_STAT_L("\r\n"); NGX_RTMP_STAT_L("");