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

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

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

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

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

示例1: hfs_format

//.........这里部分代码省略.........      hfsfile bbfile;      ExtDescriptor extent;      ExtDataRec *extrec;      ExtKeyRec key;      byte record[HFS_MAX_EXTRECLEN];      unsigned int reclen;      f_init(&bbfile, &vol, HFS_CNID_BADALLOC, "bad blocks");      qsort(badalloc, nbadblocks, sizeof(*badalloc),	    (int (*)(const void *, const void *)) compare);      for (i = 0; i < nbadblocks; ++i)	{	  if (i == 0 || badalloc[i] != extent.xdrStABN)	    {	      extent.xdrStABN    = badalloc[i];	      extent.xdrNumABlks = 1;	      if (extent.xdrStABN < vol.mdb.drNmAlBlks &&		  f_addextent(&bbfile, &extent) == -1)		goto fail;	    }	}      /* flush local extents into extents overflow file */      f_getptrs(&bbfile, &extrec, 0, 0);      r_makeextkey(&key, bbfile.fork, bbfile.cat.u.fil.filFlNum, 0);      r_packextrec(&key, extrec, record, &reclen);      if (bt_insert(&vol.ext, record, reclen) == -1)	goto fail;    }  vol.flags |= HFS_VOL_MOUNTED;  /* create root directory */  if (v_mkdir(&vol, HFS_CNID_ROOTPAR, vname) == -1)    goto fail;  vol.mdb.drNxtCNID = 16;  /* first CNID not reserved by Apple */  /* write boot blocks */  if (m_zerobb(&vol) == -1)    goto fail;  /* zero other unused space, if requested */  if (vol.flags & HFS_OPT_ZERO)    {      block b;      unsigned long bnum;      memset(&b, 0, sizeof(b));      /* between MDB and VBM (never) */      for (bnum = 3; bnum < vol.mdb.drVBMSt; ++bnum)	b_writelb(&vol, bnum, &b);      /* between VBM and first allocation block (sometimes if HFS_OPT_2048) */      for (bnum = vol.mdb.drVBMSt + vol.vbmsz; bnum < vol.mdb.drAlBlSt; ++bnum)	b_writelb(&vol, bnum, &b);      /* between last allocation block and alternate MDB (sometimes) */      for (bnum = vol.mdb.drAlBlSt + vol.mdb.drNmAlBlks * vol.lpa;	   bnum < vol.vlen - 2; ++bnum)	b_writelb(&vol, bnum, &b);      /* final block (always) */      b_writelb(&vol, vol.vlen - 1, &b);    }	  /* write boot blocks */  b_writelb(&vol, 0, (block*)bootblocks);  b_writelb(&vol, 1, (block*)&bootblocks[HFS_BLOCKSZ]);    /* flush remaining state and close volume */  if (v_close(&vol) == -1)    goto fail;  FREE(badalloc);  return 0;fail:  v_close(&vol);  FREE(badalloc);  return -1;}
开发者ID:andyvand,项目名称:fusehfs,代码行数:101,


示例2: drawallbuttons

