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
08fff518
Commit
08fff518
authored
Jun 04, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineandroid: Use libc for memory allocation.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
parent
4f09c548
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
41 deletions
+41
-41
device.c
dlls/wineandroid.drv/device.c
+8
-8
init.c
dlls/wineandroid.drv/init.c
+2
-2
opengl.c
dlls/wineandroid.drv/opengl.c
+9
-8
window.c
dlls/wineandroid.drv/window.c
+22
-23
No files found.
dlls/wineandroid.drv/device.c
View file @
08fff518
...
...
@@ -486,7 +486,7 @@ static void free_native_win_data( struct native_win_data *data )
InterlockedCompareExchangePointer
(
(
void
**
)
&
capture_window
,
0
,
data
->
hwnd
);
release_native_window
(
data
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
data_map
[
idx
]
=
NULL
;
}
...
...
@@ -500,7 +500,7 @@ static struct native_win_data *create_native_win_data( HWND hwnd, BOOL opengl )
WARN
(
"data for %p not freed correctly
\n
"
,
data
->
hwnd
);
free_native_win_data
(
data
);
}
if
(
!
(
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
data
)
)))
return
NULL
;
if
(
!
(
data
=
calloc
(
1
,
sizeof
(
*
data
)
)))
return
NULL
;
data
->
hwnd
=
hwnd
;
data
->
opengl
=
opengl
;
if
(
!
opengl
)
data
->
api
=
NATIVE_WINDOW_API_CPU
;
...
...
@@ -1255,7 +1255,7 @@ static void buffer_decRef( struct android_native_base_t *base )
{
if
(
!
is_in_desktop_process
())
gralloc_release_buffer
(
&
buffer
->
buffer
);
if
(
buffer
->
bits
)
UnmapViewOfFile
(
buffer
->
bits
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
free
(
buffer
);
}
}
...
...
@@ -1277,7 +1277,7 @@ static int dequeueBuffer( struct ANativeWindow *window, struct ANativeWindowBuff
/* if we received the native handle, this is a new buffer */
if
(
size
>
offsetof
(
struct
ioctl_android_dequeueBuffer
,
native_handle
))
{
struct
native_buffer_wrapper
*
buf
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
buf
)
);
struct
native_buffer_wrapper
*
buf
=
calloc
(
1
,
sizeof
(
*
buf
)
);
buf
->
buffer
.
common
.
magic
=
ANDROID_NATIVE_BUFFER_MAGIC
;
buf
->
buffer
.
common
.
version
=
sizeof
(
buf
->
buffer
);
...
...
@@ -1534,7 +1534,7 @@ static int perform( ANativeWindow *window, int operation, ... )
struct
ANativeWindow
*
create_ioctl_window
(
HWND
hwnd
,
BOOL
opengl
,
float
scale
)
{
struct
ioctl_android_create_window
req
;
struct
native_win_wrapper
*
win
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
win
)
);
struct
native_win_wrapper
*
win
=
calloc
(
1
,
sizeof
(
*
win
)
);
if
(
!
win
)
return
NULL
;
...
...
@@ -1585,7 +1585,7 @@ void release_ioctl_window( struct ANativeWindow *window )
if
(
win
->
buffers
[
i
])
win
->
buffers
[
i
]
->
buffer
.
common
.
decRef
(
&
win
->
buffers
[
i
]
->
buffer
.
common
);
destroy_ioctl_window
(
win
->
hwnd
,
win
->
opengl
);
HeapFree
(
GetProcessHeap
(),
0
,
win
);
free
(
win
);
}
void
destroy_ioctl_window
(
HWND
hwnd
,
BOOL
opengl
)
...
...
@@ -1641,7 +1641,7 @@ int ioctl_set_cursor( int id, int width, int height,
unsigned
int
size
=
offsetof
(
struct
ioctl_android_set_cursor
,
bits
[
width
*
height
]
);
int
ret
;
if
(
!
(
req
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
return
-
ENOMEM
;
if
(
!
(
req
=
malloc
(
size
)))
return
-
ENOMEM
;
req
->
hdr
.
hwnd
=
0
;
/* unused */
req
->
hdr
.
opengl
=
FALSE
;
req
->
id
=
id
;
...
...
@@ -1651,6 +1651,6 @@ int ioctl_set_cursor( int id, int width, int height,
req
->
hotspoty
=
hotspoty
;
memcpy
(
req
->
bits
,
bits
,
width
*
height
*
sizeof
(
req
->
bits
[
0
])
);
ret
=
android_ioctl
(
IOCTL_SET_CURSOR
,
req
,
size
,
NULL
,
NULL
);
HeapFree
(
GetProcessHeap
(),
0
,
req
);
free
(
req
);
return
ret
;
}
dlls/wineandroid.drv/init.c
View file @
08fff518
...
...
@@ -210,7 +210,7 @@ static ANDROID_PDEVICE *create_android_physdev(void)
if
(
!
device_init_done
)
device_init
();
if
(
!
(
physdev
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
physdev
)
)))
return
NULL
;
if
(
!
(
physdev
=
calloc
(
1
,
sizeof
(
*
physdev
)
)))
return
NULL
;
return
physdev
;
}
...
...
@@ -248,7 +248,7 @@ static BOOL CDECL ANDROID_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev )
*/
static
BOOL
CDECL
ANDROID_DeleteDC
(
PHYSDEV
dev
)
{
HeapFree
(
GetProcessHeap
(),
0
,
dev
);
free
(
dev
);
return
TRUE
;
}
...
...
dlls/wineandroid.drv/opengl.c
View file @
08fff518
...
...
@@ -115,7 +115,7 @@ static inline BOOL is_onscreen_pixel_format( int format )
static
struct
gl_drawable
*
create_gl_drawable
(
HWND
hwnd
,
HDC
hdc
,
int
format
)
{
static
const
int
attribs
[]
=
{
EGL_WIDTH
,
1
,
EGL_HEIGHT
,
1
,
EGL_NONE
};
struct
gl_drawable
*
gl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
gl
)
);
struct
gl_drawable
*
gl
=
malloc
(
sizeof
(
*
gl
)
);
gl
->
hwnd
=
hwnd
;
gl
->
hdc
=
hdc
;
...
...
@@ -159,7 +159,7 @@ void destroy_gl_drawable( HWND hwnd )
if
(
gl
->
surface
)
p_eglDestroySurface
(
display
,
gl
->
surface
);
if
(
gl
->
pbuffer
)
p_eglDestroySurface
(
display
,
gl
->
pbuffer
);
release_ioctl_window
(
gl
->
window
);
HeapFree
(
GetProcessHeap
(),
0
,
gl
);
free
(
gl
);
break
;
}
pthread_mutex_unlock
(
&
drawable_mutex
);
...
...
@@ -250,7 +250,7 @@ static struct wgl_context *create_context( HDC hdc, struct wgl_context *share, c
if
(
!
(
gl
=
get_gl_drawable
(
NtUserWindowFromDC
(
hdc
),
hdc
)))
return
NULL
;
ctx
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
ctx
)
);
ctx
=
malloc
(
sizeof
(
*
ctx
)
);
ctx
->
config
=
pixel_formats
[
gl
->
format
-
1
].
config
;
ctx
->
surface
=
0
;
...
...
@@ -436,7 +436,8 @@ static BOOL WINAPI android_wglDeleteContext( struct wgl_context *ctx )
list_remove
(
&
ctx
->
entry
);
pthread_mutex_unlock
(
&
drawable_mutex
);
p_eglDestroyContext
(
display
,
ctx
->
context
);
return
HeapFree
(
GetProcessHeap
(),
0
,
ctx
);
free
(
ctx
);
return
TRUE
;
}
/***********************************************************************
...
...
@@ -980,13 +981,13 @@ static BOOL egl_init(void)
TRACE
(
"display %p version %u.%u
\n
"
,
display
,
major
,
minor
);
p_eglGetConfigs
(
display
,
NULL
,
0
,
&
count
);
configs
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
*
sizeof
(
*
configs
)
);
pixel_formats
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
*
sizeof
(
*
pixel_formats
)
);
configs
=
malloc
(
count
*
sizeof
(
*
configs
)
);
pixel_formats
=
malloc
(
count
*
sizeof
(
*
pixel_formats
)
);
p_eglGetConfigs
(
display
,
configs
,
count
,
&
count
);
if
(
!
count
||
!
configs
||
!
pixel_formats
)
{
HeapFree
(
GetProcessHeap
(),
0
,
configs
);
HeapFree
(
GetProcessHeap
(),
0
,
pixel_formats
);
free
(
configs
);
free
(
pixel_formats
);
ERR
(
"eglGetConfigs returned no configs
\n
"
);
return
0
;
}
...
...
dlls/wineandroid.drv/window.c
View file @
08fff518
...
...
@@ -118,7 +118,7 @@ static struct android_win_data *alloc_win_data( HWND hwnd )
{
struct
android_win_data
*
data
;
if
((
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
data
)
)))
if
((
data
=
calloc
(
1
,
sizeof
(
*
data
)
)))
{
data
->
hwnd
=
hwnd
;
data
->
window
=
create_ioctl_window
(
hwnd
,
FALSE
,
...
...
@@ -138,7 +138,7 @@ static void free_win_data( struct android_win_data *data )
win_data_context
[
context_idx
(
data
->
hwnd
)]
=
NULL
;
pthread_mutex_unlock
(
&
win_data_mutex
);
if
(
data
->
window
)
release_ioctl_window
(
data
->
window
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
}
...
...
@@ -402,13 +402,13 @@ static void pull_events(void)
for
(;;)
{
if
(
!
(
event
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
event
)
)))
break
;
if
(
!
(
event
=
malloc
(
sizeof
(
*
event
)
)))
break
;
res
=
read
(
event_pipe
[
0
],
&
event
->
data
,
sizeof
(
event
->
data
)
);
if
(
res
!=
sizeof
(
event
->
data
))
break
;
list_add_tail
(
&
event_queue
,
&
event
->
entry
);
}
HeapFree
(
GetProcessHeap
(),
0
,
event
);
free
(
event
);
}
...
...
@@ -533,7 +533,7 @@ static int process_events( DWORD mask )
default:
FIXME
(
"got event %u
\n
"
,
event
->
data
.
type
);
}
HeapFree
(
GetProcessHeap
(),
0
,
event
);
free
(
event
);
count
++
;
/* next may have been removed by a recursive call, so reset it to the beginning of the list */
next
=
LIST_ENTRY
(
event_queue
.
next
,
struct
java_event
,
entry
);
...
...
@@ -802,11 +802,11 @@ static void android_surface_destroy( struct window_surface *window_surface )
TRACE
(
"freeing %p bits %p
\n
"
,
surface
,
surface
->
bits
);
HeapFree
(
GetProcessHeap
(),
0
,
surface
->
region_data
);
free
(
surface
->
region_data
);
if
(
surface
->
region
)
NtGdiDeleteObjectApp
(
surface
->
region
);
release_ioctl_window
(
surface
->
window
);
HeapFree
(
GetProcessHeap
(),
0
,
surface
->
bits
);
HeapFree
(
GetProcessHeap
(),
0
,
surface
);
free
(
surface
->
bits
);
free
(
surface
);
}
static
const
struct
window_surface_funcs
android_surface_funcs
=
...
...
@@ -875,17 +875,17 @@ static void set_surface_region( struct window_surface *window_surface, HRGN win_
if
(
surface
->
region
)
NtGdiCombineRgn
(
region
,
region
,
surface
->
region
,
RGN_AND
);
if
(
!
(
size
=
NtGdiGetRegionData
(
region
,
0
,
NULL
)))
goto
done
;
if
(
!
(
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
goto
done
;
if
(
!
(
data
=
malloc
(
size
)))
goto
done
;
if
(
!
NtGdiGetRegionData
(
region
,
size
,
data
))
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
data
=
NULL
;
}
done:
window_surface
->
funcs
->
lock
(
window_surface
);
HeapFree
(
GetProcessHeap
(),
0
,
surface
->
region_data
);
free
(
surface
->
region_data
);
surface
->
region_data
=
data
;
*
window_surface
->
funcs
->
get_bounds
(
window_surface
)
=
surface
->
header
.
rect
;
window_surface
->
funcs
->
unlock
(
window_surface
);
...
...
@@ -902,8 +902,7 @@ static struct window_surface *create_surface( HWND hwnd, const RECT *rect,
int
width
=
rect
->
right
-
rect
->
left
,
height
=
rect
->
bottom
-
rect
->
top
;
pthread_mutexattr_t
attr
;
surface
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
FIELD_OFFSET
(
struct
android_window_surface
,
info
.
bmiColors
[
3
]
));
surface
=
calloc
(
1
,
FIELD_OFFSET
(
struct
android_window_surface
,
info
.
bmiColors
[
3
]
));
if
(
!
surface
)
return
NULL
;
set_color_info
(
&
surface
->
info
,
src_alpha
);
surface
->
info
.
bmiHeader
.
biWidth
=
width
;
...
...
@@ -926,7 +925,7 @@ static struct window_surface *create_surface( HWND hwnd, const RECT *rect,
set_surface_region
(
&
surface
->
header
,
(
HRGN
)
1
);
reset_bounds
(
&
surface
->
bounds
);
if
(
!
(
surface
->
bits
=
HeapAlloc
(
GetProcessHeap
(),
0
,
surface
->
info
.
bmiHeader
.
biSizeImage
)))
if
(
!
(
surface
->
bits
=
malloc
(
surface
->
info
.
bmiHeader
.
biSizeImage
)))
goto
failed
;
TRACE
(
"created %p hwnd %p %s bits %p-%p
\n
"
,
surface
,
hwnd
,
wine_dbgstr_rect
(
rect
),
...
...
@@ -974,12 +973,12 @@ static unsigned int *get_mono_icon_argb( HDC hdc, HBITMAP bmp, unsigned int *wid
if
(
!
NtGdiExtGetObjectW
(
bmp
,
sizeof
(
bm
),
&
bm
))
return
NULL
;
stride
=
((
bm
.
bmWidth
+
15
)
>>
3
)
&
~
1
;
mask_size
=
stride
*
bm
.
bmHeight
;
if
(
!
(
mask
=
HeapAlloc
(
GetProcessHeap
(),
0
,
mask_size
)))
return
NULL
;
if
(
!
(
mask
=
malloc
(
mask_size
)))
return
NULL
;
if
(
!
NtGdiGetBitmapBits
(
bmp
,
mask_size
,
mask
))
goto
done
;
bm
.
bmHeight
/=
2
;
bits_size
=
bm
.
bmWidth
*
bm
.
bmHeight
*
sizeof
(
*
bits
);
if
(
!
(
bits
=
HeapAlloc
(
GetProcessHeap
(),
0
,
bits_size
)))
goto
done
;
if
(
!
(
bits
=
malloc
(
bits_size
)))
goto
done
;
ptr
=
bits
;
for
(
i
=
0
;
i
<
bm
.
bmHeight
;
i
++
)
...
...
@@ -1000,7 +999,7 @@ static unsigned int *get_mono_icon_argb( HDC hdc, HBITMAP bmp, unsigned int *wid
*
height
=
bm
.
bmHeight
;
done:
HeapFree
(
GetProcessHeap
(),
0
,
mask
);
free
(
mask
);
return
bits
;
}
...
...
@@ -1034,7 +1033,7 @@ static unsigned int *get_bitmap_argb( HDC hdc, HBITMAP color, HBITMAP mask, unsi
info
->
bmiHeader
.
biYPelsPerMeter
=
0
;
info
->
bmiHeader
.
biClrUsed
=
0
;
info
->
bmiHeader
.
biClrImportant
=
0
;
if
(
!
(
bits
=
HeapAlloc
(
GetProcessHeap
(),
0
,
bm
.
bmWidth
*
bm
.
bmHeight
*
sizeof
(
unsigned
int
)
)))
if
(
!
(
bits
=
malloc
(
bm
.
bmWidth
*
bm
.
bmHeight
*
sizeof
(
unsigned
int
)
)))
goto
failed
;
if
(
!
NtGdiGetDIBitsInternal
(
hdc
,
color
,
0
,
bm
.
bmHeight
,
bits
,
info
,
DIB_RGB_COLORS
,
0
,
0
))
goto
failed
;
...
...
@@ -1051,21 +1050,21 @@ static unsigned int *get_bitmap_argb( HDC hdc, HBITMAP color, HBITMAP mask, unsi
/* generate alpha channel from the mask */
info
->
bmiHeader
.
biBitCount
=
1
;
info
->
bmiHeader
.
biSizeImage
=
width_bytes
*
bm
.
bmHeight
;
if
(
!
(
mask_bits
=
HeapAlloc
(
GetProcessHeap
(),
0
,
info
->
bmiHeader
.
biSizeImage
)))
goto
failed
;
if
(
!
(
mask_bits
=
malloc
(
info
->
bmiHeader
.
biSizeImage
)))
goto
failed
;
if
(
!
NtGdiGetDIBitsInternal
(
hdc
,
mask
,
0
,
bm
.
bmHeight
,
mask_bits
,
info
,
DIB_RGB_COLORS
,
0
,
0
))
goto
failed
;
ptr
=
bits
;
for
(
i
=
0
;
i
<
bm
.
bmHeight
;
i
++
)
for
(
j
=
0
;
j
<
bm
.
bmWidth
;
j
++
,
ptr
++
)
if
(
!
((
mask_bits
[
i
*
width_bytes
+
j
/
8
]
<<
(
j
%
8
))
&
0x80
))
*
ptr
|=
0xff000000
;
HeapFree
(
GetProcessHeap
(),
0
,
mask_bits
);
free
(
mask_bits
);
}
return
bits
;
failed:
HeapFree
(
GetProcessHeap
(),
0
,
bits
);
HeapFree
(
GetProcessHeap
(),
0
,
mask_bits
);
free
(
bits
);
free
(
mask_bits
);
*
width
=
*
height
=
0
;
return
NULL
;
}
...
...
@@ -1477,7 +1476,7 @@ void ANDROID_SetCursor( HCURSOR handle )
}
}
ioctl_set_cursor
(
id
,
width
,
height
,
info
.
xHotspot
,
info
.
yHotspot
,
bits
);
HeapFree
(
GetProcessHeap
(),
0
,
bits
);
free
(
bits
);
NtGdiDeleteObjectApp
(
info
.
hbmColor
);
NtGdiDeleteObjectApp
(
info
.
hbmMask
);
}
...
...
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