mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #5634
5634: Fix clang tidy accessing data pointer r=def- a=ChillerDragon ddnet/src/engine/client/favorites.cpp:229:23: error: 'data' should be used for accessing the data pointer instead of taking the address of the 0-th element [readability-container-data-pointer,-warnings-as-errors] int Index = pEntry - &m_aEntries[0]; ^~~~~~~~~~~~~~ (m_aEntries).data() <!-- What is the motivation for the changes of this pull request --> ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test (especially base/) or added coverage to integration test - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: ChillerDragon <ChillerDragon@gmail.com>
This commit is contained in:
commit
a9bc4ae113
|
@ -226,7 +226,7 @@ const CFavorites::CEntry *CFavorites::Entry(const NETADDR &Addr) const
|
|||
void CFavorites::RemoveEntry(CEntry *pEntry)
|
||||
{
|
||||
// Replace the entry
|
||||
int Index = pEntry - &m_aEntries[0];
|
||||
int Index = pEntry - m_aEntries.data();
|
||||
*pEntry = m_aEntries[m_aEntries.size() - 1];
|
||||
m_aEntries.pop_back();
|
||||
if(Index != (int)m_aEntries.size())
|
||||
|
|
Loading…
Reference in a new issue