当前位置: 首页>>代码示例>>C++>>正文


C++ CHECK_VALUE函数代码示例

本文整理汇总了C++中CHECK_VALUE函数的典型用法代码示例。如果您正苦于以下问题:C++ CHECK_VALUE函数的具体用法?C++ CHECK_VALUE怎么用?C++ CHECK_VALUE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CHECK_VALUE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: alListenerf

AL_API ALvoid AL_APIENTRY alListenerf(ALenum param, ALfloat value)
{
    ALCcontext *Context;

    Context = GetContextRef();
    if(!Context) return;

    al_try
    {
        switch(param)
        {
            case AL_GAIN:
                CHECK_VALUE(Context, value >= 0.0f && isfinite(value));

                Context->Listener->Gain = value;
                Context->UpdateSources = AL_TRUE;
                break;

            case AL_METERS_PER_UNIT:
                CHECK_VALUE(Context, value >= 0.0f && isfinite(value));

                Context->Listener->MetersPerUnit = value;
                Context->UpdateSources = AL_TRUE;
                break;

            default:
                al_throwerr(Context, AL_INVALID_ENUM);
        }
    }
    al_endtry;

    ALCcontext_DecRef(Context);
}
开发者ID:yaakuro,项目名称:XdevLSDK,代码行数:33,代码来源:alListener.c

示例2: nbt_register_own

/*
  test that a server responds correctly to attempted registrations of its name
*/
static bool nbt_register_own(struct torture_context *tctx)
{
	struct nbt_name_register io;
	NTSTATUS status;
	struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL);
	struct socket_address *socket_address;
	struct nbt_name name;
	const char *address;
	const char *myaddress;

	if (!torture_nbt_get_name(tctx, &name, &address))
		return false;

	myaddress = iface_best_ip(address);

	socket_address = socket_address_from_strings(tctx, nbtsock->sock->backend_name,
						     myaddress, 0);
	torture_assert(tctx, socket_address != NULL, "Unable to get address");

	status = socket_listen(nbtsock->sock, socket_address, 0, 0);
	torture_assert_ntstatus_ok(tctx, status, 
				"socket_listen for nbt_register_own failed");

	torture_comment(tctx, "Testing name defense to name registration\n");

	io.in.name = name;
	io.in.dest_addr = address;
	io.in.address = myaddress;
	io.in.nb_flags = NBT_NODE_B | NBT_NM_ACTIVE;
	io.in.register_demand = False;
	io.in.broadcast = True;
	io.in.multi_homed = False;
	io.in.ttl = 1234;
	io.in.timeout = 3;
	io.in.retries = 0;
	
	status = nbt_name_register(nbtsock, tctx, &io);
	torture_assert_ntstatus_ok(tctx, status, 
				talloc_asprintf(tctx, "Bad response from %s for name register",
		       address));
	
	CHECK_STRING(tctx, io.out.name.name, name.name);
	CHECK_VALUE(tctx, io.out.name.type, name.type);
	CHECK_VALUE(tctx, io.out.rcode, NBT_RCODE_ACT);

	/* check a register demand */
	io.in.address = myaddress;
	io.in.register_demand = True;

	status = nbt_name_register(nbtsock, tctx, &io);

	torture_assert_ntstatus_ok(tctx, status, 
				talloc_asprintf(tctx, "Bad response from %s for name register demand", address));
	
	CHECK_STRING(tctx, io.out.name.name, name.name);
	CHECK_VALUE(tctx, io.out.name.type, name.type);
	CHECK_VALUE(tctx, io.out.rcode, NBT_RCODE_ACT);

	return true;
}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:63,代码来源:register.c

示例3: SetAbsAlarm

/*
 *  アラームの設定(絶対値)
 */
