Examples of errors detected by the V530 diagnostic
V530. Return value of 'Foo' function is required to be used.
TortoiseSVN
V530 The return value of function 'empty' is required to be utilized. contextmenu.cpp 434
STDMETHODIMP CShellExt::Initialize(....)
{
....
ignoredprops.empty();
for (int p=0; p<props.GetCount(); ++p)
{
if (props.GetItemName(p).
compare(SVN_PROP_IGNORE)==0)
{
std::string st = props.GetItemValue(p);
ignoredprops = UTF8ToWide(st.c_str());
// remove all escape chars ('\\')
std::remove(ignoredprops.begin(),
ignoredprops.end(), '\\');
break;
}
}
....
}
The std::remove function does not remove elements from the container. It only shifts the elements and brings the iterator back to the beginning of the trash. Suppose we have the vector<int> container that contains elements 1,2,3,1,2,3,1,2,3. If we execute the code "remove( v.begin(), v.end(), 2 )", the container will contain elements 1,3,1,3,?,?,?, where ? is some trash. The function will bring the iterator back to the first senseless element, so if we want to remove these trash elements, we must write the code this way: "v.erase(remove(v.begin(), v.end(), 2), v.end())".
Similar errors can be found in some other places:
- V530 The return value of function 'remove' is required to be utilized. contextmenu.cpp 442
TortoiseSVN
V530 The return value of function 'empty' is required to be utilized. mailmsg.cpp 40
CMailMsg& CMailMsg::SetFrom(string sAddress,
string sName)
{
if (initIfNeeded())
{
// only one sender allowed
if (m_from.size())
m_from.empty();
m_from.push_back(TStrStrPair(sAddress,sName));
}
return *this;
}
This is what should have been written here: m_from.clear();
TortoiseSVN
V530 The return value of function 'empty' is required to be utilized. mailmsg.cpp 54
CMailMsg& CMailMsg::SetTo(string sAddress,
string sName)
{
if (initIfNeeded())
{
// only one recipient allowed
if (m_to.size())
m_to.empty();
m_to.push_back(TStrStrPair(sAddress,sName));
}
return *this;
}
This is what should have been written here: m_to.clear();
WinMerge
V530 The return value of function 'empty' is required to be utilized. diractions.cpp 1312
/**
* @brief Get the file names on both sides for specified item.
* @note Return empty strings if item is special item.
*/
void CDirView::GetItemFileNames(int sel,
String& strLeft, String& strRight) const
{
UINT_PTR diffpos = GetItemKey(sel);
if (diffpos == (UINT_PTR)SPECIAL_ITEM_POS)
{
strLeft.empty();
strRight.empty();
}
else
{
....
}
}
This is what should have been written here: strLeft.clear(); strRight.clear();
WinMerge
V530 The return value of function 'empty' is required to be utilized. varprop.cpp 133
/**
* @brief Clear variant's value (reset to defaults).
*/
void VariantValue::Clear()
{
m_vtype = VT_NULL;
m_bvalue = false;
m_ivalue = 0;
m_fvalue = 0;
m_svalue.empty();
m_tvalue = 0;
}
This is what should have been written here: m_svalue.clear();
EchoVNC
V530 The return value of function 'empty' is required to be utilized. miniWinVNC parsecmdline.cpp 367
bool CParseCmdLine::CheckParameter(..., std::string& rStrForSave)
{
....
rStrForSave.empty();
....
}
This is what should have been written here: rStrForSave.clear();
EchoVNC
V530 The return value of function 'empty' is required to be utilized. AskParameter wndproc.cpp 163
struct ST_DATA
{
....
std::string m_szImagePath;
....
};
void Install_and_Run_MainFiles(const char* szPath)
{
....
if (!WriteTmpBanner(ser, szPath))
{
ser.m_data.m_szImagePath.empty();
}
....
}
This is what should have been written here: ser.m_data.m_szImagePath.clear();
IPP Samples
V530 The return value of function 'remove' is required to be utilized. h264_dec umc_h264_thread.cpp 226
void H264ThreadGroup::RemoveThread(H264Thread * thread)
{
AutomaticUMCMutex guard(m_mGuard);
std::remove(m_threads.begin(), m_threads.end(), thread);
}
The std::remove function does not remove elements from the container. It only shifts the elements and brings the iterator back to the beginning of the trash. Suppose we have the vector<int> container that contains elements 1,2,3,1,2,3,1,2,3. If we execute the code "remove( v.begin(), v.end(), 2 )", the container will contain elements 1,3,1,3,?,?,?, where ? is some trash. The function will bring the iterator back to the first senseless element, so if we want to remove these trash elements, we must write the code this way: "v.erase(remove(v.begin(), v.end(), 2), v.end())".
Nmap Security Scanner
V530 The return value of function 'empty' is required to be utilized. nping nepcontext.cc 562
/** Deletes all previous field specifiers.
* This should be used when dealing
* with clients that send multiple NEP_PACKET_SPEC messages,
* so only the last PacketSpec is taken into account. */
int NEPContext::resetClientFieldSpecs(){
this->fspecs.empty();
return OP_SUCCESS;
} /* End of resetClientFieldSpecs() */
What a nice comment. It's a pity that the code does quite a different thing. This is what should have been written here: this->fspecs.clear();
Chromium
V530 The return value of function 'empty' is required to be utilized. chrome_frame_ie protocol_sink_wrap.cc 399
std::wstring url_;
HRESULT ProtData::ReportProgress(IInternetProtocolSink* delegate,
ULONG status_code,
LPCWSTR status_text)
{
....
case BINDSTATUS_REDIRECTING:
url_.empty();
if (status_text)
url_ = status_text;
break;
....
}
This is what should have been written here: url_.clear();
Chromium
V530 The return value of function 'empty' is required to be utilized. chrome_frame_npapi np_proxy_service.cc 293
bool NpProxyService::GetProxyValueJSONString(std::string* output)
{
DCHECK(output);
output->empty();
....
}
This is what should have been written here: output->clear();
Intel AMT SDK
V530 The return value of function 'empty' is required to be utilized. AMTredirection mcsol.cpp 443
bool MCSOL::_createHTLink()
{
....
string HTcmd = TERM_CMD;
....
HTcmd.empty();
....
}
This is what should have been written here: HTcmd.clear();
Intel AMT SDK
V530 The return value of function 'empty' is required to be utilized. EventLogReader cimclass.h 153
void CimClassContainer::Clear()
{
for(unsigned int i = 0; i < vec.size(); i++)
{
delete vec[i];
vec[i] = NULL;
}
vec.empty();
}
This is what should have been written here: vec.clear();
ReactOS
V530 The return value of function 'wcscmp' is required to be utilized. msdmo dmoreg.c 617
if (ERROR_SUCCESS == hres)
{
Names[count] = HeapAlloc(GetProcessHeap(), 0,
strlenW(szValue) + 1);
if (Names[count])
strcmpW(Names[count], szValue);
}
It's strange that the result of calling the strcmpW() function is not used in any way.
Battle for Wesnoth
V530 The return value of function 'back' is required to be utilized. wesnoth menu_events.cpp 91
gui::dialog_button_action::RESULT
delete_recall_unit::button_pressed(int menu_selection)
{
const std::vector<std::pair<int, int> >& param =
std::vector<std::pair<int, int> >();
param.back();
const size_t index = size_t(filter_.get_index(menu_selection));
....
}
It's strange that the result of calling the param.back() function is not used in any way.
wxWidgets
V530 The return value of function 'empty' is required to be utilized. base translation.cpp 989
bool wxMsgCatalogFile::LoadData(....)
{
....
wxString m_charset;
....
if ( m_charset == wxS("CHARSET") )
{
m_charset.empty();
}
....
}
This is what should have been written here: m_charset.clear();
wxWidgets
V530 The return value of function 'empty' is required to be utilized. base registry.cpp 329
wxString m_strKey;
void wxRegKey::SetHkey(WXHKEY hKey)
{
....
// reset old data
m_strKey.empty();
m_dwLastError = 0;
}
This is what should have been written here: m_strKey.clear();
Visualization Toolkit (VTK)
V530 The return value of function 'empty' is required to be utilized. vtkRendering vtklabelhierarchy.cxx 425
std::vector<int> Path;
void vtkLabelHierarchyFrustumIterator::Next()
{
....
this->Path.empty();
....
}
This is what should have been written here: this->Path.clear();
MongoDB
V530 The return value of function 'remove' is required to be utilized. cmdline.cpp 106
void CmdLine::parseConfigFile( istream &f, stringstream &ss ) {
....
f.getline(line, MAX_LINE_LENGTH);
s = line;
std::remove(s.begin(), s.end(), ' ');
std::remove(s.begin(), s.end(), '\t');
boost::to_upper(s);
....
}
The std::remove function does not remove elements from the container. It only shifts the elements and brings the iterator back to the beginning of the trash. Suppose we have the vector<int> container that contains elements 1,2,3,1,2,3,1,2,3. If we execute the code "remove( v.begin(), v.end(), 2 )", the container will contain elements 1,3,1,3,?,?,?, where ? is some trash. The function will bring the iterator back to the first senseless element, so if we want to remove these trash elements, we must write the code this way: "v.erase(remove(v.begin(), v.end(), 2), v.end())".
Similar errors can be found in some other places:
- V530 The return value of function 'remove' is required to be utilized. cmdline.cpp 107
ReactOS
V530 The return value of function 'wcscmp' is required to be utilized. dmoreg.c 621
#define strcmpW(s1,s2) wcscmp((s1),(s2))
static HRESULT WINAPI IEnumDMO_fnNext(....)
{
....
if (Names[count])
strcmpW(Names[count], szValue);
....
}
Chromium
V530 The return value of function 'remove_if' is required to be utilized. shortcuts_provider.cc 136
void ShortcutsProvider::DeleteMatchesWithURLs(
const std::set<GURL>& urls)
{
std::remove_if(matches_.begin(),
matches_.end(),
RemoveMatchPredicate(urls));
listener_->OnProviderUpdate(true);
}
Multi Theft Auto
V530 The return value of function 'empty' is required to be utilized. cperfstat.functiontiming.cpp 197
std::map < SString, SFunctionTimingInfo > m_TimingMap;
void CPerfStatFunctionTimingImpl::DoPulse ( void )
{
....
// Do nothing if not active
if ( !m_bIsActive )
{
m_TimingMap.empty ();
return;
}
....
}
Multi Theft Auto
V530 The return value of function 'empty' is required to be utilized. cclientcolsphere.cpp 34
void CreateSphereFaces (
std::vector < SFace >& faceList, int iIterations )
{
int numFaces = (int)( pow ( 4.0, iIterations ) * 8 );
faceList.empty ();
faceList.reserve ( numFaces );
....
}
Similar errors can be found in some other places:
- V530 The return value of function 'empty' is required to be utilized. cresource.cpp 132
- V530 The return value of function 'empty' is required to be utilized. cresource.cpp 139
- V530 The return value of function 'empty' is required to be utilized. cresource.cpp 147
Trans-Proteomic Pipeline
V530 The return value of function 'empty' is required to be utilized. tag.cxx 72
static void clearTagNames() {
std::vector<const char *>ptrs;
for (tagname_set::iterator i = tagnames.begin();
i!=tagnames.end();i++) {
ptrs.push_back(*i);
}
for (tagname_set::iterator j = attrnames.begin();
j!=attrnames.end();j++) {
ptrs.push_back(*j);
}
tagnames.empty();
attrnames.empty();
for (size_t n=ptrs.size();n--;) {
delete [] (char *)(ptrs[n]); // cast away const
}
}
Similar errors can be found in some other places:
- V530 The return value of function 'empty' is required to be utilized. tag.cxx 73
QuantLib
V530 The return value of function 'empty' is required to be utilized. commoditycurve.cpp 70
void CommodityCurve::setPrices(std::map<Date, Real>& prices) {
QL_REQUIRE(prices.size()>1, "too few prices");
dates_.empty();
data_.empty();
for (std::map<Date, Real>::const_iterator i = prices.begin();
i != prices.end(); i++)
{
dates_.push_back(i->first);
data_.push_back(i->second);
}
....
}
This is what should have been written here: dates_.clear(); data_.clear();
Similar errors can be found in some other places:
- V530 The return value of function 'empty' is required to be utilized. commoditycurve.cpp 71
QuantLib
V530 The return value of function 'empty' is required to be utilized. energycommodity.cpp 152
void EnergyCommodity::calculateSecondaryCostAmounts(
const CommodityType& commodityType,
Real totalQuantityValue,
const Date& evaluationDate) const
{
secondaryCostAmounts_.empty();
....
}
QuantLib
V530 The return value of function 'remove' is required to be utilized. recursivecdoengine.hpp 172
template <class CDOEngine, class copulaT>
void RecursiveCdoEngine<CDOEngine, copulaT>::initialize() const {
....
std::remove(lgds.begin(), lgds.end(), 0.);
....
}
The std::remove function does not remove elements from the container. It only shifts the elements and brings the iterator back to the beginning of the trash. Suppose we have the vector<int> container that contains elements 1,2,3,1,2,3,1,2,3. If we execute the code "remove( v.begin(), v.end(), 2 )", the container will contain elements 1,3,1,3,?,?,?, where ? is some trash. The function will bring the iterator back to the first senseless element, so if we want to remove these trash elements, we must write the code this way: "lgds.erase(std::remove(lgds.begin(), lgds.end(), 0.), lgds.end());".
Firebird
V530 The return value of function 'fgetpos' is required to be utilized. inputdevices.cpp 118
void InputDevices::indev::getPos(fpos_t* out) const
{
fb_assert(out);
fb_assert(indev_fpointer);
fgetpos(indev_fpointer, out);
}
Synergy
V530 The return value of function 'empty' is required to be utilized. cipcserver.cpp 69
typedef std::list<CIpcClientProxy*> CClientList;
CClientList m_clients;
CIpcServer::~CIpcServer()
{
....
m_clients.empty();
....
}
Micro-Manager
V530 The return value of function 'c_str' is required to be utilized. ZeissCAN.cpp 1553
int HalogenLamp::SetIntensity(long intensity)
{
....
command_stream.str().c_str();
....
}
Similar errors can be found in some other places:
- V530 The return value of function 'c_str' is required to be utilized. ZeissCAN.cpp 2800
Unreal Engine 4
V530 The return value of function 'Memcmp' is required to be utilized. d3d11statecacheprivate.h 547
D3D11_STATE_CACHE_INLINE void GetBlendState(
ID3D11BlendState** BlendState, float BlendFactor[4],
uint32* SampleMask)
{
....
FMemory::Memcmp(BlendFactor, CurrentBlendFactor,
sizeof(CurrentBlendFactor));
....
}
This is what should have been written here: FMemory::Memcpy
Qt
V530 The return value of function 'toLower' is required to be utilized. main.cpp 72
int main(int argc, char **argv)
{
....
QByteArray arg(argv[a]);
....
arg = arg.mid(1);
arg.toLower();
if (arg == "o")
....
}
Similar errors can be found in some other places:
- V530 The return value of function 'toLower' is required to be utilized. main.cpp 1522
ITK
V530 The return value of function 'empty' is required to be utilized. itkpatchbaseddenoisingimagefilter.hxx 85
template <typename TInputImage, typename TOutputImage>
void
PatchBasedDenoisingImageFilter<TInputImage, TOutputImage>
::EmptyCaches()
{
for (unsigned int threadId = 0;
threadId < m_ThreadData.size(); ++threadId)
{
SizeValueType cacheSize = ....;
for (SizeValueType c = 0; c < cacheSize; ++c)
{
delete m_ThreadData[threadId].eigenValsCache[c];
delete m_ThreadData[threadId].eigenVecsCache[c];
}
m_ThreadData[threadId].eigenValsCache.empty();
m_ThreadData[threadId].eigenVecsCache.empty();
}
}
Similar errors can be found in some other places:
- V530 The return value of function 'empty' is required to be utilized. itkpatchbaseddenoisingimagefilter.hxx 86
ITK
V530 The return value of function 'remove' is required to be utilized. itkge5imageio.cxx 297
GEImageHeader *
GE5ImageIO::ReadHeader(const char *FileNameToRead)
{
....
std::string tmpId(buffer+VOff(84,88), 13);
std::remove(tmpId.begin(), tmpId.end(), '-');
....
}
ITK
V530 The return value of function 'empty' is required to be utilized. itkvideofilewriter.hxx 334
std::vector<SizeValueType> m_Dimensions;
template< typename TInputVideoStream >
bool
VideoFileWriter< TInputVideoStream >
::InitializeOutputParameters()
{
....
m_Dimensions.empty();
....
}
Spring Engine
V530 The return value of function 'size' is required to be utilized. assimp b3dimporter.cpp 536
void B3DImporter::ReadBB3D( aiScene *scene ){
_textures.clear();
_materials.size(); // <=
_vertices.clear();
_meshes.clear();
....
}
Doxygen
V530 The return value of function 'toupper' is required to be utilized. classdef.cpp 1963
int toupper (int __c);
void ClassDef::writeDocumentationContents(....)
{
QCString pageType = " ";
pageType += compoundTypeString();
toupper(pageType.at(1));
....
}
FreeSWITCH
V530 The return value of function 'LoadLibraryExA' is required to be utilized. switch_dso.c 42
SWITCH_DECLARE(switch_dso_lib_t) switch_dso_open(....)
{
HINSTANCE lib;
lib = LoadLibraryEx(path, NULL, 0);
if (!lib) {
LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
}
if (!lib) {
DWORD error = GetLastError();
*err = switch_mprintf("dll open error [%ul]\n", error);
}
return lib;
}
Mozilla Thunderbird
V530 The return value of function 'getenv' is required to be utilized. nswindowswmain.cpp 134
int wmain(int argc, WCHAR **argv)
{
....
// Force creation of the multibyte _environ variable.
getenv("PATH");
int result = main(argc, argvConverted, _environ);
....
}
Wine Is Not an Emulator
V530 The return value of function 'DSCF_AddRef' is required to be utilized. dsound_main.c 760
static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface)
{
return 2;
}
HRESULT WINAPI DllGetClassObject(....)
{
....
while (NULL != DSOUND_CF[i].rclsid) {
if (IsEqualGUID(rclsid, DSOUND_CF[i].rclsid)) {
DSCF_AddRef(&DSOUND_CF[i].IClassFactory_iface); // <=
*ppv = &DSOUND_CF[i];
return S_OK;
}
i++;
}
....
}
Computational Network Toolkit
V530 The return value of function 'empty' is required to be utilized. utterancesourcemulti.h 340
template <class UTTREF>
std::vector<shiftedvector<....>>getclassids(const UTTREF &uttref)
{
std::vector<shiftedvector<....>> allclassids;
allclassids.empty(); // <=
....
}
Similar errors can be found in some other places:
- V530 The return value of function 'empty' is required to be utilized. utterancesourcemulti.h 364
OpenToonz
V530 The return value of function 'toUpper' is required to be utilized. sceneviewerevents.cpp 847
void SceneViewer::keyPressEvent(QKeyEvent *event)
{
....
QString text = event->text();
if ((event->modifiers() & Qt::ShiftModifier))
text.toUpper();
....
}
Similar errors can be found in some other places:
- V530 The return value of function 'left' is required to be utilized. tfarmserver.cpp 569
- V530 The return value of function 'ftell' is required to be utilized. tiio_bmp.cpp 804
- V530 The return value of function 'accumulate' is required to be utilized. bendertool.cpp 374
ReactOS
V530 The return value of function 'GetWindow' is required to be utilized. oleobject.c 113
#define IOleInPlaceSite_GetWindow(This,phwnd)\
( (This)->lpVtbl -> GetWindow(This,phwnd) )
static void create_shell_embedding_hwnd(WebBrowser *This)
{
HWND parent = NULL;
....
if(SUCCEEDED(hres)) {
IOleInPlaceSite_GetWindow(inplace, &parent); // <=
IOleInPlaceSite_Release(inplace);
}
....
}
Similar errors can be found in some other places:
- V530 The return value of function 'GetWindow' is required to be utilized. oleobject.c 185
Open X-Ray Engine
V530 The return value of function 'empty' is required to be utilized. actor_network.cpp 657
BOOL CActor::net_Spawn(CSE_Abstract* DC)
{
....
m_States.empty();
....
}
Similar errors can be found in some other places:
- V530 The return value of function 'unique' is required to be utilized. uidragdroplistex.cpp 780
Casablanca
V530 The return value of function 'release' is required to be utilized. cpprestsdk140 http_server_api.cpp 64
std::unique_ptr<http_server>
http_server_api::s_server_api((http_server*)nullptr);
void http_server_api::unregister_server_api()
{
pplx::extensibility::scoped_critical_section_t lock(s_lock);
if (http_server_api::has_listener())
{
throw http_exception(_XPLATSTR("Server API ..... attached"));
}
s_server_api.release();
}
CodeLite
V530 The return value of function 'empty' is required to be utilized. tokenizer.cpp 56
StringTokenizer::StringTokenizer(const wxString& str,
const wxString& strDelimiter,
const bool &bAllowEmptyTokens /* false */)
{
....
wxString token;
while( nEnd != -1 )
{
if( nEnd != nStart)
token = str.substr(nStart, nEnd-nStart);
else
token.empty(); // <=
if(!token.empty())
m_tokensArr.push_back(token);
....
}
}
LLVM/Clang
V530 The return value of function 'release' is required to be utilized. VerifyDiagnosticConsumer.cpp 46
std::unique_ptr<DiagnosticConsumer> takeClient()
{ return std::move(Owner); }
VerifyDiagnosticConsumer::~VerifyDiagnosticConsumer() {
....
SrcManager = nullptr;
CheckDiagnostics();
Diags.takeClient().release();
}
CryEngine V
V530 The return value of function 'release' is required to be utilized. ClipVolumes.cpp 492
vector<unique_ptr<CFullscreenPass>> m_jitteredDepthPassArray;
void CClipVolumesStage::PrepareVolumetricFog()
{
....
for (int32 i = 0; i < m_jitteredDepthPassArray.size(); ++i)
{
m_jitteredDepthPassArray[i].release();
}
m_jitteredDepthPassArray.resize(depth);
for (int32 i = 0; i < depth; ++i)
{
m_jitteredDepthPassArray[i] = CryMakeUnique<....>();
m_jitteredDepthPassArray[i]->SetViewport(viewport);
m_jitteredDepthPassArray[i]->SetFlags(....);
}
....
}
Scilab
V530 The return value of function 'back' is required to be utilized. sci_mscanf.cpp 274
types::Function::ReturnValue sci_mscanf(....)
{
....
std::vector<types::InternalType*> pITTemp = std::vector<...>();
....
case types::InternalType::ScilabString :
{
....
pITTemp.pop_back(); // <=
pITTemp.push_back(pType);
}
break;
case types::InternalType::ScilabDouble :
{
....
pITTemp.back(); // <= ???
pITTemp.push_back(pType);
}
break;
....
}
Audacity
V530 The return value of function 'remove' is required to be utilized. OverlayPanel.cpp 31
bool OverlayPanel::RemoveOverlay(Overlay *pOverlay)
{
const size_t oldSize = mOverlays.size();
std::remove(mOverlays.begin(), mOverlays.end(), pOverlay);
return oldSize != mOverlays.size();
}
Audacity
V530 The return value of function 'Left' is required to be utilized. ASlider.cpp 973
wxString LWSlider::GetTip(float value) const
{
wxString label;
if (mTipTemplate.IsEmpty())
{
wxString val;
switch(mStyle)
{
case FRAC_SLIDER:
val.Printf(wxT("%.2f"), value);
break;
case DB_SLIDER:
val.Printf(wxT("%+.1f dB"), value);
if (val.Right(1) == wxT("0"))
{
val.Left(val.Length() - 2); // <=
}
break;
....
}
wxString Left (size_t count) const
Ardour
V530 The return value of function 'unique' is required to be utilized. audio_library.cc 162
void
AudioLibrary::search_members_and (vector<string>& members,
const vector<string>& tags)
{
....
sort(members.begin(), members.end());
unique(members.begin(), members.end());
....
}
sort(members.begin(), members.end()); auto last = unique(members.begin(), members.end()); v.erase(last, members.end());
Chromium
V530 CWE-252 The return value of function 'remove_if' is required to be utilized. pdf_to_emf_converter.cc 44
void OnConvertedClientDisconnected() {
// We have no direct way of tracking which
// PdfToEmfConverterClientPtr got disconnected as it is a
// movable type, short of using a wrapper.
// Just traverse the list of clients and remove the ones
// that are not bound.
std::remove_if(
g_converter_clients.Get().begin(),
g_converter_clients.Get().end(),
[](const mojom::PdfToEmfConverterClientPtr& client) {
return !client.is_bound();
});
}
A function remove_if deletes nothing, but only rearranges the elements in a container.
Android
V530 CWE-252 The return value of function 'bswap32' is required to be utilized. ELFAttribute.cpp 84
inline uint32_t bswap32(uint32_t pData) {
return
(((pData & 0xFF000000) >> 24) | ((pData & 0x00FF0000) >> 8) |
((pData & 0x0000FF00) << 8) | ((pData & 0x000000FF) << 24));
}
bool ELFAttribute::merge(....) {
....
uint32_t subsection_length =
*reinterpret_cast<const uint32_t*>(subsection_data);
if (llvm::sys::IsLittleEndianHost !=
m_Config.targets().isLittleEndian())
bswap32(subsection_length); // <=
....
}
Similar errors can be found in some other places:
- V530 CWE-252 The return value of function 'bswap32' is required to be utilized. ELFAttribute.cpp 218
- V530 CWE-252 The return value of function 'bswap32' is required to be utilized. ELFAttribute.cpp 346
- V530 CWE-252 The return value of function 'bswap32' is required to be utilized. ELFAttribute.cpp 352
ANGLE
V530 CWE-252 The return value of function 'release' is required to be utilized. error.inl 52
class Error final
{
....
mutable std::unique_ptr<std::string> mMessage;
};
Error &Error::operator=(const Error &other)
{
mCode = other.mCode;
mID = other.mID;
if (other.mMessage)
{
createMessageString();
*mMessage = *(other.mMessage);
}
else
{
mMessage.release();
}
return *this;
}
Similar errors can be found in some other places:
- V530 CWE-252 The return value of function 'release' is required to be utilized. error.inl 126
Qt
V530 CWE-252 The return value of function 'InitializeAcl' is required to be utilized. qlocalserver_win.cpp 144
bool QLocalServerPrivate::addListener()
{
....
InitializeAcl(acl, aclSize, ACL_REVISION_DS);
....
}
Qt
V530 CWE-252 The return value of function 'SetSecurityDescriptorOwner' is required to be utilized. qlocalserver_win.cpp 167
bool QLocalServerPrivate::addListener()
{
....
SetSecurityDescriptorOwner(pSD.data(), pTokenUser->User.Sid, FALSE);
SetSecurityDescriptorGroup(pSD.data(), pTokenGroup->PrimaryGroup, FALSE);
....
}
Similar errors can be found in some other places:
- V530 CWE-252 The return value of function 'SetSecurityDescriptorGroup' is required to be utilized. qlocalserver_win.cpp 168
LibreOffice
V530 The return value of function 'SysAllocString' is required to be utilized. maccessible.cxx 1077
STDMETHODIMP CMAccessible::put_accValue(....)
{
....
if(varChild.lVal==CHILDID_SELF)
{
SysAllocString(m_pszValue);
m_pszValue=SysAllocString(szValue);
return S_OK;
}
....
}
Haiku Operation System
V530 The return value of function 'begin' is required to be utilized. IMAPFolder.cpp 414
void
IMAPFolder::RegisterPendingBodies(...., const BMessenger* replyTo)
{
....
IMAP::MessageUIDList::const_iterator iterator = uids.begin();
for (; iterator != uids.end(); iterator++) {
if (replyTo != NULL)
fPendingBodies[*iterator].push_back(*replyTo);
else
fPendingBodies[*iterator].begin(); // <=
}
}
Blender
V530 The return value of function 'clamp' is required to be utilized. BLI_math_vector.hh 88
template <typename T, int Size>
inline vec_base<T, Size>
clamp(const vec_base<T, Size> &a, const T &min, const T &max)
{
vec_base<T, Size> result = a;
for (int i = 0; i < Size; i++) {
std::clamp(result[i], min, max);
}
return result;
}
Ogre3D
V530 The return value of function 'back' is required to be utilized. OgreGLXConfigDialog.cpp 410
class GLXConfigurator
{
public:
// ....
std::list<ConfigCallbackData> mConfigCallbackData
// ....
}
void GLXConfigurator::SetRenderer(RenderSystem *r)
// ....
mConfigCallbackData.back();
// ....
}
Here, for some reason, we call the back function of the std::list container to get a reference to the last element. However, we do not use or save this reference.