httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Fritsch" ...@sfritsch.de>
Subject Re: svn commit: r1161791 - /httpd/httpd/trunk/modules/http/byterange_filter.c
Date Fri, 26 Aug 2011 15:10:50 GMT
On Fri, August 26, 2011 16:47, Greg Ames wrote:
> On Thu, Aug 25, 2011 at 7:02 PM, <sf@apache.org> wrote:
>
>>
>> Log:
>> Put parsed ranges into an array and perform merges on that array.
>>
>> +        if (i > 0) {
>> +            if (!(ranges[i].start > ranges[i-1].end   + 1 &&
>> +                  ranges[i].end   < ranges[i-1].start - 1))
>> +            {

The if above is meant to determine if we want to merge at all. But I think
you are right in that this is wrong. The "&&" should be an "||". But this
also means that the test framework needs more tests for multiple ranges.

>> +                if (ranges[i].start < ranges[i-1].start)
>> +                    ranges[i-1].start = ranges[i].start;
>>
>
> ok, the two lines above seem reasonable.
>
>
>> +                if (ranges[i].end > ranges[i-1].end)
>> +                    ranges[i-1].end = ranges[i].end;

These two ifs just merge the range. The first selects the lower of the two
start values and the second one selects the higher of the two end values.
This could be made more clear by defining MIN and MAX macros and writing

    ranges[i-1].start = MIN(ranges[i].start, ranges[i-1].start);
    ranges[i-1].end   = MAX(ranges[i].end,   ranges[i-1].end);

Does this make sense?


Mime
View raw message