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

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

51自学网 2021-06-03 11:59:07
  C++
这篇教程C++ zerr函数代码示例写得很实用,希望能帮到您。

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

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

示例1: stuff

intstuff(char *fn){    FILE *in;    char *buf;    off_t len;    if (!(in = fopen(unmeta(fn), "r"))) {	zerr("can't open %s", fn);	return 1;    }    fseek(in, 0, 2);    len = ftell(in);    fseek(in, 0, 0);    buf = (char *)zalloc(len + 1);    if (!(fread(buf, len, 1, in))) {	zerr("read error on %s", fn);	fclose(in);	zfree(buf, len + 1);	return 1;    }    fclose(in);    buf[len] = '/0';    fwrite(buf, len, 1, stderr);    fflush(stderr);    inputsetline(metafy(buf, len, META_REALLOC), INP_FREE);    return 0;}
开发者ID:netroby,项目名称:zsh,代码行数:28,


示例2: main

/* compress or decompress from stdin to stdout */int main(int argc, char **argv){	jlg_log("Start...");	int ret;    /* avoid end-of-line conversions */    SET_BINARY_MODE(stdin);    SET_BINARY_MODE(stdout);    /* do compression if no arguments */    if (argc == 1) {    	jlg_log("Compressing...");        ret = def(stdin, stdout, Z_DEFAULT_COMPRESSION);        if (ret != Z_OK)            zerr(ret);        return ret;    }    /* do decompression if -d specified */    else if (argc == 2 && strcmp(argv[1], "-d") == 0) {    	jlg_log("Decompressing...");        ret = inf(stdin, stdout);        if (ret != Z_OK)            zerr(ret);        return ret;    }    /* otherwise, report usage */    else {        fputs("zpipe usage: zpipe [-d] < source > dest/n", stderr);        return 1;    }}
开发者ID:jlguenego,项目名称:sandbox,代码行数:34,


示例3: main

/* compress or decompress from stdin to stdout */int main(int argc, char **argv){    int ret;    /* do compression if no arguments */    if (argc == 1) {        ret = def(stdin, stdout, Z_DEFAULT_COMPRESSION);        if (ret != Z_OK)            zerr(ret);        return ret;    }    /* do decompression if -d specified */    else if (argc == 2 && strcmp(argv[1], "-d") == 0) {        ret = inf(stdin, stdout);        if (ret != Z_OK)            zerr(ret);        return ret;    }    /* otherwise, report usage */    else {        fputs("zpipe usage: zpipe [-d] < source > dest/n", stderr);        return 1;    }}
开发者ID:tombibsd,项目名称:netbsd-src,代码行数:27,


示例4: main

intmain(int argc, char *argv[]){	elf_object *elf;	add_fixup_anchor_list(zlib_anchors);	elf = elf_dlopen("/lib/x86_64-linux-gnu/libz.so.1.2.7");	if (elf == NULL)		return -1;	deflateInit = (deflateInit_fn)elf_dlsym(elf, "deflateInit_");	if (deflateInit == NULL)		goto out;	deflateEnd = (deflateEnd_fn)elf_dlsym(elf, "deflateEnd");	if (deflateEnd == NULL)		goto out;	deflate = (deflate_fn)elf_dlsym(elf, "deflate");	if (deflate == NULL)		goto out;	inflateInit = (inflateInit_fn)elf_dlsym(elf, "inflateInit_");	if (inflateInit == NULL)		goto out;	inflateEnd = (inflateEnd_fn)elf_dlsym(elf, "inflateEnd");	if (inflateEnd == NULL)		goto out;	inflate = (inflate_fn)elf_dlsym(elf, "inflate");	if (inflate == NULL)		goto out;	if (argc == 1) {		int ret;		ret = def(stdin, stdout, -1);		if (ret != 0)			zerr(ret);		return ret;	}	if (argc == 2 && !strcmp(argv[1], "-d")) {		int ret = inf(stdin, stdout);		if (ret != 0)			zerr(ret);		return ret;	}	fprintf(stderr, "usage: a.out [-d] <source> dest/n");	elf_dlclose(elf);	return 0;out:	elf_dlclose(elf);	return -2;}
开发者ID:cquaid,项目名称:lib_loader,代码行数:59,


示例5: zlib_decompress

