include/rtl/stringutils.hxx | 22 ++++++++++++++++++++++ sal/osl/unx/file.cxx | 8 ++------ sal/osl/unx/file_volume.cxx | 1 - sal/osl/unx/nlsupport.cxx | 1 - sal/osl/unx/process.cxx | 3 --- sal/osl/unx/profile.cxx | 1 - sal/osl/w32/file.cxx | 2 -- sal/rtl/alloc_arena.cxx | 1 - sal/rtl/ustring.cxx | 2 +- 9 files changed, 25 insertions(+), 16 deletions(-)
New commits: commit 644915f59bde8256af81bf479aa2f2bb310936bc Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sun Aug 10 19:19:29 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Tue Aug 12 12:07:06 2025 +0200 remove out of date markup Change-Id: I37968d42b9a2548c0e6e6227d3d245c393086d98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189401 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index 7678b4813409..eaad16612f7c 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -885,7 +885,6 @@ void setAllowedPaths( return; // too bad else { - // coverity[fixed_size_dest : FALSE] - safe, see check above strcat(resolvedPath, aPath.getStr() + n); } } @@ -932,7 +931,6 @@ bool isForbidden(const OString &filePath, sal_uInt32 nFlags) return true; // too bad else { - // coverity[fixed_size_dest : FALSE] - safe, see check above strcat(resolvedPath, filePath.getStr() + n); } } @@ -1403,10 +1401,8 @@ const off_t MAX_OFF_T = std::numeric_limits< off_t >::max(); namespace { -// coverity[result_independent_of_operands] - crossplatform requirement template<typename T> bool exceedsMaxOffT(T n) { return n > MAX_OFF_T; } -// coverity[result_independent_of_operands] - crossplatform requirement template<typename T> bool exceedsMinOffT(T n) { return n < std::numeric_limits<off_t>::min(); } @@ -1429,7 +1425,7 @@ oslFileError SAL_CALL osl_mapFile( if (uLength > SAL_MAX_SIZE) { - // coverity[dead_error_line] - suppress warning, 32bit platforms still + // coverity[dead_error_line] 2024.6.1 - crossplatform requirement return osl_File_E_OVERFLOW; } @@ -1508,7 +1504,7 @@ static oslFileError unmapFile(void* pAddr, sal_uInt64 uLength) if (uLength > SAL_MAX_SIZE) { - // coverity[dead_error_line] - suppress warning, 32bit platforms still + // coverity[dead_error_line] 2024.6.1 - crossplatform requirement return osl_File_E_OVERFLOW; } diff --git a/sal/osl/unx/file_volume.cxx b/sal/osl/unx/file_volume.cxx index 0a6183292735..a5b98aa583d4 100644 --- a/sal/osl/unx/file_volume.cxx +++ b/sal/osl/unx/file_volume.cxx @@ -212,7 +212,6 @@ static oslFileError osl_psz_getVolumeInformation ( { OSL_detail_STATFS_STRUCT sfs; OSL_detail_STATFS_INIT(sfs); - // coverity[fs_check_call : FALSE] if ((OSL_detail_STATFS(pszDirectory, &sfs)) < (0)) { oslFileError result = oslTranslateFileError(errno); diff --git a/sal/osl/unx/nlsupport.cxx b/sal/osl/unx/nlsupport.cxx index 7ba961968ab7..bf9073ab396b 100644 --- a/sal/osl/unx/nlsupport.cxx +++ b/sal/osl/unx/nlsupport.cxx @@ -635,7 +635,6 @@ void imp_getProcessLocale( rtl_Locale ** ppLocale ) } } } - // coverity[overrun-buffer-val : FALSE] - coverity gets this very wrong *ppLocale = parse_locale(locale); } diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx index 0398afc58e45..bf7c967a80f4 100644 --- a/sal/osl/unx/process.cxx +++ b/sal/osl/unx/process.cxx @@ -333,7 +333,6 @@ static void ChildStatusProc(void *pData) else pChild->m_status = -1; - // coverity[lock_order : FALSE] - incorrect report of lock order error osl_setCondition(pChild->m_terminated); } @@ -739,10 +738,8 @@ oslProcess SAL_CALL osl_getProcess(oslProcessIdentifier Ident) pProcImpl->m_status = pChild->m_status; - // coverity[lock_order : FALSE] - incorrect report of lock order error if (osl_checkCondition(pChild->m_terminated)) { - // coverity[lock_order : FALSE] - incorrect report of lock order error osl_setCondition(pProcImpl->m_terminated); } } diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx index 05026da5e6fb..d8953648b2dc 100644 --- a/sal/osl/unx/profile.cxx +++ b/sal/osl/unx/profile.cxx @@ -190,7 +190,6 @@ static oslProfile osl_psz_openProfile(const char *pszProfileName, oslProfileOpti if (pProfile->m_pFile == nullptr) closeFileImpl(pFile,pProfile->m_Flags); - // coverity[leaked_storage] - pFile is not leaked return pProfile; } diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx index 4c4c06f462fa..302e4e1e6dd9 100644 --- a/sal/osl/w32/file.cxx +++ b/sal/osl/w32/file.cxx @@ -697,7 +697,6 @@ oslFileError SAL_CALL osl_closeFile(oslFileHandle Handle) namespace { -// coverity[result_independent_of_operands] - crossplatform requirement template<typename T> bool exceedsMaxSIZE_T(T n) { return n > std::numeric_limits< SIZE_T >::max(); } @@ -850,7 +849,6 @@ LONGLONG const g_limit_longlong = std::numeric_limits< LONGLONG >::max(); namespace { -// coverity[result_independent_of_operands] - crossplatform requirement template<typename T> bool exceedsMaxLONGLONG(T n) { return n > g_limit_longlong; } diff --git a/sal/rtl/alloc_arena.cxx b/sal/rtl/alloc_arena.cxx index c628ba0aaafc..361ff2074418 100644 --- a/sal/rtl/alloc_arena.cxx +++ b/sal/rtl/alloc_arena.cxx @@ -265,7 +265,6 @@ void rtl_arena_hash_rescale( rtl_arena_segment_type * next = curr->m_fnext; rtl_arena_segment_type ** head; - // coverity[negative_shift] - bogus head = &(arena->m_hash_table[RTL_ARENA_HASH_INDEX(arena, curr->m_addr)]); curr->m_fnext = (*head); (*head) = curr; diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx index dcc19d3b6ddd..e05ed08c3ddc 100644 --- a/sal/rtl/ustring.cxx +++ b/sal/rtl/ustring.cxx @@ -278,7 +278,7 @@ void SAL_CALL rtl_uString_newFromCodePoints( units will be no larger than 2 * SAL_MAX_INT32, represented as sal_Int32 -2): */ if (n < 0) { - // coverity[dead_error_begin] - assumes wrap around + // coverity[dead_error_begin] 2024.6.1 - assumes wrap around *newString = nullptr; return; } commit 29063bb3ca7f60495fe07e6d0fbe5b3689319fab Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Aug 12 08:51:47 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Tue Aug 12 12:06:59 2025 +0200 cid#1438474 resilence Logically dead code Change-Id: I3af124e65e3902e3759e1311f155cba557338df6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189400 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/include/rtl/stringutils.hxx b/include/rtl/stringutils.hxx index 8ef63d2485ef..c3fc7b094229 100644 --- a/include/rtl/stringutils.hxx +++ b/include/rtl/stringutils.hxx @@ -256,6 +256,28 @@ struct ConstCharArrayDetector< const char[ N ], T > static char const * toPointer(char const (& literal)[N]) { return literal; } }; +#if defined(__COVERITY__) && __COVERITY_MAJOR__ <= 2024 +//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 + constexpr +#endif + static bool isValid(char const (& literal)[1]) { + return literal[0] == ' + } +#if defined LIBO_INTERNAL_ONLY + constexpr +#endif + static char const * toPointer(char const (& literal)[1]) { return literal; } +}; +#endif + #if defined LIBO_INTERNAL_ONLY \ && !(defined _MSC_VER && _MSC_VER >= 1930 && _MSC_VER <= 1939 && defined _MANAGED) template<std::size_t N, typename T>