Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Rafael Dominguez píše v St 08. 06. 2011 v 22:00 -0430:
More List cleaning up

Great work. I have pushed all patches with the following two changes:

1. 0016-Replace-SbaSelectionList-with-std-vector-sal_In.calc.patch

I replaced
+    if ( !pSelection->empty() && (*pSelection)[0] != -1L )
with
+    if ( !pSelection->empty() && (*pSelection)[0] != -1 )

, see
http://cgit.freedesktop.org/libreoffice/calc/commit/?id=63be842775f2f25fdc47376e0cbd79e2df60f7bc

It was great catch that sal_Int32 was enough => we need not compare
against the long -1.



2. 0017-Replace-List-with-std-vector-ScAddress.calc-pmladek.patch

I replaced

+    long nCount = nNoteStart; 
+        if ( nNoteStart + nCount < nSize) 
+            ScAddress &rPos = aNotePosList[nCount]; 

with

+    long nCount = 0;
+        if ( nNoteStart + nCount < nSize)
+            ScAddress &rPos = aNotePosList[ nNoteStart + nCount ];

, see 
http://cgit.freedesktop.org/libreoffice/calc/commit/?id=dbeb664c3549a00306bd26e2f7b2c3c547b33dfa

By other words, I restored the original value of nCount.

The reason is that nCount is used as the return value. Your change would
modify the behavior. It would start returning the value increased by
nNoteStart. I am not if the return value is used at all but we should
not change the behavior if we are not sure about the consequences.

Of course, your solution looked more optimized. Though, I am sure that 
"nNoteStart + nCount" will not be counted twice. Compilers do powerful
optimizations these days. IMHO, it is perfectly fine to do some things
that will get optimized at runtime but are better readable in the
sources.


Anyway, thanks a lot for contribution!

Best Regards,
Petr


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.