From 3fbadf2801f4c13f086d76a3ed566180cc0693dc Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 7 Apr 2023 17:53:00 +0200 Subject: use more OUStringToOString which makes it easier to pass around string_view in a few places. Change-Id: Icbbb7f56494986582f1c3272404775bd98031240 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150129 Tested-by: Jenkins Reviewed-by: Noel Grandin --- ucb/source/ucp/webdav-curl/DateTimeHelper.cxx | 16 ++++++++-------- ucb/source/ucp/webdav-curl/DateTimeHelper.hxx | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'ucb/source') diff --git a/ucb/source/ucp/webdav-curl/DateTimeHelper.cxx b/ucb/source/ucp/webdav-curl/DateTimeHelper.cxx index 06514d682fa6..6725b3c6fcf2 100644 --- a/ucb/source/ucp/webdav-curl/DateTimeHelper.cxx +++ b/ucb/source/ucp/webdav-curl/DateTimeHelper.cxx @@ -25,10 +25,10 @@ using namespace com::sun::star::util; using namespace http_dav_ucp; -bool DateTimeHelper::ISO8601_To_DateTime (const OUString& s, +bool DateTimeHelper::ISO8601_To_DateTime (std::u16string_view s, DateTime& dateTime) { - OString aDT (s.getStr(), s.getLength(), RTL_TEXTENCODING_ASCII_US); + OString aDT = OUStringToOString(s, RTL_TEXTENCODING_ASCII_US); int year, month, day, hours, minutes, off_hours, off_minutes, fix; double seconds; @@ -155,7 +155,7 @@ sal_Int32 DateTimeHelper::convertMonthToInt(std::u16string_view month) return 0; } -bool DateTimeHelper::RFC2068_To_DateTime (const OUString& s, +bool DateTimeHelper::RFC2068_To_DateTime (std::u16string_view s, DateTime& dateTime) { int year; @@ -166,10 +166,10 @@ bool DateTimeHelper::RFC2068_To_DateTime (const OUString& s, char string_month[3 + 1]; char string_day[3 + 1]; - sal_Int32 found = s.indexOf (','); - if (found != -1) + size_t found = s.find(','); + if (found != std::u16string_view::npos) { - OString aDT (s.getStr(), s.getLength(), RTL_TEXTENCODING_ASCII_US); + OString aDT = OUStringToOString(s, RTL_TEXTENCODING_ASCII_US); // RFC 1123 found = sscanf (aDT.getStr(), "%3s, %2d %3s %4d %2d:%2d:%2d GMT", @@ -184,7 +184,7 @@ bool DateTimeHelper::RFC2068_To_DateTime (const OUString& s, } else { - OString aDT (s.getStr(), s.getLength(), RTL_TEXTENCODING_ASCII_US); + OString aDT = OUStringToOString(s, RTL_TEXTENCODING_ASCII_US); // ANSI C's asctime () format found = sscanf (aDT.getStr(), "%3s %3s %d %2d:%2d:%2d %4d", @@ -245,7 +245,7 @@ bool DateTimeHelper::RFC2068_To_DateTime (const OUString& s, return found; } -bool DateTimeHelper::convert (const OUString& s, DateTime& dateTime) +bool DateTimeHelper::convert (std::u16string_view s, DateTime& dateTime) { if (ISO8601_To_DateTime (s, dateTime)) return true; diff --git a/ucb/source/ucp/webdav-curl/DateTimeHelper.hxx b/ucb/source/ucp/webdav-curl/DateTimeHelper.hxx index 22a8e9519b80..35784412742f 100644 --- a/ucb/source/ucp/webdav-curl/DateTimeHelper.hxx +++ b/ucb/source/ucp/webdav-curl/DateTimeHelper.hxx @@ -39,14 +39,14 @@ class DateTimeHelper private: static sal_Int32 convertMonthToInt(std::u16string_view month); - static bool ISO8601_To_DateTime (const OUString&, + static bool ISO8601_To_DateTime (std::u16string_view, css::util::DateTime& ); - static bool RFC2068_To_DateTime (const OUString&, + static bool RFC2068_To_DateTime (std::u16string_view, css::util::DateTime& ); public: - static bool convert (const OUString&, + static bool convert (std::u16string_view, css::util::DateTime& ); }; -- cgit