Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
idnode: idnode_uuid_as_str cleanups
  • Loading branch information
perexg committed Sep 8, 2015
1 parent 10d7654 commit 30fc455
Show file tree
Hide file tree
Showing 51 changed files with 217 additions and 188 deletions.
16 changes: 8 additions & 8 deletions src/access.c
Expand Up @@ -510,7 +510,7 @@ access_update(access_t *a, access_entry_t *ae)
if(pro && pro->pro_name[0] != '\0') {
if (a->aa_profiles == NULL)
a->aa_profiles = htsmsg_create_list();
htsmsg_add_str_exclusive(a->aa_profiles, idnode_uuid_as_str(&pro->pro_id));
htsmsg_add_str_exclusive(a->aa_profiles, idnode_uuid_as_sstr(&pro->pro_id));
}
}

Expand All @@ -519,7 +519,7 @@ access_update(access_t *a, access_entry_t *ae)
if(dvr && dvr->dvr_config_name[0] != '\0') {
if (a->aa_dvrcfgs == NULL)
a->aa_dvrcfgs = htsmsg_create_list();
htsmsg_add_str_exclusive(a->aa_dvrcfgs, idnode_uuid_as_str(&dvr->dvr_id));
htsmsg_add_str_exclusive(a->aa_dvrcfgs, idnode_uuid_as_sstr(&dvr->dvr_id));
}
}

Expand All @@ -534,7 +534,7 @@ access_update(access_t *a, access_entry_t *ae)
if (ilm == NULL) {
if (a->aa_chtags == NULL)
a->aa_chtags = htsmsg_create_list();
htsmsg_add_str_exclusive(a->aa_chtags, idnode_uuid_as_str(&ct->ct_id));
htsmsg_add_str_exclusive(a->aa_chtags, idnode_uuid_as_sstr(&ct->ct_id));
}
}
}
Expand All @@ -544,7 +544,7 @@ access_update(access_t *a, access_entry_t *ae)
if(ct && ct->ct_name[0] != '\0') {
if (a->aa_chtags == NULL)
a->aa_chtags = htsmsg_create_list();
htsmsg_add_str_exclusive(a->aa_chtags, idnode_uuid_as_str(&ct->ct_id));
htsmsg_add_str_exclusive(a->aa_chtags, idnode_uuid_as_sstr(&ct->ct_id));
}
}
}
Expand Down Expand Up @@ -1054,7 +1054,7 @@ access_entry_save(access_entry_t *ae)
{
htsmsg_t *c = htsmsg_create_map();
idnode_save(&ae->ae_id, c);
hts_settings_save(c, "accesscontrol/%s", idnode_uuid_as_str(&ae->ae_id));
hts_settings_save(c, "accesscontrol/%s", idnode_uuid_as_sstr(&ae->ae_id));
htsmsg_destroy(c);
}

Expand Down Expand Up @@ -1092,7 +1092,7 @@ access_entry_class_delete(idnode_t *self)
{
access_entry_t *ae = (access_entry_t *)self;

hts_settings_remove("accesscontrol/%s", idnode_uuid_as_str(&ae->ae_id));
hts_settings_remove("accesscontrol/%s", idnode_uuid_as_sstr(&ae->ae_id));
access_entry_destroy(ae);
}

Expand Down Expand Up @@ -1595,7 +1595,7 @@ passwd_entry_save(passwd_entry_t *pw)
{
htsmsg_t *c = htsmsg_create_map();
idnode_save(&pw->pw_id, c);
hts_settings_save(c, "passwd/%s", idnode_uuid_as_str(&pw->pw_id));
hts_settings_save(c, "passwd/%s", idnode_uuid_as_sstr(&pw->pw_id));
htsmsg_destroy(c);
}

Expand All @@ -1610,7 +1610,7 @@ passwd_entry_class_delete(idnode_t *self)
{
passwd_entry_t *pw = (passwd_entry_t *)self;

hts_settings_remove("passwd/%s", idnode_uuid_as_str(&pw->pw_id));
hts_settings_remove("passwd/%s", idnode_uuid_as_sstr(&pw->pw_id));
passwd_entry_destroy(pw);
}

