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

C++ put_header函数代码示例

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

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



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


示例16: 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;
        uint64_t time_code;
        int constraint_parameter_flag;

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

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

            put_sbits(&s->pb, 12, s->width );
            put_sbits(&s->pb, 12, s->height);

            put_bits(&s->pb, 4, s->aspect_ratio_info);
            put_bits(&s->pb, 4, s->frame_rate_index);

            if(s->avctx->rc_max_rate){
                v = (s->avctx->rc_max_rate + 399) / 400;
                if (v > 0x3ffff && s->codec_id == CODEC_ID_MPEG1VIDEO)
                    v = 0x3ffff;
            }else{
                v= 0x3FFFF;
            }

            if(s->avctx->rc_buffer_size)
                vbv_buffer_size = s->avctx->rc_buffer_size;
            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_sbits(&s->pb, 18, v);
            put_bits(&s->pb, 1, 1); /* marker */
            put_sbits(&s->pb, 10, vbv_buffer_size);

            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);

            if(s->codec_id == CODEC_ID_MPEG2VIDEO){
                put_header(s, EXT_START_CODE);
                put_bits(&s->pb, 4, 1); //seq ext

                put_bits(&s->pb, 1, s->avctx->profile == 0); //escx 1 for 4:2:2 profile */

                put_bits(&s->pb, 3, s->avctx->profile); //profile
                put_bits(&s->pb, 4, s->avctx->level); //level

                put_bits(&s->pb, 1, s->progressive_sequence);
                put_bits(&s->pb, 2, s->chroma_format);
                put_bits(&s->pb, 2, s->width >>12);
                put_bits(&s->pb, 2, s->height>>12);
                put_bits(&s->pb, 12, v>>18); //bitrate ext
                put_bits(&s->pb, 1, 1); //marker
                put_bits(&s->pb, 8, vbv_buffer_size >>10); //vbv buffer ext
                put_bits(&s->pb, 1, s->low_delay);
                put_bits(&s->pb, 2, 0); // frame_rate_ext_n
                put_bits(&s->pb, 5, 0); // frame_rate_ext_d

                if (s->avctx->color_primaries != AVCOL_PRI_UNSPECIFIED) {
                    put_header(s, EXT_START_CODE);
                    put_bits(&s->pb, 4, 2); //seq display ext
                    put_bits(&s->pb, 3, 0); //video_format, set to component
                    put_bits(&s->pb, 1, 1); //colour_description
                    put_bits(&s->pb, 8, s->avctx->color_primaries); //colour_primaries
                    put_bits(&s->pb, 8, s->avctx->color_transfer); //transfer_characteristics
                    put_bits(&s->pb, 8, s->avctx->color_matrix); //matrix_coefficients
                    put_bits(&s->pb, 14, s->width);
                    put_bits(&s->pb, 1, 1);
                    put_bits(&s->pb, 14, s->height);
                    put_bits(&s->pb, 1, 0);
                }
            }
开发者ID:jfuentesbrevity,项目名称:ffmbc,代码行数:88,代码来源:mpeg12enc.c


示例17: opt_d

