Klaus Demo nginx / 328df7a
use ngx_min() and ngx_max() Igor Sysoev 12 years ago
4 changed file(s) with 6 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
464464 dst = ctx->buf;
465465
466466 size = ngx_buf_size(src);
467
468 if (size > dst->end - dst->pos) {
469 size = dst->end - dst->pos;
470 }
467 size = ngx_min(size, dst->end - dst->pos);
471468
472469 sendfile = ctx->sendfile & !ctx->directio;
473470
228228 case 'V':
229229 v = va_arg(args, ngx_str_t *);
230230
231 len = v->len;
232 len = (buf + len < last) ? len : (size_t) (last - buf);
233
231 len = ngx_min(((size_t) (last - buf)), v->len);
234232 buf = ngx_cpymem(buf, v->data, len);
235233 fmt++;
236234
239237 case 'v':
240238 vv = va_arg(args, ngx_variable_value_t *);
241239
242 len = vv->len;
243 len = (buf + len < last) ? len : (size_t) (last - buf);
244
240 len = ngx_min(((size_t) (last - buf)), vv->len);
245241 buf = ngx_cpymem(buf, vv->data, len);
246242 fmt++;
247243
256252 }
257253
258254 } else {
259 len = (buf + slen < last) ? slen : (size_t) (last - buf);
260
255 len = ngx_min(((size_t) (last - buf)), slen);
261256 buf = ngx_cpymem(buf, p, len);
262257 }
263258
532532
533533 ms = (ngx_msec_int_t)
534534 ((tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec));
535 ms = (ms >= 0) ? ms : 0;
535 ms = ngx_max(ms, 0);
536536
537537 return ngx_sprintf(buf, "%T.%03M", ms / 1000, ms % 1000);
538538 }
37093709 if (state[i].status) {
37103710 ms = (ngx_msec_int_t)
37113711 (state[i].response_sec * 1000 + state[i].response_msec);
3712 ms = (ms >= 0) ? ms : 0;
3712 ms = ngx_max(ms, 0);
37133713 p = ngx_sprintf(p, "%d.%03d", ms / 1000, ms % 1000);
37143714
37153715 } else {