[Libreoffice-commits] core.git: include/rtl
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Sep 10 07:50:54 UTC 2020
include/rtl/stringutils.hxx | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
New commits:
commit 13cea4e3e6256a65f264e0922a91cf39ea1e9835
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Sep 9 10:49:41 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Sep 10 09:50:15 2020 +0200
cid#1466656 silence Logically dead code
Change-Id: Id49181f71390ff6768ce6bc5734f8166e1a310b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102293
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/rtl/stringutils.hxx b/include/rtl/stringutils.hxx
index c7abe5e60df6..7a1bc606ff5b 100644
--- a/include/rtl/stringutils.hxx
+++ b/include/rtl/stringutils.hxx
@@ -268,6 +268,24 @@ struct ConstCharArrayDetector<sal_Unicode const [N], T> {
sal_Unicode const (& literal)[N])
{ return literal; }
};
+
+#if defined(__COVERITY__)
+//to silence over zealous warnings that the loop is logically dead
+//for the single char case
+template<typename T>
+struct ConstCharArrayDetector<sal_Unicode const [1], T> {
+ using TypeUtf16 = T;
+ static constexpr bool const ok = true;
+ static constexpr std::size_t const length = 0;
+ static constexpr bool isValid(sal_Unicode const (& literal)[1]) {
+ return literal[0] == '\0';
+ }
+ static constexpr sal_Unicode const * toPointer(
+ sal_Unicode const (& literal)[1])
+ { return literal; }
+};
+#endif
+
template<typename T> struct ConstCharArrayDetector<
OUStringChar,
T>
More information about the Libreoffice-commits
mailing list