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


On Tue, 2011-08-02 at 19:12 +0200, Maciej Rumianowski wrote:
Hello,

This is my second patch for Bug 38831 - [EasyHack] Get rid of
SV_DECL_VARARR, SV_DECL_VARARR_PLAIN, SV_DECL_VARARR_SORT ....

It replace SvULongs and WW8_WrSepInfoPtrs (another VARARR) with
std:vector, SvStringsDtor with boost::ptr_vector in writer.

@@ -2017,7 +2011,7 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, sal_uInt8 nTTyp,
             {
                 // textbox - content
                 WW8_CP nCP = rWrt.Fc2Cp( rWrt.Strm().Tell() );
-                aCps.Insert( nCP, i );
+                aCps.push_back( nCP );
                 pTxtPos->Append( nCP );

Hmm are you sure that you can replace that with vector's push_back()
there?  For this to work correctly the i has to always point to the end
position (last element + 1), but from the surrounding code I'm not sure
if that's guaranteed.  You probably should use vector's insert() method
with a specific insert position, instead of using push_back() in this
case.

Also, I've seen a code like the following

if (!vec.empty())
    vec.clear();

in several places.  While this code is not wrong (since the original
code was written that way), calling clear() on an empty vector does
nothing & is harmless.  So just calling clear() should be fine without
checking for empty-ness.

Other than that, the rest looks okay to me.  I'd prefer someone more
experienced in Writer's code to sanity-check though.

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc
<kohei.yoshida@suse.com>


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.