Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
8969cf98
Commit
8969cf98
authored
Jul 13, 2018
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jul 13, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineconsole: Use the ARRAY_SIZE() macro.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d7fb7dfb
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
25 deletions
+20
-25
curses.c
programs/wineconsole/curses.c
+1
-1
dialog.c
programs/wineconsole/dialog.c
+9
-14
user.c
programs/wineconsole/user.c
+9
-9
wineconsole.c
programs/wineconsole/wineconsole.c
+1
-1
No files found.
programs/wineconsole/curses.c
View file @
8969cf98
...
...
@@ -340,7 +340,7 @@ static void WCCURSES_SetTitle(const struct inner_data* data)
{
WCHAR
wbuf
[
256
];
if
(
WINECON_GetConsoleTitle
(
data
->
hConIn
,
wbuf
,
sizeof
(
wbuf
)
/
sizeof
(
WCHAR
)))
if
(
WINECON_GetConsoleTitle
(
data
->
hConIn
,
wbuf
,
ARRAY_SIZE
(
wbuf
)))
{
char
buffer
[
256
];
...
...
programs/wineconsole/dialog.c
View file @
8969cf98
...
...
@@ -208,12 +208,10 @@ static LRESULT WINAPI WCUSER_FontPreviewProc(HWND hWnd, UINT msg, WPARAM wParam,
FillRect
(
ps
.
hdc
,
&
ps
.
rcPaint
,
CreateSolidBrush
(
bkcolor
));
SetBkColor
(
ps
.
hdc
,
bkcolor
);
SetTextColor
(
ps
.
hdc
,
get_color
(
di
,
IDC_FNT_COLOR_FG
));
len
=
LoadStringW
(
GetModuleHandleW
(
NULL
),
IDS_FNT_PREVIEW
,
buf
,
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]));
len
=
LoadStringW
(
GetModuleHandleW
(
NULL
),
IDS_FNT_PREVIEW
,
buf
,
ARRAY_SIZE
(
buf
));
if
(
len
)
TextOutW
(
ps
.
hdc
,
0
,
0
,
buf
,
len
);
TextOutW
(
ps
.
hdc
,
0
,
di
->
font
[
size_idx
].
height
,
ascii
,
sizeof
(
ascii
)
/
sizeof
(
ascii
[
0
])
-
1
);
TextOutW
(
ps
.
hdc
,
0
,
di
->
font
[
size_idx
].
height
,
ascii
,
ARRAY_SIZE
(
ascii
)
-
1
);
SelectObject
(
ps
.
hdc
,
hOldFont
);
}
EndPaint
(
hWnd
,
&
ps
);
...
...
@@ -366,7 +364,7 @@ static int CALLBACK font_enum_size(const LOGFONTW* lf, const TEXTMETRICW* tm,
static
const
int
sizes
[]
=
{
8
,
9
,
10
,
11
,
12
,
14
,
16
,
18
,
20
,
22
,
24
,
26
,
28
,
36
,
48
,
72
};
int
i
;
di
->
nFont
=
sizeof
(
sizes
)
/
sizeof
(
sizes
[
0
]
);
di
->
nFont
=
ARRAY_SIZE
(
sizes
);
di
->
font
=
HeapAlloc
(
GetProcessHeap
(),
0
,
di
->
nFont
*
sizeof
(
di
->
font
[
0
]));
for
(
i
=
0
;
i
<
di
->
nFont
;
i
++
)
{
...
...
@@ -459,11 +457,11 @@ static BOOL select_font(struct dialog_info* di)
SendDlgItemMessageW
(
di
->
hDlg
,
IDC_FNT_PREVIEW
,
WM_SETFONT
,
(
WPARAM
)
hFont
,
TRUE
);
if
(
hOldFont
)
DeleteObject
(
hOldFont
);
LoadStringW
(
GetModuleHandleW
(
NULL
),
IDS_FNT_DISPLAY
,
fmt
,
sizeof
(
fmt
)
/
sizeof
(
fmt
[
0
]
));
LoadStringW
(
GetModuleHandleW
(
NULL
),
IDS_FNT_DISPLAY
,
fmt
,
ARRAY_SIZE
(
fmt
));
args
[
0
]
=
config
.
cell_width
;
args
[
1
]
=
config
.
cell_height
;
FormatMessageW
(
FORMAT_MESSAGE_FROM_STRING
|
FORMAT_MESSAGE_ARGUMENT_ARRAY
,
fmt
,
0
,
0
,
buf
,
sizeof
(
buf
)
/
sizeof
(
*
buf
),
(
__ms_va_list
*
)
args
);
fmt
,
0
,
0
,
buf
,
ARRAY_SIZE
(
buf
),
(
__ms_va_list
*
)
args
);
SendDlgItemMessageW
(
di
->
hDlg
,
IDC_FNT_FONT_INFO
,
WM_SETTEXT
,
0
,
(
LPARAM
)
buf
);
...
...
@@ -687,10 +685,8 @@ static INT_PTR WINAPI WCUSER_ConfigDlgProc(HWND hDlg, UINT msg, WPARAM wParam, L
WCHAR
cap
[
256
];
WCHAR
txt
[
256
];
LoadStringW
(
GetModuleHandleW
(
NULL
),
IDS_DLG_TIT_ERROR
,
cap
,
sizeof
(
cap
)
/
sizeof
(
cap
[
0
]));
LoadStringW
(
GetModuleHandleW
(
NULL
),
IDS_DLG_ERR_SBWINSIZE
,
txt
,
sizeof
(
txt
)
/
sizeof
(
cap
[
0
]));
LoadStringW
(
GetModuleHandleW
(
NULL
),
IDS_DLG_TIT_ERROR
,
cap
,
ARRAY_SIZE
(
cap
));
LoadStringW
(
GetModuleHandleW
(
NULL
),
IDS_DLG_ERR_SBWINSIZE
,
txt
,
ARRAY_SIZE
(
txt
));
MessageBoxW
(
hDlg
,
txt
,
cap
,
MB_OK
);
SetWindowLongPtrW
(
hDlg
,
DWLP_MSGRESULT
,
PSNRET_INVALID
);
...
...
@@ -831,9 +827,8 @@ BOOL WCUSER_GetProperties(struct inner_data* data, BOOL current)
memset
(
&
psHead
,
0
,
sizeof
(
psHead
));
psHead
.
dwSize
=
sizeof
(
psHead
);
if
(
!
LoadStringW
(
GetModuleHandleW
(
NULL
),
(
current
)
?
IDS_DLG_TIT_CURRENT
:
IDS_DLG_TIT_DEFAULT
,
buff
,
sizeof
(
buff
)
/
sizeof
(
buff
[
0
])))
if
(
!
LoadStringW
(
GetModuleHandleW
(
NULL
),
(
current
)
?
IDS_DLG_TIT_CURRENT
:
IDS_DLG_TIT_DEFAULT
,
buff
,
ARRAY_SIZE
(
buff
)))
{
buff
[
0
]
=
'S'
;
buff
[
1
]
=
'e'
;
...
...
programs/wineconsole/user.c
View file @
8969cf98
...
...
@@ -823,25 +823,25 @@ static BOOL WCUSER_FillMenu(HMENU hMenu, BOOL sep)
hSubMenu
=
CreateMenu
();
if
(
!
hSubMenu
)
return
FALSE
;
LoadStringW
(
hInstance
,
IDS_MARK
,
buff
,
sizeof
(
buff
)
/
sizeof
(
buff
[
0
]
));
LoadStringW
(
hInstance
,
IDS_MARK
,
buff
,
ARRAY_SIZE
(
buff
));
InsertMenuW
(
hSubMenu
,
-
1
,
MF_BYPOSITION
|
MF_STRING
,
IDS_MARK
,
buff
);
LoadStringW
(
hInstance
,
IDS_COPY
,
buff
,
sizeof
(
buff
)
/
sizeof
(
buff
[
0
]
));
LoadStringW
(
hInstance
,
IDS_COPY
,
buff
,
ARRAY_SIZE
(
buff
));
InsertMenuW
(
hSubMenu
,
-
1
,
MF_BYPOSITION
|
MF_STRING
,
IDS_COPY
,
buff
);
LoadStringW
(
hInstance
,
IDS_PASTE
,
buff
,
sizeof
(
buff
)
/
sizeof
(
buff
[
0
]
));
LoadStringW
(
hInstance
,
IDS_PASTE
,
buff
,
ARRAY_SIZE
(
buff
));
InsertMenuW
(
hSubMenu
,
-
1
,
MF_BYPOSITION
|
MF_STRING
,
IDS_PASTE
,
buff
);
LoadStringW
(
hInstance
,
IDS_SELECTALL
,
buff
,
sizeof
(
buff
)
/
sizeof
(
buff
[
0
]
));
LoadStringW
(
hInstance
,
IDS_SELECTALL
,
buff
,
ARRAY_SIZE
(
buff
));
InsertMenuW
(
hSubMenu
,
-
1
,
MF_BYPOSITION
|
MF_STRING
,
IDS_SELECTALL
,
buff
);
LoadStringW
(
hInstance
,
IDS_SCROLL
,
buff
,
sizeof
(
buff
)
/
sizeof
(
buff
[
0
]
));
LoadStringW
(
hInstance
,
IDS_SCROLL
,
buff
,
ARRAY_SIZE
(
buff
));
InsertMenuW
(
hSubMenu
,
-
1
,
MF_BYPOSITION
|
MF_STRING
,
IDS_SCROLL
,
buff
);
LoadStringW
(
hInstance
,
IDS_SEARCH
,
buff
,
sizeof
(
buff
)
/
sizeof
(
buff
[
0
]
));
LoadStringW
(
hInstance
,
IDS_SEARCH
,
buff
,
ARRAY_SIZE
(
buff
));
InsertMenuW
(
hSubMenu
,
-
1
,
MF_BYPOSITION
|
MF_STRING
,
IDS_SEARCH
,
buff
);
if
(
sep
)
InsertMenuW
(
hMenu
,
-
1
,
MF_BYPOSITION
|
MF_SEPARATOR
,
0
,
NULL
);
LoadStringW
(
hInstance
,
IDS_EDIT
,
buff
,
sizeof
(
buff
)
/
sizeof
(
buff
[
0
]
));
LoadStringW
(
hInstance
,
IDS_EDIT
,
buff
,
ARRAY_SIZE
(
buff
));
InsertMenuW
(
hMenu
,
-
1
,
MF_BYPOSITION
|
MF_STRING
|
MF_POPUP
,
(
UINT_PTR
)
hSubMenu
,
buff
);
LoadStringW
(
hInstance
,
IDS_DEFAULT
,
buff
,
sizeof
(
buff
)
/
sizeof
(
buff
[
0
]
));
LoadStringW
(
hInstance
,
IDS_DEFAULT
,
buff
,
ARRAY_SIZE
(
buff
));
InsertMenuW
(
hMenu
,
-
1
,
MF_BYPOSITION
|
MF_STRING
,
IDS_DEFAULT
,
buff
);
LoadStringW
(
hInstance
,
IDS_PROPERTIES
,
buff
,
sizeof
(
buff
)
/
sizeof
(
buff
[
0
]
));
LoadStringW
(
hInstance
,
IDS_PROPERTIES
,
buff
,
ARRAY_SIZE
(
buff
));
InsertMenuW
(
hMenu
,
-
1
,
MF_BYPOSITION
|
MF_STRING
,
IDS_PROPERTIES
,
buff
);
return
TRUE
;
...
...
programs/wineconsole/wineconsole.c
View file @
8969cf98
...
...
@@ -45,7 +45,7 @@ static void printf_res(UINT uResId, ...)
va_list
args
;
va_start
(
args
,
uResId
);
LoadStringW
(
GetModuleHandleW
(
NULL
),
uResId
,
buffer
,
sizeof
(
buffer
)
/
sizeof
(
buffer
[
0
]
));
LoadStringW
(
GetModuleHandleW
(
NULL
),
uResId
,
buffer
,
ARRAY_SIZE
(
buffer
));
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
buffer
,
-
1
,
ansi
,
sizeof
(
ansi
),
NULL
,
NULL
);
vprintf
(
ansi
,
args
);
va_end
(
args
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment