On 06/17/10 15:46, Bartosz wrote:
2010/6/16 Eike Rathke wrote:
Hi Bartosz,

On Tuesday, 2010-06-15 09:06:19 +0200, Bartosz wrote:

After replace svArrays by STL containers, in some cases I observed boost of 
performance.

For example:
     for (USHORT i = 0;  i < aEntries.size();  ++i)
Please ensure to adapt also all types where necessary, in this case the
result may even be an endless loop if aEntries happens to contain more
than 64k entries.. instead of   USHORT i   it should be   size_t i

Hi Eike.

I think that if the endless loop didn't exist before SvArrays replace, then
it will not exist after SvReplace.
I think previous code:
    USHORT nCnt = aEntries.Count();
    USHORT i;
    for (i = 0;  i<  nCnt&&   0 == aRes.Len();  ++i)

may also even to endless loop.

No, as SvArrays Count() returns USHORT (IIRC), while std::vector size() returns std::vector::size_type, which can be larger than USHORT. If you change the type of aEntries from an SvArray to std::vector, you really must change the type of i from USHORT to std::vector::size_type.

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org

Reply via email to