include/rtl/stringutils.hxx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
New commits: commit 514db965c803c24dc0f21b95740d7f7230818d94 Author: Caolán McNamara <[email protected]> AuthorDate: Fri Aug 24 11:20:27 2018 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Aug 31 15:02:05 2018 +0200 coverity#1438473 silence Logically dead code Change-Id: I10b3821311515bb5148dab698f07d902c5c73100 Reviewed-on: https://gerrit.libreoffice.org/59822 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/include/rtl/stringutils.hxx b/include/rtl/stringutils.hxx index 53f7554ee132..e9aacbc3becb 100644 --- a/include/rtl/stringutils.hxx +++ b/include/rtl/stringutils.hxx @@ -184,6 +184,29 @@ struct ConstCharArrayDetector< const char[ N ], T > #endif static char const * toPointer(char 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< const char[ 1 ], T > +{ + typedef T Type; + static const std::size_t length = 0; + static const bool ok = true; +#if defined LIBO_INTERNAL_ONLY && HAVE_CXX14_CONSTEXPR + constexpr +#endif + static bool isValid(char const (& literal)[1]) { + return literal[0] == '\0'; + } +#if defined LIBO_INTERNAL_ONLY + constexpr +#endif + static char const * toPointer(char const (& literal)[1]) { return literal; } +}; +#endif + #if defined LIBO_INTERNAL_ONLY template<std::size_t N, typename T> struct ConstCharArrayDetector<sal_Unicode const [N], T> { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
