changeset 5:be5e612dd602

More readable calculations, no functional changes.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 03 Jul 2008 13:23:06 +0400
parents ab9f96327bb6
children 91985471307e
files ngx_http_bytes_filter_module.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ngx_http_bytes_filter_module.c	Thu Jul 03 13:16:03 2008 +0400
+++ b/ngx_http_bytes_filter_module.c	Thu Jul 03 13:23:06 2008 +0400
@@ -417,8 +417,8 @@
             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 @@
             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,