]> git.sesse.net Git - vlc/blobdiff - src/text/strings.c
Update .pc files for static linking
[vlc] / src / text / strings.c
index 3bc335b629655de2f36d6092bc468a8644d80f3b..0666cfd9b6948609f7354117edd3ac1e2357ac39 100644 (file)
 #include <vlc_input.h>
 #include <vlc_meta.h>
 #include <vlc_playlist.h>
-#include <vlc_aout.h>
+#include <vlc_aout_intf.h>
 
 #include <vlc_strings.h>
 #include <vlc_url.h>
 #include <vlc_charset.h>
+#include <vlc_fs.h>
 #include <libvlc.h>
 #include <errno.h>
 
@@ -738,12 +739,12 @@ char *str_format_meta( vlc_object_t *p_object, const char *string )
                     break;
                 case 's':
                     {
-                        char *lang = NULL;
+                        char *psz_lang = NULL;
                         if( p_input )
-                            lang = var_GetNonEmptyString( p_input, "sub-language" );
-                        if( lang == NULL )
-                            lang = strdup( b_empty_if_na ? "" : "-" );
-                        INSERT_STRING( lang );
+                            psz_lang = var_GetNonEmptyString( p_input, "sub-language" );
+                        if( psz_lang == NULL )
+                            psz_lang = strdup( b_empty_if_na ? "" : "-" );
+                        INSERT_STRING( psz_lang );
                         break;
                     }
                 case 't':
@@ -901,19 +902,21 @@ char *str_format_meta( vlc_object_t *p_object, const char *string )
                 case 'Z':
                     if( p_item )
                     {
-                        char *now_playing = input_item_GetNowPlaying( p_item );
-                        if ( now_playing == NULL )
+                        char *psz_now_playing = input_item_GetNowPlaying( p_item );
+                        if ( psz_now_playing == NULL )
                         {
-                            char *temp = input_item_GetTitleFbName( p_item );
-                            if( !EMPTY_STR( temp ) )
+                            char *psz_temp = input_item_GetTitleFbName( p_item );
+                            char *psz_artist = input_item_GetArtist( p_item );
+                            if( !EMPTY_STR( psz_temp ) )
                             {
-                                INSERT_STRING( temp );
-                                INSERT_STRING_NO_FREE( " - " );
+                                INSERT_STRING( psz_temp );
+                                if ( !EMPTY_STR( psz_artist ) )
+                                    INSERT_STRING_NO_FREE( " - " );
                             }
-                            INSERT_STRING( input_item_GetArtist( p_item ) );
+                            INSERT_STRING( psz_artist );
                         }
                         else
-                            INSERT_STRING( now_playing );
+                            INSERT_STRING( psz_now_playing );
                     }
                     break;
 
@@ -1127,13 +1130,15 @@ char *make_URI (const char *path, const char *scheme)
     else
     if (path[0] != DIR_SEP_CHAR)
     {   /* Relative path: prepend the current working directory */
-        char cwd[PATH_MAX];
+        char *cwd, *ret;
 
-        if (getcwd (cwd, sizeof (cwd)) == NULL) /* FIXME: UTF8? */
+        if ((cwd = vlc_getcwd ()) == NULL)
             return NULL;
-        if (asprintf (&buf, "%s/%s", cwd, path) == -1)
-            return NULL;
-        char *ret = make_URI (buf, scheme);
+        if (asprintf (&buf, "%s"DIR_SEP"%s", cwd, path) == -1)
+            buf = NULL;
+
+        free (cwd);
+        ret = (buf != NULL) ? make_URI (buf, scheme) : NULL;
         free (buf);
         return ret;
     }