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
8fe1c228
Commit
8fe1c228
authored
Nov 23, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Nov 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/header: Use CRT allocation functions.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
41b4d9b3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
21 deletions
+20
-21
header.c
dlls/comctl32/header.c
+20
-21
No files found.
dlls/comctl32/header.c
View file @
8fe1c228
...
@@ -41,7 +41,6 @@
...
@@ -41,7 +41,6 @@
#include "vssym32.h"
#include "vssym32.h"
#include "uxtheme.h"
#include "uxtheme.h"
#include "wine/debug.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
header
);
WINE_DEFAULT_DEBUG_CHANNEL
(
header
);
...
@@ -141,7 +140,7 @@ static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, UINT mask, const HDI
...
@@ -141,7 +140,7 @@ static void HEADER_StoreHDItemInHeader(HEADER_ITEM *lpItem, UINT mask, const HDI
if
(
mask
&
HDI_TEXT
)
if
(
mask
&
HDI_TEXT
)
{
{
heap_
free
(
lpItem
->
pszText
);
free
(
lpItem
->
pszText
);
lpItem
->
pszText
=
NULL
;
lpItem
->
pszText
=
NULL
;
if
(
phdi
->
pszText
!=
LPSTR_TEXTCALLBACKW
)
/* covers != TEXTCALLBACKA too */
if
(
phdi
->
pszText
!=
LPSTR_TEXTCALLBACKW
)
/* covers != TEXTCALLBACKA too */
...
@@ -336,7 +335,7 @@ static HRGN create_sort_arrow( INT x, INT y, INT h, BOOL is_up )
...
@@ -336,7 +335,7 @@ static HRGN create_sort_arrow( INT x, INT y, INT h, BOOL is_up )
if
(
size
>
sizeof
(
buffer
))
if
(
size
>
sizeof
(
buffer
))
{
{
data
=
heap_
alloc
(
size
);
data
=
m
alloc
(
size
);
if
(
!
data
)
return
NULL
;
if
(
!
data
)
return
NULL
;
}
}
data
->
rdh
.
dwSize
=
sizeof
(
data
->
rdh
);
data
->
rdh
.
dwSize
=
sizeof
(
data
->
rdh
);
...
@@ -362,7 +361,7 @@ static HRGN create_sort_arrow( INT x, INT y, INT h, BOOL is_up )
...
@@ -362,7 +361,7 @@ static HRGN create_sort_arrow( INT x, INT y, INT h, BOOL is_up )
data
->
rdh
.
nCount
++
;
data
->
rdh
.
nCount
++
;
}
}
rgn
=
ExtCreateRegion
(
NULL
,
size
,
data
);
rgn
=
ExtCreateRegion
(
NULL
,
size
,
data
);
if
(
data
!=
(
RGNDATA
*
)
buffer
)
heap_
free
(
data
);
if
(
data
!=
(
RGNDATA
*
)
buffer
)
free
(
data
);
return
rgn
;
return
rgn
;
}
}
...
@@ -983,7 +982,7 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
...
@@ -983,7 +982,7 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
if
(
mask
&
HDI_TEXT
&&
lpItem
->
pszText
!=
NULL
)
if
(
mask
&
HDI_TEXT
&&
lpItem
->
pszText
!=
NULL
)
{
{
ERR
(
"(): function called without a call to FreeCallbackItems
\n
"
);
ERR
(
"(): function called without a call to FreeCallbackItems
\n
"
);
heap_
free
(
lpItem
->
pszText
);
free
(
lpItem
->
pszText
);
lpItem
->
pszText
=
NULL
;
lpItem
->
pszText
=
NULL
;
}
}
...
@@ -994,13 +993,13 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
...
@@ -994,13 +993,13 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
{
{
dispInfo
.
hdr
.
code
=
HDN_GETDISPINFOW
;
dispInfo
.
hdr
.
code
=
HDN_GETDISPINFOW
;
if
(
mask
&
HDI_TEXT
)
if
(
mask
&
HDI_TEXT
)
pvBuffer
=
heap_alloc_zero
(
MAX_HEADER_TEXT_LEN
*
sizeof
(
WCHAR
));
pvBuffer
=
calloc
(
MAX_HEADER_TEXT_LEN
,
sizeof
(
WCHAR
));
}
}
else
else
{
{
dispInfo
.
hdr
.
code
=
HDN_GETDISPINFOA
;
dispInfo
.
hdr
.
code
=
HDN_GETDISPINFOA
;
if
(
mask
&
HDI_TEXT
)
if
(
mask
&
HDI_TEXT
)
pvBuffer
=
heap_alloc_zero
(
MAX_HEADER_TEXT_LEN
*
sizeof
(
CHAR
));
pvBuffer
=
calloc
(
MAX_HEADER_TEXT_LEN
,
sizeof
(
CHAR
));
}
}
dispInfo
.
pszText
=
pvBuffer
;
dispInfo
.
pszText
=
pvBuffer
;
dispInfo
.
cchTextMax
=
(
pvBuffer
!=
NULL
?
MAX_HEADER_TEXT_LEN
:
0
);
dispInfo
.
cchTextMax
=
(
pvBuffer
!=
NULL
?
MAX_HEADER_TEXT_LEN
:
0
);
...
@@ -1031,7 +1030,7 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
...
@@ -1031,7 +1030,7 @@ HEADER_PrepareCallbackItems(const HEADER_INFO *infoPtr, INT iItem, INT reqMask)
else
else
{
{
Str_SetPtrAtoW
(
&
lpItem
->
pszText
,
(
LPSTR
)
dispInfo
.
pszText
);
Str_SetPtrAtoW
(
&
lpItem
->
pszText
,
(
LPSTR
)
dispInfo
.
pszText
);
heap_
free
(
pvBuffer
);
free
(
pvBuffer
);
}
}
}
}
...
@@ -1057,7 +1056,7 @@ HEADER_FreeCallbackItems(HEADER_ITEM *lpItem)
...
@@ -1057,7 +1056,7 @@ HEADER_FreeCallbackItems(HEADER_ITEM *lpItem)
{
{
if
(
lpItem
->
callbackMask
&
HDI_TEXT
)
if
(
lpItem
->
callbackMask
&
HDI_TEXT
)
{
{
heap_
free
(
lpItem
->
pszText
);
free
(
lpItem
->
pszText
);
lpItem
->
pszText
=
NULL
;
lpItem
->
pszText
=
NULL
;
}
}
...
@@ -1179,15 +1178,15 @@ HEADER_DeleteItem (HEADER_INFO *infoPtr, INT iItem)
...
@@ -1179,15 +1178,15 @@ HEADER_DeleteItem (HEADER_INFO *infoPtr, INT iItem)
TRACE
(
"%d: order=%d, iOrder=%d, ->iOrder=%d
\n
"
,
i
,
infoPtr
->
order
[
i
],
infoPtr
->
items
[
i
].
iOrder
,
infoPtr
->
items
[
infoPtr
->
order
[
i
]].
iOrder
);
TRACE
(
"%d: order=%d, iOrder=%d, ->iOrder=%d
\n
"
,
i
,
infoPtr
->
order
[
i
],
infoPtr
->
items
[
i
].
iOrder
,
infoPtr
->
items
[
infoPtr
->
order
[
i
]].
iOrder
);
iOrder
=
infoPtr
->
items
[
iItem
].
iOrder
;
iOrder
=
infoPtr
->
items
[
iItem
].
iOrder
;
heap_
free
(
infoPtr
->
items
[
iItem
].
pszText
);
free
(
infoPtr
->
items
[
iItem
].
pszText
);
infoPtr
->
uNumItem
--
;
infoPtr
->
uNumItem
--
;
memmove
(
&
infoPtr
->
items
[
iItem
],
&
infoPtr
->
items
[
iItem
+
1
],
memmove
(
&
infoPtr
->
items
[
iItem
],
&
infoPtr
->
items
[
iItem
+
1
],
(
infoPtr
->
uNumItem
-
iItem
)
*
sizeof
(
HEADER_ITEM
));
(
infoPtr
->
uNumItem
-
iItem
)
*
sizeof
(
HEADER_ITEM
));
memmove
(
&
infoPtr
->
order
[
iOrder
],
&
infoPtr
->
order
[
iOrder
+
1
],
memmove
(
&
infoPtr
->
order
[
iOrder
],
&
infoPtr
->
order
[
iOrder
+
1
],
(
infoPtr
->
uNumItem
-
iOrder
)
*
sizeof
(
INT
));
(
infoPtr
->
uNumItem
-
iOrder
)
*
sizeof
(
INT
));
infoPtr
->
items
=
heap_
realloc
(
infoPtr
->
items
,
sizeof
(
HEADER_ITEM
)
*
infoPtr
->
uNumItem
);
infoPtr
->
items
=
realloc
(
infoPtr
->
items
,
sizeof
(
HEADER_ITEM
)
*
infoPtr
->
uNumItem
);
infoPtr
->
order
=
heap_
realloc
(
infoPtr
->
order
,
sizeof
(
INT
)
*
infoPtr
->
uNumItem
);
infoPtr
->
order
=
realloc
(
infoPtr
->
order
,
sizeof
(
INT
)
*
infoPtr
->
uNumItem
);
/* Correct the orders */
/* Correct the orders */
for
(
i
=
0
;
i
<
infoPtr
->
uNumItem
;
i
++
)
for
(
i
=
0
;
i
<
infoPtr
->
uNumItem
;
i
++
)
...
@@ -1417,8 +1416,8 @@ HEADER_InsertItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL b
...
@@ -1417,8 +1416,8 @@ HEADER_InsertItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL b
iOrder
=
infoPtr
->
uNumItem
;
iOrder
=
infoPtr
->
uNumItem
;
infoPtr
->
uNumItem
++
;
infoPtr
->
uNumItem
++
;
infoPtr
->
items
=
heap_
realloc
(
infoPtr
->
items
,
sizeof
(
HEADER_ITEM
)
*
infoPtr
->
uNumItem
);
infoPtr
->
items
=
realloc
(
infoPtr
->
items
,
sizeof
(
HEADER_ITEM
)
*
infoPtr
->
uNumItem
);
infoPtr
->
order
=
heap_
realloc
(
infoPtr
->
order
,
sizeof
(
INT
)
*
infoPtr
->
uNumItem
);
infoPtr
->
order
=
realloc
(
infoPtr
->
order
,
sizeof
(
INT
)
*
infoPtr
->
uNumItem
);
/* make space for the new item */
/* make space for the new item */
memmove
(
&
infoPtr
->
items
[
nItem
+
1
],
&
infoPtr
->
items
[
nItem
],
memmove
(
&
infoPtr
->
items
[
nItem
+
1
],
&
infoPtr
->
items
[
nItem
],
...
@@ -1537,7 +1536,7 @@ HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUni
...
@@ -1537,7 +1536,7 @@ HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUni
HEADER_CopyHDItemForNotify
(
infoPtr
,
&
hdNotify
,
phdi
,
bUnicode
,
&
pvScratch
);
HEADER_CopyHDItemForNotify
(
infoPtr
,
&
hdNotify
,
phdi
,
bUnicode
,
&
pvScratch
);
if
(
HEADER_SendNotifyWithHDItemT
(
infoPtr
,
HDN_ITEMCHANGINGW
,
nItem
,
&
hdNotify
))
if
(
HEADER_SendNotifyWithHDItemT
(
infoPtr
,
HDN_ITEMCHANGINGW
,
nItem
,
&
hdNotify
))
{
{
heap_
free
(
pvScratch
);
free
(
pvScratch
);
return
FALSE
;
return
FALSE
;
}
}
...
@@ -1554,7 +1553,7 @@ HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUni
...
@@ -1554,7 +1553,7 @@ HEADER_SetItemT (HEADER_INFO *infoPtr, INT nItem, const HDITEMW *phdi, BOOL bUni
InvalidateRect
(
infoPtr
->
hwndSelf
,
NULL
,
FALSE
);
InvalidateRect
(
infoPtr
->
hwndSelf
,
NULL
,
FALSE
);
heap_
free
(
pvScratch
);
free
(
pvScratch
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -1577,7 +1576,7 @@ HEADER_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
...
@@ -1577,7 +1576,7 @@ HEADER_Create (HWND hwnd, const CREATESTRUCTW *lpcs)
HFONT
hOldFont
;
HFONT
hOldFont
;
HDC
hdc
;
HDC
hdc
;
infoPtr
=
heap_alloc_zero
(
sizeof
(
*
infoPtr
));
infoPtr
=
calloc
(
1
,
sizeof
(
*
infoPtr
));
SetWindowLongPtrW
(
hwnd
,
0
,
(
DWORD_PTR
)
infoPtr
);
SetWindowLongPtrW
(
hwnd
,
0
,
(
DWORD_PTR
)
infoPtr
);
infoPtr
->
hwndSelf
=
hwnd
;
infoPtr
->
hwndSelf
=
hwnd
;
...
@@ -1632,14 +1631,14 @@ HEADER_NCDestroy (HEADER_INFO *infoPtr)
...
@@ -1632,14 +1631,14 @@ HEADER_NCDestroy (HEADER_INFO *infoPtr)
if
(
infoPtr
->
items
)
{
if
(
infoPtr
->
items
)
{
lpItem
=
infoPtr
->
items
;
lpItem
=
infoPtr
->
items
;
for
(
nItem
=
0
;
nItem
<
infoPtr
->
uNumItem
;
nItem
++
,
lpItem
++
)
for
(
nItem
=
0
;
nItem
<
infoPtr
->
uNumItem
;
nItem
++
,
lpItem
++
)
heap_
free
(
lpItem
->
pszText
);
free
(
lpItem
->
pszText
);
heap_
free
(
infoPtr
->
items
);
free
(
infoPtr
->
items
);
}
}
heap_
free
(
infoPtr
->
order
);
free
(
infoPtr
->
order
);
SetWindowLongPtrW
(
infoPtr
->
hwndSelf
,
0
,
0
);
SetWindowLongPtrW
(
infoPtr
->
hwndSelf
,
0
,
0
);
heap_
free
(
infoPtr
);
free
(
infoPtr
);
return
0
;
return
0
;
}
}
...
...
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