mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2025-01-31 06:57:28 +05:00
Move initializer list instead of copying
Use make_checked_array_iterator properly where applicable
This commit is contained in:
parent
01f7c39d1e
commit
b7cf823ee7
3 changed files with 9 additions and 9 deletions
|
@ -432,7 +432,7 @@ namespace Memory
|
||||||
inline void Patch(AT address, std::initializer_list<uint8_t> list )
|
inline void Patch(AT address, std::initializer_list<uint8_t> list )
|
||||||
{
|
{
|
||||||
uint8_t* const addr = (uint8_t*)address;
|
uint8_t* const addr = (uint8_t*)address;
|
||||||
std::copy( list.begin(), list.end(), stdext::checked_array_iterator<uint8_t*>(addr, list.size()) );
|
std::copy( list.begin(), list.end(), stdext::make_checked_array_iterator(addr, list.size()) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -531,7 +531,7 @@ namespace Memory
|
||||||
#ifndef _MEMORY_NO_CRT
|
#ifndef _MEMORY_NO_CRT
|
||||||
inline bool MemEquals(uintptr_t address, std::initializer_list<uint8_t> val)
|
inline bool MemEquals(uintptr_t address, std::initializer_list<uint8_t> val)
|
||||||
{
|
{
|
||||||
return Memory::MemEquals(DynBaseAddress(address), val);
|
return Memory::MemEquals(DynBaseAddress(address), std::move(val));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -596,7 +596,7 @@ namespace Memory
|
||||||
#ifndef _MEMORY_NO_CRT
|
#ifndef _MEMORY_NO_CRT
|
||||||
inline bool MemEquals(uintptr_t address, std::initializer_list<uint8_t> val)
|
inline bool MemEquals(uintptr_t address, std::initializer_list<uint8_t> val)
|
||||||
{
|
{
|
||||||
return Memory::MemEquals(address, val);
|
return Memory::MemEquals(address, std::move(val));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -643,7 +643,7 @@ namespace Memory
|
||||||
#ifndef _MEMORY_NO_CRT
|
#ifndef _MEMORY_NO_CRT
|
||||||
inline bool MemEquals(uintptr_t address, std::initializer_list<uint8_t> val)
|
inline bool MemEquals(uintptr_t address, std::initializer_list<uint8_t> val)
|
||||||
{
|
{
|
||||||
return Memory::MemEquals(DynBaseAddress(address), val);
|
return Memory::MemEquals(DynBaseAddress(address), std::move(val));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,10 +50,10 @@ FLAC__StreamDecoderWriteStatus CAEFLACDecoder::write_cb(const FLAC__StreamDecode
|
||||||
pClientData->m_maxBlockSize = pClientData->m_curBlockSize;
|
pClientData->m_maxBlockSize = pClientData->m_curBlockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::copy_n( buffer[0], pClientData->m_curBlockSize, stdext::checked_array_iterator<FLAC__int32*>(pClientData->m_buffer, pClientData->m_curBlockSize) );
|
std::copy_n( buffer[0], pClientData->m_curBlockSize, stdext::make_checked_array_iterator(pClientData->m_buffer, pClientData->m_curBlockSize) );
|
||||||
if ( processedChannels > 1 )
|
if ( processedChannels > 1 )
|
||||||
{
|
{
|
||||||
std::copy_n( buffer[1], pClientData->m_curBlockSize, stdext::checked_array_iterator<FLAC__int32*>(pClientData->m_buffer+pClientData->m_curBlockSize, pClientData->m_curBlockSize) );
|
std::copy_n( buffer[1], pClientData->m_curBlockSize, stdext::make_checked_array_iterator(pClientData->m_buffer+pClientData->m_curBlockSize, pClientData->m_curBlockSize) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
|
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
|
||||||
|
|
|
@ -72,7 +72,7 @@ void CVehicleModelInfo::FindEditableMaterialList()
|
||||||
if ( m_numDirtMaterials > IN_PLACE_BUFFER_DIRT_SIZE )
|
if ( m_numDirtMaterials > IN_PLACE_BUFFER_DIRT_SIZE )
|
||||||
{
|
{
|
||||||
m_dirtMaterials = new RpMaterial* [m_numDirtMaterials];
|
m_dirtMaterials = new RpMaterial* [m_numDirtMaterials];
|
||||||
std::copy( editableMaterials.begin(), editableMaterials.end(), stdext::checked_array_iterator<RpMaterial**>(m_dirtMaterials, m_numDirtMaterials) );
|
std::copy( editableMaterials.begin(), editableMaterials.end(), stdext::make_checked_array_iterator(m_dirtMaterials, m_numDirtMaterials) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -131,13 +131,13 @@ void CCustomCarPlateMgr::PollPlates( RpClump* clump, PlateMaterialsData* materia
|
||||||
if ( materials->m_numPlates > 0 )
|
if ( materials->m_numPlates > 0 )
|
||||||
{
|
{
|
||||||
materials->m_plates = new RpMaterial* [materials->m_numPlates];
|
materials->m_plates = new RpMaterial* [materials->m_numPlates];
|
||||||
std::copy( carplates.begin(), carplates.end(), stdext::checked_array_iterator<RpMaterial**>(materials->m_plates, materials->m_numPlates) );
|
std::copy( carplates.begin(), carplates.end(), stdext::make_checked_array_iterator(materials->m_plates, materials->m_numPlates) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( materials->m_numPlatebacks > 0 )
|
if ( materials->m_numPlatebacks > 0 )
|
||||||
{
|
{
|
||||||
materials->m_platebacks = new RpMaterial* [materials->m_numPlatebacks];
|
materials->m_platebacks = new RpMaterial* [materials->m_numPlatebacks];
|
||||||
std::copy( carpbacks.begin(), carpbacks.end(), stdext::checked_array_iterator<RpMaterial**>(materials->m_platebacks, materials->m_numPlatebacks) );
|
std::copy( carpbacks.begin(), carpbacks.end(), stdext::make_checked_array_iterator(materials->m_platebacks, materials->m_numPlatebacks) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue