mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
Remove unused member and simplify. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224309 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
96b7967f83
commit
a99ff35cb5
@ -640,7 +640,6 @@ private:
|
||||
uint64_t Size;
|
||||
void *Mapping;
|
||||
#ifdef LLVM_ON_WIN32
|
||||
int FileDescriptor;
|
||||
void *FileHandle;
|
||||
void *FileMappingHandle;
|
||||
#endif
|
||||
|
@ -460,14 +460,9 @@ std::error_code setLastModificationAndAccessTime(int FD, TimeValue Time) {
|
||||
|
||||
std::error_code mapped_file_region::init(int FD, uint64_t Offset,
|
||||
mapmode Mode) {
|
||||
FileDescriptor = FD;
|
||||
// Make sure that the requested size fits within SIZE_T.
|
||||
if (Size > std::numeric_limits<SIZE_T>::max()) {
|
||||
if (FileDescriptor) {
|
||||
} else
|
||||
::CloseHandle(FileHandle);
|
||||
if (Size > std::numeric_limits<SIZE_T>::max())
|
||||
return make_error_code(errc::invalid_argument);
|
||||
}
|
||||
|
||||
DWORD flprotect;
|
||||
switch (Mode) {
|
||||
@ -483,9 +478,6 @@ std::error_code mapped_file_region::init(int FD, uint64_t Offset,
|
||||
0);
|
||||
if (FileMappingHandle == NULL) {
|
||||
std::error_code ec = windows_error(GetLastError());
|
||||
if (FileDescriptor) {
|
||||
} else
|
||||
::CloseHandle(FileHandle);
|
||||
return ec;
|
||||
}
|
||||
|
||||
@ -503,9 +495,6 @@ std::error_code mapped_file_region::init(int FD, uint64_t Offset,
|
||||
if (Mapping == NULL) {
|
||||
std::error_code ec = windows_error(GetLastError());
|
||||
::CloseHandle(FileMappingHandle);
|
||||
if (FileDescriptor) {
|
||||
} else
|
||||
::CloseHandle(FileHandle);
|
||||
return ec;
|
||||
}
|
||||
|
||||
@ -516,9 +505,6 @@ std::error_code mapped_file_region::init(int FD, uint64_t Offset,
|
||||
std::error_code ec = windows_error(GetLastError());
|
||||
::UnmapViewOfFile(Mapping);
|
||||
::CloseHandle(FileMappingHandle);
|
||||
if (FileDescriptor) {
|
||||
} else
|
||||
::CloseHandle(FileHandle);
|
||||
return ec;
|
||||
}
|
||||
Size = mbi.RegionSize;
|
||||
@ -527,28 +513,23 @@ std::error_code mapped_file_region::init(int FD, uint64_t Offset,
|
||||
// Close all the handles except for the view. It will keep the other handles
|
||||
// alive.
|
||||
::CloseHandle(FileMappingHandle);
|
||||
if (FileDescriptor) {
|
||||
} else
|
||||
::CloseHandle(FileHandle);
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
mapped_file_region::mapped_file_region(int fd, mapmode mode, uint64_t length,
|
||||
uint64_t offset, std::error_code &ec)
|
||||
: Size(length), Mapping(), FileDescriptor(fd),
|
||||
: Size(length), Mapping(),
|
||||
FileHandle(INVALID_HANDLE_VALUE), FileMappingHandle() {
|
||||
FileHandle = reinterpret_cast<HANDLE>(_get_osfhandle(fd));
|
||||
if (FileHandle == INVALID_HANDLE_VALUE) {
|
||||
FileDescriptor = 0;
|
||||
ec = make_error_code(errc::bad_file_descriptor);
|
||||
return;
|
||||
}
|
||||
|
||||
ec = init(FileDescriptor, offset, mode);
|
||||
ec = init(fd, offset, mode);
|
||||
if (ec) {
|
||||
Mapping = FileMappingHandle = 0;
|
||||
FileHandle = INVALID_HANDLE_VALUE;
|
||||
FileDescriptor = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user