diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-04-07 17:53:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-04-09 16:28:13 +0200 |
commit | 3fbadf2801f4c13f086d76a3ed566180cc0693dc (patch) | |
tree | 6ec41f5a137122ce803bb4aa82d2548fe60e337b /ucb/source | |
parent | f707834e8538c0a183716b26ebdf04381482ca6d (diff) |
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb/source')
-rw-r--r-- | ucb/source/ucp/webdav-curl/DateTimeHelper.cxx | 16 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-curl/DateTimeHelper.hxx | 6 |
2 files changed, 11 insertions, 11 deletions
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& ); }; |