Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
a0bef9f3
Commit
a0bef9f3
authored
Jul 03, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jul 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wscript: Use CRT memory allocation functions.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
201ed085
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
host.c
programs/wscript/host.c
+7
-8
No files found.
programs/wscript/host.c
View file @
a0bef9f3
...
...
@@ -28,7 +28,6 @@
#include "wscript.h"
#include <wine/debug.h>
#include <wine/heap.h>
WINE_DEFAULT_DEBUG_CHANNEL
(
wscript
);
...
...
@@ -81,13 +80,13 @@ static void print_string(const WCHAR *string)
}
lena
=
WideCharToMultiByte
(
GetOEMCP
(),
0
,
string
,
len
,
NULL
,
0
,
NULL
,
NULL
);
buf
=
heap_
alloc
(
len
);
buf
=
m
alloc
(
len
);
if
(
!
buf
)
return
;
WideCharToMultiByte
(
GetOEMCP
(),
0
,
string
,
len
,
buf
,
lena
,
NULL
,
NULL
);
WriteFile
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
buf
,
lena
,
&
count
,
FALSE
);
heap_
free
(
buf
);
free
(
buf
);
WriteFile
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
"
\r\n
"
,
2
,
&
count
,
FALSE
);
}
...
...
@@ -334,8 +333,8 @@ static HRESULT WINAPI Host_Echo(IHost *iface, SAFEARRAY *args)
return
hres
;
argc
=
ubound
-
lbound
+
1
;
strs
=
heap_alloc_zero
(
argc
*
sizeof
(
*
strs
));
if
(
!
strs
)
{
if
(
!
(
strs
=
calloc
(
argc
,
sizeof
(
*
strs
))))
{
SafeArrayUnaccessData
(
args
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -353,7 +352,7 @@ static HRESULT WINAPI Host_Echo(IHost *iface, SAFEARRAY *args)
SafeArrayUnaccessData
(
args
);
if
(
SUCCEEDED
(
hres
))
{
ptr
=
output
=
heap_
alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
ptr
=
output
=
m
alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
if
(
output
)
{
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
if
(
i
)
...
...
@@ -370,13 +369,13 @@ static HRESULT WINAPI Host_Echo(IHost *iface, SAFEARRAY *args)
for
(
i
=
0
;
i
<
argc
;
i
++
)
SysFreeString
(
strs
[
i
]);
heap_
free
(
strs
);
free
(
strs
);
if
(
FAILED
(
hres
))
return
hres
;
print_string
(
output
);
heap_
free
(
output
);
free
(
output
);
return
S_OK
;
}
...
...
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