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


C++ put_header函数代码示例

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


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

示例1: P1

PRIVATE void put_byte P1 (UVAL, val)
{
    if (val >= (UVAL) 32 && val <= (UVAL) 126 && val != (UVAL) '\\'
	&& val != (UVAL) '"') {
	put_header (stringgen, alignment_of_type (tp_char));
	oprintf ("%c", (int) val);
	outcol++;
    } else {
	put_header (bytegen, alignment_of_type (tp_char));
	oprintf ("0x%lx", val & OxffUL);
	outcol += 4;
    }
}
开发者ID:brandw,项目名称:8086-toolchain,代码行数:13,代码来源:outppc.c

示例2: ct_build_group

static inline void 
ct_build_group(const struct nf_conntrack *ct, int a, struct nethdr *n, 
	      int b, int size)
{
	void *ptr = put_header(n, b, size);
	nfct_get_attr_grp(ct, a, ptr);
}
开发者ID:cyclops8456,项目名称:conntrack-tools,代码行数:7,代码来源:build.c

示例3: multilist_set_window

WERROR multilist_set_window(struct multilist *list, WINDOW *window)
{
	int maxy, maxx;
	bool rerender = false;

	getmaxyx(window, maxy, maxx);

	/* rerender pad if window width is different. */
	if (list->data && maxx != list->window_width) {
		rerender = true;
	}

	list->window = window;
	list->window_width = maxx;
	list->window_height = maxy;
	list->start_row = 0;
	if (rerender) {
		const void *row = multilist_get_current_row(list);
		WERROR rv = multilist_set_data(list, list->data);
		if (W_ERROR_IS_OK(rv) && row) {
			multilist_set_current_row(list, row);
		}
		return rv;
	} else {
		put_header(list);
		fix_start_row(list);
	}

	return WERR_OK;
}
开发者ID:DavidMulder,项目名称:samba,代码行数:30,代码来源:regedit_list.c

示例4: opt_x

/*Func: opt_x()
 * lseek 8 bytes from the beginning of arc
 * read the file name from argv and ready to search
 * find the file name from CLA
 * read each header file and store it in info strct
 * create a file by using open(info->name,RDWR_0|CREATE_O,0666)
 * set header of a new file 
 * copy and paste the rest of the content from arch (use info->size)
 */
void opt_x(int argc, char **argv,int arch, int *filecount, int *fcalled, file *info){
	char cur_name[16];
	char *null_cur_name;
	char *null_info_name;
	int newfile=0;
	int fbyte_max=120;
	int fbyte=0;
	struct stat archinfo;
	fstat(arch,&archinfo);

	fbyte_max = archinfo.st_size;	

	for((*fcalled) = 0; (*fcalled)<filecount[3];++(*fcalled)){
		fbyte = 0;

		lseek(arch,8,SEEK_SET);
		read_filename(argv,filecount,2,fcalled,info);//get name from CLA
		for(fbyte_max ; fbyte < fbyte_max; fbyte++ ){ 
			//for the end of file	
			read(arch, cur_name,16); //get name of the file from arch

			null_cur_name = null_str(cur_name,16);//turn both of the name into
			null_cur_name = shrt_str(null_cur_name);
			null_info_name = null_str(info->name,16);//null terminated strings
			null_info_name = shrt_str(null_info_name);
			if(!strcmp(null_cur_name, null_info_name)){
				put_header(arch, info);
				remove(null_info_name);
				newfile = open(null_info_name, O_RDWR|O_CREAT,0666);
				info->desc = arch;
				lseek(arch,2,SEEK_CUR);
				write_file_content(newfile, info);
				if(atoi(info->size)%2!=0)
					lseek(arch,1,SEEK_CUR);
				utime(null_info_name, atoi(info->time));
				chmod(null_info_name, strtol(info->mode,NULL,8));
				break;
			}else{
				iter_arch(arch,&fbyte,info);
			}
		}//where the for EOF ends
		if(fbyte>=fbyte_max)
			printf(CY"Warning: File(\"%s\") doesn't documented in archeive.\nThe other file has successfully extract\n"NC,null_info_name);
	}
	/*	printf("info->name: %.16s\n",info->name);
		printf("info->time: %.12s\n",info->time);
		printf("info->uid: %.6s\n",info->uid);
		printf("info->gid: %.6s\n",info->gid);
		printf("info->mode: %.8s\n",info->mode);
		printf("info->size: %.10s\n",info->size);
		*/

	return;
}
开发者ID:Lars139,项目名称:Archive,代码行数:63,代码来源:myar.c

