[Libreoffice-commits] core.git: sc/source
Eike Rathke
erack at redhat.com
Thu Dec 21 22:44:53 UTC 2017
sc/source/ui/dbgui/scuiasciiopt.cxx | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
New commits:
commit 8f3f6755d7f7355493e873954513fdaeb4dceca9
Author: Eike Rathke <erack at redhat.com>
Date: Thu Dec 21 23:41:16 2017 +0100
Have one getSkipEmptyCellsIndex(), assert array length, tdf#113979 follow-up
Change-Id: Iac38405ac7d246dfe13766b1eefc6310756bffe6
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 69cfdc65324a..4340244a0706 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -84,6 +84,13 @@ const OUString aSep_Path = "Office.Calc/Dialogs/CSVImport";
const OUString aSep_Path_Clpbrd = "Office.Calc/Dialogs/ClipboardTextImport";
const OUString aSep_Path_Text2Col = "Office.Calc/Dialogs/TextToColumnsImport";
+namespace {
+CSVImportOptionsIndex getSkipEmptyCellsIndex( ScImportAsciiCall eCall )
+{
+ return eCall == SC_TEXTTOCOLUMNS ? CSVIO_Text2ColSkipEmptyCells : CSVIO_PasteSkipEmptyCells;
+}
+}
+
static void lcl_FillCombo( ComboBox& rCombo, const OUString& rList, sal_Unicode cSelect )
{
sal_Int32 i;
@@ -165,9 +172,9 @@ void lcl_CreatePropertiesNames ( OUString& rSepPath, Sequence<OUString>& rNames,
}
if (eCall != SC_IMPORTFILE)
{
- pNames[ eCall == SC_TEXTTOCOLUMNS ?
- CSVIO_Text2ColSkipEmptyCells :
- CSVIO_PasteSkipEmptyCells ] = CSVImportOptionNames[ CSVIO_PasteSkipEmptyCells ];
+ const sal_Int32 nSkipEmptyCells = getSkipEmptyCellsIndex(eCall);
+ assert( nSkipEmptyCells < rNames.getLength());
+ pNames[ nSkipEmptyCells ] = CSVImportOptionNames[ CSVIO_PasteSkipEmptyCells ];
}
}
@@ -216,10 +223,9 @@ static void lcl_LoadSeparators( OUString& rFieldSeparators, OUString& rTextSepar
}
if (eCall != SC_IMPORTFILE)
{
- sal_Int32 nSkipEmptyCells = eCall == SC_TEXTTOCOLUMNS ?
- CSVIO_Text2ColSkipEmptyCells :
- CSVIO_PasteSkipEmptyCells;
- if( pProperties[nSkipEmptyCells].hasValue() )
+ const sal_Int32 nSkipEmptyCells = getSkipEmptyCellsIndex(eCall);
+ assert( nSkipEmptyCells < aValues.getLength());
+ if ( pProperties[nSkipEmptyCells].hasValue() )
rSkipEmptyCells = ScUnoHelpFunctions::GetBoolFromAny( pProperties[nSkipEmptyCells] );
}
}
@@ -254,9 +260,9 @@ static void lcl_SaveSeparators(
}
if (eCall != SC_IMPORTFILE)
{
- pProperties[ eCall == SC_TEXTTOCOLUMNS ?
- CSVIO_Text2ColSkipEmptyCells :
- CSVIO_PasteSkipEmptyCells ] <<= bSkipEmptyCells;
+ const sal_Int32 nSkipEmptyCells = getSkipEmptyCellsIndex(eCall);
+ assert( nSkipEmptyCells < aValues.getLength());
+ pProperties[ nSkipEmptyCells ] <<= bSkipEmptyCells;
}
aItem.PutProperties(aNames, aValues);
More information about the Libreoffice-commits
mailing list