Example #1
0
bool NDB::CDBConfig::isFull() const
{
    if (NOT_EMPTY(mPassword) && NOT_EMPTY(mDbHost) && NOT_EMPTY(mDataBaseName)
            && NOT_EMPTY(mDbType))
    {
        return true;
    }
    return false;
}
static int compare_u_st_st(int nr)
{
	int f = 0, c;
	FPU_REG *st_ptr;

	if (!NOT_EMPTY(0) || !NOT_EMPTY(nr)) {
		setcc(SW_C3 | SW_C2 | SW_C0);
		/*             */
		EXCEPTION(EX_StackUnder);
		return !(control_word & CW_Invalid);
	}

	st_ptr = &st(nr);
	c = compare(st_ptr, FPU_gettagi(nr));
	if (c & COMP_NaN) {
		setcc(SW_C3 | SW_C2 | SW_C0);
		if (c & COMP_SNaN) {	/*                                    
                                            */
			EXCEPTION(EX_Invalid);
			return !(control_word & CW_Invalid);
		}
		return 0;
	} else
		switch (c & 7) {
		case COMP_A_lt_B:
			f = SW_C0;
			break;
		case COMP_A_eq_B:
			f = SW_C3;
			break;
		case COMP_A_gt_B:
			f = 0;
			break;
		case COMP_No_Comp:
			f = SW_C3 | SW_C2 | SW_C0;
			break;
#ifdef PARANOID
		default:
			EXCEPTION(EX_INTERNAL | 0x123);
			f = SW_C3 | SW_C2 | SW_C0;
			break;
#endif /*          */
		}
	setcc(f);
	if (c & COMP_Denormal) {
		return denormal_operand() < 0;
	}
	return 0;
}
void AirEnemy::update( float deltaTime )
{
	if ( NOT_EMPTY( velocity.x ) || NOT_EMPTY( velocity.y ) )
	{
		float cfx = 0.0f, cfy = 0.0f;
		this->getPosition( &cfx, &cfy );
		this->setPosition( cfx + this->velocity.x*deltaTime, cfy + this->velocity.y*deltaTime );
	}

	// Check bullet out of range
	cocos2d::CCRect	bound	=	this->getBound();
	if( bound.origin.y + bound.size.height <= 0 )
	{
		this->isDead		=	true;
	}

	if( collisionList )
		collisionList->removeAllObjects();
}
Example #4
0
void Bullet::update( float deltaTime )
{
	if ( NOT_EMPTY( velocity.x ) || NOT_EMPTY( velocity.y ) )
	{
		float cfx = 0.0f, cfy = 0.0f;
		this->getPosition( &cfx, &cfy );
		this->setPosition( cfx + this->velocity.x*deltaTime, cfy + this->velocity.y*deltaTime );
	}

	// Check bullet out of range
	cocos2d::CCSize winSize	=	cocos2d::CCDirector::sharedDirector()->getWinSize();
	cocos2d::CCRect winRect	=	cocos2d::CCRectMake( 0, 0, winSize.width, winSize.height );
	if( !winRect.containsPoint(this->getPosition()) )
	{
		this->isDead		=	true;
	}

	if( collisionList )
		collisionList->removeAllObjects();
}
Example #5
0
void
fld_i_()
{
	FPU_REG *st_new_ptr;

	if (STACK_OVERFLOW) {
		stack_overflow();
		return;
	}
	/* fld st(i) */
	if (NOT_EMPTY(FPU_rm)) {
		reg_move(&st(FPU_rm), st_new_ptr);
		push();
	} else {
		if (control_word & EX_Invalid) {
			/* The masked response */
			push();
			stack_underflow();
		} else
			EXCEPTION(EX_StackUnder);
	}

}
Example #6
0
static int icecast_open(URLContext *h, const char *uri, int flags)
{
    IcecastContext *s = h->priv_data;

    // Dict to set options that we pass to the HTTP protocol
    AVDictionary *opt_dict = NULL;

    // URI part variables
    char h_url[1024], host[1024], auth[1024], path[1024];
    char *headers = NULL, *user = NULL;
    int port, ret;
    AVBPrint bp;

    if (flags & AVIO_FLAG_READ)
        return AVERROR(ENOSYS);

    av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);

    // Build header strings
    cat_header(&bp, "Ice-Name", s->name);
    cat_header(&bp, "Ice-Description", s->description);
    cat_header(&bp, "Ice-URL", s->url);
    cat_header(&bp, "Ice-Genre", s->genre);
    cat_header(&bp, "Ice-Public", s->public ? "1" : "0");
    if (!av_bprint_is_complete(&bp)) {
        ret = AVERROR(ENOMEM);
        goto cleanup;
    }
    av_bprint_finalize(&bp, &headers);

    // Set options
    av_dict_set(&opt_dict, "method", s->legacy_icecast ? "SOURCE" : "PUT", 0);
    av_dict_set(&opt_dict, "auth_type", "basic", 0);
    av_dict_set(&opt_dict, "headers", headers, 0);
    av_dict_set(&opt_dict, "chunked_post", "0", 0);
    av_dict_set(&opt_dict, "send_expect_100", s->legacy_icecast ? "0" : "1", 0);
    if (NOT_EMPTY(s->content_type))
        av_dict_set(&opt_dict, "content_type", s->content_type, 0);
    else
        av_dict_set(&opt_dict, "content_type", "audio/mpeg", 0);
    if (NOT_EMPTY(s->user_agent))
        av_dict_set(&opt_dict, "user_agent", s->user_agent, 0);

    // Parse URI
    av_url_split(NULL, 0, auth, sizeof(auth), host, sizeof(host),
                 &port, path, sizeof(path), uri);

    // Check for auth data in URI
    if (auth[0]) {
        char *sep = strchr(auth, ':');
        if (sep) {
            *sep = 0;
            sep++;
            if (s->pass) {
                av_free(s->pass);
                av_log(h, AV_LOG_WARNING, "Overwriting -password <pass> with URI password!\n");
            }
            if (!(s->pass = av_strdup(sep))) {
                ret = AVERROR(ENOMEM);
                goto cleanup;
            }
        }
        if (!(user = av_strdup(auth))) {
            ret = AVERROR(ENOMEM);
            goto cleanup;
        }
    }

    // Build new authstring
    snprintf(auth, sizeof(auth),
             "%s:%s",
             user ? user : DEFAULT_ICE_USER,
             s->pass ? s->pass : "");

    // Check for mountpoint (path)
    if (!path[0] || strcmp(path, "/") == 0) {
        av_log(h, AV_LOG_ERROR, "No mountpoint (path) specified!\n");
        ret = AVERROR(EIO);
        goto cleanup;
    }

    // Build new URI for passing to http protocol
    ff_url_join(h_url, sizeof(h_url), "http", auth, host, port, "%s", path);
    // Finally open http proto handler
    ret = ffurl_open_whitelist(&s->hd, h_url, AVIO_FLAG_READ_WRITE, NULL,
                               &opt_dict, h->protocol_whitelist, h->protocol_blacklist, h);

cleanup:
    av_freep(&user);
    av_freep(&headers);
    av_dict_free(&opt_dict);

    return ret;
}
Example #7
0
static void cat_header(AVBPrint *bp, const char key[], const char value[])
{
    if (NOT_EMPTY(value))
        av_bprintf(bp, "%s: %s\r\n", key, value);
}