StatusType
SetAbsAlarm(AlarmType almid, TickType start, TickType cycle)
{
	StatusType	ercd = E_OK;
	CounterType	cntid;
	TickType	maxval, start2;

	LOG_SETABS_ENTER(almid, start, cycle);
	CHECK_CALLEVEL(TCL_TASK | TCL_ISR2);
	CHECK_ALMID(almid);

	cntid = alminib_cntid[almid];
	maxval = cntinib_maxval[cntid];
	CHECK_VALUE(start <= maxval);
	CHECK_VALUE((cycle == 0u)
		|| ((cntinib_mincyc[cntid] <= cycle) && (cycle <= maxval)));

	lock_cpu();
	if (almcb_next[almid] != almid) {
		ercd = E_OS_STATE;
		goto d_error_exit;
	}

	start2 = start + maxval + 1;
	if (cntcb_curval[cntid] <= maxval) {
		if (start <= cntcb_curval[cntid]) {
			almcb_almval[almid] = start2;
		}
		else {
			almcb_almval[almid] = start;
		}
	}
	else {
		if (start2 <= cntcb_curval[cntid]) {
			almcb_almval[almid] = start;
		}
		else {
			almcb_almval[almid] = start2;
		}
	}
	almcb_cycle[almid] = cycle;
	enqueue_alarm(almid, cntid);
  exit:
	unlock_cpu();
	LOG_SETABS_LEAVE(ercd);
	return(ercd);

  error_exit:
	lock_cpu();
  d_error_exit:
	_errorhook_par1.almid = almid;
	_errorhook_par2.start = start;
	_errorhook_par3.cycle = cycle;
	call_errorhook(ercd, OSServiceId_SetAbsAlarm);
	goto exit;
}
开发者ID:Ashatta,项目名称:tools,代码行数:59,代码来源:alarm.c

示例4: test_xml_node_parser

bool test_xml_node_parser()
{
    CHECK_VALUE("xml_test", test_xml_details::testPlayer());
    CHECK_VALUE("xml_test", test_xml_details::testMatch());
    CHECK_VALUE("xml_test", test_xml_details::testHistory());
    CHECK_VALUE("xml_test", test_xml_details::testResponse());
    CHECK_VALUE("xml_test", test_xml_details::testResponseWithMessage());

    return true;
}
开发者ID:hufuman,项目名称:node_parser,代码行数:10,代码来源:test_xml_node_parser.cpp

示例5: synchronized_cancel

/**
 * Main loop and signal handler can use this to cancel each other.
 */
static void synchronized_cancel(pthread_t const* thread) {
    int rc;

    pthread_cleanup_push(unlock_mutex, NULL);

    CHECK_VALUE(pthread_mutex_lock(&mutex), 0, rc);
    pthread_testcancel();
    CHECK_VALUE(pthread_cancel(*thread), 0, rc);

    pthread_cleanup_pop(true);
}
开发者ID:dreamforfly,项目名称:resources-sever,代码行数:14,代码来源:klient.c

示例6: navRead_DSI

