aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/Windows/PathV2.inc
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2011-12-12 06:03:33 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2011-12-12 06:03:33 +0000
commit1dd2ee7bf4d848e368829cb01033f297afb674ab (patch)
tree0458e46c4fee4ade88a676613bf80b4b76ed20f1 /lib/Support/Windows/PathV2.inc
parent48b0bbf930f9efa72f46f70b7e81dec69c2397cc (diff)
Support/Windows: Cleanup scoped handles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146362 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Windows/PathV2.inc')
-rw-r--r--lib/Support/Windows/PathV2.inc23
1 files changed, 6 insertions, 17 deletions
diff --git a/lib/Support/Windows/PathV2.inc b/lib/Support/Windows/PathV2.inc
index 3872512e4f..afb5533dc8 100644
--- a/lib/Support/Windows/PathV2.inc
+++ b/lib/Support/Windows/PathV2.inc
@@ -17,7 +17,6 @@
//===----------------------------------------------------------------------===//
#include "Windows.h"
-#include <wincrypt.h>
#include <fcntl.h>
#include <io.h>
#include <sys/stat.h>
@@ -112,14 +111,6 @@ namespace {
return success;
}
- // Forwarder for ScopedHandle.
- BOOL WINAPI CryptReleaseContext(HCRYPTPROV Provider) {
- return ::CryptReleaseContext(Provider, 0);
- }
-
- typedef ScopedHandle<HCRYPTPROV, uintptr_t(-1),
- BOOL (WINAPI*)(HCRYPTPROV), CryptReleaseContext>
- ScopedCryptContext;
bool is_separator(const wchar_t value) {
switch (value) {
case L'\\':
@@ -372,7 +363,7 @@ error_code equivalent(const Twine &A, const Twine &B, bool &result) {
if (error_code ec = UTF8ToUTF16(a, wide_a)) return ec;
if (error_code ec = UTF8ToUTF16(b, wide_b)) return ec;
- AutoHandle HandleB(
+ ScopedFileHandle HandleB(
::CreateFileW(wide_b.begin(),
0,
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
@@ -381,7 +372,7 @@ error_code equivalent(const Twine &A, const Twine &B, bool &result) {
FILE_FLAG_BACKUP_SEMANTICS,
0));
- AutoHandle HandleA(
+ ScopedFileHandle HandleA(
::CreateFileW(wide_a.begin(),
0,
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
@@ -391,13 +382,11 @@ error_code equivalent(const Twine &A, const Twine &B, bool &result) {
0));
// If both handles are invalid, it's an error.
- if (HandleA == INVALID_HANDLE_VALUE &&
- HandleB == INVALID_HANDLE_VALUE)
+ if (!HandleA && !HandleB)
return windows_error(::GetLastError());
// If only one is invalid, it's false.
- if (HandleA == INVALID_HANDLE_VALUE &&
- HandleB == INVALID_HANDLE_VALUE) {
+ if (!HandleA || !HandleB) {
result = false;
return success;
}
@@ -488,7 +477,7 @@ error_code status(const Twine &path, file_status &result) {
// Handle reparse points.
if (attr & FILE_ATTRIBUTE_REPARSE_POINT) {
- AutoHandle h(
+ ScopedFileHandle h(
::CreateFileW(path_utf16.begin(),
0, // Attributes only.
FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
@@ -496,7 +485,7 @@ error_code status(const Twine &path, file_status &result) {
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
0));
- if (h == INVALID_HANDLE_VALUE)
+ if (!h)
goto handle_status_error;
}