intzlib_decompress(void *src, uint64_t srclen, void *dst, uint64_t *dstlen,		int level, uchar_t chdr, int btype, void *data){	int err;	unsigned int slen, dlen;	uint64_t _srclen = srclen;	uint64_t _dstlen = *dstlen;	uchar_t *dst1 = (uchar_t *)dst;	uchar_t *src1 = (uchar_t *)src;	z_stream *zs = (z_stream *)data;	while (_srclen > 0) {		if (_srclen > SINGLE_CALL_MAX) {			slen = SINGLE_CALL_MAX;		} else {			slen = _srclen;		}		if (_dstlen > SINGLE_CALL_MAX) {			dlen = SINGLE_CALL_MAX;		} else {			dlen = _dstlen;		}		zs->next_in = src1;		zs->avail_in = slen;		zs->next_out = dst1;		zs->avail_out = dlen;		err = inflate(zs, Z_NO_FLUSH);		if (err != Z_OK && err != Z_STREAM_END) {			zerr(err, 0);			return (-1);		}		dst1 += (dlen - zs->avail_out);		_dstlen -= (dlen - zs->avail_out);		src1 += (slen - zs->avail_in);		_srclen -= (slen - zs->avail_in);		if (err == Z_STREAM_END) {			if (_srclen > 0) {				zerr(Z_DATA_ERROR, 0);				return (-1);			} else {				break;			}		}	}	*dstlen = *dstlen - _dstlen;	err = inflateReset(zs);	if (err != Z_OK) {		zerr(err, 1);		return (-1);	}	return (0);}
开发者ID:muyu,项目名称:pcompress,代码行数:58,


示例6: def

/* Compress from file source to file dest until EOF on source.   def() returns Z_OK on success, Z_MEM_ERROR if memory could not be   allocated for processing, Z_STREAM_ERROR if an invalid compression   level is supplied, Z_VERSION_ERROR if the version of zlib.h and the   version of the library linked do not match, or Z_ERRNO if there is   an error reading or writing the files. */bool Misc::deflate(const uint8_t* in, size_t inlen, std::ostream& dest, string& err, int CHUNK, int level){  int ret, flush;  unsigned have;  z_stream strm;  if ( level == -1 ) level = Z_BEST_COMPRESSION;  if ( CHUNK == -1 ) CHUNK = CL_Z_DEFAULT_CHUNK;  uint8_t* out = (uint8_t*)malloc(CHUNK);  /* allocate deflate state */  strm.zalloc = Z_NULL;  strm.zfree = Z_NULL;  strm.opaque = Z_NULL;  ret = deflateInit(&strm, level);  if (ret != Z_OK){    free(out);    zerr(ret, err);    return false;  }  /* compress until end of file */  do {    strm.avail_in = inlen;    strm.next_in = (uint8_t*)in;    flush = Z_FINISH;    /* run deflate() on input until output buffer not full, finish       compression if all of source has been read in */    do {      strm.avail_out = CHUNK;      strm.next_out = out;      ret = ::deflate(&strm, flush);  /* no bad return value */      assert(ret != Z_STREAM_ERROR);  /* state not clobbered */      have = CHUNK - strm.avail_out;      dest.write( (char*)out,have);      if ( dest.fail() ) {        (void)deflateEnd(&strm);        free(out);        zerr(Z_ERRNO, err);        return false;      }    } while (strm.avail_out == 0);    assert(strm.avail_in == 0);   /* all input will be used */    /* done when last data in file processed */  } while (flush != Z_FINISH);  assert(ret == Z_STREAM_END);    /* stream will be complete */  /* clean up and return */  (void)deflateEnd(&strm);  free(out);  return true;}
开发者ID:zipang29,项目名称:rss,代码行数:59,


示例7: main

