size_t and backwards for loops


#1

I think the recent changes of int to size_t of many files introduced some problems, for example:

[code]void BitArray::loadFromMemoryBlock (const MemoryBlock& data) throw()
{
clear();

for (size_t i = data.getSize(); --i >= 0;)
	this->setBitRangeAsInt ((int) (i << 3), 8, data [i]);

}
[/code]

Since size_t is an unsigned type, the for never ends because decrementing i when its value is 0 results again in an extremely large value.

I wonder if this happened in some other parts of the codebase, I suggest you to check…


#2

Always check the tip before reporting a bug! I fixed that a couple of weeks ago!

Thanks, though - those size_t loops can be easy to miss…