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
2fab7995
Commit
2fab7995
authored
Aug 14, 2008
by
Rob Shearman
Committed by
Alexandre Julliard
Aug 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Avoid unnecessary allocations in TLB_MultiByteToBSTR and SLTG_ReadString.
parent
ef5a5a44
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
typelib.c
dlls/oleaut32/typelib.c
+6
-10
No files found.
dlls/oleaut32/typelib.c
View file @
2fab7995
...
...
@@ -2753,14 +2753,12 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength)
static
BSTR
TLB_MultiByteToBSTR
(
const
char
*
ptr
)
{
DWORD
len
;
WCHAR
*
nameW
;
BSTR
ret
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
ptr
,
-
1
,
NULL
,
0
);
nameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
ptr
,
-
1
,
nameW
,
len
);
ret
=
SysAllocString
(
nameW
);
HeapFree
(
GetProcessHeap
(),
0
,
nameW
);
ret
=
SysAllocStringLen
(
NULL
,
len
-
1
);
if
(
!
ret
)
return
ret
;
MultiByteToWideChar
(
CP_ACP
,
0
,
ptr
,
-
1
,
ret
,
len
);
return
ret
;
}
...
...
@@ -2790,16 +2788,14 @@ static WORD SLTG_ReadString(const char *ptr, BSTR *pBstr)
{
WORD
bytelen
;
DWORD
len
;
WCHAR
*
nameW
;
*
pBstr
=
NULL
;
bytelen
=
*
(
const
WORD
*
)
ptr
;
if
(
bytelen
==
0xffff
)
return
2
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
ptr
+
2
,
bytelen
,
NULL
,
0
);
nameW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
ptr
+
2
,
bytelen
,
nameW
,
len
);
*
pBstr
=
SysAllocStringLen
(
nameW
,
len
);
HeapFree
(
GetProcessHeap
(),
0
,
nameW
);
*
pBstr
=
SysAllocStringLen
(
NULL
,
len
-
1
);
if
(
*
pBstr
)
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
ptr
+
2
,
bytelen
,
*
pBstr
,
len
);
return
bytelen
+
2
;
}
...
...
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