summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-08-06 10:25:17 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-08-06 10:25:17 +0100
commitb24a22ba6f9861ae296d7b528110bc35c2bade08 (patch)
tree0da4da43310c198c3cb7d697bb47e9ad545d1f46
parentcf7f7679595cebb33b191406f59830f5466b5f4c (diff)
video - handle null file sets nicely
makes coverity happy
-rw-r--r--src/bin/video.c62
1 files changed, 35 insertions, 27 deletions
diff --git a/src/bin/video.c b/src/bin/video.c
index eb4a056..35d5a63 100644
--- a/src/bin/video.c
+++ b/src/bin/video.c
@@ -634,41 +634,49 @@ video_file_set(Evas_Object *obj, const char *file)
634 evas_object_hide(sd->o_vid); 634 evas_object_hide(sd->o_vid);
635 evas_object_hide(sd->clip); 635 evas_object_hide(sd->clip);
636 eina_stringshare_replace(&(sd->file), file); 636 eina_stringshare_replace(&(sd->file), file);
637 if (!strncasecmp(sd->file, "file:/", 6)) 637 if (sd->file)
638 { 638 {
639 Efreet_Uri *uri = efreet_uri_decode(sd->file); 639 if (!strncasecmp(sd->file, "file:/", 6))
640 if (uri)
641 { 640 {
642 realfile = ecore_file_realpath(uri->path); 641 Efreet_Uri *uri = efreet_uri_decode(sd->file);
643 efreet_uri_free(uri); 642 if (uri)
643 {
644 realfile = ecore_file_realpath(uri->path);
645 efreet_uri_free(uri);
646 }
644 } 647 }
645 } 648 else if ((!strncasecmp(sd->file, "http:/", 6)) ||
646 else if ((!strncasecmp(sd->file, "http:/", 6)) || 649 (!strncasecmp(sd->file, "https:/", 7)))
647 (!strncasecmp(sd->file, "https:/", 7))) 650 realfile = strdup(sd->file);
648 realfile = strdup(sd->file); 651 else
649 else 652 realfile = ecore_file_realpath(sd->file);
650 realfile = ecore_file_realpath(sd->file); 653 eina_stringshare_replace(&(sd->realfile), realfile);
651 eina_stringshare_replace(&(sd->realfile), realfile); 654 free(realfile);
652 free(realfile); 655 eina_stringshare_replace(&(sd->artfile), NULL);
653 eina_stringshare_replace(&(sd->artfile), NULL); 656 emotion_object_file_set(sd->o_vid, sd->file);
654 emotion_object_file_set(sd->o_vid, sd->file); 657 video_position_set(obj, 0.0);
655 video_position_set(obj, 0.0); 658 if (sd->doart)
656 if ((sd->file) && (sd->doart))
657 {
658 const char *extn = strchr(sd->file, '.');
659 if (extn)
660 { 659 {
661 if ((!strcasecmp(extn, ".mp3")) || 660 const char *extn = strchr(sd->file, '.');
662 (!strcasecmp(extn, ".m4a")) || 661 if (extn)
663 (!strcasecmp(extn, ".oga")) ||
664 (!strcasecmp(extn, ".aac")) ||
665 (!strcasecmp(extn, ".flac")) ||
666 (!strcasecmp(extn, ".wav")))
667 { 662 {
668 _art_check(obj); 663 if ((!strcasecmp(extn, ".mp3")) ||
664 (!strcasecmp(extn, ".m4a")) ||
665 (!strcasecmp(extn, ".oga")) ||
666 (!strcasecmp(extn, ".aac")) ||
667 (!strcasecmp(extn, ".flac")) ||
668 (!strcasecmp(extn, ".wav")))
669 {
670 _art_check(obj);
671 }
669 } 672 }
670 } 673 }
671 } 674 }
675 else
676 {
677 eina_stringshare_replace(&(sd->realfile), NULL);
678 eina_stringshare_replace(&(sd->artfile), NULL);
679 }
672} 680}
673 681
674const char * 682const char *