unix: fix warnings when loading functions with dlsym

This commit is contained in:
Recep ASLANTAS 2014-09-11 12:28:19 +03:00 committed by Saúl Ibarra Corretgé
parent 861de3d71d
commit 94e628faf1
2 changed files with 13 additions and 13 deletions

View File

@ -36,7 +36,7 @@ static int uv__pthread_setname_np(const char* name) {
int err; int err;
/* pthread_setname_np() first appeared in OS X 10.6 and iOS 3.2. */ /* pthread_setname_np() first appeared in OS X 10.6 and iOS 3.2. */
dynamic_pthread_setname_np = dlsym(RTLD_DEFAULT, "pthread_setname_np"); *(void **)(&dynamic_pthread_setname_np) = dlsym(RTLD_DEFAULT, "pthread_setname_np");
if (dynamic_pthread_setname_np == NULL) if (dynamic_pthread_setname_np == NULL)
return -ENOSYS; return -ENOSYS;
@ -94,13 +94,13 @@ int uv__set_process_title(const char* title) {
if (application_services_handle == NULL || core_foundation_handle == NULL) if (application_services_handle == NULL || core_foundation_handle == NULL)
goto out; goto out;
pCFStringCreateWithCString = *(void **)(&pCFStringCreateWithCString) =
dlsym(core_foundation_handle, "CFStringCreateWithCString"); dlsym(core_foundation_handle, "CFStringCreateWithCString");
pCFBundleGetBundleWithIdentifier = *(void **)(&pCFBundleGetBundleWithIdentifier) =
dlsym(core_foundation_handle, "CFBundleGetBundleWithIdentifier"); dlsym(core_foundation_handle, "CFBundleGetBundleWithIdentifier");
pCFBundleGetDataPointerForName = *(void **)(&pCFBundleGetDataPointerForName) =
dlsym(core_foundation_handle, "CFBundleGetDataPointerForName"); dlsym(core_foundation_handle, "CFBundleGetDataPointerForName");
pCFBundleGetFunctionPointerForName = *(void **)(&pCFBundleGetFunctionPointerForName) =
dlsym(core_foundation_handle, "CFBundleGetFunctionPointerForName"); dlsym(core_foundation_handle, "CFBundleGetFunctionPointerForName");
if (pCFStringCreateWithCString == NULL || if (pCFStringCreateWithCString == NULL ||
@ -118,14 +118,14 @@ int uv__set_process_title(const char* title) {
if (launch_services_bundle == NULL) if (launch_services_bundle == NULL)
goto out; goto out;
pLSGetCurrentApplicationASN = *(void **)(&pLSGetCurrentApplicationASN) =
pCFBundleGetFunctionPointerForName(launch_services_bundle, pCFBundleGetFunctionPointerForName(launch_services_bundle,
S("_LSGetCurrentApplicationASN")); S("_LSGetCurrentApplicationASN"));
if (pLSGetCurrentApplicationASN == NULL) if (pLSGetCurrentApplicationASN == NULL)
goto out; goto out;
pLSSetApplicationInformationItem = *(void **)(&pLSSetApplicationInformationItem) =
pCFBundleGetFunctionPointerForName(launch_services_bundle, pCFBundleGetFunctionPointerForName(launch_services_bundle,
S("_LSSetApplicationInformationItem")); S("_LSSetApplicationInformationItem"));
@ -138,9 +138,9 @@ int uv__set_process_title(const char* title) {
if (display_name_key == NULL || *display_name_key == NULL) if (display_name_key == NULL || *display_name_key == NULL)
goto out; goto out;
pCFBundleGetInfoDictionary = dlsym(core_foundation_handle, *(void **)(&pCFBundleGetInfoDictionary) = dlsym(core_foundation_handle,
"CFBundleGetInfoDictionary"); "CFBundleGetInfoDictionary");
pCFBundleGetMainBundle = dlsym(core_foundation_handle, *(void **)(&pCFBundleGetMainBundle) = dlsym(core_foundation_handle,
"CFBundleGetMainBundle"); "CFBundleGetMainBundle");
if (pCFBundleGetInfoDictionary == NULL || pCFBundleGetMainBundle == NULL) if (pCFBundleGetInfoDictionary == NULL || pCFBundleGetMainBundle == NULL)
goto out; goto out;
@ -152,13 +152,13 @@ int uv__set_process_title(const char* title) {
if (hi_services_bundle == NULL) if (hi_services_bundle == NULL)
goto out; goto out;
pSetApplicationIsDaemon = pCFBundleGetFunctionPointerForName( *(void **)(&pSetApplicationIsDaemon) = pCFBundleGetFunctionPointerForName(
hi_services_bundle, hi_services_bundle,
S("SetApplicationIsDaemon")); S("SetApplicationIsDaemon"));
pLSApplicationCheckIn = pCFBundleGetFunctionPointerForName( *(void **)(&pLSApplicationCheckIn) = pCFBundleGetFunctionPointerForName(
launch_services_bundle, launch_services_bundle,
S("_LSApplicationCheckIn")); S("_LSApplicationCheckIn"));
pLSSetApplicationLaunchServicesServerConnectionStatus = *(void **)(&pLSSetApplicationLaunchServicesServerConnectionStatus) =
pCFBundleGetFunctionPointerForName( pCFBundleGetFunctionPointerForName(
launch_services_bundle, launch_services_bundle,
S("_LSSetApplicationLaunchServicesServerConnectionStatus")); S("_LSSetApplicationLaunchServicesServerConnectionStatus"));

View File

@ -525,7 +525,7 @@ static int uv__fsevents_global_init(void) {
err = -ENOENT; err = -ENOENT;
#define V(handle, symbol) \ #define V(handle, symbol) \
do { \ do { \
p ## symbol = dlsym((handle), #symbol); \ *(void **)(&p ## symbol) = dlsym((handle), #symbol); \
if (p ## symbol == NULL) \ if (p ## symbol == NULL) \
goto out; \ goto out; \
} \ } \