Follow-up for r161168 for Windows

git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@161169 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/interception/interception_win.cc b/lib/interception/interception_win.cc
index a60c741..8e35a3b 100644
--- a/lib/interception/interception_win.cc
+++ b/lib/interception/interception_win.cc
@@ -14,22 +14,23 @@
 
 #ifdef _WIN32
 
+#include "interception.h"
 #include <windows.h>
 
 namespace __interception {
 
-bool GetRealFunctionAddress(const char *func_name, void **func_addr) {
+bool GetRealFunctionAddress(const char *func_name, uptr *func_addr) {
   const char *DLLS[] = {
     "msvcr80.dll",
     "msvcr90.dll",
     "kernel32.dll",
     NULL
   };
-  *func_addr = NULL;
-  for (size_t i = 0; *func_addr == NULL && DLLS[i]; ++i) {
+  *func_addr = 0;
+  for (size_t i = 0; *func_addr == 0 && DLLS[i]; ++i) {
     *func_addr = GetProcAddress(GetModuleHandleA(DLLS[i]), func_name);
   }
-  return (*func_addr != NULL);
+  return (*func_addr != 0);
 }
 
 // FIXME: internal_str* and internal_mem* functions should be moved from the
@@ -55,7 +56,7 @@
   *(ptrdiff_t*)(jmp_from + 1) = offset;
 }
 
-bool OverrideFunction(void *old_func, void *new_func, void **orig_old_func) {
+bool OverrideFunction(uptr old_func, uptr new_func, uptr *orig_old_func) {
 #ifdef _WIN64
 # error OverrideFunction was not tested on x64
 #endif
@@ -125,20 +126,21 @@
 
   // Now put the "jump to trampoline" instruction into the original code.
   DWORD old_prot, unused_prot;
-  if (!VirtualProtect(old_func, head, PAGE_EXECUTE_READWRITE, &old_prot))
+  if (!VirtualProtect((void*)old_func, head, PAGE_EXECUTE_READWRITE,
+                      &old_prot))
     return false;
 
   // Put the needed instructions into the trampoline bytes.
   _memcpy(trampoline, old_bytes, head);
   WriteJumpInstruction(trampoline + head, old_bytes + head);
-  *orig_old_func = trampoline;
+  *orig_old_func = (uptr)trampoline;
   pool_used += head + 5;
 
   // Intercept the 'old_func'.
   WriteJumpInstruction(old_bytes, (char*)new_func);
   _memset(old_bytes + 5, 0xCC /* int 3 */, head - 5);
 
-  if (!VirtualProtect(old_func, head, old_prot, &unused_prot))
+  if (!VirtualProtect((void*)old_func, head, old_prot, &unused_prot))
     return false;  // not clear if this failure bothers us.
 
   return true;
diff --git a/lib/interception/interception_win.h b/lib/interception/interception_win.h
index 9d1586e..c64af1b 100644
--- a/lib/interception/interception_win.h
+++ b/lib/interception/interception_win.h
@@ -23,19 +23,22 @@
 
 namespace __interception {
 // returns true if a function with the given name was found.
-bool GetRealFunctionAddress(const char *func_name, void **func_addr);
+bool GetRealFunctionAddress(const char *func_name, uptr *func_addr);
 
 // returns true if the old function existed, false on failure.
-bool OverrideFunction(void *old_func, void *new_func, void **orig_old_func);
+bool OverrideFunction(uptr old_func, uptr new_func, uptr *orig_old_func);
 }  // namespace __interception
 
 #if defined(_DLL)
 # define INTERCEPT_FUNCTION_WIN(func) \
-    ::__interception::GetRealFunctionAddress(#func, (void**)&REAL(func))
+    ::__interception::GetRealFunctionAddress( \
+        #func, (::__interception::uptr*)&REAL(func))
 #else
 # define INTERCEPT_FUNCTION_WIN(func) \
-    ::__interception::OverrideFunction((void*)func, (void*)WRAP(func), \
-                                       (void**)&REAL(func))
+    ::__interception::OverrideFunction( \
+        (::__interception::uptr)func, \
+        (::__interception::uptr)WRAP(func), \
+        (::__interception::uptr*)&REAL(func))
 #endif
 
 #endif  // INTERCEPTION_WIN_H