• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CHECK_VALUE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: alAuxiliaryEffectSlotf

AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat value)
{
    ALCcontext *Context;
    ALeffectslot *Slot;

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

    al_try
    {
        if((Slot=LookupEffectSlot(Context, effectslot)) == NULL)
            al_throwerr(Context, AL_INVALID_NAME);
        switch(param)
        {
        case AL_EFFECTSLOT_GAIN:
            CHECK_VALUE(Context, value >= 0.0f && value <= 1.0f);

            Slot->Gain = value;
            Slot->NeedsUpdate = AL_TRUE;
            break;

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

    ALCcontext_DecRef(Context);
}
开发者ID:clarkdonald,项目名称:eecs494explore3d,代码行数:29,代码来源:alAuxEffectSlot.c


示例17: alGetListenerf

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

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

    al_try
    {
        CHECK_VALUE(Context, value);
        switch(param)
        {
            case AL_GAIN:
                *value = Context->Listener->Gain;
                break;

            case AL_METERS_PER_UNIT:
                *value = Context->Listener->MetersPerUnit;
                break;

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

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


示例18: tclcommand_inter_magnetic_parse_mdlc_params

int tclcommand_inter_magnetic_parse_mdlc_params(Tcl_Interp * interp, int argc, char ** argv)
{
  double pwerror;
  double gap_size;
  double far_cut = -1;
 
  MDLC_TRACE(fprintf(stderr, "%d: tclcommand_inter_magnetic_parse_mdlc_params().\n", this_node));
  
  if (argc < 2) {
    Tcl_AppendResult(interp, "either nothing or mdlc <pwerror> <minimal layer distance> {<cutoff>}  expected, not \"", argv[0], "\"", (char *)NULL);
    return TCL_ERROR;
  }
  if (!ARG0_IS_D(pwerror))
    return TCL_ERROR;
  if (!ARG1_IS_D(gap_size))
    return TCL_ERROR;

  argc -= 2; argv += 2;

  if (argc > 0) {
    // if there, parse away manual cutoff
    if(ARG0_IS_D(far_cut)) {
      argc--; argv++;
    }
    else
      Tcl_ResetResult(interp);

    if(argc > 0) {
	Tcl_AppendResult(interp, "either nothing or mdlc <pwerror> <minimal layer distance=size of the gap without particles> {<cutoff>}   expected, not \"", argv[0], "\"", (char *)NULL);
	return TCL_ERROR;
    }
  }
  CHECK_VALUE(mdlc_set_params(pwerror,gap_size,far_cut),"choose a 3d electrostatics method prior to use mdlc");
  coulomb.Dprefactor = (temperature > 0) ? temperature*coulomb.Dbjerrum : coulomb.Dbjerrum;
}
开发者ID:PedroASanchez,项目名称:espresso,代码行数:35,代码来源:mdlc_correction.c


示例19: tclcommand_inter_parse_morseforcecap

/// parser for the forcecap
int tclcommand_inter_parse_morseforcecap(Tcl_Interp * interp, int argc, char ** argv)
{
    char buffer[TCL_DOUBLE_SPACE];

    if (argc == 0) {
        if (morse_force_cap == -1.0)
            Tcl_AppendResult(interp, "morseforcecap individual", (char *) NULL);
        else {
            Tcl_PrintDouble(interp, morse_force_cap, buffer);
            Tcl_AppendResult(interp, "morseforcecap ", buffer, (char *) NULL);
        }
        return TCL_OK;
    }

    if (argc > 1) {
        Tcl_AppendResult(interp, "inter morseforcecap takes at most 1 parameter",
                         (char *) NULL);
        return TCL_ERROR;
    }

    if (ARG0_IS_S("individual"))
        morse_force_cap = -1.0;
    else if (! ARG0_IS_D(morse_force_cap) || morse_force_cap < 0) {
        Tcl_ResetResult(interp);
        Tcl_AppendResult(interp, "force cap must be a nonnegative double value or \"individual\"",
                         (char *) NULL);
        return TCL_ERROR;
    }

    CHECK_VALUE(morseforcecap_set_params(morse_force_cap),
                "If you can read this, you should change it. (Use the source Luke!)");
}
开发者ID:steinlet,项目名称:espresso,代码行数:33,代码来源:morse_tcl.c


示例20: client_main

int client_main(){
	int                     rc;
	int                     result          = -1;
	int                     testSock        = INVALID_SOCKET;
	int                     mngSock         = INVALID_SOCKET;
	struct sockaddr_in      serverAddr;
	
	printf("Enter Function client_main\n");
	
	rc = client_management(&mngSock);
	CHECK_VALUE("client_management", rc, 0, goto cleanup);
	
	/* open client socket */
	testSock = socket(AF_INET, SOCK_STREAM, 0);  
	CHECK_NOT_EQUAL("socket", testSock, INVALID_SOCKET, goto cleanup);
	
	/* Prepare server information (family, port and address) */
	serverAddr.sin_family = AF_INET;
	serverAddr.sin_port = htons(config.port);
	serverAddr.sin_addr.s_addr = inet_addr(config.sip);

	/* Sync other side is listen*/
	rc = sync_side(mngSock, 0);
	CHECK_VALUE("sync_side", rc, 0, goto cleanup);
	
	rc = connect(testSock, (struct sockaddr *) &serverAddr, sizeof(serverAddr));
	CHECK_VALUE("connect", rc, 0, goto cleanup);
	
	rc = send_data(testSock, mngSock);
	CHECK_VALUE("send_data", rc, 0, goto cleanup);
	
	/* sync for termination */
	rc = sync_side(mngSock, 0);
	CHECK_VALUE("sync_side", rc, 0, goto cleanup);
	
	result = 0;
 cleanup:
	if(testSock != INVALID_SOCKET){
		close(testSock);
		CHECK_VALUE("close", rc, 0, result = -1);
	}
	if(mngSock != INVALID_SOCKET){
		close(mngSock);
		CHECK_VALUE("close", rc, 0, result = -1);
	}
	return result;
}
开发者ID:AlaAyesh,项目名称:libvma,代码行数:47,代码来源:client.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CHF_BOX函数代码示例发布时间:2022-05-30
下一篇:
C++ CHECK_VALID函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap