Support/Windows: Make MinGW happy.
authorMichael J. Spencer <bigcheesegs@gmail.com>
Mon, 6 Dec 2010 06:02:07 +0000 (06:02 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Mon, 6 Dec 2010 06:02:07 +0000 (06:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120991 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Windows/PathV2.inc
lib/Support/Windows/Windows.h

index 49343dc6161a57687922bdf58ccd86c438d353e9..c724607453d3c5f62e001fcb5a1c4c1d35b68c7f 100644 (file)
@@ -118,7 +118,7 @@ namespace {
     return ::CryptReleaseContext(Provider, 0);
   }
 
-  typedef ScopedHandle<HCRYPTPROV, HCRYPTPROV(INVALID_HANDLE_VALUE),
+  typedef ScopedHandle<HCRYPTPROV, uintptr_t(-1),
                        BOOL (WINAPI*)(HCRYPTPROV), CryptReleaseContext>
     ScopedCryptContext;
   bool is_separator(const wchar_t value) {
index 9ee9d1fc8e69db453c2288f9b29334deafee9373..12ddc92e7cac221be6828df79f2b53c2e6c7b20d 100644 (file)
@@ -59,7 +59,7 @@ public:
   }
 };
 
-template <class HandleType, HandleType InvalidHandle,
+template <class HandleType, uintptr_t InvalidHandle,
           class DeleterType, DeleterType D>
 class ScopedHandle {
   HandleType Handle;
@@ -69,13 +69,13 @@ public:
   ScopedHandle(HandleType handle) : Handle(handle) {}
 
   ~ScopedHandle() {
-    if (Handle != InvalidHandle)
+    if (Handle != HandleType(InvalidHandle))
       D(Handle);
   }
 
   HandleType take() {
     HandleType temp = Handle;
-    Handle = InvalidHandle;
+    Handle = HandleType(InvalidHandle);
     return temp;
   }
 
@@ -91,14 +91,14 @@ public:
 
   // True if Handle is valid.
   operator unspecified_bool_type() const {
-    return Handle == InvalidHandle ? 0 : unspecified_bool_true;
+    return Handle == HandleType(InvalidHandle) ? 0 : unspecified_bool_true;
   }
 
   bool operator!() const {
-    return Handle == InvalidHandle;
+    return Handle == HandleType(InvalidHandle);
   }
 };
 
-typedef ScopedHandle<HANDLE, INVALID_HANDLE_VALUE,
+typedef ScopedHandle<HANDLE, uintptr_t(-1),
                       BOOL (WINAPI*)(HANDLE), ::FindClose>
   ScopedFindHandle;