Expand Down
2 changes: 1 addition & 1 deletion src/api/api_bouquet.c
Expand Up @@ -36,7 +36,7 @@ api_bouquet_list
pthread_mutex_lock(&global_lock);
RB_FOREACH(bq, &bouquets, bq_link) {
e = htsmsg_create_map();
htsmsg_add_str(e, "key", idnode_uuid_as_str(&bq->bq_id));
htsmsg_add_str(e, "key", idnode_uuid_as_sstr(&bq->bq_id));
htsmsg_add_str(e, "val", bq->bq_name ?: "");
htsmsg_add_msg(l, NULL, e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/api_caclient.c
Expand Up @@ -37,7 +37,7 @@ api_caclient_list
pthread_mutex_lock(&global_lock);
TAILQ_FOREACH(cac, &caclients, cac_link) {
e = htsmsg_create_map();
htsmsg_add_str(e, "uuid", idnode_uuid_as_str(&cac->cac_id));
htsmsg_add_str(e, "uuid", idnode_uuid_as_sstr(&cac->cac_id));
htsmsg_add_str(e, "title", idnode_get_title(&cac->cac_id, perm->aa_lang));
htsmsg_add_str(e, "status", caclient_get_status(cac));
htsmsg_add_msg(l, NULL, e);
Expand Down
8 changes: 4 additions & 4 deletions src/api/api_channel.c
Expand Up @@ -57,9 +57,9 @@ api_channel_list
if (!cfg && !channel_access(ch, perm, 0)) continue;
if (!ch->ch_enabled) {
snprintf(buf, sizeof(buf), "{%s}", channel_get_name(ch));
api_channel_key_val(l, idnode_uuid_as_str(&ch->ch_id), buf);
api_channel_key_val(l, idnode_uuid_as_sstr(&ch->ch_id), buf);
} else {
api_channel_key_val(l, idnode_uuid_as_str(&ch->ch_id), channel_get_name(ch));
api_channel_key_val(l, idnode_uuid_as_sstr(&ch->ch_id), channel_get_name(ch));
}
}
pthread_mutex_unlock(&global_lock);
Expand Down Expand Up @@ -114,10 +114,10 @@ api_channel_tag_list
TAILQ_FOREACH(ct, &channel_tags, ct_link)
if (cfg || channel_tag_access(ct, perm, 0)) {
if (ct->ct_enabled) {
api_channel_key_val(l, idnode_uuid_as_str(&ct->ct_id), ct->ct_name);
api_channel_key_val(l, idnode_uuid_as_sstr(&ct->ct_id), ct->ct_name);
} else {
snprintf(buf, sizeof(buf), "{%s}", ct->ct_name);
api_channel_key_val(l, idnode_uuid_as_str(&ct->ct_id), buf);
api_channel_key_val(l, idnode_uuid_as_sstr(&ct->ct_id), buf);
}
}
pthread_mutex_unlock(&global_lock);
Expand Down
10 changes: 6 additions & 4 deletions src/api/api_dvr.c
Expand Up @@ -145,7 +145,7 @@ api_dvr_entry_create
s1 = htsmsg_get_str(conf, "config_name");
cfg = dvr_config_find_by_list(perm->aa_dvrcfgs, s1);
if (cfg) {
htsmsg_set_str(conf, "config_name", idnode_uuid_as_str(&cfg->dvr_id));
htsmsg_set_str(conf, "config_name", idnode_uuid_as_sstr(&cfg->dvr_id));
htsmsg_set_str(conf, "owner", perm->aa_username ?: "");
htsmsg_set_str(conf, "creator", perm->aa_representative ?: "");

Expand Down Expand Up @@ -213,6 +213,7 @@ api_dvr_entry_create_by_event
htsmsg_field_t *f;
const char *s;
int count = 0;
char ubuf[UUID_HEX_SIZE];

if (!(entries = htsmsg_get_list(args, "entries"))) {
entries = entries2 = api_dvr_entry_create_from_single(args);
Expand All @@ -233,7 +234,7 @@ api_dvr_entry_create_by_event
if ((e = epg_broadcast_find_by_id(strtoll(s, NULL, 10)))) {
dvr_config_t *cfg = dvr_config_find_by_list(perm->aa_dvrcfgs, config_uuid);
if (cfg) {
de = dvr_entry_create_by_event(idnode_uuid_as_str(&cfg->dvr_id),
de = dvr_entry_create_by_event(idnode_uuid_as_str(&cfg->dvr_id, ubuf),
e, 0, 0,
perm->aa_username,
perm->aa_representative,
Expand Down Expand Up @@ -309,7 +310,7 @@ api_dvr_autorec_create
pthread_mutex_lock(&global_lock);
cfg = dvr_config_find_by_list(perm->aa_dvrcfgs, s1);
if (cfg) {
htsmsg_set_str(conf, "config_name", idnode_uuid_as_str(&cfg->dvr_id));
htsmsg_set_str(conf, "config_name", idnode_uuid_as_sstr(&cfg->dvr_id));
dae = dvr_autorec_create(NULL, conf);
if (dae) {
dvr_autorec_save(dae);
Expand All @@ -331,6 +332,7 @@ api_dvr_autorec_create_by_series
htsmsg_field_t *f;
const char *config_uuid, *s;
int count = 0;
char ubuf[UUID_HEX_SIZE];

if (!(entries = htsmsg_get_list(args, "entries"))) {
entries = entries2 = api_dvr_entry_create_from_single(args);
Expand All @@ -350,7 +352,7 @@ api_dvr_autorec_create_by_series
if ((e = epg_broadcast_find_by_id(strtoll(s, NULL, 10)))) {
dvr_config_t *cfg = dvr_config_find_by_list(perm->aa_dvrcfgs, config_uuid);
if (cfg) {
dae = dvr_autorec_add_series_link(idnode_uuid_as_str(&cfg->dvr_id),
dae = dvr_autorec_add_series_link(idnode_uuid_as_str(&cfg->dvr_id, ubuf),
e,
perm->aa_username,
perm->aa_representative,
Expand Down
6 changes: 3 additions & 3 deletions src/api/api_epg.c
Expand Up @@ -56,7 +56,7 @@ api_epg_add_channel ( htsmsg_t *m, channel_t *ch )
char buf[32];
const char *s;
htsmsg_add_str(m, "channelName", channel_get_name(ch));
htsmsg_add_str(m, "channelUuid", channel_get_uuid(ch));
htsmsg_add_str(m, "channelUuid", channel_get_suuid(ch));
if ((chnum = channel_get_number(ch)) >= 0) {
uint32_t maj = chnum / CHANNEL_SPLIT;
uint32_t min = chnum % CHANNEL_SPLIT;
Expand Down Expand Up @@ -167,8 +167,8 @@ api_epg_entry ( epg_broadcast_t *eb, const char *lang, access_t *perm )
if (!access_verify2(perm, ACCESS_RECORDER) &&
(de = dvr_entry_find_by_event(eb)) &&
!access_verify_list(perm->aa_dvrcfgs,
idnode_uuid_as_str(&de->de_config->dvr_id))) {
htsmsg_add_str(m, "dvrUuid", idnode_uuid_as_str(&de->de_id));
idnode_uuid_as_sstr(&de->de_config->dvr_id))) {
htsmsg_add_str(m, "dvrUuid", idnode_uuid_as_sstr(&de->de_id));
htsmsg_add_str(m, "dvrState", dvr_entry_schedstatus(de));
}

Expand Down
4 changes: 2 additions & 2 deletions src/api/api_idnode.c
Expand Up @@ -143,7 +143,7 @@ api_idnode_grid
for (i = conf.start; i < ins.is_count && conf.limit != 0; i++) {
in = ins.is_array[i];
e = htsmsg_create_map();
htsmsg_add_str(e, "uuid", idnode_uuid_as_str(in));
htsmsg_add_str(e, "uuid", idnode_uuid_as_sstr(in));
if (idnode_perm(in, perm, NULL))
continue;
idnode_read0(in, e, flist, 0, perm->aa_lang);
Expand Down Expand Up @@ -197,7 +197,7 @@ api_idnode_load_by_class
/* Name/UUID only */
if (_enum) {
e = htsmsg_create_map();
htsmsg_add_str(e, "key", idnode_uuid_as_str(in));
htsmsg_add_str(e, "key", idnode_uuid_as_sstr(in));
htsmsg_add_str(e, "val", idnode_get_title(in, perm->aa_lang));

/* Full record */
Expand Down
2 changes: 1 addition & 1 deletion src/api/api_mpegts.c
Expand Up @@ -57,7 +57,7 @@ api_mpegts_input_network_list
char buf[256];
htsmsg_t *e = htsmsg_create_map();
mn = (mpegts_network_t*)is->is_array[i];
htsmsg_add_str(e, "key", idnode_uuid_as_str(is->is_array[i]));
htsmsg_add_str(e, "key", idnode_uuid_as_sstr(is->is_array[i]));
mn->mn_display_name(mn, buf, sizeof(buf));
htsmsg_add_str(e, "val", buf);
htsmsg_add_msg(l, NULL, e);
Expand Down
2 changes: 1 addition & 1 deletion src/api/api_profile.c
Expand Up @@ -37,7 +37,7 @@ api_profile_list
pthread_mutex_lock(&global_lock);
TAILQ_FOREACH(pro, &profiles, pro_link) {
e = htsmsg_create_map();
htsmsg_add_str(e, "key", idnode_uuid_as_str(&pro->pro_id));
htsmsg_add_str(e, "key", idnode_uuid_as_sstr(&pro->pro_id));
htsmsg_add_str(e, "val", profile_get_name(pro));
htsmsg_add_msg(l, NULL, e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/api_service.c
Expand Up @@ -73,7 +73,7 @@ api_mapper_status_msg ( void )
htsmsg_add_u32(m, "fail", stat.fail);
htsmsg_add_u32(m, "ignore", stat.ignore);
if (stat.active)
htsmsg_add_str(m, "active", idnode_uuid_as_str(&stat.active->s_id));
htsmsg_add_str(m, "active", idnode_uuid_as_sstr(&stat.active->s_id));
return m;
}

Expand Down
8 changes: 4 additions & 4 deletions src/bouquet.c
Expand Up @@ -508,7 +508,7 @@ bouquet_save(bouquet_t *bq, int notify)
{
htsmsg_t *c = htsmsg_create_map();
idnode_save(&bq->bq_id, c);
hts_settings_save(c, "bouquet/%s", idnode_uuid_as_str(&bq->bq_id));
hts_settings_save(c, "bouquet/%s", idnode_uuid_as_sstr(&bq->bq_id));
if (bq->bq_shield)
htsmsg_add_bool(c, "shield", 1);
htsmsg_destroy(c);
Expand All @@ -535,7 +535,7 @@ bouquet_class_delete(idnode_t *self)
bq->bq_enabled = 0;
bouquet_map_to_channels(bq);
if (!bq->bq_shield) {
hts_settings_remove("bouquet/%s", idnode_uuid_as_str(&bq->bq_id));
hts_settings_remove("bouquet/%s", idnode_uuid_as_sstr(&bq->bq_id));
bouquet_destroy(bq);
} else {
idnode_set_free(bq->bq_services);
Expand Down Expand Up @@ -702,7 +702,7 @@ bouquet_class_chtag_ref_get ( void *obj )
bouquet_t *bq = obj;

if (bq->bq_chtag_ptr)
buf = idnode_uuid_as_str(&bq->bq_chtag_ptr->ct_id);
buf = idnode_uuid_as_sstr(&bq->bq_chtag_ptr->ct_id);
else
buf = "";
return &buf;
Expand Down Expand Up @@ -748,7 +748,7 @@ bouquet_class_services_get ( void *obj )
htsmsg_add_s64(e, "lcn", lcn);
if ((tag = bouquet_get_tag_number(bq, t)) != 0)
htsmsg_add_s64(e, "tag", lcn);
htsmsg_add_msg(m, idnode_uuid_as_str(&t->s_id), e);
htsmsg_add_msg(m, idnode_uuid_as_sstr(&t->s_id), e);
}

return m;
Expand Down
14 changes: 7 additions & 7 deletions src/channels.c
Expand Up @@ -261,7 +261,7 @@ channel_class_bouquet_get ( void *o )
static const char *sbuf;
channel_t *ch = o;
if (ch->ch_bouquet)
sbuf = idnode_uuid_as_str(&ch->ch_bouquet->bq_id);
sbuf = idnode_uuid_as_sstr(&ch->ch_bouquet->bq_id);
else
sbuf = "";
return &sbuf;
Expand Down Expand Up @@ -466,7 +466,7 @@ channel_access(channel_t *ch, access_t *a, int disabled)
HTSMSG_FOREACH(f, a->aa_chtags) {
LIST_FOREACH(ilm, &ch->ch_ctms, ilm_in2_link) {
if (!strcmp(htsmsg_field_get_str(f) ?: "",
idnode_uuid_as_str(ilm->ilm_in1)))
idnode_uuid_as_sstr(ilm->ilm_in1)))
goto chtags_ok;
}
}
Expand Down Expand Up @@ -778,7 +778,7 @@ channel_delete ( channel_t *ch, int delconf )

/* Settings */
if (delconf)
hts_settings_remove("channel/config/%s", idnode_uuid_as_str(&ch->ch_id));
hts_settings_remove("channel/config/%s", idnode_uuid_as_sstr(&ch->ch_id));

/* Free memory */
RB_REMOVE(&channels, ch, ch_link);
Expand All @@ -796,7 +796,7 @@ channel_save ( channel_t *ch )
{
htsmsg_t *c = htsmsg_create_map();
idnode_save(&ch->ch_id, c);
hts_settings_save(c, "channel/config/%s", idnode_uuid_as_str(&ch->ch_id));
hts_settings_save(c, "channel/config/%s", idnode_uuid_as_sstr(&ch->ch_id));
htsmsg_destroy(c);
}

Expand Down Expand Up @@ -948,7 +948,7 @@ channel_tag_destroy(channel_tag_t *ct, int delconf)
channel_tag_mapping_destroy(ilm, delconf ? ilm->ilm_in1 : NULL);

if (delconf)
hts_settings_remove("channel/tag/%s", idnode_uuid_as_str(&ct->ct_id));
hts_settings_remove("channel/tag/%s", idnode_uuid_as_sstr(&ct->ct_id));

if(ct->ct_enabled && !ct->ct_internal)
htsp_tag_delete(ct);
Expand All @@ -974,7 +974,7 @@ channel_tag_save(channel_tag_t *ct)
{
htsmsg_t *c = htsmsg_create_map();
idnode_save(&ct->ct_id, c);
hts_settings_save(c, "channel/tag/%s", idnode_uuid_as_str(&ct->ct_id));
hts_settings_save(c, "channel/tag/%s", idnode_uuid_as_sstr(&ct->ct_id));
htsmsg_destroy(c);
htsp_tag_update(ct);
}
Expand Down Expand Up @@ -1016,7 +1016,7 @@ channel_tag_access(channel_tag_t *ct, access_t *a, int disabled)
/* Channel tag check */
if (a->aa_chtags) {
htsmsg_field_t *f;
const char *uuid = idnode_uuid_as_str(&ct->ct_id);
const char *uuid = idnode_uuid_as_sstr(&ct->ct_id);
HTSMSG_FOREACH(f, a->aa_chtags)
if (!strcmp(htsmsg_field_get_str(f) ?: "", uuid))
goto chtags_ok;
Expand Down
4 changes: 2 additions & 2 deletions src/channels.h
Expand Up @@ -174,8 +174,8 @@ int channel_set_number ( channel_t *ch, uint32_t major, uint32_t minor );
const char *channel_get_icon ( channel_t *ch );
int channel_set_icon ( channel_t *ch, const char *icon );

#define channel_get_uuid(ch) idnode_uuid_as_str(&(ch)->ch_id)
#define channel_get_suuid(ch) idnode_uuid_as_sstr(&(ch)->ch_id)

#define channel_get_id(ch) idnode_get_short_uuid((&(ch)->ch_id))
#define channel_get_id(ch) idnode_get_short_uuid((&(ch)->ch_id))

#endif /* CHANNELS_H */
4 changes: 2 additions & 2 deletions src/descrambler/caclient.c
Expand Up @@ -140,7 +140,7 @@ caclient_delete(caclient_t *cac, int delconf)
cac->cac_enabled = 0;
cac->cac_conf_changed(cac);
if (delconf)
hts_settings_remove("caclient/%s", idnode_uuid_as_str(&cac->cac_id));
hts_settings_remove("caclient/%s", idnode_uuid_as_sstr(&cac->cac_id));
pthread_mutex_lock(&caclients_mutex);
TAILQ_REMOVE(&caclients, cac, cac_link);
pthread_mutex_unlock(&caclients_mutex);
Expand All @@ -158,7 +158,7 @@ caclient_class_save ( idnode_t *in )
caclient_t *cac = (caclient_t *)in;
htsmsg_t *c = htsmsg_create_map();
idnode_save(in, c);
hts_settings_save(c, "caclient/%s", idnode_uuid_as_str(in));
hts_settings_save(c, "caclient/%s", idnode_uuid_as_sstr(in));
htsmsg_destroy(c);
cac->cac_conf_changed(cac);
}
Expand Down

0 comments on commit 30fc455

Please sign in to comment.