winemine: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-07-13 19:01:24 +02:00 committed by Alexandre Julliard
parent c99d5f3152
commit a9933cc2d1
2 changed files with 9 additions and 10 deletions

View File

@ -69,9 +69,8 @@ INT_PTR CALLBACK CongratsDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP
case WM_COMMAND: case WM_COMMAND:
switch( LOWORD( wParam ) ) { switch( LOWORD( wParam ) ) {
case IDOK: case IDOK:
GetDlgItemTextW( hDlg, IDC_EDITNAME, GetDlgItemTextW( hDlg, IDC_EDITNAME, p_board->best_name[p_board->difficulty],
p_board->best_name[p_board->difficulty], ARRAY_SIZE(p_board->best_name[p_board->difficulty] ));
sizeof( p_board->best_name[p_board->difficulty] ) / sizeof(WCHAR) );
EndDialog( hDlg, 0 ); EndDialog( hDlg, 0 );
return TRUE; return TRUE;
@ -107,8 +106,8 @@ INT_PTR CALLBACK TimesDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
case WM_COMMAND: case WM_COMMAND:
switch( LOWORD( wParam ) ) { switch( LOWORD( wParam ) ) {
case IDC_RESET: case IDC_RESET:
LoadStringW( NULL, IDC_CONFIRMTITLE, confirm_title, sizeof(confirm_title)/sizeof(WCHAR) ); LoadStringW( NULL, IDC_CONFIRMTITLE, confirm_title, ARRAY_SIZE(confirm_title));
LoadStringW( NULL, IDC_CONFIRMTEXT, confirm_text, sizeof(confirm_text)/sizeof(WCHAR) ); LoadStringW( NULL, IDC_CONFIRMTEXT, confirm_text, ARRAY_SIZE(confirm_text));
confirm_msgbox_result = MessageBoxW( hDlg, confirm_text, confirm_title, MB_OKCANCEL | MB_DEFBUTTON2 | MB_ICONWARNING ); confirm_msgbox_result = MessageBoxW( hDlg, confirm_text, confirm_title, MB_OKCANCEL | MB_DEFBUTTON2 | MB_ICONWARNING );
if( confirm_msgbox_result != IDOK ) if( confirm_msgbox_result != IDOK )
break; break;

View File

@ -112,7 +112,7 @@ static void LoadBoard( BOARD *p_board )
size = sizeof( data ); size = sizeof( data );
if( RegQueryValueExW( hkey, key_name, NULL, &type, if( RegQueryValueExW( hkey, key_name, NULL, &type,
(LPBYTE) data, &size ) == ERROR_SUCCESS ) (LPBYTE) data, &size ) == ERROR_SUCCESS )
lstrcpynW( p_board->best_name[i], data, sizeof(p_board->best_name[i])/sizeof(WCHAR) ); lstrcpynW( p_board->best_name[i], data, ARRAY_SIZE(p_board->best_name[i]));
else else
LoadStringW( p_board->hInst, IDS_NOBODY, p_board->best_name[i], MAX_PLAYER_NAME_SIZE+1 ); LoadStringW( p_board->hInst, IDS_NOBODY, p_board->best_name[i], MAX_PLAYER_NAME_SIZE+1 );
} }
@ -179,7 +179,7 @@ void SaveBoard( BOARD *p_board )
for( i = 0; i < 3; i++ ) { for( i = 0; i < 3; i++ ) {
wsprintfW( key_name, nameW, i+1 ); wsprintfW( key_name, nameW, i+1 );
lstrcpynW( data, p_board->best_name[i], sizeof(data)/sizeof(WCHAR) ); lstrcpynW( data, p_board->best_name[i], ARRAY_SIZE(data));
RegSetValueExW( hkey, key_name, 0, REG_SZ, (LPBYTE) data, (lstrlenW(data)+1) * sizeof(WCHAR) ); RegSetValueExW( hkey, key_name, 0, REG_SZ, (LPBYTE) data, (lstrlenW(data)+1) * sizeof(WCHAR) );
} }
@ -1003,8 +1003,8 @@ static LRESULT WINAPI MainProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
case IDM_ABOUT: case IDM_ABOUT:
{ {
WCHAR appname[256], other[256]; WCHAR appname[256], other[256];
LoadStringW( board.hInst, IDS_APPNAME, appname, sizeof(appname)/sizeof(WCHAR) ); LoadStringW( board.hInst, IDS_APPNAME, appname, ARRAY_SIZE(appname));
LoadStringW( board.hInst, IDS_ABOUT, other, sizeof(other)/sizeof(WCHAR) ); LoadStringW( board.hInst, IDS_ABOUT, other, ARRAY_SIZE(other));
ShellAboutW( hWnd, appname, other, ShellAboutW( hWnd, appname, other,
LoadImageW(board.hInst, MAKEINTRESOURCEW(IDI_WINEMINE), IMAGE_ICON, 48, 48, LR_SHARED)); LoadImageW(board.hInst, MAKEINTRESOURCEW(IDI_WINEMINE), IMAGE_ICON, 48, 48, LR_SHARED));
return 0; return 0;
@ -1025,7 +1025,7 @@ int WINAPI wWinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int c
HACCEL haccel; HACCEL haccel;
WCHAR appname[20]; WCHAR appname[20];
LoadStringW( hInst, IDS_APPNAME, appname, sizeof(appname)/sizeof(WCHAR)); LoadStringW( hInst, IDS_APPNAME, appname, ARRAY_SIZE(appname));
wc.cbSize = sizeof(wc); wc.cbSize = sizeof(wc);
wc.style = 0; wc.style = 0;