[Libreoffice-commits] core.git: svl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Feb 13 06:44:36 UTC 2019
svl/source/misc/inettype.cxx | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
New commits:
commit bd0ba6d459d9da09038db93bf701135273a429df
Author: Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Sat Feb 9 18:13:04 2019 +0100
Commit: Matteo Casalin <matteo.casalin at yahoo.com>
CommitDate: Wed Feb 13 07:44:13 2019 +0100
Use indexed getToken()
Change-Id: I7a9ee6cb1e5fd9dac917d236bfd612100828c087
Reviewed-on: https://gerrit.libreoffice.org/67626
Tested-by: Jenkins
Reviewed-by: Matteo Casalin <matteo.casalin at yahoo.com>
diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx
index 2704d949a8d5..f2bdd6c8f2f9 100644
--- a/svl/source/misc/inettype.cxx
+++ b/svl/source/misc/inettype.cxx
@@ -317,7 +317,8 @@ INetContentType INetContentTypes::GetContentType4Extension(OUString const & rExt
INetContentType INetContentTypes::GetContentTypeFromURL(OUString const & rURL)
{
INetContentType eTypeID = CONTENT_TYPE_UNKNOWN;
- OUString aToken = rURL.getToken(0, ':');
+ sal_Int32 nIdx{ 0 };
+ OUString aToken = rURL.getToken(0, ':', nIdx);
if (!aToken.isEmpty())
{
if (aToken.equalsIgnoreAsciiCase(INETTYPE_URL_PROT_FILE))
@@ -347,14 +348,13 @@ INetContentType INetContentTypes::GetContentTypeFromURL(OUString const & rURL)
eTypeID = CONTENT_TYPE_TEXT_HTML;
else if (aToken.equalsIgnoreAsciiCase(INETTYPE_URL_PROT_PRIVATE))
{
- OUString aSecondPart = rURL.getToken(1, ':');
- aToken = aSecondPart.getToken(0, '/');
+ aToken = rURL.getToken(0, '/', nIdx);
if (aToken == "factory")
{
- aToken = aSecondPart.getToken(1, '/');
+ aToken = rURL.getToken(0, '/', nIdx);
if (aToken == "swriter")
{
- aToken = aSecondPart.getToken(2, '/');
+ aToken = rURL.getToken(0, '/', nIdx);
eTypeID = aToken == "web" ?
CONTENT_TYPE_APP_VND_WRITER_WEB :
aToken == "GlobalDocument" ?
@@ -385,8 +385,7 @@ INetContentType INetContentTypes::GetContentTypeFromURL(OUString const & rURL)
eTypeID = CONTENT_TYPE_APP_MACRO;
else if (aToken.equalsIgnoreAsciiCase(INETTYPE_URL_PROT_DATA))
{
- OUString aSecondPart = rURL.getToken(1, ':');
- aToken = aSecondPart.getToken(0, ',');
+ aToken = rURL.getToken(0, ',', nIdx);
eTypeID = GetContentType(aToken);
}
}
More information about the Libreoffice-commits
mailing list