[PATCH] fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT
Ioan Radu (via Code Review)
gerrit at gerrit.libreoffice.org
Sun Mar 10 14:06:28 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/2651
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/51/2651/1
fdo#43157 - Clean up OSL_ASSERT, DBG_ASSERT
- replaced OSL_TRACE with SAL_INFO
- replaced OSL_ENSURE with SAL_WARN_IF
Change-Id: Ie30fbc9c720d8b93d6093e2c95f61dceea8aae2f
---
M oox/source/ppt/animationspersist.cxx
M oox/source/ppt/commonbehaviorcontext.cxx
M oox/source/ppt/pptshape.cxx
M sw/source/filter/ww8/ww8toolbar.cxx
4 files changed, 56 insertions(+), 57 deletions(-)
diff --git a/oox/source/ppt/animationspersist.cxx b/oox/source/ppt/animationspersist.cxx
index 74a9208..9917b60 100644
--- a/oox/source/ppt/animationspersist.cxx
+++ b/oox/source/ppt/animationspersist.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
#include "oox/drawingml/shape.hxx"
+#include "sal/log.hxx"
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::presentation;
@@ -60,12 +61,12 @@
{
case XML_charRg:
// TODO calculate the corresponding paragraph for the text range....
- OSL_TRACE( "OOX: TODO calculate the corresponding paragraph for the text range..." );
+ SAL_INFO("oox.ppt", "OOX: TODO calculate the corresponding paragraph for the text range..." );
break;
case XML_pRg:
aParaTarget.Paragraph = static_cast< sal_Int16 >( maRange.start );
// TODO what to do with more than one.
- OSL_TRACE( "OOX: TODO what to do with more than one" );
+ SAL_INFO("oox.ppt", "OOX: TODO what to do with more than one" );
break;
}
rTarget = makeAny( aParaTarget );
@@ -86,11 +87,11 @@
{
case XML_inkTgt:
// TODO
- OSL_TRACE( "OOX: TODO inkTgt" );
+ SAL_INFO("oox.ppt", "OOX: TODO inkTgt" );
break;
case XML_sldTgt:
// TODO
- OSL_TRACE( "OOX: TODO sldTgt" );
+ SAL_INFO("oox.ppt", "OOX: TODO sldTgt" );
break;
case XML_sndTgt:
aTarget = makeAny(msValue);
@@ -99,11 +100,11 @@
{
Any rTarget;
::oox::drawingml::ShapePtr pShape = pSlide->getShape(msValue);
- OSL_ENSURE( pShape, "failed to locate Shape");
+ SAL_WARN_IF( !pShape, "oox.ppt", "failed to locate Shape");
if( pShape )
{
Reference< XShape > xShape( pShape->getXShape() );
- OSL_ENSURE( xShape.is(), "fail to get XShape from shape" );
+ SAL_WARN_IF( !xShape.is(), "oox.ppt", "fail to get XShape from shape" );
if( xShape.is() )
{
rTarget <<= xShape;
diff --git a/oox/source/ppt/commonbehaviorcontext.cxx b/oox/source/ppt/commonbehaviorcontext.cxx
index 14c6c6b..d0f24a5 100644
--- a/oox/source/ppt/commonbehaviorcontext.cxx
+++ b/oox/source/ppt/commonbehaviorcontext.cxx
@@ -19,7 +19,7 @@
#include "comphelper/anytostring.hxx"
#include "cppuhelper/exc_hlp.hxx"
-#include <osl/diagnose.h>
+#include "sal/log.hxx"
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/animations/XTimeContainer.hpp>
@@ -98,9 +98,7 @@
RTL_TEXTENCODING_ASCII_US );
attr.type = attrConv->meAttribute;
maAttributes.push_back( attr );
- OSL_TRACE( "OOX: attrName is %s -> %s",
- OUSTRING_TO_CSTR( msCurrentAttribute ),
- attrConv->mpAPIName );
+ SAL_INFO("oox.ppt", "OOX: attrName is " << OUSTRING_TO_CSTR( msCurrentAttribute ) << " -> " << attrConv->mpAPIName );
break;
}
attrConv++;
@@ -143,7 +141,7 @@
}
else
{
- OSL_TRACE( "OOX: Attribute Name outside an Attribute List" );
+ SAL_INFO("oox.ppt", "OOX: Attribute Name outside an Attribute List" );
}
return this;
}
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 6da39d3..326ab76 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/text/XText.hpp>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include "oox/ppt/slidepersist.hxx"
+#include "sal/log.hxx"
using namespace ::oox::core;
using namespace ::oox::drawingml;
@@ -84,7 +85,7 @@
{
oox::drawingml::TextListStylePtr pTextListStyle;
- OSL_TRACE( "subtype style: %s", lclDebugSubType( nSubType ) );
+ SAL_INFO("oox.ppt", "subtype style: " << lclDebugSubType( nSubType ) );
switch( nSubType )
{
@@ -116,7 +117,7 @@
const awt::Rectangle* pShapeRect,
::oox::drawingml::ShapeIdMap* pShapeMap )
{
- OSL_TRACE("add shape id: %s location: %s subtype: %d service: %s", OUStringToOString(msId, RTL_TEXTENCODING_UTF8 ).getStr(), meShapeLocation == Master ? "master" : meShapeLocation == Slide ? "slide" : meShapeLocation == Layout ? "layout" : "other", mnSubType, OUStringToOString(msServiceName, RTL_TEXTENCODING_UTF8 ).getStr());
+ SAL_INFO("oox.ppt","add shape id: " << msId << " location: " << ((meShapeLocation == Master) ? "master" : ((meShapeLocation == Slide) ? "slide" : ((meShapeLocation == Layout) ? "layout" : "other"))) << " subtype: " << mnSubType << " service: " << msServiceName);
// only placeholder from layout are being inserted
if ( mnSubType && ( meShapeLocation == Master ) )
return;
@@ -133,7 +134,7 @@
sServiceName != "com.sun.star.drawing.OLE2Shape" )
{
const OUString sOutlinerShapeService( "com.sun.star.presentation.OutlinerShape" );
- OSL_TRACE("has master: %p", rSlidePersist.getMasterPersist().get());
+ SAL_INFO("oox.ppt","has master: " << rSlidePersist.getMasterPersist().get());
switch( mnSubType )
{
case XML_ctrTitle :
@@ -223,7 +224,7 @@
}
}
- OSL_TRACE("shape service: %s", OUStringToOString(sServiceName, RTL_TEXTENCODING_UTF8 ).getStr());
+ SAL_INFO("oox.ppt","shape service: " << sServiceName);
if( mnSubType && getSubTypeIndex().has() && meShapeLocation == Layout ) {
oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholderByIndex( getSubTypeIndex().get(), rSlidePersist.getShapes()->getChildren(), true );
@@ -258,7 +259,7 @@
pPlaceholder.reset();
if( pPlaceholder.get()) {
- OSL_TRACE("found placeholder with index: %d and type: %s", getSubTypeIndex().get(), lclDebugSubType( mnSubType ));
+ SAL_INFO("oox.ppt","found placeholder with index: " << getSubTypeIndex().get() << " and type: " << lclDebugSubType( mnSubType ));
}
if( pPlaceholder.get() ) {
PPTShape* pPPTPlaceholder = dynamic_cast< PPTShape* >( pPlaceholder.get() );
@@ -270,21 +271,18 @@
if( pPlaceholder->getMasterTextListStyle().get() )
pNewTextListStyle->apply( *pPlaceholder->getMasterTextListStyle() );
- // OSL_TRACE("placeholder body style");
+ // SAL_INFO("oox.ppt","placeholder body style");
// pPlaceholder->getTextBody()->getTextListStyle().dump();
- // OSL_TRACE("master text list style");
+ // SAL_INFO("oox.ppt","master text list style");
// pPlaceholder->getMasterTextListStyle()->dump();
aMasterTextListStyle = pNewTextListStyle;
- // OSL_TRACE("combined master text list style");
+ // SAL_INFO("oox.ppt","combined master text list style");
// aMasterTextListStyle->dump();
}
if( pPPTPlaceholder->mpPlaceholder.get() ) {
- OSL_TRACE("placeholder has parent placeholder: %s type: %s index: %d",
- OUStringToOString( pPPTPlaceholder->mpPlaceholder->getId(), RTL_TEXTENCODING_UTF8 ).getStr(),
- lclDebugSubType( pPPTPlaceholder->mpPlaceholder->getSubType() ),
- pPPTPlaceholder->mpPlaceholder->getSubTypeIndex().get() );
- OSL_TRACE("has textbody %d", pPPTPlaceholder->mpPlaceholder->getTextBody() != NULL );
+ SAL_INFO("oox.ppt","placeholder has parent placeholder: " << pPPTPlaceholder->mpPlaceholder->getId() << " type: " << lclDebugSubType( pPPTPlaceholder->mpPlaceholder->getSubType() ) << " index: " << pPPTPlaceholder->mpPlaceholder->getSubTypeIndex().get() );
+ SAL_INFO("oox.ppt","has textbody " << (pPPTPlaceholder->mpPlaceholder->getTextBody() != NULL) );
TextListStylePtr pPlaceholderStyle = getSubTypeTextListStyle( rSlidePersist, pPPTPlaceholder->mpPlaceholder->getSubType() );
if( pPPTPlaceholder->mpPlaceholder->getTextBody() )
pNewTextListStyle->apply( pPPTPlaceholder->mpPlaceholder->getTextBody()->getTextListStyle() );
@@ -296,7 +294,7 @@
} else if( !mpPlaceholder.get() ) {
aMasterTextListStyle.reset();
}
- OSL_TRACE("placeholder id: %s", pPlaceholder.get() ? OUStringToOString(pPlaceholder->getId(), RTL_TEXTENCODING_UTF8 ).getStr() : "not found");
+ SAL_INFO("oox.ppt","placeholder id: " << (pPlaceholder.get() ? pPlaceholder->getId() : "not found"));
}
if ( !sServiceName.isEmpty() )
diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx
index f74857b..c86b01e 100644
--- a/sw/source/filter/ww8/ww8toolbar.cxx
+++ b/sw/source/filter/ww8/ww8toolbar.cxx
@@ -44,6 +44,8 @@
#include <comphelper/processfactory.hxx>
#include <vcl/graph.hxx>
#include <map>
+#include "sal/log.hxx"
+
using namespace com::sun::star;
// no. of visual data elements in a SwCTB ( fixed )
@@ -131,7 +133,7 @@
bool SwCTBWrapper::Read( SvStream& rS )
{
- OSL_TRACE("SwCTBWrapper::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","SwCTBWrapper::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
Tcg255SubStruct::Read( rS );
rS >> reserved2 >> reserved3 >> reserved4 >> reserved5;
@@ -162,8 +164,8 @@
// Strange error condition, shouldn't happen ( but does in at least
// one test document ) In the case where it happens the SwTBC &
// TBCHeader records seem blank??? ( and incorrect )
- OSL_ENSURE( static_cast< long >(rS.Tell()) == nExpectedPos, "### Error: Expected pos not equal to actual pos after reading rtbdc");
- OSL_TRACE("\tPos now is 0x%x should be 0x%x", rS.Tell(), nExpectedPos );
+ SAL_WARN_IF( static_cast< long >(rS.Tell()) != nExpectedPos, "sw.ww8","### Error: Expected pos not equal to actual pos after reading rtbdc");
+ SAL_INFO("sw.ww8","\tPos now is 0x" << rS.Tell() << " should be 0x" << nExpectedPos );
// seek to correct position after rtbdc
rS.Seek( nExpectedPos );
}
@@ -271,7 +273,7 @@
bool Customization::Read( SvStream &rS)
{
- OSL_TRACE("Custimization::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","Custimization::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
rS >> tbidForTBD >> reserved1 >> ctbds;
if ( tbidForTBD )
@@ -386,7 +388,7 @@
aPopupMenu[3].Value <<= xMenuContainer;
if ( pCust->customizationDataCTB.get() && !pCust->customizationDataCTB->ImportMenuTB( rWrapper, xMenuContainer, helper ) )
return false;
- OSL_TRACE("** there are %d menu items on the bar, inserting after that", xIndexContainer->getCount() );
+ SAL_INFO("sw.ww8","** there are " << xIndexContainer->getCount() << " menu items on the bar, inserting after that");
xIndexContainer->insertByIndex( xIndexContainer->getCount(), uno::makeAny( aPopupMenu ) );
if ( bHasSettings )
@@ -461,7 +463,7 @@
bool TBDelta::Read(SvStream &rS)
{
- OSL_TRACE("TBDelta::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","TBDelta::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
rS >> doprfatendFlags >> ibts >> cidNext >> cid >> fc ;
rS >> CiTBDE >> cbTBC;
@@ -508,7 +510,7 @@
bool SwCTB::Read( SvStream &rS)
{
- OSL_TRACE("SwCTB::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","SwCTB::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
if ( !name.Read( rS ) )
return false;
@@ -588,7 +590,7 @@
return false;
}
- OSL_TRACE("Name of toolbar :-/ %s", rtl::OUStringToOString( sToolBarName, RTL_TEXTENCODING_UTF8 ).getStr() );
+ SAL_INFO("sw.ww8","Name of toolbar :-/ " << sToolBarName );
helper.getCfgManager()->insertSettings( sToolBarName, xIndexAccess );
helper.applyIcons();
@@ -603,7 +605,7 @@
}
catch( const uno::Exception& e )
{
- OSL_TRACE("***** For some reason we have an exception %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+ SAL_INFO("sw.ww8","***** For some reason we have an exception " << e.Message );
bRes = false;
}
return bRes;
@@ -630,7 +632,7 @@
bool SwTBC::Read( SvStream &rS )
{
- OSL_TRACE("SwTBC::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","SwTBC::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
if ( !tbch.Read( rS ) )
return false;
@@ -683,21 +685,21 @@
switch ( cmt )
{
case 1:
- OSL_TRACE("cmt is cmtFci builtin command 0x%x", arg2);
+ SAL_INFO("sw.ww8","cmt is cmtFci builtin command 0x" << arg2);
bBuiltin = true;
cmdId = arg2;
break;
case 2:
- OSL_TRACE("cmt is cmtMacro macro 0x%x", arg2);
+ SAL_INFO("sw.ww8","cmt is cmtMacro macro 0x" << arg2);
break;
case 3:
- OSL_TRACE("cmt is cmtAllocated [???] 0x%x", arg2);
+ SAL_INFO("sw.ww8","cmt is cmtAllocated [???] 0x" << arg2);
break;
case 7:
- OSL_TRACE("cmt is cmNill no-phing 0x%x", arg2);
+ SAL_INFO("sw.ww8","cmt is cmNill no-phing 0x" << arg2);
break;
default:
- OSL_TRACE("illegal 0x%x", cmt);
+ SAL_INFO("sw.ww8","illegal 0x" << cmt);
break;
}
}
@@ -724,7 +726,7 @@
TBCMenuSpecific* pMenu = tbcd->getMenuSpecific();
if ( pMenu )
{
- OSL_TRACE("** control has a menu, name of toolbar with menu items is %s", rtl::OUStringToOString( pMenu->Name(), RTL_TEXTENCODING_UTF8 ).getStr() );
+ SAL_INFO("sw.ww8","** control has a menu, name of toolbar with menu items is " << pMenu->Name() );
// search for SwCTB with the appropriate name ( it contains the
// menu items, although we cannot import ( or create ) a menu on
// a custom toolbar we can import the menu items in a separate
@@ -784,7 +786,7 @@
bool
Xst::Read( SvStream& rS )
{
- OSL_TRACE("Xst::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","Xst::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
sString = read_uInt16_PascalString(rS);
return true;
@@ -804,7 +806,7 @@
bool Tcg::Read(SvStream &rS)
{
- OSL_TRACE("Tcg::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","Tcg::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
rS >> nTcgVer;
if ( nTcgVer != -1 )
@@ -877,7 +879,7 @@
break;
}
default:
- OSL_TRACE("Unknown id 0x%x",nId);
+ SAL_INFO("sw.ww8","Unknown id 0x" << nId);
return false;
}
pSubStruct->ch = nId;
@@ -909,7 +911,7 @@
bool Tcg255::Read(SvStream &rS)
{
- OSL_TRACE("Tcg255::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","Tcg255::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
sal_uInt8 nId = 0x40;
rS >> nId;
@@ -947,7 +949,7 @@
bool Tcg255SubStruct::Read(SvStream &rS)
{
- OSL_TRACE("Tcg255SubStruct::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","Tcg255SubStruct::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
if ( mbReadId )
rS >> ch;
@@ -962,7 +964,7 @@
bool PlfMcd::Read(SvStream &rS)
{
- OSL_TRACE("PffMcd::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","PffMcd::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
Tcg255SubStruct::Read( rS );
rS >> iMac;
@@ -1007,7 +1009,7 @@
bool PlfAcd::Read( SvStream &rS)
{
- OSL_TRACE("PffAcd::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","PffAcd::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
Tcg255SubStruct::Read( rS );
rS >> iMac;
@@ -1050,7 +1052,7 @@
bool PlfKme::Read(SvStream &rS)
{
- OSL_TRACE("PlfKme::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","PlfKme::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
Tcg255SubStruct::Read( rS );
rS >> iMac;
@@ -1086,7 +1088,7 @@
bool TcgSttbf::Read( SvStream &rS)
{
- OSL_TRACE("TcgSttbf::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","TcgSttbf::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
Tcg255SubStruct::Read( rS );
return sttbf.Read( rS );
@@ -1114,7 +1116,7 @@
bool TcgSttbfCore::Read( SvStream& rS )
{
- OSL_TRACE("TcgSttbfCore::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","TcgSttbfCore::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
rS >> fExtend >> cData >> cbExtra;
if ( cData )
@@ -1159,7 +1161,7 @@
bool MacroNames::Read( SvStream &rS)
{
- OSL_TRACE("MacroNames::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","MacroNames::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
Tcg255SubStruct::Read( rS );
rS >> iMac;
@@ -1196,7 +1198,7 @@
bool MacroName::Read(SvStream &rS)
{
- OSL_TRACE("MacroName::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","MacroName::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
rS >> ibst;
return xstz.Read( rS );
@@ -1219,7 +1221,7 @@
bool
Xstz::Read(SvStream &rS)
{
- OSL_TRACE("Xstz::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","Xstz::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
if ( !xst.Read( rS ) )
return false;
@@ -1254,7 +1256,7 @@
bool
Kme::Read(SvStream &rS)
{
- OSL_TRACE("Kme::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","Kme::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
rS >> reserved1 >> reserved2 >> kcm1 >> kcm2 >> kt >> param;
return true;
@@ -1280,7 +1282,7 @@
bool Acd::Read(SvStream &rS)
{
- OSL_TRACE("Acd::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","Acd::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
rS >> ibst >> fciBasedOnABC;
return true;
@@ -1340,7 +1342,7 @@
bool MCD::Read(SvStream &rS)
{
- OSL_TRACE("MCD::Read() stream pos 0x%x", rS.Tell() );
+ SAL_INFO("sw.ww8","MCD::Read() stream pos 0x" << rS.Tell() );
nOffSet = rS.Tell();
rS >> reserved1 >> reserved2 >> ibst >> ibstName >> reserved3;
rS >> reserved4 >> reserved5 >> reserved6 >> reserved7;
--
To view, visit https://gerrit.libreoffice.org/2651
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie30fbc9c720d8b93d6093e2c95f61dceea8aae2f
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Ioan Radu <ioan.radu.g at gmail.com>
More information about the LibreOffice
mailing list