summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-11-19 12:36:45 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-11-19 13:27:00 +0100
commit5078e83d88a08881661a18636f38e8951cdda676 (patch)
tree8db22819cf10b91dd587cfa834bf5c3f0df06628 /svl
parent7e21785380f39f0fe53e06bafa3e5395f7f6e8b6 (diff)
loplugin:stringliteraldefine in svl
Change-Id: I49a8062c30bdce5b0d9bd27e421d85ba61d5592e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125544 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/misc/inettype.cxx15
1 files changed, 7 insertions, 8 deletions
diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx
index 471247b24987..c1d4e4b1ba6e 100644
--- a/svl/source/misc/inettype.cxx
+++ b/svl/source/misc/inettype.cxx
@@ -31,7 +31,7 @@ namespace
struct MediaTypeEntry
{
- char const * m_pTypeName;
+ OUString m_pTypeName;
INetContentType m_eTypeID;
};
@@ -230,8 +230,7 @@ MediaTypeEntry const * seekEntry(OUString const & rTypeName,
#if defined DBG_UTIL
for (std::size_t i = 0; i < nSize - 1; ++i)
DBG_ASSERT(
- rtl_str_compare(
- pMap[i].m_pTypeName, pMap[i + 1].m_pTypeName) < 0,
+ pMap[i].m_pTypeName < pMap[i + 1].m_pTypeName,
"seekEntry(): Bad map");
#endif
@@ -241,7 +240,7 @@ MediaTypeEntry const * seekEntry(OUString const & rTypeName,
{
std::size_t nMiddle = (nLow + nHigh) / 2;
MediaTypeEntry const * pEntry = pMap + nMiddle;
- sal_Int32 nCmp = rTypeName.compareToIgnoreAsciiCaseAscii(pEntry->m_pTypeName);
+ sal_Int32 nCmp = rTypeName.compareToIgnoreAsciiCase(pEntry->m_pTypeName);
if (nCmp < 0)
nHigh = nMiddle;
else if (nCmp == 0)
@@ -276,18 +275,18 @@ INetContentType INetContentTypes::GetContentType(OUString const & rTypeName)
//static
OUString INetContentTypes::GetContentType(INetContentType eTypeID)
{
- static std::array<char const *, CONTENT_TYPE_LAST + 1> aMap = []()
+ static std::array<OUString, CONTENT_TYPE_LAST + 1> aMap = []()
{
- std::array<char const *, CONTENT_TYPE_LAST + 1> tmp;
+ std::array<OUString, CONTENT_TYPE_LAST + 1> tmp;
for (std::size_t i = 0; i <= CONTENT_TYPE_LAST; ++i)
tmp[aStaticTypeNameMap[i].m_eTypeID] = aStaticTypeNameMap[i].m_pTypeName;
tmp[CONTENT_TYPE_UNKNOWN] = CONTENT_TYPE_STR_APP_OCTSTREAM;
- tmp[CONTENT_TYPE_TEXT_PLAIN] = CONTENT_TYPE_STR_TEXT_PLAIN
+ tmp[CONTENT_TYPE_TEXT_PLAIN] = CONTENT_TYPE_STR_TEXT_PLAIN +
"; charset=iso-8859-1";
return tmp;
}();
- OUString aTypeName = eTypeID <= CONTENT_TYPE_LAST ? OUString::createFromAscii(aMap[eTypeID])
+ OUString aTypeName = eTypeID <= CONTENT_TYPE_LAST ? aMap[eTypeID]
: OUString();
if (aTypeName.isEmpty())
{