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


Hi Noel,

On 14.02.2012 15:25, Noel Grandin wrote:
Note that I tried converting these usages to boost::ptr_map, but I ran
into entirely undecipherable C++ template errors.

Sorry for the late review... :(

What line produces that error? I suppose we should do use ptr_map, because even you forgot to delete object :)

@@ -385,14 +380,12 @@ void SvxRTFParser::ReadStyleTable()
             {
                 pStyle->sName = DelCharAtEnd( aToken, ';' );

-                if( aStyleTbl.Count() )
+                if( !aStyleTbl.empty() )
                 {
-                    SvxRTFStyleType* pOldSt = aStyleTbl.Remove( nStyleNo );
-                    if( pOldSt )
-                        delete pOldSt;
+                    aStyleTbl.erase(nStyleNo);
                 }

Also

@@ -4041,10 +4046,11 @@ SwTxtFmtColl* SwRTFParser::MakeStyle( sal_uInt16 nNo, const 
SvxRTFStyleType& rSt
         if( iter == aTxtCollTbl.end())            // noch nicht vorhanden, also anlegen
         {
             // ist die ueberhaupt als Style vorhanden ?
-            SvxRTFStyleType* pMkStyle = GetStyleTbl().Get( nStyleNo );
-            pNext = pMkStyle
-                    ? MakeStyle( nStyleNo, *pMkStyle )
-                    : pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
+            SvxRTFStyleTbl::iterator styleIter = GetStyleTbl().find( nStyleNo );
+            if ( styleIter != GetStyleTbl().end() )
+                pNext = MakeStyle( nStyleNo, *styleIter->second );
+            else
+                pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
                   ^^^

should be pNext = pDoc->...

All the best,
Ivan

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.