您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CHK函数代码示例

51自学网 2021-06-01 20:01:21
  C++
这篇教程C++ CHK函数代码示例写得很实用,希望能帮到您。

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

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

示例1: gread

voidgread(struct termios *tp, char *s){	const struct cchar *cp;	char *ep, *p;	long tmp;	if ((s = strchr(s, ':')) == NULL)		gerr(NULL);	for (++s; s != NULL;) {		p = strsep(&s, ":/0");		if (!p || !*p)			break;		if (!(ep = strchr(p, '=')))			gerr(p);		*ep++ = '/0';		(void)sscanf(ep, "%lx", &tmp);#define	CHK(s)	(*p == s[0] && !strcmp(p, s))		if (CHK("cflag")) {			tp->c_cflag = tmp;			continue;		}		if (CHK("iflag")) {			tp->c_iflag = tmp;			continue;		}		if (CHK("ispeed")) {			(void)sscanf(ep, "%ld", &tmp);			tp->c_ispeed = tmp;			continue;		}		if (CHK("lflag")) {			tp->c_lflag = tmp;			continue;		}		if (CHK("oflag")) {			tp->c_oflag = tmp;			continue;		}		if (CHK("ospeed")) {			(void)sscanf(ep, "%ld", &tmp);			tp->c_ospeed = tmp;			continue;		}		for (cp = cchars1; cp->name != NULL; ++cp)			if (CHK(cp->name)) {				tp->c_cc[cp->sub] = tmp;				break;			}		if (cp->name == NULL)			gerr(p);	}}
开发者ID:Bluerise,项目名称:openbsd-src,代码行数:54,


示例2: BMessageRunner

/*	BMessageRunner(BMessenger target, const BMessage *message,				   bigtime_t interval, int32 count)	@case 3			target is valid, message is valid, interval == 0, count > 0	@results		R5: InitCheck() should return B_ERROR.						GetInfo() should return B_BAD_VALUE.					OBOS: InitCheck() should return B_OK.						  GetInfo() should return B_OK.						  A minimal time interval is used (50000). */void TBMessageRunnerTester::BMessageRunnerA3(){	MessageRunnerTestApp app(kTesterSignature);	MessageRunnerTestLooper *looper = app.TestLooper();	BMessenger target(looper);	BMessage message(MSG_RUNNER_MESSAGE);	bigtime_t interval = 0;	int32 count = 5;	BMessageRunner runner(target, &message, interval, count);#ifdef TEST_R5	CHK(runner.InitCheck() == B_ERROR);	check_message_runner_info(runner, B_BAD_VALUE);#else	bigtime_t startTime = system_time();	CHK(runner.InitCheck() == B_OK);	interval = max(interval, kMinTimeInterval);	check_message_runner_info(runner, B_OK, interval, count);	snooze((count + 1) * interval + 10000);	CHK(looper->CheckMessages(startTime, interval, count));	CHK(app.CountReplies() == count);#endif}
开发者ID:mariuz,项目名称:haiku,代码行数:32,


示例3: channelTestFamily_done

utilStatus channelTestFamily_done( channelTestFamily * This ) {   utilStatus status = UTIL_STATUS_NO_ERROR;   if( This ) {      unsigned i;      if( This->parent2 ) {         CHK(__FILE__,__LINE__,channelTestPerson_delete( &This->parent2 ))      }      for( i = 0; i < This->children.count; ++i ) {         CHK(__FILE__,__LINE__,channelTestPerson_delete( &This->children.items[i] ))      }      CHK(__FILE__,__LINE__,channelList_done((channelList *)&This->children ))   }   else {
开发者ID:AubinMahe,项目名称:dcrud,代码行数:13,


示例4: cli_fault_injection_dev_addr

int cli_fault_injection_dev_addr(char *line, int num_of_args){	char fault_num_str[MAX_ARG_SIZE];	char dev_addr_str[MAX_ARG_SIZE];	int fault_num;	int dev_addr;	/* Get number of fault injection */	CHK(cli_get_word(line, fault_num_str, sizeof(fault_num_str), 2));	/* Get device address */	CHK(cli_get_word(line, dev_addr_str, sizeof(dev_addr_str), 3));	/* Convert strings to int */	fault_num = atoi(fault_num_str) - 1;	dev_addr = (int) strtol(dev_addr_str, (char **) &dev_addr_str, 16);	CHK(cfg_set_fault_injection_dev_address(fault_num, (unsigned char) dev_addr));	return 0;}
开发者ID:redivo,项目名称:tcc,代码行数:22,


示例5: GetAppList

/*	void GetAppList(const char *signature, BList *teamIDList) const	@case 2			teamIDList is not NULL and not empty, signature is not					NULL, but no app with this signature is running	@results		Should not modify teamIDList.*/void GetAppListTester::GetAppListTestB2(){	const char *signature = "application/x-vnd.obos-does-not-exist";	// create a list with some dummy entries	BList list;	list.AddItem((void*)-7);	list.AddItem((void*)-42);	// get a list of running applications for reference	BRoster roster;	BList list1(list);	roster.GetAppList(signature, &list1);	// run some apps	AppRunner runner1(true);	AppRunner runner2(true);	AppRunner runner3(true);	CHK(runner1.Run("AppRunTestApp1") == B_OK);	CHK(runner2.Run("AppRunTestApp2") == B_OK);	CHK(runner3.Run("BMessengerTestApp1") == B_OK);	BList expectedApps;	// get a new app list and check it	BList list2(list);	roster.GetAppList(signature, &list2);	check_list(list2, list, list1, expectedApps);	// quit app 1	runner1.WaitFor(true);	BList list3(list);	roster.GetAppList(signature, &list3);	check_list(list3, list, list1, expectedApps);	// quit app 2	runner2.WaitFor(true);	BList list4(list);	roster.GetAppList(signature, &list4);	check_list(list4, list, list1, expectedApps);	// quit app 3	runner3.WaitFor(true);	BList list5(list);	roster.GetAppList(signature, &list5);	check_list(list5, list, list1, expectedApps);}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:45,


示例6: IteratorForIndex

	inline ConstIterator IteratorForIndex(int32 index) const	{		if (index < 0 || index > Count()) {			CHK(fMyVector.IteratorForIndex(index) == fMyVector.End());			return End();		} else {			MyIterator myIt = fMyVector.IteratorForIndex(index);			ReferenceIterator it = fReferenceVector.begin();			for (int32 i = 0; i < index; i++)				++it;			return ConstIterator(this, myIt, it);		}	}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:13,


示例7: TestDir15

uint TestDir15(void){  tIORes res;  uint result = 1;  tReadDirState ReadDirState;  tFATDirectoryEntry DirEntry;//  tFATFSStatus FSStatus2;  FAT_opendir (&stdio_FATFS, &res, "d://", &ReadDirState);  CHK(res == ior_OK);  FAT_readdir (&stdio_FATFS, &res, &ReadDirState, &DirEntry);  CHK(res == ior_NO_MORE_FILES);  FAT_closedir (&stdio_FATFS, &res, &ReadDirState);  CHK(res == ior_OK);  result = 0;lend:  return result;}
开发者ID:vn2019,项目名称:epos,代码行数:22,


示例8: main

int main(int argc, char **argv){	/* create dummy pixmap to get initialization out of the way */	c2d_ts_handle curTimestamp;	PixmapPtr tmp = create_pixmap(64, 64, xRGB);	CHK(c2dFlush(tmp->id, &curTimestamp));	CHK(c2dWaitTimestamp(curTimestamp));/*[  1340.257] (II) freedreno(0): MSMCheckComposite:590 op:12: 0x2eb268 {20028888, 0} <- 0x2eb3a8 {08018000, 0} ((nil) {00000000, 0})[  1340.257] (II) freedreno(0): MSMPrepareComposite:694 0x2eb178 {35x8,256} <- 0x2eb2c8 {1024x320,1024} ((nil) {0x0,0})[  1340.258] (II) freedreno(0): MSMComposite:766 srcX=0 srcY=0  maskX=0 maskY=0 dstX=0  dstY=2  width=7 height=6 */	test_composite(C2D_ALPHA_BLEND_ADDITIVE,			ARGB, 35,   8,			A8,   1024, 320,			0,    0,    0,			0, 0, 0, 0, 0, 2, 7, 6);	return 0;}
开发者ID:downthemachine,项目名称:freedreno,代码行数:22,


示例9: ctr_drbg_self_test

/* * Checkup routine */int ctr_drbg_self_test( int verbose ){    ctr_drbg_context ctx;    unsigned char buf[16];    /*     * Based on a NIST CTR_DRBG test vector (PR = True)     */    if( verbose != 0 )        polarssl_printf( "  CTR_DRBG (PR = TRUE) : " );    test_offset = 0;    CHK( ctr_drbg_init_entropy_len( &ctx, ctr_drbg_self_test_entropy,                                entropy_source_pr, nonce_pers_pr, 16, 32 ) );    ctr_drbg_set_prediction_resistance( &ctx, CTR_DRBG_PR_ON );    CHK( ctr_drbg_random( &ctx, buf, CTR_DRBG_BLOCKSIZE ) );    CHK( ctr_drbg_random( &ctx, buf, CTR_DRBG_BLOCKSIZE ) );    CHK( memcmp( buf, result_pr, CTR_DRBG_BLOCKSIZE ) );    if( verbose != 0 )        polarssl_printf( "passed/n" );    /*     * Based on a NIST CTR_DRBG test vector (PR = FALSE)     */    if( verbose != 0 )        polarssl_printf( "  CTR_DRBG (PR = FALSE): " );    test_offset = 0;    CHK( ctr_drbg_init_entropy_len( &ctx, ctr_drbg_self_test_entropy,                            entropy_source_nopr, nonce_pers_nopr, 16, 32 ) );    CHK( ctr_drbg_random( &ctx, buf, 16 ) );    CHK( ctr_drbg_reseed( &ctx, NULL, 0 ) );    CHK( ctr_drbg_random( &ctx, buf, 16 ) );    CHK( memcmp( buf, result_nopr, 16 ) );    if( verbose != 0 )        polarssl_printf( "passed/n" );    if( verbose != 0 )            polarssl_printf( "/n" );    return( 0 );}
开发者ID:cwyiu,项目名称:fibjs,代码行数:47,


示例10: chunk_write

/* writting from chunk */int chunk_write(void *chunk, int fd){    int n = -1;    if(chunk && fd > 0 && CHK(chunk)->left > 0 && CHK(chunk)->data && CHK(chunk)->end            && (n = write(fd, CHK(chunk)->end, CHK(chunk)->left)) > 0)    {        CHK(chunk)->left -= n;        CHK(chunk)->end += n;    }    return n;}
开发者ID:houweifeng,项目名称:sbase,代码行数:13,


示例11: calc_afe_blacklevel

/* * Calculate and set the AFE offset. * * low:  known-good AFE offset-register value. See note. * high: known-good AFE offset-register value. See note.  * * Note: * 'low' and 'high' depend on the scanner model. * Choose them so that * 1. both produce black pixel samples > 0, and never zero. * 2. 'low' produces a a darker black level than 'high', * 3. 'low' and 'high' values are as far apart as possible, *    for better precision. * Example: For CanoScan 4400F, select low = 75, high = 0. * Notice that the 'low' register value is not necessarily * less than the 'high' register value. It is what comes * out of the scanner that counts. */static int calc_afe_blacklevel(struct gl843_device *dev,			       struct calibration_info *cal,			       uint8_t low, uint8_t high){	int ret, i;	struct gl843_image *img;	struct img_stat lo_stat, hi_stat;	DBG(DBG_msg, "Calibrating A/D-converter black level./n");	CHK_MEM(img = create_image(cal->width, cal->height, PXFMT_RGB16));	/* Scan with the lamp off to produce black pixels. */	CHK(set_lamp(dev, LAMP_OFF, 0));	/* Sample 'low' black level */	for (i = 0; i < 3; i++) {		CHK(write_afe_gain(dev, i, 1.0));		CHK(write_afe(dev, 32 + i, low));  /* Set 'low' black level */	}	CHK(scan_img(dev, img, 10000));	get_image_stats(img, &lo_stat);	/* Sample 'high' black level */	for (i = 0; i < 3; i++) {		CHK(write_afe(dev, 32 + i, high)); /* Set 'high' black level */	}	CHK(scan_img(dev, img, 10000));	get_image_stats(img, &hi_stat);	/* Use the line equation to find and set the best offset value */	for (i = 0; i < 3; i++) {		double m, c; /* y = mx + c */		int o;	/* offset */		m = (hi_stat.avg[i] - lo_stat.avg[i]) / (high - low);		c = lo_stat.avg[i] - m * low;		o = (int) satf(-c / m + 0.5, 0, 255);		cal->offset[i] = o;		CHK(write_afe(dev, 32 + i, o));		DBG(DBG_info, "AFE %s offset = %d/n", idx_name(i), o);	}	ret = 0;chk_failed:	free(img);	return ret;	chk_mem_failed:	ret = LIBUSB_ERROR_NO_MEM;	goto chk_failed;}
开发者ID:AndreySV,项目名称:gl843driver,代码行数:71,


示例12: msearch

intmsearch(char ***argvp, struct info *ip){	struct modes *mp;	char *name;	name = **argvp;	for (mp = cmodes; mp->name; ++mp)		if (CHK(mp->name)) {			ip->t.c_cflag &= ~mp->unset;			ip->t.c_cflag |= mp->set;			ip->set = 1;			return (1);		}	for (mp = imodes; mp->name; ++mp)		if (CHK(mp->name)) {			ip->t.c_iflag &= ~mp->unset;			ip->t.c_iflag |= mp->set;			ip->set = 1;			return (1);		}	for (mp = lmodes; mp->name; ++mp)		if (CHK(mp->name)) {			ip->t.c_lflag &= ~mp->unset;			ip->t.c_lflag |= mp->set;			ip->set = 1;			return (1);		}	for (mp = omodes; mp->name; ++mp)		if (CHK(mp->name)) {			ip->t.c_oflag &= ~mp->unset;			ip->t.c_oflag |= mp->set;			ip->set = 1;			return (1);		}	return (0);}
开发者ID:daniloegea,项目名称:freebsd,代码行数:38,


示例13: main

int main(int argc, char **argv){	/* create dummy pixmap to get initialization out of the way */	c2d_ts_handle curTimestamp;	PixmapPtr tmp = create_pixmap(64, 64, xRGB);	CHK(c2dFlush(tmp->id, &curTimestamp));	CHK(c2dWaitTimestamp(curTimestamp));	test_fill(1920, 1080, xRGB, 0, 0, 1920, 1080);	test_fill(1920, 1080, xRGB, 717, 395, 718, 685);	/* test limits of x, y */	test_fill(1920, 1080, xRGB, 0x100, 0, 0x101, 0);	test_fill(1920, 1080, xRGB, 0, 0x100, 0, 0x101);	/* test limits of width, height */	test_fill(1920, 1080, xRGB, 0, 0, 0x100, 0);	test_fill(1920, 1080, xRGB, 0, 0, 0, 0x100);	test_fill(1, 1, xRGB, 0, 0, 1, 1);	return 0;}
开发者ID:maclaw,项目名称:freedreno,代码行数:23,


示例14: cli_fault_injection_gen_read_en

int cli_fault_injection_gen_read_en(char *line, int num_of_args){	char fault_num_str[MAX_ARG_SIZE];	char en_value_str[MAX_ARG_SIZE];	int fault_num;	int en_value;	/* Get number of fault injection */	CHK(cli_get_word(line, fault_num_str, sizeof(fault_num_str), 2));	/* Get enable value */	CHK(cli_get_word(line, en_value_str, sizeof(en_value_str), 3));	/* Convert strings to int */	fault_num = atoi(fault_num_str) - 1;	en_value = atoi(en_value_str);	CHK(cfg_set_fault_injection_read_enable(fault_num, en_value));	return 0;	return 0;}
开发者ID:redivo,项目名称:tcc,代码行数:23,


示例15: TestDir13

uint TestDir13(void){  tIORes res;  uint result = 1;//  tFATFSStatus FSStatus1;  FAT_mkdir (&stdio_FATFS, &res, "d://level1", mt_S_IWUSR);  CHK(res == ior_OK);  result = 0;lend:  return result;}
开发者ID:vn2019,项目名称:epos,代码行数:14,


示例16: cfg_set_fault_injection_dev_address

int cfg_set_fault_injection_dev_address(int index, unsigned char address){	if (!IS_VALID_FAULT_INJECTION_INDEX(index))		return ERR_INVALID_PARAM;	if (!IS_VALID_DEV_ADDR(address))		return ERR_INVALID_PARAM;	CHK(hw_set_i2c_address(FI_INDEX_TO_I2C_NUMBER(index), address));	Cfg.i2c_fi[index].dev_address = address;	return 0;}
开发者ID:redivo,项目名称:tcc,代码行数:14,


示例17: IntArrayListImport

ESR_ReturnCode IntArrayListImport(int* value, IntArrayList** self){  ESR_ReturnCode rc;  IntArrayListImpl* impl;    if (self == NULL)    return ESR_INVALID_ARGUMENT;  CHK(rc, IntArrayListCreate(self));  impl = (IntArrayListImpl*) self;  impl->contents = value;  return ESR_SUCCESS;CLEANUP:  return rc;}
开发者ID:0omega,项目名称:platform_external_srec,代码行数:14,


示例18: check_list

// check_liststaticvoidcheck_list(const BList &toCheck, const BList &base, const BList &extendedBase,		   const BList &expected){	// toCheck and extendedBase must have prefix base	int32 baseCount = base.CountItems();	for (int32 i = 0; i < baseCount; i++) {		CHK(base.ItemAt(i) == toCheck.ItemAt(i));		CHK(base.ItemAt(i) == extendedBase.ItemAt(i));	}	// toCheck must have correct size	int32 toCheckCount = toCheck.CountItems();	int32 extendedBaseCount = extendedBase.CountItems();	int32 expectedCount = expected.CountItems();	CHK(toCheckCount == extendedBaseCount + expectedCount);	// toCheck must contain all elements of extendedBase and expected	// (arbitrary order)	BList list(extendedBase);	list.AddList((BList*)&expected);	CHK(contains_list(toCheck, list));	CHK(contains_list(list, toCheck));}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:24,


示例19: SR_EventLog_TokenSize_t

ESR_ReturnCode SR_EventLog_TokenSize_t(SR_EventLog* self, const LCHAR* token, size_t value){  SR_EventLogImpl *impl = (SR_EventLogImpl *)self;  ESR_ReturnCode rc;  LCHAR alpha[MAX_UINT_DIGITS+1];  size_t size = MAX_INT_DIGITS+1;  if (impl->logLevel == 0)    return ESR_SUCCESS;  CHK(rc, lultostr(value, alpha, &size, 10));  return self->token(self, token, alpha);CLEANUP:  return rc;}
开发者ID:CriGio,项目名称:platform_external_srec,代码行数:14,


示例20: open_socket

static void open_socket (int port){	struct sockaddr_in my_addr;	int sock = socket(AF_INET, SOCK_STREAM, 0);	CHK(sock);	my_addr.sin_addr.s_addr = htonl(INADDR_ANY);	my_addr.sin_port = htons(port);	my_addr.sin_family = AF_INET;	int optval = 1;	CHK(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof optval));	CHK(bind(sock,(struct sockaddr *)&my_addr,sizeof(struct sockaddr_in)));	CHK(listen(sock,1));	sockfd = accept(sock,&bot_addr, &bot_addrlen);	CHK(sockfd);	close(sock);	char msg[MAX_MSG_SIZE] ;	recv(sockfd,msg,MAX_MSG_SIZE,0);	int wlen = 4;	if (strncmp(msg, "NAME", wlen) == 0) {	  mm_botname(msg + wlen + 1,word_len(msg+wlen+1));		}}
开发者ID:lleclech,项目名称:PFA-Nethack-teamB,代码行数:23,


示例21: Remove

	void Remove(const Value &value)	{		int32 oldCount = Count();		for (ReferenceIterator it = fReferenceVector.begin();			 it != fReferenceVector.end();) {			if (*it == value)				it = fReferenceVector.erase(it);			else				++it;		}		int32 newCount = fReferenceVector.size();		CHK(fMyVector.Remove(value) == oldCount - newCount);		Check();	}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:14,


示例22: chunk_write_SSL

/* writting from chunk with SSL */int chunk_write_SSL(void *chunk, void *ssl){    int n = -1;#ifdef HAVE_SSL    if(chunk && ssl && CHK(chunk)->left > 0 && CHK(chunk)->data && CHK(chunk)->end            && (n = SSL_write(XSSL(ssl), CHK(chunk)->end, CHK(chunk)->left)) > 0)    {        CHK(chunk)->left -= n;        CHK(chunk)->end += n;    }#endif    return n;}
开发者ID:5bruce,项目名称:sbase,代码行数:14,


示例23: CHK

ErrorCode SoftwareBreakpointManager::add(Address const &address,                                         Lifetime lifetime, size_t size,                                         Mode mode) {  if (size < 2 || size > 4) {    bool isThumb = false;    //    // Unless the address specifies the thumb bit,    // we look at the current CPSR.    //    if (address.value() & 1) {      isThumb = true;    } else {      ds2::Architecture::CPUState state;      CHK(_process->currentThread()->readCPUState(state));      isThumb = state.isThumb();    }    if (isThumb) {      //      // The size for breakpoints is counted in bytes, but for the      // special case of 3 where it indicates a 2x16bit word, this in      // order to distinguish the 32bit ARM instructions. This semantic      // is equivalent to the one used by GDB.      //      uint32_t insn;      CHK(_process->readMemory(address.value() & ~1ULL, &insn, sizeof(insn)));      auto inst_size = Architecture::ARM::GetThumbInstSize(insn);      size = inst_size == Architecture::ARM::ThumbInstSize::TwoByteInst ? 2 : 3;    } else {      size = 4;    }  }  return super::add(address.value() & ~1ULL, lifetime, size, mode);}
开发者ID:sas,项目名称:ds2,代码行数:36,


示例24: parse_args

int parse_args(char** cmdline, ATERM *funcname, ATERM *args,int *arg_len) {  char *str;  int arg;  *arg_len = 0;  CHK((str = strsep(cmdline,"(")) == NULL);  mk_atom(*funcname,str,strlen(str));  while (*arg_len < 10 &&	  (str = strsep(cmdline, ",)")) != NULL) {    sscanf(str,"%d",&arg);    *(args+*arg_len) = mk_num((double)arg);    (*arg_len)++;  }  return 0;}
开发者ID:garazdawi,项目名称:alm,代码行数:15,


示例25: foo

int foo(const char *path){  int fd,err,rank;  unsigned int sum,value;  struct stat64 st;  if (MPI_Comm_rank) {     err = MPI_Comm_rank(MPI_COMM_WORLD,&rank);CHK(err);   }   else rank = -1;      fd = __collfs_open(path,O_RDONLY);  if (fd < 0) ERR("[%d] open(/"%s/",O_RDONLY) failed",rank,path);  sum = 0;  err = __collfs_lseek(fd,0,SEEK_SET); CHK(err);  long pagesize;  char* pa;  pagesize = sysconf(_SC_PAGESIZE);  pa = __collfs_mmap((void *)0,pagesize,PROT_READ,MAP_PRIVATE,fd,(off_t)0);  if (pa == MAP_FAILED) ERR("[%d] mmap(%d,pagesize) failed",rank,fd);  while (__collfs_libc_read(fd,&value,sizeof value) == sizeof value) {    sum ^= value;  }  err = __collfs_munmap(pa,pagesize); CHK(err);  err = __collfs_close(fd); CHK(err);  printf("[%d] XOR-sum of /"%s/": %x/n",rank,path,sum);  err = __collfs_xstat64(_STAT_VER, path, &st);CHK(err);  printf("[%d] %s (via __collfs_xstat64): inode %ld size %ld/n", rank, path, (long)st.st_ino, (long)st.st_size);  return 0;}
开发者ID:ahmadia,项目名称:collfs,代码行数:36,


示例26: main

int main(void){    int N,w,h,x1,y1,x2,y2,dx1,dx2,step,best,v;        scanf("%d",&N);    while (N--) {        scanf("%d %d",&w,&h);        for(y1=0;y1<h;y1++) {            scanf("%s",map[y1]);                    }        memset(m,-1,sizeof m);        m[0][0][0]=map[0][0]=='*';        for(step=1;step<w+h-1;step++)            for(x1=0;x1<=step;x1++)                for(x2=x1;x2<=step;x2++) {                    y1=step-x1;                    y2=step-x2;                    best=-1;                    if (!CHK(x1,y1) || !CHK(x2,y2)) continue;                    for(dx1=0;dx1<2;dx1++)                        for(dx2=0;dx2<2;dx2++)                            if (CHK(x1-dx1,y1-!dx1) && CHK(x2-dx2,y2-!dx2)) {                                v=m[step-1][x1-dx1][x2-dx2];                                if(v==-1)continue;                                if (v>best) best=v;                            }                    v=(map[y1][x1]=='*')+(map[y2][x2]=='*');                    if (v==2 && x1==x2) v=1;                    m[step][x1][x2]=best+v;                }                printf("%d/n",m[w+h-2][w-1][w-1]);    }    return 0;}
开发者ID:AlbertSean,项目名称:POJ,代码行数:36,


示例27: chunk_file

/* initialize chunk file */int chunk_file(void *chunk, char *file, off_t offset, off_t len){    if(chunk && file && offset >= 0 && len > 0)    {        CHK(chunk)->type = CHUNK_FILE;        CHK(chunk)->status = CHUNK_STATUS_ON;        CHK(chunk)->size = CHK(chunk)->left = len;        CHK(chunk)->offset = offset;        CHK(chunk)->ndata = 0;        strcpy(CHK(chunk)->filename, file);        return 0;    }    return -1;}
开发者ID:5bruce,项目名称:sbase,代码行数:15,



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


C++ CHKERR函数代码示例
C++ CHIP_Init函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。