SAL_WARN on dup positions

Change-Id: I6ac3940fb0b07d280998a56d5eaede0909f14bce
This commit is contained in:
Eike Rathke
2012-10-26 16:25:04 +02:00
parent c9a27eb938
commit dbd85e2b73

View File

@@ -509,13 +509,16 @@ bool SvNumberFormatter::PutEntry(String& rString,
SvNumberformat* pStdFormat = SvNumberformat* pStdFormat =
GetFormatEntry(CLOffset + ZF_STANDARD); GetFormatEntry(CLOffset + ZF_STANDARD);
sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey(); sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey();
if (nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET) if (nPos+1 - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET)
{ {
SAL_WARN( "svl.numbers", "SvNumberFormatter:: Zu viele Formate pro CL"); SAL_WARN( "svl.numbers", "SvNumberFormatter::PutEntry: too many formats for CL");
delete p_Entry; delete p_Entry;
} }
else if (!aFTable.insert(make_pair( nPos+1,p_Entry)).second) else if (!aFTable.insert(make_pair( nPos+1,p_Entry)).second)
{
SAL_WARN( "svl.numbers", "SvNumberFormatter::PutEntry: dup position");
delete p_Entry; delete p_Entry;
}
else else
{ {
bCheck = true; bCheck = true;
@@ -714,7 +717,10 @@ bool SvNumberFormatter::Load( SvStream& rStream )
pEnt->SetLastInsertKey(pEntry->GetLastInsertKey()); pEnt->SetLastInsertKey(pEntry->GetLastInsertKey());
} }
if (!aFTable.insert(make_pair( nPos, pEntry)).second) if (!aFTable.insert(make_pair( nPos, pEntry)).second)
{
SAL_WARN( "svl.numbers", "SvNumberFormatter::Load: dup position");
delete pEntry; delete pEntry;
}
rStream >> nPos; rStream >> nPos;
} }
@@ -1843,6 +1849,10 @@ SvNumberformat* SvNumberFormatter::ImpInsertFormat(
aMsg += rCode.Code; aMsg += rCode.Code;
LocaleDataWrapper::outputCheckMessage( xLocaleData->appendLocaleInfo( aMsg)); LocaleDataWrapper::outputCheckMessage( xLocaleData->appendLocaleInfo( aMsg));
} }
else
{
SAL_WARN( "svl.numbers", "SvNumberFormatter::ImpInsertFormat: dup position");
}
delete pFormat; delete pFormat;
return NULL; return NULL;
} }
@@ -2203,7 +2213,10 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
if ( !aFTable.insert(make_pair( if ( !aFTable.insert(make_pair(
CLOffset + SetIndexTable( NF_BOOLEAN, ZF_STANDARD_LOGICAL ), CLOffset + SetIndexTable( NF_BOOLEAN, ZF_STANDARD_LOGICAL ),
pNewFormat)).second) pNewFormat)).second)
{
SAL_WARN( "svl.numbers", "SvNumberFormatter::ImpGenerateFormats: dup position Boolean");
delete pNewFormat; delete pNewFormat;
}
// Text // Text
aFormatCode = '@'; aFormatCode = '@';
@@ -2214,7 +2227,10 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
if ( !aFTable.insert(make_pair( if ( !aFTable.insert(make_pair(
CLOffset + SetIndexTable( NF_TEXT, ZF_STANDARD_TEXT ), CLOffset + SetIndexTable( NF_TEXT, ZF_STANDARD_TEXT ),
pNewFormat)).second) pNewFormat)).second)
{
SAL_WARN( "svl.numbers", "SvNumberFormatter::ImpGenerateFormats: dup position Text");
delete pNewFormat; delete pNewFormat;
}
@@ -2904,7 +2920,10 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
// pNewEntry = new SvNumberformat(*pFormat); // Copy is not sufficient! // pNewEntry = new SvNumberformat(*pFormat); // Copy is not sufficient!
pNewEntry = new SvNumberformat( *pFormat, *pFormatScanner ); pNewEntry = new SvNumberformat( *pFormat, *pFormatScanner );
if (!aFTable.insert(make_pair( nNewKey, pNewEntry)).second) if (!aFTable.insert(make_pair( nNewKey, pNewEntry)).second)
{
SAL_WARN( "svl.numbers", "SvNumberFormatter::MergeFormatter: dup position");
delete pNewEntry; delete pNewEntry;
}
} }
if (nNewKey != nOldKey) // new index if (nNewKey != nOldKey) // new index
{ {
@@ -2926,14 +2945,16 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
GetFormatEntry(nCLOffset + ZF_STANDARD); GetFormatEntry(nCLOffset + ZF_STANDARD);
sal_uInt32 nPos = nCLOffset + pStdFormat->GetLastInsertKey(); sal_uInt32 nPos = nCLOffset + pStdFormat->GetLastInsertKey();
nNewKey = nPos+1; nNewKey = nPos+1;
if (nPos - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET) if (nNewKey - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET)
{ {
SAL_WARN( "svl.numbers", SAL_WARN( "svl.numbers", "SvNumberFormatter::MergeFormatter: too many formats for CL");
"SvNumberFormatter:: Zu viele Formate pro CL");
delete pNewEntry; delete pNewEntry;
} }
else if (!aFTable.insert(make_pair( nNewKey, pNewEntry)).second) else if (!aFTable.insert(make_pair( nNewKey, pNewEntry)).second)
{
SAL_WARN( "svl.numbers", "SvNumberFormatter::MergeFormatter: dup position");
delete pNewEntry; delete pNewEntry;
}
else else
pStdFormat->SetLastInsertKey((sal_uInt16) (nNewKey - nCLOffset)); pStdFormat->SetLastInsertKey((sal_uInt16) (nNewKey - nCLOffset));
} }