From: Jaroslav Kysela Date: Tue, 8 Sep 2015 12:48:21 +0000 (+0200) Subject: idnode: idnode_uuid_as_str cleanups X-Git-Tag: v4.2.1~2141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30fc455f42a5294fcdb9b56ef45852f0c3b8bef5;p=thirdparty%2Ftvheadend.git idnode: idnode_uuid_as_str cleanups --- diff --git a/src/access.c b/src/access.c index 7fcae781b..9e34fac88 100644 --- a/src/access.c +++ b/src/access.c @@ -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)); } } @@ -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)); } } @@ -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)); } } } @@ -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)); } } } @@ -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); } @@ -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); } @@ -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); } @@ -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); } diff --git a/src/api/api_bouquet.c b/src/api/api_bouquet.c index 3f891afd5..2ac0d1f55 100644 --- a/src/api/api_bouquet.c +++ b/src/api/api_bouquet.c @@ -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); } diff --git a/src/api/api_caclient.c b/src/api/api_caclient.c index 0cf933789..1f4250bb9 100644 --- a/src/api/api_caclient.c +++ b/src/api/api_caclient.c @@ -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); diff --git a/src/api/api_channel.c b/src/api/api_channel.c index ecf88345e..4eaf53d97 100644 --- a/src/api/api_channel.c +++ b/src/api/api_channel.c @@ -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); @@ -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); diff --git a/src/api/api_dvr.c b/src/api/api_dvr.c index 6da686407..9825185dd 100644 --- a/src/api/api_dvr.c +++ b/src/api/api_dvr.c @@ -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 ?: ""); @@ -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); @@ -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, @@ -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); @@ -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); @@ -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, diff --git a/src/api/api_epg.c b/src/api/api_epg.c index 1a3e44354..3d3a0a0a5 100644 --- a/src/api/api_epg.c +++ b/src/api/api_epg.c @@ -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; @@ -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)); } diff --git a/src/api/api_idnode.c b/src/api/api_idnode.c index c6e9eb07f..28437babf 100644 --- a/src/api/api_idnode.c +++ b/src/api/api_idnode.c @@ -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); @@ -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 */ diff --git a/src/api/api_mpegts.c b/src/api/api_mpegts.c index 4a54383c7..ac7d52456 100644 --- a/src/api/api_mpegts.c +++ b/src/api/api_mpegts.c @@ -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); diff --git a/src/api/api_profile.c b/src/api/api_profile.c index 5e554eb81..e84717d3b 100644 --- a/src/api/api_profile.c +++ b/src/api/api_profile.c @@ -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); } diff --git a/src/api/api_service.c b/src/api/api_service.c index f132c5400..3afa19a63 100644 --- a/src/api/api_service.c +++ b/src/api/api_service.c @@ -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; } diff --git a/src/bouquet.c b/src/bouquet.c index 5e531350f..2f6f186ac 100644 --- a/src/bouquet.c +++ b/src/bouquet.c @@ -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); @@ -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); @@ -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; @@ -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; diff --git a/src/channels.c b/src/channels.c index 3c9b00268..26f6251c7 100644 --- a/src/channels.c +++ b/src/channels.c @@ -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; @@ -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; } } @@ -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); @@ -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); } @@ -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); @@ -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); } @@ -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; diff --git a/src/channels.h b/src/channels.h index 5589bb232..7269dc476 100644 --- a/src/channels.h +++ b/src/channels.h @@ -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 */ diff --git a/src/descrambler/caclient.c b/src/descrambler/caclient.c index ab44137a6..b43869792 100644 --- a/src/descrambler/caclient.c +++ b/src/descrambler/caclient.c @@ -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); @@ -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); } diff --git a/src/dvr/dvr_autorec.c b/src/dvr/dvr_autorec.c index e4c41978d..e8c5eb46b 100644 --- a/src/dvr/dvr_autorec.c +++ b/src/dvr/dvr_autorec.c @@ -260,7 +260,7 @@ dvr_autorec_create_htsp(const char *dvr_config_name, const char *title, int full if (start_window >= 0) htsmsg_add_s32(conf, "start_window", start_window); if (ch) - htsmsg_add_str(conf, "channel", idnode_uuid_as_str(&ch->ch_id)); + htsmsg_add_str(conf, "channel", idnode_uuid_as_sstr(&ch->ch_id)); int i; for (i = 0; i < 7; i++) @@ -320,7 +320,7 @@ autorec_entry_destroy(dvr_autorec_entry_t *dae, int delconf) dvr_autorec_purge_spawns(dae, delconf); if (delconf) - hts_settings_remove("dvr/autorec/%s", idnode_uuid_as_str(&dae->dae_id)); + hts_settings_remove("dvr/autorec/%s", idnode_uuid_as_sstr(&dae->dae_id)); htsp_autorec_entry_delete(dae); @@ -368,7 +368,7 @@ dvr_autorec_save(dvr_autorec_entry_t *dae) lock_assert(&global_lock); idnode_save(&dae->dae_id, m); - hts_settings_save(m, "dvr/autorec/%s", idnode_uuid_as_str(&dae->dae_id)); + hts_settings_save(m, "dvr/autorec/%s", idnode_uuid_as_sstr(&dae->dae_id)); htsmsg_destroy(m); } @@ -444,7 +444,7 @@ dvr_autorec_entry_class_channel_get(void *o) static const char *ret; dvr_autorec_entry_t *dae = (dvr_autorec_entry_t *)o; if (dae->dae_channel) - ret = idnode_uuid_as_str(&dae->dae_channel->ch_id); + ret = idnode_uuid_as_sstr(&dae->dae_channel->ch_id); else ret = ""; return &ret; @@ -505,7 +505,7 @@ dvr_autorec_entry_class_tag_get(void *o) static const char *ret; dvr_autorec_entry_t *dae = (dvr_autorec_entry_t *)o; if (dae->dae_channel_tag) - ret = idnode_uuid_as_str(&dae->dae_channel_tag->ct_id); + ret = idnode_uuid_as_sstr(&dae->dae_channel_tag->ct_id); else ret = ""; return &ret; @@ -652,7 +652,7 @@ dvr_autorec_entry_class_config_name_get(void *o) static const char *ret; dvr_autorec_entry_t *dae = (dvr_autorec_entry_t *)o; if (dae->dae_config) - ret = idnode_uuid_as_str(&dae->dae_config->dvr_id); + ret = idnode_uuid_as_sstr(&dae->dae_config->dvr_id); else ret = ""; return &ret; diff --git a/src/dvr/dvr_config.c b/src/dvr/dvr_config.c index f331d5257..cc6ed4571 100644 --- a/src/dvr/dvr_config.c +++ b/src/dvr/dvr_config.c @@ -105,11 +105,12 @@ dvr_config_find_by_list(htsmsg_t *uuids, const char *name) dvr_config_t *cfg, *res = NULL; htsmsg_field_t *f; const char *uuid, *uuid2; + char ubuf[UUID_HEX_SIZE]; cfg = dvr_config_find_by_uuid(name); if (!cfg) cfg = dvr_config_find_by_name(name); - uuid = cfg ? idnode_uuid_as_str(&cfg->dvr_id) : ""; + uuid = cfg ? idnode_uuid_as_str(&cfg->dvr_id, ubuf) : ""; if (uuids) { HTSMSG_FOREACH(f, uuids) { uuid2 = htsmsg_field_get_str(f) ?: ""; @@ -229,7 +230,7 @@ dvr_config_destroy(dvr_config_t *cfg, int delconf) { if (delconf) { tvhinfo("dvr", "Deleting configuration '%s'", cfg->dvr_config_name); - hts_settings_remove("dvr/config/%s", idnode_uuid_as_str(&cfg->dvr_id)); + hts_settings_remove("dvr/config/%s", idnode_uuid_as_sstr(&cfg->dvr_id)); } LIST_REMOVE(cfg, config_link); idnode_unlink(&cfg->dvr_id); @@ -511,7 +512,7 @@ dvr_config_save(dvr_config_t *cfg) dvr_config_storage_check(cfg); idnode_save(&cfg->dvr_id, m); - hts_settings_save(m, "dvr/config/%s", idnode_uuid_as_str(&cfg->dvr_id)); + hts_settings_save(m, "dvr/config/%s", idnode_uuid_as_sstr(&cfg->dvr_id)); htsmsg_destroy(m); } @@ -555,7 +556,7 @@ dvr_config_class_perm(idnode_t *self, access_t *a, htsmsg_t *msg_to_write) if (!access_verify2(a, ACCESS_ADMIN)) return 0; if (a->aa_dvrcfgs) { - my_uuid = idnode_uuid_as_str(&cfg->dvr_id); + my_uuid = idnode_uuid_as_sstr(&cfg->dvr_id); HTSMSG_FOREACH(f, a->aa_dvrcfgs) { uuid = htsmsg_field_get_str(f) ?: ""; if (!strcmp(uuid, my_uuid)) @@ -635,7 +636,7 @@ dvr_config_class_profile_get(void *o) static const char *ret; dvr_config_t *cfg = (dvr_config_t *)o; if (cfg->dvr_profile) - ret = idnode_uuid_as_str(&cfg->dvr_profile->pro_id); + ret = idnode_uuid_as_sstr(&cfg->dvr_profile->pro_id); else ret = ""; return &ret; diff --git a/src/dvr/dvr_db.c b/src/dvr/dvr_db.c index 59f5904ac..7b647bf04 100644 --- a/src/dvr/dvr_db.c +++ b/src/dvr/dvr_db.c @@ -475,6 +475,7 @@ dvr_entry_create(const char *uuid, htsmsg_t *conf) dvr_entry_t *de, *de2; int64_t start, stop; htsmsg_t *m; + char ubuf[UUID_HEX_SIZE]; if (conf) { if (htsmsg_get_s64(conf, "start", &start)) @@ -521,10 +522,10 @@ dvr_entry_create(const char *uuid, htsmsg_t *conf) strcmp(de2->de_owner ?: "", de->de_owner ?: "") == 0) { tvhlog(LOG_INFO, "dvr", "delete entry %s \"%s\" on \"%s\" start time %"PRId64", " "scheduled for recording by \"%s\" (duplicate with %s)", - idnode_uuid_as_str(&de->de_id), + idnode_uuid_as_sstr(&de->de_id), lang_str_get(de->de_title, NULL), DVR_CH_NAME(de), (int64_t)de2->de_start, de->de_creator ?: "", - idnode_uuid_as_str(&de2->de_id)); + idnode_uuid_as_str(&de2->de_id, ubuf)); dvr_entry_destroy(de, 0); return NULL; } @@ -561,7 +562,7 @@ dvr_entry_create_(const char *config_uuid, epg_broadcast_t *e, conf = htsmsg_create_map(); htsmsg_add_s64(conf, "start", start); htsmsg_add_s64(conf, "stop", stop); - htsmsg_add_str(conf, "channel", idnode_uuid_as_str(&ch->ch_id)); + htsmsg_add_str(conf, "channel", idnode_uuid_as_sstr(&ch->ch_id)); htsmsg_add_u32(conf, "pri", pri); htsmsg_add_u32(conf, "retention", retention); htsmsg_add_str(conf, "config_name", config_uuid ?: ""); @@ -610,12 +611,12 @@ dvr_entry_create_(const char *config_uuid, epg_broadcast_t *e, htsmsg_add_u32(conf, "broadcast", e->id); if (dae) { - htsmsg_add_str(conf, "autorec", idnode_uuid_as_str(&dae->dae_id)); + htsmsg_add_str(conf, "autorec", idnode_uuid_as_sstr(&dae->dae_id)); htsmsg_add_str(conf, "directory", dae->dae_directory ?: ""); } if (dte) { - htsmsg_add_str(conf, "timerec", idnode_uuid_as_str(&dte->dte_id)); + htsmsg_add_str(conf, "timerec", idnode_uuid_as_sstr(&dte->dte_id)); htsmsg_add_str(conf, "directory", dte->dte_directory ?: ""); } @@ -633,7 +634,7 @@ dvr_entry_create_(const char *config_uuid, epg_broadcast_t *e, tvhlog(LOG_INFO, "dvr", "entry %s \"%s\" on \"%s\" starting at %s, " "scheduled for recording by \"%s\"", - idnode_uuid_as_str(&de->de_id), + idnode_uuid_as_sstr(&de->de_id), lang_str_get(de->de_title, NULL), DVR_CH_NAME(de), tbuf, creator ?: ""); dvr_entry_save(de); @@ -655,10 +656,11 @@ dvr_entry_create_htsp(const char *config_uuid, dvr_prio_t pri, int retention, const char *comment) { + char ubuf[UUID_HEX_SIZE]; dvr_config_t *cfg = dvr_config_find_by_uuid(config_uuid); if (!cfg) cfg = dvr_config_find_by_name(config_uuid); - return dvr_entry_create_(cfg ? idnode_uuid_as_str(&cfg->dvr_id) : NULL, + return dvr_entry_create_(cfg ? idnode_uuid_as_str(&cfg->dvr_id, ubuf) : NULL, NULL, ch, start, stop, start_extra, stop_extra, title, subtitle, description, lang, content_type, @@ -789,6 +791,7 @@ void dvr_entry_create_by_autorec(epg_broadcast_t *e, dvr_autorec_entry_t *dae) { char buf[200]; + char ubuf[UUID_HEX_SIZE]; /* Identical duplicate detection NOTE: Semantic duplicate detection is deferred to the start time of recording and then done using _dvr_duplicate_event by dvr_timer_start_recording. */ @@ -802,7 +805,7 @@ dvr_entry_create_by_autorec(epg_broadcast_t *e, dvr_autorec_entry_t *dae) dae->dae_comment ? ": " : "", dae->dae_comment ?: ""); - dvr_entry_create_by_event(idnode_uuid_as_str(&dae->dae_config->dvr_id), e, + dvr_entry_create_by_event(idnode_uuid_as_str(&dae->dae_config->dvr_id, ubuf), e, dae->dae_start_extra, dae->dae_stop_extra, dae->dae_owner, dae->dae_creator, dae, dae->dae_pri, dae->dae_retention, buf); @@ -856,7 +859,7 @@ static void dvr_entry_destroy(dvr_entry_t *de, int delconf) { if (delconf) - hts_settings_remove("dvr/log/%s", idnode_uuid_as_str(&de->de_id)); + hts_settings_remove("dvr/log/%s", idnode_uuid_as_sstr(&de->de_id)); htsp_dvr_entry_delete(de); @@ -911,7 +914,7 @@ dvr_entry_save(dvr_entry_t *de) idnode_save(&de->de_id, m); if (de->de_files) htsmsg_add_msg(m, "files", htsmsg_copy(de->de_files)); - hts_settings_save(m, "dvr/log/%s", idnode_uuid_as_str(&de->de_id)); + hts_settings_save(m, "dvr/log/%s", idnode_uuid_as_sstr(&de->de_id)); htsmsg_destroy(m); } @@ -1110,7 +1113,7 @@ dvr_event_replaced(epg_broadcast_t *e, epg_broadcast_t *new_e) tvhtrace("dvr", "dvr entry %s event replaced %s on %s @ %"PRItime_t " to %"PRItime_t, - idnode_uuid_as_str(&de->de_id), + idnode_uuid_as_sstr(&de->de_id), epg_broadcast_get_title(e, NULL), channel_get_name(e->channel), e->start, e->stop); @@ -1160,7 +1163,7 @@ void dvr_event_updated ( epg_broadcast_t *e ) tvhtrace("dvr", "dvr entry %s link to event %s on %s @ %"PRItime_t " to %"PRItime_t, - idnode_uuid_as_str(&de->de_id), + idnode_uuid_as_sstr(&de->de_id), epg_broadcast_get_title(e, NULL), channel_get_name(e->channel), e->start, e->stop); @@ -1478,7 +1481,7 @@ dvr_entry_class_config_name_get(void *o) static const char *ret; dvr_entry_t *de = (dvr_entry_t *)o; if (de->de_config) - ret = idnode_uuid_as_str(&de->de_config->dvr_id); + ret = idnode_uuid_as_sstr(&de->de_config->dvr_id); else ret = ""; return &ret; @@ -1552,7 +1555,7 @@ dvr_entry_class_channel_get(void *o) static const char *ret; dvr_entry_t *de = (dvr_entry_t *)o; if (de->de_channel) - ret = idnode_uuid_as_str(&de->de_channel->ch_id); + ret = idnode_uuid_as_sstr(&de->de_channel->ch_id); else ret = ""; return &ret; @@ -1572,13 +1575,14 @@ dvr_entry_class_channel_name_set(void *o, const void *v) { dvr_entry_t *de = (dvr_entry_t *)o; channel_t *ch; + char ubuf[UUID_HEX_SIZE]; if (!dvr_entry_is_editable(de)) return 0; if (!strcmp(de->de_channel_name ?: "", v ?: "")) return 0; ch = v ? channel_find_by_name(v) : NULL; if (ch) { - return dvr_entry_class_channel_set(o, idnode_uuid_as_str(&ch->ch_id)); + return dvr_entry_class_channel_set(o, idnode_uuid_as_str(&ch->ch_id, ubuf)); } else { free(de->de_channel_name); de->de_channel_name = v ? strdup(v) : NULL; @@ -1676,7 +1680,7 @@ dvr_entry_class_autorec_get(void *o) static const char *ret; dvr_entry_t *de = (dvr_entry_t *)o; if (de->de_autorec) - ret = idnode_uuid_as_str(&de->de_autorec->dae_id); + ret = idnode_uuid_as_sstr(&de->de_autorec->dae_id); else ret = ""; return &ret; @@ -1710,7 +1714,7 @@ dvr_entry_class_timerec_get(void *o) static const char *ret; dvr_entry_t *de = (dvr_entry_t *)o; if (de->de_timerec) - ret = idnode_uuid_as_str(&de->de_timerec->dte_id); + ret = idnode_uuid_as_sstr(&de->de_timerec->dte_id); else ret = ""; return &ret; @@ -1829,7 +1833,7 @@ dvr_entry_class_url_get(void *o) s = ""; if (de->de_sched_state == DVR_COMPLETED || de->de_sched_state == DVR_RECORDING) { - snprintf(buf, sizeof(buf), "dvrfile/%s", idnode_uuid_as_str(&de->de_id)); + snprintf(buf, sizeof(buf), "dvrfile/%s", idnode_uuid_as_sstr(&de->de_id)); s = buf; } return &s; @@ -2395,7 +2399,7 @@ dvr_entry_delete(dvr_entry_t *de) tvhlog(LOG_INFO, "dvr", "delete entry %s \"%s\" on \"%s\" start time %s, " "scheduled for recording by \"%s\", retention %d days", - idnode_uuid_as_str(&de->de_id), + idnode_uuid_as_sstr(&de->de_id), lang_str_get(de->de_title, NULL), DVR_CH_NAME(de), tbuf, de->de_creator ?: "", dvr_entry_get_retention(de)); diff --git a/src/dvr/dvr_timerec.c b/src/dvr/dvr_timerec.c index a6ae9661e..6e653cdd6 100644 --- a/src/dvr/dvr_timerec.c +++ b/src/dvr/dvr_timerec.c @@ -109,6 +109,7 @@ dvr_timerec_check(dvr_timerec_entry_t *dte) struct tm tm_start, tm_stop; const char *title; char buf[200]; + char ubuf[UUID_HEX_SIZE]; if(dte->dte_enabled == 0 || dte->dte_weekdays == 0) goto fail; @@ -153,7 +154,7 @@ dvr_timerec_check(dvr_timerec_entry_t *dte) snprintf(buf, sizeof(buf), _("Time recording%s%s"), dte->dte_comment ? ": " : "", dte->dte_comment ?: ""); - de = dvr_entry_create_(idnode_uuid_as_str(&dte->dte_config->dvr_id), + de = dvr_entry_create_(idnode_uuid_as_str(&dte->dte_config->dvr_id, ubuf), NULL, dte->dte_channel, start, stop, 0, 0, title, NULL, NULL, NULL, NULL, dte->dte_owner, dte->dte_creator, @@ -227,7 +228,7 @@ dvr_timerec_create_htsp(const char *dvr_config_name, const char *title, htsmsg_add_u32(conf, "stop", stop); if (ch) - htsmsg_add_str(conf, "channel", idnode_uuid_as_str(&ch->ch_id)); + htsmsg_add_str(conf, "channel", idnode_uuid_as_sstr(&ch->ch_id)); int i; for (i = 0; i < 7; i++) @@ -257,7 +258,7 @@ timerec_entry_destroy(dvr_timerec_entry_t *dte, int delconf) dvr_timerec_purge_spawn(dte, delconf); if (delconf) - hts_settings_remove("dvr/timerec/%s", idnode_uuid_as_str(&dte->dte_id)); + hts_settings_remove("dvr/timerec/%s", idnode_uuid_as_sstr(&dte->dte_id)); htsp_timerec_entry_delete(dte); @@ -291,7 +292,7 @@ dvr_timerec_save(dvr_timerec_entry_t *dte) lock_assert(&global_lock); idnode_save(&dte->dte_id, m); - hts_settings_save(m, "dvr/timerec/%s", idnode_uuid_as_str(&dte->dte_id)); + hts_settings_save(m, "dvr/timerec/%s", idnode_uuid_as_sstr(&dte->dte_id)); htsmsg_destroy(m); } @@ -368,7 +369,7 @@ dvr_timerec_entry_class_channel_get(void *o) static const char *ret; dvr_timerec_entry_t *dte = (dvr_timerec_entry_t *)o; if (dte->dte_channel) - ret = idnode_uuid_as_str(&dte->dte_channel->ch_id); + ret = idnode_uuid_as_sstr(&dte->dte_channel->ch_id); else ret = ""; return &ret; @@ -479,7 +480,7 @@ dvr_timerec_entry_class_config_name_get(void *o) static const char *buf; dvr_timerec_entry_t *dte = (dvr_timerec_entry_t *)o; if (dte->dte_config) - buf = idnode_uuid_as_str(&dte->dte_config->dvr_id); + buf = idnode_uuid_as_sstr(&dte->dte_config->dvr_id); else buf = ""; return &buf; diff --git a/src/epg.c b/src/epg.c index faf4ff9cc..e25116270 100644 --- a/src/epg.c +++ b/src/epg.c @@ -1783,7 +1783,7 @@ epg_episode_t *epg_broadcast_get_episode if (ebc->episode) return ebc->episode; if (!create) return NULL; snprintf(uri, sizeof(uri)-1, "tvh://channel-%s/bcast-%u/episode", - idnode_uuid_as_str(&ebc->channel->ch_id), ebc->id); + idnode_uuid_as_sstr(&ebc->channel->ch_id), ebc->id); if ((ee = epg_episode_find_by_uri(uri, 1, save))) *save |= epg_broadcast_set_episode(ebc, ee, ebc->grabber); return ee; @@ -1823,7 +1823,7 @@ htsmsg_t *epg_broadcast_serialize ( epg_broadcast_t *broadcast ) htsmsg_add_s64(m, "stop", broadcast->stop); htsmsg_add_str(m, "episode", broadcast->episode->uri); if (broadcast->channel) - htsmsg_add_str(m, "channel", channel_get_uuid(broadcast->channel)); + htsmsg_add_str(m, "channel", channel_get_suuid(broadcast->channel)); if (broadcast->dvb_eid) htsmsg_add_u32(m, "dvb_eid", broadcast->dvb_eid); if (broadcast->is_widescreen) diff --git a/src/epggrab/module.c b/src/epggrab/module.c index c522a09f0..37fa361ea 100644 --- a/src/epggrab/module.c +++ b/src/epggrab/module.c @@ -161,7 +161,7 @@ void epggrab_module_ch_save ( void *_m, epggrab_channel_t *ch ) htsmsg_add_str(m, "icon", ch->icon); LIST_FOREACH(ecl, &ch->channels, ecl_epg_link) { if (!a) a = htsmsg_create_list(); - htsmsg_add_str(a, NULL, channel_get_uuid(ecl->ecl_channel)); + htsmsg_add_str(a, NULL, channel_get_suuid(ecl->ecl_channel)); } if (a) htsmsg_add_msg(m, "channels", a); if (ch->major) diff --git a/src/epggrab/module/eit.c b/src/epggrab/module/eit.c index 876e2b7ed..f17531bd2 100644 --- a/src/epggrab/module/eit.c +++ b/src/epggrab/module/eit.c @@ -586,6 +586,7 @@ _eit_callback epggrab_ota_mux_t *ota = NULL; mpegts_psi_table_state_t *st; th_subscription_t *ths; + char ubuf[UUID_HEX_SIZE]; if (!epggrab_ota_running) return -1; @@ -667,7 +668,7 @@ _eit_callback /* Register this */ if (ota) - epggrab_ota_service_add(map, ota, idnode_uuid_as_str(&svc->s_id), 1); + epggrab_ota_service_add(map, ota, idnode_uuid_as_str(&svc->s_id, ubuf), 1); /* No point processing */ if (!LIST_FIRST(&svc->s_channels)) diff --git a/src/epggrab/module/opentv.c b/src/epggrab/module/opentv.c index ece8433d0..9ba4b5c88 100644 --- a/src/epggrab/module/opentv.c +++ b/src/epggrab/module/opentv.c @@ -363,7 +363,7 @@ opentv_parse_event_section_one if (ev.serieslink) { char suri[257]; snprintf(suri, 256, "opentv://channel-%s/series-%d", - channel_get_uuid(ch), ev.serieslink); + channel_get_suuid(ch), ev.serieslink); if ((es = epg_serieslink_find_by_uri(suri, 1, &save))) save |= epg_broadcast_set_serieslink(ebc, es, src); } diff --git a/src/epggrab/otamux.c b/src/epggrab/otamux.c index 98ca8c4fc..33252c632 100644 --- a/src/epggrab/otamux.c +++ b/src/epggrab/otamux.c @@ -118,7 +118,7 @@ epggrab_ota_queue_one( epggrab_ota_mux_t *om ) void epggrab_ota_queue_mux( mpegts_mux_t *mm ) { - const char *id = idnode_uuid_as_str(&mm->mm_id); + const char *id; epggrab_ota_mux_t *om; int epg_flag; @@ -127,6 +127,7 @@ epggrab_ota_queue_mux( mpegts_mux_t *mm ) lock_assert(&global_lock); + id = idnode_uuid_as_sstr(&mm->mm_id); epg_flag = mm->mm_is_epg(mm); if (epg_flag < 0 || epg_flag == MM_EPG_DISABLE) return; @@ -277,7 +278,7 @@ epggrab_mux_start ( mpegts_mux_t *mm, void *p ) { epggrab_module_t *m; epggrab_ota_mux_t *ota; - const char *uuid = idnode_uuid_as_str(&mm->mm_id); + const char *uuid = idnode_uuid_as_sstr(&mm->mm_id); /* Already started */ TAILQ_FOREACH(ota, &epggrab_ota_active, om_q_link) @@ -299,7 +300,7 @@ static void epggrab_mux_stop ( mpegts_mux_t *mm, void *p, int reason ) { epggrab_ota_mux_t *ota; - const char *uuid = idnode_uuid_as_str(&mm->mm_id); + const char *uuid = idnode_uuid_as_sstr(&mm->mm_id); int done = EPGGRAB_OTA_DONE_STOLEN; if (reason == SM_CODE_NO_INPUT) @@ -328,7 +329,8 @@ epggrab_ota_register if (ota == NULL) { /* Find mux entry */ - const char *uuid = idnode_uuid_as_str(&mm->mm_id); + char ubuf[UUID_HEX_SIZE]; + const char *uuid = idnode_uuid_as_str(&mm->mm_id, ubuf); SKEL_ALLOC(epggrab_ota_mux_skel); epggrab_ota_mux_skel->om_mux_uuid = (char*)uuid; diff --git a/src/esfilter.c b/src/esfilter.c index 211430410..8b12ed895 100644 --- a/src/esfilter.c +++ b/src/esfilter.c @@ -193,7 +193,7 @@ static void esfilter_delete(esfilter_t *esf, int delconf) { if (delconf) - hts_settings_remove("esfilter/%s", idnode_uuid_as_str(&esf->esf_id)); + hts_settings_remove("esfilter/%s", idnode_uuid_as_sstr(&esf->esf_id)); TAILQ_REMOVE(&esfilters[esf->esf_class], esf, esf_link); idnode_unlink(&esf->esf_id); free(esf->esf_comment); @@ -209,7 +209,7 @@ esfilter_class_save(idnode_t *self) { htsmsg_t *c = htsmsg_create_map(); idnode_save(self, c); - hts_settings_save(c, "esfilter/%s", idnode_uuid_as_str(self)); + hts_settings_save(c, "esfilter/%s", idnode_uuid_as_sstr(self)); htsmsg_destroy(c); } @@ -217,7 +217,7 @@ static const char * esfilter_class_get_title(idnode_t *self, const char *lang) { esfilter_t *esf = (esfilter_t *)self; - return idnode_uuid_as_str(&esf->esf_id); + return idnode_uuid_as_sstr(&esf->esf_id); } static void diff --git a/src/htsp_server.c b/src/htsp_server.c index 0766adeb2..f4d9c0525 100644 --- a/src/htsp_server.c +++ b/src/htsp_server.c @@ -713,10 +713,10 @@ htsp_build_dvrentry(dvr_entry_t *de, const char *method, const char *lang) htsmsg_add_u32(out, "eventId", de->de_bcast->id); if (de->de_autorec) - htsmsg_add_str(out, "autorecId", idnode_uuid_as_str(&de->de_autorec->dae_id)); + htsmsg_add_str(out, "autorecId", idnode_uuid_as_sstr(&de->de_autorec->dae_id)); if (de->de_timerec) - htsmsg_add_str(out, "timerecId", idnode_uuid_as_str(&de->de_timerec->dte_id)); + htsmsg_add_str(out, "timerecId", idnode_uuid_as_sstr(&de->de_timerec->dte_id)); htsmsg_add_s64(out, "start", de->de_start); htsmsg_add_s64(out, "stop", de->de_stop); @@ -816,7 +816,7 @@ htsp_build_autorecentry(dvr_autorec_entry_t *dae, const char *method) htsmsg_t *out = htsmsg_create_map(); int tad; - htsmsg_add_str(out, "id", idnode_uuid_as_str(&dae->dae_id)); + htsmsg_add_str(out, "id", idnode_uuid_as_sstr(&dae->dae_id)); htsmsg_add_u32(out, "enabled", dae->dae_enabled); htsmsg_add_u32(out, "maxDuration", dae->dae_maxduration); htsmsg_add_u32(out, "minDuration", dae->dae_minduration); @@ -868,7 +868,7 @@ htsp_build_timerecentry(dvr_timerec_entry_t *dte, const char *method) { htsmsg_t *out = htsmsg_create_map(); - htsmsg_add_str(out, "id", idnode_uuid_as_str(&dte->dte_id)); + htsmsg_add_str(out, "id", idnode_uuid_as_sstr(&dte->dte_id)); htsmsg_add_u32(out, "enabled", dte->dte_enabled); htsmsg_add_u32(out, "daysOfWeek", dte->dte_weekdays); htsmsg_add_u32(out, "retention", dvr_timerec_get_retention(dte)); @@ -1327,13 +1327,13 @@ htsp_method_epgQuery(htsp_connection_t *htsp, htsmsg_t *in) if (!(ch = channel_find_by_id(u32))) return htsp_error("Channel does not exist"); else - eq.channel = strdup(idnode_uuid_as_str(&ch->ch_id)); + eq.channel = strdup(idnode_uuid_as_sstr(&ch->ch_id)); } if(!(htsmsg_get_u32(in, "tagId", &u32))) { if (!(ct = htsp_channel_tag_find_by_identifier(htsp, u32))) return htsp_error("Channel tag does not exist"); else - eq.channel_tag = strdup(idnode_uuid_as_str(&ct->ct_id)); + eq.channel_tag = strdup(idnode_uuid_as_sstr(&ct->ct_id)); } if (!htsmsg_get_u32(in, "contentType", &u32)) { if(htsp->htsp_version < 6) u32 <<= 4; @@ -1417,6 +1417,7 @@ htsp_dvr_config_name( htsp_connection_t *htsp, const char *config_name ) access_t *perm = htsp->htsp_granted_access; htsmsg_field_t *f; const char *uuid; + static char ubuf[UUID_HEX_SIZE]; lock_assert(&global_lock); @@ -1439,7 +1440,7 @@ htsp_dvr_config_name( htsp_connection_t *htsp, const char *config_name ) if (!cfg && perm->aa_username) tvhlog(LOG_INFO, "htsp", "User '%s' has no valid dvr config in ACL, using default...", perm->aa_username); - return cfg ? idnode_uuid_as_str(&cfg->dvr_id) : NULL; + return cfg ? idnode_uuid_as_str(&cfg->dvr_id, ubuf) : NULL; } /** @@ -1457,7 +1458,7 @@ htsp_method_getDvrConfigs(htsp_connection_t *htsp, htsmsg_t *in) LIST_FOREACH(cfg, &dvrconfigs, config_link) if (cfg->dvr_enabled) { - uuid = idnode_uuid_as_str(&cfg->dvr_id); + uuid = idnode_uuid_as_sstr(&cfg->dvr_id); if (htsp->htsp_granted_access->aa_dvrcfgs) { HTSMSG_FOREACH(f, htsp->htsp_granted_access->aa_dvrcfgs) { if (!(s = htsmsg_field_get_str(f))) @@ -1469,7 +1470,7 @@ htsp_method_getDvrConfigs(htsp_connection_t *htsp, htsmsg_t *in) continue; } c = htsmsg_create_map(); - htsmsg_add_str(c, "uuid", idnode_uuid_as_str(&cfg->dvr_id)); + htsmsg_add_str(c, "uuid", uuid); htsmsg_add_str(c, "name", cfg->dvr_config_name ?: ""); htsmsg_add_str(c, "comment", cfg->dvr_comment ?: ""); htsmsg_add_msg(l, NULL, c); @@ -1773,7 +1774,7 @@ htsp_method_addAutorecEntry(htsp_connection_t *htsp, htsmsg_t *in) out = htsmsg_create_map(); if (dae) { - htsmsg_add_str(out, "id", idnode_uuid_as_str(&dae->dae_id)); + htsmsg_add_str(out, "id", idnode_uuid_as_sstr(&dae->dae_id)); htsmsg_add_u32(out, "success", 1); } else { @@ -1869,7 +1870,7 @@ htsp_method_addTimerecEntry(htsp_connection_t *htsp, htsmsg_t *in) out = htsmsg_create_map(); if (dte) { - htsmsg_add_str(out, "id", idnode_uuid_as_str(&dte->dte_id)); + htsmsg_add_str(out, "id", idnode_uuid_as_sstr(&dte->dte_id)); htsmsg_add_u32(out, "success", 1); } else { @@ -3243,7 +3244,7 @@ htsp_autorec_entry_delete(dvr_autorec_entry_t *dae) return; htsmsg_t *m = htsmsg_create_map(); - htsmsg_add_str(m, "id", idnode_uuid_as_str(&dae->dae_id)); + htsmsg_add_str(m, "id", idnode_uuid_as_sstr(&dae->dae_id)); htsmsg_add_str(m, "method", "autorecEntryDelete"); htsp_async_send(m, HTSP_ASYNC_ON, HTSP_ASYNC_AUX_AUTOREC, dae); } @@ -3296,7 +3297,7 @@ htsp_timerec_entry_delete(dvr_timerec_entry_t *dte) return; htsmsg_t *m = htsmsg_create_map(); - htsmsg_add_str(m, "id", idnode_uuid_as_str(&dte->dte_id)); + htsmsg_add_str(m, "id", idnode_uuid_as_sstr(&dte->dte_id)); htsmsg_add_str(m, "method", "timerecEntryDelete"); htsp_async_send(m, HTSP_ASYNC_ON, HTSP_ASYNC_AUX_TIMEREC, dte); } diff --git a/src/idnode.c b/src/idnode.c index a4c529a5c..b08348e83 100644 --- a/src/idnode.c +++ b/src/idnode.c @@ -47,6 +47,8 @@ static RB_HEAD(,idclass_link) idrootclasses; SKEL_DECLARE(idclasses_skel, idclass_link_t); +char idnode_uuid_static[UUID_HEX_SIZE]; + /* ************************************************************************** * Utilities * *************************************************************************/ @@ -154,7 +156,7 @@ idnode_insert(idnode_t *in, const char *uuid, const idclass_t *class, int flags) uuid, (flags & IDNODE_SHORT_UUID) ? " (short)" : ""); abort(); } - tvhtrace("idnode", "insert node %s", idnode_uuid_as_str(in)); + tvhtrace("idnode", "insert node %s", idnode_uuid_as_sstr(in)); /* Register the class */ idclass_register(class); // Note: we never actually unregister @@ -178,7 +180,7 @@ idnode_unlink(idnode_t *in) lock_assert(&global_lock); RB_REMOVE(&idnodes, in, in_link); RB_REMOVE(in->in_domain, in, in_domain_link); - tvhtrace("idnode", "unlink node %s", idnode_uuid_as_str(in)); + tvhtrace("idnode", "unlink node %s", idnode_uuid_as_sstr(in)); idnode_notify(in, "delete"); } @@ -237,14 +239,10 @@ idnode_get_short_uuid (const idnode_t *in) * */ const char * -idnode_uuid_as_str(const idnode_t *in) +idnode_uuid_as_str(const idnode_t *in, char *uuid) { - static tvh_uuid_t __thread ret[16]; - static uint8_t p = 0; - bin2hex(ret[p].hex, sizeof(ret[p].hex), in->in_uuid, sizeof(in->in_uuid)); - const char *s = ret[p].hex; - p = (p + 1) % 16; - return s; + bin2hex(uuid, UUID_HEX_SIZE, in->in_uuid, sizeof(in->in_uuid)); + return uuid; } /** @@ -258,7 +256,7 @@ idnode_get_title(idnode_t *in, const char *lang) if(ic->ic_get_title != NULL) return ic->ic_get_title(in, lang); } - return idnode_uuid_as_str(in); + return idnode_uuid_as_sstr(in); } @@ -639,7 +637,7 @@ idnode_find_all ( const idclass_t *idc, const idnodes_rb_t *domain ) ic = in->in_class; while (ic) { if (ic == idc) { - tvhtrace("idnode", " add node %s", idnode_uuid_as_str(in)); + tvhtrace("idnode", " add node %s", idnode_uuid_as_sstr(in)); idnode_set_add(is, in, NULL, NULL); break; } @@ -651,7 +649,7 @@ idnode_find_all ( const idclass_t *idc, const idnodes_rb_t *domain ) ic = in->in_class; while (ic) { if (ic == idc) { - tvhtrace("idnode", " add node %s", idnode_uuid_as_str(in)); + tvhtrace("idnode", " add node %s", idnode_uuid_as_sstr(in)); idnode_set_add(is, in, NULL, NULL); break; } @@ -1043,7 +1041,7 @@ idnode_set_as_htsmsg htsmsg_t *l = htsmsg_create_list(); int i; for (i = 0; i < is->is_count; i++) - htsmsg_add_str(l, NULL, idnode_uuid_as_str(is->is_array[i])); + htsmsg_add_str(l, NULL, idnode_uuid_as_sstr(is->is_array[i])); return l; } @@ -1316,7 +1314,7 @@ idnode_serialize0(idnode_t *self, htsmsg_t *list, int optmask, const char *lang) const char *uuid, *s; htsmsg_t *m = htsmsg_create_map(); - uuid = idnode_uuid_as_str(self); + uuid = idnode_uuid_as_sstr(self); htsmsg_add_str(m, "uuid", uuid); htsmsg_add_str(m, "id", uuid); htsmsg_add_str(m, "text", idnode_get_title(self, lang) ?: ""); @@ -1445,7 +1443,7 @@ idnode_list_get1 htsmsg_t *l = htsmsg_create_list(); LIST_FOREACH(ilm, in1_list, ilm_in1_link) - htsmsg_add_str(l, NULL, idnode_uuid_as_str(ilm->ilm_in2)); + htsmsg_add_str(l, NULL, idnode_uuid_as_sstr(ilm->ilm_in2)); return l; } @@ -1457,7 +1455,7 @@ idnode_list_get2 htsmsg_t *l = htsmsg_create_list(); LIST_FOREACH(ilm, in2_list, ilm_in2_link) - htsmsg_add_str(l, NULL, idnode_uuid_as_str(ilm->ilm_in1)); + htsmsg_add_str(l, NULL, idnode_uuid_as_sstr(ilm->ilm_in1)); return l; } @@ -1583,7 +1581,7 @@ void idnode_notify ( idnode_t *in, const char *action ) { const idclass_t *ic = in->in_class; - const char *uuid = idnode_uuid_as_str(in); + const char *uuid = idnode_uuid_as_sstr(in); if (!tvheadend_running) return; @@ -1605,7 +1603,7 @@ void idnode_notify_title_changed (void *in, const char *lang) { htsmsg_t *m = htsmsg_create_map(); - htsmsg_add_str(m, "uuid", idnode_uuid_as_str(in)); + htsmsg_add_str(m, "uuid", idnode_uuid_as_sstr(in)); htsmsg_add_str(m, "text", idnode_get_title(in, lang)); notify_by_msg("title", m); idnode_notify_changed(in); diff --git a/src/idnode.h b/src/idnode.h index 4914d6b20..de0ece45d 100644 --- a/src/idnode.h +++ b/src/idnode.h @@ -160,6 +160,8 @@ typedef struct idnode_filter_ele typedef LIST_HEAD(,idnode_filter_ele) idnode_filter_t; +extern char idnode_uuid_static[UUID_HEX_SIZE]; + void idnode_init(void); void idnode_done(void); @@ -169,7 +171,9 @@ int idnode_insert(idnode_t *in, const char *uuid, const idclass_t *idc, int fla void idnode_unlink(idnode_t *in); uint32_t idnode_get_short_uuid (const idnode_t *in); -const char *idnode_uuid_as_str (const idnode_t *in); +const char *idnode_uuid_as_str (const idnode_t *in, char *buf); +static inline const char *idnode_uuid_as_sstr(const idnode_t *in) + { return idnode_uuid_as_str(in, idnode_uuid_static); } idnode_set_t *idnode_get_childs (idnode_t *in); const char *idnode_get_title (idnode_t *in, const char *lang); int idnode_is_leaf (idnode_t *in); diff --git a/src/input/mpegts/dvb_psi.c b/src/input/mpegts/dvb_psi.c index c3e477294..4c3fb88fe 100644 --- a/src/input/mpegts/dvb_psi.c +++ b/src/input/mpegts/dvb_psi.c @@ -139,7 +139,7 @@ dvb_fs_mux_add ( mpegts_table_t *mt, mpegts_mux_t *mm, mpegts_mux_t *mux ) char *s; int i; - uuid = idnode_uuid_as_str(&mux->mm_id); + uuid = idnode_uuid_as_sstr(&mux->mm_id); if (mm->mm_fastscan_muxes == NULL) mm->mm_fastscan_muxes = calloc(DVB_FASTSCAN_MUXES, UUID_HEX_SIZE); for (i = 0; i < DVB_FASTSCAN_MUXES * UUID_HEX_SIZE; i += UUID_HEX_SIZE) { diff --git a/src/input/mpegts/iptv/iptv.c b/src/input/mpegts/iptv/iptv.c index 787eaa904..0225cecd4 100644 --- a/src/input/mpegts/iptv/iptv.c +++ b/src/input/mpegts/iptv/iptv.c @@ -433,7 +433,7 @@ iptv_network_class_delete ( idnode_t *in ) /* Remove config */ hts_settings_remove("input/iptv/networks/%s", - idnode_uuid_as_str(in)); + idnode_uuid_as_sstr(in)); /* delete */ mpegts_network_delete(mn, 1); @@ -515,7 +515,7 @@ iptv_network_config_save ( mpegts_network_t *mn ) htsmsg_t *c = htsmsg_create_map(); idnode_save(&mn->mn_id, c); hts_settings_save(c, "input/iptv/networks/%s/config", - idnode_uuid_as_str(&mn->mn_id)); + idnode_uuid_as_sstr(&mn->mn_id)); htsmsg_destroy(c); } @@ -550,7 +550,7 @@ iptv_network_create0 /* Load muxes */ if ((c = hts_settings_load_r(1, "input/iptv/networks/%s/muxes", - idnode_uuid_as_str(&in->mn_id)))) { + idnode_uuid_as_sstr(&in->mn_id)))) { htsmsg_field_t *f; htsmsg_t *e; HTSMSG_FOREACH(f, c) { diff --git a/src/input/mpegts/iptv/iptv_mux.c b/src/input/mpegts/iptv/iptv_mux.c index f4f6f5549..d6fdfcd37 100644 --- a/src/input/mpegts/iptv/iptv_mux.c +++ b/src/input/mpegts/iptv/iptv_mux.c @@ -159,11 +159,12 @@ const idclass_t iptv_mux_class = static void iptv_mux_config_save ( mpegts_mux_t *mm ) { + char ubuf[UUID_HEX_SIZE]; htsmsg_t *c = htsmsg_create_map(); mpegts_mux_save(mm, c); hts_settings_save(c, "input/iptv/networks/%s/muxes/%s/config", - idnode_uuid_as_str(&mm->mm_network->mn_id), - idnode_uuid_as_str(&mm->mm_id)); + idnode_uuid_as_sstr(&mm->mm_network->mn_id), + idnode_uuid_as_str(&mm->mm_id, ubuf)); htsmsg_destroy(c); } @@ -172,11 +173,12 @@ iptv_mux_delete ( mpegts_mux_t *mm, int delconf ) { char *url, *url_sane, *muxname; iptv_mux_t *im = (iptv_mux_t*)mm; + char ubuf[UUID_HEX_SIZE]; if (delconf) hts_settings_remove("input/iptv/networks/%s/muxes/%s/config", - idnode_uuid_as_str(&mm->mm_network->mn_id), - idnode_uuid_as_str(&mm->mm_id)); + idnode_uuid_as_sstr(&mm->mm_network->mn_id), + idnode_uuid_as_str(&mm->mm_id, ubuf)); url = im->mm_iptv_url; // Workaround for silly printing error url_sane = im->mm_iptv_url_sane; @@ -212,6 +214,7 @@ iptv_mux_create0 ( iptv_network_t *in, const char *uuid, htsmsg_t *conf ) { htsmsg_t *c, *e; htsmsg_field_t *f; + char ubuf[UUID_HEX_SIZE]; /* Create Mux */ iptv_mux_t *im = @@ -230,8 +233,8 @@ iptv_mux_create0 ( iptv_network_t *in, const char *uuid, htsmsg_t *conf ) /* Services */ c = hts_settings_load_r(1, "input/iptv/networks/%s/muxes/%s/services", - idnode_uuid_as_str(&in->mn_id), - idnode_uuid_as_str(&im->mm_id)); + idnode_uuid_as_sstr(&in->mn_id), + idnode_uuid_as_str(&im->mm_id, ubuf)); if (c) { HTSMSG_FOREACH(f, c) { if (!(e = htsmsg_field_get_map(f))) continue; diff --git a/src/input/mpegts/iptv/iptv_service.c b/src/input/mpegts/iptv/iptv_service.c index cfade5cec..ba1a469d4 100644 --- a/src/input/mpegts/iptv/iptv_service.c +++ b/src/input/mpegts/iptv/iptv_service.c @@ -27,12 +27,14 @@ iptv_service_config_save ( service_t *s ) { mpegts_mux_t *mm = ((mpegts_service_t *)s)->s_dvb_mux; htsmsg_t *c = htsmsg_create_map(); + char ubuf1[UUID_HEX_SIZE]; + char ubuf2[UUID_HEX_SIZE]; service_save(s, c); hts_settings_save(c, "input/iptv/networks/%s/muxes/%s/services/%s", - idnode_uuid_as_str(&mm->mm_network->mn_id), - idnode_uuid_as_str(&mm->mm_id), - idnode_uuid_as_str(&s->s_id)); + idnode_uuid_as_sstr(&mm->mm_network->mn_id), + idnode_uuid_as_str(&mm->mm_id, ubuf1), + idnode_uuid_as_str(&s->s_id, ubuf2)); htsmsg_destroy(c); } @@ -40,13 +42,15 @@ static void iptv_service_delete ( service_t *s, int delconf ) { mpegts_mux_t *mm = ((mpegts_service_t *)s)->s_dvb_mux; + char ubuf1[UUID_HEX_SIZE]; + char ubuf2[UUID_HEX_SIZE]; /* Remove config */ if (delconf) hts_settings_remove("input/iptv/networks/%s/muxes/%s/services/%s", - idnode_uuid_as_str(&mm->mm_network->mn_id), - idnode_uuid_as_str(&mm->mm_id), - idnode_uuid_as_str(&s->s_id)); + idnode_uuid_as_sstr(&mm->mm_network->mn_id), + idnode_uuid_as_str(&mm->mm_id, ubuf1), + idnode_uuid_as_str(&s->s_id, ubuf2)); /* Note - do no pass the delconf flag - another file location */ mpegts_service_delete(s, 0); diff --git a/src/input/mpegts/linuxdvb/linuxdvb_adapter.c b/src/input/mpegts/linuxdvb/linuxdvb_adapter.c index 768944a25..5a1108b2d 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_adapter.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_adapter.c @@ -128,7 +128,7 @@ linuxdvb_adapter_save ( linuxdvb_adapter_t *la ) /* Save */ hts_settings_save(m, "input/linuxdvb/adapters/%s", - idnode_uuid_as_str(&la->th_id)); + idnode_uuid_as_sstr(&la->th_id)); htsmsg_destroy(m); } diff --git a/src/input/mpegts/linuxdvb/linuxdvb_ca.c b/src/input/mpegts/linuxdvb/linuxdvb_ca.c index a668f6d85..5d364871a 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_ca.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_ca.c @@ -904,7 +904,7 @@ void linuxdvb_ca_save( linuxdvb_ca_t *lca, htsmsg_t *msg ) char id[8]; htsmsg_t *m = htsmsg_create_map(); - htsmsg_add_str(m, "uuid", idnode_uuid_as_str(&lca->lca_id)); + htsmsg_add_str(m, "uuid", idnode_uuid_as_sstr(&lca->lca_id)); idnode_save(&lca->lca_id, m); /* Add to list */ diff --git a/src/input/mpegts/linuxdvb/linuxdvb_frontend.c b/src/input/mpegts/linuxdvb/linuxdvb_frontend.c index 2b7417925..03b64d61c 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_frontend.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_frontend.c @@ -1624,11 +1624,11 @@ linuxdvb_frontend_save ( linuxdvb_frontend_t *lfe, htsmsg_t *fe ) /* Save frontend */ mpegts_input_save((mpegts_input_t*)lfe, m); htsmsg_add_str(m, "type", dvb_type2str(lfe->lfe_type)); - htsmsg_add_str(m, "uuid", idnode_uuid_as_str(&lfe->ti_id)); + htsmsg_add_str(m, "uuid", idnode_uuid_as_sstr(&lfe->ti_id)); if (lfe->lfe_satconf) { htsmsg_t *s = htsmsg_create_map(); linuxdvb_satconf_save(lfe->lfe_satconf, s); - htsmsg_add_str(s, "uuid", idnode_uuid_as_str(&lfe->lfe_satconf->ls_id)); + htsmsg_add_str(s, "uuid", idnode_uuid_as_sstr(&lfe->lfe_satconf->ls_id)); htsmsg_add_msg(m, "satconf", s); } diff --git a/src/input/mpegts/linuxdvb/linuxdvb_satconf.c b/src/input/mpegts/linuxdvb/linuxdvb_satconf.c index d478202cf..4e8892b7b 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_satconf.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_satconf.c @@ -967,7 +967,7 @@ linuxdvb_satconf_save ( linuxdvb_satconf_t *ls, htsmsg_t *m ) TAILQ_FOREACH(lse, &ls->ls_elements, lse_link){ e = htsmsg_create_map(); idnode_save(&lse->lse_id, e); - htsmsg_add_str(e, "uuid", idnode_uuid_as_str(&lse->lse_id)); + htsmsg_add_str(e, "uuid", idnode_uuid_as_sstr(&lse->lse_id)); if (lse->lse_lnb) { c = htsmsg_create_map(); idnode_save(&lse->lse_lnb->ld_id, c); @@ -1042,7 +1042,7 @@ linuxdvb_satconf_ele_class_network_set( void *o, const void *p ) TAILQ_FOREACH(lse, &sc->ls_elements, lse_link) { for (i = 0; i < lse->lse_networks->is_count; i++) htsmsg_add_str(l, NULL, - idnode_uuid_as_str(lse->lse_networks->is_array[i])); + idnode_uuid_as_sstr(lse->lse_networks->is_array[i])); } mpegts_input_class_network_set(ls->lse_parent->ls_frontend, l); htsmsg_destroy(l); @@ -1326,9 +1326,8 @@ void linuxdvb_satconf_delete ( linuxdvb_satconf_t *ls, int delconf ) { linuxdvb_satconf_ele_t *lse, *nxt; - const char *uuid = idnode_uuid_as_str(&ls->ls_id); if (delconf) - hts_settings_remove("input/linuxdvb/satconfs/%s", uuid); + hts_settings_remove("input/linuxdvb/satconfs/%s", idnode_uuid_as_sstr(&ls->ls_id)); gtimer_disarm(&ls->ls_diseqc_timer); for (lse = TAILQ_FIRST(&ls->ls_elements); lse != NULL; lse = nxt) { nxt = TAILQ_NEXT(lse, lse_link); diff --git a/src/input/mpegts/mpegts_input.c b/src/input/mpegts/mpegts_input.c index be9bc3ee9..fd62ce439 100644 --- a/src/input/mpegts/mpegts_input.c +++ b/src/input/mpegts/mpegts_input.c @@ -54,7 +54,7 @@ mpegts_input_dbus_notify(mpegts_input_t *mi, int64_t subs) mi->mi_display_name(mi, buf, sizeof(buf)); htsmsg_add_str(msg, NULL, buf); htsmsg_add_s64(msg, NULL, subs); - snprintf(buf, sizeof(buf), "/input/mpegts/%s", idnode_uuid_as_str(&mi->ti_id)); + snprintf(buf, sizeof(buf), "/input/mpegts/%s", idnode_uuid_as_sstr(&mi->ti_id)); dbus_emit_signal(buf, "status", msg); #endif } @@ -80,7 +80,7 @@ mpegts_input_class_network_get ( void *obj ) htsmsg_t *l = htsmsg_create_list(); LIST_FOREACH(mnl, &mi->mi_networks, mnl_mi_link) - htsmsg_add_str(l, NULL, idnode_uuid_as_str(&mnl->mnl_network->mn_id)); + htsmsg_add_str(l, NULL, idnode_uuid_as_sstr(&mnl->mnl_network->mn_id)); return l; } @@ -97,7 +97,7 @@ mpegts_input_class_network_enum ( void *obj, const char *lang ) htsmsg_t *p, *m; p = htsmsg_create_map(); - htsmsg_add_str (p, "uuid", idnode_uuid_as_str((idnode_t*)obj)); + htsmsg_add_str (p, "uuid", idnode_uuid_as_sstr((idnode_t*)obj)); htsmsg_add_bool(p, "enum", 1); m = htsmsg_create_map(); @@ -160,7 +160,7 @@ mpegts_input_class_linked_set ( void *self, const void *val ) mi2 = mpegts_input_find((char *)val); if (mi2) { free(mi2->mi_linked); - mi2->mi_linked = strdup(idnode_uuid_as_str(&mi->ti_id)); + mi2->mi_linked = strdup(idnode_uuid_as_sstr(&mi->ti_id)); } } if (mi2) @@ -179,7 +179,7 @@ mpegts_input_class_linked_get ( void *self ) if (mi->mi_linked) { mi = mpegts_input_find(mi->mi_linked); if (mi) - ptr = idnode_uuid_as_str(&mi->ti_id); + ptr = idnode_uuid_as_sstr(&mi->ti_id); } return &ptr; } @@ -198,13 +198,14 @@ mpegts_input_class_linked_enum( void * self, const char *lang ) { mpegts_input_t *mi = self, *mi2; tvh_input_t *ti; + char ubuf[UUID_HEX_SIZE]; htsmsg_t *m = htsmsg_create_list(); mpegts_input_add_keyval(m, "", tvh_gettext_lang(lang, N_("Not Linked"))); TVH_INPUT_FOREACH(ti) if (idnode_is_instance(&ti->ti_id, &mpegts_input_class)) { mi2 = (mpegts_input_t *)ti; if (mi2 != mi) - mpegts_input_add_keyval(m, idnode_uuid_as_str(&ti->ti_id), + mpegts_input_add_keyval(m, idnode_uuid_as_str(&ti->ti_id, ubuf), idnode_get_title(&mi2->ti_id, lang)); } return m; @@ -1406,7 +1407,7 @@ mpegts_input_stream_status w = MAX(w, ths->ths_weight); } - st->uuid = strdup(idnode_uuid_as_str(&mmi->tii_id)); + st->uuid = strdup(idnode_uuid_as_sstr(&mmi->tii_id)); mi->mi_display_name(mi, buf, sizeof(buf)); st->input_name = strdup(buf); mpegts_mux_nice_name(mm, buf, sizeof(buf)); diff --git a/src/input/mpegts/mpegts_mux.c b/src/input/mpegts/mpegts_mux.c index b446b844d..e77f0cfb5 100644 --- a/src/input/mpegts/mpegts_mux.c +++ b/src/input/mpegts/mpegts_mux.c @@ -359,7 +359,7 @@ mpegts_mux_class_get_network_uuid ( void *ptr ) static char buf[UUID_HEX_SIZE], *s = buf; mpegts_mux_t *mm = ptr; if (mm && mm->mm_network) - strcpy(buf, idnode_uuid_as_str(&mm->mm_network->mn_id) ?: ""); + strcpy(buf, idnode_uuid_as_sstr(&mm->mm_network->mn_id) ?: ""); else *buf = 0; return &s; diff --git a/src/input/mpegts/mpegts_mux_dvb.c b/src/input/mpegts/mpegts_mux_dvb.c index 4a88296a2..7702b1983 100644 --- a/src/input/mpegts/mpegts_mux_dvb.c +++ b/src/input/mpegts/mpegts_mux_dvb.c @@ -662,11 +662,12 @@ const idclass_t dvb_mux_atsc_class = static void dvb_mux_config_save ( mpegts_mux_t *mm ) { + char ubuf[UUID_HEX_SIZE]; htsmsg_t *c = htsmsg_create_map(); mpegts_mux_save(mm, c); hts_settings_save(c, "input/dvb/networks/%s/muxes/%s/config", - idnode_uuid_as_str(&mm->mm_network->mn_id), - idnode_uuid_as_str(&mm->mm_id)); + idnode_uuid_as_sstr(&mm->mm_network->mn_id), + idnode_uuid_as_str(&mm->mm_id, ubuf)); htsmsg_destroy(c); } @@ -713,11 +714,13 @@ dvb_mux_create_instances ( mpegts_mux_t *mm ) static void dvb_mux_delete ( mpegts_mux_t *mm, int delconf ) { + char ubuf[UUID_HEX_SIZE]; + /* Remove config */ if (delconf) hts_settings_remove("input/dvb/networks/%s/muxes/%s", - idnode_uuid_as_str(&mm->mm_network->mn_id), - idnode_uuid_as_str(&mm->mm_id)); + idnode_uuid_as_sstr(&mm->mm_network->mn_id), + idnode_uuid_as_str(&mm->mm_id, ubuf)); /* Delete the mux */ mpegts_mux_delete(mm, delconf); @@ -739,6 +742,7 @@ dvb_mux_create0 htsmsg_t *c, *e; htsmsg_field_t *f; dvb_fe_delivery_system_t delsys; + char ubuf[UUID_HEX_SIZE]; /* Class */ if (ln->ln_type == DVB_TYPE_S) { @@ -788,8 +792,8 @@ dvb_mux_create0 /* Services */ c = hts_settings_load_r(1, "input/dvb/networks/%s/muxes/%s/services", - idnode_uuid_as_str(&ln->mn_id), - idnode_uuid_as_str(&mm->mm_id)); + idnode_uuid_as_sstr(&ln->mn_id), + idnode_uuid_as_str(&mm->mm_id, ubuf)); if (c) { HTSMSG_FOREACH(f, c) { if (!(e = htsmsg_get_map_by_field(f))) continue; diff --git a/src/input/mpegts/mpegts_mux_sched.c b/src/input/mpegts/mpegts_mux_sched.c index 2562df4c9..93cf2ab9e 100644 --- a/src/input/mpegts/mpegts_mux_sched.c +++ b/src/input/mpegts/mpegts_mux_sched.c @@ -299,7 +299,7 @@ mpegts_mux_sched_save ( mpegts_mux_sched_t *mms ) { htsmsg_t *c = htsmsg_create_map(); idnode_save(&mms->mms_id, c); - hts_settings_save(c, "muxsched/%s", idnode_uuid_as_str(&mms->mms_id)); + hts_settings_save(c, "muxsched/%s", idnode_uuid_as_sstr(&mms->mms_id)); htsmsg_destroy(c); } @@ -308,7 +308,7 @@ mpegts_mux_sched_delete ( mpegts_mux_sched_t *mms, int delconf ) { LIST_REMOVE(mms, mms_link); if (delconf) - hts_settings_remove("muxsched/%s", idnode_uuid_as_str(&mms->mms_id)); + hts_settings_remove("muxsched/%s", idnode_uuid_as_sstr(&mms->mms_id)); if (mms->mms_sub) subscription_unsubscribe(mms->mms_sub, 0); gtimer_disarm(&mms->mms_timer); diff --git a/src/input/mpegts/mpegts_network_dvb.c b/src/input/mpegts/mpegts_network_dvb.c index 3feeb9ee4..47007c318 100644 --- a/src/input/mpegts/mpegts_network_dvb.c +++ b/src/input/mpegts/mpegts_network_dvb.c @@ -46,7 +46,7 @@ dvb_network_class_delete ( idnode_t *in ) /* remove config */ hts_settings_remove("input/dvb/networks/%s", - idnode_uuid_as_str(in)); + idnode_uuid_as_sstr(in)); /* Parent delete */ mpegts_network_delete(mn, 1); @@ -394,7 +394,7 @@ dvb_network_config_save ( mpegts_network_t *mn ) idnode_save(&mn->mn_id, c); htsmsg_add_str(c, "class", mn->mn_id.in_class->ic_class); hts_settings_save(c, "input/dvb/networks/%s/config", - idnode_uuid_as_str(&mn->mn_id)); + idnode_uuid_as_sstr(&mn->mn_id)); htsmsg_destroy(c); } diff --git a/src/input/mpegts/mpegts_service.c b/src/input/mpegts/mpegts_service.c index 7e9c659a1..d2d255c11 100644 --- a/src/input/mpegts/mpegts_service.c +++ b/src/input/mpegts/mpegts_service.c @@ -51,7 +51,7 @@ mpegts_service_class_get_mux_uuid ( void *ptr ) static char buf[UUID_HEX_SIZE], *s = buf; mpegts_service_t *ms = ptr; if (ms && ms->s_dvb_mux) - strcpy(buf, idnode_uuid_as_str(&ms->s_dvb_mux->mm_id) ?: ""); + strcpy(buf, idnode_uuid_as_sstr(&ms->s_dvb_mux->mm_id) ?: ""); else *buf = 0; return &s; @@ -243,11 +243,13 @@ mpegts_service_config_save ( service_t *t ) { htsmsg_t *c = htsmsg_create_map(); mpegts_service_t *s = (mpegts_service_t*)t; + char ubuf1[UUID_HEX_SIZE]; + char ubuf2[UUID_HEX_SIZE]; service_save(t, c); hts_settings_save(c, "input/dvb/networks/%s/muxes/%s/services/%s", - idnode_uuid_as_str(&s->s_dvb_mux->mm_network->mn_id), - idnode_uuid_as_str(&s->s_dvb_mux->mm_id), - idnode_uuid_as_str(&s->s_id)); + idnode_uuid_as_sstr(&s->s_dvb_mux->mm_network->mn_id), + idnode_uuid_as_str(&s->s_dvb_mux->mm_id, ubuf1), + idnode_uuid_as_str(&s->s_id, ubuf2)); htsmsg_destroy(c); } @@ -547,13 +549,15 @@ mpegts_service_delete ( service_t *t, int delconf ) { mpegts_service_t *ms = (mpegts_service_t*)t; mpegts_mux_t *mm = ms->s_dvb_mux; + char ubuf1[UUID_HEX_SIZE]; + char ubuf2[UUID_HEX_SIZE]; /* Remove config */ if (delconf && t->s_type == STYPE_STD) hts_settings_remove("input/dvb/networks/%s/muxes/%s/services/%s", - idnode_uuid_as_str(&mm->mm_network->mn_id), - idnode_uuid_as_str(&mm->mm_id), - idnode_uuid_as_str(&t->s_id)); + idnode_uuid_as_sstr(&mm->mm_network->mn_id), + idnode_uuid_as_str(&mm->mm_id, ubuf1), + idnode_uuid_as_str(&t->s_id, ubuf2)); /* Free memory */ free(ms->s_dvb_svcname); diff --git a/src/input/mpegts/satip/satip.c b/src/input/mpegts/satip/satip.c index 33b45110a..765757c21 100644 --- a/src/input/mpegts/satip/satip.c +++ b/src/input/mpegts/satip/satip.c @@ -52,7 +52,7 @@ satip_device_dbus_notify( satip_device_t *sd, const char *sig_name ) htsmsg_add_str(msg, NULL, sd->sd_info.location); htsmsg_add_str(msg, NULL, sd->sd_info.server); htsmsg_add_s64(msg, NULL, sd->sd_info.rtsp_port); - snprintf(buf, sizeof(buf), "/input/mpegts/satip/%s", idnode_uuid_as_str(&sd->th_id)); + snprintf(buf, sizeof(buf), "/input/mpegts/satip/%s", idnode_uuid_as_sstr(&sd->th_id)); dbus_emit_signal(buf, sig_name, msg); #endif } @@ -644,7 +644,7 @@ satip_device_save( satip_device_t *sd ) htsmsg_add_msg(m, "frontends", l); hts_settings_save(m, "input/satip/adapters/%s", - idnode_uuid_as_str(&sd->th_id)); + idnode_uuid_as_sstr(&sd->th_id)); htsmsg_destroy(m); } diff --git a/src/input/mpegts/satip/satip_frontend.c b/src/input/mpegts/satip/satip_frontend.c index e856d2435..99819bbd3 100644 --- a/src/input/mpegts/satip/satip_frontend.c +++ b/src/input/mpegts/satip/satip_frontend.c @@ -936,7 +936,7 @@ satip_frontend_tuning_error ( satip_frontend_t *lfe, satip_tune_req_t *tr ) pthread_mutex_lock(&lfe->sf_dvr_lock); if (lfe->sf_running && lfe->sf_req == tr && (mmi = tr->sf_mmi) != NULL && (mm = mmi->mmi_mux) != NULL) { - strcpy(uuid, idnode_uuid_as_str(&mm->mm_id)); + idnode_uuid_as_str(&mm->mm_id, uuid); pthread_mutex_unlock(&lfe->sf_dvr_lock); mpegts_mux_tuning_error(uuid, mmi); return; @@ -1668,7 +1668,7 @@ satip_frontend_save ( satip_frontend_t *lfe, htsmsg_t *fe ) /* Save frontend */ mpegts_input_save((mpegts_input_t*)lfe, m); htsmsg_add_str(m, "type", dvb_type2str(lfe->sf_type)); - htsmsg_add_str(m, "uuid", idnode_uuid_as_str(&lfe->ti_id)); + htsmsg_add_str(m, "uuid", idnode_uuid_as_sstr(&lfe->ti_id)); if (lfe->ti_id.in_class == &satip_frontend_dvbs_class) { satip_satconf_save(lfe, m); htsmsg_delete_field(m, "networks"); diff --git a/src/input/mpegts/satip/satip_satconf.c b/src/input/mpegts/satip/satip_satconf.c index f95c4ec15..66ebc3af6 100644 --- a/src/input/mpegts/satip/satip_satconf.c +++ b/src/input/mpegts/satip/satip_satconf.c @@ -121,7 +121,7 @@ satip_satconf_class_network_set( void *o, const void *p ) TAILQ_FOREACH(sfc2, &lfe->sf_satconf, sfc_link) { for (i = 0; i < sfc2->sfc_networks->is_count; i++) htsmsg_add_str(l, NULL, - idnode_uuid_as_str(sfc2->sfc_networks->is_array[i])); + idnode_uuid_as_sstr(sfc2->sfc_networks->is_array[i])); } mpegts_input_class_network_set(lfe, l); /* update the slave tuners, too */ diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c index a84b3f486..b2b7e0c39 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c @@ -198,7 +198,7 @@ tvhdhomerun_device_save( tvhdhomerun_device_t *hd ) htsmsg_add_str(m, "fe_override", hd->hd_override_type); hts_settings_save(m, "input/tvhdhomerun/adapters/%s", - idnode_uuid_as_str(&hd->th_id)); + idnode_uuid_as_sstr(&hd->th_id)); htsmsg_destroy(m); } diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c index 0c88758ee..e6e9af976 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c @@ -537,7 +537,7 @@ tvhdhomerun_frontend_save ( tvhdhomerun_frontend_t *hfe, htsmsg_t *fe ) /* Save frontend */ mpegts_input_save((mpegts_input_t*)hfe, m); htsmsg_add_str(m, "type", dvb_type2str(hfe->hf_type)); - htsmsg_add_str(m, "uuid", idnode_uuid_as_str(&hfe->ti_id)); + htsmsg_add_str(m, "uuid", idnode_uuid_as_sstr(&hfe->ti_id)); /* Add to list */ snprintf(id, sizeof(id), "%s #%d", dvb_type2str(hfe->hf_type), hfe->hf_tunerNumber); diff --git a/src/profile.c b/src/profile.c index bf793c343..7f7b8e3e7 100644 --- a/src/profile.c +++ b/src/profile.c @@ -137,7 +137,7 @@ profile_delete(profile_t *pro, int delconf) if (pro->pro_conf_changed) pro->pro_conf_changed(pro); if (delconf) - hts_settings_remove("profile/%s", idnode_uuid_as_str(&pro->pro_id)); + hts_settings_remove("profile/%s", idnode_uuid_as_sstr(&pro->pro_id)); TAILQ_REMOVE(&profiles, pro, pro_link); idnode_unlink(&pro->pro_id); dvr_config_destroy_by_profile(pro, delconf); @@ -155,7 +155,7 @@ profile_class_save ( idnode_t *in ) idnode_save(in, c); if (pro->pro_shield) htsmsg_add_bool(c, "shield", 1); - hts_settings_save(c, "profile/%s", idnode_uuid_as_str(in)); + hts_settings_save(c, "profile/%s", idnode_uuid_as_sstr(in)); htsmsg_destroy(c); if (pro->pro_conf_changed) pro->pro_conf_changed(pro); @@ -452,7 +452,7 @@ profile_find_by_list if (!profile_verify(pro, sflags)) pro = NULL; if (uuids) { - uuid = pro ? idnode_uuid_as_str(&pro->pro_id) : ""; + uuid = pro ? idnode_uuid_as_sstr(&pro->pro_id) : ""; HTSMSG_FOREACH(f, uuids) { uuid2 = htsmsg_field_get_str(f) ?: ""; if (strcmp(uuid, uuid2) == 0 && profile_verify(pro, sflags)) @@ -519,7 +519,7 @@ profile_get_htsp_list(htsmsg_t *array, htsmsg_t *filter) TAILQ_FOREACH(pro, &profiles, pro_link) { if (!pro->pro_work) continue; - uuid = idnode_uuid_as_str(&pro->pro_id); + uuid = idnode_uuid_as_sstr(&pro->pro_id); if (filter) { HTSMSG_FOREACH(f, filter) { if (!(s = htsmsg_field_get_str(f))) diff --git a/src/service.c b/src/service.c index 9e987cb03..e279689a5 100644 --- a/src/service.c +++ b/src/service.c @@ -439,7 +439,7 @@ filter: strncmp(esf->esf_language, st->es_lang, 4)) continue; if (esf->esf_service[0]) { - if (strcmp(esf->esf_service, idnode_uuid_as_str(&t->s_id))) + if (strcmp(esf->esf_service, idnode_uuid_as_sstr(&t->s_id))) continue; if (esf->esf_pid && esf->esf_pid != st->es_pid) continue; diff --git a/src/service_mapper.c b/src/service_mapper.c index 99f026167..fe1c48017 100644 --- a/src/service_mapper.c +++ b/src/service_mapper.c @@ -91,7 +91,7 @@ service_mapper_start ( const service_mapper_conf_t *conf, htsmsg_t *uuids ) if (uuids) { htsmsg_field_t *f; const char *str; - const char *uuid = idnode_uuid_as_str(&s->s_id); + const char *uuid = idnode_uuid_as_sstr(&s->s_id); HTSMSG_FOREACH(f, uuids) { if (!(str = htsmsg_field_get_str(f))) continue; if (!strcmp(str, uuid)) break; @@ -99,7 +99,7 @@ service_mapper_start ( const service_mapper_conf_t *conf, htsmsg_t *uuids ) if (!f) continue; } tvhtrace("service_mapper", "check service %s (%s)", - s->s_nicename, idnode_uuid_as_str(&s->s_id)); + s->s_nicename, idnode_uuid_as_sstr(&s->s_id)); /* Already mapped (or in progress) */ if (s->s_sm_onqueue) continue; diff --git a/src/webui/simpleui.c b/src/webui/simpleui.c index 4a71f664f..d9a8c5024 100644 --- a/src/webui/simpleui.c +++ b/src/webui/simpleui.c @@ -272,7 +272,7 @@ page_simple(http_connection_t *hc, rstatus = val2str(de->de_sched_state, recstatustxt); - htsbuf_qprintf(hq, "", idnode_uuid_as_str(&de->de_id)); + htsbuf_qprintf(hq, "", idnode_uuid_as_sstr(&de->de_id)); htsbuf_qprintf(hq, "%02d:%02d-%02d:%02d  %s", @@ -431,7 +431,7 @@ page_pvrinfo(http_connection_t *hc, const char *remain, void *opaque) htsbuf_qprintf(hq, "Recording status: %s
", rstatus); htsbuf_qprintf(hq, "
", - idnode_uuid_as_str(&de->de_id)); + idnode_uuid_as_sstr(&de->de_id)); switch(de->de_sched_state) { case DVR_SCHEDULED: diff --git a/src/webui/webui.c b/src/webui/webui.c index 6dfdb61b6..9c06dcb97 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -790,7 +790,7 @@ http_dvr_list_playlist(http_connection_t *hc, int pltype) htsbuf_qprintf(hq, "#EXTINF:%"PRItime_t",%s\n", durration, lang_str_get(de->de_title, NULL)); htsbuf_qprintf(hq, "#EXT-X-TARGETDURATION:%"PRItime_t"\n", durration); - uuid = idnode_uuid_as_str(&de->de_id); + uuid = idnode_uuid_as_sstr(&de->de_id); htsbuf_qprintf(hq, "#EXT-X-STREAM-INF:PROGRAM-ID=%s,BANDWIDTH=%d\n", uuid, bandwidth); htsbuf_qprintf(hq, "#EXT-X-PROGRAM-DATE-TIME:%s\n", buf); @@ -841,7 +841,7 @@ http_dvr_playlist(http_connection_t *hc, int pltype, dvr_entry_t *de) htsbuf_qprintf(hq, "#EXTINF:%"PRItime_t",%s\n", durration, lang_str_get(de->de_title, NULL)); htsbuf_qprintf(hq, "#EXT-X-TARGETDURATION:%"PRItime_t"\n", durration); - uuid = idnode_uuid_as_str(&de->de_id); + uuid = idnode_uuid_as_sstr(&de->de_id); htsbuf_qprintf(hq, "#EXT-X-STREAM-INF:PROGRAM-ID=%s,BANDWIDTH=%d\n", uuid, bandwidth); htsbuf_qprintf(hq, "#EXT-X-PROGRAM-DATE-TIME:%s\n", buf);