void navRead_DSI(dsi_t *dsi, unsigned char *buffer) {
  int i;

  CHECK_VALUE(sizeof(dsi_t) == DSI_BYTES - 1); // -1 for substream id
  
  memcpy(dsi, buffer, sizeof(dsi_t));

  /* Endian conversions */

  /* dsi dsi gi */
  B2N_32(dsi->dsi_gi.nv_pck_scr);
  B2N_32(dsi->dsi_gi.nv_pck_lbn);
  B2N_32(dsi->dsi_gi.vobu_ea);
  B2N_32(dsi->dsi_gi.vobu_1stref_ea);
  B2N_32(dsi->dsi_gi.vobu_2ndref_ea);
  B2N_32(dsi->dsi_gi.vobu_3rdref_ea);
  B2N_16(dsi->dsi_gi.vobu_vob_idn);

  /* dsi sml pbi */
  B2N_16(dsi->sml_pbi.category);
  B2N_32(dsi->sml_pbi.ilvu_ea);
  B2N_32(dsi->sml_pbi.ilvu_sa);
  B2N_16(dsi->sml_pbi.size);
  B2N_32(dsi->sml_pbi.vob_v_s_s_ptm);
  B2N_32(dsi->sml_pbi.vob_v_e_e_ptm);

  /* dsi sml agli */
  for(i = 0; i < 9; i++) {
    B2N_32(dsi->sml_agli.data[ i ].address);
    B2N_16(dsi->sml_agli.data[ i ].size);
  }

  /* dsi vobu sri */
  B2N_32(dsi->vobu_sri.next_video);
  for(i = 0; i < 19; i++)
    B2N_32(dsi->vobu_sri.fwda[i]);
  B2N_32(dsi->vobu_sri.next_vobu);
  B2N_32(dsi->vobu_sri.prev_vobu);
  for(i = 0; i < 19; i++)
    B2N_32(dsi->vobu_sri.bwda[i]);
  B2N_32(dsi->vobu_sri.prev_video);

  /* dsi synci */
  for(i = 0; i < 8; i++)
    B2N_16(dsi->synci.a_synca[i]);
  for(i = 0; i < 32; i++)
    B2N_32(dsi->synci.sp_synca[i]);

  
  /* Asserts */

  /* dsi dsi gi */
  CHECK_VALUE(dsi->dsi_gi.zero1 == 0);
}
开发者ID:gromaudio,项目名称:dashtest,代码行数:54,代码来源:nav_read.c

示例7: alListenerfv

AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values)
{
    ALCcontext *Context;

    if(values)
    {
        switch(param)
        {
            case AL_GAIN:
            case AL_METERS_PER_UNIT:
                alListenerf(param, values[0]);
                return;

            case AL_POSITION:
            case AL_VELOCITY:
                alListener3f(param, values[0], values[1], values[2]);
                return;
        }
    }

    Context = GetContextRef();
    if(!Context) return;

    al_try
    {
        CHECK_VALUE(Context, values);
        switch(param)
        {
            case AL_ORIENTATION:
                CHECK_VALUE(Context, isfinite(values[0]) && isfinite(values[1]) &&
                                     isfinite(values[2]) && isfinite(values[3]) &&
                                     isfinite(values[4]) && isfinite(values[5]));

                LockContext(Context);
                /* AT then UP */
                Context->Listener->Forward[0] = values[0];
                Context->Listener->Forward[1] = values[1];
                Context->Listener->Forward[2] = values[2];
                Context->Listener->Up[0] = values[3];
                Context->Listener->Up[1] = values[4];
                Context->Listener->Up[2] = values[5];
                Context->UpdateSources = AL_TRUE;
                UnlockContext(Context);
                break;

            default:
                al_throwerr(Context, AL_INVALID_ENUM);
        }
    }
    al_endtry;

    ALCcontext_DecRef(Context);
}
开发者ID:yaakuro,项目名称:XdevLSDK,代码行数:53,代码来源:alListener.c

示例8: alDistanceModel

AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value)
{
    ALCcontext *Context;

    Context = GetContextRef();
    if(!Context) return;

    al_try
    {
        CHECK_VALUE(Context, value == AL_NONE ||
                             value == AL_INVERSE_DISTANCE ||
                             value == AL_INVERSE_DISTANCE_CLAMPED ||
                             value == AL_LINEAR_DISTANCE ||
                             value == AL_LINEAR_DISTANCE_CLAMPED ||
                             value == AL_EXPONENT_DISTANCE ||
                             value == AL_EXPONENT_DISTANCE_CLAMPED);

        Context->DistanceModel = value;
        if(!Context->SourceDistanceModel)
            Context->UpdateSources = AL_TRUE;
    }
    al_endtry;

    ALCcontext_DecRef(Context);
}
开发者ID:Lorchik,项目名称:libopenal,代码行数:25,代码来源:alState.c

示例9: alGetIntegerv

AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values)
{
    ALCcontext *Context;

    if(values)
    {
        switch(pname)
        {
            case AL_DOPPLER_FACTOR:
            case AL_DOPPLER_VELOCITY:
            case AL_DISTANCE_MODEL:
            case AL_SPEED_OF_SOUND:
            case AL_DEFERRED_UPDATES_SOFT:
                values[0] = alGetInteger(pname);
                return;
        }
    }

    Context = GetContextRef();
    if(!Context) return;

    al_try
    {
        CHECK_VALUE(Context, values);
        switch(pname)
        {
            default:
                al_throwerr(Context, AL_INVALID_ENUM);
        }
    }
    al_endtry;

    ALCcontext_DecRef(Context);
}
开发者ID:Lorchik,项目名称:libopenal,代码行数:34,代码来源:alState.c

示例10: ifoPrint_time

/* Put this in some other file / package?  It's used in nav_print too. */
static void ifoPrint_time(dvd_time_t *dtime) {
  const char *rate;
  CHECK_VALUE((dtime->hour>>4) < 0xa && (dtime->hour&0xf) < 0xa);
  CHECK_VALUE((dtime->minute>>4) < 0x7 && (dtime->minute&0xf) < 0xa);
  CHECK_VALUE((dtime->second>>4) < 0x7 && (dtime->second&0xf) < 0xa);
  CHECK_VALUE((dtime->frame_u&0xf) < 0xa);
  
  printf("%02x:%02x:%02x.%02x", 
         dtime->hour,
         dtime->minute,
         dtime->second,
         dtime->frame_u & 0x3f);
  switch((dtime->frame_u & 0xc0) >> 6) {
  case 1:
    rate = "25.00";
    break;
  case 3:
    rate = "29.97";
    break;
  default:
    if(dtime->hour == 0 && dtime->minute == 0 
       && dtime->second == 0 && dtime->frame_u == 0)
      rate = "no";
    else
      rate = "(please send a bug report)";
    break;
  } 
  printf(" @ %s fps", rate);
}
开发者ID:twtwft,项目名称:mplayer-10rc2-upgrade,代码行数:30,代码来源:ifo_print.c

示例11: check_uint64_range

static int check_uint64_range(const ss_conf_data_t *conf, const char *name, unsigned long long num)
{

	if (NULL == conf || NULL == name) {
		return SS_CONF_NULL;
	}

	if (NULL == conf->range) {
		SS_LOG_WARNING("no found configure range file, no check range[%s]", name);
		return SS_CONF_CHECKSUCCESS;
	}

	int ret;
	unsigned long long l;
	unsigned long long r;
	char range_str[WORD_SIZE];
	ret = lib_getconfstr(conf->range, name, range_str, sizeof(range_str));

	if (-1 == ret) {
		SS_LOG_WARNING("no found [%s] range check item", name);
		return SS_CONF_CHECKSUCCESS;
	}

	if (sscanf(range_str, "range [%llu %llu]", &l, &r) == 2) {
		if (CHECK_VALUE(num, l, r) == 0) {
			return SS_CONF_CHECKSUCCESS;
		} else {
			SS_LOG_WARNING("int [%s] load error, [%llu] overflow range [%llu %llu]", name, num, l, r);
			return SS_CONF_CHECKFAIL;
		}
	}

	SS_LOG_WARNING("int [%s] load error, [%llu] is invalid format", name, num);
	return SS_CONF_CHECKFAIL;
}
开发者ID:newwy,项目名称:otl,代码行数:35,代码来源:ss_conf.cpp

示例12: tclcommand_inter_parse_angle

/// parse parameters for the angle potential
int tclcommand_inter_parse_angle(Tcl_Interp *interp, int bond_type, int argc, char **argv)
{
  double bend, phi0;

  /* the optional parameter phi0 is due to backwards compatibility and is set to PI if not given */
  if (argc != 2 && argc != 3) {
    Tcl_AppendResult(interp, "angle needs 1 or 2 parameters: "
		     "<bend> [<phi0>]", (char *) NULL);
    return (TCL_ERROR);
  }

  if (! ARG_IS_D(1, bend)) {
    Tcl_AppendResult(interp, "angle needs a DOUBLE parameter: "
		     "<bend> ", (char *) NULL);
    return TCL_ERROR;
  }

  /* special treatment of the optional parameter phi0 */
  if (argc == 3) {
    if (! ARG_IS_D(2, phi0)) {
      Tcl_AppendResult(interp, "angle needs a DOUBLE parameter: "
		       "<phi0> ", (char *) NULL);
      return TCL_ERROR;
    }
  } else {
    phi0 = PI;
  }
  CHECK_VALUE(angle_set_params(bond_type, bend, phi0), "bond type must be nonnegative");
}
开发者ID:Ammar-85,项目名称:espresso,代码行数:30,代码来源:angle_tcl.cpp

