summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammed Abdul Azeem <azeemmysore@gmail.com>2017-08-06 16:40:55 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-08-08 07:18:08 +0200
commit855af7f3260705faf7c33be36efc1610354336f0 (patch)
tree3ac569bb96cddd1267778f07cddfd3e0771c0f98
parent5b25fec2159e1e5207141bc4268170aec3ac6c7d (diff)
Avoiding unnecessary memory allocation:
Added a method to directly convert fast attribute values to double. Change-Id: Ia0c415530d6d7c7f767a2e0c88983429bc966210 Reviewed-on: https://gerrit.libreoffice.org/40846 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--include/sax/fastattribs.hxx5
-rw-r--r--sc/source/filter/xml/XMLCalculationSettingsContext.cxx4
-rw-r--r--sc/source/filter/xml/XMLDDELinksContext.cxx2
-rw-r--r--sc/source/filter/xml/XMLTrackedChangesContext.cxx2
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx4
-rw-r--r--sc/source/filter/xml/xmldpimp.cxx6
-rw-r--r--sc/source/filter/xml/xmlexternaltabi.cxx2
7 files changed, 14 insertions, 11 deletions
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 9c1db656e36c..8b669fe26a17 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -150,6 +150,11 @@ public:
assert(mnIdx < mrList.maAttributeTokens.size());
return rtl_str_toInt32(mrList.getFastAttributeValue(mnIdx), 10);
}
+ double toDouble() const
+ {
+ assert(mnIdx < mrList.maAttributeTokens.size());
+ return rtl_str_toDouble(mrList.getFastAttributeValue(mnIdx));
+ }
OUString toString() const
{
assert(mnIdx < mrList.maAttributeTokens.size());
diff --git a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
index 0617d2654b14..81fc1744ab4c 100644
--- a/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
+++ b/sc/source/filter/xml/XMLCalculationSettingsContext.cxx
@@ -200,9 +200,7 @@ ScXMLIterationContext::ScXMLIterationContext( ScXMLImport& rImport,
pCalcSet->SetIterationCount(aIter.toInt32());
break;
case XML_ELEMENT( TABLE, XML_MAXIMUM_DIFFERENCE ):
- double fDif;
- ::sax::Converter::convertDouble(fDif, aIter.toString());
- pCalcSet->SetIterationEpsilon(fDif);
+ pCalcSet->SetIterationEpsilon( aIter.toDouble() );
break;
}
}
diff --git a/sc/source/filter/xml/XMLDDELinksContext.cxx b/sc/source/filter/xml/XMLDDELinksContext.cxx
index 59b9fbb5df66..faaab9888728 100644
--- a/sc/source/filter/xml/XMLDDELinksContext.cxx
+++ b/sc/source/filter/xml/XMLDDELinksContext.cxx
@@ -370,7 +370,7 @@ ScXMLDDECellContext::ScXMLDDECellContext( ScXMLImport& rImport,
bString2 = true;
break;
case XML_ELEMENT( OFFICE, XML_VALUE ):
- ::sax::Converter::convertDouble(fValue, aIter.toString());
+ fValue = aIter.toDouble();
bEmpty = false;
bString2 = false;
break;
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index 1657ea40687f..ff843fa7df51 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -887,7 +887,7 @@ ScXMLChangeCellContext::ScXMLChangeCellContext( ScXMLImport& rImport,
}
break;
case XML_ELEMENT( OFFICE, XML_VALUE ):
- ::sax::Converter::convertDouble(fValue, aIter.toString());
+ fValue = aIter.toDouble();
bEmpty = false;
break;
case XML_ELEMENT( OFFICE, XML_DATE_VALUE ):
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 043190f41bbf..c3edfdbeac03 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -211,7 +211,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
{
if (!it.isEmpty())
{
- ::sax::Converter::convertDouble(fValue, it.toString());
+ fValue = it.toDouble();
bIsEmpty = false;
//if office:value="0", let's get the text:p in case this is
@@ -259,7 +259,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
else if ( IsXMLToken( it, XML_FALSE ) )
fValue = 0.0;
else
- ::sax::Converter::convertDouble(fValue, it.toString() );
+ fValue = it.toDouble();
bIsEmpty = false;
}
}
diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx
index 27dfb894a7dd..9f431889385c 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -1504,7 +1504,7 @@ ScXMLDataPilotGroupsContext::ScXMLDataPilotGroupsContext( ScXMLImport& rImport,
bAutoStart = true;
else
{
- ::sax::Converter::convertDouble(fStart, aIter.toString());
+ fStart = aIter.toDouble();
bAutoStart = false;
}
}
@@ -1515,14 +1515,14 @@ ScXMLDataPilotGroupsContext::ScXMLDataPilotGroupsContext( ScXMLImport& rImport,
bAutoEnd = true;
else
{
- ::sax::Converter::convertDouble(fEnd, aIter.toString());
+ fEnd = aIter.toDouble();
bAutoEnd = false;
}
}
break;
case XML_STEP :
{
- ::sax::Converter::convertDouble(fStep, aIter.toString());
+ fStep = aIter.toDouble();
}
break;
case XML_GROUPED_BY :
diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx b/sc/source/filter/xml/xmlexternaltabi.cxx
index 1b0f1775eb0a..70fc010667f2 100644
--- a/sc/source/filter/xml/xmlexternaltabi.cxx
+++ b/sc/source/filter/xml/xmlexternaltabi.cxx
@@ -278,7 +278,7 @@ ScXMLExternalRefCellContext::ScXMLExternalRefCellContext(
{
if ( !it.isEmpty() )
{
- ::sax::Converter::convertDouble( mfCellValue, it.toString() );
+ mfCellValue = it.toDouble();
mbIsNumeric = true;
mbIsEmpty = false;
}