/*
- * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004, 2006 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
CFStringRef sessionKey;
CFStringRef storeSessionKey;
- if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+ if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
return kSCStatusNoStoreSession; /* you must have an open session to play */
}
CFStringRef key = NULL; /* key (un-serialized) */
serverSessionRef mySession = getSession(server);
+ *sc_status = kSCStatusOK;
+
/* un-serialize the key */
if (!_SCUnserializeString(&key, NULL, (void *)keyRef, keyLen)) {
*sc_status = kSCStatusFailed;
- goto done;
- }
-
- if (!isA_CFString(key)) {
- *sc_status = kSCStatusInvalidArgument;
- goto done;
}
/* un-serialize the data */
if (!_SCUnserializeData(&data, (void *)dataRef, dataLen)) {
*sc_status = kSCStatusFailed;
+ }
+
+ if (*sc_status != kSCStatusOK) {
goto done;
}
- if (!mySession) {
+ if (!isA_CFString(key)) {
+ *sc_status = kSCStatusInvalidArgument;
+ goto done;
+ }
+
+ if (mySession == NULL) {
*sc_status = kSCStatusNoStoreSession; /* you must have an open session to play */
goto done;
}
SCDynamicStorePrivateRef storePrivate = (SCDynamicStorePrivateRef)store;
int sc_status = kSCStatusOK;
- if (!store || (storePrivate->server == MACH_PORT_NULL)) {
+ if ((store == NULL) || (storePrivate->server == MACH_PORT_NULL)) {
return kSCStatusNoStoreSession; /* you must have an open session to play */
}
CFArrayRef notify = NULL; /* keys to notify (un-serialized) */
CFArrayRef remove = NULL; /* keys to remove (un-serialized) */
- if (dictRef && (dictLen > 0)) {
+ *sc_status = kSCStatusOK;
+
+ if ((dictRef != NULL) && (dictLen > 0)) {
/* un-serialize the key/value pairs to set */
if (!_SCUnserialize((CFPropertyListRef *)&dict, NULL, (void *)dictRef, dictLen)) {
*sc_status = kSCStatusFailed;
- goto done;
- }
-
- if (!isA_CFDictionary(dict)) {
- *sc_status = kSCStatusInvalidArgument;
- goto done;
}
}
- if (removeRef && (removeLen > 0)) {
+ if ((removeRef != NULL) && (removeLen > 0)) {
/* un-serialize the keys to remove */
if (!_SCUnserialize((CFPropertyListRef *)&remove, NULL, (void *)removeRef, removeLen)) {
*sc_status = kSCStatusFailed;
- goto done;
- }
-
- if (!isA_CFArray(remove)) {
- *sc_status = kSCStatusInvalidArgument;
- goto done;
}
}
- if (notifyRef && (notifyLen > 0)) {
+ if ((notifyRef != NULL) && (notifyLen > 0)) {
/* un-serialize the keys to notify */
if (!_SCUnserialize((CFPropertyListRef *)¬ify, NULL, (void *)notifyRef, notifyLen)) {
*sc_status = kSCStatusFailed;
- goto done;
}
+ }
- if (!isA_CFArray(notify)) {
- *sc_status = kSCStatusInvalidArgument;
- goto done;
- }
+ if (*sc_status != kSCStatusOK) {
+ goto done;
+ }
+
+ if ((dict != NULL) && !isA_CFDictionary(dict)) {
+ *sc_status = kSCStatusInvalidArgument;
+ goto done;
+ }
+
+ if ((remove != NULL) && !isA_CFArray(remove)) {
+ *sc_status = kSCStatusInvalidArgument;
+ goto done;
+ }
+
+ if ((notify != NULL) && !isA_CFArray(notify)) {
+ *sc_status = kSCStatusInvalidArgument;
+ goto done;
}
- if (!mySession) {
+ if (mySession == NULL) {
/* you must have an open session to play */
*sc_status = kSCStatusNoStoreSession;
goto done;
done :
- if (dict) CFRelease(dict);
- if (remove) CFRelease(remove);
- if (notify) CFRelease(notify);
+ if (dict != NULL) CFRelease(dict);
+ if (remove != NULL) CFRelease(remove);
+ if (notify != NULL) CFRelease(notify);
return KERN_SUCCESS;
}