mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-28 21:34:23 +00:00
Remove the last unnecessary member variable of mapped_file_region. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224312 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b5f992ccc0
commit
8b3754208f
@ -639,9 +639,6 @@ private:
|
|||||||
/// Platform-specific mapping state.
|
/// Platform-specific mapping state.
|
||||||
uint64_t Size;
|
uint64_t Size;
|
||||||
void *Mapping;
|
void *Mapping;
|
||||||
#ifdef LLVM_ON_WIN32
|
|
||||||
void *FileHandle;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::error_code init(int FD, uint64_t Offset, mapmode Mode);
|
std::error_code init(int FD, uint64_t Offset, mapmode Mode);
|
||||||
|
|
||||||
|
@ -464,6 +464,10 @@ std::error_code mapped_file_region::init(int FD, uint64_t Offset,
|
|||||||
if (Size > std::numeric_limits<SIZE_T>::max())
|
if (Size > std::numeric_limits<SIZE_T>::max())
|
||||||
return make_error_code(errc::invalid_argument);
|
return make_error_code(errc::invalid_argument);
|
||||||
|
|
||||||
|
HANDLE FileHandle = reinterpret_cast<HANDLE>(_get_osfhandle(FD));
|
||||||
|
if (FileHandle == INVALID_HANDLE_VALUE)
|
||||||
|
return make_error_code(errc::bad_file_descriptor);
|
||||||
|
|
||||||
DWORD flprotect;
|
DWORD flprotect;
|
||||||
switch (Mode) {
|
switch (Mode) {
|
||||||
case readonly: flprotect = PAGE_READONLY; break;
|
case readonly: flprotect = PAGE_READONLY; break;
|
||||||
@ -518,19 +522,10 @@ std::error_code mapped_file_region::init(int FD, uint64_t Offset,
|
|||||||
|
|
||||||
mapped_file_region::mapped_file_region(int fd, mapmode mode, uint64_t length,
|
mapped_file_region::mapped_file_region(int fd, mapmode mode, uint64_t length,
|
||||||
uint64_t offset, std::error_code &ec)
|
uint64_t offset, std::error_code &ec)
|
||||||
: Size(length), Mapping(),
|
: Size(length), Mapping() {
|
||||||
FileHandle(INVALID_HANDLE_VALUE) {
|
|
||||||
FileHandle = reinterpret_cast<HANDLE>(_get_osfhandle(fd));
|
|
||||||
if (FileHandle == INVALID_HANDLE_VALUE) {
|
|
||||||
ec = make_error_code(errc::bad_file_descriptor);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ec = init(fd, offset, mode);
|
ec = init(fd, offset, mode);
|
||||||
if (ec) {
|
if (ec)
|
||||||
Mapping = 0;
|
Mapping = 0;
|
||||||
FileHandle = INVALID_HANDLE_VALUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mapped_file_region::~mapped_file_region() {
|
mapped_file_region::~mapped_file_region() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user