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


Hi Rafael,

I have pushed:

0003-Replace-List-for-std-vector-ExcEScenarioCell.calc.patch
0004-Make-read-only-functions-in-ExcEScenarioCell-co.calc.patch
0005-Replace-List-for-std-vector-ExcEScenario.calc.patch

=================================================

I havn't pushed 0001-Replace-List-for-std-vector-XclObj.patch because I am not sure about

--- cut ---
+     inline sal_uInt16 size () const { return static_cast<sal_uInt16>(maObjs.size()); } 
--- cut ---

If I understand it correctly, it is a replacement for

--- cut ---
sal_uIntPtr       Count() const { return nCount; }
--- cut ---
, see http://opengrok.libreoffice.org/xref/libs-gui/tools/inc/tools/contnr.hxx#99


The original object might have a bigger size. I guess that you have used sal_uInt16 because of 

--- cut ---
 sal_uInt16 XclExpObjList::Add( XclObj* pObj ) 
 { 
-    OSL_ENSURE( Count() < 0xFFFF, "XclExpObjList::Add: too much for Xcl" ); 
-    if ( Count() < 0xFFFF ) 
+    OSL_ENSURE( maObjs.size() < 0xFFFF, "XclExpObjList::Add: too much for Xcl" ); 
--- cut ---

So, it should not go over 2bytes. Though, IMHO, it is quite dangerous to
use sal_uInt16 because it could overflow easily and if it overflows, it is
again lower than 0xFFFF.

=> I would suggest to use the sal_uIntPtr.

What do you think?


===========================================================

Also haven't pushed
0002-Replace-List-with-std-vector-XclExpUserBView.calc.patch because I
am not sure about

--- cut ---
 XclExpUserBViewList::XclExpUserBViewList( const ScChangeTrack& rChangeTrack ) 
+    : aViews(rChangeTrack.GetUserCollection().GetCount())
[...]
-            List::Insert( new XclExpUserBView( pStrData->GetString(), aGUID ), LIST_APPEND ); 
+            aViews.push_back( new XclExpUserBView( pStrData->GetString(), aGUID ) ); 
--- cut ---

Why do you initialize the vector with NULL pointers?

IMHO, all the pointers will stay NULL because you later use .push_back().

For example, rChangeTrack has the collection: A B C D and GetCount() returns 4.
If you initialize the vector, you will end with the vector: 0 0 0 0 A B C D

Or did I miss something?


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.