Kaydet (Commit) ba1e1727 authored tarafından Caolán McNamara's avatar Caolán McNamara

Related: rhbz#1602589 add comments to coverity annotations

Change-Id: I88c941832a0d682ea4b6028c28edd48cf5df38f7
Reviewed-on: https://gerrit.libreoffice.org/58093
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 877dd9e9
......@@ -144,7 +144,7 @@ uno_Mapping * Bridge::createMapping(
bool bExportCpp2Uno)
{
Bridge * bridge = new Bridge(pCppEnv, pUnoEnv, bExportCpp2Uno);
//coverity[leaked_storage]
// coverity[leaked_storage] - on purpose
return bExportCpp2Uno ? &bridge->aCpp2Uno : &bridge->aUno2Cpp;
}
......
......@@ -552,7 +552,7 @@ SAL_DLLPUBLIC_EXPORT void uno_ext_getMapping(
uno_registerMapping(
&mapping, Bridge_free,
pFrom, &pTo->pExtEnv->aBase, nullptr );
// coverity[leaked_storage]
// coverity[leaked_storage] - on purpose
}
else if ( from_env_typename == UNO_LB_UNO && to_env_typename == UNO_LB_JAVA )
{
......@@ -562,7 +562,7 @@ SAL_DLLPUBLIC_EXPORT void uno_ext_getMapping(
uno_registerMapping(
&mapping, Bridge_free,
&pFrom->pExtEnv->aBase, pTo, nullptr );
// coverity[leaked_storage]
// coverity[leaked_storage] - on purpose
}
}
catch (const BridgeRuntimeError & err)
......
......@@ -103,7 +103,7 @@ JNI_interface_type_info::JNI_interface_type_info(
typelib_InterfaceTypeDescription * td =
reinterpret_cast< typelib_InterfaceTypeDescription * >(
m_td.get() );
// coverity [ctor_dtor_leak]
// coverity[ctor_dtor_leak] - on purpose
m_methods.reset(new jmethodID[ td->nMapFunctionIndexToMemberIndex ]);
sal_Int32 nMethodIndex = 0;
typelib_TypeDescriptionReference ** ppMembers = td->ppMembers;
......@@ -288,7 +288,7 @@ JNI_compound_type_info::JNI_compound_type_info(
td->aBase.pWeakRef,
jni_info->m_RuntimeException_type.getTypeLibType() ))
{
// coverity [ctor_dtor_leak]
// coverity[ctor_dtor_leak] - on purpose
m_fields.reset(new jfieldID[ 2 ]);
m_fields[ 0 ] = nullptr; // special Throwable.getMessage()
// field Context
......@@ -860,7 +860,7 @@ JNI_info::JNI_info(
{
css::uno::TypeDescription XInterface_td(
cppu::UnoType<css::uno::XInterface>::get());
// coverity [ctor_dtor_leak]
// coverity[ctor_dtor_leak] - on purpose
m_XInterface_type_info =
new JNI_interface_type_info( jni, XInterface_td.get() );
}
......
......@@ -154,7 +154,7 @@ void ThreadPool::shutdownLocked(std::unique_lock<std::mutex>& aGuard)
}
assert( maTasks.empty() );
// coverity[missing_lock]
// coverity[missing_lock] - on purpose
mbTerminate = true;
maTasksChanged.notify_all();
......
......@@ -439,7 +439,7 @@ void SAL_CALL typelib_static_interface_type_init(
typelib_TypeDescriptionReference * pBaseType )
SAL_THROW_EXTERN_C()
{
// coverity[callee_ptr_arith]
// coverity[callee_ptr_arith] - not a bug
typelib_static_mi_interface_type_init(
ppRef, pTypeName, pBaseType == nullptr ? 0 : 1, &pBaseType);
}
......
......@@ -890,7 +890,7 @@ extern "C" void SAL_CALL typelib_typedescription_newInterface(
typelib_TypeDescriptionReference ** ppMembers )
SAL_THROW_EXTERN_C()
{
// coverity[callee_ptr_arith]
// coverity[callee_ptr_arith] - not a bug
typelib_typedescription_newMIInterface(
ppRet, pTypeName, 0, 0, 0, 0, 0, pBaseInterface == nullptr ? 0 : 1,
&pBaseInterface, nMembers, ppMembers);
......
......@@ -1123,7 +1123,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_save(bool bPreferred)
// take over all changes into the original container
SolarMutexGuard g;
// coverity[check_after_deref]
// coverity[check_after_deref] - confusing but correct
if (m_pPrimaryWriteCache)
{
m_aPrimaryReadCache.takeOver(*m_pPrimaryWriteCache);
......@@ -1161,7 +1161,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_save(bool bPreferred)
// take over all changes into the original container
SolarMutexGuard g;
// coverity[check_after_deref]
// coverity[check_after_deref] - confusing but correct
if (m_pSecondaryWriteCache)
{
m_aSecondaryReadCache.takeOver(*m_pSecondaryWriteCache);
......
......@@ -2115,7 +2115,7 @@ at_least_one_scoped_name :
} else
{
std::list< OString >* pScopedNames = new std::list< OString >;
// coverity [copy_paste_error]
// coverity[copy_paste_error] - this is not a cut and paste
pScopedNames->push_back(*$1);
$$ = pScopedNames;
}
......
......@@ -287,13 +287,13 @@ static LibreOfficeKit *lok_init_2( const char *install_path, const char *user_p
}
free( imp_lib );
// dlhandle is "leaked"
// coverity[leaked_storage]
// coverity[leaked_storage] - on purpose
return pSym( install_path );
}
free( imp_lib );
// dlhandle is "leaked"
// coverity[leaked_storage]
// coverity[leaked_storage] - on purpose
return pSym2( install_path, user_profile_url );
#else
return libreofficekit_hook_2( install_path, user_profile_url );
......@@ -330,7 +330,7 @@ int lok_preinit( const char *install_path, const char *user_profile_url )
free( imp_lib );
// dlhandle is "leaked"
// coverity[leaked_storage]
// coverity[leaked_storage] - on purpose
return pSym( install_path, user_profile_url );
}
#endif
......
......@@ -324,8 +324,7 @@ void dumpType(typereg::Reader const & reader, OString const & indent) {
printf(
"%s parameter count: %u\n", indent.getStr(),
static_cast< unsigned int >(reader.getMethodParameterCount(i)));
// coverity[tainted_data] cid#1215304 unhelpfully warns about an
// untrusted loop bound here:
// coverity[tainted_data] - cid#1215304 unhelpfully warns about untrusted loop bound
for (sal_uInt16 j = 0; j < reader.getMethodParameterCount(i); ++j)
{
printf(
......@@ -366,8 +365,7 @@ void dumpType(typereg::Reader const & reader, OString const & indent) {
printf(
"%s exception count: %u\n", indent.getStr(),
static_cast< unsigned int >(reader.getMethodExceptionCount(i)));
// coverity[tainted_data] cid#1215304 unhelpfully warns about an
// untrusted loop bound here:
// coverity[tainted_data] - cid#1215304 unhelpfully warns about untrusted loop bound
for (sal_uInt16 j = 0; j < reader.getMethodExceptionCount(i); ++j)
{
printf(
......
......@@ -1134,10 +1134,10 @@ const off_t MAX_OFF_T = std::numeric_limits< off_t >::max();
namespace {
//coverity[result_independent_of_operands]
// coverity[result_independent_of_operands] - crossplatform requirement
template<typename T> bool exceedsMaxOffT(T n) { return n > MAX_OFF_T; }
//coverity[result_independent_of_operands]
// coverity[result_independent_of_operands] - crossplatform requirement
template<typename T> bool exceedsMinOffT(T n)
{ return n < std::numeric_limits<off_t>::min(); }
......
......@@ -287,10 +287,11 @@ oslPipe osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions Options,
if (listen(pPipe->m_Socket, 5) < 0)
{
SAL_WARN("sal.osl.pipe", "listen() failed: " << strerror(errno));
// coverity[toctou] cid#1255391 warns about unlink(name) after
// stat(name, &status) above, but the intervening call to bind makes
// those two clearly unrelated, as it would fail if name existed at
// that point in time:
// cid#1255391 warns about unlink(name) after stat(name, &status)
// above, but the intervening call to bind makes those two clearly
// unrelated, as it would fail if name existed at that point in
// time:
// coverity[toctou] - this is bogus
unlink(name); /* remove filesystem entry */
close(pPipe->m_Socket);
destroyPipeImpl(pPipe);
......
......@@ -776,7 +776,7 @@ oslFileError SAL_CALL osl_closeFile(oslFileHandle Handle)
namespace {
//coverity[result_independent_of_operands]
// coverity[result_independent_of_operands] - crossplatform requirement
template<typename T> bool exceedsMaxSIZE_T(T n)
{ return n > std::numeric_limits< SIZE_T >::max(); }
......@@ -930,7 +930,7 @@ LONGLONG const g_limit_longlong = std::numeric_limits< LONGLONG >::max();
namespace {
//coverity[result_independent_of_operands]
// coverity[result_independent_of_operands] - crossplatform requirement
template<typename T> bool exceedsMaxLONGLONG(T n)
{ return n > g_limit_longlong; }
......
......@@ -258,7 +258,7 @@ void rtl_arena_hash_rescale(
rtl_arena_segment_type * next = curr->m_fnext;
rtl_arena_segment_type ** head;
// coverity[negative_shift]
// coverity[negative_shift] - bogus
head = &(arena->m_hash_table[RTL_ARENA_HASH_INDEX(arena, curr->m_addr)]);
curr->m_fnext = (*head);
(*head) = curr;
......
......@@ -817,7 +817,7 @@ void rtl_cache_deactivate(rtl_cache_type * cache)
/* cleanup cpu layer */
if ((mag = cache->m_cpu_curr))
{
// coverity[missing_lock]
// coverity[missing_lock] - locking is fine
cache->m_cpu_curr = nullptr;
rtl_cache_magazine_clear (cache, mag);
rtl_cache_free (mag_cache, mag);
......@@ -825,7 +825,7 @@ void rtl_cache_deactivate(rtl_cache_type * cache)
if ((mag = cache->m_cpu_prev))
{
// coverity[missing_lock]
// coverity[missing_lock] - locking is fine
cache->m_cpu_prev = nullptr;
rtl_cache_magazine_clear (cache, mag);
rtl_cache_free (mag_cache, mag);
......@@ -1267,7 +1267,7 @@ static void rtl_cache_depot_wsupdate(
RTL_MEMORY_LOCK_ACQUIRE(&(cache->m_depot_lock));
}
}
// coverity[missing_unlock]
// coverity[missing_unlock] - locking is fine
}
/**
......
......@@ -77,7 +77,7 @@ void DeleteItemOnIdle(SfxPoolItem* pItem)
DBG_ASSERT( 0 == pItem->GetRefCount(), "deleting item in use" );
SfxItemDisruptor_Impl *pDesruptor = new SfxItemDisruptor_Impl(pItem);
pDesruptor->LaunchDeleteOnIdle();
// coverity[leaked_storage] pDesruptor takes care of its own destruction at idle time
// coverity[leaked_storage] - pDesruptor takes care of its own destruction at idle time
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -465,7 +465,7 @@ static OString lcl_ConvertCharToHTML( sal_uInt32 c,
// If the character could not be converted to the destination
// character set, the UNICODE character is exported as character
// entity.
// coverity[callee_ptr_arith]
// coverity[callee_ptr_arith] - its ok
nLen = lcl_FlushContext(rContext, cBuffer, nFlags);
sal_Char *pBuffer = cBuffer;
while( nLen-- )
......
......@@ -259,9 +259,9 @@ rtl::Reference< Entity > readEntity(
{
sal_uInt16 m
= reader.getMethodExceptionCount(k);
// coverity[tainted_data] cid#1213376
// unhelpfully warns about an untrusted loop
// bound here:
// cid#1213376 unhelpfully warns about an
// untrusted loop bound here:
// coverity[tainted_data] - trusted data source
for (sal_uInt16 l = 0; l != m; ++l) {
getExcs.push_back(
reader.getMethodExceptionTypeName(k, l).
......@@ -273,9 +273,9 @@ rtl::Reference< Entity > readEntity(
{
sal_uInt16 m
= reader.getMethodExceptionCount(k);
// coverity[tainted_data] cid#1213376
// unhelpfully warns about an untrusted loop
// bound here:
// cid#1213376 unhelpfully warns about an
// untrusted loop bound here:
// coverity[tainted_data] - trusted data source
for (sal_uInt16 l = 0; l != m; ++l) {
setExcs.push_back(
reader.getMethodExceptionTypeName(k, l).
......@@ -309,8 +309,9 @@ rtl::Reference< Entity > readEntity(
std::vector< InterfaceTypeEntity::Method::Parameter >
params;
sal_uInt16 m = reader.getMethodParameterCount(j);
// coverity[tainted_data] cid#1213376 unhelpfully warns
// about an untrusted loop bound here:
// cid#1213376 unhelpfully warns about an untrusted loop
// bound here:
// coverity[tainted_data] - trusted data source
for (sal_uInt16 k = 0; k != m; ++k) {
RTParamMode mode = reader.getMethodParameterFlags(j, k);
InterfaceTypeEntity::Method::Parameter::Direction dir;
......@@ -342,8 +343,9 @@ rtl::Reference< Entity > readEntity(
}
std::vector< OUString > excs;
m = reader.getMethodExceptionCount(j);
// coverity[tainted_data] cid#1213376 unhelpfully warns
// about an untrusted loop bound here:
// cid#1213376 unhelpfully warns about an untrusted loop
// bound here:
// coverity[tainted_data] - trusted data source
for (sal_uInt16 k = 0; k != m; ++k) {
excs.push_back(
reader.getMethodExceptionTypeName(j, k).replace(
......@@ -607,8 +609,9 @@ rtl::Reference< Entity > readEntity(
SingleInterfaceBasedServiceEntity::Constructor::
Parameter > params;
sal_uInt16 m = reader.getMethodParameterCount(j);
// coverity[tainted_data] cid#1213376 unhelpfully warns
// about an untrusted loop bound here:
// cid#1213376 unhelpfully warns about an untrusted
// loop bound here:
// coverity[tainted_data] - trusted data source
for (sal_uInt16 k = 0; k != m; ++k) {
RTParamMode mode
= reader.getMethodParameterFlags(j, k);
......@@ -647,8 +650,9 @@ rtl::Reference< Entity > readEntity(
}
std::vector< OUString > excs;
m = reader.getMethodExceptionCount(j);
// coverity[tainted_data] cid#1213376 unhelpfully warns
// about an untrusted loop bound here:
// cid#1213376 unhelpfully warns about an untrusted
// loop bound here:
// coverity[tainted_data] - trusted data source
for (sal_uInt16 k = 0; k != m; ++k) {
excs.push_back(
reader.getMethodExceptionTypeName(j, k).replace(
......
......@@ -78,7 +78,7 @@ void OfficeConnection::setUp() {
{
envs = &argEnv.pData;
}
// coverity[callee_ptr_arith]
// coverity[callee_ptr_arith] - arith is fine
CPPUNIT_ASSERT_EQUAL(
osl_Process_E_None,
osl_executeProcess(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment