diff --git a/src/bin/media.c b/src/bin/media.c index 91f01fb9..3e78ac3c 100644 --- a/src/bin/media.c +++ b/src/bin/media.c @@ -1501,14 +1501,14 @@ media_get(const Evas_Object *obj) } Media_Type -media_src_type_get(const char *src) +media_src_type_get(const char *src, size_t len) { Media_Type type = MEDIA_TYPE_UNKNOWN; - if (_is_fmt(src, extn_img)) type = MEDIA_TYPE_IMG; - else if (_is_fmt(src, extn_scale)) type = MEDIA_TYPE_SCALE; - else if (_is_fmt(src, extn_edj)) type = MEDIA_TYPE_EDJE; - else if (_is_fmt(src, extn_mov)) type = MEDIA_TYPE_MOV; + if (extn_matches(src, len, extn_img)) type = MEDIA_TYPE_IMG; + else if (extn_matches(src, len, extn_scale)) type = MEDIA_TYPE_SCALE; + else if (extn_matches(src, len, extn_edj)) type = MEDIA_TYPE_EDJE; + else if (extn_matches(src, len, extn_mov)) type = MEDIA_TYPE_MOV; return type; } diff --git a/src/bin/media.h b/src/bin/media.h index 5f33cd47..76df6e5e 100644 --- a/src/bin/media.h +++ b/src/bin/media.h @@ -36,7 +36,7 @@ void media_volume_set(Evas_Object *obj, double vol); void media_visualize_set(Evas_Object *obj, Eina_Bool visualize); void media_stop(Evas_Object *obj); const char *media_get(const Evas_Object *obj); -Media_Type media_src_type_get(const char *src); +Media_Type media_src_type_get(const char *src, size_t len); Evas_Object *media_control_get(const Evas_Object *obj); void media_unknown_handle(const char *handler, const char *src); diff --git a/src/bin/options_background.c b/src/bin/options_background.c index 541f5800..57023d48 100644 --- a/src/bin/options_background.c +++ b/src/bin/options_background.c @@ -185,7 +185,7 @@ _grid_content_get(void *data, Evas_Object *obj, const char *part) if (extn_matches(item->path, len, extn_edj)) return media_add(obj, item->path, config, MEDIA_BG, MEDIA_TYPE_EDJE); - type = media_src_type_get(item->path); + type = media_src_type_get(item->path, len); return media_add(obj, item->path, config, MEDIA_THUMB, type); } else diff --git a/src/bin/termio.c b/src/bin/termio.c index 2af0008a..b247ab3f 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -788,7 +788,8 @@ _activate_link(Evas_Object *obj, Eina_Bool may_inline) escaped = ecore_file_escape_name(path); if (escaped) { - Media_Type type = media_src_type_get(path); + size_t len = strlen(path); + Media_Type type = media_src_type_get(path, len); if (may_inline && _should_inline(obj)) { if ((type == MEDIA_TYPE_IMG) || @@ -839,7 +840,8 @@ _activate_link(Evas_Object *obj, Eina_Bool may_inline) escaped = ecore_file_escape_name(s); if (escaped) { - Media_Type type = media_src_type_get(link); + size_t len = strlen(link); + Media_Type type = media_src_type_get(link, len); if (may_inline && _should_inline(obj)) { evas_object_smart_callback_call(obj, "popup", NULL); @@ -1345,7 +1347,8 @@ _cb_link_down(void *data, if (sd->config->helper.inline_please) { - Media_Type type = media_src_type_get(raw_link); + size_t len = strlen(raw_link); + Media_Type type = media_src_type_get(raw_link, len); if ((type == MEDIA_TYPE_IMG) || (type == MEDIA_TYPE_SCALE) || @@ -1820,7 +1823,7 @@ _smart_media_clicked(void *data, Evas_Object *obj, void *_info EINA_UNUSED) { if (blk->link) { - Media_Type type = media_src_type_get(blk->link); + Media_Type type = media_src_type_get(blk->link, strlen(blk->link)); Config *config = termio_config_get(data); if (config) @@ -2429,7 +2432,7 @@ _block_media_activate(Evas_Object *obj, Termblock *blk) else media |= MEDIA_RECOVER | MEDIA_SAVE; - type = media_src_type_get(blk->path); + type = media_src_type_get(blk->path, strlen(blk->path)); blk->obj = media_add(obj, blk->path, sd->config, media, type); if (type == MEDIA_TYPE_MOV) diff --git a/src/bin/win.c b/src/bin/win.c index 7a747ced..3512a8ed 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -5749,8 +5749,9 @@ _popmedia_unknown(Term *term, const char *src, Eina_Bool from_user_interaction) { Media_Type type; Config *config = termio_config_get(term->termio); + size_t len = strlen(src); - type = media_src_type_get(src); + type = media_src_type_get(src, len); if (type == MEDIA_TYPE_UNKNOWN) { #ifdef HAVE_ECORE_CON_URL_HEAD @@ -6907,7 +6908,8 @@ _term_media_update(Term *term, const Config *config) _cb_media_del); evas_object_del(term->media); } - type = media_src_type_get(config->background); + type = media_src_type_get(config->background, + strlen(config->background)); term->media = o = media_add(term->wn->win, config->background, config, MEDIA_BG, type);