# HG changeset patch # User Maxim Dounin # Date 1215076986 -14400 # Node ID be5e612dd6026423d03f675cbd273258509de9c6 # Parent ab9f96327bb655fcc85c12c58b061d297933c265 More readable calculations, no functional changes. diff --git a/ngx_http_bytes_filter_module.c b/ngx_http_bytes_filter_module.c --- a/ngx_http_bytes_filter_module.c +++ b/ngx_http_bytes_filter_module.c @@ -417,8 +417,8 @@ next: if (range->start > ctx->offset) { b->file_pos += range->start - ctx->offset; } - if (range->end - ctx->offset < size) { - b->file_last -= size - (range->end - ctx->offset); + if (range->end < ctx->offset + size) { + b->file_last -= ctx->offset + size - range->end; } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, @@ -435,8 +435,8 @@ next: if (range->start > ctx->offset) { b->pos += (size_t) (range->start - ctx->offset); } - if (range->end - ctx->offset < size) { - b->last -= (size_t) (size - (range->end - ctx->offset)); + if (range->end < ctx->offset + size) { + b->last -= (size_t) (ctx->offset + size - range->end); } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,