s32 FilePhysical::getSeek() const
{
    if (hasReadAccess())
        return static_cast<s32>(Stream_.tellg());
    else if (hasWriteAccess())
        return static_cast<s32>(Stream_.tellp());
    return 0;
}
Beispiel #2
0
__private_extern__
kern_return_t
_configremove(mach_port_t		server,
	      xmlData_t			keyRef,		/* raw XML bytes */
	      mach_msg_type_number_t	keyLen,
	      int			*sc_status,
	      audit_token_t		audit_token)
{
	CFStringRef		key		= NULL;		/* key  (un-serialized) */
	serverSessionRef	mySession;

	/* 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;
	}

	mySession = getSession(server);
	if (mySession == NULL) {
		mySession = tempSession(server, CFSTR("SCDynamicStoreRemoveValue"), audit_token);
		if (mySession == NULL) {
			/* you must have an open session to play */
			*sc_status = kSCStatusNoStoreSession;
			goto done;
		}
	}

	if (!hasWriteAccess(mySession, key)) {
		*sc_status = kSCStatusAccessError;
		goto done;
	}

	*sc_status = __SCDynamicStoreRemoveValue(mySession->store, key, FALSE);

    done :

	if (key)	CFRelease(key);

	return KERN_SUCCESS;
}
void FilePhysical::setSeek(s32 Pos, const EFileSeekTypes PosType)
{
    std::ios_base::seekdir OffsetDir = std::ios_base::beg;
    
    switch (PosType)
    {
        case FILEPOS_BEGIN:
            OffsetDir = std::ios_base::beg; break;
        case FILEPOS_CURRENT:
            OffsetDir = std::ios_base::cur; break;
        case FILEPOS_END:
            OffsetDir = std::ios_base::end; break;
    }
    
    if (hasReadAccess())
        Stream_.seekg(Pos, OffsetDir);
    if (hasWriteAccess())
        Stream_.seekp(Pos, OffsetDir);
}