add an assert to check for ref-counts > 16 bits

after
    commit 87c518593d
    sc: remove antique reference counting hacks from ScDocumentPool

In theory, nothing should be trying to save items like this
anymore, but lets make the error more obvious in case something is.

Change-Id: I89b3637168c072d20e214a8f6338f6336d44d891
Reviewed-on: https://gerrit.libreoffice.org/30467
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
This commit is contained in:
Noel Grandin
2016-11-01 15:28:13 +02:00
committed by Michael Stahl
parent 943e82d8a4
commit 241dca2d8a

View File

@@ -258,9 +258,13 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const
rStream.WriteUInt16( convertSfxItemKindToUInt16(pItem->GetKind()) );
else
{
rStream.WriteUInt16( pItem->GetRefCount() );
if( pItem->GetRefCount() > SFX_ITEMS_OLD_MAXREF )
{
assert(!"refcount does not fit into 16-bits");
rStream.SetError( ERRCODE_IO_NOTSTORABLEINBINARYFORMAT );
}
else
rStream.WriteUInt16( pItem->GetRefCount() );
}
if ( !rStream.GetError() )