void opt_d(int argc, char **argv,int *arch, int *filecount, int *fcalled, file *info){
	int fbyte_max=1;
	int fbyte=0;
	int size = 0;
	int tsize = 0;
	int tempfile=0;
	int temparch =0;
	char cur_name[16];
	char *null_cur_name;
	char *null_info_name;
	char *str_buf;
	struct stat archinfo;
	struct stat temparch_info;


	fstat((*arch),&archinfo);

	temparch = open_file("temp_arch",1);

	fbyte_max = archinfo.st_size;
	//for fcalled goes here
	fbyte = 0;
	lseek((*arch),8,SEEK_SET);
	read_filename(argv,filecount,4,fcalled,info);

	for(fbyte=0; fbyte < fbyte_max; ){
		read((*arch),cur_name,16);
		null_cur_name = null_str(cur_name,16);
		null_cur_name = shrt_str(null_cur_name);
		null_info_name= null_str(info->name,16);
		null_info_name = shrt_str(null_info_name);

		(fbyte) += 60+atoi(info->size);

		if(fbyte < fbyte_max){
			if(!strcmp(null_cur_name,null_info_name)){//equal
				iter_arch((*arch), &fbyte, info);
				(fbyte) -= 60+atoi(info->size);
			}else{
				tempfile = 0;
				put_header((*arch), info);
				lseek((*arch),2,SEEK_CUR);

				/*printf("\ninfo->name: %.16s\n",info->name);
				  printf("cur name: %.16s\n",cur_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);
				  */

				//so now the header are read correctly
				//Time to put info in files
				tempfile = create_tempfile();
				write_file_header2(tempfile,cur_name,info);
				info->desc = (*arch);
				write_file_content(tempfile,info);
				all_in_arch(tempfile,temparch,fcalled,info);

				if(tsize%2!=0){
					write(temparch,"\n",1);
				}

				(*fcalled)++;
				close(tempfile);
				if(atoi(info->size)%2!=0)
					lseek((*arch),1,SEEK_CUR);

			}
		}
	}
	//FIXME: the temp_arch has the correct info but when copy to arch itself has wrong info.	
	fstat(temparch,&temparch_info);
	size = temparch_info.st_size;
	printf("temparch.size: %d\n",size);
	str_buf = malloc(sizeof(char)*size);
	read(temparch,str_buf,size);
	//ftruncate((*arch),(sizeof(char))*size);
	lseek((*arch),0,SEEK_SET);
	write((*arch),str_buf,size);
	free(str_buf);
	close(temparch);
	//remove("temp_arch");
}
开发者ID:Lars139,项目名称:Archive,代码行数:85,代码来源:myar.c


示例18: concatenate

/*
 * concatenate two (or more) files into one single file 
 */
void concatenate(int argc, char **argv)
{
   int zerr;
   gzFile fd;
   struct log_global_header hdr, tmp;

   memset(&hdr, 0, sizeof(struct log_global_header));

   /* open the output file for writing */
   fd = gzopen(GBL_LOGFILE, "wb");
   ON_ERROR(fd, NULL, "%s", gzerror(fd, &zerr));

   /* 
    * use GBL_LOG_FD here so the get_header function
    * will use this file 
    */
   GBL_LOG_FD = gzopen(argv[argc], "rb");
   ON_ERROR(GBL_LOG_FD, NULL, "%s", gzerror(GBL_LOG_FD, &zerr));
   
   /* get the file header */
   if (get_header(&hdr) != E_SUCCESS)
      FATAL_ERROR("Invalid log file (%s)", argv[argc]);

   /* write the header */
   put_header(fd, &hdr);
      
   printf("Concatenating file [%s]", argv[argc]);
   
   /* copy the first file into the output */
   dump_file(fd, &hdr);
     
   /* move the pointer to the next file */
   argc++;
   
   /* cicle thru the file list */
   while(argv[argc] != NULL) {
   
      GBL_LOG_FD = gzopen(argv[argc], "rb");
      ON_ERROR(GBL_LOG_FD, NULL, "%s", gzerror(GBL_LOG_FD, &zerr));
   
      /* get the file header */
      if (get_header(&tmp) != E_SUCCESS)
         FATAL_ERROR("Invalid log file (%s)", argv[argc]);
     
      /* check if the files are compatible */
      if (hdr.type != tmp.type)
         FATAL_ERROR("Cannot concatenate different type of file");

      printf("Concatenating file [%s]", argv[argc]);
      
      /* concatenate this file */
      dump_file(fd, &tmp);

      gzclose(GBL_LOG_FD);
      argc++;
   }

   gzclose(fd);

   printf("\nAll files concatenated into: %s\n\n", GBL_LOGFILE);

   exit(0);
}
开发者ID:LocutusOfBorg,项目名称:ettercap,代码行数:66,代码来源:el_log.c


示例19: asf_write_header1

