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
b1631d69
Commit
b1631d69
authored
Apr 03, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Try to load libpng only once.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
728255cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
30 deletions
+35
-30
cursoricon.c
dlls/user32/cursoricon.c
+35
-30
No files found.
dlls/user32/cursoricon.c
View file @
b1631d69
...
...
@@ -144,42 +144,42 @@ MAKE_FUNCPTR(png_set_gray_to_rgb);
MAKE_FUNCPTR
(
png_set_read_fn
);
#undef MAKE_FUNCPTR
static
BOOL
load_libpng
(
void
)
{
USER_Lock
();
static
INIT_ONCE
init_once
=
INIT_ONCE_STATIC_INIT
;
if
(
!
libpng_handle
&&
(
libpng_handle
=
wine_dlopen
(
SONAME_LIBPNG
,
RTLD_NOW
,
NULL
,
0
))
!=
NULL
)
static
BOOL
WINAPI
load_libpng
(
INIT_ONCE
*
once
,
void
*
param
,
void
**
context
)
{
if
(
!
(
libpng_handle
=
wine_dlopen
(
SONAME_LIBPNG
,
RTLD_NOW
,
NULL
,
0
)))
{
WARN
(
"failed to load %s
\n
"
,
SONAME_LIBPNG
);
return
TRUE
;
}
#define LOAD_FUNCPTR(f) \
if ((p##f = wine_dlsym(libpng_handle, #f, NULL, 0)) == NULL) \
{ \
WARN( "%s not found in %s\n", #f, SONAME_LIBPNG ); \
libpng_handle = NULL; \
USER_Unlock(); \
return FALSE; \
}
LOAD_FUNCPTR
(
png_create_read_struct
);
LOAD_FUNCPTR
(
png_create_info_struct
);
LOAD_FUNCPTR
(
png_destroy_read_struct
);
LOAD_FUNCPTR
(
png_error
);
LOAD_FUNCPTR
(
png_get_bit_depth
);
LOAD_FUNCPTR
(
png_get_color_type
);
LOAD_FUNCPTR
(
png_get_error_ptr
);
LOAD_FUNCPTR
(
png_get_image_height
);
LOAD_FUNCPTR
(
png_get_image_width
);
LOAD_FUNCPTR
(
png_get_io_ptr
);
LOAD_FUNCPTR
(
png_read_image
);
LOAD_FUNCPTR
(
png_read_info
);
LOAD_FUNCPTR
(
png_read_update_info
);
LOAD_FUNCPTR
(
png_set_bgr
);
LOAD_FUNCPTR
(
png_set_crc_action
);
LOAD_FUNCPTR
(
png_set_error_fn
);
LOAD_FUNCPTR
(
png_set_expand
);
LOAD_FUNCPTR
(
png_set_gray_to_rgb
);
LOAD_FUNCPTR
(
png_set_read_fn
);
return TRUE; \
}
LOAD_FUNCPTR
(
png_create_read_struct
);
LOAD_FUNCPTR
(
png_create_info_struct
);
LOAD_FUNCPTR
(
png_destroy_read_struct
);
LOAD_FUNCPTR
(
png_error
);
LOAD_FUNCPTR
(
png_get_bit_depth
);
LOAD_FUNCPTR
(
png_get_color_type
);
LOAD_FUNCPTR
(
png_get_error_ptr
);
LOAD_FUNCPTR
(
png_get_image_height
);
LOAD_FUNCPTR
(
png_get_image_width
);
LOAD_FUNCPTR
(
png_get_io_ptr
);
LOAD_FUNCPTR
(
png_read_image
);
LOAD_FUNCPTR
(
png_read_info
);
LOAD_FUNCPTR
(
png_read_update_info
);
LOAD_FUNCPTR
(
png_set_bgr
);
LOAD_FUNCPTR
(
png_set_crc_action
);
LOAD_FUNCPTR
(
png_set_error_fn
);
LOAD_FUNCPTR
(
png_set_expand
);
LOAD_FUNCPTR
(
png_set_gray_to_rgb
);
LOAD_FUNCPTR
(
png_set_read_fn
);
#undef LOAD_FUNCPTR
}
USER_Unlock
();
return
TRUE
;
}
...
...
@@ -233,6 +233,11 @@ static unsigned be_uint(unsigned val)
return
(
u
.
c
[
0
]
<<
24
)
|
(
u
.
c
[
1
]
<<
16
)
|
(
u
.
c
[
2
]
<<
8
)
|
u
.
c
[
3
];
}
static
BOOL
have_libpng
(
void
)
{
return
InitOnceExecuteOnce
(
&
init_once
,
load_libpng
,
NULL
,
NULL
)
&&
libpng_handle
;
}
static
BOOL
get_png_info
(
const
void
*
png_data
,
DWORD
size
,
int
*
width
,
int
*
height
,
int
*
bpp
)
{
static
const
char
png_sig
[
8
]
=
{
0x89
,
'P'
,
'N'
,
'G'
,
0x0d
,
0x0a
,
0x1a
,
0x0a
};
...
...
@@ -271,7 +276,7 @@ static BITMAPINFO *load_png(const char *png_data, DWORD *size)
if
(
!
get_png_info
(
png_data
,
*
size
,
&
width
,
&
height
,
&
bpp
))
return
NULL
;
if
(
!
load
_libpng
())
return
NULL
;
if
(
!
have
_libpng
())
return
NULL
;
png
.
buffer
=
png_data
;
png
.
size
=
*
size
;
...
...
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