Skip to content

Commit 94e628f

Browse files
recpsaghul
authored andcommitted
unix: fix warnings when loading functions with dlsym
1 parent 861de3d commit 94e628f

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/unix/darwin-proctitle.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static int uv__pthread_setname_np(const char* name) {
3636
int err;
3737

3838
/* pthread_setname_np() first appeared in OS X 10.6 and iOS 3.2. */
39-
dynamic_pthread_setname_np = dlsym(RTLD_DEFAULT, "pthread_setname_np");
39+
*(void **)(&dynamic_pthread_setname_np) = dlsym(RTLD_DEFAULT, "pthread_setname_np");
4040
if (dynamic_pthread_setname_np == NULL)
4141
return -ENOSYS;
4242

@@ -94,13 +94,13 @@ int uv__set_process_title(const char* title) {
9494
if (application_services_handle == NULL || core_foundation_handle == NULL)
9595
goto out;
9696

97-
pCFStringCreateWithCString =
97+
*(void **)(&pCFStringCreateWithCString) =
9898
dlsym(core_foundation_handle, "CFStringCreateWithCString");
99-
pCFBundleGetBundleWithIdentifier =
99+
*(void **)(&pCFBundleGetBundleWithIdentifier) =
100100
dlsym(core_foundation_handle, "CFBundleGetBundleWithIdentifier");
101-
pCFBundleGetDataPointerForName =
101+
*(void **)(&pCFBundleGetDataPointerForName) =
102102
dlsym(core_foundation_handle, "CFBundleGetDataPointerForName");
103-
pCFBundleGetFunctionPointerForName =
103+
*(void **)(&pCFBundleGetFunctionPointerForName) =
104104
dlsym(core_foundation_handle, "CFBundleGetFunctionPointerForName");
105105

106106
if (pCFStringCreateWithCString == NULL ||
@@ -118,14 +118,14 @@ int uv__set_process_title(const char* title) {
118118
if (launch_services_bundle == NULL)
119119
goto out;
120120

121-
pLSGetCurrentApplicationASN =
121+
*(void **)(&pLSGetCurrentApplicationASN) =
122122
pCFBundleGetFunctionPointerForName(launch_services_bundle,
123123
S("_LSGetCurrentApplicationASN"));
124124

125125
if (pLSGetCurrentApplicationASN == NULL)
126126
goto out;
127127

128-
pLSSetApplicationInformationItem =
128+
*(void **)(&pLSSetApplicationInformationItem) =
129129
pCFBundleGetFunctionPointerForName(launch_services_bundle,
130130
S("_LSSetApplicationInformationItem"));
131131

@@ -138,9 +138,9 @@ int uv__set_process_title(const char* title) {
138138
if (display_name_key == NULL || *display_name_key == NULL)
139139
goto out;
140140

141-
pCFBundleGetInfoDictionary = dlsym(core_foundation_handle,
141+
*(void **)(&pCFBundleGetInfoDictionary) = dlsym(core_foundation_handle,
142142
"CFBundleGetInfoDictionary");
143-
pCFBundleGetMainBundle = dlsym(core_foundation_handle,
143+
*(void **)(&pCFBundleGetMainBundle) = dlsym(core_foundation_handle,
144144
"CFBundleGetMainBundle");
145145
if (pCFBundleGetInfoDictionary == NULL || pCFBundleGetMainBundle == NULL)
146146
goto out;
@@ -152,13 +152,13 @@ int uv__set_process_title(const char* title) {
152152
if (hi_services_bundle == NULL)
153153
goto out;
154154

155-
pSetApplicationIsDaemon = pCFBundleGetFunctionPointerForName(
155+
*(void **)(&pSetApplicationIsDaemon) = pCFBundleGetFunctionPointerForName(
156156
hi_services_bundle,
157157
S("SetApplicationIsDaemon"));
158-
pLSApplicationCheckIn = pCFBundleGetFunctionPointerForName(
158+
*(void **)(&pLSApplicationCheckIn) = pCFBundleGetFunctionPointerForName(
159159
launch_services_bundle,
160160
S("_LSApplicationCheckIn"));
161-
pLSSetApplicationLaunchServicesServerConnectionStatus =
161+
*(void **)(&pLSSetApplicationLaunchServicesServerConnectionStatus) =
162162
pCFBundleGetFunctionPointerForName(
163163
launch_services_bundle,
164164
S("_LSSetApplicationLaunchServicesServerConnectionStatus"));

src/unix/fsevents.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ static int uv__fsevents_global_init(void) {
525525
err = -ENOENT;
526526
#define V(handle, symbol) \
527527
do { \
528-
p ## symbol = dlsym((handle), #symbol); \
528+
*(void **)(&p ## symbol) = dlsym((handle), #symbol); \
529529
if (p ## symbol == NULL) \
530530
goto out; \
531531
} \

0 commit comments

Comments
 (0)