/* write the header (used two times if non streamed) */
static int asf_write_header1(AVFormatContext *s, int64_t file_size,
                             int64_t data_chunk_size)
{
    ASFContext *asf = s->priv_data;
    AVIOContext *pb = s->pb;
    AVDictionaryEntry *tags[5];
    int header_size, n, extra_size, extra_size2, wav_extra_size, file_time;
    int has_title, has_aspect_ratio = 0;
    int metadata_count;
    AVCodecContext *enc;
    int64_t header_offset, cur_pos, hpos;
    int bit_rate;
    int64_t duration;

    ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL);

    tags[0] = av_dict_get(s->metadata, "title", NULL, 0);
    tags[1] = av_dict_get(s->metadata, "author", NULL, 0);
    tags[2] = av_dict_get(s->metadata, "copyright", NULL, 0);
    tags[3] = av_dict_get(s->metadata, "comment", NULL, 0);
    tags[4] = av_dict_get(s->metadata, "rating", NULL, 0);

    duration       = asf->duration + PREROLL_TIME * 10000;
    has_title      = tags[0] || tags[1] || tags[2] || tags[3] || tags[4];
    metadata_count = av_dict_count(s->metadata);

    bit_rate = 0;
    for (n = 0; n < s->nb_streams; n++) {
        enc = s->streams[n]->codec;

        avpriv_set_pts_info(s->streams[n], 32, 1, 1000); /* 32 bit pts in ms */

        bit_rate += enc->bit_rate;
        if (   enc->codec_type == AVMEDIA_TYPE_VIDEO
            && enc->sample_aspect_ratio.num > 0
            && enc->sample_aspect_ratio.den > 0)
            has_aspect_ratio++;
    }

    if (asf->is_streamed) {
        put_chunk(s, 0x4824, 0, 0xc00); /* start of stream (length will be patched later) */
    }

    ff_put_guid(pb, &ff_asf_header);
    avio_wl64(pb, -1); /* header length, will be patched after */
    avio_wl32(pb, 3 + has_title + !!metadata_count + s->nb_streams); /* number of chunks in header */
    avio_w8(pb, 1); /* ??? */
    avio_w8(pb, 2); /* ??? */

    /* file header */
    header_offset = avio_tell(pb);
    hpos          = put_header(pb, &ff_asf_file_header);
    ff_put_guid(pb, &ff_asf_my_guid);
    avio_wl64(pb, file_size);
    file_time = 0;
    avio_wl64(pb, unix_to_file_time(file_time));
    avio_wl64(pb, asf->nb_packets); /* number of packets */
    avio_wl64(pb, duration); /* end time stamp (in 100ns units) */
    avio_wl64(pb, asf->duration); /* duration (in 100ns units) */
    avio_wl64(pb, PREROLL_TIME); /* start time stamp */
    avio_wl32(pb, (asf->is_streamed || !pb->seekable) ? 3 : 2);  /* ??? */
    avio_wl32(pb, s->packet_size); /* packet size */
    avio_wl32(pb, s->packet_size); /* packet size */
    avio_wl32(pb, bit_rate ? bit_rate : -1); /* Maximum data rate in bps */
    end_header(pb, hpos);

    /* unknown headers */
    hpos = put_header(pb, &ff_asf_head1_guid);
    ff_put_guid(pb, &ff_asf_head2_guid);
    avio_wl16(pb, 6);
    if (has_aspect_ratio) {
        int64_t hpos2;
        avio_wl32(pb, 26 + has_aspect_ratio * 84);
        hpos2 = put_header(pb, &ff_asf_metadata_header);
        avio_wl16(pb, 2 * has_aspect_ratio);
        for (n = 0; n < s->nb_streams; n++) {
            enc = s->streams[n]->codec;
            if (   enc->codec_type == AVMEDIA_TYPE_VIDEO
                && enc->sample_aspect_ratio.num > 0
                && enc->sample_aspect_ratio.den > 0) {
                AVRational sar = enc->sample_aspect_ratio;
                avio_wl16(pb, 0);
                // the stream number is set like this below
                avio_wl16(pb, n + 1);
                avio_wl16(pb, 26); // name_len
                avio_wl16(pb,  3); // value_type
                avio_wl32(pb,  4); // value_len
                avio_put_str16le(pb, "AspectRatioX");
                avio_wl32(pb, sar.num);
                avio_wl16(pb, 0);
                // the stream number is set like this below
                avio_wl16(pb, n + 1);
                avio_wl16(pb, 26); // name_len
                avio_wl16(pb,  3); // value_type
                avio_wl32(pb,  4); // value_len
                avio_put_str16le(pb, "AspectRatioY");
                avio_wl32(pb, sar.den);
            }
        }
//.........这里部分代码省略.........
开发者ID:r-type,项目名称:vice-libretro,代码行数:101,代码来源:asfenc.c


示例20: ct_build_u8

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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