fix bug of (0x01<<slot) for 64bit

This commit is contained in:
VincentWei
2018-05-19 00:56:39 +08:00
parent 36d2ea8158
commit 977ac1ec9b
2 changed files with 19 additions and 17 deletions
+14 -10
View File
@@ -486,12 +486,17 @@ BOOL PeekMessageEx (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin, UINT nMsgFilterMax
#ifdef _MGRM_THREADS
if (!(pMsgQueue = GetMsgQueueThisThread ()))
return FALSE;
return FALSE;
#else
pMsgQueue = __mg_dsk_msg_queue;
#endif
memset (pMsg, 0, sizeof(MSG));
#ifdef _MGRM_PROCESSES
pMsg->time = SHAREDRES_TIMER_COUNTER;
#else
pMsg->time = __mg_timer_counter;
#endif
checkagain:
@@ -670,7 +675,8 @@ checkagain:
/* get the first expired timer slot */
slot = pMsgQueue->FirstTimerSlot;
do {
if (pMsgQueue->TimerMask & (0x01 << slot))
DWORD dwTest = 0x01;
if (pMsgQueue->TimerMask & (dwTest << slot))
break;
slot ++;
@@ -685,11 +691,8 @@ checkagain:
pMsgQueue->FirstTimerSlot %= DEF_NR_TIMERS;
if ((timer = __mg_get_timer (slot))) {
unsigned int tick_count = timer->tick_count;
timer->tick_count = 0;
pMsgQueue->TimerMask &= ~(0x01 << slot);
DWORD dwTest = 0x01;
pMsgQueue->TimerMask &= ~(dwTest << slot);
if (timer->proc) {
BOOL ret_timer_proc;
@@ -699,7 +702,7 @@ checkagain:
/* calling the timer callback procedure */
ret_timer_proc = timer->proc (timer->hWnd,
timer->id, tick_count);
timer->id, timer->tick_count);
/* lock the message queue again */
LOCK_MSGQ (pMsgQueue);
@@ -715,7 +718,7 @@ checkagain:
pMsg->message = MSG_TIMER;
pMsg->hwnd = timer->hWnd;
pMsg->wParam = timer->id;
pMsg->lParam = tick_count;
pMsg->lParam = timer->tick_count;
SET_PADD (NULL);
UNLOCK_MSGQ (pMsgQueue);
@@ -1221,7 +1224,8 @@ int GUIAPI ThrowAwayMessages (HWND hWnd)
/* clear timer message flags of this window */
for (slot = 0; slot < DEF_NR_TIMERS; slot++) {
if (pMsgQueue->TimerMask & (0x01 << slot)) {
DWORD dwTest = 0x01;
if (pMsgQueue->TimerMask & (dwTest << slot)) {
HWND timer_wnd = __mg_get_timer_hwnd (slot);
if (timer_wnd == hWnd
|| gui_GetMainWindowPtrOfControl (timer_wnd) == (PMAINWIN)hWnd){
+5 -7
View File
@@ -78,9 +78,9 @@ static pthread_mutex_t timerLock;
#define TIMER_UNLOCK()
#endif
#ifdef _MGGAL_S3C6410
#ifdef __LINUX__
# define _MG_USE_BETTER_TIMER
#endif /* _MGGAL_S3C6410 */
#endif /* __LINUX__ */
#ifdef _MG_USE_BETTER_TIMER
#include <sys/times.h>
@@ -298,16 +298,14 @@ void mg_dispatch_timer_message (DWORD inter)
if (timerstr[i] && timerstr[i]->msg_queue) {
timerstr[i]->count += inter;
if (timerstr[i]->count >= timerstr[i]->speed) {
if (timerstr[i]->tick_count == 0)
#ifdef _MGRM_PROCESSES
timerstr[i]->tick_count = SHAREDRES_TIMER_COUNTER;
timerstr[i]->tick_count = SHAREDRES_TIMER_COUNTER;
#else
timerstr[i]->tick_count = __mg_timer_counter;
timerstr[i]->tick_count = __mg_timer_counter;
#endif
/* setting timer flag is simple, we do not need to lock msgq,
or else we may encounter dead lock here */
SetMsgQueueTimerFlag (timerstr[i]->msg_queue, i);
timerstr[i]->count -= timerstr[i]->speed;
}
}
@@ -469,7 +467,7 @@ void __mg_remove_timer (TIMER* timer, int slot)
TIMER_LOCK ();
if (timer && timer->msg_queue && timerstr[slot] == timer) {
/* The following code is already called in message.c...
/* The following code is already moved to message.c...
* timer->msg_queue->TimerMask &= ~(0x01 << slot);
*/
free (timerstr[slot]);