After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 780300 - gio/gosxappinfo.c uses deprecated LSFindApplicationForInfo
gio/gosxappinfo.c uses deprecated LSFindApplicationForInfo
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
2.52.x
Other Mac OS
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2017-03-20 13:36 UTC by Daniel Macks
Modified: 2017-04-27 13:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gosxappinfo: Fix typo in ifdef (914 bytes, patch)
2017-03-31 00:11 UTC, Patrick Griffis (tingping)
committed Details | Review

Description Daniel Macks 2017-03-20 13:36:41 UTC
Building glib-2.52.0 on OS X 10.11 gives a warning:

gosxappinfo.c:315:7: warning: 'LSFindApplicationForInfo' is deprecated: first deprecated in macOS 10.10 - Use LSCopyApplicationURLsForBundleIdentifier instead. [-Wdeprecated-declarations]
  if (LSFindApplicationForInfo (kLSUnknownCreator, bundle_id, NULL, NULL, &app_url))
      ^
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LSInfoDeprecated.h:785:1: note: 'LSFindApplicationForInfo' has been explicitly marked deprecated here
LSFindApplicationForInfo(
^
Comment 1 Patrick Griffis (tingping) 2017-03-30 14:42:38 UTC
It already does:

    #ifdef AVAILABLE_MAC_OS_VERSION_10_10_OR_LATER
      ...
    #else
      if (LSFindApplicationForInfo (kLSUnknownCreator, bundle_id, NULL, NULL, &app_url))
    #endif
Comment 2 Daniel Macks 2017-03-30 14:52:39 UTC
I'm on 10.11, which is later than 10.10. By the warning, it's clear the compiler is *not* using that "10.10 or later" code block.
Comment 3 Daniel Macks 2017-03-30 15:16:08 UTC
Ah, it's the wrong macro. Should be:

#ifdef AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER

(missing _X_, and uses _AND_ not _OR_)
Comment 4 Daniel Macks 2017-03-30 16:32:05 UTC
...fixing which leads to build failure:

gosxappinfo.c:303:3: error: unknown type name 'CSArrayRef'; did you mean 'CFArrayRef'?
  CSArrayRef urls = LSCopyApplicationURLsForBundleIdentifier (bundle_id, NULL);
  ^~~~~~~~~~
  CFArrayRef
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h:108:59: note: 'CFArrayRef' declared here
typedef const struct CF_BRIDGED_TYPE(NSArray) __CFArray * CFArrayRef;
                                                          ^
1 error generated.
make[4]: *** [Makefile:3829: libgio_2_0_la-gosxappinfo.lo] Error 1
Comment 5 Patrick Griffis (tingping) 2017-03-30 16:46:32 UTC
Clearly just a typo.
Comment 6 Patrick Griffis (tingping) 2017-03-31 00:11:34 UTC
Created attachment 349021 [details] [review]
gosxappinfo: Fix typo in ifdef
Comment 7 Daniel Macks 2017-04-03 01:47:15 UTC
(In reply to Patrick Griffis (tingping) from comment #6)
> Created attachment 349021 [details] [review] [review]
> gosxappinfo: Fix typo in ifdef

Seems to do the right thing on 10.11 now. Thanks!
Comment 8 Matthias Clasen 2017-04-27 13:27:29 UTC
Review of attachment 349021 [details] [review]:

good catch!
Comment 9 Patrick Griffis (tingping) 2017-04-27 13:35:56 UTC
Attachment 349021 [details] pushed as f3321da - gosxappinfo: Fix typo in ifdef