diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-07-10 17:33:02 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-07-11 09:26:37 +0200 |
commit | a15e387775b02489e5aafcee7cf3250dad9a10d0 (patch) | |
tree | 5d0e4e26cf8b3227ae851667b4b85cf02c9fa136 /ucb/source | |
parent | e68f28ec9f68a1f70afce7acfa38ce7a63ccdafe (diff) |
cid#1608274 silence Overflowed return value
Change-Id: Ia4472781f51117e3a9cdcfbdb6fe62cd56f9dfe0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170322
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'ucb/source')
-rw-r--r-- | ucb/source/ucp/webdav-curl/DateTimeHelper.cxx | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/ucb/source/ucp/webdav-curl/DateTimeHelper.cxx b/ucb/source/ucp/webdav-curl/DateTimeHelper.cxx index 6725b3c6fcf2..3e4484cc89e8 100644 --- a/ucb/source/ucp/webdav-curl/DateTimeHelper.cxx +++ b/ucb/source/ucp/webdav-curl/DateTimeHelper.cxx @@ -166,36 +166,36 @@ bool DateTimeHelper::RFC2068_To_DateTime (std::u16string_view s, char string_month[3 + 1]; char string_day[3 + 1]; - size_t found = s.find(','); - if (found != std::u16string_view::npos) + bool res = false; + if (s.find(',') != std::u16string_view::npos) { OString aDT = OUStringToOString(s, RTL_TEXTENCODING_ASCII_US); // RFC 1123 - found = sscanf (aDT.getStr(), "%3s, %2d %3s %4d %2d:%2d:%2d GMT", - string_day, &day, string_month, &year, &hours, &minutes, &seconds); + int found = sscanf(aDT.getStr(), "%3s, %2d %3s %4d %2d:%2d:%2d GMT", + string_day, &day, string_month, &year, &hours, &minutes, &seconds); if (found != 7) { // RFC 1036 found = sscanf (aDT.getStr(), "%3s, %2d-%3s-%2d %2d:%2d:%2d GMT", string_day, &day, string_month, &year, &hours, &minutes, &seconds); } - found = (found == 7) ? 1 : 0; + res = found == 7; } else { OString aDT = OUStringToOString(s, RTL_TEXTENCODING_ASCII_US); // ANSI C's asctime () format - found = sscanf (aDT.getStr(), "%3s %3s %d %2d:%2d:%2d %4d", - string_day, string_month, - &day, &hours, &minutes, &seconds, &year); - found = (found == 7) ? 1 : 0; + int found = sscanf(aDT.getStr(), "%3s %3s %d %2d:%2d:%2d %4d", + string_day, string_month, + &day, &hours, &minutes, &seconds, &year); + res = found == 7; } - if (found) + if (res) { - found = 0; + res = false; int month = DateTimeHelper::convertMonthToInt ( OUString::createFromAscii (string_month)); @@ -235,14 +235,14 @@ bool DateTimeHelper::RFC2068_To_DateTime (std::u16string_view s, dateTime.Minutes = aDateTime.Minutes; dateTime.Seconds = aDateTime.Seconds; - found = 1; + res = true; } } } } } - return found; + return res; } bool DateTimeHelper::convert (std::u16string_view s, DateTime& dateTime) |