[Libreoffice-commits] core.git: 3 commits - basic/source include/tools vcl/source
Caolán McNamara
caolanm at redhat.com
Thu Feb 9 09:23:00 UTC 2017
basic/source/basmgr/basicmanagerrepository.cxx | 30 +++++++--------
include/tools/rcid.h | 1
vcl/source/gdi/svmconverter.cxx | 48 +++++++++++++++----------
3 files changed, 43 insertions(+), 36 deletions(-)
New commits:
commit cff6cdb2ee37e836b9bab39500d24fcedc360121
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Feb 9 09:21:39 2017 +0000
Resolves: ofz#576 unexpected exception with invalid fraction
Change-Id: I1d653775e88e9fa2ba7b62fce39d52fc21ffe363
diff --git a/vcl/source/gdi/svmconverter.cxx b/vcl/source/gdi/svmconverter.cxx
index 9d963f4..06c5325 100644
--- a/vcl/source/gdi/svmconverter.cxx
+++ b/vcl/source/gdi/svmconverter.cxx
@@ -129,19 +129,26 @@ void ImplWriteColor( SvStream& rOStm, const Color& rColor )
rOStm.WriteInt16( nVal );
}
-void ImplReadMapMode( SvStream& rIStm, MapMode& rMapMode )
+bool ImplReadMapMode(SvStream& rIStm, MapMode& rMapMode)
{
- Point aOrg;
- sal_Int32 nXNum;
- sal_Int32 nXDenom;
- sal_Int32 nYNum;
- sal_Int32 nYDenom;
- sal_Int16 nUnit;
-
- rIStm.ReadInt16( nUnit );
- ReadPair( rIStm, aOrg );
- rIStm.ReadInt32( nXNum ).ReadInt32( nXDenom ).ReadInt32( nYNum ).ReadInt32( nYDenom );
+ sal_Int16 nUnit(0);
+ rIStm.ReadInt16(nUnit);
+
+ Point aOrg;
+ ReadPair(rIStm, aOrg);
+
+ sal_Int32 nXNum(0), nXDenom(0), nYNum(0), nYDenom(0);
+ rIStm.ReadInt32(nXNum).ReadInt32(nXDenom).ReadInt32(nYNum).ReadInt32(nYDenom);
+
+ if (!rIStm.good() || nXDenom == 0 || nYDenom == 0)
+ {
+ SAL_WARN("vcl.gdi", "Parsing error: invalid mapmode fraction");
+ return false;
+ }
+
rMapMode = MapMode( (MapUnit) nUnit, aOrg, Fraction( nXNum, nXDenom ), Fraction( nYNum, nYDenom ) );
+
+ return true;
}
void ImplWriteMapMode( SvStream& rOStm, const MapMode& rMapMode )
@@ -503,7 +510,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rtl_TextEncoding eActualCharSet = osl_getThreadTextEncoding();
bool bFatLine = false;
- MapMode aMapMode;
tools::Polygon aActionPoly;
Rectangle aRect;
Point aPt, aPt1;
@@ -513,7 +519,11 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
sal_uInt32 nUnicodeCommentStreamPos = 0;
sal_Int32 nUnicodeCommentActionNumber = 0;
- ImplReadMapMode( rIStm, aMapMode ); // MapMode
+ rMtf.SetPrefSize(aPrefSz);
+
+ MapMode aMapMode;
+ if (ImplReadMapMode(rIStm, aMapMode)) // MapMode
+ rMtf.SetPrefMapMode(aMapMode);
sal_Int32 nActions(0);
rIStm.ReadInt32(nActions); // Action count
@@ -531,8 +541,6 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
nActions = nMaxPossibleActions;
}
- rMtf.SetPrefSize( aPrefSz );
- rMtf.SetPrefMapMode( aMapMode );
size_t nLastPolygonAction(0);
for (sal_Int32 i = 0; i < nActions && rIStm.good(); ++i)
@@ -1042,11 +1050,13 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
case GDI_MAPMODE_ACTION:
{
- ImplReadMapMode( rIStm, aMapMode );
- rMtf.AddAction( new MetaMapModeAction( aMapMode ) );
+ if (ImplReadMapMode(rIStm, aMapMode))
+ {
+ rMtf.AddAction(new MetaMapModeAction(aMapMode));
- // #106172# Track font relevant data in shadow VDev
- aFontVDev->SetMapMode( aMapMode );
+ // #106172# Track font relevant data in shadow VDev
+ aFontVDev->SetMapMode(aMapMode);
+ };
}
break;
commit e2b1e755e2f7587cf45084d092a10ba444710126
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Feb 8 17:26:15 2017 +0000
drop unused RSC_BYNAME define
Change-Id: If26e39fedc1687ceb08d3e8663f95f4d84b5c488
diff --git a/include/tools/rcid.h b/include/tools/rcid.h
index a86667f..8a58f66 100644
--- a/include/tools/rcid.h
+++ b/include/tools/rcid.h
@@ -30,7 +30,6 @@
// Resource types
// Minimum is 0x100 due to MS-Windows resource types
// (RSC_NOTYPE=0x100) is defined in resid.hxx
-#define RSC_BYNAME (RSC_NOTYPE + 0x01)
#define RSC_VERSIONCONTROL (RSC_NOTYPE + 0x02) // Version control
#define RSC_RESOURCE (RSC_NOTYPE + 0x10)
commit 49c007b394126de2f1292e7ede17499c568f9bfa
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Feb 8 17:16:40 2017 +0000
split getApplicationBasicManager into get and getOrCreate
Change-Id: I8e35594104ba85470eda387bc227e88bf77ccffd
diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx
index 500f314..9635fb2 100644
--- a/basic/source/basmgr/basicmanagerrepository.cxx
+++ b/basic/source/basmgr/basicmanagerrepository.cxx
@@ -49,8 +49,6 @@
namespace basic
{
-
-
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::frame::XModel;
@@ -83,7 +81,8 @@ namespace basic
static ImplRepository& Instance();
BasicManager* getDocumentBasicManager( const Reference< XModel >& _rxDocumentModel );
- BasicManager* getApplicationBasicManager( bool _bCreate );
+ BasicManager* getOrCreateApplicationBasicManager();
+ BasicManager* getApplicationBasicManager() const;
void setApplicationBasicManager( BasicManager* _pBasicManager );
void registerCreationListener( BasicManagerCreationListener& _rListener );
void revokeCreationListener( BasicManagerCreationListener& _rListener );
@@ -238,23 +237,28 @@ namespace basic
return nullptr;
}
- BasicManager* ImplRepository::getApplicationBasicManager( bool _bCreate )
+ BasicManager* ImplRepository::getOrCreateApplicationBasicManager()
{
SolarMutexGuard g;
BasicManager* pAppManager = GetSbData()->pAppBasMgr;
- if ( ( pAppManager == nullptr ) && _bCreate )
+ if (pAppManager == nullptr)
pAppManager = impl_createApplicationBasicManager();
-
return pAppManager;
}
+ BasicManager* ImplRepository::getApplicationBasicManager() const
+ {
+ SolarMutexGuard g;
+
+ return GetSbData()->pAppBasMgr;
+ }
void ImplRepository::setApplicationBasicManager( BasicManager* _pBasicManager )
{
SolarMutexGuard g;
- BasicManager* pPreviousManager = getApplicationBasicManager( false );
+ BasicManager* pPreviousManager = getApplicationBasicManager();
delete pPreviousManager;
GetSbData()->pAppBasMgr = _pBasicManager;
@@ -265,7 +269,7 @@ namespace basic
{
SolarMutexGuard g;
- OSL_PRECOND( getApplicationBasicManager( false ) == nullptr, "ImplRepository::impl_createApplicationBasicManager: there already is one!" );
+ OSL_PRECOND(getApplicationBasicManager() == nullptr, "ImplRepository::impl_createApplicationBasicManager: there already is one!");
// Determine Directory
SvtPathOptions aPathCFG;
@@ -356,7 +360,7 @@ namespace basic
StarBASIC* ImplRepository::impl_getDefaultAppBasicLibrary()
{
- BasicManager* pAppManager = getApplicationBasicManager( true );
+ BasicManager* pAppManager = getOrCreateApplicationBasicManager();
StarBASIC* pAppBasic = pAppManager ? pAppManager->GetLib(0) : nullptr;
DBG_ASSERT( pAppBasic != nullptr, "impl_getApplicationBasic: unable to determine the default application's Basic library!" );
@@ -601,37 +605,31 @@ namespace basic
}
}
-
BasicManager* BasicManagerRepository::getDocumentBasicManager( const Reference< XModel >& _rxDocumentModel )
{
return ImplRepository::Instance().getDocumentBasicManager( _rxDocumentModel );
}
-
BasicManager* BasicManagerRepository::getApplicationBasicManager()
{
- return ImplRepository::Instance().getApplicationBasicManager( true/*_bCreate*/ );
+ return ImplRepository::Instance().getOrCreateApplicationBasicManager();
}
-
void BasicManagerRepository::resetApplicationBasicManager()
{
ImplRepository::Instance().setApplicationBasicManager( nullptr );
}
-
void BasicManagerRepository::registerCreationListener( BasicManagerCreationListener& _rListener )
{
ImplRepository::Instance().registerCreationListener( _rListener );
}
-
void BasicManagerRepository::revokeCreationListener( BasicManagerCreationListener& _rListener )
{
ImplRepository::Instance().revokeCreationListener( _rListener );
}
-
} // namespace basic
More information about the Libreoffice-commits
mailing list