/* compress or decompress from stdin to stdout */int main(int argc, char **argv){    int ret;    /* avoid end-of-line conversions */    /* do compression if no arguments */    if (argc == 3) {           char *addr;           int fdr, fdw;           struct stat sb;           size_t out_len =6000*1000;           out_len*=1000 ;           char *outbuff= (char*)malloc(out_len );           off_t offset, pa_offset;           size_t length;           fdr = open( argv[1], O_RDONLY);           fstat(fdr, &sb);           length = sb.st_size;           addr = mmap(NULL, length, PROT_READ,                       MAP_PRIVATE, fdr, 0);           printf("input length = %lld/n",  length);           length = deflate_mmap(addr, length , outbuff, out_len, 7 );           printf("output length = %lld/n",  length);           size_t len;           fdw = open( argv[2], O_CREAT | O_WRONLY, 0666);                      while ( len = write(fdw, outbuff, length)){                length -=len;                outbuff +=len;            }           //ret = def(stdin, stdout, Z_DEFAULT_COMPRESSION);           if (ret != Z_OK)               zerr(ret);           return ret;    }    /* do decompression if -d specified */    else if (argc == 2 && strcmp(argv[1], "-d") == 0) {        ret = inf(stdin, stdout);        if (ret != Z_OK)            zerr(ret);        return ret;    }    /* otherwise, report usage */    else {        fputs("zpipe usage: zpipe [-d] source dest/n", stderr);        return 1;    }}
开发者ID:mostlybrainless,项目名称:acroparallels2015,代码行数:52,


示例8: parsestr

mod_export intparsestr(char *s){    int err;    if ((err = parsestrnoerr(s))) {	untokenize(s);	if (err > 32 && err < 127)	    zerr("parse error near `%c'", NULL, err);	else	    zerr("parse error", NULL, 0);    }    return err;}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:14,


示例9: squeeze

    void squeeze(disk_stream *inflight, unsigned long superp)    {      z_stream *zlib_stream =  inflight->zlib_streams[superp];      int ret;      unsigned long disk_buffer_pos;      while(zlib_stream->avail_in) {	ret = deflate(zlib_stream, Z_NO_FLUSH);	if(ret != Z_OK) {	  BOOST_LOG_TRIVIAL(fatal) << "Compression failure:("				   << ret << ")"				   << zerr(ret);	  exit(-1);	}	if(zlib_stream->avail_out == 0) {	  disk_buffer_pos = inflight->disk_pos[superp];	  inflight->disk_pos[superp]   += stream_unit;	  inflight->disk_bytes[superp] += stream_unit;	  do_flip_IO(inflight->flip_buffers[superp],		     disk_buffer_pos,		     stream_unit,		     false);	  zlib_stream->avail_out = stream_unit;	  zlib_stream->next_out = inflight->flip_buffers[superp]->ready;	}      }    }
开发者ID:Junyaozhao,项目名称:x-stream,代码行数:26,


示例10: setmathvar

static mnumbersetmathvar(struct mathvalue *mvp, mnumber v){    if (mvp->pval) {	/*	 * This value may have been hanging around for a while.	 * Be ultra-paranoid in checking the variable is still valid.	 */	char *s = mvp->lval, *ptr;	Param pm;	DPUTS(!mvp->lval, "no variable name but variable value in math");	if ((ptr = strchr(s, '[')))	    s = dupstrpfx(s, ptr - s);	pm = (Param) paramtab->getnode(paramtab, s);	if (pm == mvp->pval->pm) {	    if (noeval)		return v;	    setnumvalue(mvp->pval, v);	    return v;	}	/* Different parameter, start again from scratch */	mvp->pval = NULL;    }    if (!mvp->lval) {	zerr("lvalue required");	v.type = MN_INTEGER;	v.u.l = 0;	return v;    }    if (noeval)	return v;    untokenize(mvp->lval);    setnparam(mvp->lval, v);    return v;}
开发者ID:brandt,项目名称:zsh,代码行数:35,


示例11: modentry

intmodentry(int boot, Module m, void *ptr){    switch (boot) {    case 0:	return setup_(m);	break;    case 1:	return boot_(m);	break;    case 2:	return cleanup_(m);	break;    case 3:	return finish_(m);	break;    case 4:	return features_(m, (char ***)ptr);	break;    case 5:	return enables_(m, (int **)ptr);	break;    default:	zerr("bad call to modentry");	return 1;	break;    }}
开发者ID:AMDmi3,项目名称:zsh,代码行数:34,


示例12: decode_out

int decode_out(Gzb64* gzb64, unsigned char* buf, const size_t length){	int zret, ret;	/* should be guaranteed at least length after inflate */	int gz_in_bytes = evbuffer_get_contiguous_space(gzb64->decode_output_buffer);	unsigned char* gzin_buf = evbuffer_pullup(gzb64->decode_output_buffer, gz_in_bytes );	if(DEBUG) hex_debug(gzin_buf, gz_in_bytes);		gzb64->gz_decode_strm.next_in = gzin_buf;	gzb64->gz_decode_strm.avail_in = gz_in_bytes;	gzb64->gz_decode_strm.next_out = buf;    gzb64->gz_decode_strm.avail_out = length;	zret = inflate (& gzb64->gz_decode_strm, Z_NO_FLUSH);	if(zret < 0) zerr(zret);	evbuffer_drain(gzb64->decode_output_buffer, gz_in_bytes - gzb64->gz_decode_strm.avail_in);	ret = length - gzb64->gz_decode_strm.avail_out;		if(gzb64->decoded_last_chunk && 0 == ret) {		resetDecoder(gzb64);	}	return ret;}
开发者ID:nfvproject,项目名称:TFM,代码行数:27,


示例13: __compress__

int __compress__(struct strbuf *src, struct strbuf *dest, int level){    z_stream stream;    z_stream_init(&stream);    int ret, flush;    unsigned have;    ret = deflateInit(&stream, Z_DEFAULT_COMPRESSION);    if (ret != Z_OK)        zerr(ret);    char buffer[CHUNK_LENGTH];    stream.avail_in = src->len;    stream.next_in = (Bytef *)src->buf;    do {        flush = (stream.avail_in < CHUNK_LENGTH) ? Z_FINISH : Z_NO_FLUSH;        do {            stream.avail_out = CHUNK_LENGTH;            stream.next_out = (Bytef *)buffer;            ret = deflate(&stream, flush);            have = CHUNK_LENGTH - stream.avail_out;            strbuf_add(dest, buffer, have);        } while (stream.avail_out == 0);        assert(stream.avail_in == 0);    } while (flush != Z_FINISH);    assert(ret == Z_STREAM_END);    deflateEnd(&stream);    return ret;}
开发者ID:crypton3535,项目名称:pegit,代码行数:29,


示例14: zlib_init

intzlib_init(void **data, int *level, int nthreads, uint64_t chunksize,	  int file_version, compress_op_t op){	z_stream *zs;	int ret;	zs = (z_stream *)slab_alloc(NULL, sizeof (z_stream));	zs->zalloc = slab_alloc_ui;	zs->zfree = slab_free;	zs->opaque = NULL;	if (*level > 9) *level = 9;	if (op == COMPRESS) {		ret = deflateInit2(zs, *level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY);	} else {		if (file_version < 5) {			ret = inflateInit(zs);		} else {			ret = inflateInit2(zs, -15);		}	}	if (ret != Z_OK) {		zerr(ret, 0);		return (-1);	}	*data = zs;	return (0);}
开发者ID:muyu,项目名称:pcompress,代码行数:30,


示例15: parsestr

mod_export intparsestr(char **s){    int err;    if ((err = parsestrnoerr(s))) {	untokenize(*s);	if (!(errflag & ERRFLAG_INT)) {	    if (err > 32 && err < 127)		zerr("parse error near `%c'", err);	    else		zerr("parse error");	}    }    return err;}
开发者ID:AMDmi3,项目名称:zsh,代码行数:16,


示例16: gzb64_init

Gzb64* gzb64_init(){	int zret;	Gzb64* gzb64 = (Gzb64*) malloc(sizeof(Gzb64));	if( gzb64 == NULL ) { fprintf(stderr, "Failed to malloc/n"); exit(EXIT_FAILURE); }	/* Encode */	/* setup zlib encode struc */    gzb64->gz_encode_strm.zalloc = Z_NULL;    gzb64->gz_encode_strm.zfree  = Z_NULL;    gzb64->gz_encode_strm.opaque = Z_NULL;    zret = deflateInit2 (& gzb64->gz_encode_strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED,                             windowBits | GZIP_ENCODING, 8,                             Z_DEFAULT_STRATEGY);	if(zret < 0) zerr(zret);	gzb64->encode_gzout_buffer = evbuffer_new();	/* setup base64 encoder */	gzb64->b64_encoder = BIO_new(BIO_f_base64());	BIO_set_flags(gzb64->b64_encoder, BIO_FLAGS_BASE64_NO_NL); //Do not use newlines to flush buffer	gzb64->encode_output_buffer = BIO_new(BIO_s_mem());	BIO_set_mem_eof_return(gzb64->encode_output_buffer, 0);    gzb64->b64_encoder = BIO_push(gzb64->b64_encoder, gzb64->encode_output_buffer);	/* Decode */	gzb64->decode_input_buffer = evbuffer_new();	/* setup base64 decoder */	gzb64->b64_decoder = BIO_new(BIO_f_base64());	BIO_set_flags(gzb64->b64_decoder, BIO_FLAGS_BASE64_NO_NL); //Do not use newlines to flush buffer	gzb64->decode_output_buffer = evbuffer_new();	/* setup zlib decode struc */    gzb64->gz_decode_strm.avail_in = 0;    gzb64->gz_decode_strm.next_in = Z_NULL;	zret = inflateInit2 (& gzb64->gz_decode_strm, windowBits | ENABLE_ZLIB_GZIP);	if(zret < 0) zerr(zret);	/* State */	gzb64->encoded_last_chunk = false;	gzb64->decoded_last_chunk = false;	return gzb64;}
开发者ID:nfvproject,项目名称:TFM,代码行数:47,


示例17: encode_in

int encode_in(Gzb64* gzb64, const unsigned char* buf, const size_t length, const bool last){	int flush_type, zret;	struct evbuffer_iovec v[2];	int n, i, written;	size_t n_to_add = BUFF_SIZE;	if(last) {		flush_type = Z_FINISH;		gzb64->encoded_last_chunk = true;	} else {		flush_type = Z_NO_FLUSH;		}	gzb64->gz_encode_strm.next_in = buf;	gzb64->gz_encode_strm.avail_in = length;	/* loop as long as more input available */	while( 0 != gzb64->gz_encode_strm.avail_in || Z_FINISH == flush_type )	{		/* Reserve BUFF_SIZE bytes.*/		n = evbuffer_reserve_space(gzb64->encode_gzout_buffer, n_to_add, v, 2);		if (n<=0)		   return -1; /* Unable to reserve the space for some reason. */		for (i=0; i<n && n_to_add > 0; ++i) {		   size_t len = v[i].iov_len;		   if (len > n_to_add) /* Don't write more than n_to_add bytes. */			  len = n_to_add;			gzb64->gz_encode_strm.avail_out = len;			gzb64->gz_encode_strm.next_out = v[i].iov_base;						zret = deflate (& gzb64->gz_encode_strm, flush_type);			if(zret < 0) zerr(zret);			written = len - gzb64->gz_encode_strm.avail_out;			if(DEBUG) printf("Deflate Out:%d/n", written);		  /* If there was a problem during data generation, we can just stop			 here; no data will be committed to the buffer. */		   /* Set iov_len to the number of bytes we actually wrote, so we			  don't commit too much. */		   v[i].iov_len = written;		}		/* We commit the space here.  Note that we give it 'i' (the number of		   vectors we actually used) rather than 'n' (the number of vectors we		   had available. */		if (evbuffer_commit_space(gzb64->encode_gzout_buffer, v, i) < 0)		   return -1; /* Error committing */		if( Z_FINISH == flush_type && 0 == written ) break;	} 	return 0;	}
开发者ID:nfvproject,项目名称:TFM,代码行数:59,


示例18: resetDecoder

static void resetDecoder(Gzb64* gzb64){	int zret = inflateReset(& gzb64->gz_decode_strm);	if(zret < 0) zerr(zret);	zret = BIO_reset(gzb64->b64_decoder);	gzb64->decoded_last_chunk = false;	if(DEBUG) printf("Decoder reset/n");}
开发者ID:nfvproject,项目名称:TFM,代码行数:8,


示例19: notzero

static intnotzero(mnumber a){    if ((a.type & MN_INTEGER) ? a.u.l == 0 : a.u.d == 0.0) {	zerr("division by zero");	return 0;    }    return 1;}
开发者ID:blueyed,项目名称:zsh,代码行数:9,


示例20: comp_check

static intcomp_check(void){    if (incompfunc != 1) {	zerr("condition can only be used in completion function");	return 0;    }    return 1;}
开发者ID:Jaharmi,项目名称:zsh,代码行数:9,


示例21: resetEncoder

static void resetEncoder(Gzb64* gzb64){    int zret = deflateReset(& gzb64->gz_encode_strm);	if(zret < 0) zerr(zret);	zret = BIO_reset(gzb64->encode_output_buffer);	zret = BIO_reset(gzb64->b64_encoder);	gzb64->encoded_last_chunk = false;	if(DEBUG) printf("Encoder reset/n");}
开发者ID:nfvproject,项目名称:TFM,代码行数:9,


示例22: loop

voidloop(int toplevel){    List list;#ifdef DEBUG    int oasp = toplevel ? 0 : alloc_stackp;#endif    pushheap();    for (;;) {	freeheap();	errflag = 0;	if (interact && isset(SHINSTDIN))	    preprompt();	hbegin();		/* init history mech        */	intr();			/* interrupts on            */	lexinit();              /* initialize lexical state */	if (!(list = parse_event())) {	/* if we couldn't parse a list */	    hend();	    if (tok == ENDINPUT && !errflag)		break;	    continue;	}	if (hend()) {	    int toksav = tok;	    if (stopmsg)	/* unset 'you have stopped jobs' flag */		stopmsg--;	    execlist(list, 0, 0);	    tok = toksav;	    if (toplevel)		noexitct = 0;	}	DPUTS(alloc_stackp != oasp, "BUG: alloc_stackp changed in loop()");	if (ferror(stderr)) {	    zerr("write error", NULL, 0);	    clearerr(stderr);	}	if (subsh)		/* how'd we get this far in a subshell? */	    exit(lastval);	if (((!interact || sourcelevel) && errflag) || retflag)	    break;	if (trapreturn) {	    lastval = trapreturn;	    trapreturn = 0;	}	if (isset(SINGLECOMMAND) && toplevel) {	    if (sigtrapped[SIGEXIT])		dotrap(SIGEXIT);	    exit(lastval);	}    }    popheap();}
开发者ID:OS2World,项目名称:UTIL-SHELL-Zsh,代码行数:54,


示例23: compressZlib

void compressZlib(SharedBuffer<u8> data, std::ostream &os){	z_stream z;	const s32 bufsize = 16384;	//char input_buffer[bufsize];	char output_buffer[bufsize];	int input_i = 0;	int status = 0;	int ret;	z.zalloc = Z_NULL;	z.zfree = Z_NULL;	z.opaque = Z_NULL;	ret = deflateInit(&z, -1);	if(ret != Z_OK)		throw SerializationError("compressZlib: deflateInit failed");	z.avail_in = 0;	for(;;)	{		int flush = Z_NO_FLUSH;		z.next_out = (Bytef*)output_buffer;		z.avail_out = bufsize;		if(z.avail_in == 0)		{			//z.next_in = (char*)&data[input_i];			z.next_in = (Bytef*)&data[input_i];			z.avail_in = data.getSize() - input_i;			input_i += z.avail_in;			if(input_i == (int)data.getSize())				flush = Z_FINISH;		}		if(z.avail_in == 0)			break;		status = deflate(&z, flush);		if(status == Z_NEED_DICT || status == Z_DATA_ERROR				|| status == Z_MEM_ERROR)		{			zerr(status);			throw SerializationError("compressZlib: deflate failed");		}		int count = bufsize - z.avail_out;		if(count)			os.write(output_buffer, count);	}	deflateEnd(&z);}
开发者ID:ray8888,项目名称:MINETEST-Minetest-classic-remoboray,代码行数:52,


示例24: globlist

voidgloblist(LinkList list){    LinkNode node, next;    badcshglob = 0;    for (node = firstnode(list); !errflag && node; node = next) {	next = nextnode(node);	glob(list, node);    }    if (badcshglob == 1)	zerr("no match", NULL, 0);}
开发者ID:redwinner,项目名称:unxutils,代码行数:13,


示例25: push

static voidpush(mnumber val, char *lval, int getme){    if (sp == STACKSZ - 1)	zerr("stack overflow");    else	sp++;    stack[sp].val = val;    stack[sp].lval = lval;    stack[sp].pval = NULL;    if (getme)	stack[sp].val.type = MN_UNSET;}
开发者ID:blueyed,项目名称:zsh,代码行数:13,


示例26: zshlex

voidzshlex(void){    if (tok == LEXERR)	return;    do {	if (inrepeat_)	    ++inrepeat_;	if (inrepeat_ == 3 && isset(SHORTLOOPS))	    incmdpos = 1;	tok = gettok();    } while (tok != ENDINPUT && exalias());    nocorrect &= 1;    if (tok == NEWLIN || tok == ENDINPUT) {	while (hdocs) {	    struct heredocs *next = hdocs->next;	    char *doc, *munged_term;	    hwbegin(0);	    cmdpush(hdocs->type == REDIR_HEREDOC ? CS_HEREDOC : CS_HEREDOCD);	    munged_term = dupstring(hdocs->str);	    STOPHIST	    doc = gethere(&munged_term, hdocs->type);	    ALLOWHIST	    cmdpop();	    hwend();	    if (!doc) {		zerr("here document too large");		while (hdocs) {		    next = hdocs->next;		    zfree(hdocs, sizeof(struct heredocs));		    hdocs = next;		}		tok = LEXERR;		break;	    }	    setheredoc(hdocs->pc, REDIR_HERESTR, doc, hdocs->str,		       munged_term);	    zfree(hdocs, sizeof(struct heredocs));	    hdocs = next;	}    }    if (tok != NEWLIN)	isnewlin = 0;    else	isnewlin = (inbufct) ? -1 : 1;    if (tok == SEMI || (tok == NEWLIN && !(lexflags & LEXFLAGS_NEWLINE)))	tok = SEPER;}
开发者ID:AMDmi3,项目名称:zsh,代码行数:49,


示例27: reset_inflate_state

    void reset_inflate_state(z_stream *strm)    {      inflateEnd(strm);      strm->zalloc = Z_NULL;      strm->zfree = Z_NULL;      strm->opaque = Z_NULL;      strm->avail_in = 0;      strm->next_in = Z_NULL;      int ret = inflateInit(strm);      if (ret != Z_OK) {	BOOST_LOG_TRIVIAL(fatal) << "Unable to initialize zlib stream:"				 <<"(" << ret << ")" << zerr(ret);	exit(-1);      }    }
开发者ID:Junyaozhao,项目名称:x-stream,代码行数:15,


示例28: sourcehome

voidsourcehome(char *s){    char buf[PATH_MAX];    char *h;    if (emulation == EMULATE_SH || emulation == EMULATE_KSH ||	!(h = getsparam("ZDOTDIR")))	h = home;    if (strlen(h) + strlen(s) + 1 >= PATH_MAX) {	zerr("path too long: %s", s, 0);	return;    }    sprintf(buf, "%s/%s", h, s);    source(buf);}
开发者ID:OS2World,项目名称:UTIL-SHELL-Zsh,代码行数:16,


示例29: reset_deflate_state

    void reset_deflate_state(z_stream *strm, unsigned char *buffer)    {      deflateEnd(strm);      strm->zalloc = Z_NULL;      strm->zfree = Z_NULL;      strm->opaque = Z_NULL;      strm->avail_in = 0;      strm->next_in = Z_NULL;      strm->avail_out = stream_unit;      strm->next_out  = buffer;      int ret = deflateInit(strm, ZLIB_COMPRESSION_LEVEL);      if (ret != Z_OK) {	BOOST_LOG_TRIVIAL(fatal) << "Unable to initialize zlib stream" <<	      "(" << ret << ")" << zerr(ret);	exit(-1);      }    }
开发者ID:Junyaozhao,项目名称:x-stream,代码行数:17,


示例30: compressZlib

void compressZlib(SharedBuffer<u8> data, std::ostream &os){	z_stream z;	const s32 bufsize = 16384;	char output_buffer[bufsize];	int status = 0;	int ret;	z.zalloc = Z_NULL;	z.zfree = Z_NULL;	z.opaque = Z_NULL;	ret = deflateInit(&z, -1);	if(ret != Z_OK)		throw SerializationError("compressZlib: deflateInit failed");		// Point zlib to our input buffer	z.next_in = (Bytef*)&data[0];	z.avail_in = data.getSize();	// And get all output	for(;;)	{		z.next_out = (Bytef*)output_buffer;		z.avail_out = bufsize;				status = deflate(&z, Z_FINISH);		if(status == Z_NEED_DICT || status == Z_DATA_ERROR				|| status == Z_MEM_ERROR)		{			zerr(status);			throw SerializationError("compressZlib: deflate failed");		}		int count = bufsize - z.avail_out;		if(count)			os.write(output_buffer, count);		// This determines zlib has given all output		if(status == Z_STREAM_END)			break;	}	deflateEnd(&z);}
开发者ID:AMDmi3,项目名称:minetest,代码行数:43,



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


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