示例13: alDeleteFilters

AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters)
{
    ALCcontext *Context;
    ALfilter *Filter;
    ALsizei i;

    Context = GetContextRef();
    if(!Context) return;

    al_try
    {
        ALCdevice *device = Context->Device;
        CHECK_VALUE(Context, n >= 0);
        for(i = 0;i < n;i++)
        {
            if(filters[i] && LookupFilter(device, filters[i]) == NULL)
                al_throwerr(Context, AL_INVALID_NAME);
        }

        for(i = 0;i < n;i++)
        {
            if((Filter=RemoveFilter(device, filters[i])) == NULL)
                continue;
            FreeThunkEntry(Filter->id);

            memset(Filter, 0, sizeof(*Filter));
            free(Filter);
        }
    }
    al_endtry;

    ALCcontext_DecRef(Context);
}
开发者ID:JakobssonAndre,项目名称:lotech,代码行数:33,代码来源:alFilter.c

示例14: tclcommand_inter_parse_harmonic_dumbbell

int tclcommand_inter_parse_harmonic_dumbbell(Tcl_Interp *interp, int bond_type, int argc, char **argv)
{
  double k1, k2, r, r_cut;

  if (argc < 4) {
    Tcl_AppendResult(interp, "harmonic dumbbell needs at least 3 parameters: "
		     "<k1> <k2> <r> [<r_cut>]", (char *) NULL);
    return TCL_ERROR;
  }

  if ((! ARG_IS_D(1, k1)) || (! ARG_IS_D(2, k2)) || (! ARG_IS_D(3, r))) {
    Tcl_AppendResult(interp, "harmonic dumbbell needs at least 3 DOUBLE parameters: "
		     "<k1> <k2> <r> [<r_cut>]", (char *) NULL);
    return TCL_ERROR;
  }

  if (argc < 5) {
    r_cut = -1.0;
  } else if (! ARG_IS_D(4, r_cut))  {
    Tcl_AppendResult(interp, "<r_cut> should be DOUBLE", (char *) NULL);
    return TCL_ERROR;
  }

  CHECK_VALUE(harmonic_dumbbell_set_params(bond_type, k1, k2, r, r_cut), "bond type must be nonnegative");
}
开发者ID:Clemson-MSE,项目名称:espresso,代码行数:25,代码来源:harmonic_dumbbell_tcl.cpp

示例15: alDeleteEffects

AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects)
{
    ALCcontext *Context;
    ALeffect *Effect;
    ALsizei i;

    Context = GetContextRef();
    if(!Context) return;

    al_try
    {
        ALCdevice *device = Context->Device;
        CHECK_VALUE(Context, n >= 0);
        for(i = 0;i < n;i++)
        {
            if(effects[i] && LookupEffect(device, effects[i]) == NULL)
                al_throwerr(Context, AL_INVALID_NAME);
        }

        for(i = 0;i < n;i++)
        {
            if((Effect=RemoveEffect(device, effects[i])) == NULL)
                continue;
            FreeThunkEntry(Effect->id);

            memset(Effect, 0, sizeof(*Effect));
            free(Effect);
        }
    }
    al_endtry;

    ALCcontext_DecRef(Context);
}
开发者ID:JakobssonAndre,项目名称:lotech,代码行数:33,代码来源:alEffect.c


注:本文中的CHECK_VALUE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。