mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-16 23:38:40 +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;
|
uint64_t Size;
|
||||||
void *Mapping;
|
void *Mapping;
|
||||||
#ifdef LLVM_ON_WIN32
|
#ifdef LLVM_ON_WIN32
|
||||||
int FileDescriptor;
|
|
||||||
void *FileHandle;
|
void *FileHandle;
|
||||||
void *FileMappingHandle;
|
void *FileMappingHandle;
|
||||||
#endif
|
#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,
|
std::error_code mapped_file_region::init(int FD, uint64_t Offset,
|
||||||
mapmode Mode) {
|
mapmode Mode) {
|
||||||
FileDescriptor = FD;
|
|
||||||
// Make sure that the requested size fits within SIZE_T.
|
// Make sure that the requested size fits within SIZE_T.
|
||||||
if (Size > std::numeric_limits<SIZE_T>::max()) {
|
if (Size > std::numeric_limits<SIZE_T>::max())
|
||||||
if (FileDescriptor) {
|
|
||||||
} else
|
|
||||||
::CloseHandle(FileHandle);
|
|
||||||
return make_error_code(errc::invalid_argument);
|
return make_error_code(errc::invalid_argument);
|
||||||
}
|
|
||||||
|
|
||||||
DWORD flprotect;
|
DWORD flprotect;
|
||||||
switch (Mode) {
|
switch (Mode) {
|
||||||
@ -483,9 +478,6 @@ std::error_code mapped_file_region::init(int FD, uint64_t Offset,
|
|||||||
0);
|
0);
|
||||||
if (FileMappingHandle == NULL) {
|
if (FileMappingHandle == NULL) {
|
||||||
std::error_code ec = windows_error(GetLastError());
|
std::error_code ec = windows_error(GetLastError());
|
||||||
if (FileDescriptor) {
|
|
||||||
} else
|
|
||||||
::CloseHandle(FileHandle);
|
|
||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,9 +495,6 @@ std::error_code mapped_file_region::init(int FD, uint64_t Offset,
|
|||||||
if (Mapping == NULL) {
|
if (Mapping == NULL) {
|
||||||
std::error_code ec = windows_error(GetLastError());
|
std::error_code ec = windows_error(GetLastError());
|
||||||
::CloseHandle(FileMappingHandle);
|
::CloseHandle(FileMappingHandle);
|
||||||
if (FileDescriptor) {
|
|
||||||
} else
|
|
||||||
::CloseHandle(FileHandle);
|
|
||||||
return ec;
|
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());
|
std::error_code ec = windows_error(GetLastError());
|
||||||
::UnmapViewOfFile(Mapping);
|
::UnmapViewOfFile(Mapping);
|
||||||
::CloseHandle(FileMappingHandle);
|
::CloseHandle(FileMappingHandle);
|
||||||
if (FileDescriptor) {
|
|
||||||
} else
|
|
||||||
::CloseHandle(FileHandle);
|
|
||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
Size = mbi.RegionSize;
|
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
|
// Close all the handles except for the view. It will keep the other handles
|
||||||
// alive.
|
// alive.
|
||||||
::CloseHandle(FileMappingHandle);
|
::CloseHandle(FileMappingHandle);
|
||||||
if (FileDescriptor) {
|
|
||||||
} else
|
|
||||||
::CloseHandle(FileHandle);
|
|
||||||
return std::error_code();
|
return std::error_code();
|
||||||
}
|
}
|
||||||
|
|
||||||
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(), FileDescriptor(fd),
|
: Size(length), Mapping(),
|
||||||
FileHandle(INVALID_HANDLE_VALUE), FileMappingHandle() {
|
FileHandle(INVALID_HANDLE_VALUE), FileMappingHandle() {
|
||||||
FileHandle = reinterpret_cast<HANDLE>(_get_osfhandle(fd));
|
FileHandle = reinterpret_cast<HANDLE>(_get_osfhandle(fd));
|
||||||
if (FileHandle == INVALID_HANDLE_VALUE) {
|
if (FileHandle == INVALID_HANDLE_VALUE) {
|
||||||
FileDescriptor = 0;
|
|
||||||
ec = make_error_code(errc::bad_file_descriptor);
|
ec = make_error_code(errc::bad_file_descriptor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ec = init(FileDescriptor, offset, mode);
|
ec = init(fd, offset, mode);
|
||||||
if (ec) {
|
if (ec) {
|
||||||
Mapping = FileMappingHandle = 0;
|
Mapping = FileMappingHandle = 0;
|
||||||
FileHandle = INVALID_HANDLE_VALUE;
|
FileHandle = INVALID_HANDLE_VALUE;
|
||||||
FileDescriptor = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user