示例5: test_init_simple

static int test_init_simple()
{
    yla_cop_type prg[HEADER_SIZE + 1];
    yla_cop_type *ptr = prg;

    put_header(&ptr, 0, 0, 1);
    put_commd(&ptr, CHALT);

    yla_vm vm;

    YLATEST_ASSERT_TRUE(yla_vm_init(&vm, prg, HEADER_SIZE + 1), "normal");
    YLATEST_ASSERT_TRUE(yla_vm_do_command(&vm) == -1, "halt expected")
    YLATEST_ASSERT_TRUE(yla_vm_done(&vm), "normal");

    return 0;
}
开发者ID:Temerin,项目名称:teach-yla-vm,代码行数:16,代码来源:yla_vm_test1.c

示例6: test_code_limit

static int test_code_limit()
{
    yla_cop_type prg[HEADER_SIZE + 1];
    yla_cop_type *ptr = prg;

    put_header(&ptr, 0, 0, 1);
    put_commd(&ptr, CNOP);

    yla_vm vm;

    YLATEST_ASSERT_TRUE(yla_vm_init(&vm, prg, HEADER_SIZE + 1), "normal");
    YLATEST_ASSERT_FALSE(yla_vm_run(&vm), "normal")
    YLATEST_ASSERT_TRUE(yla_vm_last_error(&vm) == YLA_VM_ERROR_CODE_SEG_EXCEED, "incorrect error code");
    YLATEST_ASSERT_TRUE(yla_vm_done(&vm), "normal");

    return 0;
}
开发者ID:Temerin,项目名称:teach-yla-vm,代码行数:17,代码来源:yla_vm_test1.c

示例7: test_init_simple_run

static int test_init_simple_run()
{
    yla_cop_type prg[HEADER_SIZE + 2];
    yla_cop_type *ptr = prg;

    put_header(&ptr, 0, 0, 2);
    put_commd(&ptr, CNOP);
    put_commd(&ptr, CHALT);

    yla_vm vm;

    YLATEST_ASSERT_TRUE(yla_vm_init(&vm, prg, HEADER_SIZE + 2), "normal");
    YLATEST_ASSERT_TRUE(yla_vm_run(&vm), "normal")
    YLATEST_ASSERT_TRUE(yla_vm_done(&vm), "normal");

    return 0;
}
开发者ID:Temerin,项目名称:teach-yla-vm,代码行数:17,代码来源:yla_vm_test1.c

示例8: test_push

static int test_push()
{
    yla_cop_type prg[HEADER_SIZE + 4];
    yla_cop_type *ptr = prg;

    put_header(&ptr, 1, 0, 4);
    put_commd(&ptr, CPUSH);
    put_value(&ptr, 0x1234);
    put_commd(&ptr, CHALT);

    yla_vm vm;

    YLATEST_ASSERT_TRUE(yla_vm_init(&vm, prg, HEADER_SIZE + 4), "normal");
    YLATEST_ASSERT_TRUE(yla_vm_run(&vm), "normal")
    YLATEST_ASSERT_TRUE(yla_vm_done(&vm), "normal");

    return 0;
}
开发者ID:Temerin,项目名称:teach-yla-vm,代码行数:18,代码来源:yla_vm_test1.c

示例9: test_get_stack_full

