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
2217e42c
Commit
2217e42c
authored
May 02, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
May 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Added warn+heap support for cached BSTRs.
parent
4eebe0bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
oleaut.c
dlls/oleaut32/oleaut.c
+20
-0
No files found.
dlls/oleaut32/oleaut.c
View file @
2217e42c
...
...
@@ -41,6 +41,7 @@
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
ole
);
WINE_DECLARE_DEBUG_CHANNEL
(
heap
);
/******************************************************************************
* BSTR {OLEAUT32}
...
...
@@ -97,6 +98,10 @@ typedef struct {
#define BUCKET_SIZE 16
#define ARENA_INUSE_FILLER 0x55
#define ARENA_TAIL_FILLER 0xab
#define ARENA_FREE_FILLER 0xfeeefeee
static
bstr_cache_entry_t
bstr_cache
[
0x10000
/
BUCKET_SIZE
];
static
inline
size_t
bstr_alloc_size
(
size_t
size
)
...
...
@@ -140,6 +145,14 @@ static bstr_t *alloc_bstr(size_t size)
LeaveCriticalSection
(
&
cs_bstr_cache
);
if
(
cache_entry
)
{
if
(
WARN_ON
(
heap
))
{
size_t
tail
;
memset
(
ret
,
ARENA_INUSE_FILLER
,
FIELD_OFFSET
(
bstr_t
,
u
.
ptr
[
size
+
sizeof
(
WCHAR
)]));
tail
=
bstr_alloc_size
(
size
)
-
FIELD_OFFSET
(
bstr_t
,
u
.
ptr
[
size
+
sizeof
(
WCHAR
)]);
if
(
tail
)
memset
(
ret
->
u
.
ptr
+
size
+
sizeof
(
WCHAR
),
ARENA_TAIL_FILLER
,
tail
);
}
ret
->
size
=
size
;
return
ret
;
}
...
...
@@ -250,6 +263,13 @@ void WINAPI SysFreeString(BSTR str)
cache_entry
->
buf
[(
cache_entry
->
head
+
cache_entry
->
cnt
)
%
((
sizeof
(
cache_entry
->
buf
)
/
sizeof
(
*
cache_entry
->
buf
)))]
=
bstr
;
cache_entry
->
cnt
++
;
if
(
WARN_ON
(
heap
))
{
unsigned
i
,
n
=
bstr_alloc_size
(
bstr
->
size
)
/
sizeof
(
DWORD
)
-
1
;
bstr
->
size
=
ARENA_FREE_FILLER
;
for
(
i
=
0
;
i
<
n
;
i
++
)
bstr
->
u
.
dwptr
[
i
]
=
ARENA_FREE_FILLER
;
}
LeaveCriticalSection
(
&
cs_bstr_cache
);
return
;
}
...
...
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