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
d3188ce1
Commit
d3188ce1
authored
Jul 24, 2018
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Aug 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hostname: Use the ARRAY_SIZE() macro.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b762bd7b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
hostname.c
programs/hostname/hostname.c
+4
-6
No files found.
programs/hostname/hostname.c
View file @
d3188ce1
...
...
@@ -90,8 +90,7 @@ static int hostname_message_printfW(int msg, ...)
WCHAR
msg_buffer
[
8192
];
int
len
;
LoadStringW
(
GetModuleHandleW
(
NULL
),
msg
,
msg_buffer
,
sizeof
(
msg_buffer
)
/
sizeof
(
WCHAR
));
LoadStringW
(
GetModuleHandleW
(
NULL
),
msg
,
msg_buffer
,
ARRAY_SIZE
(
msg_buffer
));
va_start
(
va_args
,
msg
);
len
=
hostname_vprintfW
(
msg_buffer
,
va_args
);
...
...
@@ -105,8 +104,7 @@ static int hostname_message(int msg)
static
const
WCHAR
formatW
[]
=
{
'%'
,
's'
,
0
};
WCHAR
msg_buffer
[
8192
];
LoadStringW
(
GetModuleHandleW
(
NULL
),
msg
,
msg_buffer
,
sizeof
(
msg_buffer
)
/
sizeof
(
WCHAR
));
LoadStringW
(
GetModuleHandleW
(
NULL
),
msg
,
msg_buffer
,
ARRAY_SIZE
(
msg_buffer
));
return
hostname_printfW
(
formatW
,
msg_buffer
);
}
...
...
@@ -119,7 +117,7 @@ static void display_computer_name(void)
WCHAR
nameW
[
256
];
gethostname
(
nameA
,
sizeof
(
nameA
));
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
nameA
,
sizeof
(
nameA
),
nameW
,
sizeof
(
nameW
)
/
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
nameA
,
sizeof
(
nameA
),
nameW
,
ARRAY_SIZE
(
nameW
));
hostname_printfW
(
fmtW
,
nameW
);
}
...
...
@@ -132,7 +130,7 @@ int wmain(int argc, WCHAR *argv[])
unsigned
int
i
;
if
(
!
strncmpW
(
argv
[
1
],
slashHelpW
,
sizeof
(
slashHelpW
)
/
sizeof
(
WCHAR
)
-
1
))
if
(
!
strncmpW
(
argv
[
1
],
slashHelpW
,
ARRAY_SIZE
(
slashHelpW
)
-
1
))
{
hostname_message
(
STRING_USAGE
);
return
1
;
...
...
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