> On Jan. 18, 2011, 12:09 p.m., Merov Linden wrote:
> > indra/newview/lltexturecache.cpp, line 1595
> > <http://codereview.secondlife.com/r/90/diff/1/?file=413#file413line1595>
> >
> >     validate_idx being used in a test later, it's not just for 
> > (validate_idx == 0) that the behavior will be different. I need to 
> > understand better what that idx is all about or you need to give a bit more 
> > explanation before I approve this diff.

The debug setting CacheValidateCounter is set to 'next_id', which makes clear 
what it's meaning is: namely, the id that we will check next time. next_idx is 
a very local variable that is simply set to the value of CacheValidateCounter 
plus 1, and then that value is stored to CacheValidateCounter again for next 
time.

validate_idx is the ID that is actually being tested this time. Hence, it 
should be the value of CacheValidateCounter before we increase that.

Obviously, those ID's should be in the range 0...255, which is garanteed by 
doing a modulo 256 on next_id before writing it to CacheValidateCounter.

The old code also increases validate_idx *before* it is used. That means that 
it will be in the range 1...256, and 0 is never tested (note that validate_idx 
is just increased, there is no modulo applied, so it's obvious that it 
shouldn't be increased). Even the wording ("next"_id) suggests that 
validate_idx should just be the value of CacheValidateCounter, which is the 
value of the previous next_id...

So, after this patch, we get to the following code with validate_idx in the 
range 0...255, as it should be.


- Aleric


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://codereview.secondlife.com/r/90/#review191
-----------------------------------------------------------


On Jan. 14, 2011, 1:02 p.m., Aleric Inglewood wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://codereview.secondlife.com/r/90/
> -----------------------------------------------------------
> 
> (Updated Jan. 14, 2011, 1:02 p.m.)
> 
> 
> Review request for Viewer.
> 
> 
> Summary
> -------
> 
> Trivial patch, just removes stupidity.
> 
> 
> This addresses bug VWR-24321.
>     http://jira.secondlife.com/browse/VWR-24321
> 
> 
> Diffs
> -----
> 
>   doc/contributions.txt b0bd26c5638a 
>   indra/newview/lltexturecache.cpp b0bd26c5638a 
> 
> Diff: http://codereview.secondlife.com/r/90/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Aleric
> 
>

_______________________________________________
Policies and (un)subscribe information available here:
http://wiki.secondlife.com/wiki/OpenSource-Dev
Please read the policies before posting to keep unmoderated posting privileges

Reply via email to