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


C++ r_buf_free函数代码示例

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


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

示例1: __core_patch_bracket

static int __core_patch_bracket(RCore *core, const char *str, ut64 *noff) {
	char tmp[128];
	char *s, *p, *q, *off;
	RBuffer *b = r_buf_new ();
	if (!b) {
		return 0;
	}
	p = off = strdup (str);
	if (!p) {
		r_buf_free (b);
		return 0;
	}
	for (;*p;) {
		if (*p=='\n') {
			*p++ = 0;
		} else {
			p++;
			continue;
		}
		if (*str == '}')
			break;
		if ((q = strstr (str, "${"))) {
			char *end = strchr (q+2,'}');
			if (end) {
				*q = *end = 0;
				*noff = r_num_math (core->num, q+2);
				r_buf_append_bytes (b, (const ut8*)str, strlen (str));
				snprintf (tmp, sizeof (tmp), "0x%08"PFMT64x, *noff);
				r_buf_append_bytes (b, (const ut8*)tmp, strlen (tmp));
				r_buf_append_bytes (b, (const ut8*)end+1, strlen (end+1));
			}
		} else {
			r_buf_append_bytes (b, (const ut8*)str, strlen (str));
		}
		str = p;
	}

	s = r_buf_to_string (b);
	r_egg_load (core->egg, s, 0);
	free (s);

	r_egg_compile (core->egg);
	r_egg_assemble (core->egg);

	r_buf_free (b);
	b = r_egg_get_bin (core->egg);

	if (strcmp (off, "+")) {
		*noff = r_num_math (core->num, off);
	}
	r_core_write_at (core, *noff, b->buf, b->length);
	*noff += b->length;
	free (off);
	return 1;
}
开发者ID:EliaGeretto,项目名称:radare2,代码行数:55,代码来源:patch.c

示例2: R_NEW0

static RIODesc *__open(RIO *io, const char *pathname, int rw, int mode) {
	if (__plugin_open (io, pathname,0)) {
		RIOSparse *mal = R_NEW0 (RIOSparse);
		mal->fd = -2; /* causes r_io_desc_new() to set the correct fd */
		int size = (int)r_num_math (NULL, pathname+9);
		mal->buf = r_buf_new_sparse ();
		if (size>0) {
			ut8 *data = malloc (size);
			if (!data) {
				eprintf ("Cannot allocate (%s) %d bytes\n",
					pathname+9, size);
				mal->offset = 0;
			} else {
				memset (data, 0x00, size);
				r_buf_write_at (mal->buf, 0, data, size);
				free (data);
			}
		}
		if (mal->buf) {
			RETURN_IO_DESC_NEW (&r_io_plugin_sparse,
				mal->fd, pathname, rw, mode, mal);
		}
		r_buf_free (mal->buf);
		free (mal);
	}
	return NULL;
}
开发者ID:13572293130,项目名称:radare2,代码行数:27,代码来源:io_sparse.c

示例3: r_io_def_mmap_free

static void r_io_def_mmap_free (RIOMMapFileObj *mmo) {
	free (mmo->filename);
	r_buf_free (mmo->buf);
	close (mmo->fd);
	memset (mmo, 0, sizeof (RIOMMapFileObj));
	free (mmo);
}
开发者ID:agatti,项目名称:radare2,代码行数:7,代码来源:io_default.c

示例4: destroy

static int destroy(RBinFile *arch) {
	free(arch->o->bin_obj);
	r_buf_free (arch->buf);
	arch->buf = NULL;
	arch->o->bin_obj = NULL;
	return true;
}
开发者ID:13572293130,项目名称:radare2,代码行数:7,代码来源:bin_xbe.c

示例5: r_io_def_mmap_refresh_def_mmap_buf

static int r_io_def_mmap_refresh_def_mmap_buf(RIOMMapFileObj *mmo) {
	RIO* io = mmo->io_backref;
	ut64 cur;
	if (mmo->buf) {
		cur = mmo->buf->cur;
		r_buf_free (mmo->buf);
		mmo->buf = NULL;
	} else {
		cur = 0;
	}
	st64 sz = r_file_size (mmo->filename);
	if (sz == 0 || sz > ST32_MAX) {
		// Do not use mmap if the file is huge
		mmo->rawio = 1;
	}
	if (mmo->rawio) {
		mmo->fd = __io_posix_open (mmo->filename, mmo->flags, mmo->mode);
		return (mmo->fd != -1);
	}
	mmo->buf = r_buf_mmap (mmo->filename, mmo->flags);
	if (mmo->buf) {
		r_io_def_mmap_seek (io, mmo, cur, SEEK_SET);
		return true;
	} else {
		mmo->rawio = 1;
		mmo->fd = __io_posix_open (mmo->filename, mmo->flags, mmo->mode);
		return (mmo->fd != -1);
	}
	return false;
}
开发者ID:Kodoque1,项目名称:radare2,代码行数:30,代码来源:io_default.c

示例6: destroy

