fixed formatting types

This commit is contained in:
Roman Arutyunyan 2013-06-13 17:11:44 +04:00
parent c4e78b6ea9
commit cbe760aa8a
6 changed files with 52 additions and 59 deletions

View file

@ -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;

View file

@ -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) {

View file

@ -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 },

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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("<pool><nlarge>");
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("</nlarge><size>");
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("</size></pool>\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("<id>");
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("</id>");
NGX_RTMP_STAT_L("<address>");
@ -338,8 +335,8 @@ ngx_rtmp_stat_client(ngx_http_request_t *r, ngx_chain_t ***lll,
NGX_RTMP_STAT_L("</address>");
NGX_RTMP_STAT_L("<time>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%M",
ngx_current_msec - s->epoch) - buf);
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%i",
(ngx_int_t) (ngx_current_msec - s->epoch)) - buf);
NGX_RTMP_STAT_L("</time>");
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("</name>\r\n");
NGX_RTMP_STAT_L("<time>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%M", ngx_current_msec - stream->epoch) - buf);
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf), "%i",
(ngx_int_t) (ngx_current_msec - stream->epoch))
- buf);
NGX_RTMP_STAT_L("</time>");
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("<dropped>");
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("</dropped>");
NGX_RTMP_STAT_L("<avsync>");
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("</avsync>");
@ -443,13 +441,13 @@ ngx_rtmp_stat_live(ngx_http_request_t *r, ngx_chain_t ***lll,
if (codec) {
NGX_RTMP_STAT_L("<meta><width>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", codec->width) - buf);
"%ui", codec->width) - buf);
NGX_RTMP_STAT_L("</width><height>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", codec->height) - buf);
"%ui", codec->height) - buf);
NGX_RTMP_STAT_L("</height><framerate>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%ui", codec->frame_rate) - buf);
"%ui", codec->frame_rate) - buf);
NGX_RTMP_STAT_L("</framerate>");
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("<nclients>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%uz", nclients) - buf);
"%ui", nclients) - buf);
NGX_RTMP_STAT_L("</nclients>\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("<nclients>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%uz", total_nclients) - buf);
"%ui", total_nclients) - buf);
NGX_RTMP_STAT_L("</nclients>\r\n");
NGX_RTMP_STAT_L("</live>\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("<active/>");
NGX_RTMP_STAT_L("<nclients>");
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("</nclients>\r\n");
NGX_RTMP_STAT_L("</stream>\r\n");
@ -562,7 +559,7 @@ ngx_rtmp_stat_play(ngx_http_request_t *r, ngx_chain_t ***lll,
NGX_RTMP_STAT_L("<nclients>");
NGX_RTMP_STAT(buf, ngx_snprintf(buf, sizeof(buf),
"%uz", total_nclients) - buf);
"%ui", total_nclients) - buf);
NGX_RTMP_STAT_L("</nclients>\r\n");
NGX_RTMP_STAT_L("</play>\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("<uptime>");
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("</uptime>\r\n");
NGX_RTMP_STAT_L("<naccepted>");