static int test_get_stack_full()
{
    yla_cop_type prg[HEADER_SIZE + 4];
    yla_cop_type *ptr = prg;

    put_header(&ptr, 0, 0, 4);
    put_commd(&ptr, CPUSH);
    put_value(&ptr, 0x1234);
    put_commd(&ptr, CHALT);

    yla_vm vm;

    YLATEST_ASSERT_TRUE(yla_vm_init(&vm, prg, HEADER_SIZE + 4), "normal");
    YLATEST_ASSERT_FALSE(yla_vm_run(&vm), "normal")
    YLATEST_ASSERT_TRUE(yla_vm_last_error(&vm) == YLA_VM_ERROR_STACK_FULL, "incorrect error code");
    YLATEST_ASSERT_TRUE(yla_vm_done(&vm), "normal");

    return 0;
}
开发者ID:Temerin,项目名称:teach-yla-vm,代码行数:19,代码来源:yla_vm_test1.c

示例10: asf_write_markers

static int asf_write_markers(AVFormatContext *s)
{
    ASFContext *asf = s->priv_data;
    AVIOContext *pb = s->pb;
    int i;
    AVRational scale = {1, 10000000};
    int64_t hpos = put_header(pb, &ff_asf_marker_header);

    ff_put_guid(pb, &ff_asf_reserved_4);// ASF spec mandates this reserved value
    avio_wl32(pb, s->nb_chapters);     // markers count
    avio_wl16(pb, 0);                  // ASF spec mandates 0 for this
    avio_wl16(pb, 0);                  // name length 0, no name given

    for (i = 0; i < s->nb_chapters; i++) {
        AVChapter *c = s->chapters[i];
        AVDictionaryEntry *t = av_dict_get(c->metadata, "title", NULL, 0);
        int64_t pres_time = av_rescale_q(c->start, c->time_base, scale);
        uint64_t offset;
        int32_t send_time = get_send_time(asf, pres_time, &offset);
        int len = 0;
        uint8_t *buf;
        AVIOContext *dyn_buf;
        if (t) {
            if (avio_open_dyn_buf(&dyn_buf) < 0)
                return AVERROR(ENOMEM);
            avio_put_str16le(dyn_buf, t->value);
            len = avio_close_dyn_buf(dyn_buf, &buf);
        }
        avio_wl64(pb, offset);            // offset of the packet with send_time
        avio_wl64(pb, pres_time + PREROLL_TIME * 10000); // presentation time
        avio_wl16(pb, 12 + len);          // entry length
        avio_wl32(pb, send_time);         // send time
        avio_wl32(pb, 0);                 // flags, should be 0
        avio_wl32(pb, len / 2);           // marker desc length in WCHARS!
        if (t) {
            avio_write(pb, buf, len);     // marker desc
            av_freep(&buf);
        }
    }
    end_header(pb, hpos);
    return 0;
}
开发者ID:r-type,项目名称:vice-libretro,代码行数:42,代码来源:asfenc.c

示例11: opt_v

void opt_v(int argc, char **argv,int arch, int *filecount, int *fcalled, file *info){
	int fbyte_max=1;
	int fbyte=0;
	char cur_name[16];
	char *null_cur_name;
	char null_time[13];
	struct stat archinfo;
	fstat(arch,&archinfo);

	fbyte_max = archinfo.st_size;
	fbyte = 0;
	lseek(arch,8,SEEK_SET);

	for(fbyte=0; fbyte < fbyte_max; fbyte++){
		read(arch,cur_name,16);
		null_cur_name = null_str(cur_name,16);
		null_cur_name = shrt_str(null_cur_name);
		(fbyte) += 60+atoi(info->size);



		if(fbyte < fbyte_max){
			put_header(arch,info);
			lseek(arch,atoi(info->size)+2,SEEK_CUR);
			print_mode(info);
			printf("%.6s",info->uid);
			printf("/%.6s",info->gid);
			printf("%.10s",info->size);
			//null_time= null_str(info->time,12);
			//null_time= shrt_str(null_time);
			//strftime(null_time,12,"%c",info->time);
			printf("%.12s",info->time);
			printf("%.16s",null_cur_name);
			printf("\n");
			if(atoi(info->size)%2!=0){
				lseek(arch,1,SEEK_CUR);
				(fbyte)++;
			}
		}
	}

}
开发者ID:Lars139,项目名称:Archive,代码行数:42,代码来源:myar_backup.c

