Use OUStringLiteral

Change-Id: I720f70f81db92d75cdd83aa20a1cbf5a311b092b
This commit is contained in:
Stephan Bergmann
2017-02-07 22:57:39 +01:00
parent 3c5c11bf63
commit d7a2e94e65

View File

@@ -45,16 +45,11 @@ using namespace std;
namespace { namespace {
struct AsciiString {
char const * string;
sal_Int32 length;
};
bool matchList( bool matchList(
const OUString& rUrl, const AsciiString* pList, size_t nLength) const OUString& rUrl, const OUStringLiteral* pList, size_t nLength)
{ {
for (size_t i = 0; i != nLength; ++i) { for (size_t i = 0; i != nLength; ++i) {
if (rUrl.endsWithAsciiL(pList[i].string, pList[i].length)) { if (rUrl.endsWith(pList[i])) {
return true; return true;
} }
} }
@@ -62,31 +57,24 @@ bool matchList(
} }
bool passesNegativeList(const OUString& rUrl) { bool passesNegativeList(const OUString& rUrl) {
static const AsciiString list[] = { static const OUStringLiteral list[] = {
{ RTL_CONSTASCII_STRINGPARAM("/dictionaries.xcu") }, "/dictionaries.xcu",
{ RTL_CONSTASCII_STRINGPARAM( "/dictionaries/da_DK/help/da/help.tree",
"/dictionaries/da_DK/help/da/help.tree") }, ("/dictionaries/da_DK/help/da/"
{ RTL_CONSTASCII_STRINGPARAM( "org.openoffice.da.hunspell.dictionaries/page1.xhp"),
"/dictionaries/da_DK/help/da/" ("/dictionaries/da_DK/help/da/"
"org.openoffice.da.hunspell.dictionaries/page1.xhp") }, "org.openoffice.da.hunspell.dictionaries/page2.xhp"),
{ RTL_CONSTASCII_STRINGPARAM( "/dictionaries/hu_HU/help/hu/help.tree",
"/dictionaries/da_DK/help/da/" ("/dictionaries/hu_HU/help/hu/"
"org.openoffice.da.hunspell.dictionaries/page2.xhp") }, "org.openoffice.hu.hunspell.dictionaries/page1.xhp"),
{ RTL_CONSTASCII_STRINGPARAM( "/officecfg/registry/data/org/openoffice/Office/Accelerators.xcu"
"/dictionaries/hu_HU/help/hu/help.tree") },
{ RTL_CONSTASCII_STRINGPARAM(
"/dictionaries/hu_HU/help/hu/"
"org.openoffice.hu.hunspell.dictionaries/page1.xhp") },
{ RTL_CONSTASCII_STRINGPARAM(
"/officecfg/registry/data/org/openoffice/Office/"
"Accelerators.xcu") }
}; };
return !matchList(rUrl, list, SAL_N_ELEMENTS(list)); return !matchList(rUrl, list, SAL_N_ELEMENTS(list));
} }
bool passesPositiveList(const OUString& rUrl) { bool passesPositiveList(const OUString& rUrl) {
static const AsciiString list[] = { static const OUStringLiteral list[] = {
{ RTL_CONSTASCII_STRINGPARAM("/description.xml") } "/description.xml"
}; };
return matchList(rUrl, list, SAL_N_ELEMENTS(list)); return matchList(rUrl, list, SAL_N_ELEMENTS(list));
} }