static int destroy(RBinFile *bf) {
	free (bf->o->bin_obj);
	r_buf_free (bf->buf);
	bf->buf = NULL;
	bf->o->bin_obj = NULL;
	return true;
}
开发者ID:montekki,项目名称:radare2,代码行数:7,代码来源:bin_xbe.c

示例7: R_NEW0

static RIODesc *__open(RIO *io, const char *pathname, int rw, int mode) {
	if (__plugin_open (io, pathname,0)) {
		RIOSparse *mal = R_NEW0 (RIOSparse);
		int size = (int)r_num_math (NULL, pathname + 9);
		mal->buf = r_buf_new_sparse (io->Oxff);
		if (!mal->buf) {
			free (mal);
			return NULL;
		}
		if (size > 0) {
			ut8 *data = malloc (size);
			if (!data) {
				eprintf ("Cannot allocate (%s) %d byte(s)\n",
					pathname+9, size);
				mal->offset = 0;
			} else {
				memset (data, 0x00, size);
				r_buf_write_at (mal->buf, 0, data, size);
				free (data);
			}
		}
		if (mal->buf) {
			return r_io_desc_new (io, &r_io_plugin_sparse,
				pathname, rw, mode, mal);
		}
		r_buf_free (mal->buf);
		free (mal);
	}
	return NULL;
}
开发者ID:aronsky,项目名称:radare2,代码行数:30,代码来源:io_sparse.c

示例8: r_bin_dyldcache_free

void* r_bin_dyldcache_free(struct r_bin_dyldcache_obj_t* bin) {
	if (!bin)
		return NULL;
	if (bin->b)
		r_buf_free (bin->b);
	free(bin);
	return NULL;
}
开发者ID:17twenty,项目名称:radare2,代码行数:8,代码来源:dyldcache.c

示例9: r_bin_te_free

void* r_bin_te_free(struct r_bin_te_obj_t* bin) {
	if (!bin) return NULL;
	free (bin->header);
	free (bin->section_header);
	r_buf_free (bin->b);
	free (bin);
	return NULL;
}
开发者ID:HKingz,项目名称:radare2,代码行数:8,代码来源:te.c

示例10: r_buf_new

R_API RBuffer *r_buf_file (const char *file) {
	RBuffer *b = r_buf_new ();
	if (!b) return NULL;
	b->buf = (ut8*)r_file_slurp (file, &b->length);
	if (b->buf) return b;
	r_buf_free (b);
	return NULL; /* we just freed b, don't return it */
}
开发者ID:dialeth,项目名称:radare2,代码行数:8,代码来源:buf.c

示例11: r_io_zip_free_zipfileobj

void r_io_zip_free_zipfileobj(RIOZipFileObj *zfo) {
	if (!zfo) return;
	if (zfo->modified)
		r_io_zip_flush_file (zfo);
	free (zfo->name);
	free (zfo->password);
	r_buf_free (zfo->b);
	free (zfo);
}
开发者ID:CodingFree,项目名称:radare2,代码行数:9,代码来源:io_zip.c

示例12: r_bin_java_free

void* r_bin_java_free(RBinJavaObj* bin) {
	if (!bin) return NULL;
	if (bin->cp_items) free (bin->cp_items);
	if (bin->fields) free (bin->fields);
	if (bin->methods) free (bin->methods);
	if (bin->b) r_buf_free (bin->b);
	free (bin);
	return NULL;
}
开发者ID:pixilla,项目名称:radare2,代码行数:9,代码来源:java.c

示例13: free

void *r_bin_mz_free(struct r_bin_mz_obj_t* bin) {
	if (!bin) return NULL;
	free ((void *)bin->dos_header);
	free ((void *)bin->dos_extended_header);
	free ((void *)bin->relocation_entries);
	r_buf_free (bin->b);
	bin->b = NULL;
	free (bin);
	return NULL;
}
开发者ID:0x2F,项目名称:radare2,代码行数:10,代码来源:mz.c

示例14: load_bytes

static void * load_bytes(RBinFile *arch, const ut8 *buf, ut64 sz, ut64 loadaddr, Sdb *sdb) {
	if (!buf || !sz || sz == UT64_MAX) {
		return NULL;
	}
	RBuffer *tbuf = r_buf_new();
	r_buf_set_bytes (tbuf, buf, sz);
	void *res = r_bin_coff_new_buf (tbuf, arch->rbin->verbose);
	r_buf_free (tbuf);
	return res;
}
开发者ID:lionaneesh,项目名称:radare2,代码行数:10,代码来源:bin_coff.c

示例15: load_bytes

static void * load_bytes(const ut8 *buf, ut64 sz, ut64 loadaddr, Sdb *sdb){
	void *res = NULL;
	RBuffer *tbuf = NULL;
	if (!buf || sz == 0 || sz == UT64_MAX) return NULL;
	tbuf = r_buf_new ();
	r_buf_set_bytes (tbuf, buf, sz);
	res = r_bin_dex_new_buf (tbuf);
	r_buf_free (tbuf);
	return res;
}
开发者ID:crowell,项目名称:radare2,代码行数:10,代码来源:bin_dex.c


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