50 lines
1.7 KiB
Diff
50 lines
1.7 KiB
Diff
From d2f6452be919d2e2a77db67e6fdc7a2e498a091c Mon Sep 17 00:00:00 2001
|
|
From: Alexpux <alexey.pawlow@gmail.com>
|
|
Date: Sun, 22 Nov 2015 17:09:05 +0300
|
|
Subject: [PATCH 26/27] Fix using function pointer.
|
|
|
|
---
|
|
src/common/classes/locks.cpp | 3 ++-
|
|
src/common/classes/locks.h | 7 +++----
|
|
2 files changed, 5 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/common/classes/locks.cpp b/src/common/classes/locks.cpp
|
|
index de6b2f8e36..aaf7f868d5 100644
|
|
--- a/src/common/classes/locks.cpp
|
|
+++ b/src/common/classes/locks.cpp
|
|
@@ -124,7 +124,8 @@ BOOL WINAPI TryEnterCriticalSection_Win9X(CRITICAL_SECTION* cs)
|
|
|
|
// On Win 98 and Win ME TryEnterCriticalSection is defined, but not implemented
|
|
// So direct linking to it won't hurt and will signal our incompatibility with Win 95
|
|
-TryEnterCS::tTryEnterCriticalSection* TryEnterCS::m_funct = &TryEnterCriticalSection;
|
|
+TryEnterCS::tTryEnterCriticalSection TryEnterCS::m_funct =
|
|
+ reinterpret_cast<TryEnterCS::tTryEnterCriticalSection>(TryEnterCriticalSection);
|
|
|
|
static TryEnterCS tryEnterCS;
|
|
|
|
diff --git a/src/common/classes/locks.h b/src/common/classes/locks.h
|
|
index 75ba1943fb..358659201f 100644
|
|
--- a/src/common/classes/locks.h
|
|
+++ b/src/common/classes/locks.h
|
|
@@ -60,14 +60,13 @@ public:
|
|
|
|
static bool tryEnter(LPCRITICAL_SECTION lpCS)
|
|
{
|
|
- return ((*m_funct) (lpCS) == TRUE);
|
|
+ return ((m_funct) (lpCS) == TRUE);
|
|
}
|
|
|
|
private:
|
|
- typedef WINBASEAPI BOOL WINAPI tTryEnterCriticalSection
|
|
- (LPCRITICAL_SECTION lpCriticalSection);
|
|
+ typedef BOOL (WINAPI *tTryEnterCriticalSection)(LPCRITICAL_SECTION lpCriticalSection);
|
|
|
|
- static tTryEnterCriticalSection* m_funct;
|
|
+ static tTryEnterCriticalSection m_funct;
|
|
};
|
|
|
|
class Mutex
|
|
--
|
|
2.13.0
|
|
|