Commit d585d422 authored by Gerald Pfeifer's avatar Gerald Pfeifer Committed by Alexandre Julliard

comctl32: Push down function scope variable into the different case statements…

comctl32: Push down function scope variable into the different case statements which allows us using more specific types in case.
parent 3a805d28
...@@ -817,7 +817,6 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, INT x, INT ...@@ -817,7 +817,6 @@ static void UPDOWN_HandleMouseEvent (UPDOWN_INFO *infoPtr, UINT msg, INT x, INT
static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd); UPDOWN_INFO *infoPtr = UPDOWN_GetInfoPtr (hwnd);
int temp;
static const WCHAR themeClass[] = {'S','p','i','n',0}; static const WCHAR themeClass[] = {'S','p','i','n',0};
HTHEME theme; HTHEME theme;
...@@ -903,6 +902,8 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L ...@@ -903,6 +902,8 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
/* if initial timer, kill it and start the repeat timer */ /* if initial timer, kill it and start the repeat timer */
if(wParam == TIMER_AUTOREPEAT) { if(wParam == TIMER_AUTOREPEAT) {
int temp;
KillTimer(hwnd, TIMER_AUTOREPEAT); KillTimer(hwnd, TIMER_AUTOREPEAT);
/* if no accel info given, used default timer */ /* if no accel info given, used default timer */
if(infoPtr->AccelCount==0 || infoPtr->AccelVect==0) { if(infoPtr->AccelCount==0 || infoPtr->AccelVect==0) {
...@@ -917,6 +918,8 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L ...@@ -917,6 +918,8 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
/* now, if the mouse is above us, do the thing...*/ /* now, if the mouse is above us, do the thing...*/
if(infoPtr->Flags & FLAG_MOUSEIN) { if(infoPtr->Flags & FLAG_MOUSEIN) {
int temp;
temp = infoPtr->AccelIndex == -1 ? 1 : infoPtr->AccelVect[infoPtr->AccelIndex].nInc; temp = infoPtr->AccelIndex == -1 ? 1 : infoPtr->AccelVect[infoPtr->AccelIndex].nInc;
UPDOWN_DoAction(infoPtr, temp, infoPtr->Flags & FLAG_ARROW); UPDOWN_DoAction(infoPtr, temp, infoPtr->Flags & FLAG_ARROW);
...@@ -972,13 +975,16 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L ...@@ -972,13 +975,16 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
case UDM_GETACCEL: case UDM_GETACCEL:
if (wParam==0 && lParam==0) return infoPtr->AccelCount; if (wParam==0 && lParam==0) return infoPtr->AccelCount;
if (wParam && lParam) { if (wParam && lParam) {
temp = min(infoPtr->AccelCount, wParam); int temp = min(infoPtr->AccelCount, wParam);
memcpy((void *)lParam, infoPtr->AccelVect, temp*sizeof(UDACCEL)); memcpy((void *)lParam, infoPtr->AccelVect, temp*sizeof(UDACCEL));
return temp; return temp;
} }
return 0; return 0;
case UDM_SETACCEL: case UDM_SETACCEL:
{
unsigned temp;
TRACE("UDM_SETACCEL\n"); TRACE("UDM_SETACCEL\n");
if(infoPtr->AccelVect) { if(infoPtr->AccelVect) {
...@@ -996,14 +1002,14 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L ...@@ -996,14 +1002,14 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
TRACE("%d: nSec %u nInc %u\n", temp, infoPtr->AccelVect[temp].nSec, infoPtr->AccelVect[temp].nInc); TRACE("%d: nSec %u nInc %u\n", temp, infoPtr->AccelVect[temp].nSec, infoPtr->AccelVect[temp].nInc);
return TRUE; return TRUE;
}
case UDM_GETBASE: case UDM_GETBASE:
return infoPtr->Base; return infoPtr->Base;
case UDM_SETBASE: case UDM_SETBASE:
TRACE("UpDown Ctrl new base(%ld), hwnd=%p\n", wParam, hwnd); TRACE("UpDown Ctrl new base(%ld), hwnd=%p\n", wParam, hwnd);
if (wParam==10 || wParam==16) { if (wParam==10 || wParam==16) {
temp = infoPtr->Base; WPARAM temp = infoPtr->Base;
infoPtr->Base = wParam; infoPtr->Base = wParam;
return temp; return temp;
} }
...@@ -1016,11 +1022,14 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L ...@@ -1016,11 +1022,14 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
return (LRESULT)UPDOWN_SetBuddy (infoPtr, (HWND)wParam); return (LRESULT)UPDOWN_SetBuddy (infoPtr, (HWND)wParam);
case UDM_GETPOS: case UDM_GETPOS:
temp = UPDOWN_GetBuddyInt (infoPtr); {
int temp = UPDOWN_GetBuddyInt (infoPtr);
return MAKELONG(infoPtr->CurVal, temp ? 0 : 1); return MAKELONG(infoPtr->CurVal, temp ? 0 : 1);
}
case UDM_SETPOS: case UDM_SETPOS:
temp = (short)LOWORD(lParam); {
int temp = (short)LOWORD(lParam);
TRACE("UpDown Ctrl new value(%d), hwnd=%p\n", temp, hwnd); TRACE("UpDown Ctrl new value(%d), hwnd=%p\n", temp, hwnd);
if(!UPDOWN_InBounds(infoPtr, temp)) { if(!UPDOWN_InBounds(infoPtr, temp)) {
if(temp < infoPtr->MinVal) temp = infoPtr->MinVal; if(temp < infoPtr->MinVal) temp = infoPtr->MinVal;
...@@ -1030,7 +1039,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L ...@@ -1030,7 +1039,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
infoPtr->CurVal = temp; infoPtr->CurVal = temp;
UPDOWN_SetBuddyInt (infoPtr); UPDOWN_SetBuddyInt (infoPtr);
return wParam; /* return prev value */ return wParam; /* return prev value */
}
case UDM_GETRANGE: case UDM_GETRANGE:
return MAKELONG(infoPtr->MaxVal, infoPtr->MinVal); return MAKELONG(infoPtr->MaxVal, infoPtr->MinVal);
...@@ -1062,6 +1071,9 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L ...@@ -1062,6 +1071,9 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
return infoPtr->CurVal; return infoPtr->CurVal;
case UDM_SETPOS32: case UDM_SETPOS32:
{
int temp;
if(!UPDOWN_InBounds(infoPtr, (int)lParam)) { if(!UPDOWN_InBounds(infoPtr, (int)lParam)) {
if((int)lParam < infoPtr->MinVal) lParam = infoPtr->MinVal; if((int)lParam < infoPtr->MinVal) lParam = infoPtr->MinVal;
if((int)lParam > infoPtr->MaxVal) lParam = infoPtr->MaxVal; if((int)lParam > infoPtr->MaxVal) lParam = infoPtr->MaxVal;
...@@ -1070,17 +1082,18 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L ...@@ -1070,17 +1082,18 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
infoPtr->CurVal = (int)lParam; /* set the new value */ infoPtr->CurVal = (int)lParam; /* set the new value */
UPDOWN_SetBuddyInt (infoPtr); UPDOWN_SetBuddyInt (infoPtr);
return temp; /* return prev value */ return temp; /* return prev value */
}
case UDM_GETUNICODEFORMAT: case UDM_GETUNICODEFORMAT:
/* we lie a bit here, we're always using Unicode internally */ /* we lie a bit here, we're always using Unicode internally */
return infoPtr->UnicodeFormat; return infoPtr->UnicodeFormat;
case UDM_SETUNICODEFORMAT: case UDM_SETUNICODEFORMAT:
{
/* do we really need to honour this flag? */ /* do we really need to honour this flag? */
temp = infoPtr->UnicodeFormat; int temp = infoPtr->UnicodeFormat;
infoPtr->UnicodeFormat = (BOOL)wParam; infoPtr->UnicodeFormat = (BOOL)wParam;
return temp; return temp;
}
default: default:
if ((message >= WM_USER) && (message < WM_APP) && !COMCTL32_IsReflectedMessage(message)) if ((message >= WM_USER) && (message < WM_APP) && !COMCTL32_IsReflectedMessage(message))
ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message, wParam, lParam); ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message, wParam, lParam);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment