diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-05-18 14:23:15 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-05-18 16:10:41 +0200 |
commit | eca89ece45ede76605a6102c94b3b67e1f8ff5aa (patch) | |
tree | 13973d98d4cbcf324fddec118da696202b9b5cd9 /sal | |
parent | 2f9d909a01f90197c3029a446f8aac8135f53f48 (diff) |
Replace rtl_string_getTokenView with o3tl::getToken
...to not needlessly extend the sal ABI.
At least for now, o3tl::getToken has a simpler interface than its
OString::getToken counterpart (driven mainly by how it is used for now): it does
not support a `token` argument, and its `position` argument must not be npos.
To meet the latter requirement, the check for "subpath" in LineParser::readPath
has been reworked slightly.
Change-Id: I4428fe2d9aa03ca83a436fc6493fbc34665a8033
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115742
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/rtl/string.cxx | 5 | ||||
-rw-r--r-- | sal/rtl/strtmpl.hxx | 66 | ||||
-rw-r--r-- | sal/util/sal.map | 5 |
3 files changed, 0 insertions, 76 deletions
diff --git a/sal/rtl/string.cxx b/sal/rtl/string.cxx index ec6b95718b3c..94be8029032a 100644 --- a/sal/rtl/string.cxx +++ b/sal/rtl/string.cxx @@ -700,9 +700,4 @@ sal_Int32 SAL_CALL rtl_string_getToken(rtl_String** ppThis, rtl_String* pStr, sa return rtl::str::getToken(ppThis, pStr, nToken, cTok, nIndex); } -sal_Int32 SAL_CALL rtl_string_getTokenView(const char ** ppViewStr , sal_Int32* pViewLength, rtl_String* pStr, sal_Int32 nToken, - char cTok, sal_Int32 nIndex) SAL_THROW_EXTERN_C() -{ - return rtl::str::getTokenView(ppViewStr, pViewLength, pStr, nToken, cTok, nIndex); -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/rtl/strtmpl.hxx b/sal/rtl/strtmpl.hxx index 855516cec1d4..094a1cc1f2ab 100644 --- a/sal/rtl/strtmpl.hxx +++ b/sal/rtl/strtmpl.hxx @@ -1732,72 +1732,6 @@ sal_Int32 getToken ( IMPL_RTL_STRINGDATA** ppThis } } - -/* ----------------------------------------------------------------------- */ - -template <typename IMPL_RTL_STRINGDATA> -sal_Int32 getTokenView ( const char ** ppViewStr, - sal_Int32 * pViewLength, - IMPL_RTL_STRINGDATA* pStr, - sal_Int32 nToken, - STRCODE<IMPL_RTL_STRINGDATA> cTok, - sal_Int32 nIndex ) -{ - assert(ppViewStr); - assert(pViewLength); - assert(pStr); - const auto* pCharStr = pStr->buffer; - sal_Int32 nLen = pStr->length-nIndex; - sal_Int32 nTokCount = 0; - - // Set ppThis to an empty string and return -1 if either nToken or nIndex is - // negative: - if (nIndex < 0) - nToken = -1; - - pCharStr += nIndex; - const auto* pOrgCharStr = pCharStr; - const auto* pCharStrStart = pCharStr; - while ( nLen > 0 ) - { - if ( *pCharStr == cTok ) - { - nTokCount++; - - if ( nTokCount == nToken ) - pCharStrStart = pCharStr+1; - else - { - if ( nTokCount > nToken ) - break; - } - } - - pCharStr++; - nLen--; - } - - if ( (nToken < 0) || (nTokCount < nToken) || (pCharStr == pCharStrStart) ) - { - if( (nToken < 0) || (nTokCount < nToken) ) - return -1; - else if( nLen > 0 ) - return nIndex+(pCharStr-pOrgCharStr)+1; - else return -1; - } - else - { - *ppViewStr = pCharStrStart; - *pViewLength = pCharStr-pCharStrStart; - if ( nLen ) - return nIndex+(pCharStr-pOrgCharStr)+1; - else - return -1; - } -} - - - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/util/sal.map b/sal/util/sal.map index bc6e90ec488e..49efb2a436cd 100644 --- a/sal/util/sal.map +++ b/sal/util/sal.map @@ -755,11 +755,6 @@ PRIVATE_1.7 { # LibreOffice 7.1 rtl_uString_newReplaceAllFromIndexUtf16LUtf16L; } PRIVATE_1.5; -PRIVATE_1.8 { # LibreOffice 7.2 - global: - rtl_string_getTokenView; -} PRIVATE_1.7; - PRIVATE_textenc.1 { # LibreOffice 3.6 global: _ZN3sal6detail7textenc20convertCharToUnicode*; |