<< Return to list of all diagnostics
V530. The return value of function 'Foo' is required to be utilized.
TortoiseSVN
V530 The return value of function 'empty' is required to be utilized. contextmenu.cpp 434
V530 The return value of function 'remove' is required to be utilized. contextmenu.cpp 442
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())".
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
/**
* @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
/**
* @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
V530 The return value of function 'remove' is required to be utilized. cmdline.cpp 107
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())".
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);
....
}