diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-03-08 09:43:26 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-03-08 12:02:38 +0000 |
commit | 6a7a5740ad82f2ada6dded286aacc32f2af1b246 (patch) | |
tree | f5d1349a56d750c1af1d5ae4a9cdcd814117bd31 /sw | |
parent | tidy up SwBreakIt (diff) | |
download | core-6a7a5740ad82f2ada6dded286aacc32f2af1b246.tar.gz core-6a7a5740ad82f2ada6dded286aacc32f2af1b246.zip |
64bit Truncated pointer used as an unique 32bit id
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/wrtww8.hxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8gr.cxx | 13 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 2 |
3 files changed, 17 insertions, 7 deletions
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 11422528dd03..a7dd47a9eedf 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -117,7 +117,10 @@ class WW8_WrtBookmarks; class WW8_WrtRedlineAuthor; class SvxMSExportOLEObjects; class SwMSConvertControls; -typedef std::set<sal_uInt32> WW8OleSet; +namespace com { namespace sun { namespace star { namespace embed { +class XEmbeddedObject; +} } } } +typedef std::map<const com::sun::star::embed::XEmbeddedObject*, sal_Int32> WW8OleMap; class SvStorageRef; struct WW8_PdAttrDesc; class SvxBrushItem; @@ -461,7 +464,7 @@ public: boost::shared_ptr<NfKeywordTable> pKeyMap; SvxMSExportOLEObjects* pOLEExp; SwMSConvertControls* pOCXExp; - WW8OleSet m_aOleSet; // To remember all already exported ole objects + WW8OleMap m_aOleMap; // To remember all already exported ole objects ww8::WW8TableInfo::Pointer_t mpTableInfo; sal_uInt16 nCharFmtStart; @@ -968,7 +971,7 @@ public: SvxMSExportOLEObjects& GetOLEExp() { return *pOLEExp; } SwMSConvertControls& GetOCXExp() { return *pOCXExp; } - WW8OleSet& GetOLESet() { return m_aOleSet; } + WW8OleMap& GetOLEMap() { return m_aOleMap; } void ExportDopTypography(WW8DopTypography &rTypo); sal_uInt16 AddRedlineAuthor( sal_uInt16 nId ); diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index f8614f9b2675..c0008d7ec734 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -242,9 +242,16 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode ) if( xObj.is() ) { const embed::XEmbeddedObject *pObj = xObj.get(); - sal_uInt32 nPictureId = (sal_uInt32)(sal_uIntPtr)pObj; - //.second is false when element already existed - bool bIsNotDuplicate = GetOLESet().insert(nPictureId).second; + WW8OleMap& rPointerToObjId = GetOLEMap(); + //Don't want to use pointer ids, as is traditional, because we need + //to put this into a 32bit value, and on 64bit the bottom bits + //might collide and two unrelated ole objects end up considered the + //same. Don't want to simply start at 0 which is a special value + sal_Int32 nPictureId = SAL_MAX_INT32 - rPointerToObjId.size(); + WW8OleMap::value_type entry = std::make_pair(pObj, nPictureId); + std::pair<WW8OleMap::iterator, bool> aRes = rPointerToObjId.insert(entry); + bool bIsNotDuplicate = aRes.second; //.second is false when element already existed + nPictureId = aRes.first->second; Set_UInt32(pDataAdr, nPictureId); String sStorageName( '_' ); sStorageName += String::CreateFromInt32( nPictureId ); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 4e57ac632608..9b79d2356e20 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -5591,7 +5591,7 @@ sal_Bool SwMSDffManager::GetOLEStorageName(long nOLEId, String& rStorageName, { bool bRet = false; - long nPictureId = 0; + sal_Int32 nPictureId = 0; if (rReader.pStg) { // dann holen wir uns mal ueber den TextBox-PLCF die richtigen |