From 8bf380f7d33f39eaa4cb96b38a82ac18e589deef Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 2 May 2022 16:36:43 +0200 Subject: add o3tl::matchIgnoreAsciiCase Change-Id: Iad8e1ed256d84808404bf20ed7a16b05b3db5818 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133753 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/source/filter/inc/msfilter.hxx | 6 +++--- sw/source/filter/ww8/writerwordglue.cxx | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'sw') diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx index 39d6e4d5bf99..0ca05c0ac9f9 100644 --- a/sw/source/filter/inc/msfilter.hxx +++ b/sw/source/filter/inc/msfilter.hxx @@ -84,15 +84,15 @@ namespace sw sal_uLong MSDateTimeFormatToSwFormat(OUString& rParams, SvNumberFormatter *pFormatter, LanguageType &rLang, bool bHijri, LanguageType nDocLang); /*Used to identify if the previous token is AM time field*/ - bool IsPreviousAM(OUString const & rParams, sal_Int32 nPos); + bool IsPreviousAM(std::u16string_view rParams, sal_Int32 nPos); /*Used to identify if the next token is PM time field*/ - bool IsNextPM(OUString const & rParams, sal_Int32 nPos); + bool IsNextPM(std::u16string_view rParams, sal_Int32 nPos); /** Used by MSDateTimeFormatToSwFormat to identify AM time fields */ - bool IsNotAM(OUString const & rParams, sal_Int32 nPos); + bool IsNotAM(std::u16string_view rParams, sal_Int32 nPos); /** Another function used by MSDateTimeFormatToSwFormat diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index b2eb03e4a53a..e0a7fb3bb941 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -25,6 +25,7 @@ #include +#include #include #include #include @@ -1036,18 +1037,18 @@ namespace sw return nKey; } - bool IsPreviousAM(OUString const & rParams, sal_Int32 nPos) + bool IsPreviousAM(std::u16string_view rParams, sal_Int32 nPos) { - return nPos>=2 && rParams.matchIgnoreAsciiCase("am", nPos-2); + return nPos>=2 && o3tl::matchIgnoreAsciiCase(rParams, u"am", nPos-2); } - bool IsNextPM(OUString const & rParams, sal_Int32 nPos) + bool IsNextPM(std::u16string_view rParams, sal_Int32 nPos) { - return nPos+2=rParams.getLength() || (rParams[nPos]!='M' && rParams[nPos]!='m'); + return o3tl::make_unsigned(nPos)>=rParams.size() || (rParams[nPos]!='M' && rParams[nPos]!='m'); } void SwapQuotesInField(OUString &rFormat) -- cgit