diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-21 20:32:46 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-22 09:03:33 -0500 |
commit | 6087da0dd402013b7d67fe6754081e647fdc5f8c (patch) | |
tree | a7a8971d86e9d8dd3f1d844fa7c22410feb119ff /sc | |
parent | 151beeb0b234512768080da3441ebe40a46cd861 (diff) |
getChar() to return a null-terminated char array.
No need to fetch string size with this change.
Change-Id: Iae5f6c60430fc57985a0fec5bfec59727e5a8f0f
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/inc/addressconverter.hxx | 7 | ||||
-rw-r--r-- | sc/source/filter/oox/addressconverter.cxx | 16 | ||||
-rw-r--r-- | sc/source/filter/oox/sheetdatacontext.cxx | 8 |
3 files changed, 12 insertions, 19 deletions
diff --git a/sc/source/filter/inc/addressconverter.hxx b/sc/source/filter/inc/addressconverter.hxx index 886e074e03c6..36f859948092 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 b9dbc53124a9..59028bacd59d 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 ca55119e57aa..5170234158ea 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; } |