[Libreoffice-commits] core.git: Branch 'private/kohei/xlsx-import-speedup' - sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Thu Nov 21 17:31:53 PST 2013
sc/source/filter/inc/addressconverter.hxx | 7 +++----
sc/source/filter/oox/addressconverter.cxx | 16 ++++++----------
sc/source/filter/oox/sheetdatacontext.cxx | 8 +++-----
3 files changed, 12 insertions(+), 19 deletions(-)
New commits:
commit 3d42cf07c241cac6a26554ba18430d37e8832662
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Nov 21 20:32:46 2013 -0500
getChar() to return a null-terminated char array.
No need to fetch string size with this change.
Change-Id: Iae5f6c60430fc57985a0fec5bfec59727e5a8f0f
diff --git a/sc/source/filter/inc/addressconverter.hxx b/sc/source/filter/inc/addressconverter.hxx
index 886e074..36f8599 100644
--- a/sc/source/filter/inc/addressconverter.hxx
+++ b/sc/source/filter/inc/addressconverter.hxx
@@ -214,7 +214,7 @@ public:
sal_Int32 nLength = SAL_MAX_INT32 );
static bool parseOoxAddress2d(
- sal_Int32& ornColumn, sal_Int32& ornRow, const char* pStr, sal_Int32 nStrLen );
+ sal_Int32& ornColumn, sal_Int32& ornRow, const char* pStr );
/** Tries to parse the passed string for a 2d cell range in A1 notation.
@@ -320,8 +320,7 @@ public:
sal_Int16 nSheet );
bool convertToCellAddressUnchecked(
- com::sun::star::table::CellAddress& orAddress,
- const char* pStr, size_t nStrLen, sal_Int16 nSheet ) const;
+ com::sun::star::table::CellAddress& orAddress, const char* pStr, sal_Int16 nSheet ) const;
/** Tries to convert the passed string to a single cell address.
@@ -340,7 +339,7 @@ public:
bool convertToCellAddress(
com::sun::star::table::CellAddress& rAddress,
- const char* pStr, size_t nStrLen, sal_Int16 nSheet, bool bTrackOverflow );
+ const char* pStr, sal_Int16 nSheet, bool bTrackOverflow );
/** Returns a valid cell address by moving it into allowed dimensions.
diff --git a/sc/source/filter/oox/addressconverter.cxx b/sc/source/filter/oox/addressconverter.cxx
index b9dbc53..59028ba 100644
--- a/sc/source/filter/oox/addressconverter.cxx
+++ b/sc/source/filter/oox/addressconverter.cxx
@@ -226,16 +226,13 @@ bool AddressConverter::parseOoxAddress2d(
return (ornColumn >= 0) && (ornRow >= 0);
}
-bool AddressConverter::parseOoxAddress2d(
- sal_Int32& ornColumn, sal_Int32& ornRow, const char* pStr, sal_Int32 nStrLen )
+bool AddressConverter::parseOoxAddress2d( sal_Int32& ornColumn, sal_Int32& ornRow, const char* pStr )
{
ornColumn = ornRow = 0;
- const char* pStrEnd = pStr + nStrLen;
-
enum { STATE_COL, STATE_ROW } eState = STATE_COL;
- while (pStr < pStrEnd)
+ while (*pStr)
{
char cChar = *pStr;
switch( eState )
@@ -356,11 +353,10 @@ bool AddressConverter::convertToCellAddressUnchecked( CellAddress& orAddress,
}
bool AddressConverter::convertToCellAddressUnchecked(
- com::sun::star::table::CellAddress& orAddress,
- const char* pStr, size_t nStrLen, sal_Int16 nSheet ) const
+ com::sun::star::table::CellAddress& orAddress, const char* pStr, sal_Int16 nSheet ) const
{
orAddress.Sheet = nSheet;
- return parseOoxAddress2d(orAddress.Column, orAddress.Row, pStr, nStrLen);
+ return parseOoxAddress2d(orAddress.Column, orAddress.Row, pStr);
}
bool AddressConverter::convertToCellAddress( CellAddress& orAddress,
@@ -373,9 +369,9 @@ bool AddressConverter::convertToCellAddress( CellAddress& orAddress,
bool AddressConverter::convertToCellAddress(
com::sun::star::table::CellAddress& rAddress,
- const char* pStr, size_t nStrLen, sal_Int16 nSheet, bool bTrackOverflow )
+ const char* pStr, sal_Int16 nSheet, bool bTrackOverflow )
{
- if (!convertToCellAddressUnchecked(rAddress, pStr, nStrLen, nSheet))
+ if (!convertToCellAddressUnchecked(rAddress, pStr, nSheet))
return false;
return checkCellAddress(rAddress, bTrackOverflow);
diff --git a/sc/source/filter/oox/sheetdatacontext.cxx b/sc/source/filter/oox/sheetdatacontext.cxx
index ca55119..5170234 100644
--- a/sc/source/filter/oox/sheetdatacontext.cxx
+++ b/sc/source/filter/oox/sheetdatacontext.cxx
@@ -311,18 +311,16 @@ void SheetDataContext::importRow( const AttributeList& rAttribs )
bool SheetDataContext::importCell( const AttributeList& rAttribs )
{
bool bValid = true;
- AttributeList::Char aChar = rAttribs.getChar(XML_r);
+ const char* p = rAttribs.getChar(XML_r);
- if (!aChar.mpPos)
+ if (!p)
{
++mnCol;
maCellData.maCellAddr = CellAddress( mnSheet, mnCol, mnRow );
}
else
{
- bValid = mrAddressConv.convertToCellAddress(
- maCellData.maCellAddr, aChar.mpPos, aChar.mnSize, mnSheet, true);
-
+ bValid = mrAddressConv.convertToCellAddress(maCellData.maCellAddr, p, mnSheet, true);
mnCol = maCellData.maCellAddr.Column;
}
More information about the Libreoffice-commits
mailing list