mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Avoid string copy in 'VPKEntryBlock_t::VPKEntryBlock_t'
Avoid a copy when formatting string to that of the VPK directory tree structure.
This commit is contained in:
parent
484f6a779a
commit
2e9aa9a77c
@ -734,13 +734,13 @@ VPKKeyValues_t::VPKKeyValues_t(const string& svEntryPath, uint16_t iPreloadSize,
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: 'VPKEntryBlock_t' file constructor
|
||||
// Input : hFile -
|
||||
// svEntryPath -
|
||||
// &svEntryPath -
|
||||
//-----------------------------------------------------------------------------
|
||||
VPKEntryBlock_t::VPKEntryBlock_t(FileHandle_t hFile, string svEntryPath)
|
||||
VPKEntryBlock_t::VPKEntryBlock_t(FileHandle_t hFile, const string& svEntryPath)
|
||||
{
|
||||
StringReplace(svEntryPath, "\\", "/"); // Flip windows-style backslash to forward slash.
|
||||
StringReplace(svEntryPath, " /", "" ); // Remove space character representing VPK root.
|
||||
m_svEntryPath = svEntryPath; // Set the entry path.
|
||||
StringReplace(m_svEntryPath, "\\", "/"); // Flip windows-style backslash to forward slash.
|
||||
StringReplace(m_svEntryPath, " /", ""); // Remove space character representing VPK root.
|
||||
|
||||
FileSystem()->Read(&m_nFileCRC, sizeof(uint32_t), hFile); //
|
||||
FileSystem()->Read(&m_iPreloadSize, sizeof(uint16_t), hFile); //
|
||||
|
@ -81,7 +81,7 @@ struct VPKEntryBlock_t
|
||||
vector<VPKChunkDescriptor_t> m_vFragments; // Vector of all the chunks of a given entry (chunks have a size limit of 1 MiB, anything over this limit is fragmented into smaller chunks).
|
||||
string m_svEntryPath; // Path to entry within vpk.
|
||||
|
||||
VPKEntryBlock_t(FileHandle_t pFile, string svEntryPath);
|
||||
VPKEntryBlock_t(FileHandle_t pFile, const string& svEntryPath);
|
||||
VPKEntryBlock_t(const uint8_t* pData, size_t nLen, int64_t nOffset, uint16_t iPreloadSize,
|
||||
uint16_t iPackFileIndex, uint32_t nEntryFlags, uint16_t nTextureFlags, const string& svEntryPath);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user