示例12: create_library

/*
 * Create a new library
 */
int create_library(char *libname)
{
    FILE *libfp;
    struct rdlm_hdr hdr;

    hdr.magic = RDLAMAG;
    hdr.hdrsize = 0;
    hdr.date = time(NULL);
    hdr.owner = getuid();
    hdr.group = getgid();
    hdr.mode = umask(022);
    hdr.size = 0;

    libfp = fopen(libname, "wb");
    if (!libfp)
        error_exit(1, true, "could not open '%s'\n", libname);

    /* Write library header */
    put_header(&hdr, libfp, NULL);

    fclose(libfp);
    return true;
}
开发者ID:coapp-packages,项目名称:nasm,代码行数:26,代码来源:rdlar.c

示例13: multilist_set_data

WERROR multilist_set_data(struct multilist *list, const void *data)
{
	WERROR rv;

	SMB_ASSERT(list->window != NULL);
	list->data = data;

	calc_column_widths(list);

	if (list->pad) {
		delwin(list->pad);
	}
	/* construct a pad that is exactly the width of the window, and
	   as tall as required to fit all data rows. */
	list->nrows = data_get_row_count(list);
	list->pad = newpad(MAX(list->nrows, 1), list->window_width);
	if (list->pad == NULL) {
		return WERR_NOT_ENOUGH_MEMORY;
	}

	/* add the column headers to the window and render all rows to
	   the pad. */
	werase(list->window);
	put_header(list);
	rv = put_data(list);
	if (!W_ERROR_IS_OK(rv)) {
		return rv;
	}

	/* initialize the cursor */
	list->start_row = 0;
	list->cursor_row = 0;
	list->current_row = data_get_first_row(list);
	highlight_current_row(list);

	return WERR_OK;
}
开发者ID:DavidMulder,项目名称:samba,代码行数:37,代码来源:regedit_list.c

示例14: add_module

/*
 * Add a module to the library
 */
int add_module(FILE * libfp, const char *fname, char *modname)
{
    FILE *modfp;
    struct rdlm_hdr hdr = { RDLMMAG, 0, 0, 0, 0, 0, 0 };
    struct stat finfo;
    int i;

    if (options.verbose)
        fprintf(stderr, "adding module %s\n", modname);

    /* Initialize some fields in the module header */
    if (stat(fname, &finfo) < 0)
        error_exit(1, true, "could not stat '%s'", fname);
    hdr.date = finfo.st_mtime;
    hdr.owner = finfo.st_uid;
    hdr.group = finfo.st_gid;
    hdr.size = finfo.st_size;

    modfp = fopen(fname, "rb");
    if (!modfp)
        error_exit(1, true, "could not open '%s'", fname);

    /* Write module header */
    put_header(&hdr, libfp, modname);

    /* Put the module itself */
    while (!feof(modfp)) {
        i = fgetc(modfp);
        if (i == EOF)
            break;
        if (fputc(i, libfp) == EOF)
            error_exit(1, false, "write error");
    }

    fclose(modfp);
    return true;
}
开发者ID:coapp-packages,项目名称:nasm,代码行数:40,代码来源:rdlar.c

示例15: mpeg1_encode_sequence_header

