本文整理汇总了C++中rstr_release函数的典型用法代码示例。如果您正苦于以下问题:C++ rstr_release函数的具体用法?C++ rstr_release怎么用?C++ rstr_release使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rstr_release函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: glw_view_load1
/**
* Load a view file and do lexographical parsing
*
* Returns pointer to last token, or NULL if an error occured.
* If an error occured 'ei' will be filled with data
*/
token_t *
glw_view_load1(glw_root_t *gr, rstr_t *url, errorinfo_t *ei, token_t *prev,
int may_unlock)
{
token_t *last;
char errbuf[256];
rstr_t *p = fa_absolute_path(url, prev->file);
if(may_unlock)
glw_unlock(gr);
buf_t *b = fa_load(rstr_get(p),
FA_LOAD_VPATHS(gr->gr_vpaths),
FA_LOAD_ERRBUF(errbuf, sizeof(errbuf)),
NULL);
if(may_unlock)
glw_lock(gr);
if(b == NULL) {
snprintf(ei->error, sizeof(ei->error), "Unable to open \"%s\" -- %s",
rstr_get(p), errbuf);
snprintf(ei->file, sizeof(ei->file), "%s", rstr_get(prev->file));
ei->line = prev->line;
rstr_release(p);
return NULL;
}
last = glw_view_lexer(gr, buf_cstr(b), ei, p, prev);
buf_release(b);
rstr_release(p);
return last;
}
开发者ID:bguerreiro,项目名称:movian,代码行数:40,代码来源:glw_view_lexer.c
示例2: jpeg_info_clear
void
jpeg_info_clear(jpeginfo_t *ji)
{
if(ji->ji_thumbnail != NULL)
pixmap_release(ji->ji_thumbnail);
rstr_release(ji->ji_manufacturer);
rstr_release(ji->ji_equipment);
}
开发者ID:Rautz,项目名称:showtime,代码行数:8,代码来源:jpeg.c
示例3: sidfile_scandir
static int
sidfile_scandir(fa_dir_t *fd, const char *url, char *errbuf, size_t errlen)
{
void *fh = NULL;
char *p, *fpath = mystrdupa(url);
char buf[128];
char name[32];
char turl[URL_MAX];
int tracks, i;
fa_dir_entry_t *fde;
rstr_t *album, *artist;
if((p = strrchr(fpath, '/')) == NULL) {
snprintf(errbuf, errlen, "Invalid filename");
return -1;
}
*p = 0;
if((fh = fa_open(fpath, errbuf, errlen)) == NULL)
return -1;
if(fa_read(fh, buf, 128) != 128) {
snprintf(errbuf, errlen, "Unable to read file");
fa_close(fh);
return -1;
}
album = rstr_alloc(utf8_from_bytes((char *)buf + 0x16, 32, NULL));
artist = rstr_alloc(utf8_from_bytes((char *)buf + 0x36, 32, NULL));
tracks = buf[0xf];
for(i = 0; i < tracks; i++) {
snprintf(name, sizeof(name), "Track %02d", i + 1);
snprintf(turl, sizeof(turl), "sidplayer:%s/%d", fpath, i + 1);
fde = fa_dir_add(fd, turl, name, CONTENT_AUDIO);
fde->fde_probestatus = FDE_PROBE_DEEP;
fde->fde_metadata = prop_create_root("metadata");
prop_set_string(prop_create(fde->fde_metadata, "title"), name);
prop_set_rstring(prop_create(fde->fde_metadata, "album"), album);
prop_set_rstring(prop_create(fde->fde_metadata, "artist"), artist);
}
rstr_release(album);
rstr_release(artist);
fa_close(fh);
return 0;
}
开发者ID:dev-life,项目名称:showtime,代码行数:52,代码来源:fa_sidfile.c
示例4: ns_val_clr
static void
ns_val_clr(nls_string_t *ns)
{
if(ns->ns_values == 1) {
rstr_release(ns->ns_u.rstr);
ns->ns_u.rstr = NULL;
} else if(ns->ns_values > 1) {
int i;
for(i = 0; i < ns->ns_values; i++)
rstr_release(ns->ns_u.vec[i]);
free(ns->ns_u.vec);
ns->ns_u.vec = NULL;
}
ns->ns_values = 0;
}
开发者ID:andreus-sebes,项目名称:showtime,代码行数:15,代码来源:i18n.c
示例5: search_class_create
int
search_class_create(prop_t *parent, prop_t **nodesp, prop_t **entriesp,
const char *title, const char *icon)
{
prop_t *p = prop_create_root(NULL);
prop_t *m = prop_create(p, "metadata");
prop_t *n, *e;
rstr_t *url = backend_prop_make(p, NULL);
prop_set_rstring(prop_create(p, "url"), url);
rstr_release(url);
prop_set_string(prop_create(m, "title"), title);
if(icon != NULL)
prop_set_string(prop_create(m, "icon"), icon);
prop_set_string(prop_create(p, "type"), "directory");
n = prop_create(p, "nodes");
e = prop_create(p, "entries");
prop_set_int(e, 0);
*nodesp = prop_ref_inc(n);
*entriesp = prop_ref_inc(e);
if(prop_set_parent(p, parent)) {
prop_destroy(p);
return 1;
}
return 0;
}
开发者ID:niconico27,项目名称:showtime,代码行数:30,代码来源:search.c
示例6: set_path
static int
set_path(glw_view_eval_context_t *ec, const token_attrib_t *a,
struct token *t)
{
glw_t *w = ec->w;
rstr_t *r;
void (*fn)(glw_t *w, rstr_t *r) = a->fn;
switch(t->type) {
case TOKEN_VOID:
fn(w, NULL);
return 0;
case TOKEN_RSTRING:
case TOKEN_LINK:
r = t->t_rstring;
break;
default:
return glw_view_seterr(ec->ei, t,
"Attribute '%s' expects a string or scalar not %s",
a->name, token2name(t));
}
r = fa_absolute_path(r, t->file);
fn(w, r);
rstr_release(r);
return 0;
}
开发者ID:Rautz,项目名称:showtime,代码行数:31,代码来源:glw_view_attrib.c
示例7: file_open_audio
/**
* Try to open the given URL with a playqueue context
*/
static int
file_open_audio(prop_t *page, const char *url)
{
char parent[URL_MAX];
char parent2[URL_MAX];
struct fa_stat fs;
prop_t *model;
if(fa_parent(parent, sizeof(parent), url))
return 1;
if(fa_stat(parent, &fs, NULL, 0))
return 1;
model = prop_create(page, "model");
prop_set_string(prop_create(model, "type"), "directory");
/* Find a meaningful page title (last component of URL) */
rstr_t *title = title_from_url(parent);
prop_setv(model, "metadata", "title", NULL, PROP_SET_RSTRING, title);
// Set parent
if(!fa_parent(parent2, sizeof(parent2), parent))
prop_set_string(prop_create(page, "parent"), parent2);
fa_scanner_page(parent, fs.fs_mtime, model, url,
prop_create(page, "directClose"), title);
rstr_release(title);
return 0;
}
开发者ID:tydaikho,项目名称:showtime,代码行数:33,代码来源:fa_backend.c
示例8: event_prop_action_dtor
static void
event_prop_action_dtor(event_t *e)
{
event_prop_action_t *epa = (event_prop_action_t *)e;
prop_ref_dec(epa->p);
rstr_release(epa->action);
}
开发者ID:supersn0b,项目名称:movian,代码行数:7,代码来源:event.c
示例9: ffmpeg_metadata_rstr
static rstr_t *
ffmpeg_metadata_rstr(AVMetadata *m, const char *key)
{
AVMetadataTag *tag;
int len;
rstr_t *ret;
const char *str;
char *d;
if((tag = av_metadata_get(m, key, NULL, AV_METADATA_IGNORE_SUFFIX)) == NULL)
return NULL;
if(!utf8_verify(tag->value))
return NULL;
str = tag->value;
len = strlen(str);
ret = rstr_allocl(str, len);
d = rstr_data(ret);
while(len > 0) {
len--;
if(d[len] <= ' ' || d[len] == '-')
d[len] = 0;
else
break;
}
if(*d == 0 || !strncasecmp(d, "http://", 7)) {
rstr_release(ret);
return NULL;
}
return ret;
}
开发者ID:Allba,项目名称:showtime,代码行数:33,代码来源:fa_probe.c
示例10: is_plugin_blacklisted
static int
is_plugin_blacklisted(const char *id, const char *version, rstr_t **reason)
{
char tmp[512];
int verint = parse_version_int(version);
if(!strcmp(id, "custombg")) {
if(reason != NULL) {
*reason =
_("Custom backgrounds can now be set in Settings -> Look and Feel");
}
return 1;
}
for(int i = 0; i < ARRAYSIZE(blacklist); i++) {
if(strcmp(id, blacklist[i].id))
continue;
if(verint >= blacklist[i].version)
continue;
if(reason != NULL) {
rstr_t *f = _("Version %s is no longer compatible with Movian");
snprintf(tmp, sizeof(tmp), rstr_get(f), version);
rstr_release(f);
*reason = rstr_alloc(tmp);
}
return 1;
}
return 0;
}
开发者ID:RuralHunter,项目名称:showtime,代码行数:30,代码来源:plugins.c
示例11: set_alt
static int
set_alt(glw_view_eval_context_t *ec, const token_attrib_t *a,
struct token *t)
{
glw_t *w = ec->w;
rstr_t *r;
switch(t->type) {
default:
if(w->glw_class->gc_set_alt != NULL)
w->glw_class->gc_set_alt(w, NULL);
return 0;
case TOKEN_RSTRING:
r = t->t_rstring;
break;
case TOKEN_LINK:
r = t->t_link_rurl;
break;
}
r = fa_absolute_path(r, t->file);
if(w->glw_class->gc_set_alt != NULL)
w->glw_class->gc_set_alt(w, r);
rstr_release(r);
return 0;
}
开发者ID:dreamcat4,项目名称:showtime,代码行数:29,代码来源:glw_view_attrib.c
示例12: news_sink
static void
news_sink(void *opaque, prop_event_t event, ...)
{
prop_t *p = opaque;
event_t *e;
va_list ap;
va_start(ap, event);
switch(event) {
case PROP_DESTROYED:
prop_unsubscribe(va_arg(ap, prop_sub_t *));
prop_ref_dec(p);
break;
case PROP_EXT_EVENT:
e = va_arg(ap, event_t *);
if(event_is_type(e, EVENT_DYNAMIC_ACTION)) {
const event_payload_t *ep = (const event_payload_t *)e;
if(!strcmp(ep->payload, "dismiss")) {
rstr_t *id = prop_get_string(p, "id", NULL);
dismis_news(rstr_get(id));
rstr_release(id);
prop_destroy(opaque);
}
}
break;
default:
break;
}
va_end(ap);
}
开发者ID:tajmouati,项目名称:showtime,代码行数:33,代码来源:notifications.c
示例13: hc_prop
static int
hc_prop(http_connection_t *hc, const char *remain, void *opaque,
http_cmd_t method)
{
htsbuf_queue_t out;
rstr_t *r;
int rval, i;
prop_t *p;
const char *action = http_arg_get_req(hc, "action");
if(remain == NULL)
return 404;
p = prop_from_path(remain);
if(p == NULL)
return 404;
htsbuf_queue_init(&out, 0);
switch(method) {
case HTTP_CMD_GET:
if(action != NULL) {
event_t *e = event_create_action_str(action);
prop_send_ext_event(p, e);
event_release(e);
rval = HTTP_STATUS_OK;
break;
}
r = prop_get_string(p, NULL);
if(r == NULL) {
char **childs = prop_get_name_of_childs(p);
if(childs == NULL) {
rval = HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE;
break;
}
for(i = 0; childs[i] != NULL; i++) {
htsbuf_qprintf(&out, "\t%s\n", childs[i]);
}
} else {
htsbuf_append(&out, rstr_get(r), strlen(rstr_get(r)));
htsbuf_append(&out, "\n", 1);
rstr_release(r);
}
rval = http_send_reply(hc, 0, "text/ascii", NULL, NULL, 0, &out);
break;
default:
rval = HTTP_STATUS_METHOD_NOT_ALLOWED;
break;
}
prop_ref_dec(p);
return rval;
}
开发者ID:Rautz,项目名称:showtime,代码行数:60,代码来源:httpcontrol.c
示例14: set_source
static void
set_source(glw_t *w, rstr_t *filename)
{
glw_image_t *gi = (glw_image_t *)w;
const rstr_t *curname;
if(gi->gi_pending_url != NULL)
curname = gi->gi_pending_url;
else if(gi->gi_pending != NULL)
curname = gi->gi_pending->glt_url;
else if(gi->gi_current != NULL)
curname = gi->gi_current->glt_url;
else
curname = NULL;
if(curname != NULL && filename != NULL && !strcmp(rstr_get(filename),
rstr_get(curname)))
return;
if(gi->gi_pending_url != NULL)
rstr_release(gi->gi_pending_url);
gi->gi_pending_url = filename ? rstr_dup(filename) : rstr_alloc("");
}
开发者ID:Daisho,项目名称:showtime,代码行数:25,代码来源:glw_image.c
示例15: callback_opt
static void
callback_opt(void *opaque, prop_event_t event, ...)
{
setting_t *s = opaque;
prop_callback_string_t *cb;
prop_t *c;
rstr_t *name;
va_list ap;
va_start(ap, event);
cb = s->s_callback;
if(event != PROP_SELECT_CHILD)
return;
c = va_arg(ap, prop_t *);
name = c ? prop_get_name(c) : NULL;
va_end(ap);
if(cb != NULL)
cb(s->s_opaque, rstr_get(name));
if(s->s_store != NULL && s->s_saver != NULL) {
htsmsg_delete_field(s->s_store, s->s_id);
if(name != NULL)
htsmsg_add_str(s->s_store, s->s_id, rstr_get(name));
s->s_saver(s->s_saver_opaque, s->s_store);
}
rstr_release(name);
}
开发者ID:Rautz,项目名称:showtime,代码行数:31,代码来源:settings.c
示例16: notifications_update
static void
notifications_update(void *opaque, prop_event_t event, ...)
{
statusbar_t *sb = opaque;
prop_t *p, *txt;
statusbar_entry_t *sbe;
char *buf;
rstr_t *msg;
int i, l;
va_list ap;
va_start(ap, event);
switch(event) {
case PROP_ADD_CHILD:
p = va_arg(ap, prop_t *);
txt = prop_get_by_name(PNVEC("self", "text"), 1,
PROP_TAG_NAMED_ROOT, p, "self",
NULL);
if(txt != NULL) {
msg = prop_get_string(txt);
if(msg != NULL) {
buf = mystrdupa(rstr_get(msg));
l = strlen(buf);
for(i = 0; i < l; i++)
if(buf[i] < ' ')
buf[i] = ' ';
sbe = calloc(1, sizeof(statusbar_entry_t));
sbe->p = prop_ref_inc(p);
sbe->id = gtk_statusbar_push(GTK_STATUSBAR(sb->bar), sb->ctxid, buf);
LIST_INSERT_HEAD(&sb->entries, sbe, link);
rstr_release(msg);
}
prop_ref_dec(txt);
}
break;
case PROP_DEL_CHILD:
p = va_arg(ap, prop_t *);
LIST_FOREACH(sbe, &sb->entries, link)
if(sbe->p == p)
break;
if(sbe == NULL)
break;
prop_ref_dec(sbe->p);
gtk_statusbar_remove(GTK_STATUSBAR(sb->bar), sb->ctxid, sbe->id);
LIST_REMOVE(sbe, link);
free(sbe);
break;
default:
break;
}
}
开发者ID:CrashSerious,项目名称:showtime,代码行数:59,代码来源:gu_statusbar.c
示例17: glw_quad_dtor
static void
glw_quad_dtor(glw_t *w)
{
glw_quad_t *q = (glw_quad_t *)w;
glw_renderer_free(&q->r);
rstr_release(q->fs);
glw_destroy_program(w->glw_root, q->prog);
}
开发者ID:Allba,项目名称:showtime,代码行数:8,代码来源:glw_primitives.c
示例18: rstr_vec_free
void
rstr_vec_free(rstr_vec_t *rv)
{
int i;
for(i = 0; i < rv->size; i++)
rstr_release(rv->v[i]);
free(rv);
}
开发者ID:Cy-4AH,项目名称:showtime,代码行数:8,代码来源:rstr.c
示例19: set_torrent_cache_path
static void
set_torrent_cache_path(void *opaque, const char *str)
{
rstr_release(btg.btg_cache_path);
btg.btg_cache_path = rstr_alloc(str);
if(allow_update)
torrent_diskio_scan(0);
}
开发者ID:RuralHunter,项目名称:showtime,代码行数:8,代码来源:torrent_settings.c
示例20: set_rstring
static int
set_rstring(glw_view_eval_context_t *ec, const token_attrib_t *a,
struct token *t)
{
rstr_t *rstr;
char buf[30];
void (*fn)(struct glw *w, rstr_t *str) = a->fn;
switch(t->type) {
case TOKEN_VOID:
buf[0] = 0;
break;
case TOKEN_CSTRING:
rstr = rstr_alloc(t->t_cstring);
fn(ec->w, rstr);
rstr_release(rstr);
return 0;
case TOKEN_RSTRING:
case TOKEN_LINK:
fn(ec->w, t->t_rstring);
return 0;
case TOKEN_INT:
snprintf(buf, sizeof(buf), "%d", t->t_int);
break;
case TOKEN_FLOAT:
snprintf(buf, sizeof(buf), "%f", t->t_float);
break;
default:
return glw_view_seterr(ec->ei, t,
"Attribute '%s' expects a string or scalar, got %s",
a->name, token2name(t));
}
rstr = rstr_alloc(buf);
fn(ec->w, rstr);
rstr_release(rstr);
return 0;
}
开发者ID:dreamcat4,项目名称:showtime,代码行数:43,代码来源:glw_view_attrib.c
注:本文中的rstr_release函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论