mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 00:05:36 +00:00
Bug 1603714: Add explicit copy constructor and copy assignment operators to nt::MemorySectionNameBuf; r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D57889 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
a3f185ef1b
commit
72918a2e58
@ -240,6 +240,23 @@ struct MemorySectionNameBuf : public _MEMORY_SECTION_NAME {
|
||||
mSectionFileName.Buffer = mBuf;
|
||||
}
|
||||
|
||||
MemorySectionNameBuf(const MemorySectionNameBuf& aOther) {
|
||||
*this = aOther;
|
||||
}
|
||||
|
||||
// We cannot use default copy here because mSectionFileName.Buffer needs to
|
||||
// be updated to point to |this->mBuf|, not |aOther.mBuf|.
|
||||
MemorySectionNameBuf& operator=(const MemorySectionNameBuf& aOther) {
|
||||
mSectionFileName.Length = aOther.mSectionFileName.Length;
|
||||
mSectionFileName.MaximumLength = sizeof(mBuf);
|
||||
mSectionFileName.Buffer = mBuf;
|
||||
memcpy(mBuf, aOther.mBuf, aOther.mSectionFileName.Length);
|
||||
return *this;
|
||||
}
|
||||
|
||||
MemorySectionNameBuf(MemorySectionNameBuf&&) = delete;
|
||||
MemorySectionNameBuf& operator=(MemorySectionNameBuf&&) = delete;
|
||||
|
||||
// Native NT paths, so we can't assume MAX_PATH. Use a larger buffer.
|
||||
WCHAR mBuf[2 * MAX_PATH];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user