void drawallbuttons(struct w_window *w) {    static struct w_b_choose modebutton, modifybutton, pigfile;    static struct w_b_press movebutton[6], pogfile;    struct w_button *b1, *b2, *b3;    struct ws_bitmap *bm;    int i, j, k, bxsize, bysize, y;    char **pignames;    modifybutton.num_options = tt_number;    modifybutton.options = (const char **)init.bnames;    modifybutton.selected = view.currmode;    modifybutton.select_lroutine = modifybutton.select_rroutine =                                       b_changemode;    modebutton.num_options = mt_number;    modebutton.options = movemodes;    modebutton.selected = view.movemode;    modebutton.select_lroutine = modebutton.select_rroutine =                                     b_changemovemode;    if (init.d_ver >= d2_10_reg) {        pignames = ws_getallfilenames(init.pigpaths[init.d_ver], "pig",                                      &pigfile.num_options);        checkmem( pigfile.options =                     MALLOC(sizeof(char *) * pigfile.num_options) );        pigfile.selected = 0;        for (i = 0; i < pigfile.num_options; i++) {            pignames[i][strlen(pignames[i]) - 4] = 0;            checkmem( pigfile.options[i] = MALLOC(strlen(pignames[i]) + 1) );            strcpy( (char *)pigfile.options[i], pignames[i] );            for (j = 1; j < strlen(pigfile.options[i]); j++) {                *( (char *)pigfile.options[i] + j ) = tolower(                    pigfile.options[i][j]);            }            strcat(pignames[i], ".256");            if ( l && !strcmp(pignames[i], l->pigname) ) {                pigfile.selected = i;            }            FREE(pignames[i]);        }        FREE(pignames);        pigfile.select_lroutine = pigfile.select_rroutine = b_changepigfile;    }    checkmem( view.b_levels = MALLOC( sizeof(struct w_b_choose) ) );    view.b_levels->num_options = 1;    checkmem( view.b_levels->options = MALLOC(sizeof(char *) * 1) );    view.b_levels->options[0] = TXT_NONE;    view.b_levels->selected = 0;    view.b_levels->select_lroutine = view.b_levels->select_rroutine =                                         b_changelevel;    bxsize = w_xwininsize(w) / 3;    w_refreshstart(w);    checkmem( b1 = b_currmode =                       w_addstdbutton(w, w_b_choose, 0, y = 0, bxsize * 3, -1,                                      TXT_MODIFYWHAT, &modifybutton,                                      1) );    y += b1->ysize;    checkmem( b2 = b_movemode =                       w_addstdbutton(w, w_b_choose, 0, y, bxsize * 3, -1,                                      TXT_MOVEMODE, &modebutton, 1) );    y += b2->ysize;    checkmem( view.levelbutton =                 w_addstdbutton(w, w_b_choose, 0, y, bxsize * 3, -1,                                TXT_LEVEL, view.b_levels, 1) );    y += view.levelbutton->ysize;    if (init.d_ver >= d2_10_reg) {        checkmem( b3 = b_pigfile =                           w_addstdbutton(w, w_b_choose, 0, y, bxsize * 3, -1,                                          TXT_LEVELPIGFILE, &pigfile,                                          1) );        y += b3->ysize;        if (init.d_ver >= d2_12_reg) {            pogfile.delay = 0;            pogfile.repeat = -1;            pogfile.l_pressed_routine = pogfile.r_pressed_routine = NULL;            pogfile.l_routine = pogfile.r_routine = b_changepogfile;            checkmem( b_pogfile =                         w_addstdbutton(w, w_b_press, 0, y, bxsize * 3, -1,                                        TXT_POGFILE, &pogfile, 1) );            y += b_pogfile->ysize;        }    }    bysize = (w_ywininsize(w) - y) / 2;    /* move button menu */    for (j = 5; j < 22; j++) {        for (k = 1; k < 5; k += 2) {            mbls[2][j * 5 + k] = -mbls[0][j * 5 + k];            mbls[2][j * 5 + k + 1] = mbls[0][j * 5 + k + 1];            mbls[4][j * 5 + k] = mbls[1][j * 5 + k];//.........这里部分代码省略.........
开发者ID:j13s,项目名称:devil,代码行数:101,


示例3: disposeFpgmPrep

static INLINE void disposeFpgmPrep(MOVE table_fpgm_prep *table) {	if (table->tag) sdsfree(table->tag);	if (table->bytes) FREE(table->bytes);}
开发者ID:anthrotype,项目名称:otfcc,代码行数:4,


示例4: mvg_triangulation_RANSAC

//.........这里部分代码省略.........		CvMat * X = 			affine ? mvg_triangulation_SVD_affine(projection_matrices, projected_points, normalize_A, 2, samples, 2)			       : mvg_triangulation_SVD(projection_matrices, projected_points, normalize_A, 2, samples, 2);		if (!X)		{			continue;		}		// count and mark the inliers		int inliers_count = 0;		for (int j = 0; j < n; j++)		{			double reprojection[2];			// note that here we're using "dirty" projection method which is suitable only for visualization; on the upside, it shouldn't matter because			// if a point is projected on pi_infinity, there's something wrong with it anyway			if (affine) 			{				opencv_vertex_projection_visualization(projection_matrices[j], OPENCV_ELEM(X, 0, 0), OPENCV_ELEM(X, 1, 0), OPENCV_ELEM(X, 2, 0), reprojection);			}			else			{				opencv_vertex_projection_visualization(projection_matrices[j], OPENCV_ELEM(X, 0, 0), OPENCV_ELEM(X, 1, 0), OPENCV_ELEM(X, 2, 0), OPENCV_ELEM(X, 3, 0), reprojection);			}			const double				dx = reprojection[0] - OPENCV_ELEM(projected_points, 0, j), 				dy = reprojection[1] - OPENCV_ELEM(projected_points, 1, j);						if (dx * dx + dy * dy <= threshold_sq)			{				inliers_count++; 				status[j] = true; 			}			else			{				status[j] = false;			}		}		cvReleaseMat(&X);		// check for the best sample 		if (inliers_count > best_inliers_count)		{			bool * temp = best_status; 			best_status = status; 			status = temp;			best_inliers_count = inliers_count; 		}		// debug 		// printf("{%d/%d} ", inliers_count, n);	}	FREE(status);	if (best_inliers_count < 2)	{		FREE(best_status);		return false;	}	// calculate camera calibration using only inliers	int * samples = ALLOC(int, best_inliers_count);	int j = 0;	int outliers = 0, min = min_inliers_to_triangulate; 	for (int i = 0; i < n; i++)	{		if (best_status[i]) 		{			samples[j++] = i;		}		else		{			outliers++;		}	}	if (outliers == 0) min = min_inliers_to_triangulate_weaker;	CvMat * X = affine ? mvg_triangulation_SVD_affine(projection_matrices, projected_points, true, min, samples, best_inliers_count)	                   : mvg_triangulation_SVD(projection_matrices, projected_points, true, min, samples, best_inliers_count);	if (!X)	{		// printf("failed to estimate/n"); 		if (inliers) 		{			memset(inliers, 0, sizeof(bool) * n);		}	}	else if (inliers)	{		memcpy(inliers, best_status, sizeof(bool) * n);	}	// release resources	FREE(samples);	FREE(best_status);	// printf("/n");	return X;}
开发者ID:HWiese1980,项目名称:insight3d,代码行数:101,


示例5: krb5_rc_dfl_recover_locked

static krb5_error_codekrb5_rc_dfl_recover_locked(krb5_context context, krb5_rcache id){#ifdef NOIOSTUFF    return KRB5_RC_NOIO;#else    struct dfl_data *t = (struct dfl_data *)id->data;    krb5_donot_replay *rep = 0;    krb5_error_code retval;    long max_size;    int expired_entries = 0;    krb5_int32 now;    if ((retval = krb5_rc_io_open(context, &t->d, t->name))) {	return retval;    }    t->recovering = 1;    max_size = krb5_rc_io_size(context, &t->d);    rep = NULL;    if (krb5_rc_io_read(context, &t->d, (krb5_pointer) &t->lifespan,			sizeof(t->lifespan))) {	retval = KRB5_RC_IO;	goto io_fail;    }    if (!(rep = (krb5_donot_replay *) malloc(sizeof(krb5_donot_replay)))) {	retval = KRB5_RC_MALLOC;	goto io_fail;    }    rep->client = NULL;    rep->server = NULL;    if (krb5_timeofday(context, &now))	now = 0;    /* now read in each auth_replay and insert into table */    for (;;) {	if (krb5_rc_io_mark(context, &t->d)) {	    retval = KRB5_RC_IO;	    goto io_fail;	}	retval = krb5_rc_io_fetch(context, t, rep, (int) max_size);	if (retval == KRB5_RC_IO_EOF)	    break;	else if (retval != 0)	    goto io_fail;	if (alive(now, rep, t->lifespan) != CMP_EXPIRED) {	    if (rc_store(context, id, rep, now) == CMP_MALLOC) {		retval = KRB5_RC_MALLOC; goto io_fail;	    }	} else {	    expired_entries++;	}	/*	 *  free fields allocated by rc_io_fetch	 */	FREE(rep->server);	FREE(rep->client);	rep->server = 0;	rep->client = 0;    }    retval = 0;    krb5_rc_io_unmark(context, &t->d);    /*     *  An automatic expunge here could remove the need for     *  mark/unmark but that would be inefficient.     */io_fail:    krb5_rc_free_entry(context, &rep);    if (retval)	krb5_rc_io_close(context, &t->d);    else if (expired_entries > EXCESSREPS)	retval = krb5_rc_dfl_expunge_locked(context, id);    t->recovering = 0;    return retval;#endif}
开发者ID:aosm,项目名称:Kerberos,代码行数:86,


示例6: val_log_assertion_pfx

voidval_log_assertion_pfx(const val_context_t * ctx, int level,                      const char *prefix, const char * name_pr,                      struct val_authentication_chain *next_as){    char            name_buf[INET6_ADDRSTRLEN + 1];    const char     *serv_pr;    int             tag = 0;    int             class_h;    int             type_h;    struct          val_rr_rec  *data;    struct          val_rr_rec  *sig;    struct          sockaddr *serv;    val_astatus_t   status;    struct val_rr_rec  *curkey, *cursig;    if (next_as == NULL)        return;    class_h = next_as->val_ac_rrset->val_rrset_class;    type_h = next_as->val_ac_rrset->val_rrset_type;    data = next_as->val_ac_rrset->val_rrset_data;    sig = next_as->val_ac_rrset->val_rrset_sig;    serv = next_as->val_ac_rrset->val_rrset_server;    status = next_as->val_ac_status;    if (NULL == prefix)        prefix = "";    if (serv)        serv_pr =            ((serv_pr =              val_get_ns_string(serv, name_buf, sizeof(name_buf))) == NULL) ?  "VAL_CACHE" : serv_pr;    else        serv_pr = "NULL";    if (type_h == ns_t_dnskey) {        for (curkey = data; curkey; curkey = curkey->rr_next) {            if ((curkey->rr_status == VAL_AC_VERIFIED_LINK) ||                (curkey->rr_status == VAL_AC_TRUST_POINT) ||                (curkey->rr_status == VAL_AC_UNKNOWN_ALGORITHM_LINK)) {                /*                 * Extract the key tag                  */                val_dnskey_rdata_t dnskey;                if (VAL_NO_ERROR != val_parse_dnskey_rdata(curkey->rr_rdata,                                       curkey->rr_rdata_length, &dnskey)) {                    val_log(ctx, LOG_INFO, "val_log_assertion_pfx(): Cannot parse DNSKEY data");                } else {                    tag = dnskey.key_tag;                    if (dnskey.public_key)                        FREE(dnskey.public_key);                }                break;            }        }    }    if (tag != 0) {        val_log(ctx, level,                "%sname=%s class=%s type=%s[tag=%d] from-server=%s "                "status=%s:%d", prefix, name_pr, p_class(class_h),                p_type(type_h), tag, serv_pr, p_ac_status(status), status);    } else {        val_log(ctx, level,                "%sname=%s class=%s type=%s from-server=%s status=%s:%d",                prefix, name_pr, p_class(class_h), p_type(type_h), serv_pr,                p_ac_status(status), status);    }#if 0    for (cursig = sig; cursig; cursig = cursig->rr_next) {        char incpTime[1028];        char exprTime[1028];        struct timeval  tv_sig;        val_rrsig_rdata_t rrsig;        val_parse_rrsig_rdata(cursig->rr_rdata, cursig->rr_rdata_length, &rrsig);        memset(&tv_sig, 0, sizeof(tv_sig));        tv_sig.tv_sec = rrsig.sig_incp;        GET_TIME_BUF((const time_t *)(&tv_sig.tv_sec), incpTime);        memset(&tv_sig, 0, sizeof(tv_sig));        tv_sig.tv_sec = rrsig.sig_expr;        GET_TIME_BUF((const time_t *)(&tv_sig.tv_sec), exprTime);        val_log(ctx, level,                "%s    ->tag=%d status=%s sig-incep=%s sig-expr=%s",                prefix, rrsig.key_tag,                p_ac_status(cursig->rr_status),                incpTime, exprTime);    }#endif#if 0    struct val_rr_rec  *rr;    struct val_rr_rec  *sig = next_as->val_ac_rrset->val_rrset_sig;    for (rr = data; rr; rr = rr->rr_next) {        val_log(ctx, level, "    data_status=%s:%d",//.........这里部分代码省略.........
开发者ID:ajufrancis,项目名称:dnssec-tools,代码行数:101,


示例7: finish

/* * Creates the config file and tells i3 to reload. * */static void finish() {    printf("creating /"%s/".../n", config_path);    if (!(dpy = XOpenDisplay(NULL)))        errx(1, "Could not connect to X11");    FILE *kc_config = fopen(SYSCONFDIR "/i3/config.keycodes", "r");    if (kc_config == NULL)        err(1, "Could not open input file /"%s/"", SYSCONFDIR "/i3/config.keycodes");    FILE *ks_config = fopen(config_path, "w");    if (ks_config == NULL)        err(1, "Could not open output config file /"%s/"", config_path);    free(config_path);    char *line = NULL;    size_t len = 0;#ifndef USE_FGETLN    ssize_t read;#endif    bool head_of_file = true;    /* write a header about auto-generation to the output file */    fputs("# This file has been auto-generated by i3-config-wizard(1)./n", ks_config);    fputs("# It will not be overwritten, so edit it as you like./n", ks_config);    fputs("#/n", ks_config);    fputs("# Should you change your keyboard layout some time, delete/n", ks_config);    fputs("# this file and re-run i3-config-wizard(1)./n", ks_config);    fputs("#/n", ks_config);#ifdef USE_FGETLN    char *buf = NULL;    while ((buf = fgetln(kc_config, &len)) != NULL) {        /* fgetln does not return null-terminated strings */        FREE(line);        sasprintf(&line, "%.*s", len, buf);#else    size_t linecap = 0;    while ((read = getline(&line, &linecap, kc_config)) != -1) {        len = strlen(line);#endif        /* skip the warning block at the beginning of the input file */        if (head_of_file &&            strncmp("# WARNING", line, strlen("# WARNING")) == 0)            continue;        head_of_file = false;        /* Skip leading whitespace */        char *walk = line;        while (isspace(*walk) && walk < (line + len)) {            /* Pre-output the skipped whitespaces to keep proper indentation */            fputc(*walk, ks_config);            walk++;        }        /* Set the modifier the user chose */        if (strncmp(walk, "set $mod ", strlen("set $mod ")) == 0) {            if (modifier == MOD_Mod1)                fputs("set $mod Mod1/n", ks_config);            else                fputs("set $mod Mod4/n", ks_config);            continue;        }        /* Check for 'bindcode'. If it’s not a bindcode line, we         * just copy it to the output file */        if (strncmp(walk, "bindcode", strlen("bindcode")) != 0) {            fputs(walk, ks_config);            continue;        }        char *result = rewrite_binding(walk);        fputs(result, ks_config);        free(result);    }    /* sync to do our best in order to have the file really stored on disk */    fflush(ks_config);    fsync(fileno(ks_config));#ifndef USE_FGETLN    free(line);#endif    fclose(kc_config);    fclose(ks_config);    /* tell i3 to reload the config file */    int sockfd = ipc_connect(socket_path);    ipc_send_message(sockfd, strlen("reload"), 0, (uint8_t *)"reload");    close(sockfd);    exit(0);}int main(int argc, char *argv[]) {//.........这里部分代码省略.........
开发者ID:Fresne,项目名称:i3-1,代码行数:101,


示例8: dres_free_value

/******************** * dres_free_value ********************/voiddres_free_value(dres_value_t *val){    if (val && val->type == DRES_TYPE_STRING)        FREE(val->v.s);}
开发者ID:maemo-foss,项目名称:maemo-multimedia-dres,代码行数:9,


示例9: dres_free_field

/******************** * dres_free_field ********************/voiddres_free_field(dres_field_t *f){    FREE(f->name);    dres_free_value(&f->value);}
开发者ID:maemo-foss,项目名称:maemo-multimedia-dres,代码行数:9,


示例10: eGrep

//.........这里部分代码省略.........					"/n-v, --invert-match/tSelect non-matching lines (uncompatible with -o)/n"					"/n    --help/t/tDisplay this help and exit/n"					"/nOutput control :/n"					"/n-m, --max-count=NUM/tStop searching in a file after NUM matching lines/n"					"/n-b, --byte-offset/tPrint the byte offset for each output lines,/n"					"/t/t/twhen combined with -o print the offset of the match/n"					"/n-n, --line-number/tPrint line number with outuput lines (starts at 1)/n"					"/n-H, --with-filename/tPrint the filename for each match (default when having/n/t/t/tmore than one FILE)/n"					"/n-h, --no-filename/tSuppress the file name prefix on output (default when/n/t/t/thaving only one FILE)/n"					"/n-o, --only-matching/tDisplays only the part of a line matching the pattern,/n"					"/t/t/tin the case of multiple matches per line, displays/n/t/t/tas many lines as matches/n"					"/t/t/tuncompatible with -v, -e and -E/n"					"/n-q, --quiet, --silent/tSuppress all normal output/n"					"/n-R, -r, --recursive/tSearch recursively in each files contained in FILE/n"					"/n--include=GLOB/t/tSearch only files whose base name matches GLOB/n"					"/n--exclude=GLOB/t/tSkip   files  whose  base  name  matches  GLOB/n"					"/n--exclude-dir=DIR/tExclude directories matching  the  pattern  DIR/n/t/t/tfrom  recursive searches/n"					"/n-L, --files-without-match Print only names of FILEs containing no match/n"					"/n-l, --file-with-matches/tPrint only names of FILEs containing matches/n"					"/n-c, --count/t/tprint only a count of matching lines per FILE/n"					"/n-Z, --null/t/tPrint 0 byte after FILE name/n"					"/nSpecial handling : if '-' is given as PATTERN, PATTERN become the standard input"					"/nExit status :/n/n" 					"0 if no results were found/n"					"1 if at least one result was found/n"					"2 if an error was given/n/n"									);		quit = 1;	}	if (!quit && args->options != NULL &&  (*(Options*)args->options->data).name == 'V' && args->files == NULL && args->pattern == NULL)	{		printf( 				"Grep command revised :/n/n"				"version : %d.%d.%d/n/n"				"authors :/n/tBASSET Cyril/n/tLAMBERTI Jean-Vincent/n/tPICARD David/n/n"				,GREP_STATUS,GREP_MAJOR_VERSION,GREP_MINOR_VERSION);		quit = 1;	}	if(!quit && args->pattern == NULL)	{		if(!hasOption('s', args->options) && !hasOption('q', args->options))			printf("Pattern not found./n");		return_val = 2;		quit = 1;	}	if(!quit && (!args->files || !args->pattern))		quit = 1;	if (!quit)	{		if (args->files != NULL)		{			Maillon* lines = NULL;			int file_count = 0;			if(hasOption('r',args->options))			{				Maillon* files = NULL;				Maillon* next = args->files;				while(next != NULL)				{					getFileFrom((char*)next->data,&files,args->options);					next = next->next;				}				lines = nFileLoader(files, hasOption('z',args->options));				file_count = listSize(files);			}			else			{				lines = nFileLoader(args->files, hasOption('z',args->options));				file_count = listSize(args->files);			}			if (lines != NULL)			{				Maillon* results = extractWithPattern(lines, args->pattern, args->options);				if (!hasOption('q', args->options))					displayFileLine(results, file_count, args);				return_val = listSize(results) > 0 ? 0 : 1 ;				//listSize(results)>0?return_val=0:return_val=1;			}		}	}	if (args != NULL)	{		//freeList(&(args->options));		// Do not free pattern!!! It's the argv[i] address		//freeList(&(args->files));		FREE(args);	}	return return_val;}
开发者ID:kinroux,项目名称:grep,代码行数:101,


示例11: main

main(int    argc,     char **argv){char        *pagedir, *pagesubstr, *maskdir, *masksubstr;char        *title, *fileout, *boxaafile, *boxaapath;l_int32      ret, res, type, thresh;l_float32    scalefactor;BOXAA       *baa;static char  mainName[] = "convertsegfilestopdf";    if (argc != 12) {        fprintf(stderr,	    " Syntax: convertsegfilestopdf dirin substr res type thresh // /n"            "                       boxaafile scalefactor title fileout/n"            "     where/n"            "         pagedir:  input directory for image files/n"            "         pagesubstr:  Use 'allfiles' to convert all files/n"            "                  in the directory/n"            "         maskdir:  input directory for mask files;/n"            "                   use 'skip' to skip /n"            "         masksubstr:  Use 'allfiles' to convert all files/n"            "                  in the directory; 'skip' to skip/n"            "         res:  Input resolution of each image;/n"            "               assumed to all be the same/n"            "         type: compression used for non-image regions:/n"            "               0: default (G4 encoding)/n"            "               1: JPEG encoding/n"            "               2: G4 encoding/n"            "               3: PNG encoding/n"            "         thresh:  threshold for binarization; use 0 for default/n"            "         boxaafile: Optional file of 'image' regions within/n"            "                    each page.  This contains a boxa for each/n"            "                    page, consisting of a set of regions./n"            "                    Use 'skip' to skip./n"            "         scalefactor:  Use to scale down the image regions/n"            "         title:  Use 'none' to omit/n"            "         fileout:  Output pdf file/n");        return 1;    }    pagedir = argv[1];    pagesubstr = argv[2];    maskdir = argv[3];    masksubstr = argv[4];    res = atoi(argv[5]);    type = atoi(argv[6]);    thresh = atoi(argv[7]);    boxaafile = argv[8];    scalefactor = atof(argv[9]);    title = argv[10];    fileout = argv[11];    if (!strcmp(pagesubstr, "allfiles"))        pagesubstr = NULL;    if (!strcmp(maskdir, "skip"))        maskdir = NULL;    if (!strcmp(masksubstr, "allfiles"))        masksubstr = NULL;    if (scalefactor <= 0.0 || scalefactor > 1.0) {        L_WARNING("invalid scalefactor: setting to 1.0", mainName);        scalefactor = 1.0;    }    if (type != 1 && type != 2 && type != 3)        type = L_G4_ENCODE;    if (thresh <= 0)        thresh = 150;    if (!strcmp(title, "none"))        title = NULL;    if (maskdir)  /* use this; ignore any input boxaafile */        baa = convertNumberedMasksToBoxaa(maskdir, masksubstr, 0, 0);    else if (strcmp(boxaafile, "skip")) {  /* use the boxaafile */        boxaapath = genPathname(boxaafile, NULL);        baa = boxaaRead(boxaapath);        FREE(boxaapath);    }     else  /* no maskdir and no input boxaafile */        baa = NULL;    ret = convertSegmentedFilesToPdf(pagedir, pagesubstr, res, type, thresh,                                     baa, 75, scalefactor, title, fileout);    boxaaDestroy(&baa);    return ret;}
开发者ID:ErfanHasmin,项目名称:scope-ocr,代码行数:84,


示例12: llvm_pipeline_generic

static voidllvm_pipeline_generic( struct draw_pt_middle_end *middle,                       const struct draw_fetch_info *fetch_info,                       const struct draw_prim_info *in_prim_info ){   struct llvm_middle_end *fpme = (struct llvm_middle_end *)middle;   struct draw_context *draw = fpme->draw;   struct draw_geometry_shader *gshader = draw->gs.geometry_shader;   struct draw_prim_info gs_prim_info;   struct draw_vertex_info llvm_vert_info;   struct draw_vertex_info gs_vert_info;   struct draw_vertex_info *vert_info;   struct draw_prim_info ia_prim_info;   struct draw_vertex_info ia_vert_info;   const struct draw_prim_info *prim_info = in_prim_info;   boolean free_prim_info = FALSE;   unsigned opt = fpme->opt;   unsigned clipped = 0;   llvm_vert_info.count = fetch_info->count;   llvm_vert_info.vertex_size = fpme->vertex_size;   llvm_vert_info.stride = fpme->vertex_size;   llvm_vert_info.verts =      (struct vertex_header *)MALLOC(fpme->vertex_size *                                     align(fetch_info->count,  lp_native_vector_width / 32));   if (!llvm_vert_info.verts) {      assert(0);      return;   }   if (draw->collect_statistics) {      draw->statistics.ia_vertices += fetch_info->count;      draw->statistics.ia_primitives +=         u_decomposed_prims_for_vertices(prim_info->prim, prim_info->count);      draw->statistics.vs_invocations += fetch_info->count;   }   if (fetch_info->linear)      clipped = fpme->current_variant->jit_func( &fpme->llvm->jit_context,                                       llvm_vert_info.verts,                                       (const char **)draw->pt.user.vbuffer,                                       fetch_info->start,                                       fetch_info->count,                                       fpme->vertex_size,                                       draw->pt.vertex_buffer,                                       draw->instance_id);   else      clipped = fpme->current_variant->jit_func_elts( &fpme->llvm->jit_context,                                            llvm_vert_info.verts,                                            (const char **)draw->pt.user.vbuffer,                                            fetch_info->elts,                                            fetch_info->count,                                            fpme->vertex_size,                                            draw->pt.vertex_buffer,                                            draw->instance_id);   /* Finished with fetch and vs:    */   fetch_info = NULL;   vert_info = &llvm_vert_info;   if ((opt & PT_SHADE) && gshader) {      struct draw_vertex_shader *vshader = draw->vs.vertex_shader;      draw_geometry_shader_run(gshader,                               draw->pt.user.gs_constants,                               draw->pt.user.gs_constants_size,                               vert_info,                               prim_info,                               &vshader->info,                               &gs_vert_info,                               &gs_prim_info);      FREE(vert_info->verts);      vert_info = &gs_vert_info;      prim_info = &gs_prim_info;   } else {      if (draw_prim_assembler_is_required(draw, prim_info, vert_info)) {         draw_prim_assembler_run(draw, prim_info, vert_info,                                 &ia_prim_info, &ia_vert_info);         if (ia_vert_info.count) {            FREE(vert_info->verts);            vert_info = &ia_vert_info;            prim_info = &ia_prim_info;            free_prim_info = TRUE;         }      }   }   /* stream output needs to be done before clipping */   draw_pt_so_emit( fpme->so_emit, vert_info, prim_info );   /*    * if there's no position, need to stop now, or the latter stages    * will try to access non-existent position output.    */   if (draw_current_shader_position_output(draw) != -1) {      if ((opt & PT_SHADE) && gshader) {         clipped = draw_pt_post_vs_run( fpme->post_vs, vert_info );//.........这里部分代码省略.........
开发者ID:mthuurne,项目名称:mesa,代码行数:101,


示例13: render_destroy

static void render_destroy( struct draw_stage *stage ){   FREE( stage );}
开发者ID:Bluerise,项目名称:bitrig-xenocara,代码行数:4,


示例14: ALLOC

/* * NAME:	hfs->create() * DESCRIPTION:	create and open a new file */hfsfile *hfs_create(hfsvol *vol, const char *path,		    const char *type, const char *creator){  hfsfile *file = 0;  unsigned long parid;  char name[HFS_MAX_FLEN + 1];  CatKeyRec key;  byte record[HFS_MAX_CATRECLEN];  unsigned reclen;  int found;  if (getvol(&vol) == -1)    goto fail;  file = ALLOC(hfsfile, 1);  if (file == 0)    ERROR(ENOMEM, 0);  found = v_resolve(&vol, path, &file->cat, &parid, name, 0);  if (found == -1 || parid == 0)    goto fail;  if (found)    ERROR(EEXIST, 0);  if (parid == HFS_CNID_ROOTPAR)    ERROR(EINVAL, 0);  if (vol->flags & HFS_VOL_READONLY)    ERROR(EROFS, 0);  /* create file `name' in parent `parid' */  if (bt_space(&vol->cat, 1) == -1)    goto fail;  f_init(file, vol, vol->mdb.drNxtCNID++, name);  vol->flags |= HFS_VOL_UPDATE_MDB;  file->parid = parid;  /* create catalog record */  file->cat.u.fil.filUsrWds.fdType =    d_getsl((const unsigned char *) type);  file->cat.u.fil.filUsrWds.fdCreator =    d_getsl((const unsigned char *) creator);  file->cat.u.fil.filCrDat = d_mtime(time(0));  file->cat.u.fil.filMdDat = file->cat.u.fil.filCrDat;  r_makecatkey(&key, file->parid, file->name);  r_packcatrec(&key, &file->cat, record, &reclen);  if (bt_insert(&vol->cat, record, reclen) == -1 ||      v_adjvalence(vol, file->parid, 0, 1) == -1)    goto fail;  /* package file handle for user */  file->next = vol->files;  file->refs = 1;  if (vol->files)    vol->files->prev = file;  vol->files = file;  return file;fail:  FREE(file);  return 0;}
开发者ID:andyvand,项目名称:fusehfs,代码行数:77,


示例15: import_heap_image

//.........这里部分代码省略.........    if (params->oldest_agegroup_keeping_idle_fromspace_buffers < 0) {        params->oldest_agegroup_keeping_idle_fromspace_buffers = heap_header.oldest_agegroup_keeping_idle_fromspace_buffers;    }     task = make_task( FALSE, params );						// make_task		def in   src/c/main/runtime-state.c    // Get the run-time pointers into the heap:    //    *PTR_CAST( Val*, PERVASIVE_PACKAGE_PICKLE_LIST_REFCELL__GLOBAL )        =        heap_header.pervasive_package_pickle_list;    // This carefully constructed fake looks like a normal    // compiled package from the Mythryl side but actually    // links to compile C code -- see the hack in    //	    //     src/c/main/load-compiledfiles.c    //    runtime_package__global =  heap_header.runtime_pseudopackage;    #ifdef ASM_MATH	mathvec__global = heap_header.math_package;    #endif    externs = heapio__read_externs_table (&inbuf);		// Read the externals table.    READ(&inbuf, image);				// Read and initialize the Mythryl state info.    //    if (image_header.kind == EXPORT_HEAP_IMAGE) {        // Load the live registers:        //	ASSIGN( POSIX_INTERPROCESS_SIGNAL_HANDLER_REFCELL__GLOBAL, image.posix_interprocess_signal_handler );	//	task->argument		= image.stdArg;	task->fate		= image.stdCont;	task->current_closure	= image.stdClos;	task->program_counter	= image.pc;	task->exception_fate	= image.exception_fate;	task->current_thread	= image.current_thread;	//	task->callee_saved_registers[0]	= image.calleeSave[0];	task->callee_saved_registers[1]	= image.calleeSave[1];	task->callee_saved_registers[2]	= image.calleeSave[2];	read_heap (&inbuf, &heap_header, task, externs);			// Read the Mythryl heap.	/* cleaner_messages_are_enabled__global = TRUE; */					// Cleaning messages are on by default for interactive images.    } else { 								// EXPORT_FN_IMAGE        Val function_to_run;	Val program_name;	Val args;        // Restore the signal handler:        //	ASSIGN( POSIX_INTERPROCESS_SIGNAL_HANDLER_REFCELL__GLOBAL, image.posix_interprocess_signal_handler );        // Read the Mythryl heap:        //	task->argument		= image.stdArg;	read_heap (&inbuf, &heap_header, task, externs);        // Initialize the calling context (taken from run_mythryl_function):					// run_mythryl_function		def in   src/c/main/run-mythryl-code-and-runtime-eventloop.c        //	function_to_run		= task->argument;	//	task->exception_fate	= PTR_CAST( Val,  handle_uncaught_exception_closure_v + 1 );	task->current_thread	= HEAP_VOID;	//	task->fate		= PTR_CAST( Val,  return_to_c_level_c );	task->current_closure	= function_to_run;	//	task->program_counter	=	task->link_register	= GET_CODE_ADDRESS_FROM_CLOSURE( function_to_run );        // Set up the arguments to the imported function:        //	program_name = make_ascii_string_from_c_string(task, mythryl_program_name__global);	args = make_ascii_strings_from_vector_of_c_strings (task, commandline_arguments);	REC_ALLOC2(task, task->argument, program_name, args);	// debug_say("arg = %#x : [%#x, %#x]/n", task->argument, GET_TUPLE_SLOT_AS_VAL(task->argument, 0), GET_TUPLE_SLOT_AS_VAL(task->argument, 1));        // Cleaner messages are off by        // default for spawn_to_disk images:        //	cleaner_messages_are_enabled__global =  FALSE;    }    FREE( externs );    if (inbuf.file)   fclose (inbuf.file);    if (verbosity > 0)   say(" done/n");    return task;}								// fun import_heap_image
开发者ID:spiralofhope,项目名称:mythryl,代码行数:101,


示例16: calculate_visibility

/** * calculate_visibility - Are tree nodes visible * @param ctx       Mailbox * @param max_depth Maximum depth to check * * this calculates whether a node is the root of a subtree that has visible * nodes, whether a node itself is visible, whether, if invisible, it has * depth anyway, and whether any of its later siblings are roots of visible * subtrees.  while it's at it, it frees the old thread display, so we can * skip parts of the tree in mutt_draw_tree() if we've decided here that we * don't care about them any more. */static void calculate_visibility(struct Context *ctx, int *max_depth){  struct MuttThread *tmp = NULL, *tree = ctx->tree;  int hide_top_missing = C_HideTopMissing && !C_HideMissing;  int hide_top_limited = C_HideTopLimited && !C_HideLimited;  int depth = 0;  /* we walk each level backwards to make it easier to compute next_subtree_visible */  while (tree->next)    tree = tree->next;  *max_depth = 0;  while (true)  {    if (depth > *max_depth)      *max_depth = depth;    tree->subtree_visible = 0;    if (tree->message)    {      FREE(&tree->message->tree);      if (is_visible(tree->message, ctx))      {        tree->deep = true;        tree->visible = true;        tree->message->display_subject = need_display_subject(ctx, tree->message);        for (tmp = tree; tmp; tmp = tmp->parent)        {          if (tmp->subtree_visible)          {            tmp->deep = true;            tmp->subtree_visible = 2;            break;          }          else            tmp->subtree_visible = 1;        }      }      else      {        tree->visible = false;        tree->deep = !C_HideLimited;      }    }    else    {      tree->visible = false;      tree->deep = !C_HideMissing;    }    tree->next_subtree_visible =        tree->next && (tree->next->next_subtree_visible || tree->next->subtree_visible);    if (tree->child)    {      depth++;      tree = tree->child;      while (tree->next)        tree = tree->next;    }    else if (tree->prev)      tree = tree->prev;    else    {      while (tree && !tree->prev)      {        depth--;        tree = tree->parent;      }      if (!tree)        break;      else        tree = tree->prev;    }  }  /* now fix up for the OPTHIDETOP* options if necessary */  if (hide_top_limited || hide_top_missing)  {    tree = ctx->tree;    while (true)    {      if (!tree->visible && tree->deep && (tree->subtree_visible < 2) &&          ((tree->message && hide_top_limited) || (!tree->message && hide_top_missing)))      {        tree->deep = false;      }      if (!tree->deep && tree->child && tree->subtree_visible)        tree = tree->child;      else if (tree->next)//.........这里部分代码省略.........
开发者ID:kdave,项目名称:neomutt,代码行数:101,


示例17: load_file_banded_imp

static void load_file_banded_imp(const char *file, const char *band,                                 int reset_location, int multilook){    char *old_file = NULL;    if (curr->filename) {      old_file = STRDUP(curr->filename);      free(curr->filename);      curr->filename = NULL;    }    reset_globals(reset_location);    asfPrintStatus("/nLoading: %s/n", file);    // start loading of the new file    curr->filename = STRDUP(file);    // strip off a trailing "."    if (curr->filename[strlen(curr->filename)-1] == '.')        curr->filename[strlen(curr->filename)-1] = '/0';    // Determine if the current file is a new file    static char *last_file = NULL;    int new_file = 0;    if (!last_file) last_file = STRDUP(curr->filename);    if (last_file && strcmp(last_file, curr->filename) != 0) {      new_file = 1;      FREE(last_file);      last_file = STRDUP(curr->filename);    }    if (read_file(curr->filename, band, multilook, FALSE)) {      int dummy;      char lut[256];      static int tiff_lut_exists = 0;      static int asf_colormap_exists = 0;      char embedded_tiff_lut_file[1024];      char embedded_asf_colormap_file[1024];      char *lut_loc = (char *)MALLOC(sizeof(char)*(strlen(get_asf_share_dir())+128));      sprintf(lut_loc, "%s%clook_up_tables", get_asf_share_dir(), DIR_SEPARATOR);      sprintf(embedded_tiff_lut_file,"%s%c%s", lut_loc, DIR_SEPARATOR,              EMBEDDED_TIFF_COLORMAP_LUT_FILE);      sprintf(embedded_asf_colormap_file, "%s%c%s", lut_loc, DIR_SEPARATOR,              EMBEDDED_ASF_COLORMAP_LUT_FILE);      FREE(lut_loc);      tiff_lut_exists      = new_file ? 0 : tiff_lut_exists;      asf_colormap_exists  = new_file ? 0 : asf_colormap_exists;      tiff_lut_exists     += fileExists(embedded_tiff_lut_file)     ? 1 : 0;      asf_colormap_exists += fileExists(embedded_asf_colormap_file) ? 1 : 0;      GtkWidget *om = get_widget_checked("lut_optionmenu");      int idx = gtk_option_menu_get_history(GTK_OPTION_MENU(om));      if (tiff_lut_exists <= 1 &&          check_for_embedded_tiff_lut(curr->filename, &dummy, lut))      {        // On first read of a TIFF file, check for embedded colormap and turn it into a        // look up table if it exists ...then select it        // (Run this stuff ONCE ...else the embedded lut will keep getting selected, even if changed)        if (fileExists(embedded_asf_colormap_file)) {          remove(embedded_asf_colormap_file);          asf_colormap_exists = 0;        }        if (get_tiff_lut_index() == 0) {            populate_lut_combo();            GtkWidget *option_menu = get_widget_checked("lut_optionmenu");            gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), get_tiff_lut_index());            set_current_index(get_tiff_lut_index());            select_lut(lut);        }        else {            set_current_index(idx);        }      }      else if (tiff_lut_exists &&               !check_for_embedded_tiff_lut(curr->filename, &dummy, lut))      {        // If a tiff colormap look up table exists, but the current file being        // read is not a color map tiff, then delete the existing tiff color map        // look up table        remove(embedded_tiff_lut_file);        tiff_lut_exists = 0;        populate_lut_combo(); // Re-populate since tiff colormap lut was removed        GtkWidget *option_menu = get_widget_checked("lut_optionmenu");        gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), 0); // Default to None        set_current_index(0);      }      if (asf_colormap_exists <= 1 && is_colormap_ASF_file(curr->filename)) {        // On first read of an ASF file, check for a colormap and turn it into a        // look up table if it exists ...then select it        // (Run this stuff ONCE ...else the embedded lut will keep getting selected, even if changed)        if (fileExists(embedded_tiff_lut_file)) {          remove(embedded_tiff_lut_file);          tiff_lut_exists = 0;        }        if (get_asf_lut_index() == 0) {            populate_lut_combo();            select_lut(EMBEDDED_ASF_COLORMAP_LUT);            GtkWidget *option_menu = get_widget_checked("lut_optionmenu");            gtk_option_menu_set_history(GTK_OPTION_MENU(option_menu), get_asf_lut_index());//.........这里部分代码省略.........
开发者ID:asfadmin,项目名称:ASF_MapReady,代码行数:101,


示例18: mutt_draw_tree

//.........这里部分代码省略.........  pfx = mutt_mem_malloc(width * max_depth + 2);  arrow = mutt_mem_malloc(width * max_depth + 2);  while (tree)  {    if (depth)    {      myarrow = arrow + (depth - start_depth - (start_depth ? 0 : 1)) * width;      if (depth && (start_depth == depth))        myarrow[0] = nextdisp ? MUTT_TREE_LTEE : corner;      else if (parent->message && !C_HideLimited)        myarrow[0] = MUTT_TREE_HIDDEN;      else if (!parent->message && !C_HideMissing)        myarrow[0] = MUTT_TREE_MISSING;      else        myarrow[0] = vtee;      if (width == 2)      {        myarrow[1] = pseudo ? MUTT_TREE_STAR :                              (tree->duplicate_thread ? MUTT_TREE_EQUALS : MUTT_TREE_HLINE);      }      if (tree->visible)      {        myarrow[width] = MUTT_TREE_RARROW;        myarrow[width + 1] = 0;        new_tree = mutt_mem_malloc((2 + depth * width));        if (start_depth > 1)        {          strncpy(new_tree, pfx, (start_depth - 1) * width);          mutt_str_strfcpy(new_tree + (start_depth - 1) * width, arrow,                           (1 + depth - start_depth) * width + 2);        }        else          mutt_str_strfcpy(new_tree, arrow, 2 + depth * width);        tree->message->tree = new_tree;      }    }    if (tree->child && depth)    {      mypfx = pfx + (depth - 1) * width;      mypfx[0] = nextdisp ? MUTT_TREE_VLINE : MUTT_TREE_SPACE;      if (width == 2)        mypfx[1] = MUTT_TREE_SPACE;    }    parent = tree;    nextdisp = NULL;    pseudo = NULL;    do    {      if (tree->child && tree->subtree_visible)      {        if (tree->deep)          depth++;        if (tree->visible)          start_depth = depth;        tree = tree->child;        /* we do this here because we need to make sure that the first child thread         * of the old tree that we deal with is actually displayed if any are,         * or we might set the parent variable wrong while going through it. */        while (!tree->subtree_visible && tree->next)          tree = tree->next;      }      else      {        while (!tree->next && tree->parent)        {          if (tree == pseudo)            pseudo = NULL;          if (tree == nextdisp)            nextdisp = NULL;          if (tree->visible)            start_depth = depth;          tree = tree->parent;          if (tree->deep)          {            if (start_depth == depth)              start_depth--;            depth--;          }        }        if (tree == pseudo)          pseudo = NULL;        if (tree == nextdisp)          nextdisp = NULL;        if (tree->visible)          start_depth = depth;        tree = tree->next;        if (!tree)          break;      }      if (!pseudo && tree->fake_thread)        pseudo = tree;      if (!nextdisp && tree->next_subtree_visible)        nextdisp = tree;    } while (!tree->deep);  }  FREE(&pfx);  FREE(&arrow);}
开发者ID:kdave,项目名称:neomutt,代码行数:101,


示例19: StoreObject

/****************************************************************************** Store data for addin object.  Returns handle (NULL if error).****************************************************************************/char* StoreObject(char* name, void* data){    static char *routine = "StoreObject";    int          status = FAILURE;    char        *handle = NULL;    TObject     *node;    static char buffer[255];    if (data == NULL)    {        JpmcdsErrMsg("%s: No data to store provided./n", routine);        goto done;    }    if (name == NULL)    {        JpmcdsErrMsg("%s: No object name provided./n", routine);        goto done;    }    if (strlen(name) > 200)    {        JpmcdsErrMsg("%s: Object name cannot exceed 200 characters./n", routine);        goto done;    }    node = FindNode(name);    if (node == NULL)    {        node = NEW(TObject);        if (node == NULL)            goto done;        node->name = strdup(name);        node->version = 1;        node->data = data;        node->next = cache;        cache = node;    }    else    {        node->version += 1;        JpmcdsFreeTCurve((TCurve*)(node->data));        node->data = data;    }    sprintf(buffer, "%s%c%d/0", node->name, SEPARATOR, node->version);    handle = strdup(buffer);    if (handle == NULL)        goto done;    strcpy(handle, buffer);    status = SUCCESS;    done:    if (status != SUCCESS)    {        JpmcdsErrMsg("%s: Failed!/n", routine);        FREE(handle);        handle = NULL;    }    return handle;}
开发者ID:arthurpham,项目名称:CdsModel,代码行数:70,


示例20: fse_destroy

static voidfse_destroy(struct draw_pt_middle_end *middle){   FREE(middle);}
开发者ID:ChristophHaag,项目名称:mesa-mesa,代码行数:5,


示例21: free_derives

voidfree_derives(){  FREE(derives[ntokens]);  FREE(derives + ntokens);}
开发者ID:BozzieBear,项目名称:flexpp-bisonpp,代码行数:6,


示例22: lp_scene_end_rasterization

/** * Free all the temporary data in a scene. */voidlp_scene_end_rasterization(struct lp_scene *scene ){   int i, j;   /* Unmap color buffers */   for (i = 0; i < scene->fb.nr_cbufs; i++) {      if (scene->cbufs[i].map) {         struct pipe_surface *cbuf = scene->fb.cbufs[i];         if (llvmpipe_resource_is_texture(cbuf->texture)) {            llvmpipe_resource_unmap(cbuf->texture,                                    cbuf->u.tex.level,                                    cbuf->u.tex.first_layer);         }         scene->cbufs[i].map = NULL;      }   }   /* Unmap z/stencil buffer */   if (scene->zsbuf.map) {      struct pipe_surface *zsbuf = scene->fb.zsbuf;      llvmpipe_resource_unmap(zsbuf->texture,                              zsbuf->u.tex.level,                              zsbuf->u.tex.first_layer);      scene->zsbuf.map = NULL;   }   /* Reset all command lists:    */   for (i = 0; i < scene->tiles_x; i++) {      for (j = 0; j < scene->tiles_y; j++) {         struct cmd_bin *bin = lp_scene_get_bin(scene, i, j);         bin->head = NULL;         bin->tail = NULL;         bin->last_state = NULL;      }   }   /* If there are any bins which weren't cleared by the loop above,    * they will be caught (on debug builds at least) by this assert:    */   assert(lp_scene_is_empty(scene));   /* Decrement texture ref counts    */   {      struct resource_ref *ref;      int i, j = 0;      for (ref = scene->resources; ref; ref = ref->next) {         for (i = 0; i < ref->count; i++) {            if (LP_DEBUG & DEBUG_SETUP)               debug_printf("resource %d: %p %dx%d sz %d/n",                            j,                            (void *) ref->resource[i],                            ref->resource[i]->width0,                            ref->resource[i]->height0,                            llvmpipe_resource_size(ref->resource[i]));            j++;            pipe_resource_reference(&ref->resource[i], NULL);         }      }      if (LP_DEBUG & DEBUG_SETUP)         debug_printf("scene %d resources, sz %d/n",                      j, scene->resource_reference_size);   }   /* Free all scene data blocks:    */   {      struct data_block_list *list = &scene->data;      struct data_block *block, *tmp;      for (block = list->head->next; block; block = tmp) {         tmp = block->next;	 FREE(block);      }      list->head->next = NULL;      list->head->used = 0;   }   lp_fence_reference(&scene->fence, NULL);   scene->resources = NULL;   scene->scene_size = 0;   scene->resource_reference_size = 0;   scene->has_depthstencil_clear = FALSE;   scene->alloc_failed = FALSE;   util_unreference_framebuffer_state( &scene->fb );}
开发者ID:ilyesgouta,项目名称:mesa,代码行数:97,


示例23: StringBuffer_free

void StringBuffer_free(T *S) {        assert(S && *S);	FREE((*S)->buffer);        FREE(*S);}
开发者ID:aipoyun,项目名称:libzdb,代码行数:5,


示例24: cbitDel

// Efface un champ de bitsvoid cbitDel(CBit s){	FREE(s);}
开发者ID:aquirin,项目名称:pathfinder,代码行数:5,


示例25: krb5_rc_dfl_expunge_locked

static krb5_error_codekrb5_rc_dfl_expunge_locked(krb5_context context, krb5_rcache id){    struct dfl_data *t = (struct dfl_data *)id->data;#ifdef NOIOSTUFF    int i;    struct authlist **q;    struct authlist **qt;    struct authlist *r;    struct authlist *rt;    krb5_int32 now;    if (krb5_timestamp(context, &now))	now = 0;    for (q = &t->a; *q; q = qt) {	qt = &(*q)->na;	if (alive(now, &(*q)->rep, t->lifespan) == CMP_EXPIRED) {	    FREE((*q)->rep.client);	    FREE((*q)->rep.server);	    FREE(*q);	    *q = *qt; /* why doesn't this feel right? */	}    }    for (i = 0; i < t->hsize; i++)	t->h[i] = (struct authlist *) 0;    for (r = t->a; r; r = r->na) {	i = hash(&r->rep, t->hsize);	rt = t->h[i];	t->h[i] = r;	r->nh = rt;    }    return 0;#else    struct authlist *q;    char *name;    krb5_error_code retval = 0;    krb5_rcache tmp;    krb5_deltat lifespan = t->lifespan;  /* save original lifespan */    if (! t->recovering) {	name = t->name;	t->name = 0;		/* Clear name so it isn't freed */	(void) krb5_rc_dfl_close_no_free(context, id);	retval = krb5_rc_dfl_resolve(context, id, name);	free(name);	if (retval)	    return retval;	retval = krb5_rc_dfl_recover_locked(context, id);	if (retval)	    return retval;	t = (struct dfl_data *)id->data; /* point to recovered cache */    }    tmp = (krb5_rcache) malloc(sizeof(*tmp));    if (!tmp)	return ENOMEM;    retval = krb5_rc_resolve_type(context, &tmp, "dfl");    if (retval) {        free(tmp);        return retval;    }    retval = krb5_rc_resolve(context, tmp, 0);    if (retval)        goto cleanup;    retval = krb5_rc_initialize(context, tmp, lifespan);    if (retval)        goto cleanup;    for (q = t->a; q; q = q->na) {	if (krb5_rc_io_store(context, (struct dfl_data *)tmp->data, &q->rep)) {            retval = KRB5_RC_IO;            goto cleanup;        }    }    /* NOTE: We set retval in case we have an error */    retval = KRB5_RC_IO;    if (krb5_rc_io_sync(context, &((struct dfl_data *)tmp->data)->d))        goto cleanup;    if (krb5_rc_io_sync(context, &t->d))        goto cleanup;    if (krb5_rc_io_move(context, &t->d, &((struct dfl_data *)tmp->data)->d))        goto cleanup;    retval = 0; cleanup:    (void) krb5_rc_dfl_close(context, tmp);    return retval;#endif}
开发者ID:aosm,项目名称:Kerberos,代码行数:88,


示例26: XMesaCreateVisual

//.........这里部分代码省略.........   v->screen = visinfo->screen;#if !(defined(__cplusplus) || defined(c_plusplus))   v->visualType = xmesa_convert_from_x_visual_type(visinfo->class);#else   v->visualType = xmesa_convert_from_x_visual_type(visinfo->c_class);#endif   v->mesa_visual.visualRating = visualCaveat;   if (alpha_flag)      v->mesa_visual.alphaBits = 8;   (void) initialize_visual_and_buffer( v, NULL, rgb_flag, 0, 0 );   {      const int xclass = v->visualType;      if (xclass == GLX_TRUE_COLOR || xclass == GLX_DIRECT_COLOR) {         red_bits   = _mesa_bitcount(GET_REDMASK(v));         green_bits = _mesa_bitcount(GET_GREENMASK(v));         blue_bits  = _mesa_bitcount(GET_BLUEMASK(v));      }      else {         /* this is an approximation */         int depth;         depth = v->visinfo->depth;         red_bits = depth / 3;         depth -= red_bits;         green_bits = depth / 2;         depth -= green_bits;         blue_bits = depth;         alpha_bits = 0;         assert( red_bits + green_bits + blue_bits == v->visinfo->depth );      }      alpha_bits = v->mesa_visual.alphaBits;   }   /* initialize visual */   {      struct gl_config *vis = &v->mesa_visual;      vis->rgbMode          = GL_TRUE;      vis->doubleBufferMode = db_flag;      vis->stereoMode       = stereo_flag;      vis->redBits          = red_bits;      vis->greenBits        = green_bits;      vis->blueBits         = blue_bits;      vis->alphaBits        = alpha_bits;      vis->rgbBits          = red_bits + green_bits + blue_bits;      vis->indexBits      = 0;      vis->depthBits      = depth_size;      vis->stencilBits    = stencil_size;      vis->accumRedBits   = accum_red_size;      vis->accumGreenBits = accum_green_size;      vis->accumBlueBits  = accum_blue_size;      vis->accumAlphaBits = accum_alpha_size;      vis->haveAccumBuffer   = accum_red_size > 0;      vis->haveDepthBuffer   = depth_size > 0;      vis->haveStencilBuffer = stencil_size > 0;      vis->numAuxBuffers = 0;      vis->level = 0;      vis->sampleBuffers = 0;      vis->samples = 0;   }   v->stvis.buffer_mask = ST_ATTACHMENT_FRONT_LEFT_MASK;   if (db_flag)      v->stvis.buffer_mask |= ST_ATTACHMENT_BACK_LEFT_MASK;   if (stereo_flag) {      v->stvis.buffer_mask |= ST_ATTACHMENT_FRONT_RIGHT_MASK;      if (db_flag)         v->stvis.buffer_mask |= ST_ATTACHMENT_BACK_RIGHT_MASK;   }   v->stvis.color_format = choose_pixel_format(v);   if (v->stvis.color_format == PIPE_FORMAT_NONE) {      FREE(v->visinfo);      FREE(v);      return NULL;   }   v->stvis.depth_stencil_format =      choose_depth_stencil_format(xmdpy, depth_size, stencil_size);   v->stvis.accum_format = (accum_red_size +         accum_green_size + accum_blue_size + accum_alpha_size) ?      PIPE_FORMAT_R16G16B16A16_SNORM : PIPE_FORMAT_NONE;   v->stvis.samples = num_samples;   v->stvis.render_buffer = ST_ATTACHMENT_INVALID;   /* XXX minor hack */   v->mesa_visual.level = level;   return v;}
开发者ID:GunioRobot,项目名称:mesa-7.10.2-PS3,代码行数:101,


示例27: initgrph

void initgrph(int showtitle) {    int i;    FILE *f;    char *pigname;    struct ws_event ws;    struct ws_bitmap *cursor;    inittimer();   #if defined (GNU_C) && defined (GO32)        if ( showtitle &&            ws_initgrfx(640, 480, 256, init.fontname) && titlescreen() ) {            ws_getevent(&ws, 1);        }        ws_textmode();   #endif    if ( !w_initwins(init.xres, init.yres, 256, init.fontname) ) {        printf(TXT_CANTINITWINS);        my_exit();    }    if ( ( f = fopen(init.menuname, "r") ) == NULL ) {        fprintf(errf, TXT_NOMENUFILE, init.menuname);        my_exit();    }    my_assert( w_initmenu(f, do_event, ec_num_of_codes) );    fclose(f);    pigname = pig.current_pigname;    pig.current_pigname = NULL;    newpigfile(pigname, NULL);    FREE(pigname);    /* draw the cursors (init the cursor data) */    cntrlcursor_ysize = altcursor_ysize = w_titlebarheight();    cntrlcursor_xsize = (ws_pixstrlen(TXT_TAG) + 2 + 3) / 4 * 4;    altcursor_xsize = (ws_pixstrlen(TXT_INFO) + 2 + 3) / 4 * 4;    cursor = ws_createbitmap(cntrlcursor_xsize, cntrlcursor_ysize,                             control_cursor);    ws_bmdrawtext(cursor, 1, 0, cntrlcursor_xsize, TXT_TAG, 1, 0);    ws_freebitmap(cursor);    cursor = ws_createbitmap(altcursor_xsize, altcursor_ysize, alt_cursor);    ws_bmdrawtext(cursor, 1, 0, altcursor_xsize, TXT_INFO, 1, 0);    ws_freebitmap(cursor);    cursor_initialized = 1;    checkmem( pig.txt_buffer = MALLOC(64 * 64) );    memset(pig.txt_buffer, 0, 64 * 64);    pig.txt_bm = ws_createbitmap(64, 64, pig.txt_buffer);    checkmem( pig.door_buffer = MALLOC(64 * 64) );    memset(pig.door_buffer, 0, 64 * 64);    pig.door_bm = ws_createbitmap(64, 64, pig.door_buffer);    checkmem( pig.thing_buffer = MALLOC(64 * 64) );    memset(pig.thing_buffer, 0, 64 * 64);    pig.thing_bm = ws_createbitmap(64, 64, pig.thing_buffer);    button_win.xpos = w_xmaxwinsize() - button_win.xsize - 10;    button_win.ypos = w_ymaxwinsize() - button_win.ysize - 10;    if (init.d_ver >= d2_10_reg) {        button_win.ypos -= 20;        button_win.ysize += 20;        if (init.d_ver >= d2_12_reg) {            button_win.ypos -= 16;        }        button_win.ysize += 16;    }    checkmem( view.movewindow = w_openwindow(&button_win) );    drawallbuttons(view.movewindow);    for (i = 0; i <= in_internal; i++) {        makeoptwindow(i);    }    init_txtgrfx();    read_lightsources();}
开发者ID:j13s,项目名称:devil,代码行数:80,


示例28: read_heap

static void   read_heap   (    //        =========    //    Inbuf*       bp,    Heap_Header* header,    Task*        task,    Val*         externs){    Heap*		heap =  task->heap;    Sib_Header*	sib_headers;    Sib_Header*	p;    Sib_Header*	q;    int			sib_headers_bytesize;    int			i, j, k;    long		prevSzB[MAX_PLAIN_ILKS], size;    Sibid*		oldBOOK2SIBID;    Punt		addrOffset[MAX_AGEGROUPS][MAX_PLAIN_ILKS];    Hugechunk_Region_Relocation_Info*	boRelocInfo;    Addresstable*	boRegionTable;    // Allocate a book_to_sibid__global for the imported    // heap image's address space:    //    #ifdef TWO_LEVEL_MAP        #error two level map not supported    #else	oldBOOK2SIBID = MALLOC_VEC (Sibid, BOOK2SIBID_TABLE_SIZE_IN_SLOTS);    #endif    // Read in the hugechunk region descriptors    // for the old address space:    //    {	int		  size;	Hugechunk_Region_Header* boRgnHdr;	boRegionTable = make_address_hashtable(LOG2_BOOK_BYTESIZE+1, header->hugechunk_ramregion_count);	size = header->hugechunk_ramregion_count * sizeof(Hugechunk_Region_Header);	boRgnHdr = (Hugechunk_Region_Header*) MALLOC (size);	heapio__read_block( bp, boRgnHdr, size );	boRelocInfo = MALLOC_VEC(Hugechunk_Region_Relocation_Info, header->hugechunk_ramregion_count);	for (i = 0;  i < header->hugechunk_ramregion_count;  i++) {	    set_book2sibid_entries_for_range(oldBOOK2SIBID,		(Val*)(boRgnHdr[i].base_address),		BOOKROUNDED_BYTESIZE(boRgnHdr[i].bytesize),		HUGECHUNK_DATA_SIBID(1)            );	    oldBOOK2SIBID[GET_BOOK_CONTAINING_POINTEE(boRgnHdr[i].base_address)] = HUGECHUNK_RECORD_SIBID(MAX_AGEGROUPS);	    boRelocInfo[i].first_ram_quantum = boRgnHdr[i].first_ram_quantum;	    boRelocInfo[i].page_count                =                (boRgnHdr[i].bytesize - (boRgnHdr[i].first_ram_quantum - boRgnHdr[i].base_address))                >>                LOG2_HUGECHUNK_RAM_QUANTUM_IN_BYTES;	    boRelocInfo[i].hugechunk_page_to_hugechunk = MALLOC_VEC(Hugechunk_Relocation_Info*, boRelocInfo[i].page_count);	    for (j = 0;  j < boRelocInfo[i].page_count;  j++) {	        //		boRelocInfo[i].hugechunk_page_to_hugechunk[j] = NULL;            } 	    addresstable_insert (boRegionTable, boRgnHdr[i].base_address, &(boRelocInfo[i]));	}	FREE (boRgnHdr);    }    // Read the sib headers:    //    sib_headers_bytesize = header->active_agegroups * TOTAL_ILKS * sizeof( Sib_Header );    //    sib_headers = (Sib_Header*) MALLOC( sib_headers_bytesize );    //    heapio__read_block( bp, sib_headers, sib_headers_bytesize );    for (i = 0;  i < MAX_PLAIN_ILKS;  i++) {	prevSzB[i] = heap->agegroup0_buffer_bytesize;    }    // Allocate the sib buffers and read in the heap image:    //    for (p = sib_headers, i = 0;  i < header->active_agegroups;  i++) {        //	Agegroup*  age =  heap->agegroup[ i ];	// Compute the space required for this agegroup,	// and mark the oldBOOK2SIBID to reflect the old address space://.........这里部分代码省略.........
开发者ID:spiralofhope,项目名称:mythryl,代码行数:101,


示例29: main

//.........这里部分代码省略.........                                   buffer[i]=i_bits[counter++];                                   }                                   if(verbose_mode==TRUE)                                      printf(" %02x",(unsigned char) buffer[i]);                                }                                // convert to 4 bits each RGB                                if(verbose_mode==TRUE)                                    printf("--->");                                //R G                                b[0]=((buffer[2]&0xf0)|((buffer[1]>>4)&0x0f));                                //B R2                                b[1]=(buffer[0]&0xf0)|((buffer[5]>>4)&0x0f);                                //G2B2                                b[2]=(buffer[4]&0xf0)|((buffer[3]>>4)&0x0f);                               // put in o_bits                                o_bits[in++] =b[0];                                o_bits[in++] =b[1];                                o_bits[in++] =b[2];                                if(verbose_mode==TRUE)                                   printf("%02X %02X %02X /n",b[0],b[1],b[2]);                                if (breakout==TRUE) {                                    //try to clean                                    if ((b[0]==0x00)&& (b[1] == 0x00)&& (b[2]==0x00)) {                                       //remove excess padding                                       in-=3;                                       break;                                    }                                }                            }                        break;                    case 32:                         printf(" 32-bit not yet done");                        fclose(fp);                        exit(-1);                        break;                    default:                        printf(" Unrecognize Bit count /n");                        fclose(fp);                        exit(-1);				}				printf(" sending image data../n ");				has_more_data=TRUE;				i=0;				while(i< in){					for (c=0; c < chunksize; c++) {						if (i+c < in){							buffer[c]= o_bits[i+c];						}						else {			            // no more data						has_more_data=FALSE;						break;   //breakout of for loop, c has the last chunk						}					}					if(verbose_mode==TRUE) {						for(counter=0;counter < c;counter++) {							printf(" [%i] %02X /n", i+counter, (uint8_t) buffer[counter]);					//        printf(" %02X /n",  (uint8_t) buffer[counter]);						}					}					serial_write( fd, buffer,c);					i=i+c;					if(has_more_data==FALSE)					   break;				}				printf(" Total Bytes Sent: %i/n",i);				Sleep(1);				res= serial_read(fd, buffer, sizeof(buffer));				if(res==1 && buffer[0]==0x01 ){                   printf(" Success!/n");				}				else {				    printf(" Reply received: ");                    for (i=0;i <res;i++)                      printf(" %02x",(uint8_t) buffer[i]);                   printf("/n");				}                printf(" Done! :-)/n/n");				//close lcd				fclose(fp);		}		serial_close(fd);		FREE(param_port);		FREE(param_speed);		FREE(param_imagefile);		FREE(param_mode);		return 0; }  //end main()
开发者ID:BrzTit,项目名称:dangerous-prototypes-open-hardware,代码行数:101,



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


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