aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMServiceManagement.c
diff options
context:
space:
mode:
authorGravatar dmaclach <dmaclach@google.com>2016-10-07 12:10:23 -0400
committerGravatar Thomas Van Lenten <thomasvl@google.com>2016-10-07 12:21:06 -0400
commit42124b3691197c3c4f52f069775fa0390a8ff942 (patch)
treeebd373d398ea64b45bdc1d196fa0a2c5f57cabfd /Foundation/GTMServiceManagement.c
parent57eeab4193210df8ab0c81e9d3f1ee1ad3e24492 (diff)
First cut at pruning things/updating things.
Remove a bunch of code that Google stopped using/maintaining rather than trying to update it it. Some would be hard to update, some actually has system provided replacements; others are patterns that just don't seem as common now. Prune out the code related to macOS <= 10.5, start pruning some of the really old iOS support also. Get the projects mostly limping again with modern Xcodes so tests can be run. If someone ends up on this commit via history for something they still find as useful, feel free to do a pull request to bring the snippet of code back to life and update it for current SDKs.
Diffstat (limited to 'Foundation/GTMServiceManagement.c')
-rw-r--r--Foundation/GTMServiceManagement.c47
1 files changed, 4 insertions, 43 deletions
diff --git a/Foundation/GTMServiceManagement.c b/Foundation/GTMServiceManagement.c
index 5e41ba0..dfd0dc6 100644
--- a/Foundation/GTMServiceManagement.c
+++ b/Foundation/GTMServiceManagement.c
@@ -382,8 +382,11 @@ CFTypeRef GTMCFTypeCreateFromLaunchData(launch_data_t ldata,
}
case LAUNCH_DATA_OPAQUE: {
- size_t size = launch_data_get_opaque_size(ldata);
+ // Must get the data before we get the size.
+ // Otherwise the size will come back faulty on macOS 10.11.6.
+ // Radar: 28509492 launch_data_get_opaque_size gives wrong size
void *data = launch_data_get_opaque(ldata);
+ size_t size = launch_data_get_opaque_size(ldata);
cf_type_ref = CFDataCreate(kCFAllocatorDefault, data, size);
break;
}
@@ -784,46 +787,4 @@ CFDictionaryRef GTMSMCopyAllJobDictionaries(void) {
return dict;
}
-// Some private SPIs defined by apple in the launchd sources
-// http://opensource.apple.com/source/launchd/launchd-258.25/launchd/src/
-// and
-// http://opensource.apple.com/source/launchd/launchd-329.3/launchd/src/
-// It turns out that they renamed the enum that I need to use between 10.5 and
-// 10.6. Luckily if we request the 10_5 value on 10_6 we get an error
-// so we just ask for the 10_5 value first, and then the 10_6 value second.
-
-typedef enum {
- VPROC_GSK_ENVIRONMENT_10_5 = 10,
- VPROC_GSK_ENVIRONMENT_10_6 = 11
-} vproc_gsk_t;
-
-extern vproc_err_t vproc_swap_complex(vproc_t vp,
- vproc_gsk_t key,
- launch_data_t inval,
- launch_data_t *outval);
-
-CFDictionaryRef GTMCopyLaunchdExports(void) {
- launch_data_t resp;
- CFDictionaryRef dict = NULL;
- vproc_err_t err = vproc_swap_complex(NULL,
- VPROC_GSK_ENVIRONMENT_10_5,
- NULL,
- &resp);
- if (err) {
- err = vproc_swap_complex(NULL, VPROC_GSK_ENVIRONMENT_10_6, NULL, &resp);
- }
- if (err == NULL) {
- CFErrorRef error = NULL;
- dict = GTMCFTypeCreateFromLaunchData(resp, false, &error);
- if (error) {
-#ifdef DEBUG
- CFShow(error);
-#endif // DEBUG
- CFRelease(error);
- }
- launch_data_free(resp);
- }
- return dict;
-}
-
#endif // if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4