/* put sequence header if needed */
static void mpeg1_encode_sequence_header(MpegEncContext *s)
{
        unsigned int vbv_buffer_size;
        unsigned int fps, v;
        int i;
        uint64_t time_code;
        float best_aspect_error= 1E10;
        float aspect_ratio= av_q2d(s->avctx->sample_aspect_ratio);
        int constraint_parameter_flag;

        if(aspect_ratio==0.0) aspect_ratio= 1.0; //pixel aspect 1:1 (VGA)

        if (s->current_picture.key_frame) {
            AVRational framerate= ff_frame_rate_tab[s->frame_rate_index];

            /* mpeg1 header repeated every gop */
            put_header(s, SEQ_START_CODE);

            put_bits(&s->pb, 12, s->width);
            put_bits(&s->pb, 12, s->height);
#if 0 //MEANX
            for(i=1; i<15; i++){
                float error= aspect_ratio;
                if(s->codec_id == CODEC_ID_MPEG1VIDEO || i <=1)
                    error-= 1.0/ff_mpeg1_aspect[i];
                else
                    error-= av_q2d(ff_mpeg2_aspect[i])*s->height/s->width;

                error= FFABS(error);

                if(error < best_aspect_error){
                    best_aspect_error= error;
                    s->aspect_ratio_info= i;
                }
            }
#endif // MEANX
            //MEANX put_bits(&s->pb, 4, s->aspect_ratio_info);
            //MEANX put_bits(&s->pb, 4, s->frame_rate_index);
 // MEANX 4:3
	     if(s->avctx->sample_aspect_ratio.num==16 && s->avctx->sample_aspect_ratio.den==9)
            {
                //printf("FFmpeg : Wide\n");
                put_bits(&s->pb,4,3); //16:9
            }
            else        //4:3
            {
              if(s->codec_id == CODEC_ID_MPEG2VIDEO)
                put_bits(&s->pb, 4, 2);
              else
                put_bits(&s->pb, 4, 12); // MPEG1
            }
// /MEANX
// //MEANX PULLDOWN            put_bits(&s->pb, 4, s->frame_rate_index);
if((s->flags2 & CODEC_FLAG2_32_PULLDOWN) && (s->codec_id == CODEC_ID_MPEG2VIDEO))
            {           
                put_bits(&s->pb, 4,4);
            }
            else
            {                                  
                put_bits(&s->pb, 4, s->frame_rate_index);
            } //MEANX pulldown

            if(s->avctx->rc_max_rate_header){ //MEANX we use header
                v = (s->avctx->rc_max_rate_header + 399) / 400;
                if (v > 0x3ffff && s->codec_id == CODEC_ID_MPEG1VIDEO)
                    v = 0x3ffff;
            }else{
                v= 0x3FFFF;
            }
// MEANX we use rc_buffer_size_header here to force
                // a correct rc_buffer_size


            if(s->avctx->rc_buffer_size_header)
                vbv_buffer_size = s->avctx->rc_buffer_size_header;
            else
                /* VBV calculation: Scaled so that a VCD has the proper VBV size of 40 kilobytes */
                vbv_buffer_size = (( 20 * s->bit_rate) / (1151929 / 2)) * 8 * 1024;
            vbv_buffer_size= (vbv_buffer_size + 16383) / 16384;

            put_bits(&s->pb, 18, v & 0x3FFFF);
            put_bits(&s->pb, 1, 1); /* marker */
            put_bits(&s->pb, 10, vbv_buffer_size & 0x3FF);

            constraint_parameter_flag=
                s->width <= 768 && s->height <= 576 &&
                s->mb_width * s->mb_height <= 396 &&
                s->mb_width * s->mb_height * framerate.num <= framerate.den*396*25 &&
                framerate.num <= framerate.den*30 &&
                s->avctx->me_range && s->avctx->me_range < 128 &&
                vbv_buffer_size <= 20 &&
                v <= 1856000/400 &&
                s->codec_id == CODEC_ID_MPEG1VIDEO;

            put_bits(&s->pb, 1, constraint_parameter_flag);

            ff_write_quant_matrix(&s->pb, s->avctx->intra_matrix);
            ff_write_quant_matrix(&s->pb, s->avctx->inter_matrix);

//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:avidemux-svn,代码行数:101,代码来源:mpeg12enc.c


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